FreeINCHI:
  145|    288|{
  146|    288|    if (!out)
  ------------------
  |  Branch (146:9): [True: 0, False: 288]
  ------------------
  147|      0|    {
  148|      0|        return;
  149|      0|    }
  150|       |
  151|    288|    if (out->szInChI)
  ------------------
  |  Branch (151:9): [True: 80, False: 208]
  ------------------
  152|     80|    {
  153|     80|        inchi_free( out->szInChI );
  ------------------
  |  | 1136|     80|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 80, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  154|     80|    }
  155|    288|    if (out->szLog)
  ------------------
  |  Branch (155:9): [True: 227, False: 61]
  ------------------
  156|    227|    {
  157|    227|        inchi_free( out->szLog );
  ------------------
  |  | 1136|    227|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 227, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  158|    227|    }
  159|    288|    if (out->szMessage)
  ------------------
  |  Branch (159:9): [True: 227, False: 61]
  ------------------
  160|    227|    {
  161|    227|        inchi_free( out->szMessage );
  ------------------
  |  | 1136|    227|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 227, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  162|    227|    }
  163|       |
  164|    288|    memset( out, 0, sizeof( *out ) );
  165|    288|}
FreeStructFromINCHI:
  200|    288|{
  201|    288|    if (!out)
  ------------------
  |  Branch (201:9): [True: 0, False: 288]
  ------------------
  202|      0|    {
  203|      0|        return;
  204|      0|    }
  205|       |
  206|    288|    if (out->atom)
  ------------------
  |  Branch (206:9): [True: 31, False: 257]
  ------------------
  207|     31|    {
  208|     31|        inchi_free( out->atom );
  ------------------
  |  | 1136|     31|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 31, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  209|     31|    }
  210|    288|    if (out->stereo0D)
  ------------------
  |  Branch (210:9): [True: 0, False: 288]
  ------------------
  211|      0|    {
  212|      0|        inchi_free( out->stereo0D );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  213|      0|    }
  214|    288|    if (out->szLog)
  ------------------
  |  Branch (214:9): [True: 227, False: 61]
  ------------------
  215|    227|    {
  216|    227|        inchi_free( out->szLog );
  ------------------
  |  | 1136|    227|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 227, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  217|    227|    }
  218|    288|    if (out->szMessage)
  ------------------
  |  Branch (218:9): [True: 227, False: 61]
  ------------------
  219|    227|    {
  220|    227|        inchi_free( out->szMessage );
  ------------------
  |  | 1136|    227|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 227, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  221|    227|    }
  222|       |
  223|    288|    memset( out, 0, sizeof( *out ) );
  224|    288|}
CheckINCHI:
  821|    576|{
  822|    576|    int ret = INCHI_VALID_NON_STANDARD;
  823|    576|    int ret_i2i;
  824|    576|    inchi_InputINCHI    inchi_inp;
  825|    576|    inchi_Output        inchi_out;
  826|    576|    size_t slen, pos_slash1 = 0;
  827|    576|    char *str = NULL;
  828|    576|    size_t i;
  829|    576|    size_t slen0;
  830|    576|    char pp;
  831|       |
  832|       |    /* .. non-empty */
  833|    576|    if (szINCHI == NULL)
  ------------------
  |  Branch (833:9): [True: 0, False: 576]
  ------------------
  834|      0|    {
  835|      0|        return INCHI_INVALID_PREFIX;
  836|      0|    }
  837|       |
  838|    576|    slen = strlen( szINCHI );
  839|       |
  840|       |
  841|       |    /* .. has valid prefix */
  842|    576|    if (slen < LEN_INCHI_STRING_PREFIX + 3)
  ------------------
  |  |  767|    576|#define LEN_INCHI_STRING_PREFIX 6
  ------------------
  |  Branch (842:9): [True: 6, False: 570]
  ------------------
  843|      6|    {
  844|      6|        return INCHI_INVALID_PREFIX;
  845|      6|    }
  846|    570|    if (memcmp( szINCHI, INCHI_STRING_PREFIX, LEN_INCHI_STRING_PREFIX ))
  ------------------
  |  |  766|    570|#define INCHI_STRING_PREFIX "InChI="
  ------------------
                  if (memcmp( szINCHI, INCHI_STRING_PREFIX, LEN_INCHI_STRING_PREFIX ))
  ------------------
  |  |  767|    570|#define LEN_INCHI_STRING_PREFIX 6
  ------------------
  |  Branch (846:9): [True: 4, False: 566]
  ------------------
  847|      4|    {
  848|      4|        return INCHI_INVALID_PREFIX;
  849|      4|    }
  850|       |
  851|       |    /* .. has InChI version 1 */
  852|       |    /* if (!isdigit(szINCHI[LEN_INCHI_STRING_PREFIX]) )  */
  853|    566|    if (szINCHI[LEN_INCHI_STRING_PREFIX] != '1')
  ------------------
  |  |  767|    566|#define LEN_INCHI_STRING_PREFIX 6
  ------------------
  |  Branch (853:9): [True: 0, False: 566]
  ------------------
  854|      0|    {
  855|      0|        return INCHI_INVALID_VERSION;
  856|      0|    }
  857|       |
  858|       |    /* .. optionally has a 'standard' flag character */
  859|    566|    pos_slash1 = LEN_INCHI_STRING_PREFIX + 1;
  ------------------
  |  |  767|    566|#define LEN_INCHI_STRING_PREFIX 6
  ------------------
  860|    566|    if (szINCHI[pos_slash1] == 'S')
  ------------------
  |  Branch (860:9): [True: 0, False: 566]
  ------------------
  861|      0|    {
  862|       |        /* Standard InChI ==> standard InChIKey */
  863|      0|        ret = INCHI_VALID_STANDARD;
  864|      0|        pos_slash1++;
  865|      0|    }
  866|    566|    else if (szINCHI[pos_slash1] == 'B')
  ------------------
  |  Branch (866:14): [True: 0, False: 566]
  ------------------
  867|      0|    {
  868|       |        /* Beta version InChI ==> non-standard */
  869|      0|        ret = INCHI_VALID_BETA;
  870|      0|        pos_slash1++;
  871|      0|    }
  872|       |
  873|       |    /* .. has trailing slash in the right place */
  874|    566|    if (szINCHI[pos_slash1] != '/')
  ------------------
  |  Branch (874:9): [True: 0, False: 566]
  ------------------
  875|      0|    {
  876|      0|        return INCHI_INVALID_LAYOUT;
  877|      0|    }
  878|       |
  879|       |    /* .. the rest of source string contains valid literals */
  880|       |
  881|       |
  882|       |    /* adjust line len so we not check trailing whitespaces */
  883|    566|    i = slen - 1;
  884|  60.9k|    while (isspace(UCINT szINCHI[i--])) slen--;
  885|       |
  886|       |    /* Treat possible SaveOpt letters  */
  887|    566|    slen0 = slen;
  888|    566|    if (( szINCHI[slen - 3] == '\\' ) &&
  ------------------
  |  Branch (888:9): [True: 10, False: 556]
  ------------------
  889|    566|        ( szINCHI[slen - 2] >= 'A' ) && ( szINCHI[slen - 2] <= 'Z' ) &&
  ------------------
  |  Branch (889:9): [True: 10, False: 0]
  |  Branch (889:41): [True: 10, False: 0]
  ------------------
  890|    566|        ( szINCHI[slen - 1] >= 'A' ) && ( szINCHI[slen - 1] <= 'Z' )
  ------------------
  |  Branch (890:9): [True: 10, False: 0]
  |  Branch (890:41): [True: 10, False: 0]
  ------------------
  891|    566|        )
  892|     10|    {
  893|     10|        slen0 = slen - 3;
  894|     10|    }
  895|       |
  896|    566|    int prev_is_slash = 1;
  897|  4.91M|    for (i = pos_slash1 + 1; i < slen0; i++)
  ------------------
  |  Branch (897:30): [True: 4.91M, False: 454]
  ------------------
  898|  4.91M|    {
  899|  4.91M|        pp = szINCHI[i];
  900|  4.91M|#if ( FIX_GAF_2020_GENERIC==1 )
  901|  4.91M|        if (prev_is_slash)
  ------------------
  |  Branch (901:13): [True: 53.1k, False: 4.85M]
  ------------------
  902|  53.1k|        {
  903|       |            /* After slash: */
  904|  53.1k|            if (pp == '0')
  ------------------
  |  Branch (904:17): [True: 0, False: 53.1k]
  ------------------
  905|      0|            {
  906|       |                /* '0' is never allowed */
  907|      0|                return INCHI_INVALID_LAYOUT;
  908|      0|            }
  909|  53.1k|            if (i > pos_slash1 + 1)
  ------------------
  |  Branch (909:17): [True: 52.6k, False: 566]
  ------------------
  910|  52.6k|            {
  911|       |                /* Not in main formula layer... */ 
  912|  52.6k|                if (!islower(pp))
  ------------------
  |  Branch (912:21): [True: 50, False: 52.5k]
  ------------------
  913|     50|                {
  914|       |                    /* only lowercase letters are allowed */
  915|     50|                    return INCHI_INVALID_LAYOUT;
  916|     50|                }
  917|  52.6k|            }
  918|  53.1k|        }
  919|  4.91M|        prev_is_slash = (pp != '/') ? 0 : 1;
  ------------------
  |  Branch (919:25): [True: 4.85M, False: 52.6k]
  ------------------
  920|  4.91M|#endif
  921|  4.91M|        if (pp >= 'A' && pp <= 'Z')   continue;
  ------------------
  |  Branch (921:13): [True: 3.63M, False: 1.27M]
  |  Branch (921:26): [True: 63.2k, False: 3.56M]
  ------------------
  922|  4.84M|        if (pp >= 'a' && pp <= 'z')   continue;
  ------------------
  |  Branch (922:13): [True: 3.56M, False: 1.27M]
  |  Branch (922:26): [True: 3.56M, False: 0]
  ------------------
  923|  1.27M|        if (pp >= '0' && pp <= '9')  continue;
  ------------------
  |  Branch (923:13): [True: 617k, False: 660k]
  |  Branch (923:26): [True: 569k, False: 48.3k]
  ------------------
  924|   709k|        switch (pp)
  925|   709k|        {
  926|   292k|            case '(': case ')':
  ------------------
  |  Branch (926:13): [True: 158k, False: 550k]
  |  Branch (926:23): [True: 134k, False: 574k]
  ------------------
  927|   296k|            case '*': case '+':
  ------------------
  |  Branch (927:13): [True: 2.08k, False: 707k]
  |  Branch (927:23): [True: 1.45k, False: 707k]
  ------------------
  928|   603k|            case ',': case '-':
  ------------------
  |  Branch (928:13): [True: 187k, False: 521k]
  |  Branch (928:23): [True: 119k, False: 589k]
  ------------------
  929|   660k|            case '.': case '/':
  ------------------
  |  Branch (929:13): [True: 4.42k, False: 704k]
  |  Branch (929:23): [True: 52.6k, False: 656k]
  ------------------
  930|   660k|#if ( FIX_GAF_2020_GENERIC==1 )
  931|   709k|            case ';': case '?':     continue;
  ------------------
  |  Branch (931:13): [True: 48.2k, False: 660k]
  |  Branch (931:23): [True: 68, False: 709k]
  ------------------
  932|       |#else
  933|       |            case ';': case '=':
  934|       |            case '?': case '@':     continue;
  935|       |#endif
  936|     62|            default:            return INCHI_INVALID_LAYOUT;
  ------------------
  |  Branch (936:13): [True: 62, False: 709k]
  ------------------
  937|   709k|        }
  938|   709k|    }
  939|       |
  940|    454|    if (strict)
  ------------------
  |  Branch (940:9): [True: 0, False: 454]
  ------------------
  941|      0|    {
  942|      0|        char opts[] = "?FixedH ?RecMet ?SUU ?SLUUD";
  943|      0|        extract_inchi_substring( &str, szINCHI, slen );
  944|      0|        if (NULL == str)
  ------------------
  |  Branch (944:13): [True: 0, False: 0]
  ------------------
  945|      0|        {
  946|      0|            ret = INCHI_FAIL_I2I;
  947|      0|            goto fin;
  948|      0|        }
  949|       |
  950|      0|        inchi_inp.szInChI = str;
  951|      0|        opts[0] = opts[8] = opts[16] = opts[21] = INCHI_OPTION_PREFX;
  ------------------
  |  |  255|      0|#define   INCHI_OPTION_PREFX  '-'
  ------------------
  952|      0|        inchi_inp.szOptions = opts;
  953|       |
  954|      0|        ret_i2i = GetINCHIfromINCHI( &inchi_inp, &inchi_out );
  955|       |
  956|      0|        if (( ( ret_i2i != inchi_Ret_OKAY ) && ( ret_i2i != inchi_Ret_WARNING ) ) || !inchi_out.szInChI)
  ------------------
  |  Branch (956:15): [True: 0, False: 0]
  |  Branch (956:48): [True: 0, False: 0]
  |  Branch (956:86): [True: 0, False: 0]
  ------------------
  957|      0|        {
  958|      0|            ret = INCHI_FAIL_I2I;
  959|      0|        }
  960|      0|        else
  961|      0|        {
  962|      0|            if (strcmp( inchi_inp.szInChI, inchi_out.szInChI ))
  ------------------
  |  Branch (962:17): [True: 0, False: 0]
  ------------------
  963|      0|            {
  964|      0|                ret = INCHI_FAIL_I2I;
  965|      0|            }
  966|      0|        }
  967|      0|    }
  968|       |
  969|    454|fin:if (strict)
  ------------------
  |  Branch (969:9): [True: 0, False: 454]
  ------------------
  970|      0|{
  971|      0|    if (NULL != str)
  ------------------
  |  Branch (971:9): [True: 0, False: 0]
  ------------------
  972|      0|        inchi_free( str );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  973|      0|}
  974|       |
  975|    454|    return ret;
  976|    454|}
parse_options_string:
 1024|    576|{
 1025|    576|    char    *p;
 1026|    576|    char    *pArgCurChar;
 1027|    576|    int      bInsideQuotes;
 1028|    576|    int      bCopyCharToArg;
 1029|    576|    int      nNumBackSlashes;
 1030|    576|    int      i;
 1031|       |
 1032|    576|    i = 0;
 1033|    576|    argv[i++] = ""; /* zeroth argument is not used */
 1034|    576|    p = cmd;
 1035|    576|    bInsideQuotes = 0;
 1036|       |
 1037|       |    /* arguments, one by one */
 1038|  1.15k|    while (i < maxargs - 1)
  ------------------
  |  Branch (1038:12): [True: 1.15k, False: 0]
  ------------------
 1039|  1.15k|    {
 1040|       |        /* bypass spaces */
 1041|  1.72k|        while (*p == ' ' || *p == '\t')
  ------------------
  |  Branch (1041:16): [True: 576, False: 1.15k]
  |  Branch (1041:29): [True: 0, False: 1.15k]
  ------------------
 1042|    576|        {
 1043|    576|            p++;
 1044|    576|        }
 1045|  1.15k|        if (!*p)
  ------------------
  |  Branch (1045:13): [True: 576, False: 576]
  ------------------
 1046|    576|        {
 1047|    576|            break;
 1048|    576|        }
 1049|       |
 1050|       |        /* scan an argument */
 1051|    576|        argv[i++] = pArgCurChar = p;     /* store preliminary ptr to arg */
 1052|       |
 1053|  7.77k|        while (1)
  ------------------
  |  Branch (1053:16): [Folded - Ignored]
  ------------------
 1054|  7.77k|        {
 1055|  7.77k|            bCopyCharToArg = 1;
 1056|  7.77k|            nNumBackSlashes = 0;
 1057|  7.77k|            while (*p == '\\')
  ------------------
  |  Branch (1057:20): [True: 0, False: 7.77k]
  ------------------
 1058|      0|            {
 1059|      0|                ++p;
 1060|      0|                ++nNumBackSlashes;
 1061|      0|            }
 1062|       |
 1063|       |            /* each pair of backslashes => one backslash; one more backslash => literal quote */
 1064|  7.77k|            if (*p == '\"')
  ------------------
  |  Branch (1064:17): [True: 0, False: 7.77k]
  ------------------
 1065|      0|            {
 1066|       |                /* one " found */
 1067|      0|                if (nNumBackSlashes % 2 == 0)
  ------------------
  |  Branch (1067:21): [True: 0, False: 0]
  ------------------
 1068|      0|                {
 1069|      0|                    if (bInsideQuotes)
  ------------------
  |  Branch (1069:25): [True: 0, False: 0]
  ------------------
 1070|      0|                    {
 1071|      0|                        if (*( p + 1 ) == '\"')
  ------------------
  |  Branch (1071:29): [True: 0, False: 0]
  ------------------
 1072|      0|                        {
 1073|      0|                            p++;
 1074|      0|                        }
 1075|      0|                        else
 1076|      0|                        {
 1077|      0|                            bCopyCharToArg = 0;
 1078|      0|                        }
 1079|      0|                    }
 1080|      0|                    else
 1081|      0|                    {
 1082|      0|                        bCopyCharToArg = 0;
 1083|      0|                    }
 1084|      0|                    bInsideQuotes = !bInsideQuotes;
 1085|      0|                }
 1086|      0|                nNumBackSlashes /= 2;          /* divide nNumBackSlashes by two */
 1087|      0|            }
 1088|  7.77k|            while (nNumBackSlashes--)
  ------------------
  |  Branch (1088:20): [True: 0, False: 7.77k]
  ------------------
 1089|      0|            {
 1090|      0|                *pArgCurChar++ = '\\';
 1091|      0|            }
 1092|  7.77k|            if (!*p)
  ------------------
  |  Branch (1092:17): [True: 576, False: 7.20k]
  ------------------
 1093|    576|            {
 1094|    576|                break;
 1095|    576|            }
 1096|  7.20k|            if (!bInsideQuotes && ( *p == ' ' || *p == '\t' ))
  ------------------
  |  Branch (1096:17): [True: 7.20k, False: 0]
  |  Branch (1096:37): [True: 0, False: 7.20k]
  |  Branch (1096:50): [True: 0, False: 7.20k]
  ------------------
 1097|      0|            {
 1098|      0|                p++;
 1099|       |                /* move to the next char because this char may become
 1100|       |                 * zero due to  *pArgCurChar++ = '\0'; line below */
 1101|      0|                break;
 1102|      0|            }
 1103|  7.20k|            if (bCopyCharToArg)
  ------------------
  |  Branch (1103:17): [True: 7.20k, False: 0]
  ------------------
 1104|  7.20k|            {
 1105|  7.20k|                *pArgCurChar++ = *p;
 1106|  7.20k|            }
 1107|  7.20k|            ++p;
 1108|  7.20k|        }
 1109|    576|        *pArgCurChar++ = '\0';  /* argument zero termination */
 1110|    576|    }
 1111|       |
 1112|       |    /* The last argument is NULL */
 1113|    576|    argv[i] = NULL;
 1114|       |
 1115|    576|    return i;
 1116|    576|}
InpAtom0DToInchiAtom:
 1655|     31|{
 1656|     31|    int num_stereo_centers, num_stereo_bonds, num_inp_stereo0D, i, m, m1, m2, n, ret = 0;
 1657|       |
 1658|       |    /* count stereobonds, allenes. cumulenes. and stereoatoms */
 1659|     31|    num_stereo_centers = num_stereo_bonds = ret = 0;
 1660|       |
 1661|     31|    *atom = NULL;
 1662|     31|    *num_atoms = 0;
 1663|     31|    *stereo0D = NULL;
 1664|     31|    *num_stereo0D = 0;
 1665|       |
 1666|  53.5k|    for (i = 0; i < num_inp_atoms; i++)
  ------------------
  |  Branch (1666:17): [True: 53.4k, False: 31]
  ------------------
 1667|  53.4k|    {
 1668|  53.4k|        if (at[i].p_parity)
  ------------------
  |  Branch (1668:13): [True: 0, False: 53.4k]
  ------------------
 1669|      0|        {
 1670|       |            /* stereocenter */
 1671|      0|            num_stereo_centers++;
 1672|      0|        }
 1673|  53.4k|        else
 1674|  53.4k|        {
 1675|  53.4k|            for (m = 0; m < MAX_NUM_STEREO_BONDS && at[i].sb_parity[m]; m++)
  ------------------
  |  |  876|   106k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (1675:25): [True: 53.4k, False: 0]
  |  Branch (1675:53): [True: 0, False: 53.4k]
  ------------------
 1676|      0|            {
 1677|      0|                ;
 1678|      0|            }
 1679|  53.4k|            num_stereo_bonds += m;
 1680|  53.4k|        }
 1681|  53.4k|    }
 1682|       |
 1683|     31|    num_stereo_bonds /= 2;
 1684|     31|    num_inp_stereo0D = num_stereo_bonds + num_stereo_centers;
 1685|       |
 1686|     31|    if (num_inp_atoms > 0)
  ------------------
  |  Branch (1686:9): [True: 31, False: 0]
  ------------------
 1687|     31|    {
 1688|     31|        *atom = (inchi_Atom *) inchi_calloc( num_inp_atoms, sizeof( ( *atom )[0] ) );
  ------------------
  |  | 1133|     31|#define inchi_calloc   calloc
  ------------------
 1689|     31|    }
 1690|       |
 1691|     31|    *num_atoms = num_inp_atoms;
 1692|       |
 1693|     31|    if (num_inp_stereo0D > 0)
  ------------------
  |  Branch (1693:9): [True: 0, False: 31]
  ------------------
 1694|      0|    {
 1695|      0|        *stereo0D = (inchi_Stereo0D *) inchi_calloc( num_inp_stereo0D, sizeof( ( *stereo0D )[0] ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 1696|      0|    }
 1697|       |
 1698|     31|    if (num_inp_atoms && !( *atom ) || num_inp_stereo0D > 0 && !( *stereo0D ))
  ------------------
  |  Branch (1698:9): [True: 31, False: 0]
  |  Branch (1698:26): [True: 0, False: 31]
  |  Branch (1698:40): [True: 0, False: 31]
  |  Branch (1698:64): [True: 0, False: 0]
  ------------------
 1699|      0|    {
 1700|       |        /* allocation failed */
 1701|      0|        ret = -1;
 1702|      0|        goto exit_function;
 1703|      0|    }
 1704|       |
 1705|       |    /* copy atom properties */
 1706|  53.5k|    for (i = 0; i < num_inp_atoms; i++)
  ------------------
  |  Branch (1706:17): [True: 53.4k, False: 31]
  ------------------
 1707|  53.4k|    {
 1708|  53.4k|        ( *atom )[i].num_bonds = at[i].valence;
 1709|  53.5k|        for (m = 0; m < at[i].valence; m++)
  ------------------
  |  Branch (1709:21): [True: 24, False: 53.4k]
  ------------------
 1710|     24|        {
 1711|     24|            ( *atom )[i].bond_type[m] = at[i].bond_type[m];
 1712|     24|            ( *atom )[i].neighbor[m] = at[i].neighbor[m];
 1713|     24|        }
 1714|  53.4k|        ( *atom )[i].charge = at[i].charge;
 1715|  53.4k|        memcpy( ( *atom )[i].elname, at[i].elname, ATOM_EL_LEN );
  ------------------
  |  |   99|  53.4k|#define ATOM_EL_LEN               6 /* length of ASCIIZ element symbol field        */
  ------------------
 1716|  53.4k|        if (at[i].iso_atw_diff)
  ------------------
  |  Branch (1716:13): [True: 15, False: 53.4k]
  ------------------
 1717|     15|        {
 1718|     15|            ( *atom )[i].isotopic_mass = ISOTOPIC_SHIFT_FLAG + ( at[i].iso_atw_diff > 0 ? at[i].iso_atw_diff - 1 : at[i].iso_atw_diff );
  ------------------
  |  |  101|     15|#define ISOTOPIC_SHIFT_FLAG   10000 /* add to isotopic mass if isotopic_mass =      */
  ------------------
  |  Branch (1718:66): [True: 15, False: 0]
  ------------------
 1719|     15|        }
 1720|  53.4k|        ( *atom )[i].num_iso_H[0] = at[i].num_H;
 1721|   213k|        for (m = 0; m < NUM_H_ISOTOPES; m++)
  ------------------
  |  |  100|   213k|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (1721:21): [True: 160k, False: 53.4k]
  ------------------
 1722|   160k|        {
 1723|   160k|            ( *atom )[i].num_iso_H[m + 1] = at[i].num_iso_H[m];
 1724|   160k|        }
 1725|  53.4k|        ( *atom )[i].radical = at[i].radical;
 1726|  53.4k|    }
 1727|       |
 1728|       |    /* stereo */
 1729|  53.5k|    for (i = n = 0; i < num_inp_atoms; i++)
  ------------------
  |  Branch (1729:21): [True: 53.4k, False: 31]
  ------------------
 1730|  53.4k|    {
 1731|  53.4k|        if (at[i].p_parity)
  ------------------
  |  Branch (1731:13): [True: 0, False: 53.4k]
  ------------------
 1732|      0|        {
 1733|      0|            if (n < num_inp_stereo0D)
  ------------------
  |  Branch (1733:17): [True: 0, False: 0]
  ------------------
 1734|      0|            {
 1735|      0|                ( *stereo0D )[n].central_atom = i;
 1736|      0|                ( *stereo0D )[n].parity = at[i].p_parity;
 1737|      0|                ( *stereo0D )[n].type = INCHI_StereoType_Tetrahedral;
 1738|      0|                for (m = 0; m < MAX_NUM_STEREO_ATOM_NEIGH; m++)
  ------------------
  |  |  880|      0|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (1738:29): [True: 0, False: 0]
  ------------------
 1739|      0|                {
 1740|      0|                    ( *stereo0D )[n].neighbor[m] = at[i].p_orig_at_num[m] - 1;
 1741|      0|                }
 1742|      0|                n++;
 1743|      0|            }
 1744|      0|            else
 1745|      0|            {
 1746|      0|                ret |= 1;
 1747|      0|                break;
 1748|      0|            }
 1749|      0|        }
 1750|  53.4k|        else
 1751|  53.4k|        {
 1752|  53.4k|            for (m1 = 0; m1 < MAX_NUM_STEREO_BONDS && at[i].sb_parity[m1]; m1++)
  ------------------
  |  |  876|   106k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (1752:26): [True: 53.4k, False: 0]
  |  Branch (1752:55): [True: 0, False: 53.4k]
  ------------------
 1753|      0|            {
 1754|       |                /* find the opposite atom at the other end of double bond, allene, or cumulene */
 1755|      0|                int chain[12], len = 0, nxt_neigh, nxt, cur;
 1756|      0|                cur = chain[len++] = i;
 1757|      0|                nxt_neigh = at[cur].sb_ord[m1];
 1758|       |
 1759|      0|                do
 1760|      0|                {
 1761|       |                    /* add next atom */
 1762|      0|                    chain[len++] = nxt = at[cur].neighbor[nxt_neigh];
 1763|      0|                    nxt_neigh = ( at[nxt].neighbor[0] == cur );
 1764|      0|                    cur = nxt;
 1765|       |                    /* find nxt_neigh */
 1766|      0|                }
 1767|      0|                while (!at[cur].sb_parity[0] &&
  ------------------
  |  Branch (1767:24): [True: 0, False: 0]
  ------------------
 1768|      0|                       len < 12 &&
  ------------------
  |  Branch (1768:24): [True: 0, False: 0]
  ------------------
 1769|      0|                       at[cur].valence == 2);
  ------------------
  |  Branch (1769:24): [True: 0, False: 0]
  ------------------
 1770|       |
 1771|      0|                if (at[cur].sb_parity[0] && len <= 4 && i < cur /* count bonds only one time */)
  ------------------
  |  Branch (1771:21): [True: 0, False: 0]
  |  Branch (1771:45): [True: 0, False: 0]
  |  Branch (1771:57): [True: 0, False: 0]
  ------------------
 1772|      0|                {
 1773|       |                    /* double bond, cumulene, or allene has been found */
 1774|      0|                    for (m2 = 0; m2 < MAX_NUM_STEREO_BONDS && at[cur].sb_parity[m2]; m2++)
  ------------------
  |  |  876|      0|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (1774:34): [True: 0, False: 0]
  |  Branch (1774:63): [True: 0, False: 0]
  ------------------
 1775|      0|                    {
 1776|      0|                        if (chain[len - 2] == at[cur].neighbor[(int) at[cur].sb_ord[m2]])
  ------------------
  |  Branch (1776:29): [True: 0, False: 0]
  ------------------
 1777|      0|                        {
 1778|      0|                            if (n < num_inp_stereo0D)
  ------------------
  |  Branch (1778:33): [True: 0, False: 0]
  ------------------
 1779|      0|                            {
 1780|      0|                                int parity1 = at[i].sb_parity[m1];
 1781|      0|                                int parity2 = at[cur].sb_parity[m2];
 1782|      0|                                int parity;
 1783|      0|                                if (( INCHI_PARITY_ODD == parity1 || INCHI_PARITY_EVEN == parity1 ) &&
  ------------------
  |  Branch (1783:39): [True: 0, False: 0]
  |  Branch (1783:70): [True: 0, False: 0]
  ------------------
 1784|      0|                                    ( INCHI_PARITY_ODD == parity2 || INCHI_PARITY_EVEN == parity2 ))
  ------------------
  |  Branch (1784:39): [True: 0, False: 0]
  |  Branch (1784:70): [True: 0, False: 0]
  ------------------
 1785|      0|                                {
 1786|       |                                    /* well-defined parity */
 1787|      0|                                    parity = ( parity1 == parity2 ) ? INCHI_PARITY_EVEN : INCHI_PARITY_ODD;
  ------------------
  |  Branch (1787:46): [True: 0, False: 0]
  ------------------
 1788|      0|                                }
 1789|      0|                                else
 1790|      0|                                {
 1791|      0|                                    parity = inchi_max( parity1, parity2 );
  ------------------
  |  |  166|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1792|      0|                                }
 1793|      0|                                ( *stereo0D )[n].central_atom = ( len == 3 ) ? chain[1] : NO_ATOM;
  ------------------
  |  |  397|      0|#define NO_ATOM          (-1) /* non-existent (central) atom */
  ------------------
  |  Branch (1793:65): [True: 0, False: 0]
  ------------------
 1794|      0|                                ( *stereo0D )[n].parity = parity;
 1795|      0|                                ( *stereo0D )[n].type = len == 3 ? INCHI_StereoType_Allene : INCHI_StereoType_DoubleBond;
  ------------------
  |  Branch (1795:57): [True: 0, False: 0]
  ------------------
 1796|      0|                                ( *stereo0D )[n].neighbor[0] = at[i].sn_orig_at_num[m1] - 1;
 1797|      0|                                ( *stereo0D )[n].neighbor[1] = i;
 1798|      0|                                ( *stereo0D )[n].neighbor[2] = cur;
 1799|      0|                                ( *stereo0D )[n].neighbor[3] = at[cur].sn_orig_at_num[m2] - 1;
 1800|      0|                                n++;
 1801|      0|                            }
 1802|      0|                            else
 1803|      0|                            {
 1804|      0|                                ret |= 1;
 1805|      0|                            }
 1806|      0|                            break;
 1807|      0|                        }
 1808|      0|                    }
 1809|      0|                }
 1810|      0|            }
 1811|  53.4k|        }
 1812|  53.4k|    }
 1813|       |
 1814|     31|    *num_stereo0D = n;
 1815|       |
 1816|     31|exit_function:
 1817|     31|    if (ret < 0)
  ------------------
  |  Branch (1817:9): [True: 0, False: 31]
  ------------------
 1818|      0|    {
 1819|      0|        if (*atom)
  ------------------
  |  Branch (1819:13): [True: 0, False: 0]
  ------------------
 1820|      0|        {
 1821|      0|            inchi_free( *atom );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1822|      0|        }
 1823|      0|        if (*stereo0D)
  ------------------
  |  Branch (1823:13): [True: 0, False: 0]
  ------------------
 1824|      0|        {
 1825|      0|            inchi_free( *stereo0D );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1826|      0|        }
 1827|      0|        *atom = NULL;
 1828|      0|        *stereo0D = NULL;
 1829|      0|        *num_atoms = 0;
 1830|      0|        *num_stereo0D = 0;
 1831|      0|    }
 1832|       |
 1833|     31|    return ret;
 1834|     31|}
GetINCHIfromINCHI:
 2091|    288|{
 2092|    288|    STRUCT_DATA struct_data;
 2093|    288|    STRUCT_DATA *sd = &struct_data;
 2094|       |
 2095|    288|    static char szMainOption[] = " ?InChI2InChI";
 2096|       |
 2097|    288|    INCHI_CLOCK ic;
 2098|    288|    CANON_GLOBALS CG;
 2099|       |
 2100|    288|    int i;
 2101|    288|    char      szSdfDataValue[MAX_SDF_VALUE + 1];
 2102|    288|    unsigned long  ulDisplTime = 0;    /*  infinite, milliseconds */
 2103|       |
 2104|    288|    INPUT_PARMS inp_parms;
 2105|    288|    INPUT_PARMS *ip = &inp_parms;
 2106|       |
 2107|    288|    int             bReleaseVersion = bRELEASE_VERSION;
  ------------------
  |  |  262|    288|#define bRELEASE_VERSION  1    /* 1=> release version; comment out to disable */
  ------------------
 2108|    288|    int   nRet = 0, nRet1;
 2109|       |
 2110|       |#if ( defined(REPEAT_ALL) && REPEAT_ALL > 0 )
 2111|       |    int  num_repeat = REPEAT_ALL;
 2112|       |#endif
 2113|       |
 2114|    288|    const char *argv[INCHI_MAX_NUM_ARG + 1];
 2115|    288|    int   argc;
 2116|    288|    char *szOptions = NULL;
 2117|       |
 2118|    288|    INCHI_IOSTREAM inchi_file[3], *out_file = inchi_file, *log_file = inchi_file + 1, *input_file = inchi_file + 2;
 2119|       |
 2120|       |#if( TRACE_MEMORY_LEAKS == 1 )
 2121|       |    _CrtSetDbgFlag( _CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_ALLOC_MEM_DF );
 2122|       |/* for execution outside the VC++ debugger uncomment one of the following two */
 2123|       |
 2124|       |#ifdef MY_REPORT_FILE
 2125|       |    _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );
 2126|       |    _CrtSetReportFile( _CRT_WARN, MY_REPORT_FILE );
 2127|       |    _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE );
 2128|       |    _CrtSetReportFile( _CRT_ERROR, MY_REPORT_FILE );
 2129|       |    _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );
 2130|       |    _CrtSetReportFile( _CRT_ASSERT, MY_REPORT_FILE );
 2131|       |#else
 2132|       |    _CrtSetReportMode( _CRT_WARN | _CRT_ERROR, _CRTDBG_MODE_DEBUG );
 2133|       |#endif
 2134|       |
 2135|       |    /* turn on floating point exceptions */
 2136|       |#if ( !defined(__STDC__) || __STDC__ != 1 )
 2137|       |    {
 2138|       |        /* Get the default control word. */
 2139|       |        int cw = _controlfp( 0, 0 );
 2140|       |
 2141|       |        /* Set the exception masks OFF, turn exceptions on. */
 2142|       |        /*cw &=~(EM_OVERFLOW|EM_UNDERFLOW|EM_INEXACT|EM_ZERODIVIDE|EM_DENORMAL);*/
 2143|       |        cw &= ~( EM_OVERFLOW | EM_UNDERFLOW | EM_ZERODIVIDE | EM_DENORMAL );
 2144|       |
 2145|       |        /* Set the control word. */
 2146|       |        _controlfp( cw, MCW_EM );
 2147|       |    }
 2148|       |#endif
 2149|       |#endif
 2150|       |
 2151|    288|    memset( out, 0, sizeof( *out ) );
 2152|       |#if ( defined(REPEAT_ALL) && REPEAT_ALL > 0 )
 2153|       |repeat:
 2154|       |    FreeINCHI( out );
 2155|       |    inchi_ios_close( out_file );
 2156|       |    inchi_ios_close( log_file );
 2157|       |    inchi_ios_reset( input_file );  /* do not close input_file - its string buffer may point to inpInChI->szInChI */
 2158|       |#endif
 2159|       |
 2160|       |    /* Initialize internal for this function I/O streams as string buffers */
 2161|    288|    inchi_ios_init( input_file, INCHI_IOS_TYPE_STRING, NULL );
  ------------------
  |  | 1011|    288|#define INCHI_IOS_TYPE_STRING 1
  ------------------
 2162|    288|    inchi_ios_init( out_file, INCHI_IOS_TYPE_STRING, NULL );
  ------------------
  |  | 1011|    288|#define INCHI_IOS_TYPE_STRING 1
  ------------------
 2163|    288|    inchi_ios_init( log_file, INCHI_IOS_TYPE_STRING, NULL );
  ------------------
  |  | 1011|    288|#define INCHI_IOS_TYPE_STRING 1
  ------------------
 2164|       |
 2165|    288|    sd->bUserQuit = 0;
 2166|       |
 2167|       |    /* clear original input structure */
 2168|       |    /* memset( inchi_file, 0, sizeof(inchi_file) ); */
 2169|    288|    memset( sd, 0, sizeof( *sd ) );
 2170|    288|    memset( ip, 0, sizeof( *ip ) );
 2171|    288|    memset( szSdfDataValue, 0, sizeof( szSdfDataValue ) );
 2172|       |
 2173|    288|    memset( &ic, 0, sizeof( ic ) );
 2174|    288|    memset( &CG, 0, sizeof( CG ) );
 2175|       |
 2176|    288|    szMainOption[1] = INCHI_OPTION_PREFX;
  ------------------
  |  |  255|    288|#define   INCHI_OPTION_PREFX  '-'
  ------------------
 2177|       |
 2178|    288|    if (!inpInChI)
  ------------------
  |  Branch (2178:9): [True: 0, False: 288]
  ------------------
 2179|      0|    {
 2180|      0|        nRet = _IS_ERROR;
  ------------------
  |  |   40|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
 2181|      0|        goto exit_function;
 2182|      0|    }
 2183|       |
 2184|       |    /* options */
 2185|    288|    if (inpInChI)
  ------------------
  |  Branch (2185:9): [True: 288, False: 0]
  ------------------
 2186|    288|    {
 2187|    288|        int opt_len = (int) ( ( inpInChI->szOptions ? strlen( inpInChI->szOptions ) : 0 ) + sizeof( szMainOption ) + 1 );
  ------------------
  |  Branch (2187:33): [True: 0, False: 288]
  ------------------
 2188|    288|        szOptions = (char*) inchi_calloc( opt_len + 1, sizeof( szOptions[0] ) );
  ------------------
  |  | 1133|    288|#define inchi_calloc   calloc
  ------------------
 2189|    288|        if (szOptions)
  ------------------
  |  Branch (2189:13): [True: 288, False: 0]
  ------------------
 2190|    288|        {
 2191|    288|            if (inpInChI->szOptions)
  ------------------
  |  Branch (2191:17): [True: 0, False: 288]
  ------------------
 2192|      0|            {
 2193|      0|                strcpy( szOptions, inpInChI->szOptions );
 2194|      0|            }
 2195|    288|            strcat( szOptions, szMainOption );
 2196|    288|            argc = parse_options_string( szOptions, argv, INCHI_MAX_NUM_ARG );
  ------------------
  |  |   39|    288|#define INCHI_MAX_NUM_ARG 32
  ------------------
 2197|    288|        }
 2198|      0|        else
 2199|      0|        {
 2200|      0|            nRet = _IS_FATAL;
  ------------------
  |  |   41|      0|#define _IS_FATAL   3
  ------------------
 2201|      0|            goto translate_RetVal; /* emergency exit */
 2202|      0|        }
 2203|    288|    }
 2204|      0|    else
 2205|      0|    {
 2206|      0|        argc = 1;
 2207|      0|        argv[0] = "";
 2208|      0|        argv[1] = NULL;
 2209|      0|    }
 2210|       |
 2211|    288|    if (argc == 1
  ------------------
  |  Branch (2211:9): [True: 0, False: 288]
  ------------------
 2212|    288|#ifdef TARGET_API_LIB
 2213|    288|        && ( !inpInChI || !inpInChI->szInChI )
  ------------------
  |  Branch (2213:14): [True: 0, False: 0]
  |  Branch (2213:27): [True: 0, False: 0]
  ------------------
 2214|    288|#endif
 2215|       |
 2216|    288|        || argc == 2 && ( argv[1][0] == INCHI_OPTION_PREFX ) &&
  ------------------
  |  |  255|    288|#define   INCHI_OPTION_PREFX  '-'
  ------------------
  |  Branch (2216:12): [True: 288, False: 0]
  |  Branch (2216:25): [True: 288, False: 0]
  ------------------
 2217|    288|        ( !strcmp( argv[1] + 1, "?" ) || !inchi_stricmp( argv[1] + 1, "help" ) ))
  ------------------
  |  Branch (2217:11): [True: 0, False: 288]
  |  Branch (2217:42): [True: 0, False: 288]
  ------------------
 2218|      0|    {
 2219|      0|        HelpCommandLineParms( log_file );
 2220|      0|        out->szLog = log_file->s.pStr;
 2221|      0|        memset( log_file, 0, sizeof( *log_file ) );
 2222|      0|        nRet = _IS_EOF;
  ------------------
  |  |   43|      0|#define _IS_EOF    -1    /* end of file */
  ------------------
 2223|      0|        goto translate_RetVal;
 2224|      0|    }
 2225|       |
 2226|    288|    nRet1 = ReadCommandLineParms( argc, argv, ip, szSdfDataValue,
 2227|    288|                                &ulDisplTime, bReleaseVersion, log_file );
 2228|       |
 2229|    288|    if (szOptions)
  ------------------
  |  Branch (2229:9): [True: 288, False: 0]
  ------------------
 2230|    288|    {
 2231|       |        /* argv pointed to strings in szOptions */
 2232|    288|        inchi_free( szOptions );
  ------------------
  |  | 1136|    288|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 288, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2233|    288|        szOptions = NULL;
 2234|    288|    }
 2235|       |    /* INChI DLL specific */
 2236|    288|    ip->bNoStructLabels = 1;
 2237|       |
 2238|    288|    if (0 > nRet1)
  ------------------
  |  Branch (2238:9): [True: 0, False: 288]
  ------------------
 2239|      0|    {
 2240|      0|        goto exit_function;
 2241|      0|    }
 2242|       |
 2243|    288|    if (ip->bNoStructLabels)
  ------------------
  |  Branch (2243:9): [True: 288, False: 0]
  ------------------
 2244|    288|    {
 2245|    288|        ip->pSdfLabel = NULL;
 2246|    288|        ip->pSdfValue = NULL;
 2247|    288|    }
 2248|      0|    else if (ip->nInputType == INPUT_INCHI_XML ||
  ------------------
  |  Branch (2248:14): [True: 0, False: 0]
  ------------------
 2249|      0|            ip->nInputType == INPUT_INCHI_PLAIN ||
  ------------------
  |  Branch (2249:13): [True: 0, False: 0]
  ------------------
 2250|      0|            ip->nInputType == INPUT_CMLFILE ||
  ------------------
  |  Branch (2250:13): [True: 0, False: 0]
  ------------------
 2251|      0|            ip->nInputType == INPUT_INCHI)
  ------------------
  |  Branch (2251:13): [True: 0, False: 0]
  ------------------
 2252|      0|    {
 2253|       |        /* the input may contain both the header and the label of the structure */
 2254|      0|        if (!ip->pSdfLabel)
  ------------------
  |  Branch (2254:13): [True: 0, False: 0]
  ------------------
 2255|      0|        {
 2256|      0|            ip->pSdfLabel = ip->szSdfDataHeader;
 2257|      0|        }
 2258|      0|        if (!ip->pSdfValue)
  ------------------
  |  Branch (2258:13): [True: 0, False: 0]
  ------------------
 2259|      0|        {
 2260|      0|            ip->pSdfValue = szSdfDataValue;
 2261|      0|        }
 2262|      0|    }
 2263|       |
 2264|    288|    if (ip->nInputType && ip->nInputType != INPUT_INCHI)
  ------------------
  |  Branch (2264:9): [True: 288, False: 0]
  |  Branch (2264:27): [True: 0, False: 288]
  ------------------
 2265|      0|    {
 2266|      0|        inchi_ios_eprint( log_file, "Input type set to INPUT_INCHI\n" );
 2267|      0|        ip->nInputType = INPUT_INCHI;
 2268|      0|    }
 2269|       |
 2270|    288|    if (!inpInChI->szInChI)
  ------------------
  |  Branch (2270:9): [True: 0, False: 288]
  ------------------
 2271|      0|    {
 2272|      0|        nRet = _IS_ERROR;
  ------------------
  |  |   40|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
 2273|      0|        goto exit_function;
 2274|      0|    }
 2275|    288|    else
 2276|    288|    {
 2277|    288|        const int strict = 0;
 2278|    288|        nRet = CheckINCHI( inpInChI->szInChI, strict );
 2279|    288|        if (nRet != INCHI_VALID_STANDARD     &&
  ------------------
  |  Branch (2279:13): [True: 288, False: 0]
  ------------------
 2280|    288|            nRet != INCHI_VALID_NON_STANDARD &&
  ------------------
  |  Branch (2280:13): [True: 61, False: 227]
  ------------------
 2281|    288|            nRet != INCHI_VALID_BETA)
  ------------------
  |  Branch (2281:13): [True: 61, False: 0]
  ------------------
 2282|     61|        {
 2283|     61|            nRet = _IS_ERROR;
  ------------------
  |  |   40|     61|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
 2284|     61|            goto exit_function;
 2285|     61|        }
 2286|    288|    }
 2287|       |
 2288|       |
 2289|    227|    PrintInputParms( log_file, ip );
 2290|       |
 2291|       |    /********************************/
 2292|       |    /* InChI -> InChI               */
 2293|       |    /********************************/
 2294|       |
 2295|       |    /* input_file simulation */
 2296|    227|    input_file->s.pStr = inpInChI->szInChI;
 2297|    227|    input_file->s.nUsedLength = (int) strlen( input_file->s.pStr ) + 1;
 2298|    227|    input_file->s.nAllocatedLength = input_file->s.nUsedLength;
 2299|    227|    input_file->s.nPtr = 0;
 2300|       |
 2301|       |    /* buffer for the message */
 2302|    227|    out->szMessage = (char *) inchi_calloc( MAX_MSG_LEN, sizeof( out->szMessage[0] ) );
  ------------------
  |  | 1133|    227|#define inchi_calloc   calloc
  ------------------
                  out->szMessage = (char *) inchi_calloc( MAX_MSG_LEN, sizeof( out->szMessage[0] ) );
  ------------------
  |  | 2073|    227|#define MAX_MSG_LEN 512
  ------------------
 2303|    227|    if (!out->szMessage)
  ------------------
  |  Branch (2303:9): [True: 0, False: 227]
  ------------------
 2304|      0|    {
 2305|      0|        inchi_ios_eprint( log_file, "Cannot allocate output message buffer.\n" );
 2306|      0|        nRet = -1;
 2307|      0|    }
 2308|    227|    else
 2309|    227|    {
 2310|    227|        nRet = ReadWriteInChI( &ic, &CG, input_file, out_file, log_file,
 2311|    227|                                ip, sd,
 2312|    227|                                NULL, 0, NULL,
 2313|    227|                                NULL, NULL,
 2314|    227|                                out->szMessage, MAX_MSG_LEN,
  ------------------
  |  | 2073|    227|#define MAX_MSG_LEN 512
  ------------------
 2315|    227|                                NULL /*out->WarningFlags*/ );
 2316|    227|    }
 2317|       |
 2318|    227|    if (nRet >= 0 && out_file->s.pStr)
  ------------------
  |  Branch (2318:9): [True: 101, False: 126]
  |  Branch (2318:22): [True: 80, False: 21]
  ------------------
 2319|     80|    {
 2320|       |        /* success */
 2321|     80|        char *p;
 2322|     80|        out->szInChI = out_file->s.pStr;
 2323|     80|        out->szAuxInfo = NULL;
 2324|       |
 2325|     80|        for (p = strchr( out->szInChI, '\n' ); p; p = strchr( p + 1, '\n' ))
  ------------------
  |  Branch (2325:48): [True: 80, False: 0]
  ------------------
 2326|     80|        {
 2327|     80|            if (!memcmp( p, "\nAuxInfo", 8 ))
  ------------------
  |  Branch (2327:17): [True: 0, False: 80]
  ------------------
 2328|      0|            {
 2329|      0|                *p = '\0';            /* remove LF after INChI */
 2330|      0|                out->szAuxInfo = p + 1; /* save pointer to AuxInfo */
 2331|      0|            }
 2332|     80|            else if (out->szAuxInfo || !p[1])
  ------------------
  |  Branch (2332:22): [True: 0, False: 80]
  |  Branch (2332:40): [True: 80, False: 0]
  ------------------
 2333|     80|            {
 2334|       |                /* remove LF after aux info or from the last char */
 2335|     80|                *p = '\0';
 2336|     80|                break;
 2337|     80|            }
 2338|     80|        }
 2339|     80|        out_file->s.pStr = NULL;
 2340|     80|    }
 2341|       |
 2342|       |    /*
 2343|       |    out->szLog = log_file->pStr;
 2344|       |    log_file->pStr   = NULL;
 2345|       |    */
 2346|       |
 2347|    288|exit_function:;
 2348|       |
 2349|  1.44k|    for (i = 0; i < MAX_NUM_PATHS; i++)
  ------------------
  |  |   86|  1.44k|#define MAX_NUM_PATHS 4
  ------------------
  |  Branch (2349:17): [True: 1.15k, False: 288]
  ------------------
 2350|  1.15k|    {
 2351|  1.15k|        if (ip->path[i])
  ------------------
  |  Branch (2351:13): [True: 0, False: 1.15k]
  ------------------
 2352|      0|        {
 2353|      0|            inchi_free( (char*) ip->path[i] ); /*  cast deliberately discards 'const' qualifier */
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2354|      0|            ip->path[i] = NULL;
 2355|      0|        }
 2356|  1.15k|    }
 2357|       |
 2358|    288|    SetBitFree( &CG );
 2359|       |
 2360|       |#if ( defined(REPEAT_ALL) && REPEAT_ALL > 0 )
 2361|       |    if (num_repeat-- > 0)
 2362|       |    {
 2363|       |        goto repeat;
 2364|       |    }
 2365|       |#endif
 2366|       |
 2367|    288|#ifdef TARGET_API_LIB
 2368|       |    /* output */
 2369|       |
 2370|    288|        if (log_file->s.pStr && log_file->s.nUsedLength > 0)
  ------------------
  |  Branch (2370:13): [True: 227, False: 61]
  |  Branch (2370:33): [True: 227, False: 0]
  ------------------
 2371|    227|        {
 2372|    614|            while (log_file->s.nUsedLength && '\n' == log_file->s.pStr[log_file->s.nUsedLength - 1])
  ------------------
  |  Branch (2372:20): [True: 614, False: 0]
  |  Branch (2372:47): [True: 387, False: 227]
  ------------------
 2373|    387|            {
 2374|    387|                log_file->s.pStr[--log_file->s.nUsedLength] = '\0'; /* remove last LF */
 2375|    387|            }
 2376|    227|            if (out)
  ------------------
  |  Branch (2376:17): [True: 227, False: 0]
  ------------------
 2377|    227|            {
 2378|    227|                out->szLog = log_file->s.pStr;
 2379|    227|                log_file->s.pStr = NULL;
 2380|    227|            }
 2381|    227|        }
 2382|       |
 2383|    288|#endif
 2384|       |
 2385|    288|translate_RetVal:
 2386|       |
 2387|       |    /* close internal output streams */
 2388|    288|    inchi_ios_close( out_file );
 2389|    288|    inchi_ios_close( log_file );
 2390|    288|    inchi_ios_reset( input_file );  /* do not close input_file - its string buffer may point to inpInChI->szInChI */
 2391|       |
 2392|    288|    switch (nRet)
 2393|    288|    {
 2394|      1|        case -3: nRet = inchi_Ret_ERROR; break; /* Error: no Structure has been created */
  ------------------
  |  Branch (2394:9): [True: 1, False: 287]
  ------------------
 2395|    125|        case -2: nRet = inchi_Ret_ERROR; break; /* Error: no Structure has been created */
  ------------------
  |  Branch (2395:9): [True: 125, False: 163]
  ------------------
 2396|      0|        case -1: nRet = inchi_Ret_FATAL; break; /* Severe error: no Structure has been created (typically; break; memory allocation failed) */
  ------------------
  |  Branch (2396:9): [True: 0, False: 288]
  ------------------
 2397|    162|        default:
  ------------------
  |  Branch (2397:9): [True: 162, False: 126]
  ------------------
 2398|       |            /*
 2399|       |            if ( !outStruct->atom || !outStruct->num_atoms )
 2400|       |            {
 2401|       |                nRet = inchi_Ret_EOF;
 2402|       |            }
 2403|       |            else
 2404|       |            {
 2405|       |                int m,n,t=0;
 2406|       |                for ( m=0; m < 2; m ++ )
 2407|       |                {
 2408|       |                    for ( n=0; n < 2; n ++ )
 2409|       |                    {
 2410|       |                        if ( outStruct->WarningFlags[m][n] ) {
 2411|       |                            t ++;
 2412|       |                        }
 2413|       |                    }
 2414|       |                }
 2415|       |                nRet = t? inchi_Ret_WARNING : inchi_Ret_OKAY;
 2416|       |            }
 2417|       |            */
 2418|    162|            break;
 2419|    288|    }
 2420|       |
 2421|    288|    return nRet;
 2422|    288|}
GetStructFromINCHIEx:
 2457|    288|{
 2458|    288|    INCHI_CLOCK ic;
 2459|    288|    CANON_GLOBALS CG;
 2460|    288|    STRUCT_DATA struct_data;
 2461|    288|    STRUCT_DATA *sd = &struct_data;
 2462|    288|    INPUT_PARMS inp_parms;
 2463|    288|    INPUT_PARMS *ip = &inp_parms;
 2464|    288|    INCHI_IOSTREAM inchi_file[3];
 2465|    288|    INCHI_IOSTREAM *out_file = inchi_file, *log_file = inchi_file + 1, *input_file = inchi_file + 2;
 2466|    288|    int    i, nRet = 0, nRet1;
 2467|    288|    int bStdFormat = 0;
 2468|    288|    int bReleaseVersion = bRELEASE_VERSION;
  ------------------
  |  |  262|    288|#define bRELEASE_VERSION  1    /* 1=> release version; comment out to disable */
  ------------------
 2469|    288|    unsigned long  ulDisplTime = 0;    /*  infinite, milliseconds */
 2470|       |#if ( defined(REPEAT_ALL) && REPEAT_ALL > 0 )
 2471|       |    int  num_repeat = REPEAT_ALL;
 2472|       |#endif
 2473|    288|    static char szMainOption[] = " ?InChI2Struct";
 2474|    288|    char szSdfDataValue[MAX_SDF_VALUE + 1];
 2475|    288|    const char *argv[INCHI_MAX_NUM_ARG + 1];
 2476|    288|    int   argc;
 2477|    288|    char *szOptions = NULL;
 2478|       |    /* conversion result */
 2479|    288|    inp_ATOM *at = NULL;
 2480|    288|    int num_at = 0;
 2481|    288|    OAD_Polymer *polymer = NULL;
 2482|    288|    OAD_V3000    *v3000 = NULL;
 2483|       |
 2484|       |#if( TRACE_MEMORY_LEAKS == 1 )
 2485|       |    _CrtSetDbgFlag( _CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_ALLOC_MEM_DF );
 2486|       |
 2487|       |/* for execution outside the VC++ debugger uncomment one of the following two */
 2488|       |#ifdef MY_REPORT_FILE
 2489|       |    _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );
 2490|       |    _CrtSetReportFile( _CRT_WARN, MY_REPORT_FILE );
 2491|       |    _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE );
 2492|       |    _CrtSetReportFile( _CRT_ERROR, MY_REPORT_FILE );
 2493|       |    _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );
 2494|       |    _CrtSetReportFile( _CRT_ASSERT, MY_REPORT_FILE );
 2495|       |#else
 2496|       |    _CrtSetReportMode( _CRT_WARN | _CRT_ERROR, _CRTDBG_MODE_DEBUG );
 2497|       |#endif
 2498|       |
 2499|       |    /* turn on floating point exceptions */
 2500|       |#if ( !defined(__STDC__) || __STDC__ != 1 )
 2501|       |    {
 2502|       |        /* Get the default control word. */
 2503|       |        int cw = _controlfp( 0, 0 );
 2504|       |
 2505|       |        /* Set the exception masks OFF, turn exceptions on. */
 2506|       |        /*cw &=~(EM_OVERFLOW|EM_UNDERFLOW|EM_INEXACT|EM_ZERODIVIDE|EM_DENORMAL);*/
 2507|       |        cw &= ~( EM_OVERFLOW | EM_UNDERFLOW | EM_ZERODIVIDE | EM_DENORMAL );
 2508|       |
 2509|       |        /* Set the control word. */
 2510|       |        _controlfp( cw, MCW_EM );
 2511|       |    }
 2512|       |#endif
 2513|       |#endif
 2514|       |
 2515|    288|    memset( outStruct, 0, sizeof( *outStruct ) );
 2516|       |
 2517|       |#if ( defined(REPEAT_ALL) && REPEAT_ALL > 0 )
 2518|       |    repeat:
 2519|       |    FreeStructFromINCHI( &outStruct );
 2520|       |    inchi_ios_reset( input_file );  /* do not close input_file - its string buffer may point to inpInChI->szInChI */
 2521|       |    inchi_ios_close( out_file );
 2522|       |    inchi_ios_close( log_file );
 2523|       |#endif
 2524|       |
 2525|    288|    sd->bUserQuit = 0;
 2526|       |
 2527|       |    /* Initialize internal for this function I/O streams as string buffers */
 2528|    288|    inchi_ios_init( input_file, INCHI_IOS_TYPE_STRING, NULL );
  ------------------
  |  | 1011|    288|#define INCHI_IOS_TYPE_STRING 1
  ------------------
 2529|    288|    inchi_ios_init( out_file, INCHI_IOS_TYPE_STRING, NULL );
  ------------------
  |  | 1011|    288|#define INCHI_IOS_TYPE_STRING 1
  ------------------
 2530|    288|    inchi_ios_init( log_file, INCHI_IOS_TYPE_STRING, NULL );
  ------------------
  |  | 1011|    288|#define INCHI_IOS_TYPE_STRING 1
  ------------------
 2531|       |
 2532|       |    /* clear original input structure */
 2533|    288|    memset( sd, 0, sizeof( *sd ) );
 2534|    288|    memset( ip, 0, sizeof( *ip ) );
 2535|    288|    memset( szSdfDataValue, 0, sizeof( szSdfDataValue ) );
 2536|       |
 2537|    288|    memset( &ic, 0, sizeof( ic ) );
 2538|    288|    memset( &CG, 0, sizeof( CG ) );
 2539|       |
 2540|    288|    szMainOption[1] = INCHI_OPTION_PREFX;
  ------------------
  |  |  255|    288|#define   INCHI_OPTION_PREFX  '-'
  ------------------
 2541|       |
 2542|    288|    if (!inpInChI)
  ------------------
  |  Branch (2542:9): [True: 0, False: 288]
  ------------------
 2543|      0|    {
 2544|      0|        nRet = _IS_ERROR;
  ------------------
  |  |   40|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
 2545|      0|        goto exit_function;
 2546|      0|    }
 2547|       |
 2548|       |    /* options */
 2549|    288|    if (inpInChI /*&& inpInChI->szOptions*/)
  ------------------
  |  Branch (2549:9): [True: 288, False: 0]
  ------------------
 2550|    288|    {
 2551|       |        /* fix bug discovered by Burt Leland 2008-12-23 */
 2552|    288|        int opt_len = ( inpInChI->szOptions ? strlen( inpInChI->szOptions ) : 0 ) + sizeof( szMainOption ) + 1;
  ------------------
  |  Branch (2552:25): [True: 0, False: 288]
  ------------------
 2553|    288|        szOptions = (char*) inchi_calloc( opt_len + 1, sizeof( szOptions[0] ) );
  ------------------
  |  | 1133|    288|#define inchi_calloc   calloc
  ------------------
 2554|    288|        if (szOptions)
  ------------------
  |  Branch (2554:13): [True: 288, False: 0]
  ------------------
 2555|    288|        {
 2556|    288|            if (inpInChI->szOptions)
  ------------------
  |  Branch (2556:17): [True: 0, False: 288]
  ------------------
 2557|       |                /* fix bug discovered by Burt Leland 2008-12-23 */
 2558|      0|                strcpy( szOptions, inpInChI->szOptions );
 2559|    288|            strcat( szOptions, szMainOption );
 2560|    288|            argc = parse_options_string( szOptions, argv, INCHI_MAX_NUM_ARG );
  ------------------
  |  |   39|    288|#define INCHI_MAX_NUM_ARG 32
  ------------------
 2561|    288|        }
 2562|      0|        else
 2563|      0|        {
 2564|      0|            nRet = _IS_FATAL;
  ------------------
  |  |   41|      0|#define _IS_FATAL   3
  ------------------
 2565|      0|            goto translate_RetVal; /* emergency exit */
 2566|      0|        }
 2567|    288|    }
 2568|      0|    else
 2569|      0|    {
 2570|      0|        argc = 1;
 2571|      0|            argv[0] = "";
 2572|      0|        argv[1] = NULL;
 2573|      0|    }
 2574|       |
 2575|    288|    if (argc == 1
  ------------------
  |  Branch (2575:9): [True: 0, False: 288]
  ------------------
 2576|    288|#ifdef TARGET_API_LIB
 2577|    288|        && ( !inpInChI || !inpInChI->szInChI )
  ------------------
  |  Branch (2577:14): [True: 0, False: 0]
  |  Branch (2577:27): [True: 0, False: 0]
  ------------------
 2578|    288|#endif
 2579|    288|        || argc == 2 && ( argv[1][0] == INCHI_OPTION_PREFX ) &&
  ------------------
  |  |  255|    288|#define   INCHI_OPTION_PREFX  '-'
  ------------------
  |  Branch (2579:12): [True: 288, False: 0]
  |  Branch (2579:25): [True: 288, False: 0]
  ------------------
 2580|    288|        ( !strcmp( argv[1] + 1, "?" ) || !inchi_stricmp( argv[1] + 1, "help" ) ))
  ------------------
  |  Branch (2580:11): [True: 0, False: 288]
  |  Branch (2580:42): [True: 0, False: 288]
  ------------------
 2581|      0|    {
 2582|      0|        HelpCommandLineParms( log_file );
 2583|      0|        outStruct->szLog = log_file->s.pStr;
 2584|      0|        nRet = _IS_EOF;
  ------------------
  |  |   43|      0|#define _IS_EOF    -1    /* end of file */
  ------------------
 2585|      0|        goto translate_RetVal;
 2586|      0|    }
 2587|       |
 2588|    288|    nRet1 = ReadCommandLineParms( argc, argv, ip, szSdfDataValue,
 2589|    288|                                  &ulDisplTime, bReleaseVersion,
 2590|    288|                                  log_file );
 2591|       |
 2592|    288|    if (szOptions)
  ------------------
  |  Branch (2592:9): [True: 288, False: 0]
  ------------------
 2593|    288|    {
 2594|       |        /* argv pointed to strings in szOptions */
 2595|    288|        inchi_free( szOptions );
  ------------------
  |  | 1136|    288|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 288, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2596|    288|        szOptions = NULL;
 2597|    288|    }
 2598|       |
 2599|       |    /* INChI DLL specific */
 2600|    288|    ip->bNoStructLabels = 1;
 2601|       |
 2602|    288|    if (0 > nRet1)
  ------------------
  |  Branch (2602:9): [True: 0, False: 288]
  ------------------
 2603|      0|    {
 2604|      0|        goto exit_function;
 2605|      0|    }
 2606|       |
 2607|    288|    if (ip->bNoStructLabels)
  ------------------
  |  Branch (2607:9): [True: 288, False: 0]
  ------------------
 2608|    288|    {
 2609|    288|        ip->pSdfLabel = NULL;
 2610|    288|        ip->pSdfValue = NULL;
 2611|    288|    }
 2612|      0|    else if (ip->nInputType == INPUT_INCHI_XML ||
  ------------------
  |  Branch (2612:14): [True: 0, False: 0]
  ------------------
 2613|      0|            ip->nInputType == INPUT_INCHI_PLAIN ||
  ------------------
  |  Branch (2613:13): [True: 0, False: 0]
  ------------------
 2614|      0|            ip->nInputType == INPUT_CMLFILE ||
  ------------------
  |  Branch (2614:13): [True: 0, False: 0]
  ------------------
 2615|      0|            ip->nInputType == INPUT_INCHI)
  ------------------
  |  Branch (2615:13): [True: 0, False: 0]
  ------------------
 2616|      0|    {
 2617|       |        /* the input may contain both the header and the label of the structure */
 2618|      0|        if (!ip->pSdfLabel)
  ------------------
  |  Branch (2618:13): [True: 0, False: 0]
  ------------------
 2619|      0|            ip->pSdfLabel = ip->szSdfDataHeader;
 2620|      0|        if (!ip->pSdfValue)
  ------------------
  |  Branch (2620:13): [True: 0, False: 0]
  ------------------
 2621|      0|            ip->pSdfValue = szSdfDataValue;
 2622|      0|    }
 2623|       |
 2624|    288|    if (ip->nInputType && ip->nInputType != INPUT_INCHI)
  ------------------
  |  Branch (2624:9): [True: 288, False: 0]
  |  Branch (2624:27): [True: 0, False: 288]
  ------------------
 2625|      0|    {
 2626|      0|        inchi_ios_eprint( log_file, "Input type set to INPUT_INCHI\n" );
 2627|      0|        ip->nInputType = INPUT_INCHI;
 2628|      0|    }
 2629|       |
 2630|    288|    if (!inpInChI->szInChI)
  ------------------
  |  Branch (2630:9): [True: 0, False: 288]
  ------------------
 2631|      0|    {
 2632|      0|        nRet = _IS_ERROR;
  ------------------
  |  |   40|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
 2633|      0|        goto exit_function;
 2634|      0|    }
 2635|    288|    else
 2636|    288|    {
 2637|    288|        const int strict = 0;                     /* do not use strict mode, it may be too alarmous */
 2638|    288|        nRet = CheckINCHI( inpInChI->szInChI, strict );
 2639|    288|        if (nRet == INCHI_VALID_STANDARD)
  ------------------
  |  Branch (2639:13): [True: 0, False: 288]
  ------------------
 2640|      0|        {
 2641|      0|            bStdFormat = 1;
 2642|      0|        }
 2643|    288|        else if (nRet == INCHI_VALID_NON_STANDARD || nRet == INCHI_VALID_BETA)
  ------------------
  |  Branch (2643:18): [True: 227, False: 61]
  |  Branch (2643:54): [True: 0, False: 61]
  ------------------
 2644|    227|        {
 2645|    227|            ;
 2646|    227|        }
 2647|     61|        else
 2648|     61|        {
 2649|     61|            nRet = _IS_ERROR;
  ------------------
  |  |   40|     61|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
 2650|     61|            goto exit_function;
 2651|     61|        }
 2652|    288|    }
 2653|       |
 2654|    227|    PrintInputParms( log_file, ip );
 2655|       |
 2656|       |    /*********************************/
 2657|       |    /* InChI -> Structure conversion */
 2658|       |    /*********************************/
 2659|       |
 2660|       |    /* input_file simulation */
 2661|       |
 2662|       |    /*
 2663|       |    that was incorrect simulation, and correct one is much simpler, see below
 2664|       |    input_file->s.pStr = inpInChI->szInChI;
 2665|       |    input_file->s.nUsedLength = (int) strlen(input_file->s.pStr)+1;
 2666|       |    input_file->s.nAllocatedLength = input_file->s.nUsedLength;
 2667|       |    input_file->s.nPtr = 0;
 2668|       |    */
 2669|    227|    inchi_ios_print_nodisplay( input_file, inpInChI->szInChI );
 2670|       |
 2671|       |    /* buffer for the message */
 2672|       |    /* outStruct->szMessage = (char *)inchi_calloc( MAX_MSG_LEN, sizeof(outStruct->szMessage[0])); */
 2673|       |
 2674|    227|    outStruct->szMessage = (char *) inchi_calloc( MAX_MSG_LEN, sizeof( char ) );
  ------------------
  |  | 1133|    227|#define inchi_calloc   calloc
  ------------------
                  outStruct->szMessage = (char *) inchi_calloc( MAX_MSG_LEN, sizeof( char ) );
  ------------------
  |  | 2073|    227|#define MAX_MSG_LEN 512
  ------------------
 2675|    227|    if (!outStruct->szMessage)
  ------------------
  |  Branch (2675:9): [True: 0, False: 227]
  ------------------
 2676|      0|    {
 2677|      0|        inchi_ios_eprint( log_file, "Cannot allocate output message buffer.\n" );
 2678|      0|        nRet = -1;
 2679|      0|    }
 2680|    227|    else
 2681|    227|    {
 2682|    227|        int num_bonds;
 2683|    227|        nRet = ReadWriteInChI( &ic, &CG , input_file, out_file, log_file,
 2684|    227|                                ip, sd, &at, &num_at, &num_bonds,
 2685|    227|                                &polymer, &v3000,
 2686|    227|                                outStruct->szMessage,
 2687|    227|                                MAX_MSG_LEN, outStruct->WarningFlags );
  ------------------
  |  | 2073|    227|#define MAX_MSG_LEN 512
  ------------------
 2688|       |
 2689|    227|        if (nRet >= 0 && polymer)
  ------------------
  |  Branch (2689:13): [True: 45, False: 182]
  |  Branch (2689:26): [True: 7, False: 38]
  ------------------
 2690|      7|        {
 2691|      7|            OAD_Polymer_SmartReopenCyclizedUnits( polymer, at,
 2692|      7|                                                 num_at, &num_bonds );
 2693|      7|        }
 2694|    227|    }
 2695|       |
 2696|    227|    if (nRet >= 0 && at && num_at)
  ------------------
  |  Branch (2696:9): [True: 45, False: 182]
  |  Branch (2696:22): [True: 31, False: 14]
  |  Branch (2696:28): [True: 31, False: 0]
  ------------------
 2697|     31|    {
 2698|       |        /* success */
 2699|     31|        nRet = InpAtom0DToInchiAtom( at, num_at,
 2700|     31|                                    &outStruct->num_atoms,
 2701|     31|                                    &outStruct->atom,
 2702|     31|                                    &outStruct->num_stereo0D,
 2703|     31|                                    &outStruct->stereo0D );
 2704|       |
 2705|     31|        if (at)
  ------------------
  |  Branch (2705:13): [True: 31, False: 0]
  ------------------
 2706|     31|        {
 2707|     31|            inchi_free( at );
  ------------------
  |  | 1136|     31|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 31, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2708|     31|            at = NULL;
 2709|     31|        }
 2710|       |
 2711|     31|        if (nRet >= 0 && polymer)
  ------------------
  |  Branch (2711:13): [True: 31, False: 0]
  |  Branch (2711:26): [True: 7, False: 24]
  ------------------
 2712|      7|        {
 2713|       |            /* Check for and then replace ZZ for star atoms if Polymer extension is supplied */
 2714|     34|            for (i = 0; i < outStruct->num_atoms; i++)
  ------------------
  |  Branch (2714:25): [True: 27, False: 7]
  ------------------
 2715|     27|            {
 2716|     27|                if (!strcmp( outStruct->atom[i].elname, "Zz" ))
  ------------------
  |  Branch (2716:21): [True: 0, False: 27]
  ------------------
 2717|      0|                {
 2718|      0|                    strcpy( outStruct->atom[i].elname, "*" );
 2719|      0|                }
 2720|     27|            }
 2721|      7|        }
 2722|       |
 2723|     31|        if (nRet >= 0)
  ------------------
  |  Branch (2723:13): [True: 31, False: 0]
  ------------------
 2724|     31|        {
 2725|     31|            if (polymer || v3000)
  ------------------
  |  Branch (2725:17): [True: 7, False: 24]
  |  Branch (2725:28): [True: 0, False: 24]
  ------------------
 2726|      7|            {
 2727|      7|                nRet = SetInChIExtInputByExtOrigAtData( polymer, v3000,
 2728|      7|                                                        &outStruct->polymer,
 2729|      7|                                                        &outStruct->v3000,
 2730|      7|                                                        outStruct->num_atoms ); /* pair to SetExtOrigAtDataByInChIExtInput */
 2731|      7|                FreeExtOrigAtData( polymer, v3000 );
 2732|      7|                polymer = NULL;
 2733|      7|                v3000 = NULL;
 2734|      7|            }
 2735|     31|        }
 2736|     31|        if (nRet < 0)
  ------------------
  |  Branch (2736:13): [True: 0, False: 31]
  ------------------
 2737|      0|        {
 2738|      0|            inchi_ios_eprint( log_file, "Final structure conversion failed\n" );
 2739|      0|        }
 2740|     31|    }
 2741|    227|    outStruct->szLog = log_file->s.pStr;
 2742|       |
 2743|    288|exit_function:;
 2744|       |
 2745|  1.44k|    for (i = 0; i < MAX_NUM_PATHS; i++)
  ------------------
  |  |   86|  1.44k|#define MAX_NUM_PATHS 4
  ------------------
  |  Branch (2745:17): [True: 1.15k, False: 288]
  ------------------
 2746|  1.15k|    {
 2747|  1.15k|        if (ip->path[i])
  ------------------
  |  Branch (2747:13): [True: 0, False: 1.15k]
  ------------------
 2748|      0|        {
 2749|      0|            inchi_free( (char*) ip->path[i] ); /*  cast deliberately discards 'const' qualifier */
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2750|      0|            ip->path[i] = NULL;
 2751|      0|        }
 2752|  1.15k|    }
 2753|       |
 2754|    288|    SetBitFree( &CG );
 2755|       |
 2756|       |#if ( defined(REPEAT_ALL) && REPEAT_ALL > 0 )
 2757|       |    if (num_repeat-- > 0)
 2758|       |    {
 2759|       |        goto repeat;
 2760|       |    }
 2761|       |#endif
 2762|       |
 2763|    288|#ifdef TARGET_API_LIB
 2764|       |    /* output */
 2765|    288|    if (log_file->s.pStr && log_file->s.nUsedLength > 0)
  ------------------
  |  Branch (2765:9): [True: 227, False: 61]
  |  Branch (2765:29): [True: 227, False: 0]
  ------------------
 2766|    227|    {
 2767|    480|        while (log_file->s.nUsedLength &&
  ------------------
  |  Branch (2767:16): [True: 480, False: 0]
  ------------------
 2768|    480|                '\n' == log_file->s.pStr[log_file->s.nUsedLength - 1])
  ------------------
  |  Branch (2768:17): [True: 253, False: 227]
  ------------------
 2769|    253|        {
 2770|    253|            log_file->s.pStr[--log_file->s.nUsedLength] = '\0'; /* remove last LF */
 2771|    253|        }
 2772|    227|        if (outStruct)
  ------------------
  |  Branch (2772:13): [True: 227, False: 0]
  ------------------
 2773|    227|        {
 2774|    227|            outStruct->szLog = log_file->s.pStr;
 2775|    227|            log_file->s.pStr = NULL;
 2776|    227|        }
 2777|    227|    }
 2778|    288|#endif
 2779|       |
 2780|    288|translate_RetVal:
 2781|       |
 2782|       |    /* Close internal I/O streams */
 2783|       |    /* that was incorrect also
 2784|       |    inchi_ios_reset(input_file);  */    /* do not close input_file - its string buffer may point to inpInChI->szInChI */
 2785|    288|    inchi_ios_close( input_file );
 2786|    288|    inchi_ios_close( out_file );
 2787|    288|    inchi_ios_close( log_file );
 2788|       |
 2789|    288|    switch (nRet)
 2790|    288|    {
 2791|     59|        case -3: nRet = inchi_Ret_ERROR; break; /* Error: no Structure has been created */
  ------------------
  |  Branch (2791:9): [True: 59, False: 229]
  ------------------
 2792|    123|        case -2: nRet = inchi_Ret_ERROR; break; /* Error: no Structure has been created */
  ------------------
  |  Branch (2792:9): [True: 123, False: 165]
  ------------------
 2793|      0|        case -1: nRet = inchi_Ret_FATAL; break; /* Severe error: no Structure has been created (typically; break; memory allocation failed) */
  ------------------
  |  Branch (2793:9): [True: 0, False: 288]
  ------------------
 2794|    106|        default:
  ------------------
  |  Branch (2794:9): [True: 106, False: 182]
  ------------------
 2795|    106|            if (!outStruct->atom || !outStruct->num_atoms)
  ------------------
  |  Branch (2795:17): [True: 75, False: 31]
  |  Branch (2795:37): [True: 0, False: 31]
  ------------------
 2796|     75|            {
 2797|     75|                nRet = inchi_Ret_EOF;
 2798|     75|            }
 2799|     31|            else
 2800|     31|            {
 2801|     31|                int m, n, t = 0;
 2802|     93|                for (m = 0; m < 2; m++)
  ------------------
  |  Branch (2802:29): [True: 62, False: 31]
  ------------------
 2803|     62|                {
 2804|    186|                    for (n = 0; n < 2; n++)
  ------------------
  |  Branch (2804:33): [True: 124, False: 62]
  ------------------
 2805|    124|                    {
 2806|    124|                        if (outStruct->WarningFlags[m][n])
  ------------------
  |  Branch (2806:29): [True: 18, False: 106]
  ------------------
 2807|     18|                        {
 2808|     18|                            t++;
 2809|     18|                        }
 2810|    124|                    }
 2811|     62|                }
 2812|     31|                nRet = t ? inchi_Ret_WARNING : inchi_Ret_OKAY;
  ------------------
  |  Branch (2812:24): [True: 18, False: 13]
  ------------------
 2813|     31|            }
 2814|    106|            break;
 2815|    288|    }
 2816|       |
 2817|    288|    return nRet;
 2818|    288|}
GetStructFromINCHI:
 2829|    288|{
 2830|    288|    int ret = 0;
 2831|       |
 2832|    288|    inchi_OutputStructEx outex;
 2833|    288|    memset( out, 0, sizeof( *out ) );
 2834|       |
 2835|    288|    ret = GetStructFromINCHIEx( inpInChI, &outex );
 2836|       |
 2837|    288|    out->szLog = outex.szLog;
 2838|    288|    out->szMessage = outex.szMessage;
 2839|    288|    out->WarningFlags[0][0] = outex.WarningFlags[0][0];
 2840|    288|    out->WarningFlags[0][1] = outex.WarningFlags[0][1];
 2841|    288|    out->WarningFlags[1][0] = outex.WarningFlags[1][0];
 2842|    288|    out->WarningFlags[1][1] = outex.WarningFlags[1][1];
 2843|       |
 2844|    288|    if (ret == inchi_Ret_OKAY || ret == inchi_Ret_WARNING)
  ------------------
  |  Branch (2844:9): [True: 13, False: 275]
  |  Branch (2844:34): [True: 18, False: 257]
  ------------------
 2845|     31|    {
 2846|     31|        out->num_atoms = outex.num_atoms;
 2847|     31|        out->atom = outex.atom;
 2848|     31|        out->num_stereo0D = outex.num_stereo0D;
 2849|     31|        out->stereo0D = outex.stereo0D;
 2850|     31|    }
 2851|       |
 2852|    288|    return ret;
 2853|    288|}
SetInChIExtInputByExtOrigAtData:
 3234|      7|{
 3235|      7|    int    k, m, err = 0;
 3236|       |
 3237|       |        /* Polymers */
 3238|      7|    if (orp && orp->n > 0)
  ------------------
  |  Branch (3238:9): [True: 7, False: 0]
  |  Branch (3238:16): [True: 7, False: 0]
  ------------------
 3239|      7|    {
 3240|      7|        *iip = (inchi_Input_Polymer *) inchi_calloc( 1, sizeof( inchi_Input_Polymer ) );
  ------------------
  |  | 1133|      7|#define inchi_calloc   calloc
  ------------------
 3241|      7|        if (!*iip)
  ------------------
  |  Branch (3241:13): [True: 0, False: 7]
  ------------------
 3242|      0|        {
 3243|      0|            err = 9001;
 3244|      0|            goto exitf;
 3245|      0|        }
 3246|      7|        ( *iip )->n = orp->n;
 3247|      7|        ( *iip )->units = (inchi_Input_PolymerUnit**) inchi_calloc( orp->n, sizeof( ( *iip )->units[0] ) );
  ------------------
  |  | 1133|      7|#define inchi_calloc   calloc
  ------------------
 3248|      7|        if (!( *iip )->units)
  ------------------
  |  Branch (3248:13): [True: 0, False: 7]
  ------------------
 3249|      0|        {
 3250|      0|            err = 9001; goto exitf;
 3251|      0|        }
 3252|      7|        memset( ( *iip )->units, 0, sizeof( *( *iip )->units ) );
 3253|  8.47k|        for (k = 0; k < orp->n; k++)
  ------------------
  |  Branch (3253:21): [True: 8.46k, False: 7]
  ------------------
 3254|  8.46k|        {
 3255|  8.46k|            int q = 0;
 3256|  8.46k|            inchi_Input_PolymerUnit *unitk;
 3257|  8.46k|            OAD_PolymerUnit    *groupk = orp->units[k];
 3258|  8.46k|            ( *iip )->units[k] = (inchi_Input_PolymerUnit*) inchi_calloc( 1, sizeof( inchi_Input_PolymerUnit ) );
  ------------------
  |  | 1133|  8.46k|#define inchi_calloc   calloc
  ------------------
 3259|  8.46k|            unitk = ( *iip )->units[k];
 3260|  8.46k|            if (!unitk)
  ------------------
  |  Branch (3260:17): [True: 0, False: 8.46k]
  ------------------
 3261|      0|            {
 3262|      0|                err = 9001; goto exitf;
 3263|      0|            }
 3264|  8.46k|            memset( unitk, 0, sizeof( *unitk ) );
 3265|  8.46k|            unitk->id = groupk->id;
 3266|  8.46k|            unitk->type = groupk->type;
 3267|  8.46k|            unitk->subtype = groupk->subtype;
 3268|  8.46k|            unitk->conn = groupk->conn;
 3269|  8.46k|            unitk->label = groupk->label;
 3270|  42.3k|            for (q = 0; q < 4; q++)
  ------------------
  |  Branch (3270:25): [True: 33.8k, False: 8.46k]
  ------------------
 3271|  33.8k|            {
 3272|  33.8k|                unitk->xbr1[q] = groupk->xbr1[q];
 3273|  33.8k|                unitk->xbr2[q] = groupk->xbr2[q];
 3274|  33.8k|            }
 3275|  8.46k|            strcpy( unitk->smt, groupk->smt );
 3276|  8.46k|            unitk->na = groupk->na;
 3277|  8.46k|            unitk->alist = (int *) inchi_calloc( unitk->na, sizeof( int ) );
  ------------------
  |  | 1133|  8.46k|#define inchi_calloc   calloc
  ------------------
 3278|  8.46k|            if (!unitk->alist)
  ------------------
  |  Branch (3278:17): [True: 0, False: 8.46k]
  ------------------
 3279|      0|            {
 3280|      0|                err = 9001; goto exitf;
 3281|      0|            }
 3282|  17.7k|            for (m = 0; m < unitk->na; m++)
  ------------------
  |  Branch (3282:25): [True: 9.23k, False: 8.46k]
  ------------------
 3283|  9.23k|            {
 3284|  9.23k|                unitk->alist[m] = groupk->alist[m];
 3285|  9.23k|            }
 3286|  8.46k|            unitk->nb = groupk->nb;
 3287|  8.46k|            if (unitk->nb > 0)
  ------------------
  |  Branch (3287:17): [True: 0, False: 8.46k]
  ------------------
 3288|      0|            {
 3289|      0|                unitk->blist = (int *) inchi_calloc( 2 * unitk->nb, sizeof( int ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 3290|      0|                if (!unitk->blist)
  ------------------
  |  Branch (3290:21): [True: 0, False: 0]
  ------------------
 3291|      0|                {
 3292|      0|                    err = 9001; goto exitf;
 3293|      0|                }
 3294|      0|                for (m = 0; m < 2 * groupk->nb; m++)
  ------------------
  |  Branch (3294:29): [True: 0, False: 0]
  ------------------
 3295|      0|                {
 3296|      0|                    unitk->blist[m] = groupk->blist[m];
 3297|      0|                }
 3298|      0|            }
 3299|  8.46k|            else
 3300|  8.46k|            {
 3301|  8.46k|                unitk->blist = NULL;
 3302|  8.46k|            }
 3303|  8.46k|        }
 3304|      7|    }
 3305|       |
 3306|      7|    if (orv)
  ------------------
  |  Branch (3306:9): [True: 0, False: 7]
  ------------------
 3307|      0|    {
 3308|      0|        int nn;
 3309|      0|        *iiv = (inchi_Input_V3000 *) inchi_calloc( 1, sizeof( OAD_V3000 ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 3310|      0|        if (!*iiv)
  ------------------
  |  Branch (3310:13): [True: 0, False: 0]
  ------------------
 3311|      0|        {
 3312|      0|            err = 9001; goto exitf;
 3313|      0|        }
 3314|      0|        memset( *iiv, 0, sizeof( **iiv ) );
 3315|       |
 3316|      0|        ( *iiv )->n_collections = orv->n_collections;
 3317|      0|        ( *iiv )->n_haptic_bonds = orv->n_haptic_bonds;
 3318|      0|        ( *iiv )->n_non_haptic_bonds = orv->n_non_haptic_bonds;
 3319|      0|        ( *iiv )->n_sgroups = orv->n_sgroups;
 3320|      0|        ( *iiv )->n_non_star_atoms = orv->n_non_star_atoms;
 3321|      0|        ( *iiv )->n_star_atoms = orv->n_star_atoms;
 3322|      0|        ( *iiv )->n_steabs = orv->n_steabs;
 3323|      0|        ( *iiv )->n_sterac = orv->n_sterac;
 3324|      0|        ( *iiv )->n_sterel = orv->n_sterel;
 3325|      0|        ( *iiv )->n_3d_constraints = orv->n_3d_constraints;
 3326|       |
 3327|      0|        if (orv->atom_index_orig)
  ------------------
  |  Branch (3327:13): [True: 0, False: 0]
  ------------------
 3328|      0|        {
 3329|      0|            ( *iiv )->atom_index_orig = (int *) inchi_calloc( nat, sizeof( int ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 3330|      0|            if (NULL == ( *iiv )->atom_index_orig)
  ------------------
  |  Branch (3330:17): [True: 0, False: 0]
  ------------------
 3331|      0|            {
 3332|      0|                err = 9001;
 3333|      0|                goto exitf;
 3334|      0|            }
 3335|      0|            memcpy( ( *iiv )->atom_index_orig, orv->atom_index_orig, nat );
 3336|      0|        }
 3337|      0|        if (orv->atom_index_fin)
  ------------------
  |  Branch (3337:13): [True: 0, False: 0]
  ------------------
 3338|      0|        {
 3339|      0|            ( *iiv )->atom_index_fin = (int *) inchi_calloc( nat, sizeof( int ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 3340|      0|            if (NULL == ( *iiv )->atom_index_fin)
  ------------------
  |  Branch (3340:17): [True: 0, False: 0]
  ------------------
 3341|      0|            {
 3342|      0|                err = 9001;
 3343|      0|                goto exitf;
 3344|      0|            }
 3345|      0|            memcpy( ( *iiv )->atom_index_fin, orv->atom_index_fin, nat );
 3346|      0|        }
 3347|      0|        if (orv->n_haptic_bonds && orv->lists_haptic_bonds)
  ------------------
  |  Branch (3347:13): [True: 0, False: 0]
  |  Branch (3347:36): [True: 0, False: 0]
  ------------------
 3348|      0|        {
 3349|      0|            ( *iiv )->lists_haptic_bonds = (int **) inchi_calloc( orv->n_haptic_bonds, sizeof( int* ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 3350|      0|            if (NULL == ( *iiv )->lists_haptic_bonds)
  ------------------
  |  Branch (3350:17): [True: 0, False: 0]
  ------------------
 3351|      0|            {
 3352|      0|                err = 9001;
 3353|      0|                goto exitf;
 3354|      0|            }
 3355|      0|            for (m = 0; m < orv->n_haptic_bonds; m++)
  ------------------
  |  Branch (3355:25): [True: 0, False: 0]
  ------------------
 3356|      0|            {
 3357|      0|                int *lst = NULL;
 3358|      0|                int *mol_lst = orv->lists_haptic_bonds[m];
 3359|      0|                nn = mol_lst[2] + 3;
 3360|      0|                lst = ( *iiv )->lists_haptic_bonds[m] = (int *) inchi_calloc( nn, sizeof( int ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 3361|      0|                if (NULL == lst)
  ------------------
  |  Branch (3361:21): [True: 0, False: 0]
  ------------------
 3362|      0|                {
 3363|      0|                    err = 9001;
 3364|      0|                    goto exitf;
 3365|      0|                }
 3366|      0|                for (k = 0; k < nn; k++)
  ------------------
  |  Branch (3366:29): [True: 0, False: 0]
  ------------------
 3367|      0|                {
 3368|      0|                    lst[k] = mol_lst[k];
 3369|      0|                }
 3370|      0|            }
 3371|      0|        }
 3372|      0|        if (orv->n_steabs && orv->lists_steabs)
  ------------------
  |  Branch (3372:13): [True: 0, False: 0]
  |  Branch (3372:30): [True: 0, False: 0]
  ------------------
 3373|      0|        {
 3374|      0|            ( *iiv )->lists_steabs = (int **) inchi_calloc( orv->n_steabs, sizeof( int* ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 3375|      0|            if (NULL == ( *iiv )->lists_steabs) { err = 9001; goto exitf; }
  ------------------
  |  Branch (3375:17): [True: 0, False: 0]
  ------------------
 3376|      0|            for (m = 0; m < orv->n_steabs; m++)
  ------------------
  |  Branch (3376:25): [True: 0, False: 0]
  ------------------
 3377|      0|            {
 3378|      0|                int *lst = NULL;
 3379|      0|                int *mol_lst = orv->lists_steabs[m];
 3380|      0|                nn = mol_lst[1] + 2;
 3381|      0|                lst = ( *iiv )->lists_steabs[m] = (int *) inchi_calloc( nn, sizeof( int ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 3382|      0|                if (NULL == lst)
  ------------------
  |  Branch (3382:21): [True: 0, False: 0]
  ------------------
 3383|      0|                {
 3384|      0|                    err = 9001;
 3385|      0|                    goto exitf;
 3386|      0|                }
 3387|      0|                for (k = 0; k < nn; k++)
  ------------------
  |  Branch (3387:29): [True: 0, False: 0]
  ------------------
 3388|      0|                {
 3389|      0|                    lst[k] = mol_lst[k];
 3390|      0|                }
 3391|      0|            }
 3392|      0|        }
 3393|      0|        if (orv->n_sterac && orv->lists_sterac)
  ------------------
  |  Branch (3393:13): [True: 0, False: 0]
  |  Branch (3393:30): [True: 0, False: 0]
  ------------------
 3394|      0|        {
 3395|      0|            ( *iiv )->lists_sterac = (int **) inchi_calloc( orv->n_sterac, sizeof( int* ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 3396|      0|            if (NULL == ( *iiv )->lists_sterac) { err = 9001; goto exitf; }
  ------------------
  |  Branch (3396:17): [True: 0, False: 0]
  ------------------
 3397|      0|            for (m = 0; m < orv->n_sterac; m++)
  ------------------
  |  Branch (3397:25): [True: 0, False: 0]
  ------------------
 3398|      0|            {
 3399|      0|                int *lst = NULL;
 3400|      0|                int *mol_lst = orv->lists_sterac[m];
 3401|      0|                nn = mol_lst[1] + 2;
 3402|      0|                lst = ( *iiv )->lists_sterac[m] = (int *) inchi_calloc( nn, sizeof( int ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 3403|      0|                if (NULL == lst)
  ------------------
  |  Branch (3403:21): [True: 0, False: 0]
  ------------------
 3404|      0|                {
 3405|      0|                    err = 9001;
 3406|      0|                    goto exitf;
 3407|      0|                }
 3408|      0|                for (k = 0; k < nn; k++)
  ------------------
  |  Branch (3408:29): [True: 0, False: 0]
  ------------------
 3409|      0|                {
 3410|      0|                    lst[k] = mol_lst[k];
 3411|      0|                }
 3412|      0|            }
 3413|      0|        }
 3414|      0|        if (orv->n_sterel && orv->lists_sterel)
  ------------------
  |  Branch (3414:13): [True: 0, False: 0]
  |  Branch (3414:30): [True: 0, False: 0]
  ------------------
 3415|      0|        {
 3416|      0|            ( *iiv )->lists_sterel = (int **) inchi_calloc( orv->n_sterel, sizeof( int* ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 3417|      0|            if (NULL == ( *iiv )->lists_sterel) { err = 9001; goto exitf; }
  ------------------
  |  Branch (3417:17): [True: 0, False: 0]
  ------------------
 3418|      0|            for (m = 0; m < orv->n_sterel; m++)
  ------------------
  |  Branch (3418:25): [True: 0, False: 0]
  ------------------
 3419|      0|            {
 3420|      0|                int *lst = NULL;
 3421|      0|                int *mol_lst = orv->lists_sterel[m];
 3422|      0|                nn = mol_lst[1] + 2;
 3423|      0|                lst = ( *iiv )->lists_sterel[m] = (int *) inchi_calloc( nn, sizeof( int ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 3424|      0|                if (NULL == lst)
  ------------------
  |  Branch (3424:21): [True: 0, False: 0]
  ------------------
 3425|      0|                {
 3426|      0|                    err = 9001;
 3427|      0|                    goto exitf;
 3428|      0|                }
 3429|      0|                for (k = 0; k < nn; k++)
  ------------------
  |  Branch (3429:29): [True: 0, False: 0]
  ------------------
 3430|      0|                {
 3431|      0|                    lst[k] = mol_lst[k];
 3432|      0|                }
 3433|      0|            }
 3434|      0|        }
 3435|      0|    }
 3436|       |
 3437|      7|exitf:
 3438|      7|    if (err)
  ------------------
  |  Branch (3438:9): [True: 0, False: 7]
  ------------------
 3439|      0|    {
 3440|      0|        FreeInChIExtInput( *iip, *iiv );
 3441|      0|    }
 3442|       |
 3443|      7|    return err;
 3444|      7|}

RunBalancedNetworkSearch:
  675|   110k|{
  676|   110k|    int pass, delta = 0, nSumDelta;
  677|       |
  678|   110k|    nSumDelta = 0;
  679|   110k|    for (pass = 0; pass < pBNS->max_altp; pass++)
  ------------------
  |  Branch (679:20): [True: 110k, False: 0]
  ------------------
  680|   110k|    {
  681|   110k|        pBNS->alt_path = pBNS->altp[pass];
  682|   110k|        pBNS->bChangeFlow = 0;
  683|   110k|        delta = BalancedNetworkSearch( pBNS, pBD, bChangeFlow );
  684|   110k|        ReInitBnData( pBD );
  685|   110k|        if (0 < delta)
  ------------------
  |  Branch (685:13): [True: 15, False: 110k]
  ------------------
  686|     15|        {
  687|     15|            pBNS->num_altp++;
  688|     15|            nSumDelta += abs( delta );
  689|     15|        }
  690|   110k|        else
  691|   110k|        {
  692|   110k|            break;
  693|   110k|        }
  694|   110k|    }
  695|       |
  696|   110k|    if (IS_BNS_ERROR( delta ))
  ------------------
  |  |   95|   110k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|   110k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|   110k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|   110k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 110k, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
  697|      0|    {
  698|      0|        return delta;
  699|      0|    }
  700|       |
  701|   110k|    if (bInchiTimeIsOver( pBNS->ic, pBNS->ulTimeOutTime ))
  ------------------
  |  Branch (701:9): [True: 0, False: 110k]
  ------------------
  702|      0|    {
  703|      0|        return BNS_TIMEOUT;
  ------------------
  |  |   91|      0|#define BNS_TIMEOUT        (BNS_ERR + 14) /*(-9985)*/ /* v. 1.05 */
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
  704|      0|    }
  705|       |
  706|   110k|    return nSumDelta; /* number of eliminated pairs of "dots"  */
  707|   110k|}
AddOrRemoveExplOrImplH:
  892|      4|{
  893|      4|    int i, iso, tot_num_iso_H,
  894|      4|        num_H,                  /* number of H before the removal, including explicit H  */
  895|      4|        nNum2Remove,            /* number of H to remove */
  896|      4|        nNumRemovedExplicitH,
  897|      4|        nNumExplicit2Implicit;
  898|      4|    S_CHAR    num_iso_H[NUM_H_ISOTOPES];
  899|      4|    inp_ATOM *at_H;
  900|       |
  901|      4|    if (!nDelta)
  ------------------
  |  Branch (901:9): [True: 0, False: 4]
  ------------------
  902|      0|    {
  903|      0|        return 0;
  904|      0|    }
  905|       |    /* add */
  906|      4|    if (nDelta > 0)
  ------------------
  |  Branch (906:9): [True: 4, False: 0]
  ------------------
  907|      4|    {
  908|      4|        at[at_no].num_H += nDelta;
  909|      4|        t_group_info->tni.nNumRemovedProtons--;
  910|      4|        return nDelta;
  911|      4|    }
  912|       |    /* remove */
  913|      0|    nNum2Remove = -nDelta;
  914|      0|    nNumRemovedExplicitH = t_group_info->tni.nNumRemovedExplicitH; /* number of explicit H saved separately in
  915|       |                                                                   at[num_atoms+i], i=0..nNumRemovedExplicitH-1 */
  916|      0|    tot_num_iso_H = NUM_ISO_H( at, at_no );
  ------------------
  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  ------------------
  917|      0|    num_H = at[at_no].num_H;
  918|       |    /*
  919|       |    tot_num_iso_H          = NUM_ISO_H(at,at_no);
  920|       |    num_H                  = at[at_no].num_H;
  921|       |    nNumAtomExplicitH      = 0;
  922|       |    nNumRemovedExplicitH   = t_group_info->tni.nNumRemovedExplicitH;
  923|       |    tot_num_explicit_iso_H = 0;
  924|       |    */
  925|       |
  926|      0|    at_H = at + num_atoms;
  927|      0|    memcpy( num_iso_H, at[at_no].num_iso_H, sizeof( num_iso_H ) );
  928|       |
  929|       |    /*  Remove all explicit H, otherwise a false stereo can occur.
  930|       |    Example: remove H(+) from the following substructure:
  931|       |
  932|       |    H                                            H
  933|       |    A      /                                      A     /
  934|       |    >X==N(+)    produces false stereogenic bond:  >X==N
  935|       |    B      \                                      B
  936|       |    H
  937|       |
  938|       |    To avoid this effect all explicit H atoms must be removed
  939|       |    */
  940|       |
  941|      0|    nNumExplicit2Implicit = 0;
  942|      0|    for (i = 0; i < nNumRemovedExplicitH; )
  ------------------
  |  Branch (942:17): [True: 0, False: 0]
  ------------------
  943|      0|    {
  944|      0|        if (at_H[i].neighbor[0] == at_no)
  ------------------
  |  Branch (944:13): [True: 0, False: 0]
  ------------------
  945|      0|        {
  946|      0|            int m, k, orig_no = at_H[i].orig_at_number;
  947|      0|            nNumRemovedExplicitH--;
  948|      0|            nNumExplicit2Implicit++;
  949|      0|            if (nNumRemovedExplicitH > i)
  ------------------
  |  Branch (949:17): [True: 0, False: 0]
  ------------------
  950|      0|            {
  951|      0|                inp_ATOM at_i = at_H[i];
  952|      0|                memmove( at_H + i, at_H + i + 1, sizeof( at_H[0] )*( nNumRemovedExplicitH - i ) );
  953|      0|                at_H[nNumRemovedExplicitH] = at_i; /* save removed H (for debugging purposes?) */
  954|      0|            }
  955|       |            /* Adjust 0D parities */
  956|      0|            if (at[at_no].sb_parity[0])
  ------------------
  |  Branch (956:17): [True: 0, False: 0]
  ------------------
  957|      0|            {
  958|      0|                for (m = 0; m < MAX_NUM_STEREO_BONDS && at[at_no].sb_parity[m]; m++)
  ------------------
  |  |  876|      0|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (958:29): [True: 0, False: 0]
  |  Branch (958:57): [True: 0, False: 0]
  ------------------
  959|      0|                {
  960|      0|                    if (at[at_no].sn_orig_at_num[m] == orig_no)
  ------------------
  |  Branch (960:25): [True: 0, False: 0]
  ------------------
  961|      0|                    {
  962|      0|                        if (at[at_no].valence >= MIN_NUM_STEREO_BOND_NEIGH)
  ------------------
  |  |  878|      0|#define MIN_NUM_STEREO_BOND_NEIGH 2
  ------------------
  |  Branch (962:29): [True: 0, False: 0]
  ------------------
  963|      0|                        {
  964|      0|                            at[at_no].sn_ord[m] = k = ( at[at_no].sb_ord[m] == 0 );
  965|      0|                            at[at_no].sn_orig_at_num[m] = at[(int) at[at_no].neighbor[k]].orig_at_number;
  966|      0|                            if (ATOM_PARITY_WELL_DEF( at[at_no].sb_parity[m] ))
  ------------------
  |  |  287|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  265|      0|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  264|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (287:38): [True: 0, False: 0]
  |  |  |  Branch (287:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  967|      0|                            {
  968|      0|                                at[at_no].sb_parity[m] = 3 - at[at_no].sb_parity[m];
  969|      0|                            }
  970|      0|                        }
  971|      0|                        else
  972|      0|                        {
  973|      0|                            at[at_no].sn_ord[m] = -99; /* no sb neighbor exists anymore */
  974|      0|                            at[at_no].sn_orig_at_num[m] = 0;
  975|      0|                            if (ATOM_PARITY_WELL_DEF( at[at_no].sb_parity[m] ))
  ------------------
  |  |  287|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  265|      0|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  264|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (287:38): [True: 0, False: 0]
  |  |  |  Branch (287:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  976|      0|                            {
  977|      0|                                int pnxt_atom, pinxt2cur, pinxt_sb_parity_ord;
  978|      0|                                if (0 < get_opposite_sb_atom( at, at_no, at[at_no].sb_ord[m],
  ------------------
  |  Branch (978:37): [True: 0, False: 0]
  ------------------
  979|      0|                                                              &pnxt_atom, &pinxt2cur, &pinxt_sb_parity_ord ))
  980|      0|                                {
  981|      0|                                    at[at_no].sb_parity[m] =
  982|      0|                                        at[pnxt_atom].sb_parity[pinxt_sb_parity_ord] = AB_PARITY_UNDF;
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  983|      0|                                }
  984|      0|                            }
  985|      0|                        }
  986|      0|                    }
  987|      0|                }
  988|      0|            }
  989|       |            /* do not increment i here: we have shifted next at_H[] element
  990|       |            to the ith position and decremented nNumRemovedExplicitH */
  991|      0|        }
  992|      0|        else
  993|      0|        {
  994|      0|            i++;
  995|      0|        }
  996|      0|    }
  997|       |
  998|      0|    for (iso = -1; iso < NUM_H_ISOTOPES && 0 < nNum2Remove; iso++)
  ------------------
  |  |   53|      0|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (998:20): [True: 0, False: 0]
  |  Branch (998:44): [True: 0, False: 0]
  ------------------
  999|      0|    {
 1000|       |        /* Each pass removes up to one H */
 1001|      0|        if (iso < 0)
  ------------------
  |  Branch (1001:13): [True: 0, False: 0]
  ------------------
 1002|      0|        {
 1003|       |            /* Try to remove non-isotopic */
 1004|      0|            while (tot_num_iso_H < num_H && 0 < nNum2Remove)
  ------------------
  |  Branch (1004:20): [True: 0, False: 0]
  |  Branch (1004:45): [True: 0, False: 0]
  ------------------
 1005|      0|            {
 1006|       |                /* Non-isotopic H exists */
 1007|      0|                num_H--;
 1008|      0|                t_group_info->tni.nNumRemovedProtons++;
 1009|      0|                nNum2Remove--;
 1010|      0|            }
 1011|      0|        }
 1012|      0|        else
 1013|      0|        {
 1014|       |            /* Remove isotopic */
 1015|      0|            while (num_iso_H[iso] && num_H && 0 < nNum2Remove)
  ------------------
  |  Branch (1015:20): [True: 0, False: 0]
  |  Branch (1015:38): [True: 0, False: 0]
  |  Branch (1015:47): [True: 0, False: 0]
  ------------------
 1016|      0|            {
 1017|       |                /* Isotopic H exists */
 1018|      0|                num_H--;
 1019|      0|                num_iso_H[iso] --;
 1020|      0|                t_group_info->tni.nNumRemovedProtonsIsotopic[iso] ++;
 1021|      0|                t_group_info->tni.nNumRemovedProtons++;
 1022|      0|                nNum2Remove--;
 1023|      0|            }
 1024|      0|        }
 1025|      0|    }
 1026|       |#if ( bRELEASE_VERSION != 1 )
 1027|       |    if (nNum2Remove)
 1028|       |    {
 1029|       |        int stop = 1; /* <BRKPT> Program error */
 1030|       |    }
 1031|       |#endif
 1032|      0|    if (nDelta + nNum2Remove < 0)
  ------------------
  |  Branch (1032:9): [True: 0, False: 0]
  ------------------
 1033|      0|    {
 1034|      0|        at[at_no].num_H = num_H;
 1035|      0|        memcpy( at[at_no].num_iso_H, num_iso_H, sizeof( at[0].num_iso_H ) );
 1036|      0|        t_group_info->tni.nNumRemovedExplicitH = nNumRemovedExplicitH;
 1037|      0|    }
 1038|       |
 1039|      0|    return nDelta + nNum2Remove;
 1040|      4|}
bNeedToTestTheFlow:
 1579|      6|{
 1580|      6|    int nBondType = ( BOND_TYPE_MASK & bond_type );
  ------------------
  |  |  217|      6|#define BOND_TYPE_MASK        0x0f
  ------------------
 1581|      6|    int nBondAttrib = ( BOND_MARK_MASK & bond_type );
  ------------------
  |  |  226|      6|#define BOND_MARK_MASK        0x70
  ------------------
 1582|       |
 1583|      6|    if (bTestForNonStereoBond)
  ------------------
  |  Branch (1583:9): [True: 6, False: 0]
  ------------------
 1584|      6|    {
 1585|      6|        if (nBondAttrib || nBondType == BOND_ALTERN || nBondType == BOND_ALT12NS)
  ------------------
  |  |  208|      6|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   63|     12|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
                      if (nBondAttrib || nBondType == BOND_ALTERN || nBondType == BOND_ALT12NS)
  ------------------
  |  |  214|      6|#define BOND_ALT12NS             9
  ------------------
  |  Branch (1585:13): [True: 0, False: 6]
  |  Branch (1585:28): [True: 0, False: 6]
  |  Branch (1585:56): [True: 0, False: 6]
  ------------------
 1586|      0|        {
 1587|      0|            switch (nTestFlow)
  ------------------
  |  Branch (1587:21): [True: 0, False: 0]
  ------------------
 1588|      0|            {
 1589|      0|                case 0:  /* single: can be 1 (single)?  */
  ------------------
  |  Branch (1589:17): [True: 0, False: 0]
  ------------------
 1590|      0|                    if (nBondAttrib == BOND_MARK_ALT12NS ||
  ------------------
  |  |  225|      0|#define BOND_MARK_ALT12NS     0x50  /* 1 or 2, non-stereo                   */
  ------------------
  |  Branch (1590:25): [True: 0, False: 0]
  ------------------
 1591|      0|                         nBondAttrib == BOND_MARK_ALT123 ||
  ------------------
  |  |  222|      0|#define BOND_MARK_ALT123      0x20
  ------------------
  |  Branch (1591:26): [True: 0, False: 0]
  ------------------
 1592|      0|                         nBondAttrib == BOND_MARK_ALT13)
  ------------------
  |  |  223|      0|#define BOND_MARK_ALT13       0x30
  ------------------
  |  Branch (1592:26): [True: 0, False: 0]
  ------------------
 1593|      0|                    {
 1594|      0|                        return 0; /* yes, already checked */
 1595|      0|                    }
 1596|      0|                    break;
 1597|       |
 1598|      0|                case 1:  /* double: can be 2 (double)? */
  ------------------
  |  Branch (1598:17): [True: 0, False: 0]
  ------------------
 1599|      0|                    if (nBondAttrib == BOND_MARK_ALT12NS ||
  ------------------
  |  |  225|      0|#define BOND_MARK_ALT12NS     0x50  /* 1 or 2, non-stereo                   */
  ------------------
  |  Branch (1599:25): [True: 0, False: 0]
  ------------------
 1600|      0|                         nBondAttrib == BOND_MARK_ALT123 ||
  ------------------
  |  |  222|      0|#define BOND_MARK_ALT123      0x20
  ------------------
  |  Branch (1600:26): [True: 0, False: 0]
  ------------------
 1601|      0|                         nBondAttrib == BOND_MARK_ALT23)
  ------------------
  |  |  224|      0|#define BOND_MARK_ALT23       0x40
  ------------------
  |  Branch (1601:26): [True: 0, False: 0]
  ------------------
 1602|      0|                    {
 1603|      0|                        return 0; /* yes, already checked */
 1604|      0|                    }
 1605|      0|                    break;
 1606|      0|                case 2:  /* triple: can be 3 (triple)?  */
  ------------------
  |  Branch (1606:17): [True: 0, False: 0]
  ------------------
 1607|      0|                    if (nBondAttrib == BOND_MARK_ALT13 ||
  ------------------
  |  |  223|      0|#define BOND_MARK_ALT13       0x30
  ------------------
  |  Branch (1607:25): [True: 0, False: 0]
  ------------------
 1608|      0|                         nBondAttrib == BOND_MARK_ALT123 ||
  ------------------
  |  |  222|      0|#define BOND_MARK_ALT123      0x20
  ------------------
  |  Branch (1608:26): [True: 0, False: 0]
  ------------------
 1609|      0|                         nBondAttrib == BOND_MARK_ALT23)
  ------------------
  |  |  224|      0|#define BOND_MARK_ALT23       0x40
  ------------------
  |  Branch (1609:26): [True: 0, False: 0]
  ------------------
 1610|      0|                    {
 1611|      0|                        return 0; /* yes, already checked */
 1612|      0|                    }
 1613|      0|                    break;
 1614|      0|            }
 1615|      0|        }
 1616|      6|    }
 1617|      0|    else
 1618|      0|    {
 1619|      0|        if (nBondAttrib || nBondType == BOND_ALTERN || nBondType == BOND_ALT12NS)
  ------------------
  |  |  208|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   63|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
                      if (nBondAttrib || nBondType == BOND_ALTERN || nBondType == BOND_ALT12NS)
  ------------------
  |  |  214|      0|#define BOND_ALT12NS             9
  ------------------
  |  Branch (1619:13): [True: 0, False: 0]
  |  Branch (1619:28): [True: 0, False: 0]
  |  Branch (1619:56): [True: 0, False: 0]
  ------------------
 1620|      0|        {
 1621|      0|            switch (nTestFlow)
  ------------------
  |  Branch (1621:21): [True: 0, False: 0]
  ------------------
 1622|      0|            {
 1623|      0|                case 0:  /* single: can be 1 (single)?  */
  ------------------
  |  Branch (1623:17): [True: 0, False: 0]
  ------------------
 1624|      0|                    if (nBondAttrib == BOND_MARK_ALT12 ||
  ------------------
  |  |  221|      0|#define BOND_MARK_ALT12       0x10
  ------------------
  |  Branch (1624:25): [True: 0, False: 0]
  ------------------
 1625|      0|                         nBondAttrib == BOND_MARK_ALT12NS ||
  ------------------
  |  |  225|      0|#define BOND_MARK_ALT12NS     0x50  /* 1 or 2, non-stereo                   */
  ------------------
  |  Branch (1625:26): [True: 0, False: 0]
  ------------------
 1626|      0|                         nBondAttrib == BOND_MARK_ALT123 ||
  ------------------
  |  |  222|      0|#define BOND_MARK_ALT123      0x20
  ------------------
  |  Branch (1626:26): [True: 0, False: 0]
  ------------------
 1627|      0|                         nBondAttrib == BOND_MARK_ALT13)
  ------------------
  |  |  223|      0|#define BOND_MARK_ALT13       0x30
  ------------------
  |  Branch (1627:26): [True: 0, False: 0]
  ------------------
 1628|      0|                    {
 1629|      0|                        return 0;
 1630|      0|                    }
 1631|      0|                    break;
 1632|       |
 1633|      0|                case 1:  /* double: can be 2 (double)? */
  ------------------
  |  Branch (1633:17): [True: 0, False: 0]
  ------------------
 1634|      0|                    if (nBondAttrib == BOND_MARK_ALT12 ||
  ------------------
  |  |  221|      0|#define BOND_MARK_ALT12       0x10
  ------------------
  |  Branch (1634:25): [True: 0, False: 0]
  ------------------
 1635|      0|                         nBondAttrib == BOND_MARK_ALT12NS ||
  ------------------
  |  |  225|      0|#define BOND_MARK_ALT12NS     0x50  /* 1 or 2, non-stereo                   */
  ------------------
  |  Branch (1635:26): [True: 0, False: 0]
  ------------------
 1636|      0|                         nBondAttrib == BOND_MARK_ALT123 ||
  ------------------
  |  |  222|      0|#define BOND_MARK_ALT123      0x20
  ------------------
  |  Branch (1636:26): [True: 0, False: 0]
  ------------------
 1637|      0|                         nBondAttrib == BOND_MARK_ALT23)
  ------------------
  |  |  224|      0|#define BOND_MARK_ALT23       0x40
  ------------------
  |  Branch (1637:26): [True: 0, False: 0]
  ------------------
 1638|      0|                    {
 1639|      0|                        return 0; /* yes */
 1640|      0|                    }
 1641|      0|                    break;
 1642|      0|                case 2:  /* triple: can be 3 (triple)?  */
  ------------------
  |  Branch (1642:17): [True: 0, False: 0]
  ------------------
 1643|      0|                    if (nBondAttrib == BOND_MARK_ALT13 ||
  ------------------
  |  |  223|      0|#define BOND_MARK_ALT13       0x30
  ------------------
  |  Branch (1643:25): [True: 0, False: 0]
  ------------------
 1644|      0|                         nBondAttrib == BOND_MARK_ALT123 ||
  ------------------
  |  |  222|      0|#define BOND_MARK_ALT123      0x20
  ------------------
  |  Branch (1644:26): [True: 0, False: 0]
  ------------------
 1645|      0|                         nBondAttrib == BOND_MARK_ALT23)
  ------------------
  |  |  224|      0|#define BOND_MARK_ALT23       0x40
  ------------------
  |  Branch (1645:26): [True: 0, False: 0]
  ------------------
 1646|      0|                    {
 1647|      0|                        return 0;
 1648|      0|                    }
 1649|      0|                    break;
 1650|      0|            }
 1651|      0|        }
 1652|      0|    }
 1653|       |
 1654|      6|    return 1;
 1655|      6|}
nBondsValenceInpAt:
 1662|   222k|{
 1663|   222k|    int j, bond_type, nBondsValence = 0, nAltBonds = 0, nNumWrong = 0;
 1664|   222k|    for (j = 0; j < at->valence; j++)
  ------------------
  |  Branch (1664:17): [True: 112, False: 222k]
  ------------------
 1665|    112|    {
 1666|    112|        bond_type = at->bond_type[j] & BOND_TYPE_MASK;
  ------------------
  |  |  217|    112|#define BOND_TYPE_MASK        0x0f
  ------------------
 1667|    112|        switch (bond_type)
 1668|    112|        {
 1669|      0|            case 0:  /* for structure from InChI reconstruction */
  ------------------
  |  Branch (1669:13): [True: 0, False: 112]
  ------------------
 1670|     84|            case BOND_SINGLE:
  ------------------
  |  |  205|     84|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   60|     84|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (1670:13): [True: 84, False: 28]
  ------------------
 1671|    112|            case BOND_DOUBLE:
  ------------------
  |  |  206|    112|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   61|    112|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (1671:13): [True: 28, False: 84]
  ------------------
 1672|    112|            case BOND_TRIPLE:
  ------------------
  |  |  207|    112|#define BOND_TRIPLE BOND_TYPE_TRIPLE  /* 3                                  */
  |  |  ------------------
  |  |  |  |   62|    112|#define BOND_TYPE_TRIPLE    3
  |  |  ------------------
  ------------------
  |  Branch (1672:13): [True: 0, False: 112]
  ------------------
 1673|    112|                nBondsValence += bond_type;
 1674|    112|                break;
 1675|      0|            case BOND_ALTERN:
  ------------------
  |  |  208|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   63|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (1675:13): [True: 0, False: 112]
  ------------------
 1676|      0|                nAltBonds++;
 1677|      0|                break;
 1678|      0|            default:
  ------------------
  |  Branch (1678:13): [True: 0, False: 112]
  ------------------
 1679|      0|                nNumWrong++;
 1680|    112|        }
 1681|    112|    }
 1682|   222k|    switch (nAltBonds)
 1683|   222k|    {
 1684|   222k|        case 0:
  ------------------
  |  Branch (1684:9): [True: 222k, False: 0]
  ------------------
 1685|   222k|            break;
 1686|      0|        case 1:
  ------------------
  |  Branch (1686:9): [True: 0, False: 222k]
  ------------------
 1687|      0|            nBondsValence += 1; /* 1 or greater than 3 is wrong */
 1688|      0|            nNumWrong++;
 1689|      0|            break;
 1690|      0|        default:
  ------------------
  |  Branch (1690:9): [True: 0, False: 222k]
  ------------------
 1691|      0|            nBondsValence += nAltBonds + 1;
 1692|      0|            break;
 1693|   222k|    }
 1694|   222k|    if (nNumAltBonds)
  ------------------
  |  Branch (1694:9): [True: 112k, False: 109k]
  ------------------
 1695|   112k|    {
 1696|   112k|        *nNumAltBonds = nAltBonds;
 1697|   112k|    }
 1698|   222k|    if (nNumWrongBonds)
  ------------------
  |  Branch (1698:9): [True: 112k, False: 109k]
  ------------------
 1699|   112k|    {
 1700|   112k|        *nNumWrongBonds = nNumWrong;
 1701|   112k|    }
 1702|       |
 1703|   222k|    return nBondsValence;
 1704|   222k|}
BnsAdjustFlowBondsRad:
 1715|   110k|{
 1716|   110k|    int  bError = 0, nOrigDelta = 0, ret, num_removed;
 1717|       |
 1718|   110k|#if( CHECK_AROMBOND2ALT == 1 )
 1719|   110k|    int *pcValMinusBondsVal = NULL;
 1720|   110k|    int  i, nValMinusBondsVal, nAltBonds, bIgnore, valen, is_rad, excess;
 1721|       |
 1722|       |    /* Find valence excess (it may only be due to aromatic bonds) */
 1723|   222k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1723:17): [True: 112k, False: 110k]
  ------------------
 1724|   112k|    {
 1725|   112k|        valen = nBondsValenceInpAt( at + i, &nAltBonds, &bIgnore );
 1726|   112k|        nValMinusBondsVal = (int) at[i].chem_bonds_valence - valen;
 1727|   112k|        bIgnore += ( nAltBonds > 3 );
 1728|   112k|        if (!bIgnore && nValMinusBondsVal > 0)
  ------------------
  |  Branch (1728:13): [True: 112k, False: 0]
  |  Branch (1728:25): [True: 0, False: 112k]
  ------------------
 1729|      0|        {
 1730|      0|            if (!pcValMinusBondsVal &&
  ------------------
  |  Branch (1730:17): [True: 0, False: 0]
  ------------------
 1731|      0|                 !( pcValMinusBondsVal = (int *) inchi_calloc( num_atoms, sizeof( pcValMinusBondsVal[0] ) ) ))
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  |  Branch (1731:18): [True: 0, False: 0]
  ------------------
 1732|      0|            {
 1733|      0|                bError = BNS_OUT_OF_RAM;
  ------------------
  |  |   77|      0|#define BNS_OUT_OF_RAM     (BNS_ERR +  1) /*(-9998)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 1734|      0|                goto exit_function;
 1735|      0|            }
 1736|       |            /* Mark atoms that have extra unsatisfied valence due to aromatic bonds */
 1737|      0|            is_rad = ( at[i].radical == RADICAL_DOUBLET );
  ------------------
  |  |  104|      0|#define RADICAL_DOUBLET 2
  ------------------
 1738|      0|            excess = nValMinusBondsVal + is_rad;
 1739|      0|            pcValMinusBondsVal[i] = excess;
 1740|      0|        }
 1741|   112k|    }
 1742|   110k|#endif /* CHECK_AROMBOND2ALT */
 1743|       |
 1744|       |    /* Match bonds to valences */
 1745|   110k|    do
 1746|   110k|    {
 1747|   110k|        num_removed = 0;
 1748|   110k|        ret = RunBalancedNetworkSearch( pBNS, pBD, BNS_EF_CHNG_FLOW );
  ------------------
  |  |  379|   110k|#define BNS_EF_CHNG_FLOW      1  /* change Balanced Network (BN) flow inside the BNS search */
  ------------------
 1749|   110k|        if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|   110k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|   110k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|   110k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|   110k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 110k, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
 1750|      0|        {
 1751|      0|            bError = ret;
 1752|      0|        }
 1753|   110k|        else
 1754|   110k|        {
 1755|   110k|            nOrigDelta += ret;
 1756|   110k|            num_removed = pBNS->num_altp; /* number of augmenting paths */
 1757|   110k|            if (ret > 0)
  ------------------
  |  Branch (1757:17): [True: 0, False: 110k]
  ------------------
 1758|      0|            {
 1759|       |                /* save new bonds in at[] and flows in pBNS and at[] */
 1760|      0|                ret = SetBondsFromBnStructFlow( pBNS, at, num_atoms, BNS_EF_SAVE_ALL ); /* must include 1: 5=(4|1) */
  ------------------
  |  |  390|      0|#define BNS_EF_SAVE_ALL     (BNS_EF_CHNG_FLOW | BNS_EF_CHNG_BONDS | BNS_EF_UPD_RAD_ORI)
  |  |  ------------------
  |  |  |  |  379|      0|#define BNS_EF_CHNG_FLOW      1  /* change Balanced Network (BN) flow inside the BNS search */
  |  |  ------------------
  |  |               #define BNS_EF_SAVE_ALL     (BNS_EF_CHNG_FLOW | BNS_EF_CHNG_BONDS | BNS_EF_UPD_RAD_ORI)
  |  |  ------------------
  |  |  |  |  382|      0|#define BNS_EF_CHNG_BONDS     4  /* change bonds in the structure according to the BN flow */
  |  |  ------------------
  |  |               #define BNS_EF_SAVE_ALL     (BNS_EF_CHNG_FLOW | BNS_EF_CHNG_BONDS | BNS_EF_UPD_RAD_ORI)
  |  |  ------------------
  |  |  |  |  384|      0|#define BNS_EF_UPD_RAD_ORI   16  /* update BN flow0 & Atom radical values:
  |  |  ------------------
  ------------------
 1761|      0|                if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1762|      0|                {
 1763|      0|                    bError = ret;
 1764|      0|                }
 1765|      0|                ret = RestoreBnStructFlow( pBNS, BNS_EF_SAVE_ALL ); /* must include 1: 5=(4|1) */
  ------------------
  |  |  390|      0|#define BNS_EF_SAVE_ALL     (BNS_EF_CHNG_FLOW | BNS_EF_CHNG_BONDS | BNS_EF_UPD_RAD_ORI)
  |  |  ------------------
  |  |  |  |  379|      0|#define BNS_EF_CHNG_FLOW      1  /* change Balanced Network (BN) flow inside the BNS search */
  |  |  ------------------
  |  |               #define BNS_EF_SAVE_ALL     (BNS_EF_CHNG_FLOW | BNS_EF_CHNG_BONDS | BNS_EF_UPD_RAD_ORI)
  |  |  ------------------
  |  |  |  |  382|      0|#define BNS_EF_CHNG_BONDS     4  /* change bonds in the structure according to the BN flow */
  |  |  ------------------
  |  |               #define BNS_EF_SAVE_ALL     (BNS_EF_CHNG_FLOW | BNS_EF_CHNG_BONDS | BNS_EF_UPD_RAD_ORI)
  |  |  ------------------
  |  |  |  |  384|      0|#define BNS_EF_UPD_RAD_ORI   16  /* update BN flow0 & Atom radical values:
  |  |  ------------------
  ------------------
 1766|      0|                if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1767|      0|                {
 1768|      0|                    bError = ret;
 1769|      0|                }
 1770|      0|            }
 1771|   110k|            ReInitBnStructAltPaths( pBNS );
 1772|   110k|        }
 1773|   110k|    } while (num_removed && num_removed == pBNS->max_altp && !bError);
  ------------------
  |  Branch (1773:14): [True: 0, False: 110k]
  |  Branch (1773:29): [True: 0, False: 0]
  |  Branch (1773:62): [True: 0, False: 0]
  ------------------
 1774|       |
 1775|   110k|#if( CHECK_AROMBOND2ALT == 1 )
 1776|       |    /* Check whether aromatic bonds have been replaces with alternating bonds */
 1777|   110k|    if (!bError && pcValMinusBondsVal)
  ------------------
  |  Branch (1777:9): [True: 110k, False: 0]
  |  Branch (1777:20): [True: 0, False: 110k]
  ------------------
 1778|      0|    {
 1779|      0|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1779:21): [True: 0, False: 0]
  ------------------
 1780|      0|        {
 1781|      0|            if (!pcValMinusBondsVal[i])
  ------------------
  |  Branch (1781:17): [True: 0, False: 0]
  ------------------
 1782|      0|            {
 1783|      0|                continue;
 1784|      0|            }
 1785|      0|            valen = nBondsValenceInpAt( at + i, &nAltBonds, &bIgnore );
 1786|      0|            nValMinusBondsVal = (int) at[i].chem_bonds_valence - valen;
 1787|      0|            is_rad = ( at[i].radical == RADICAL_DOUBLET );
  ------------------
  |  |  104|      0|#define RADICAL_DOUBLET 2
  ------------------
 1788|      0|            excess = nValMinusBondsVal + is_rad;
 1789|      0|            if (bIgnore ||
  ------------------
  |  Branch (1789:17): [True: 0, False: 0]
  ------------------
 1790|      0|                ( pcValMinusBondsVal[i] - excess ) != 1)
  ------------------
  |  Branch (1790:17): [True: 0, False: 0]
  ------------------
 1791|      0|            {
 1792|       |                /* radical excess has not been reduced */
 1793|      0|                bError = BNS_ALTBOND_ERR;
  ------------------
  |  |   89|      0|#define BNS_ALTBOND_ERR    (BNS_ERR + 13) /*(-9986)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 1794|      0|                break;
 1795|      0|            }
 1796|      0|        }
 1797|      0|    }
 1798|       |
 1799|   110k|exit_function:
 1800|   110k|    if (pcValMinusBondsVal)
  ------------------
  |  Branch (1800:9): [True: 0, False: 110k]
  ------------------
 1801|      0|    {
 1802|      0|        inchi_free( pcValMinusBondsVal );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1803|      0|    }
 1804|   110k|#endif /* CHECK_AROMBOND2ALT */
 1805|       |
 1806|   110k|    return bError ? bError : nOrigDelta;
  ------------------
  |  Branch (1806:12): [True: 0, False: 110k]
  ------------------
 1807|   110k|}
BnsTestAndMarkAltBonds:
 1818|   110k|{
 1819|   110k|    int ret, iat, ineigh, neigh;
 1820|   110k|    int nMinFlow, nMaxFlow, nTestFlow, nCurFlow;
 1821|   110k|    int iedge, bSuccess, bError, nDots, nChanges, bTestForNonStereoBond;
 1822|       |
 1823|       |    /* Normalize bonds and find tautomeric groups */
 1824|   110k|    bError = 0;
 1825|   110k|    nChanges = 0;
 1826|   110k|    bTestForNonStereoBond = pBNS->tot_st_cap > pBNS->tot_st_flow;
 1827|       |
 1828|   222k|    for (iat = 0; iat < num_atoms && !bError; iat++)
  ------------------
  |  Branch (1828:19): [True: 112k, False: 110k]
  |  Branch (1828:38): [True: 112k, False: 0]
  ------------------
 1829|   112k|    {
 1830|   112k|        for (ineigh = 0; ineigh < at[iat].valence && !bError; ineigh++)
  ------------------
  |  Branch (1830:26): [True: 64, False: 112k]
  |  Branch (1830:54): [True: 64, False: 0]
  ------------------
 1831|     64|        {
 1832|     64|            neigh = at[iat].neighbor[ineigh];
 1833|     64|            if (neigh < iat)
  ------------------
  |  Branch (1833:17): [True: 32, False: 32]
  ------------------
 1834|     32|            {
 1835|     32|                continue; /* we have already tested the bond */
 1836|     32|            }
 1837|     32|            iedge = pBNS->vert[iat].iedge[ineigh];
 1838|     32|            if (IS_FORBIDDEN( pBNS->edge[iedge].forbidden, pBNS ))
  ------------------
  |  |   65|     32|#define IS_FORBIDDEN(EDGE_FORBIDDEN, PBNS)     (EDGE_FORBIDDEN)
  |  |  ------------------
  |  |  |  Branch (65:48): [True: 0, False: 32]
  |  |  ------------------
  ------------------
 1839|      0|            {
 1840|      0|                continue;
 1841|      0|            }
 1842|     32|            if (nBondTypeToTest && ( at[iat].bond_type[ineigh] & BOND_TYPE_MASK ) != nBondTypeToTest)
  ------------------
  |  |  217|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
  |  Branch (1842:17): [True: 0, False: 32]
  |  Branch (1842:36): [True: 0, False: 0]
  ------------------
 1843|      0|            {
 1844|      0|                continue;
 1845|      0|            }
 1846|     32|            nMinFlow = nMinFlow2Check( pBNS, iedge );
 1847|     32|            nMaxFlow = nMaxFlow2Check( pBNS, iedge );
 1848|     32|            nCurFlow = nCurFlow2Check( pBNS, iedge );
 1849|     32|            if (nMinFlow == nMaxFlow)
  ------------------
  |  Branch (1849:17): [True: 32, False: 0]
  ------------------
 1850|     32|            {
 1851|     32|                if (nMaxFlow && bTestForNonStereoBond)
  ------------------
  |  Branch (1851:21): [True: 8, False: 24]
  |  Branch (1851:33): [True: 6, False: 2]
  ------------------
 1852|      6|                {
 1853|      6|                    nTestFlow = nMaxFlow - (int) ( pBNS->tot_st_cap - pBNS->tot_st_flow ); /* temporary use of nTestFlow */
 1854|      6|                    nMinFlow = inchi_max( 0, nTestFlow );
  ------------------
  |  |  166|      6|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 2, False: 4]
  |  |  ------------------
  ------------------
 1855|      6|                }
 1856|     26|                else
 1857|     26|                {
 1858|     26|                    continue;
 1859|     26|                }
 1860|     32|            }
 1861|     18|            for (nTestFlow = nMinFlow; nTestFlow <= nMaxFlow && !bError; nTestFlow++)
  ------------------
  |  Branch (1861:40): [True: 12, False: 6]
  |  Branch (1861:65): [True: 12, False: 0]
  ------------------
 1862|     12|            {
 1863|     12|                if (nTestFlow == nCurFlow)
  ------------------
  |  Branch (1863:21): [True: 6, False: 6]
  ------------------
 1864|      6|                {
 1865|      6|                    continue;
 1866|      6|                }
 1867|      6|                if (!bNeedToTestTheFlow( at[iat].bond_type[ineigh], nTestFlow, bTestForNonStereoBond ))
  ------------------
  |  Branch (1867:21): [True: 0, False: 6]
  ------------------
 1868|      0|                {
 1869|      0|                    continue;
 1870|      0|                }
 1871|      6|                bSuccess = 0;
 1872|      6|                nDots = bSetFlowToCheckOneBond( pBNS, iedge, nTestFlow, fcd );
 1873|       |
 1874|      6|                if (IS_BNS_ERROR( nDots ))
  ------------------
  |  |   95|      6|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      6|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      6|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      6|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 6, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 6]
  |  |  ------------------
  ------------------
 1875|      0|                {
 1876|      0|                    if (nDots == BNS_CANT_SET_BOND)
  ------------------
  |  |   85|      0|#define BNS_CANT_SET_BOND  (BNS_ERR +  9) /*(-9990)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
  |  Branch (1876:25): [True: 0, False: 0]
  ------------------
 1877|      0|                    {
 1878|      0|                        ret = bRestoreFlowAfterCheckOneBond( pBNS, fcd );
 1879|      0|                        if (!IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1880|      0|                        {
 1881|      0|                            continue;
 1882|      0|                        }
 1883|      0|                    }
 1884|      0|                    bError = nDots;
 1885|      0|                }
 1886|      6|                else
 1887|      6|                {
 1888|      6|                    if (nDots > 0)
  ------------------
  |  Branch (1888:25): [True: 6, False: 0]
  ------------------
 1889|      6|                    {
 1890|      6|                        ret = RunBalancedNetworkSearch( pBNS, pBD, bChangeFlow );
 1891|      6|                        if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      6|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      6|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      6|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      6|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 6, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 6]
  |  |  ------------------
  ------------------
 1892|      0|                        {
 1893|      0|                            bError = ret;
 1894|      0|                        }
 1895|      6|                        else
 1896|      6|                        {
 1897|      6|                            if (ret > 0)
  ------------------
  |  Branch (1897:33): [True: 0, False: 6]
  ------------------
 1898|      0|                            {
 1899|      0|                                if (2 * ret == nDots)
  ------------------
  |  Branch (1899:37): [True: 0, False: 0]
  ------------------
 1900|      0|                                {
 1901|      0|                                    ret = bSetBondsAfterCheckOneBond( pBNS, fcd, nTestFlow, at, num_atoms, bChangeFlow );
 1902|      0|                                    if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1903|      0|                                    {
 1904|      0|                                        bError = ret;
 1905|      0|                                    }
 1906|      0|                                    else
 1907|      0|                                    {
 1908|      0|                                        nChanges += ( ret & 1 );
 1909|      0|                                        ret = SetBondsFromBnStructFlow( pBNS, at, num_atoms, bChangeFlow );
 1910|      0|                                        if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1911|      0|                                        {
 1912|      0|                                            bError = ret;
 1913|      0|                                        }
 1914|      0|                                        else
 1915|      0|                                        {
 1916|      0|                                            if (ret >= 0)
  ------------------
  |  Branch (1916:49): [True: 0, False: 0]
  ------------------
 1917|      0|                                            {
 1918|      0|                                                nChanges += ( ret & 1 );
 1919|      0|                                                bSuccess = 1;
 1920|      0|                                            }
 1921|      0|                                            else
 1922|      0|                                            {
 1923|      0|                                                bError = ret;
 1924|      0|                                            }
 1925|      0|                                        }
 1926|      0|                                    }
 1927|      0|                                }
 1928|       |                                /* typically 2*ret < nDots; 2*ret > nDots should not happen. Check later */
 1929|      0|                                ret = RestoreBnStructFlow( pBNS, bChangeFlow & BNS_EF_CHNG_RSTR );
  ------------------
  |  |  381|      0|#define BNS_EF_CHNG_RSTR      (BNS_EF_CHNG_FLOW | BNS_EF_RSTR_FLOW)
  |  |  ------------------
  |  |  |  |  379|      0|#define BNS_EF_CHNG_FLOW      1  /* change Balanced Network (BN) flow inside the BNS search */
  |  |  ------------------
  |  |               #define BNS_EF_CHNG_RSTR      (BNS_EF_CHNG_FLOW | BNS_EF_RSTR_FLOW)
  |  |  ------------------
  |  |  |  |  380|      0|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  |  |  ------------------
  ------------------
 1930|      0|                                if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1931|      0|                                {
 1932|      0|                                    bError = ret;
 1933|      0|                                }
 1934|      0|                            }
 1935|      6|                        }
 1936|       |                        /* --- Reinitialize to repeat the calculations --- */
 1937|      6|                        ReInitBnStructAltPaths( pBNS );
 1938|      6|                    }
 1939|       |
 1940|      0|                    else
 1941|      0|                    {
 1942|      0|                        if (nDots == 0)
  ------------------
  |  Branch (1942:29): [True: 0, False: 0]
  ------------------
 1943|      0|                        {
 1944|      0|                            ret = bSetBondsAfterCheckOneBond( pBNS, fcd, nTestFlow, at, num_atoms, bChangeFlow );
 1945|      0|                            if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1946|      0|                            {
 1947|      0|                                bError = ret;
 1948|      0|                            }
 1949|      0|                            else
 1950|      0|                            {
 1951|      0|                                nChanges += ( ret & 1 );
 1952|      0|                            }
 1953|      0|                        }
 1954|      0|                    }
 1955|      6|                }
 1956|       |
 1957|      6|                ret = bRestoreFlowAfterCheckOneBond( pBNS, fcd );
 1958|       |
 1959|      6|                if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      6|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      6|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      6|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      6|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 6, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 6]
  |  |  ------------------
  ------------------
 1960|      0|                {
 1961|      0|                    bError = ret;
 1962|      0|                }
 1963|       |
 1964|      6|            } /* for (nTestFlow = */
 1965|      6|        } /* for (ineigh = */
 1966|   112k|    } /* for (iat =  */
 1967|       |
 1968|   110k|    return bError ? bError : nChanges;
  ------------------
  |  Branch (1968:12): [True: 0, False: 110k]
  ------------------
 1969|   110k|}
SetForbiddenEdges:
 1994|   110k|{
 1995|       |
 1996|       |
 1997|   110k|    int i, j, neigh, num_found;
 1998|   110k|    BNS_IEDGE iedge;
 1999|       |    /*S_CHAR    edge_forbidden_mask = BNS_EDGE_FORBIDDEN_MASK;*/
 2000|   110k|    S_CHAR    edge_forbidden_mask = forbidden_mask;
 2001|       |
 2002|   110k|    pBNS->edge_forbidden_mask |= forbidden_mask;
 2003|       |
 2004|   110k|    num_found = 0;
 2005|       |
 2006|   227k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (2006:17): [True: 116k, False: 110k]
  ------------------
 2007|   116k|    {
 2008|       |        /* acetyl */
 2009|   116k|        if (at[i].el_number == EL_NUMBER_C && 3 == at[i].valence &&
  ------------------
  |  |   43|   233k|#define EL_NUMBER_C ((U_CHAR) 6)
  ------------------
  |  Branch (2009:13): [True: 87, False: 116k]
  |  Branch (2009:47): [True: 0, False: 87]
  ------------------
 2010|   116k|             4 == at[i].chem_bonds_valence)
  ------------------
  |  Branch (2010:14): [True: 0, False: 0]
  ------------------
 2011|      0|        {
 2012|      0|            int num_O = 0;
 2013|      0|            int bond_to_O_val = 0;
 2014|      0|            int forbidden_bond_pos = -1;
 2015|      0|            int forbidden_bond_val = -1;
 2016|      0|            for (j = 0; j < at[i].valence; j++)
  ------------------
  |  Branch (2016:25): [True: 0, False: 0]
  ------------------
 2017|      0|            {
 2018|      0|                neigh = at[i].neighbor[j];
 2019|      0|                if (at[neigh].el_number == EL_NUMBER_O &&
  ------------------
  |  |   45|      0|#define EL_NUMBER_O ((U_CHAR) 8)
  ------------------
  |  Branch (2019:21): [True: 0, False: 0]
  ------------------
 2020|      0|                     at[neigh].valence == 1)
  ------------------
  |  Branch (2020:22): [True: 0, False: 0]
  ------------------
 2021|      0|                {
 2022|      0|                    num_O++;
 2023|      0|                    bond_to_O_val += ( at[i].bond_type[j] & BOND_TYPE_MASK );
  ------------------
  |  |  217|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
 2024|      0|                }
 2025|      0|                else
 2026|      0|                {
 2027|      0|                    forbidden_bond_pos = j;
 2028|      0|                    forbidden_bond_val = ( at[i].bond_type[j] & BOND_TYPE_MASK );
  ------------------
  |  |  217|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
 2029|      0|                }
 2030|      0|            }
 2031|      0|            if (2 == num_O && 3 == bond_to_O_val && 1 == forbidden_bond_val)
  ------------------
  |  Branch (2031:17): [True: 0, False: 0]
  |  Branch (2031:31): [True: 0, False: 0]
  |  Branch (2031:53): [True: 0, False: 0]
  ------------------
 2032|      0|            {
 2033|      0|                iedge = pBNS->vert[i].iedge[forbidden_bond_pos];
 2034|      0|                pBNS->edge[iedge].forbidden |= edge_forbidden_mask;
 2035|      0|                num_found++;
 2036|      0|            }
 2037|      0|        }
 2038|   116k|        else
 2039|   116k|        {
 2040|       |            /* nitro */
 2041|   116k|            if (at[i].el_number == EL_NUMBER_N && 3 == at[i].valence &&
  ------------------
  |  |   44|   233k|#define EL_NUMBER_N ((U_CHAR) 7)
  ------------------
  |  Branch (2041:17): [True: 953, False: 115k]
  |  Branch (2041:51): [True: 0, False: 953]
  ------------------
 2042|   116k|                ( 4 == at[i].chem_bonds_valence || 5 == at[i].chem_bonds_valence ))
  ------------------
  |  Branch (2042:19): [True: 0, False: 0]
  |  Branch (2042:52): [True: 0, False: 0]
  ------------------
 2043|      0|            {
 2044|      0|                int num_O = 0;
 2045|      0|                int bond_to_O_val = 0;
 2046|      0|                int forbidden_bond_pos = -1;
 2047|      0|                int forbidden_bond_val = -1;
 2048|      0|                for (j = 0; j < at[i].valence; j++)
  ------------------
  |  Branch (2048:29): [True: 0, False: 0]
  ------------------
 2049|      0|                {
 2050|      0|                    neigh = at[i].neighbor[j];
 2051|      0|                    if (at[neigh].el_number == EL_NUMBER_O &&
  ------------------
  |  |   45|      0|#define EL_NUMBER_O ((U_CHAR) 8)
  ------------------
  |  Branch (2051:25): [True: 0, False: 0]
  ------------------
 2052|      0|                         at[neigh].valence == 1)
  ------------------
  |  Branch (2052:26): [True: 0, False: 0]
  ------------------
 2053|      0|                    {
 2054|      0|                        num_O++;
 2055|      0|                        bond_to_O_val += ( at[i].bond_type[j] & BOND_TYPE_MASK );
  ------------------
  |  |  217|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
 2056|      0|                    }
 2057|      0|                    else
 2058|      0|                    {
 2059|      0|                        forbidden_bond_pos = j;
 2060|      0|                        forbidden_bond_val = ( at[i].bond_type[j] & BOND_TYPE_MASK );
  ------------------
  |  |  217|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
 2061|      0|                    }
 2062|      0|                }
 2063|      0|                if (2 == num_O && ( 3 == bond_to_O_val || 4 == bond_to_O_val ) && 1 == forbidden_bond_val)
  ------------------
  |  Branch (2063:21): [True: 0, False: 0]
  |  Branch (2063:37): [True: 0, False: 0]
  |  Branch (2063:59): [True: 0, False: 0]
  |  Branch (2063:83): [True: 0, False: 0]
  ------------------
 2064|      0|                {
 2065|      0|                    iedge = pBNS->vert[i].iedge[forbidden_bond_pos];
 2066|      0|                    pBNS->edge[iedge].forbidden |= edge_forbidden_mask;
 2067|      0|                    num_found++;
 2068|      0|                }
 2069|      0|            }
 2070|   116k|        }
 2071|   116k|    }
 2072|       |
 2073|       |#ifdef FIX_SRU_CYCLIZING_PS_BONDS_IN_BNS
 2074|       |    if (nebend > 1)
 2075|       |        num_found += fix_explicitly_indicated_bonds( nebend, ebend, pBNS, at, num_atoms );
 2076|       |#endif
 2077|       |
 2078|   110k|#if ( REMOVE_ION_PAIRS_FIX_BONDS == 1 )
 2079|   110k|    num_found += fix_special_bonds( pBNS, at, num_atoms, edge_forbidden_mask );
 2080|   110k|#endif
 2081|       |#if ( RESET_EDGE_FORBIDDEN_MASK == 0 )
 2082|       |    num_found += TempFix_NH_NH_Bonds( pBNS, at, num_atoms );
 2083|       |#endif
 2084|       |
 2085|   110k|    return num_found;
 2086|   110k|}
fix_special_bonds:
 2172|   110k|{
 2173|   110k|    int num_changes = 0;
 2174|       |
 2175|       |    /*                           0 1 2  3  4 5 6  7  8  9                   8  9  */
 2176|       |#if ( FIX_REM_ION_PAIRS_Si_BUG == 1 )
 2177|       |    static const char    el[] = "N;P;As;Sb;O;S;Se;Te;C;Si;";  /* 8 elements + C, Si */
 2178|       |#else
 2179|   110k|    static const char    el[] = "N;P;As;Sb;O;S;Se;Te;C;Si";   /* 8 elements + C, Si */
 2180|   110k|#endif
 2181|   110k|    static char    en[12];  /* Same number: 8 elements  */
 2182|   110k|    static int     ne = 0;  /* will be 8 and 10         */
 2183|   110k|    int ne2;
 2184|       |
 2185|   110k|#define ELEM_N_FST  0
 2186|   110k|#define ELEM_N_LEN  4
 2187|   110k|#define ELEM_O_FST  4
 2188|   110k|#define ELEM_O_LEN  4
 2189|   110k|#define ELEM_S_FST  (ELEM_O_FST+1)
 2190|   110k|#define ELEM_S_LEN  (ELEM_O_LEN-1)
 2191|   110k|#define ELEM_C_FST  8
 2192|   110k|#define ELEM_C_LEN  2
 2193|       |
 2194|   110k|#define MAX_NEIGH 6
 2195|       |
 2196|   110k|    int i, k, n1, n2, n3, n4, i1, i2, i3, i4, bond_type;
 2197|   110k|    inp_ATOM *a;
 2198|   110k|    char elname[ATOM_EL_LEN];
 2199|   110k|    int j[3], m[3], num_O, k_O, num_N, num_OH, num_OM, num_X, num_other, k_N;
 2200|       |
 2201|   110k|    BNS_IEDGE iedge;
 2202|       |    /*S_CHAR    edge_forbidden_mask = BNS_EDGE_FORBIDDEN_MASK;*/
 2203|   110k|    S_CHAR    edge_forbidden_mask = forbidden_mask;
 2204|       |
 2205|   110k|    pBNS->edge_forbidden_mask |= edge_forbidden_mask;
 2206|       |
 2207|   110k|    if (!ne)
  ------------------
  |  Branch (2207:9): [True: 1, False: 110k]
  ------------------
 2208|      1|    {
 2209|       |        /* One time initialization */
 2210|      1|        const char *b, *e;
 2211|      1|        int  len;
 2212|      1|        ne2 = 0;
 2213|     10|        for (b = el; e = strchr( b, ';' ); b = e + 1)
  ------------------
  |  Branch (2213:22): [True: 9, False: 1]
  ------------------
 2214|      9|        {
 2215|      9|            len = (int) ( e - b );
 2216|      9|            memcpy( elname, b, len );
 2217|      9|            elname[len] = '\0';
 2218|      9|            en[ne2++] = get_periodic_table_number( elname );
 2219|      9|        }
 2220|      1|        en[ne2] = '\0';
 2221|      1|        en[ne2 + 1] = '\0';
 2222|      1|        ne = ne2;
 2223|      1|    }
 2224|       |
 2225|   227k|    for (i = 0, a = at; i < num_atoms; i++, a++)
  ------------------
  |  Branch (2225:25): [True: 116k, False: 110k]
  ------------------
 2226|   116k|    {
 2227|       |
 2228|   116k|        if (!a->charge && !a->radical &&
  ------------------
  |  Branch (2228:13): [True: 116k, False: 49]
  |  Branch (2228:27): [True: 116k, False: 0]
  ------------------
 2229|   116k|             2 <= a->chem_bonds_valence + NUMH( a, 0 ) - get_el_valence( a->el_number, 0, 0 ) &&
  ------------------
  |  |   88|   116k|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|   116k|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (2229:14): [True: 32, False: 116k]
  ------------------
 2230|   116k|             0 == num_of_H( at, i ) &&
  ------------------
  |  Branch (2230:14): [True: 0, False: 32]
  ------------------
 2231|   116k|             2 == nNoMetalBondsValence( at, i ) + NUMH( a, 0 ) - get_el_valence( a->el_number, 0, 0 ) &&
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (2231:14): [True: 0, False: 0]
  ------------------
 2232|   116k|             NULL != memchr( en + ELEM_N_FST, at[i].el_number, ELEM_N_LEN ))
  ------------------
  |  | 2185|      0|#define ELEM_N_FST  0
  ------------------
                           NULL != memchr( en + ELEM_N_FST, at[i].el_number, ELEM_N_LEN ))
  ------------------
  |  | 2186|      0|#define ELEM_N_LEN  4
  ------------------
  |  Branch (2232:14): [True: 0, False: 0]
  ------------------
 2233|      0|        {
 2234|       |            /* Found N(V), no H */
 2235|      0|            if (2 == nNoMetalNumBonds( at, i ))
  ------------------
  |  Branch (2235:17): [True: 0, False: 0]
  ------------------
 2236|      0|            {
 2237|       |                /* #N= */
 2238|       |                /* fix bonds: double and triple: =N# so that bonds cannot be changed by the normalization */
 2239|      0|#if ( FIX_N_V_METAL_BONDS_GPF == 1 )
 2240|      0|                if (0 > ( i1 = nNoMetalNeighIndex( at, i ) ) ||
  ------------------
  |  Branch (2240:21): [True: 0, False: 0]
  ------------------
 2241|      0|                     0 > ( i2 = nNoMetalOtherNeighIndex( at, i, n1 = a->neighbor[i1]/* non-metal neighbor #1 */ ) ))
  ------------------
  |  Branch (2241:22): [True: 0, False: 0]
  ------------------
 2242|      0|                {
 2243|       |                    /*num_err ++; */ /* do not count would-be original InChI v.1 buffer overflow GPF */
 2244|      0|                    continue;       /* v1 bug: 2 bonds to metal yield i1 < 0 and/or i2 < 0 => bounds violation */
 2245|      0|                }
 2246|       |#else
 2247|       |                i1 = nNoMetalNeighIndex( at, i );
 2248|       |                n1 = a->neighbor[i1]; /* non-metal neighbor #1 */
 2249|       |                i2 = nNoMetalOtherNeighIndex( at, i, n1 );
 2250|       |#endif
 2251|      0|                n2 = a->neighbor[i2]; /* non-metal neighbor #2 */
 2252|       |                                      /* forbid all edges to non-metals */
 2253|      0|                iedge = pBNS->vert[i].iedge[i1];
 2254|      0|                pBNS->edge[iedge].forbidden |= edge_forbidden_mask; /* fix bond to neighbor #1 */
 2255|      0|                iedge = pBNS->vert[i].iedge[i2];
 2256|      0|                pBNS->edge[iedge].forbidden |= edge_forbidden_mask; /* fix bond to neighbor #1 */
 2257|      0|                num_changes++;  /* added 11-15-2005 */
 2258|       |                                /*                                                      i n3 */
 2259|       |                                /* forbid single bond edge beyond the neighboring =N- as in #N=N- */
 2260|      0|                if (( at[i].bond_type[i1] & BOND_TYPE_MASK ) == BOND_TYPE_DOUBLE)
  ------------------
  |  |  217|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
                              if (( at[i].bond_type[i1] & BOND_TYPE_MASK ) == BOND_TYPE_DOUBLE)
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (2260:21): [True: 0, False: 0]
  ------------------
 2261|      0|                {
 2262|      0|                    i3 = i1;
 2263|      0|                    n3 = n1;
 2264|      0|                }
 2265|      0|                else
 2266|      0|                {
 2267|      0|                    i3 = i2;
 2268|      0|                    n3 = n2;
 2269|      0|                }
 2270|      0|                if (0 == NUMH( at, n3 ) && 2 == nNoMetalNumBonds( at, n3 ) &&
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (2270:21): [True: 0, False: 0]
  |  Branch (2270:44): [True: 0, False: 0]
  ------------------
 2271|      0|                     3 == nNoMetalBondsValence( at, n3 ) &&
  ------------------
  |  Branch (2271:22): [True: 0, False: 0]
  ------------------
 2272|      0|                     NULL != memchr( en + ELEM_N_FST, at[n3].el_number, ELEM_N_LEN ) &&
  ------------------
  |  | 2185|      0|#define ELEM_N_FST  0
  ------------------
                                   NULL != memchr( en + ELEM_N_FST, at[n3].el_number, ELEM_N_LEN ) &&
  ------------------
  |  | 2186|      0|#define ELEM_N_LEN  4
  ------------------
  |  Branch (2272:22): [True: 0, False: 0]
  ------------------
 2273|      0|                     0 <= ( k = nNoMetalOtherNeighIndex( at, n3, i ) ))
  ------------------
  |  Branch (2273:22): [True: 0, False: 0]
  ------------------
 2274|      0|                {
 2275|       |                    /* found =N- ; forbid the edge*/
 2276|      0|                    iedge = pBNS->vert[n3].iedge[k];
 2277|      0|                    pBNS->edge[iedge].forbidden |= edge_forbidden_mask;
 2278|      0|                    num_changes++;
 2279|      0|                }
 2280|      0|            }
 2281|      0|            else if (3 == nNoMetalNumBonds( at, i ) &&
  ------------------
  |  Branch (2281:22): [True: 0, False: 0]
  ------------------
 2282|       |                      /*         |                      */
 2283|       |                      /* found  =N=                     */
 2284|       |                      /* locate all non-metal neighbors */
 2285|      0|                      0 <= ( j[0] = nNoMetalNeighIndex( at, i ) ) &&
  ------------------
  |  Branch (2285:23): [True: 0, False: 0]
  ------------------
 2286|      0|                      0 <= ( j[1] = nNoMetalOtherNeighIndex( at, i, m[0] = a->neighbor[j[0]] ) ) &&
  ------------------
  |  Branch (2286:23): [True: 0, False: 0]
  ------------------
 2287|      0|                      0 <= ( j[2] = nNoMetalOtherNeighIndex2( at, i, m[0], m[1] = a->neighbor[j[1]] ) ))
  ------------------
  |  Branch (2287:23): [True: 0, False: 0]
  ------------------
 2288|      0|            {
 2289|       |                /* Count specific neighbors: N(V)=N, N(V)-N N(V)=O, and N(V)-N */
 2290|       |
 2291|       |                /*  if there is a single neighbor connected by a double bond, namely
 2292|       |                N(V)=N and/or N(V)=O, then fix the bond(s).
 2293|       |                If N(V)=O was fixed then do not fix another bond */
 2294|      0|                m[2] = a->neighbor[j[2]];
 2295|      0|                num_O = num_N = 0;
 2296|      0|                for (k = 0; k < 3; k++)
  ------------------
  |  Branch (2296:29): [True: 0, False: 0]
  ------------------
 2297|      0|                {
 2298|      0|                    n1 = m[k];
 2299|      0|                    i1 = j[k];
 2300|      0|                    if (NULL != memchr( en + ELEM_N_FST, at[n1].el_number, ELEM_N_LEN ))
  ------------------
  |  | 2185|      0|#define ELEM_N_FST  0
  ------------------
                                  if (NULL != memchr( en + ELEM_N_FST, at[n1].el_number, ELEM_N_LEN ))
  ------------------
  |  | 2186|      0|#define ELEM_N_LEN  4
  ------------------
  |  Branch (2300:25): [True: 0, False: 0]
  ------------------
 2301|      0|                    {
 2302|      0|                        k_N = k;
 2303|      0|                        num_N++;
 2304|      0|                    }
 2305|      0|                    else if (NULL != memchr( en + ELEM_O_FST, at[n1].el_number, ELEM_O_LEN ) &&
  ------------------
  |  | 2187|      0|#define ELEM_O_FST  4
  ------------------
                                  else if (NULL != memchr( en + ELEM_O_FST, at[n1].el_number, ELEM_O_LEN ) &&
  ------------------
  |  | 2188|      0|#define ELEM_O_LEN  4
  ------------------
  |  Branch (2305:30): [True: 0, False: 0]
  ------------------
 2306|      0|                              1 == nNoMetalNumBonds( at, n1 ))
  ------------------
  |  Branch (2306:31): [True: 0, False: 0]
  ------------------
 2307|      0|                    {
 2308|      0|                        k_O = k;
 2309|      0|                        num_O++;
 2310|      0|                    }
 2311|      0|                }
 2312|      0|                num_other = 0;
 2313|      0|                if (1 == num_O &&
  ------------------
  |  Branch (2313:21): [True: 0, False: 0]
  ------------------
 2314|      0|                     0 == at[n1 = m[k_O]].charge &&
  ------------------
  |  Branch (2314:22): [True: 0, False: 0]
  ------------------
 2315|      0|                     0 == at[n1].radical            &&
  ------------------
  |  Branch (2315:22): [True: 0, False: 0]
  ------------------
 2316|      0|                     BOND_TYPE_DOUBLE == ( at[i].bond_type[i1 = j[k_O]] & BOND_TYPE_MASK )
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
                                   BOND_TYPE_DOUBLE == ( at[i].bond_type[i1 = j[k_O]] & BOND_TYPE_MASK )
  ------------------
  |  |  217|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
  |  Branch (2316:22): [True: 0, False: 0]
  ------------------
 2317|      0|                     )
 2318|      0|                {
 2319|       |                    /* Fix bond to neighbor =O */
 2320|      0|                    iedge = pBNS->vert[i].iedge[i1];
 2321|      0|                    pBNS->edge[iedge].forbidden |= edge_forbidden_mask;
 2322|      0|                    num_changes++;
 2323|      0|                    num_other++; /* indicator: double to a terminal O has been fixed */
 2324|      0|                }
 2325|      0|                if (!num_other                    &&
  ------------------
  |  Branch (2325:21): [True: 0, False: 0]
  ------------------
 2326|      0|                     num_O <= 1 &&
  ------------------
  |  Branch (2326:22): [True: 0, False: 0]
  ------------------
 2327|      0|                     1 == num_N &&
  ------------------
  |  Branch (2327:22): [True: 0, False: 0]
  ------------------
 2328|      0|                     0 == at[n1 = m[k_N]].charge &&
  ------------------
  |  Branch (2328:22): [True: 0, False: 0]
  ------------------
 2329|      0|                     0 == at[n1].radical            &&
  ------------------
  |  Branch (2329:22): [True: 0, False: 0]
  ------------------
 2330|      0|                     BOND_TYPE_DOUBLE == ( at[i].bond_type[i1 = j[k_N]] & BOND_TYPE_MASK ))
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
                                   BOND_TYPE_DOUBLE == ( at[i].bond_type[i1 = j[k_N]] & BOND_TYPE_MASK ))
  ------------------
  |  |  217|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
  |  Branch (2330:22): [True: 0, False: 0]
  ------------------
 2331|      0|                {
 2332|       |                    /* Fix bond to neighbor =N */
 2333|      0|                    iedge = pBNS->vert[i].iedge[i1];
 2334|      0|                    pBNS->edge[iedge].forbidden |= edge_forbidden_mask;
 2335|      0|                    num_changes++;
 2336|      0|                }
 2337|      0|            }
 2338|      0|            else if (4 == nNoMetalNumBonds( at, i ))
  ------------------
  |  Branch (2338:22): [True: 0, False: 0]
  ------------------
 2339|      0|            {
 2340|       |                /*         |                      */
 2341|       |                /* found  -N=N-                   */
 2342|       |                /*         |                      */
 2343|       |                /* locate non-metal neighbor connected by a double bond;
 2344|       |                * if it is =N- then fix the double bond and the single bond beyond the neighbor
 2345|       |                */
 2346|      0|                num_N = 0;
 2347|      0|                num_other = 0;
 2348|      0|                for (i1 = 0; i1 < at[i].valence; i1++)
  ------------------
  |  Branch (2348:30): [True: 0, False: 0]
  ------------------
 2349|      0|                {
 2350|      0|                    if (BOND_TYPE_DOUBLE == ( at[i].bond_type[i1] & BOND_TYPE_MASK ) &&
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
                                  if (BOND_TYPE_DOUBLE == ( at[i].bond_type[i1] & BOND_TYPE_MASK ) &&
  ------------------
  |  |  217|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
  |  Branch (2350:25): [True: 0, False: 0]
  ------------------
 2351|      0|                         !is_el_a_metal( at[n1 = (int) at[i].neighbor[i1]].el_number ) &&
  ------------------
  |  Branch (2351:26): [True: 0, False: 0]
  ------------------
 2352|      0|                         NULL != memchr( en + ELEM_N_FST, at[n1].el_number, ELEM_N_LEN ))
  ------------------
  |  | 2185|      0|#define ELEM_N_FST  0
  ------------------
                                       NULL != memchr( en + ELEM_N_FST, at[n1].el_number, ELEM_N_LEN ))
  ------------------
  |  | 2186|      0|#define ELEM_N_LEN  4
  ------------------
  |  Branch (2352:26): [True: 0, False: 0]
  ------------------
 2353|      0|                    {
 2354|      0|                        num_N++;
 2355|      0|                        n2 = n1;
 2356|      0|                        i2 = i1;
 2357|      0|                    }
 2358|      0|                }
 2359|      0|                if (1 == num_N && 0 == NUMH( at, n2 ) &&
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (2359:21): [True: 0, False: 0]
  |  Branch (2359:35): [True: 0, False: 0]
  ------------------
 2360|      0|                     2 == nNoMetalNumBonds( at, n2 ) &&
  ------------------
  |  Branch (2360:22): [True: 0, False: 0]
  ------------------
 2361|      0|                     3 == nNoMetalBondsValence( at, n2 ) &&
  ------------------
  |  Branch (2361:22): [True: 0, False: 0]
  ------------------
 2362|      0|                     0 <= ( i3 = nNoMetalOtherNeighIndex( at, n2, i ) ) &&
  ------------------
  |  Branch (2362:22): [True: 0, False: 0]
  ------------------
 2363|      0|                     BOND_TYPE_SINGLE == ( at[n2].bond_type[i3] & BOND_TYPE_MASK ))
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
                                   BOND_TYPE_SINGLE == ( at[n2].bond_type[i3] & BOND_TYPE_MASK ))
  ------------------
  |  |  217|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
  |  Branch (2363:22): [True: 0, False: 0]
  ------------------
 2364|      0|                {
 2365|       |                    /* fix the single bond beyond the N(V) neighbor N(V)=N- */
 2366|      0|                    iedge = pBNS->vert[n2].iedge[i3];
 2367|      0|                    pBNS->edge[iedge].forbidden |= edge_forbidden_mask;
 2368|      0|                    num_changes++;
 2369|       |                    /* fix the double bond */
 2370|      0|                    iedge = pBNS->vert[i].iedge[i2];
 2371|      0|                    pBNS->edge[iedge].forbidden |= edge_forbidden_mask;
 2372|      0|                    num_changes++;
 2373|      0|                }
 2374|      0|            }
 2375|      0|        }
 2376|       |
 2377|   116k|        else if (!a->charge && !a->radical &&
  ------------------
  |  Branch (2377:18): [True: 116k, False: 49]
  |  Branch (2377:32): [True: 116k, False: 0]
  ------------------
 2378|   116k|                  2 <= a->chem_bonds_valence + NUMH( a, 0 ) - get_el_valence( a->el_number, 0, 0 ) &&
  ------------------
  |  |   88|   116k|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|   116k|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (2378:19): [True: 32, False: 116k]
  ------------------
 2379|   116k|                  0 == num_of_H( at, i ) &&
  ------------------
  |  Branch (2379:19): [True: 0, False: 32]
  ------------------
 2380|   116k|                  2 == nNoMetalBondsValence( at, i ) + NUMH( a, 0 ) - get_el_valence( a->el_number, 0, 0 ) &&
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (2380:19): [True: 0, False: 0]
  ------------------
 2381|   116k|                  NULL != memchr( en + ELEM_S_FST, a->el_number, ELEM_S_LEN ) &&
  ------------------
  |  | 2189|      0|#define ELEM_S_FST  (ELEM_O_FST+1)
  |  |  ------------------
  |  |  |  | 2187|      0|#define ELEM_O_FST  4
  |  |  ------------------
  ------------------
                                NULL != memchr( en + ELEM_S_FST, a->el_number, ELEM_S_LEN ) &&
  ------------------
  |  | 2190|      0|#define ELEM_S_LEN  (ELEM_O_LEN-1)
  |  |  ------------------
  |  |  |  | 2188|      0|#define ELEM_O_LEN  4
  |  |  ------------------
  ------------------
  |  Branch (2381:19): [True: 0, False: 0]
  ------------------
 2382|   116k|                  3 == nNoMetalNumBonds( at, i ))
  ------------------
  |  Branch (2382:19): [True: 0, False: 0]
  ------------------
 2383|      0|        {
 2384|       |            /* Found S(IV), no H, one double bond, total 3 bonds */
 2385|       |            /*       OH
 2386|       |            /
 2387|       |            in O=S   (X != O) fix single bond O-X  (type 1)
 2388|       |            \
 2389|       |            X
 2390|       |
 2391|       |            X
 2392|       |            /
 2393|       |            in Z=S    (X, Y != OH) fix double bond Z=S (type 2)
 2394|       |            \
 2395|       |            Y
 2396|       |            */
 2397|      0|            num_N = 0;  /* number of non-metal neighbors connected by a double bond */
 2398|      0|            num_OH = 0; /* number of neighbors OH connected by a single bond */
 2399|      0|            num_OM = 0; /* number of charged neighbors O connected by a single bond */
 2400|      0|            num_O = 0;  /* number of neighbors =O connected by a double bond */
 2401|      0|            num_other = 0;
 2402|       |
 2403|      0|            for (i1 = 0; i1 < a->valence; i1++)
  ------------------
  |  Branch (2403:26): [True: 0, False: 0]
  ------------------
 2404|      0|            {
 2405|      0|                n1 = (int) a->neighbor[i1];
 2406|      0|                if (is_el_a_metal( at[n1].el_number ))
  ------------------
  |  Branch (2406:21): [True: 0, False: 0]
  ------------------
 2407|      0|                {
 2408|      0|                    continue;
 2409|      0|                }
 2410|       |
 2411|      0|                bond_type = ( a->bond_type[i1] & BOND_TYPE_MASK );
  ------------------
  |  |  217|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
 2412|       |
 2413|      0|                if (BOND_TYPE_DOUBLE == bond_type)
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (2413:21): [True: 0, False: 0]
  ------------------
 2414|      0|                {
 2415|      0|                    num_N++;
 2416|      0|                    n2 = n1;
 2417|      0|                    i2 = i1;
 2418|      0|                    if (NULL != memchr( en + ELEM_O_FST, at[n1].el_number, ELEM_O_LEN ))
  ------------------
  |  | 2187|      0|#define ELEM_O_FST  4
  ------------------
                                  if (NULL != memchr( en + ELEM_O_FST, at[n1].el_number, ELEM_O_LEN ))
  ------------------
  |  | 2188|      0|#define ELEM_O_LEN  4
  ------------------
  |  Branch (2418:25): [True: 0, False: 0]
  ------------------
 2419|      0|                    {
 2420|      0|                        num_O++;
 2421|      0|                    }
 2422|      0|                }
 2423|      0|                else if (BOND_TYPE_SINGLE == bond_type &&
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2423:26): [True: 0, False: 0]
  ------------------
 2424|      0|                          1 == nNoMetalNumBonds( at, n1 ) &&
  ------------------
  |  Branch (2424:27): [True: 0, False: 0]
  ------------------
 2425|      0|                          1 == nNoMetalBondsValence( at, n1 ) &&
  ------------------
  |  Branch (2425:27): [True: 0, False: 0]
  ------------------
 2426|      0|                          NULL != memchr( en + ELEM_O_FST, at[n1].el_number, ELEM_O_LEN ))
  ------------------
  |  | 2187|      0|#define ELEM_O_FST  4
  ------------------
                                        NULL != memchr( en + ELEM_O_FST, at[n1].el_number, ELEM_O_LEN ))
  ------------------
  |  | 2188|      0|#define ELEM_O_LEN  4
  ------------------
  |  Branch (2426:27): [True: 0, False: 0]
  ------------------
 2427|      0|                {
 2428|      0|                    if (0 == at[n1].charge)
  ------------------
  |  Branch (2428:25): [True: 0, False: 0]
  ------------------
 2429|      0|                    {
 2430|      0|                        num_OH++;
 2431|      0|                        n3 = n1;
 2432|      0|                        i3 = i1;
 2433|      0|                    }
 2434|      0|                    else
 2435|      0|                    {
 2436|      0|                        num_OM++;
 2437|      0|                    }
 2438|      0|                }
 2439|      0|                else
 2440|      0|                {
 2441|      0|                    num_other++;
 2442|      0|                    n4 = n1;
 2443|      0|                    i4 = i1;
 2444|      0|                }
 2445|      0|            } /* for (i1 = */
 2446|       |
 2447|      0|            if (1 == num_N && 1 == num_O && 1 == num_OH + num_OM)
  ------------------
  |  Branch (2447:17): [True: 0, False: 0]
  |  Branch (2447:31): [True: 0, False: 0]
  |  Branch (2447:45): [True: 0, False: 0]
  ------------------
 2448|      0|            {
 2449|      0|                if (1 == num_other)
  ------------------
  |  Branch (2449:21): [True: 0, False: 0]
  ------------------
 2450|      0|                {
 2451|       |                    /* type 1: fix the single bond S-X */
 2452|      0|                    iedge = pBNS->vert[i].iedge[i4];
 2453|      0|                    pBNS->edge[iedge].forbidden |= edge_forbidden_mask;
 2454|      0|                    num_changes++;
 2455|      0|                }
 2456|      0|            }
 2457|      0|            else if (1 == num_N && !num_OH && !num_OM)
  ------------------
  |  Branch (2457:22): [True: 0, False: 0]
  |  Branch (2457:36): [True: 0, False: 0]
  |  Branch (2457:47): [True: 0, False: 0]
  ------------------
 2458|      0|            {
 2459|      0|                int    bFound = 0; /* flag */
 2460|      0|                int    bDoNotFixAnyBond = 0; /* flag */
 2461|       |                                             /* Avoid case N=S-NH or N=S-N(-); N = N, P, As, Sb */
 2462|      0|                if (NULL != memchr( en + ELEM_N_FST, at[n2].el_number, ELEM_N_LEN ))
  ------------------
  |  | 2185|      0|#define ELEM_N_FST  0
  ------------------
                              if (NULL != memchr( en + ELEM_N_FST, at[n2].el_number, ELEM_N_LEN ))
  ------------------
  |  | 2186|      0|#define ELEM_N_LEN  4
  ------------------
  |  Branch (2462:21): [True: 0, False: 0]
  ------------------
 2463|      0|                {
 2464|      0|                    U_CHAR el_number = at[n2].el_number;
 2465|      0|                    for (i1 = 0; i1 < a->valence; i1++)
  ------------------
  |  Branch (2465:34): [True: 0, False: 0]
  ------------------
 2466|      0|                    {
 2467|      0|                        n1 = (int) a->neighbor[i1];
 2468|      0|                        bond_type = ( a->bond_type[i1] & BOND_TYPE_MASK );
  ------------------
  |  |  217|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
 2469|      0|                        if (BOND_TYPE_SINGLE == bond_type &&
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2469:29): [True: 0, False: 0]
  ------------------
 2470|      0|                            ( NUMH( at, n1 ) || -1 == at[n1].charge ) &&
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  |  |  |  Branch (88:24): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (2470:49): [True: 0, False: 0]
  ------------------
 2471|      0|                             el_number == at[n1].el_number)
  ------------------
  |  Branch (2471:30): [True: 0, False: 0]
  ------------------
 2472|      0|                        {
 2473|      0|                            i3 = i1;
 2474|      0|                            n3 = n1;
 2475|      0|                            bFound++;
 2476|      0|                        }
 2477|      0|                    }
 2478|      0|                }
 2479|       |                /* Exception: check if Z==X and they belong to the same ring system */
 2480|      0|                for (i1 = 0; i1 < a->valence; i1++)
  ------------------
  |  Branch (2480:30): [True: 0, False: 0]
  ------------------
 2481|      0|                {
 2482|      0|                    if (i1 != i2)
  ------------------
  |  Branch (2482:25): [True: 0, False: 0]
  ------------------
 2483|      0|                    {
 2484|      0|                        n1 = (int) a->neighbor[i1];
 2485|      0|                        if (at[n2].el_number == at[n1].el_number &&
  ------------------
  |  Branch (2485:29): [True: 0, False: 0]
  ------------------
 2486|      0|                             at[n2].nRingSystem == at[n1].nRingSystem)
  ------------------
  |  Branch (2486:30): [True: 0, False: 0]
  ------------------
 2487|      0|                        {
 2488|      0|                            bDoNotFixAnyBond++;
 2489|      0|                        }
 2490|      0|                    }
 2491|      0|                }
 2492|      0|                if (bDoNotFixAnyBond)
  ------------------
  |  Branch (2492:21): [True: 0, False: 0]
  ------------------
 2493|      0|                {
 2494|      0|                    ; /* do nothing */
 2495|      0|                }
 2496|      0|                else if (bFound)
  ------------------
  |  Branch (2496:26): [True: 0, False: 0]
  ------------------
 2497|      0|                {
 2498|      0|                    if (1 == bFound &&
  ------------------
  |  Branch (2498:25): [True: 0, False: 0]
  ------------------
 2499|      0|                         0 <= ( i4 = nNoMetalOtherNeighIndex2( at, i, n2, n3 ) ))
  ------------------
  |  Branch (2499:26): [True: 0, False: 0]
  ------------------
 2500|      0|                    {
 2501|       |                        /* fix bond i4 */
 2502|      0|                        iedge = pBNS->vert[i].iedge[i4];
 2503|      0|                        pBNS->edge[iedge].forbidden |= edge_forbidden_mask;
 2504|      0|                        num_changes++;
 2505|      0|                    }
 2506|      0|                }
 2507|      0|                else
 2508|      0|                {
 2509|       |                    /* fix the double bond >S=X */
 2510|      0|                    iedge = pBNS->vert[i].iedge[i2];
 2511|      0|                    pBNS->edge[iedge].forbidden |= edge_forbidden_mask;
 2512|      0|                    num_changes++;
 2513|       |                    /* -- test later --
 2514|       |                    if ( 2 == nNoMetalNumBonds( at, n2 ) &&
 2515|       |                    0 <= ( i3 = nNoMetalOtherNeighIndex( at, n2, i ) ) ) {
 2516|       |                    iedge = pBNS->vert[n2].iedge[i3];
 2517|       |                    pBNS->edge[iedge].forbidden |= edge_forbidden_mask;
 2518|       |                    num_changes ++;
 2519|       |                    }
 2520|       |                    -------------------*/
 2521|      0|                }
 2522|      0|            }
 2523|      0|        }
 2524|       |
 2525|   116k|        else if (!a->charge && !a->radical &&
  ------------------
  |  Branch (2525:18): [True: 116k, False: 49]
  |  Branch (2525:32): [True: 116k, False: 0]
  ------------------
 2526|   116k|                  4 <= a->chem_bonds_valence + NUMH( a, 0 ) - get_el_valence( a->el_number, 0, 0 ) &&
  ------------------
  |  |   88|   116k|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|   116k|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (2526:19): [True: 32, False: 116k]
  ------------------
 2527|   116k|                  0 == num_of_H( at, i ) &&
  ------------------
  |  Branch (2527:19): [True: 0, False: 32]
  ------------------
 2528|   116k|                  4 == nNoMetalBondsValence( at, i ) + NUMH( a, 0 ) - get_el_valence( a->el_number, 0, 0 ) &&
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (2528:19): [True: 0, False: 0]
  ------------------
 2529|   116k|                  NULL != memchr( en + ELEM_S_FST, a->el_number, ELEM_S_LEN ) &&
  ------------------
  |  | 2189|      0|#define ELEM_S_FST  (ELEM_O_FST+1)
  |  |  ------------------
  |  |  |  | 2187|      0|#define ELEM_O_FST  4
  |  |  ------------------
  ------------------
                                NULL != memchr( en + ELEM_S_FST, a->el_number, ELEM_S_LEN ) &&
  ------------------
  |  | 2190|      0|#define ELEM_S_LEN  (ELEM_O_LEN-1)
  |  |  ------------------
  |  |  |  | 2188|      0|#define ELEM_O_LEN  4
  |  |  ------------------
  ------------------
  |  Branch (2529:19): [True: 0, False: 0]
  ------------------
 2530|   116k|                  4 == nNoMetalNumBonds( at, i ))
  ------------------
  |  Branch (2530:19): [True: 0, False: 0]
  ------------------
 2531|      0|        {
 2532|       |            /* Found S(VI), no H, two double bonds or one triple bond */
 2533|       |            /*     O
 2534|       |            ||
 2535|       |            in O=S--Y-   (X, Y -- non-terminal) fix single bonds S-X, S-Y  (type 1)
 2536|       |            \
 2537|       |            X--
 2538|       |
 2539|       |            O
 2540|       |            ||
 2541|       |            in O=S--O(-)    (X -- non-terminal) fix single bond S-X (type 2)
 2542|       |            \
 2543|       |            X--
 2544|       |
 2545|       |            O
 2546|       |            ||
 2547|       |            in O=S--OH     (X -- non-terminal) fix single bond S-X (type 3)
 2548|       |            \
 2549|       |            X--
 2550|       |
 2551|       |            */
 2552|      0|            int iN[4];  /* indexes of non-terminal neighbors connected by a single bond */
 2553|      0|            num_N = 0; /* number of non-metal neighbors connected by a double bond */
 2554|      0|            num_OH = 0; /* number of neighbors OH connected by a single bond */
 2555|      0|            num_OM = 0; /* number of non-terminal neighbors connected by a single bond */
 2556|      0|            num_O = 0; /* number of neighbors =O connected by a double bond */
 2557|      0|            num_X = 0; /* number of terminal atom X != O connected by a single bond */
 2558|      0|            num_other = 0;
 2559|      0|            for (i1 = 0; i1 < a->valence; i1++)
  ------------------
  |  Branch (2559:26): [True: 0, False: 0]
  ------------------
 2560|      0|            {
 2561|      0|                n1 = (int) a->neighbor[i1];
 2562|      0|                if (is_el_a_metal( at[n1].el_number ))
  ------------------
  |  Branch (2562:21): [True: 0, False: 0]
  ------------------
 2563|      0|                {
 2564|      0|                    continue;
 2565|      0|                }
 2566|      0|                bond_type = ( a->bond_type[i1] & BOND_TYPE_MASK );
  ------------------
  |  |  217|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
 2567|      0|                if (BOND_TYPE_DOUBLE == bond_type)
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (2567:21): [True: 0, False: 0]
  ------------------
 2568|      0|                {
 2569|      0|                    num_N++;
 2570|      0|                    if (( 0 == at[n1].charge
  ------------------
  |  Branch (2570:27): [True: 0, False: 0]
  ------------------
 2571|      0|#if ( S_VI_O_PLUS_METAL_FIX_BOND == 1 )
 2572|      0|                          || 1 == at[n1].charge && 2 == at[n1].valence
  ------------------
  |  Branch (2572:30): [True: 0, False: 0]
  |  Branch (2572:52): [True: 0, False: 0]
  ------------------
 2573|      0|#endif
 2574|      0|                          ) &&
 2575|      0|                         0 == at[n1].radical &&
  ------------------
  |  Branch (2575:26): [True: 0, False: 0]
  ------------------
 2576|      0|                         0 == num_of_H( at, n1 ) &&
  ------------------
  |  Branch (2576:26): [True: 0, False: 0]
  ------------------
 2577|      0|                         NULL != memchr( en + ELEM_O_FST, at[n1].el_number, ELEM_O_LEN ) &&
  ------------------
  |  | 2187|      0|#define ELEM_O_FST  4
  ------------------
                                       NULL != memchr( en + ELEM_O_FST, at[n1].el_number, ELEM_O_LEN ) &&
  ------------------
  |  | 2188|      0|#define ELEM_O_LEN  4
  ------------------
  |  Branch (2577:26): [True: 0, False: 0]
  ------------------
 2578|      0|                         1 == nNoMetalNumBonds( at, n1 ))
  ------------------
  |  Branch (2578:26): [True: 0, False: 0]
  ------------------
 2579|      0|                    {
 2580|      0|                        num_O++;
 2581|      0|                    }
 2582|      0|                }
 2583|      0|                else if (BOND_TYPE_SINGLE == bond_type &&
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2583:26): [True: 0, False: 0]
  ------------------
 2584|      0|                          1 == nNoMetalNumBonds( at, n1 ) &&
  ------------------
  |  Branch (2584:27): [True: 0, False: 0]
  ------------------
 2585|      0|                          NULL != memchr( en + ELEM_O_FST, at[n1].el_number, ELEM_O_LEN ) &&
  ------------------
  |  | 2187|      0|#define ELEM_O_FST  4
  ------------------
                                        NULL != memchr( en + ELEM_O_FST, at[n1].el_number, ELEM_O_LEN ) &&
  ------------------
  |  | 2188|      0|#define ELEM_O_LEN  4
  ------------------
  |  Branch (2585:27): [True: 0, False: 0]
  ------------------
 2586|      0|                          1 >= num_of_H( at, n1 ) &&
  ------------------
  |  Branch (2586:27): [True: 0, False: 0]
  ------------------
 2587|      0|                          1 == ( ( 0 == at[n1].charge ) && 1 == num_of_H( at, n1 ) )
  ------------------
  |  Branch (2587:27): [True: 0, False: 0]
  |  Branch (2587:34): [True: 0, False: 0]
  |  Branch (2587:60): [True: 0, False: 0]
  ------------------
 2588|      0|                          + ( ( -1 == at[n1].charge ) && 0 == num_of_H( at, n1 ) ))
  ------------------
  |  Branch (2588:31): [True: 0, False: 0]
  |  Branch (2588:58): [True: 0, False: 0]
  ------------------
 2589|      0|                {
 2590|      0|                    num_OH++; /* -OH or -O(-) */
 2591|      0|                }
 2592|      0|                else if (BOND_TYPE_SINGLE == bond_type &&
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2592:26): [True: 0, False: 0]
  ------------------
 2593|      0|                          1 < nNoMetalNumBonds( at, n1 ))
  ------------------
  |  Branch (2593:27): [True: 0, False: 0]
  ------------------
 2594|      0|                {
 2595|      0|                    iN[num_OM++] = i1; /* non-terminal neighbor connected by a single bond */
 2596|      0|                }
 2597|      0|                else if (BOND_TYPE_SINGLE == bond_type &&
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2597:26): [True: 0, False: 0]
  ------------------
 2598|      0|                          1 == nNoMetalNumBonds( at, n1 ))
  ------------------
  |  Branch (2598:27): [True: 0, False: 0]
  ------------------
 2599|      0|                {
 2600|      0|                    num_X++; /* other terminal neighbor connected by a single bond */
 2601|      0|                }
 2602|      0|                else
 2603|      0|                {
 2604|      0|                    num_other++;
 2605|      0|                }
 2606|      0|            }
 2607|      0|            if (num_N == num_O && 2 == num_O && 2 == num_OH + num_OM + num_X && 0 == num_other)
  ------------------
  |  Branch (2607:17): [True: 0, False: 0]
  |  Branch (2607:35): [True: 0, False: 0]
  |  Branch (2607:49): [True: 0, False: 0]
  |  Branch (2607:81): [True: 0, False: 0]
  ------------------
 2608|      0|            {
 2609|      0|                for (i2 = 0; i2 < num_OM; i2++)
  ------------------
  |  Branch (2609:30): [True: 0, False: 0]
  ------------------
 2610|      0|                {
 2611|      0|                    i1 = iN[i2];
 2612|       |                    /* fix bond i1 */
 2613|      0|                    iedge = pBNS->vert[i].iedge[i1];
 2614|      0|                    pBNS->edge[iedge].forbidden |= edge_forbidden_mask;
 2615|      0|                    num_changes++;
 2616|      0|                }
 2617|      0|            }
 2618|      0|        }
 2619|       |
 2620|   116k|        else if (!a->charge && !a->radical &&
  ------------------
  |  Branch (2620:18): [True: 116k, False: 49]
  |  Branch (2620:32): [True: 116k, False: 0]
  ------------------
 2621|   116k|                  6 <= a->chem_bonds_valence + NUMH( a, 0 ) - get_el_valence( a->el_number, 0, 0 ) &&
  ------------------
  |  |   88|   116k|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|   116k|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (2621:19): [True: 32, False: 116k]
  ------------------
 2622|   116k|                  0 == num_of_H( at, i ) &&
  ------------------
  |  Branch (2622:19): [True: 0, False: 32]
  ------------------
 2623|   116k|                  6 == nNoMetalBondsValence( at, i ) + NUMH( a, 0 ) - get_el_valence( a->el_number, 0, 0 ) &&
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (2623:19): [True: 0, False: 0]
  ------------------
 2624|   116k|                  NULL != memchr( en + ELEM_S_FST, a->el_number, ELEM_S_LEN ) &&
  ------------------
  |  | 2189|      0|#define ELEM_S_FST  (ELEM_O_FST+1)
  |  |  ------------------
  |  |  |  | 2187|      0|#define ELEM_O_FST  4
  |  |  ------------------
  ------------------
                                NULL != memchr( en + ELEM_S_FST, a->el_number, ELEM_S_LEN ) &&
  ------------------
  |  | 2190|      0|#define ELEM_S_LEN  (ELEM_O_LEN-1)
  |  |  ------------------
  |  |  |  | 2188|      0|#define ELEM_O_LEN  4
  |  |  ------------------
  ------------------
  |  Branch (2624:19): [True: 0, False: 0]
  ------------------
 2625|   116k|                  5 == nNoMetalNumBonds( at, i ))
  ------------------
  |  Branch (2625:19): [True: 0, False: 0]
  ------------------
 2626|      0|        {
 2627|       |            /* Found S(VIII), no H, three double bonds or two triple bond */
 2628|       |            /*
 2629|       |
 2630|       |            O
 2631|       |            ||
 2632|       |            in O=S--Y--     (X, Y -- non-terminal) fix single bond S-X, S-Y (type 4)
 2633|       |            //\
 2634|       |            O   X--
 2635|       |
 2636|       |            note: this structure is a mistakenly drawn structure
 2637|       |
 2638|       |            O                  O
 2639|       |            ||                 ||
 2640|       |            O=S--O--Y--  or    O=S--Y--
 2641|       |            \                  \
 2642|       |            X--                O--X--
 2643|       |
 2644|       |
 2645|       |            */
 2646|      0|            int iN[5];  /* indexes of non-terminal neighbors connected by a single bond */
 2647|      0|            num_N = 0; /* number of non-metal neighbors connected by a double bond */
 2648|      0|            num_OH = 0; /* number of neighbors OH connected by a single bond */
 2649|      0|            num_OM = 0; /* number of non-terminal neighbors connected by a single bond */
 2650|      0|            num_O = 0; /* number of neighbors =O connected by a double bond */
 2651|      0|            num_X = 0; /* number of terminal atom X != O connected by a single bond */
 2652|      0|            num_other = 0;
 2653|      0|            for (i1 = 0; i1 < a->valence; i1++)
  ------------------
  |  Branch (2653:26): [True: 0, False: 0]
  ------------------
 2654|      0|            {
 2655|      0|                n1 = (int) a->neighbor[i1];
 2656|      0|                if (is_el_a_metal( at[n1].el_number ))
  ------------------
  |  Branch (2656:21): [True: 0, False: 0]
  ------------------
 2657|      0|                {
 2658|      0|                    continue;
 2659|      0|                }
 2660|      0|                bond_type = ( a->bond_type[i1] & BOND_TYPE_MASK );
  ------------------
  |  |  217|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
 2661|      0|                if (BOND_TYPE_DOUBLE == bond_type)
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (2661:21): [True: 0, False: 0]
  ------------------
 2662|      0|                {
 2663|      0|                    num_N++;
 2664|      0|                    if (( 0 == at[n1].charge
  ------------------
  |  Branch (2664:27): [True: 0, False: 0]
  ------------------
 2665|      0|#if ( S_VI_O_PLUS_METAL_FIX_BOND == 1 )
 2666|      0|                          || 1 == at[n1].charge && 2 == at[n1].valence
  ------------------
  |  Branch (2666:30): [True: 0, False: 0]
  |  Branch (2666:52): [True: 0, False: 0]
  ------------------
 2667|      0|#endif
 2668|      0|                          )
 2669|      0|                         && 0 == at[n1].radical &&
  ------------------
  |  Branch (2669:29): [True: 0, False: 0]
  ------------------
 2670|      0|                         0 == num_of_H( at, n1 ) &&
  ------------------
  |  Branch (2670:26): [True: 0, False: 0]
  ------------------
 2671|      0|                         NULL != memchr( en + ELEM_O_FST, at[n1].el_number, ELEM_O_LEN ) &&
  ------------------
  |  | 2187|      0|#define ELEM_O_FST  4
  ------------------
                                       NULL != memchr( en + ELEM_O_FST, at[n1].el_number, ELEM_O_LEN ) &&
  ------------------
  |  | 2188|      0|#define ELEM_O_LEN  4
  ------------------
  |  Branch (2671:26): [True: 0, False: 0]
  ------------------
 2672|      0|                         1 == nNoMetalNumBonds( at, n1 ))
  ------------------
  |  Branch (2672:26): [True: 0, False: 0]
  ------------------
 2673|      0|                    {
 2674|      0|                        num_O++;
 2675|      0|                    }
 2676|      0|                }
 2677|      0|                else if (BOND_TYPE_SINGLE == bond_type &&
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2677:26): [True: 0, False: 0]
  ------------------
 2678|      0|                          1 == nNoMetalNumBonds( at, n1 ) &&
  ------------------
  |  Branch (2678:27): [True: 0, False: 0]
  ------------------
 2679|      0|                          NULL != memchr( en + ELEM_O_FST, at[n1].el_number, ELEM_O_LEN ) &&
  ------------------
  |  | 2187|      0|#define ELEM_O_FST  4
  ------------------
                                        NULL != memchr( en + ELEM_O_FST, at[n1].el_number, ELEM_O_LEN ) &&
  ------------------
  |  | 2188|      0|#define ELEM_O_LEN  4
  ------------------
  |  Branch (2679:27): [True: 0, False: 0]
  ------------------
 2680|      0|                          1 >= num_of_H( at, n1 ) &&
  ------------------
  |  Branch (2680:27): [True: 0, False: 0]
  ------------------
 2681|      0|                          1 == ( ( 0 == at[n1].charge ) && 1 == num_of_H( at, n1 ) )
  ------------------
  |  Branch (2681:27): [True: 0, False: 0]
  |  Branch (2681:34): [True: 0, False: 0]
  |  Branch (2681:60): [True: 0, False: 0]
  ------------------
 2682|      0|                          + ( ( -1 == at[n1].charge ) && 0 == num_of_H( at, n1 ) ))
  ------------------
  |  Branch (2682:31): [True: 0, False: 0]
  |  Branch (2682:58): [True: 0, False: 0]
  ------------------
 2683|      0|                {
 2684|      0|                    num_OH++; /* -OH or -O(-) */
 2685|      0|                }
 2686|      0|                else
 2687|      0|                {
 2688|      0|                    if (BOND_TYPE_SINGLE == bond_type &&
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2688:25): [True: 0, False: 0]
  ------------------
 2689|      0|                         1 < nNoMetalNumBonds( at, n1 ))
  ------------------
  |  Branch (2689:26): [True: 0, False: 0]
  ------------------
 2690|      0|                    {
 2691|       |
 2692|      0|                        iN[num_OM++] = i1; /* non-terminal neighbor connected by a single bond */
 2693|      0|                    }
 2694|      0|                    else
 2695|      0|                    {
 2696|      0|                        if (BOND_TYPE_SINGLE == bond_type && 1 == nNoMetalNumBonds( at, n1 ))
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2696:29): [True: 0, False: 0]
  |  Branch (2696:62): [True: 0, False: 0]
  ------------------
 2697|      0|                        {
 2698|       |
 2699|      0|                            num_X++; /* other terminal neighbor connected by a single bond */
 2700|      0|                        }
 2701|      0|                        else
 2702|      0|                        {
 2703|      0|                            num_other++;
 2704|      0|                        }
 2705|      0|                    }
 2706|      0|                }
 2707|      0|            }
 2708|      0|            if (num_N == num_O && 3 == num_O && 2 == num_OH + num_OM + num_X && 0 == num_other)
  ------------------
  |  Branch (2708:17): [True: 0, False: 0]
  |  Branch (2708:35): [True: 0, False: 0]
  |  Branch (2708:49): [True: 0, False: 0]
  |  Branch (2708:81): [True: 0, False: 0]
  ------------------
 2709|      0|            {
 2710|      0|                for (i2 = 0; i2 < num_OM; i2++)
  ------------------
  |  Branch (2710:30): [True: 0, False: 0]
  ------------------
 2711|      0|                {
 2712|      0|                    i1 = iN[i2];
 2713|       |                    /* fix bond i1 */
 2714|      0|                    iedge = pBNS->vert[i].iedge[i1];
 2715|      0|                    pBNS->edge[iedge].forbidden |= edge_forbidden_mask;
 2716|      0|                    num_changes++;
 2717|      0|                }
 2718|      0|            }
 2719|      0|        }
 2720|       |
 2721|   116k|    } /* for (i =  */
 2722|       |
 2723|   110k|    return num_changes;
 2724|   110k|}
is_Z_atom:
 2806|     93|{
 2807|     93|    typedef enum tag_Z_elnumber
 2808|     93|    {
 2809|     93|        el_C,
 2810|     93|        el_N,
 2811|     93|        el_P,
 2812|     93|        el_As,
 2813|     93|        el_Sb,
 2814|     93|        el_S,
 2815|     93|        el_Se,
 2816|     93|        el_Te,
 2817|     93|        el_Cl,
 2818|     93|        el_Br,
 2819|     93|        el_I,
 2820|       |#if ( ALL_NONMETAL_Z == 1 )
 2821|       |        el_B,
 2822|       |        el_O,
 2823|       |        el_Si,
 2824|       |        el_Ge,
 2825|       |        el_F,
 2826|       |        el_At,
 2827|       |#endif
 2828|     93|        el_len
 2829|     93|    } Z_ELNUMBER;
 2830|       |
 2831|     93|    static U_CHAR el_numb[el_len];
 2832|       |
 2833|       |    /*
 2834|       |    return is_el_a_metal( (int)el_number );
 2835|       |    */
 2836|       |
 2837|     93|    if (!el_numb[el_C])
  ------------------
  |  Branch (2837:9): [True: 1, False: 92]
  ------------------
 2838|      1|    {
 2839|      1|        el_numb[el_C] = (U_CHAR) get_periodic_table_number( "C" );
 2840|      1|        el_numb[el_N] = (U_CHAR) get_periodic_table_number( "N" );
 2841|      1|        el_numb[el_P] = (U_CHAR) get_periodic_table_number( "P" );
 2842|      1|        el_numb[el_As] = (U_CHAR) get_periodic_table_number( "As" );
 2843|      1|        el_numb[el_Sb] = (U_CHAR) get_periodic_table_number( "Sb" );
 2844|      1|        el_numb[el_S] = (U_CHAR) get_periodic_table_number( "S" );
 2845|      1|        el_numb[el_Se] = (U_CHAR) get_periodic_table_number( "Se" );
 2846|      1|        el_numb[el_Te] = (U_CHAR) get_periodic_table_number( "Te" );
 2847|      1|        el_numb[el_Cl] = (U_CHAR) get_periodic_table_number( "Cl" );
 2848|      1|        el_numb[el_Br] = (U_CHAR) get_periodic_table_number( "Br" );
 2849|      1|        el_numb[el_I] = (U_CHAR) get_periodic_table_number( "I" );
 2850|       |#if ( ALL_NONMETAL_Z == 1 )
 2851|       |        el_numb[el_B] = (U_CHAR) get_periodic_table_number( "B" );
 2852|       |        el_numb[el_O] = (U_CHAR) get_periodic_table_number( "O" );
 2853|       |        el_numb[el_Si] = (U_CHAR) get_periodic_table_number( "Si" );
 2854|       |        el_numb[el_Ge] = (U_CHAR) get_periodic_table_number( "Ge" );
 2855|       |        el_numb[el_F] = (U_CHAR) get_periodic_table_number( "F" );
 2856|       |        el_numb[el_At] = (U_CHAR) get_periodic_table_number( "At" );
 2857|       |#endif
 2858|      1|    }
 2859|       |
 2860|     93|    if (memchr( el_numb, el_number, el_len ))
  ------------------
  |  Branch (2860:9): [True: 0, False: 93]
  ------------------
 2861|      0|    {
 2862|      0|        return 1;
 2863|      0|    }
 2864|       |
 2865|     93|    return 0;
 2866|     93|}
GetAtomChargeType:
 2935|   113k|{
 2936|       |
 2937|   113k|    inp_ATOM *at = atom + at_no;
 2938|   113k|#if ( FIX_NORM_BUG_ADD_ION_PAIR == 1 )
 2939|   113k|    int i, neigh, mask, bit, type, num_z, num_m, num_o, delta = bSubtract > 0 ? -1 : 1; /* 0 or -2 => add, 1 or 2 => subtract */
  ------------------
  |  Branch (2939:65): [True: 4, False: 113k]
  ------------------
 2940|   113k|    int bNoAdjIon = ( bSubtract == 0 || bSubtract == 1 );
  ------------------
  |  Branch (2940:23): [True: 113k, False: 4]
  |  Branch (2940:41): [True: 4, False: 0]
  ------------------
 2941|       |#else
 2942|       |    int i, neigh, mask, bit, type, num_z, num_m, num_o, delta = bSubtract ? -1 : 1;
 2943|       |#endif
 2944|   113k|    int bUnsatNHasTerminalO = 0;
 2945|       |
 2946|   113k|    type = ATT_NONE;
  ------------------
  |  |   62|   113k|#define ATT_NONE         0x0000
  ------------------
 2947|   113k|    mask = 0;
 2948|       |
 2949|   113k|    if (at->radical && at->radical != RADICAL_SINGLET)
  ------------------
  |  |  103|     34|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (2949:9): [True: 34, False: 113k]
  |  Branch (2949:24): [True: 34, False: 0]
  ------------------
 2950|     34|    {
 2951|     34|        goto exit_function;
 2952|     34|    }
 2953|       |    
 2954|   113k|    if (is_el_a_metal( at->el_number ))
  ------------------
  |  Branch (2954:9): [True: 2.19k, False: 110k]
  ------------------
 2955|  2.19k|    {
 2956|  2.19k|        goto exit_function;
 2957|  2.19k|    }
 2958|   110k|    if (at->charge < -1 || at->charge > 1)
  ------------------
  |  Branch (2958:9): [True: 0, False: 110k]
  |  Branch (2958:28): [True: 0, False: 110k]
  ------------------
 2959|      0|    {
 2960|      0|        goto exit_function;
 2961|      0|    }
 2962|       |
 2963|   110k|    if (!at->valence && at->charge == 1 && !at->num_H && !at->radical && at->el_number == EL_NUMBER_H)
  ------------------
  |  |   41|      5|#define EL_NUMBER_H ((U_CHAR) 1)
  ------------------
  |  Branch (2963:9): [True: 110k, False: 215]
  |  Branch (2963:25): [True: 5, False: 110k]
  |  Branch (2963:44): [True: 5, False: 0]
  |  Branch (2963:58): [True: 5, False: 0]
  |  Branch (2963:74): [True: 5, False: 0]
  ------------------
 2964|      5|    {
 2965|       |        /* a proton H+ (#1) */
 2966|      5|        type = ATT_PROTON;
  ------------------
  |  |   75|      5|#define ATT_PROTON       0x1000
  ------------------
 2967|      5|        mask = ATBIT_Proton;
  ------------------
  |  |  143|      5|#define ATBIT_Proton     (1 << ATTOT_NUM_Proton)
  ------------------
 2968|      5|        goto count_mask_bits;
 2969|      5|    }
 2970|       |
 2971|   110k|    if (  !at->valence && at->charge == -1	&& 
  ------------------
  |  Branch (2971:11): [True: 110k, False: 215]
  |  Branch (2971:27): [True: 0, False: 110k]
  ------------------
 2972|   110k|          !at->num_H && !at->radical		&&
  ------------------
  |  Branch (2972:11): [True: 0, False: 0]
  |  Branch (2972:25): [True: 0, False: 0]
  ------------------
 2973|   110k|          (	at->el_number == EL_NUMBER_F || at->el_number == EL_NUMBER_CL	||
  ------------------
  |  |   46|      0|#define EL_NUMBER_F ((U_CHAR) 9)
  ------------------
                        (	at->el_number == EL_NUMBER_F || at->el_number == EL_NUMBER_CL	||
  ------------------
  |  |   50|      0|#define EL_NUMBER_CL ((U_CHAR) 17)
  ------------------
  |  Branch (2973:13): [True: 0, False: 0]
  |  Branch (2973:45): [True: 0, False: 0]
  ------------------
 2974|      0|            at->el_number == EL_NUMBER_BR || at->el_number == EL_NUMBER_I	 ) 
  ------------------
  |  |   53|      0|#define EL_NUMBER_BR ((U_CHAR) 35)
  ------------------
                          at->el_number == EL_NUMBER_BR || at->el_number == EL_NUMBER_I	 ) 
  ------------------
  |  |   55|      0|#define EL_NUMBER_I ((U_CHAR) 53)
  ------------------
  |  Branch (2974:13): [True: 0, False: 0]
  |  Branch (2974:46): [True: 0, False: 0]
  ------------------
 2975|   110k|        )
 2976|      0|    {
 2977|       |        /* a halogen anion Hal- (#2) */
 2978|      0|        type = ATT_HalAnion;
  ------------------
  |  |   76|      0|#define ATT_HalAnion     0x2000
  ------------------
 2979|      0|        mask = ATBIT_HalAnion;
  ------------------
  |  |  144|      0|#define ATBIT_HalAnion   (1 << ATTOT_NUM_HalAnion)
  ------------------
 2980|      0|        goto count_mask_bits;
 2981|      0|    }
 2982|   110k|#if ( HAL_ACID_H_XCHG == 1 )
 2983|       |    /* halogen/chalcogen acid */
 2984|   110k|    if (!at->valence && at->charge == 0 && 1 == at->num_H && !at->radical &&
  ------------------
  |  Branch (2984:9): [True: 110k, False: 215]
  |  Branch (2984:25): [True: 110k, False: 0]
  |  Branch (2984:44): [True: 0, False: 110k]
  |  Branch (2984:62): [True: 0, False: 0]
  ------------------
 2985|   110k|        ( at->el_number == EL_NUMBER_F ||
  ------------------
  |  |   46|      0|#define EL_NUMBER_F ((U_CHAR) 9)
  ------------------
  |  Branch (2985:11): [True: 0, False: 0]
  ------------------
 2986|      0|          at->el_number == EL_NUMBER_CL ||
  ------------------
  |  |   50|      0|#define EL_NUMBER_CL ((U_CHAR) 17)
  ------------------
  |  Branch (2986:11): [True: 0, False: 0]
  ------------------
 2987|      0|          at->el_number == EL_NUMBER_BR ||
  ------------------
  |  |   53|      0|#define EL_NUMBER_BR ((U_CHAR) 35)
  ------------------
  |  Branch (2987:11): [True: 0, False: 0]
  ------------------
 2988|      0|          at->el_number == EL_NUMBER_I ) ||
  ------------------
  |  |   55|      0|#define EL_NUMBER_I ((U_CHAR) 53)
  ------------------
  |  Branch (2988:11): [True: 0, False: 0]
  ------------------
 2989|   110k|         !at->valence && at->charge == 0 && 2 == at->num_H && !at->radical &&
  ------------------
  |  Branch (2989:10): [True: 110k, False: 215]
  |  Branch (2989:26): [True: 110k, False: 0]
  |  Branch (2989:45): [True: 0, False: 110k]
  |  Branch (2989:63): [True: 0, False: 0]
  ------------------
 2990|   110k|         ( at->el_number == EL_NUMBER_O ||
  ------------------
  |  |   45|      0|#define EL_NUMBER_O ((U_CHAR) 8)
  ------------------
  |  Branch (2990:12): [True: 0, False: 0]
  ------------------
 2991|      0|           at->el_number == EL_NUMBER_S ||
  ------------------
  |  |   49|      0|#define EL_NUMBER_S ((U_CHAR) 16)
  ------------------
  |  Branch (2991:12): [True: 0, False: 0]
  ------------------
 2992|      0|           at->el_number == EL_NUMBER_SE ||
  ------------------
  |  |   52|      0|#define EL_NUMBER_SE ((U_CHAR) 34)
  ------------------
  |  Branch (2992:12): [True: 0, False: 0]
  ------------------
 2993|      0|           at->el_number == EL_NUMBER_TE )
  ------------------
  |  |   54|      0|#define EL_NUMBER_TE ((U_CHAR) 52)
  ------------------
  |  Branch (2993:12): [True: 0, False: 0]
  ------------------
 2994|   110k|         )
 2995|      0|    {
 2996|       |        /* a halogen/chalcogen acid (#3) */
 2997|      0|        type = ATT_HalAcid;
  ------------------
  |  |   77|      0|#define ATT_HalAcid      0x4000
  ------------------
 2998|      0|        mask = ATBIT_HalAcid;
  ------------------
  |  |  145|      0|#define ATBIT_HalAcid    (1 << ATTOT_NUM_HalAcid)
  ------------------
 2999|      0|        goto count_mask_bits;
 3000|      0|    }
 3001|   110k|#endif
 3002|       |
 3003|   110k|    if (detect_unusual_el_valence( at->el_number, at->charge, at->radical,
  ------------------
  |  Branch (3003:9): [True: 0, False: 110k]
  ------------------
 3004|   110k|                                   at->chem_bonds_valence, at->num_H, at->valence ))
 3005|      0|    {
 3006|      0|        goto exit_function; /* unusual valence state */
 3007|      0|    }
 3008|       |
 3009|       |    /* Check neighbors */
 3010|   110k|    for (i = 0, num_z = 0, num_m = 0, num_o = 0; i < at->valence; i++)
  ------------------
  |  Branch (3010:50): [True: 244, False: 110k]
  ------------------
 3011|    244|    {
 3012|    244|        neigh = at->neighbor[i];
 3013|    244|#if ( FIX_NORM_BUG_ADD_ION_PAIR == 1 )
 3014|    244|        if (atom[neigh].charge < -1 || atom[neigh].charge > 1)
  ------------------
  |  Branch (3014:13): [True: 26, False: 218]
  |  Branch (3014:40): [True: 0, False: 218]
  ------------------
 3015|     26|        {
 3016|     26|            goto exit_function; /* neighboring charge */
 3017|     26|        }
 3018|    218|        if (atom[neigh].charge && at->charge)
  ------------------
  |  Branch (3018:13): [True: 145, False: 73]
  |  Branch (3018:35): [True: 125, False: 20]
  ------------------
 3019|    125|        {
 3020|    125|            if (bNoAdjIon)
  ------------------
  |  Branch (3020:17): [True: 125, False: 0]
  ------------------
 3021|    125|            {
 3022|    125|#if ( FIX_RENUM_BUG_FOR_CASE_OF_ACIDIC_OH_AT_P_PLUS == 1 )
 3023|    125|                goto count_mask_bits;
 3024|       |                /*update_some_attype_totals(nAtTypeTotals, mask, delta, at->charge);*/
 3025|      0|#endif
 3026|      0|                goto exit_function; /* neighboring charge */
 3027|    125|            }
 3028|      0|            type = ATT_NONE;
  ------------------
  |  |   62|      0|#define ATT_NONE         0x0000
  ------------------
 3029|      0|            mask = 0;
 3030|      0|            goto count_mask_bits;
 3031|    125|        }
 3032|       |#else
 3033|       |        if (atom[neigh].charge < -1 || atom[neigh].charge > 1 || atom[neigh].charge && at->charge)
 3034|       |        {
 3035|       |            goto exit_function; /* neighboring charge */
 3036|       |        }
 3037|       |#endif
 3038|     93|        if (detect_unusual_el_valence( atom[neigh].el_number, atom[neigh].charge, atom[neigh].radical,
  ------------------
  |  Branch (3038:13): [True: 0, False: 93]
  ------------------
 3039|     93|                                       atom[neigh].chem_bonds_valence, atom[neigh].num_H,
 3040|     93|                                       atom[neigh].valence ))
 3041|      0|        {
 3042|       |            /* neighbor in unusual valence state */
 3043|      0|            goto exit_function;
 3044|      0|        }
 3045|     93|        if (is_Z_atom( atom[neigh].el_number ))
  ------------------
  |  Branch (3045:13): [True: 0, False: 93]
  ------------------
 3046|      0|        {
 3047|      0|            num_z++;
 3048|      0|        }
 3049|     93|        if (is_el_a_metal( atom[neigh].el_number ))
  ------------------
  |  Branch (3049:13): [True: 0, False: 93]
  ------------------
 3050|      0|        {
 3051|      0|            num_m++;
 3052|      0|        }
 3053|     93|        num_o += ( atom[neigh].el_number == EL_NUMBER_O );
  ------------------
  |  |   45|     93|#define EL_NUMBER_O ((U_CHAR) 8)
  ------------------
 3054|     93|        if (at->el_number == EL_NUMBER_N && at->valence == 2 && !at->charge &&
  ------------------
  |  |   44|    186|#define EL_NUMBER_N ((U_CHAR) 7)
  ------------------
  |  Branch (3054:13): [True: 0, False: 93]
  |  Branch (3054:45): [True: 0, False: 0]
  |  Branch (3054:65): [True: 0, False: 0]
  ------------------
 3055|       |             /*at->valence < at->chem_bonds_valence &&*/
 3056|     93|             atom[neigh].valence == 1 && atom[neigh].chem_bonds_valence == 2 &&
  ------------------
  |  Branch (3056:14): [True: 0, False: 0]
  |  Branch (3056:42): [True: 0, False: 0]
  ------------------
 3057|     93|             ( atom[neigh].el_number == EL_NUMBER_O ||
  ------------------
  |  |   45|      0|#define EL_NUMBER_O ((U_CHAR) 8)
  ------------------
  |  Branch (3057:16): [True: 0, False: 0]
  ------------------
 3058|      0|               atom[neigh].el_number == EL_NUMBER_S ||
  ------------------
  |  |   49|      0|#define EL_NUMBER_S ((U_CHAR) 16)
  ------------------
  |  Branch (3058:16): [True: 0, False: 0]
  ------------------
 3059|      0|               atom[neigh].el_number == EL_NUMBER_SE ||
  ------------------
  |  |   52|      0|#define EL_NUMBER_SE ((U_CHAR) 34)
  ------------------
  |  Branch (3059:16): [True: 0, False: 0]
  ------------------
 3060|      0|               atom[neigh].el_number == EL_NUMBER_TE ))
  ------------------
  |  |   54|      0|#define EL_NUMBER_TE ((U_CHAR) 52)
  ------------------
  |  Branch (3060:16): [True: 0, False: 0]
  ------------------
 3061|      0|        {
 3062|      0|            bUnsatNHasTerminalO++;
 3063|      0|        }
 3064|     93|    } /* eof check neighbors */
 3065|       |
 3066|       |    /* O, S, Se, Te */
 3067|   110k|    if ( at->el_number == EL_NUMBER_O	||
  ------------------
  |  |   45|   221k|#define EL_NUMBER_O ((U_CHAR) 8)
  ------------------
  |  Branch (3067:10): [True: 116, False: 110k]
  ------------------
 3068|   110k|         at->el_number == EL_NUMBER_S	||
  ------------------
  |  |   49|   221k|#define EL_NUMBER_S ((U_CHAR) 16)
  ------------------
  |  Branch (3068:10): [True: 189, False: 110k]
  ------------------
 3069|   110k|         at->el_number == EL_NUMBER_SE	||
  ------------------
  |  |   52|   221k|#define EL_NUMBER_SE ((U_CHAR) 34)
  ------------------
  |  Branch (3069:10): [True: 0, False: 110k]
  ------------------
 3070|   110k|         at->el_number == EL_NUMBER_TE	 )
  ------------------
  |  |   54|   110k|#define EL_NUMBER_TE ((U_CHAR) 52)
  ------------------
  |  Branch (3070:10): [True: 0, False: 110k]
  ------------------
 3071|    305|    {
 3072|    305|        if (at->charge == 1)
  ------------------
  |  Branch (3072:13): [True: 0, False: 305]
  ------------------
 3073|      0|        {
 3074|      0|            if (at->num_H)
  ------------------
  |  Branch (3074:17): [True: 0, False: 0]
  ------------------
 3075|      0|            {
 3076|       |                /* #4 */
 3077|      0|                type = ATT_O_PLUS;
  ------------------
  |  |   74|      0|#define ATT_O_PLUS       0x0800   /* -OH2(+), =OH(+), -OH(+)-, OH3(+), =O(+)-, etc; O=O,S,Se,Te */
  ------------------
 3078|      0|                mask |= ATBIT_OH_Plus;
  ------------------
  |  |  141|      0|#define ATBIT_OH_Plus    (1 << ATTOT_NUM_OH_Plus)
  ------------------
 3079|      0|            }
 3080|      0|            else
 3081|      0|            {
 3082|       |                /* #5 */
 3083|      0|                type = ATT_O_PLUS;
  ------------------
  |  |   74|      0|#define ATT_O_PLUS       0x0800   /* -OH2(+), =OH(+), -OH(+)-, OH3(+), =O(+)-, etc; O=O,S,Se,Te */
  ------------------
 3084|      0|                mask |= ATBIT_O_Plus;
  ------------------
  |  |  142|      0|#define ATBIT_O_Plus     (1 << ATTOT_NUM_O_Plus)
  ------------------
 3085|      0|            }
 3086|      0|        }
 3087|    305|        else
 3088|    305|        {
 3089|       |            /* at->charge != 1 */
 3090|    305|            if (at->valence > 1)
  ------------------
  |  Branch (3090:17): [True: 15, False: 290]
  ------------------
 3091|     15|            {
 3092|     15|                goto exit_function;  /* not a terminal atom #C1 */
 3093|     15|            }
 3094|    290|            else
 3095|    290|            {
 3096|    290|                if (at->valence && !( num_z || num_o ))
  ------------------
  |  Branch (3096:21): [True: 49, False: 241]
  |  Branch (3096:39): [True: 0, False: 49]
  |  Branch (3096:48): [True: 49, False: 0]
  ------------------
 3097|      0|                {
 3098|      0|                    if (num_m == at->valence)
  ------------------
  |  Branch (3098:25): [True: 0, False: 0]
  ------------------
 3099|      0|                    {
 3100|      0|                        goto exit_function; /* #C2 */
 3101|      0|                    }
 3102|      0|                    goto count_mask_bits;  /* #C3 count charges, no donor or acceptor found */
 3103|      0|                }
 3104|    290|                else
 3105|    290|                {
 3106|       |                    /* Here at->neigh[0] is one of: O, or Z={C, N, P, As, Sb, S, Se, Te, Cl, Br, I} */
 3107|    290|                    if (at->valence)
  ------------------
  |  Branch (3107:25): [True: 49, False: 241]
  ------------------
 3108|     49|                    {
 3109|     49|                        neigh = at->neighbor[0]; /* Z or O only */
 3110|     49|                        if (!atom[neigh].charge && atom[neigh].el_number == EL_NUMBER_C &&
  ------------------
  |  |   43|     98|#define EL_NUMBER_C ((U_CHAR) 6)
  ------------------
  |  Branch (3110:29): [True: 49, False: 0]
  |  Branch (3110:52): [True: 0, False: 49]
  ------------------
 3111|     49|                             atom[neigh].chem_bonds_valence > atom[neigh].valence)
  ------------------
  |  Branch (3111:30): [True: 0, False: 0]
  ------------------
 3112|      0|                        {
 3113|       |                            /* =C-OH, #C-OH, =C-O(-), #C-O(-), -C=O, =C=O; O = O, S, Se, Te */
 3114|      0|                            type = ATT_ACIDIC_CO;
  ------------------
  |  |   63|      0|#define ATT_ACIDIC_CO    0x0001
  ------------------
 3115|      0|                            if (at->num_H == 1)
  ------------------
  |  Branch (3115:33): [True: 0, False: 0]
  ------------------
 3116|      0|                            {
 3117|      0|                                mask |= ( ATBIT_COH );            /* #6: =C-OH, #C-OH; O=O,S,Se,Te */
  ------------------
  |  |  122|      0|#define ATBIT_COH        (1 << ATTOT_NUM_COH)
  ------------------
 3118|       |                                                                  /*nAtTypeTotals[ATTOT_NUM_COH] ++;*/
 3119|      0|                            }
 3120|      0|                            else
 3121|      0|                            {
 3122|      0|                                if (at->charge == -1)
  ------------------
  |  Branch (3122:37): [True: 0, False: 0]
  ------------------
 3123|      0|                                {
 3124|      0|                                    mask |= ( ATBIT_CO_Minus );       /* #7: =C-O(-), #C-O(-); O=O,S,Se,Te */
  ------------------
  |  |  133|      0|#define ATBIT_CO_Minus   (1 << ATTOT_NUM_CO_Minus)
  ------------------
 3125|       |                                                                      /*nAtTypeTotals[ATTOT_NUM_CO_Minus] ++;*/
 3126|      0|                                }
 3127|      0|                                else
 3128|      0|                                {
 3129|      0|                                    if (!at->num_H && !at->charge)
  ------------------
  |  Branch (3129:41): [True: 0, False: 0]
  |  Branch (3129:55): [True: 0, False: 0]
  ------------------
 3130|      0|                                    {
 3131|      0|                                        mask |= ( ATBIT_CO );             /* #8 -C=O, =C=O; O=O,S,Se,Te */
  ------------------
  |  |  129|      0|#define ATBIT_CO         (1 << ATTOT_NUM_CO)
  ------------------
 3132|       |                                                                          /*nAtTypeTotals[ATTOT_NUM_CO] ++;*/
 3133|      0|                                    }
 3134|      0|                                    else
 3135|      0|                                    {
 3136|      0|                                        mask |= ( ATBIT_Errors );
  ------------------
  |  |  148|      0|#define ATBIT_Errors     (1 << ATTOT_NUM_Errors)
  ------------------
 3137|       |                                        /*nAtTypeTotals[ATTOT_NUM_Errors] ++;*/
 3138|      0|                                    }
 3139|      0|                                }
 3140|      0|                            }
 3141|      0|                        }
 3142|     49|                        else
 3143|     49|                        {
 3144|     49|                            if (!atom[neigh].charge &&
  ------------------
  |  Branch (3144:33): [True: 49, False: 0]
  ------------------
 3145|     49|                                ( atom[neigh].el_number == EL_NUMBER_O ||
  ------------------
  |  |   45|     98|#define EL_NUMBER_O ((U_CHAR) 8)
  ------------------
  |  Branch (3145:35): [True: 49, False: 0]
  ------------------
 3146|     49|                                  atom[neigh].el_number == EL_NUMBER_S ||
  ------------------
  |  |   49|     49|#define EL_NUMBER_S ((U_CHAR) 16)
  ------------------
  |  Branch (3146:35): [True: 0, False: 0]
  ------------------
 3147|     49|                                  atom[neigh].el_number == EL_NUMBER_SE ||
  ------------------
  |  |   52|     49|#define EL_NUMBER_SE ((U_CHAR) 34)
  ------------------
  |  Branch (3147:35): [True: 0, False: 0]
  ------------------
 3148|     49|                                  atom[neigh].el_number == EL_NUMBER_TE ) &&
  ------------------
  |  |   54|      0|#define EL_NUMBER_TE ((U_CHAR) 52)
  ------------------
  |  Branch (3148:35): [True: 0, False: 0]
  ------------------
 3149|     49|                                 atom[neigh].chem_bonds_valence == atom[neigh].valence)
  ------------------
  |  Branch (3149:34): [True: 49, False: 0]
  ------------------
 3150|     49|                            {
 3151|       |                                /* -O-OH, -O-O(-); O = O, S, Se, Te */
 3152|     49|                                type = ATT_OO;
  ------------------
  |  |   65|     49|#define ATT_OO           0x0004
  ------------------
 3153|     49|                                if (at->num_H == 1)
  ------------------
  |  Branch (3153:37): [True: 32, False: 17]
  ------------------
 3154|     32|                                {
 3155|     32|                                    mask |= ( ATBIT_OOH );            /* #9 -O-OH */
  ------------------
  |  |  125|     32|#define ATBIT_OOH        (1 << ATTOT_NUM_OOH)
  ------------------
 3156|       |                                                                      /*nAtTypeTotals[ATTOT_NUM_OOH] ++;*/
 3157|     32|                                }
 3158|     17|                                else
 3159|     17|                                {
 3160|     17|                                    if (at->charge == -1)
  ------------------
  |  Branch (3160:41): [True: 17, False: 0]
  ------------------
 3161|     17|                                    {
 3162|     17|                                        mask |= ( ATBIT_OO_Minus );       /* #10 -O-O(-) */
  ------------------
  |  |  136|     17|#define ATBIT_OO_Minus   (1 << ATTOT_NUM_OO_Minus)
  ------------------
 3163|       |                                                                          /*nAtTypeTotals[ATTOT_NUM_OO_Minus] ++;*/
 3164|     17|                                    }
 3165|      0|                                    else
 3166|      0|                                    {
 3167|      0|                                        mask |= ( ATBIT_Errors );
  ------------------
  |  |  148|      0|#define ATBIT_Errors     (1 << ATTOT_NUM_Errors)
  ------------------
 3168|       |                                        /*nAtTypeTotals[ATTOT_NUM_Errors] ++;*/
 3169|      0|                                    }
 3170|     17|                                }
 3171|     49|                            }
 3172|      0|                            else
 3173|      0|                            {
 3174|      0|                                if (!atom[neigh].charge &&
  ------------------
  |  Branch (3174:37): [True: 0, False: 0]
  ------------------
 3175|      0|                                     atom[neigh].chem_bonds_valence == atom[neigh].valence &&
  ------------------
  |  Branch (3175:38): [True: 0, False: 0]
  ------------------
 3176|      0|                                     atom[neigh].el_number == EL_NUMBER_C &&
  ------------------
  |  |   43|      0|#define EL_NUMBER_C ((U_CHAR) 6)
  ------------------
  |  Branch (3176:38): [True: 0, False: 0]
  ------------------
 3177|      0|                                     at->el_number != EL_NUMBER_O)
  ------------------
  |  |   45|      0|#define EL_NUMBER_O ((U_CHAR) 8)
  ------------------
  |  Branch (3177:38): [True: 0, False: 0]
  ------------------
 3178|      0|                                {
 3179|       |                                    /* >C-S(-), >C-SH; S = S, Se, Te  */
 3180|      0|                                    type = ATT_ACIDIC_S;
  ------------------
  |  |   64|      0|#define ATT_ACIDIC_S     0x0002
  ------------------
 3181|      0|                                    if (at->num_H == 1)
  ------------------
  |  Branch (3181:41): [True: 0, False: 0]
  ------------------
 3182|      0|                                    {
 3183|      0|                                        mask |= ( ATBIT_CSH );            /* #11: >C-SH, >CH-SH, -CH2-SH; S = S, Se, Te */
  ------------------
  |  |  123|      0|#define ATBIT_CSH        (1 << ATTOT_NUM_CSH)
  ------------------
 3184|       |                                                                          /*nAtTypeTotals[ATTOT_NUM_CSH] ++;*/
 3185|      0|                                    }
 3186|      0|                                    else
 3187|      0|                                    {
 3188|      0|                                        if (at->charge == -1)
  ------------------
  |  Branch (3188:45): [True: 0, False: 0]
  ------------------
 3189|      0|                                        {
 3190|      0|                                            mask |= ( ATBIT_CS_Minus );       /* #12: >C-S(-), >CH-S(-), -CH2-S(-); S = S, Se, Te  */
  ------------------
  |  |  134|      0|#define ATBIT_CS_Minus   (1 << ATTOT_NUM_CS_Minus)
  ------------------
 3191|       |                                                                              /*nAtTypeTotals[ATTOT_NUM_CS_Minus] ++;*/
 3192|      0|                                        }
 3193|      0|                                        else
 3194|      0|                                        {
 3195|      0|                                            mask |= ( ATBIT_Errors );
  ------------------
  |  |  148|      0|#define ATBIT_Errors     (1 << ATTOT_NUM_Errors)
  ------------------
 3196|       |                                            /*nAtTypeTotals[ATTOT_NUM_Errors] ++;*/
 3197|      0|                                        }
 3198|      0|                                    }
 3199|      0|                                }
 3200|      0|                                else
 3201|      0|                                {
 3202|      0|                                    if (atom[neigh].el_number == EL_NUMBER_N &&
  ------------------
  |  |   44|      0|#define EL_NUMBER_N ((U_CHAR) 7)
  ------------------
  |  Branch (3202:41): [True: 0, False: 0]
  ------------------
 3203|      0|                                         atom[neigh].valence == 2 &&
  ------------------
  |  Branch (3203:42): [True: 0, False: 0]
  ------------------
 3204|      0|                                         ( !atom[neigh].num_H || atom[neigh].num_H == 1 && atom[neigh].charge == 1 ))
  ------------------
  |  Branch (3204:44): [True: 0, False: 0]
  |  Branch (3204:66): [True: 0, False: 0]
  |  Branch (3204:92): [True: 0, False: 0]
  ------------------
 3205|      0|                                    {
 3206|       |                                        /* N or N(-) or NH(+) neighbor */
 3207|      0|                                        type = ATT_NO; /* single bond only */
  ------------------
  |  |   67|      0|#define ATT_NO           0x0010
  ------------------
 3208|      0|                                        if (at->num_H == 1)
  ------------------
  |  Branch (3208:45): [True: 0, False: 0]
  ------------------
 3209|      0|                                        {
 3210|      0|                                            mask |= ( ATBIT_NOH );            /* #13: =N-OH, =NH(+)-OH, #N(+)-OH, -N(-)-OH; O = O, S, Se, Te */
  ------------------
  |  |  127|      0|#define ATBIT_NOH        (1 << ATTOT_NUM_NOH)
  ------------------
 3211|       |                                                                              /*nAtTypeTotals[ATTOT_NUM_NOH] ++;*/
 3212|      0|                                        }
 3213|      0|                                        else
 3214|      0|                                        {
 3215|      0|                                            if (at->charge == -1)
  ------------------
  |  Branch (3215:49): [True: 0, False: 0]
  ------------------
 3216|      0|                                            {
 3217|      0|                                                mask |= ( ATBIT_NO_Minus );       /* #14: =N-O(-); O = O, S, Se, Te */
  ------------------
  |  |  138|      0|#define ATBIT_NO_Minus   (1 << ATTOT_NUM_NO_Minus)
  ------------------
 3218|       |                                                                                  /*nAtTypeTotals[ATTOT_NUM_NO_Minus] ++;*/
 3219|      0|                                            }
 3220|      0|                                            else
 3221|      0|                                            {
 3222|      0|                                                if (atom[neigh].charge == 1 || atom[neigh].charge == 0)
  ------------------
  |  Branch (3222:53): [True: 0, False: 0]
  |  Branch (3222:80): [True: 0, False: 0]
  ------------------
 3223|      0|                                                {
 3224|      0|                                                    mask |= ( ATBIT_NO );             /* #15: =N(+)=O, -NH(+)=O -N=O */
  ------------------
  |  |  131|      0|#define ATBIT_NO         (1 << ATTOT_NUM_NO)
  ------------------
 3225|       |                                                                                      /*nAtTypeTotals[ATTOT_NUM_NO] ++;*/
 3226|      0|                                                }
 3227|      0|                                                else
 3228|      0|                                                {
 3229|      0|                                                    mask |= ( ATBIT_Errors );
  ------------------
  |  |  148|      0|#define ATBIT_Errors     (1 << ATTOT_NUM_Errors)
  ------------------
 3230|       |                                                    /*nAtTypeTotals[ATTOT_NUM_Errors] ++;*/
 3231|      0|                                                }
 3232|      0|                                            }
 3233|      0|                                        }
 3234|      0|                                    }
 3235|      0|                                    else
 3236|      0|                                    {
 3237|      0|                                        if (atom[neigh].el_number == EL_NUMBER_N)
  ------------------
  |  |   44|      0|#define EL_NUMBER_N ((U_CHAR) 7)
  ------------------
  |  Branch (3237:45): [True: 0, False: 0]
  ------------------
 3238|      0|                                        {
 3239|      0|                                            type = ATT_N_O; /* #16: single bond only */
  ------------------
  |  |   68|      0|#define ATT_N_O          0x0020
  ------------------
 3240|      0|                                            if (at->num_H == 1)
  ------------------
  |  Branch (3240:49): [True: 0, False: 0]
  ------------------
 3241|      0|                                            {
 3242|      0|                                                mask |= ( ATBIT_N_OH );            /* #16: -NH-OH, >N-OH or >N(+)<OH; O = O, S, Se, Te */
  ------------------
  |  |  128|      0|#define ATBIT_N_OH       (1 << ATTOT_NUM_N_OH)
  ------------------
 3243|       |                                                                                   /*nAtTypeTotals[ATTOT_NUM_NOH] ++;*/
 3244|      0|                                            }
 3245|      0|                                            else
 3246|      0|                                            {
 3247|      0|                                                if (at->charge == -1)
  ------------------
  |  Branch (3247:53): [True: 0, False: 0]
  ------------------
 3248|      0|                                                {
 3249|      0|                                                    mask |= ( ATBIT_N_O_Minus );       /* #17: -NH-O(-), >N-O(-); O = O, S, Se, Te */
  ------------------
  |  |  139|      0|#define ATBIT_N_O_Minus  (1 << ATTOT_NUM_N_O_Minus)
  ------------------
 3250|       |                                                                                       /*nAtTypeTotals[ATTOT_NUM_NO_Minus] ++;*/
 3251|      0|                                                }
 3252|      0|                                                else
 3253|      0|                                                {
 3254|      0|                                                    if (atom[neigh].charge == 1)
  ------------------
  |  Branch (3254:57): [True: 0, False: 0]
  ------------------
 3255|      0|                                                    {
 3256|      0|                                                        mask |= ( ATBIT_N_O );             /* #18:  >N(+)=O */
  ------------------
  |  |  132|      0|#define ATBIT_N_O        (1 << ATTOT_NUM_N_O)
  ------------------
 3257|       |                                                                                           /*nAtTypeTotals[ATTOT_NUM_NO] ++;*/
 3258|      0|                                                    }
 3259|      0|                                                    else
 3260|      0|                                                    {
 3261|      0|                                                        mask |= ( ATBIT_Errors );
  ------------------
  |  |  148|      0|#define ATBIT_Errors     (1 << ATTOT_NUM_Errors)
  ------------------
 3262|       |                                                        /*nAtTypeTotals[ATTOT_NUM_Errors] ++;*/
 3263|      0|                                                    }
 3264|      0|                                                }
 3265|      0|                                            }
 3266|      0|                                        }
 3267|      0|                                        else
 3268|      0|                                        {
 3269|      0|                                            if ( atom[neigh].el_number != EL_NUMBER_C &&
  ------------------
  |  |   43|      0|#define EL_NUMBER_C ((U_CHAR) 6)
  ------------------
  |  Branch (3269:50): [True: 0, False: 0]
  ------------------
 3270|      0|                                                 atom[neigh].el_number != EL_NUMBER_O &&
  ------------------
  |  |   45|      0|#define EL_NUMBER_O ((U_CHAR) 8)
  ------------------
  |  Branch (3270:50): [True: 0, False: 0]
  ------------------
 3271|      0|                                                 !is_el_a_metal( atom[neigh].el_number ) &&
  ------------------
  |  Branch (3271:50): [True: 0, False: 0]
  ------------------
 3272|      0|                                                 atom[neigh].chem_bonds_valence > atom[neigh].valence)
  ------------------
  |  Branch (3272:50): [True: 0, False: 0]
  ------------------
 3273|      0|                                            {
 3274|       |                                                /* =Z-OH, #Z-OH, =Z-O(-), #Z-O(-), -Z=O, =Z=O;
 3275|       |                                                =Z(+)-OH, #Z(+)-OH, =Z-O(-), #Z-O(-), -Z(+)=O, =Z(+)=O; O = O, S, Se, Te */
 3276|       |                                                /* neigh = Z\{N,C} = P, As, Sb, S, Se, Te, Cl, Br, I */
 3277|      0|                                                if (at->chem_bonds_valence == 1 && IsZOX( atom, at_no, 0 ))
  ------------------
  |  Branch (3277:53): [True: 0, False: 0]
  |  Branch (3277:84): [True: 0, False: 0]
  ------------------
 3278|      0|                                                {
 3279|      0|                                                    type = ATT_ZOO;
  ------------------
  |  |   66|      0|#define ATT_ZOO          0x0008
  ------------------
 3280|      0|                                                    if (at->num_H == 1)
  ------------------
  |  Branch (3280:57): [True: 0, False: 0]
  ------------------
 3281|      0|                                                    {
 3282|      0|                                                        mask |= ( ATBIT_ZOOH );            /* 18: O=Z-OH; O=O,S,Se,Te; Z may have charge */
  ------------------
  |  |  126|      0|#define ATBIT_ZOOH       (1 << ATTOT_NUM_ZOOH)
  ------------------
 3283|       |                                                                                           /*nAtTypeTotals[ATTOT_NUM_ZOOH] ++;*/
 3284|      0|                                                    }
 3285|      0|                                                    else
 3286|      0|                                                    {
 3287|      0|                                                        if (at->charge == -1)
  ------------------
  |  Branch (3287:61): [True: 0, False: 0]
  ------------------
 3288|      0|                                                        {
 3289|      0|                                                            mask |= ( ATBIT_ZOO_Minus );       /* 19: O=Z-O(-); O = O, S, Se, Te */
  ------------------
  |  |  137|      0|#define ATBIT_ZOO_Minus  (1 << ATTOT_NUM_ZOO_Minus)
  ------------------
 3290|       |                                                                                               /*nAtTypeTotals[ATTOT_NUM_ZOO_Minus] ++;*/
 3291|      0|                                                        }
 3292|      0|                                                        else
 3293|      0|                                                        {
 3294|      0|                                                            mask |= ( ATBIT_Errors );
  ------------------
  |  |  148|      0|#define ATBIT_Errors     (1 << ATTOT_NUM_Errors)
  ------------------
 3295|       |                                                            /*nAtTypeTotals[ATTOT_NUM_Errors] ++;*/
 3296|      0|                                                        }
 3297|      0|                                                    }
 3298|      0|                                                }
 3299|      0|                                                else
 3300|      0|                                                {
 3301|      0|                                                    type = ATT_OTHER_ZO;
  ------------------
  |  |   72|      0|#define ATT_OTHER_ZO     0x0200   /* -Z=O or =Z=O */
  ------------------
 3302|      0|                                                    if (at->num_H == 1)
  ------------------
  |  Branch (3302:57): [True: 0, False: 0]
  ------------------
 3303|      0|                                                    {
 3304|      0|                                                        mask |= ( ATBIT_ZOH );            /* 20: =Z-OH, #Z-OH; O=O,S,Se,Te; Z may have charge */
  ------------------
  |  |  124|      0|#define ATBIT_ZOH        (1 << ATTOT_NUM_ZOH)
  ------------------
 3305|       |                                                                                          /*nAtTypeTotals[ATTOT_NUM_ZOH] ++;*/
 3306|      0|                                                    }
 3307|      0|                                                    else
 3308|      0|                                                    {
 3309|      0|                                                        if (at->charge == -1)
  ------------------
  |  Branch (3309:61): [True: 0, False: 0]
  ------------------
 3310|      0|                                                        {
 3311|      0|                                                            mask |= ( ATBIT_ZO_Minus );       /* 21: =Z-O(-), #Z-O(-); O = O, S, Se, Te */
  ------------------
  |  |  135|      0|#define ATBIT_ZO_Minus   (1 << ATTOT_NUM_ZO_Minus)
  ------------------
 3312|       |                                                                                              /*nAtTypeTotals[ATTOT_NUM_ZO_Minus] ++;*/
 3313|      0|                                                        }
 3314|      0|                                                        else
 3315|      0|                                                        {
 3316|      0|                                                            if (at->num_H == 0)
  ------------------
  |  Branch (3316:65): [True: 0, False: 0]
  ------------------
 3317|      0|                                                            {
 3318|      0|                                                                mask |= ( ATBIT_ZO );             /* 22: -Z=O, =Z=O; O=O,S,Se,Te; Z may have charge */
  ------------------
  |  |  130|      0|#define ATBIT_ZO         (1 << ATTOT_NUM_ZO)
  ------------------
 3319|       |                                                                                                  /*nAtTypeTotals[ATTOT_NUM_ZO] ++;*/
 3320|      0|                                                            }
 3321|      0|                                                            else
 3322|      0|                                                            {
 3323|      0|                                                                mask |= ( ATBIT_Errors );
  ------------------
  |  |  148|      0|#define ATBIT_Errors     (1 << ATTOT_NUM_Errors)
  ------------------
 3324|       |                                                                /*nAtTypeTotals[ATTOT_NUM_Errors] ++;*/
 3325|      0|                                                            }
 3326|      0|                                                        }
 3327|      0|                                                    }
 3328|      0|                                                }
 3329|      0|                                            }
 3330|      0|                                            else
 3331|      0|                                            {
 3332|      0|                                                if (at->charge == -1 && !is_el_a_metal( atom[neigh].el_number ))
  ------------------
  |  Branch (3332:53): [True: 0, False: 0]
  |  Branch (3332:73): [True: 0, False: 0]
  ------------------
 3333|      0|                                                {
 3334|       |                                                    /* >Z-O(-); O=O,S,Se,Te */
 3335|      0|                                                    type = ATT_OTHER_NEG_O;
  ------------------
  |  |   71|      0|#define ATT_OTHER_NEG_O  0x0100
  ------------------
 3336|      0|                                                    mask |= ( ATBIT_O_Minus );            /* 23: -Z-O(-); O=O,S,Se,Te */
  ------------------
  |  |  140|      0|#define ATBIT_O_Minus    (1 << ATTOT_NUM_O_Minus)
  ------------------
 3337|       |                                                                                          /*nAtTypeTotals[ATTOT_NUM_ZO_Minus] ++;*/
 3338|      0|                                                }
 3339|      0|                                            }
 3340|      0|                                        }
 3341|      0|                                    }
 3342|      0|                                }
 3343|      0|                            }
 3344|     49|                        }
 3345|     49|                    }
 3346|       |
 3347|    241|                    else
 3348|    241|                    {
 3349|    241|                        if (at->charge == -1 && at->num_H == 1)
  ------------------
  |  Branch (3349:29): [True: 0, False: 241]
  |  Branch (3349:49): [True: 0, False: 0]
  ------------------
 3350|      0|                        {
 3351|      0|                            type = ATT_OH_MINUS;
  ------------------
  |  |   73|      0|#define ATT_OH_MINUS     0x0400   /* OH(-), O=O,S,Se,Te */
  ------------------
 3352|      0|                            mask |= ( ATBIT_O_Minus );            /* 25: HO(-); O=O,S,Se,Te */
  ------------------
  |  |  140|      0|#define ATBIT_O_Minus    (1 << ATTOT_NUM_O_Minus)
  ------------------
 3353|      0|                        }
 3354|    241|                    }
 3355|    290|                }
 3356|    290|            }
 3357|    305|        }
 3358|    305|    }
 3359|       |
 3360|   110k|    else
 3361|   110k|    {
 3362|       |        /* P, N, neutral valence = 3 (not 5) */
 3363|   110k|        if (( at->el_number == EL_NUMBER_N ||
  ------------------
  |  |   44|   220k|#define EL_NUMBER_N ((U_CHAR) 7)
  ------------------
  |  Branch (3363:15): [True: 526, False: 109k]
  ------------------
 3364|   110k|              at->el_number == EL_NUMBER_P ) &&
  ------------------
  |  |   48|   109k|#define EL_NUMBER_P ((U_CHAR) 15)
  ------------------
  |  Branch (3364:15): [True: 57, False: 109k]
  ------------------
 3365|   110k|             0 <= at->valence && at->valence <= 3 &&
  ------------------
  |  Branch (3365:14): [True: 583, False: 0]
  |  Branch (3365:34): [True: 583, False: 0]
  ------------------
 3366|   110k|             at->chem_bonds_valence + at->num_H == 3 + at->charge)
  ------------------
  |  Branch (3366:14): [True: 0, False: 583]
  ------------------
 3367|      0|        {
 3368|      0|            if (at->valence && !( num_z /*|| num_o == at->valence*/ ))
  ------------------
  |  Branch (3368:17): [True: 0, False: 0]
  |  Branch (3368:32): [True: 0, False: 0]
  ------------------
 3369|      0|            {
 3370|      0|                if (num_m == at->valence)
  ------------------
  |  Branch (3370:21): [True: 0, False: 0]
  ------------------
 3371|      0|                {
 3372|      0|                    goto exit_function;
 3373|      0|                }
 3374|      0|                goto count_mask_bits; /* N(III), N(-)(II), N(+)(IV) and same P that have only oxygen neighbors are ignored here */
 3375|      0|            }
 3376|      0|            type = ( at->el_number == EL_NUMBER_N ) ? ATT_ATOM_N : ATT_ATOM_P;
  ------------------
  |  |   44|      0|#define EL_NUMBER_N ((U_CHAR) 7)
  ------------------
                          type = ( at->el_number == EL_NUMBER_N ) ? ATT_ATOM_N : ATT_ATOM_P;
  ------------------
  |  |   69|      0|#define ATT_ATOM_N       0x0040
  ------------------
                          type = ( at->el_number == EL_NUMBER_N ) ? ATT_ATOM_N : ATT_ATOM_P;
  ------------------
  |  |   70|      0|#define ATT_ATOM_P       0x0080
  ------------------
  |  Branch (3376:20): [True: 0, False: 0]
  ------------------
 3377|      0|            switch (at->charge)
 3378|      0|            {
 3379|      0|                case -1:
  ------------------
  |  Branch (3379:17): [True: 0, False: 0]
  ------------------
 3380|      0|                    if (at->el_number == EL_NUMBER_N)
  ------------------
  |  |   44|      0|#define EL_NUMBER_N ((U_CHAR) 7)
  ------------------
  |  Branch (3380:25): [True: 0, False: 0]
  ------------------
 3381|      0|                    {
 3382|      0|                        mask |= ( ATBIT_N_Minus ); /* 26: -NH(-), =N(-), >N(-) */
  ------------------
  |  |  119|      0|#define ATBIT_N_Minus    (1 << ATTOT_NUM_N_Minus)
  ------------------
 3383|      0|                        if (at->num_H)
  ------------------
  |  Branch (3383:29): [True: 0, False: 0]
  ------------------
 3384|      0|                        {
 3385|      0|                            mask |= ( ATBIT_NP_H ); /* 27: -NH(-) */
  ------------------
  |  |  118|      0|#define ATBIT_NP_H       (1 << ATTOT_NUM_NP_H)
  ------------------
 3386|      0|                        }
 3387|      0|#if ( FIX_NP_MINUS_BUG == 1 )
 3388|      0|                        else
 3389|      0|                        {
 3390|      0|                            if (at->valence == 1 && at->chem_bonds_valence >= 2 && ( at->bond_type[0] & BOND_MARK_ALL ))
  ------------------
  |  |  219|      0|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
  |  Branch (3390:33): [True: 0, False: 0]
  |  Branch (3390:53): [True: 0, False: 0]
  |  Branch (3390:84): [True: 0, False: 0]
  ------------------
 3391|      0|                            {
 3392|      0|                                type |= ATT_NP_MINUS_V23; /* =N(-) created by normalization 2010-03-11 DT */
  ------------------
  |  |   79|      0|#define ATT_NP_MINUS_V23 0x8000   /* =N(-) or =P(-) where = previously was triple */
  ------------------
 3393|      0|                            }
 3394|      0|                        }
 3395|      0|#endif
 3396|      0|                    }
 3397|       |                    /*nAtTypeTotals[ATTOT_NUM_N_Minus] += (at->el_number == EL_NUMBER_N);*/
 3398|      0|                    break;
 3399|      0|                case 0:
  ------------------
  |  Branch (3399:17): [True: 0, False: 0]
  ------------------
 3400|      0|                    if (at->num_H)
  ------------------
  |  Branch (3400:25): [True: 0, False: 0]
  ------------------
 3401|      0|                    {
 3402|      0|                        mask |= ( ATBIT_NP_H );          /* 28: -NH2, =NH, >NH */
  ------------------
  |  |  118|      0|#define ATBIT_NP_H       (1 << ATTOT_NUM_NP_H)
  ------------------
 3403|       |                                                         /*nAtTypeTotals[ATTOT_NUM_NP_H] ++;*/
 3404|      0|                    }
 3405|      0|                    else
 3406|      0|                    {
 3407|      0|                        if (bUnsatNHasTerminalO == 1)
  ------------------
  |  Branch (3407:29): [True: 0, False: 0]
  ------------------
 3408|      0|                        {
 3409|      0|                            mask |= ( ATBIT_ON );            /* 29: -N=O,-N=OH(+) only, not =N-OH */
  ------------------
  |  |  121|      0|#define ATBIT_ON         (1 << ATTOT_NUM_ON)
  ------------------
 3410|      0|                        }
 3411|      0|                        else
 3412|      0|                        {
 3413|      0|                            mask |= ( ATBIT_NP );            /* 30: -P=O,-P=OH(+), >N- =N- (incl. =N-OH) , #N */
  ------------------
  |  |  120|      0|#define ATBIT_NP         (1 << ATTOT_NUM_NP)
  ------------------
 3414|       |                                                             /*nAtTypeTotals[ATTOT_NUM_NP] ++;*/
 3415|      0|                        }
 3416|      0|                    }
 3417|      0|                    break; /* ignore neutral N or P */
 3418|      0|                case 1:
  ------------------
  |  Branch (3418:17): [True: 0, False: 0]
  ------------------
 3419|      0|                    if (at->num_H)
  ------------------
  |  Branch (3419:25): [True: 0, False: 0]
  ------------------
 3420|      0|                    {
 3421|      0|                        mask |= ( ATBIT_NP_Proton );       /* 31: NH4(+), -NH3(+), =NH2(+), >NH2(+), =NH(+)-, >NH(+)-, #NH(+) */
  ------------------
  |  |  117|      0|#define ATBIT_NP_Proton  (1 << ATTOT_NUM_NP_Proton)
  ------------------
 3422|       |                                                           /*nAtTypeTotals[ATTOT_NUM_NP_Proton] ++;*/
 3423|      0|                    }
 3424|      0|                    else
 3425|      0|                    {
 3426|      0|                        if (at->chem_bonds_valence > at->valence)
  ------------------
  |  Branch (3426:29): [True: 0, False: 0]
  ------------------
 3427|      0|                        {
 3428|      0|                            mask |= ( ATBIT_NP_Plus );         /* =N(+)=, #N(+)-, =N(+)< */
  ------------------
  |  |  116|      0|#define ATBIT_NP_Plus    (1 << ATTOT_NUM_NP_Plus)
  ------------------
 3429|       |                                                               /*nAtTypeTotals[ATTOT_NUM_NP_Plus] ++;*/
 3430|      0|                        }
 3431|      0|                        else
 3432|      0|                        {
 3433|      0|                            type = 0; /* 32: ignore onium cations >N(+)< */
 3434|      0|                        }
 3435|      0|                    }
 3436|      0|                    break;
 3437|      0|                default:
  ------------------
  |  Branch (3437:17): [True: 0, False: 0]
  ------------------
 3438|      0|                    mask |= ( 1 << ATTOT_NUM_Errors );
 3439|       |                    /*nAtTypeTotals[ATTOT_NUM_Errors] ++;*/
 3440|      0|                    break;
 3441|      0|            }
 3442|      0|        }
 3443|   110k|    }
 3444|       |
 3445|   110k|count_mask_bits:
 3446|   110k|    if (nAtTypeTotals)
  ------------------
  |  Branch (3446:9): [True: 110k, False: 148]
  ------------------
 3447|   110k|    {
 3448|   110k|        if (mask && !( mask & ( ATBIT_Errors ) ))
  ------------------
  |  |  148|     14|#define ATBIT_Errors     (1 << ATTOT_NUM_Errors)
  ------------------
  |  Branch (3448:13): [True: 14, False: 110k]
  |  Branch (3448:21): [True: 14, False: 0]
  ------------------
 3449|     14|        {
 3450|    476|            for (i = 0, bit = 1; i < ATTOT_ARRAY_LEN; i++, bit <<= 1)
  ------------------
  |  Branch (3450:34): [True: 462, False: 14]
  ------------------
 3451|    462|            {
 3452|    462|                if (bit & mask)
  ------------------
  |  Branch (3452:21): [True: 14, False: 448]
  ------------------
 3453|     14|                {
 3454|     14|                    nAtTypeTotals[i] += delta;
 3455|     14|                }
 3456|    462|            }
 3457|     14|        }
 3458|       |
 3459|       |        /* Count charges */
 3460|   110k|        if (at->charge)
  ------------------
  |  Branch (3460:13): [True: 27, False: 110k]
  ------------------
 3461|     27|        {
 3462|     27|            nAtTypeTotals[ATTOT_TOT_CHARGE] += delta * at->charge;
 3463|     27|            nAtTypeTotals[ATTOT_NUM_CHARGES] += delta;
 3464|     27|        }
 3465|   110k|    }
 3466|       |
 3467|   110k|    if (pMask)
  ------------------
  |  Branch (3467:9): [True: 110k, False: 0]
  ------------------
 3468|   110k|    {
 3469|   110k|        *pMask = mask;
 3470|   110k|    }
 3471|       |
 3472|   113k|exit_function:
 3473|   113k|    if (mask & ( ATBIT_Errors ))
  ------------------
  |  |  148|   113k|#define ATBIT_Errors     (1 << ATTOT_NUM_Errors)
  ------------------
  |  Branch (3473:9): [True: 0, False: 113k]
  ------------------
 3474|      0|    {
 3475|      0|        type = 0;
 3476|      0|        if (nAtTypeTotals)
  ------------------
  |  Branch (3476:13): [True: 0, False: 0]
  ------------------
 3477|      0|        {
 3478|      0|            nAtTypeTotals[ATTOT_NUM_Errors] += 1;
 3479|      0|        }
 3480|      0|    }
 3481|       |
 3482|       |
 3483|   113k|    return type;
 3484|   110k|}
CreateCGroupInBnStruct:
 3660|     20|{
 3661|     20|    int         k, c_point, cg, centerpoint, fictpoint, type, ret = 0;
 3662|     20|    int         num_cg = 1;
 3663|     20|    int         num_edges = pBNS->num_edges;
 3664|     20|    int         num_vertices = pBNS->num_vertices; /* new c-group bns-ID */
 3665|     20|    BNS_VERTEX *vert_ficpoint, *ver_ficpont_prev;  /* fictitious vertex describing charge c-group */
 3666|     20|    BNS_VERTEX *vertex_cpoint;
 3667|     20|    BNS_EDGE   *edge;      /* edge between that vertex and the tautomeric c_point */
 3668|     20|    int        mask, num_CPoints;
 3669|       |
 3670|       |    /* Debug: check overflow */
 3671|     20|    if (num_vertices + num_cg >= pBNS->max_vertices)
  ------------------
  |  Branch (3671:9): [True: 0, False: 20]
  ------------------
 3672|      0|    {
 3673|      0|        return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   82|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3674|      0|    }
 3675|       |
 3676|       |    /* Count new c-group edges */
 3677|    112|    for (c_point = 0, num_CPoints = 0; c_point < num_atoms; c_point++)
  ------------------
  |  Branch (3677:40): [True: 92, False: 20]
  ------------------
 3678|     92|    {
 3679|     92|        if (( nType & GetAtomChargeType( at, c_point, NULL, &mask, 0 ) ) && ( mask & nMask )
  ------------------
  |  Branch (3679:13): [True: 4, False: 88]
  |  Branch (3679:77): [True: 4, False: 0]
  ------------------
 3680|       |#if ( OPPOSITE_CHARGE_IN_CGROUP == 0 )
 3681|       |             && ( at[c_point].charge == nCharge || !at[c_point].charge )
 3682|       |#endif
 3683|     92|             )
 3684|      4|        {
 3685|      4|            num_CPoints++;
 3686|      4|        }
 3687|     92|    }
 3688|       |
 3689|     20|    if (!num_CPoints)
  ------------------
  |  Branch (3689:9): [True: 16, False: 4]
  ------------------
 3690|     16|    {
 3691|     16|        return 0;
 3692|     16|    }
 3693|       |
 3694|       |    /* Clear the new vertex */
 3695|      4|    memset( pBNS->vert + num_vertices, 0, 1 * sizeof( pBNS->vert[0] ) );
 3696|       |
 3697|       |    /* *old* Make sure the last t-group has the largest t-group ID:
 3698|       |    this is necessary to correctly add new edges and vertices for testing augmenting paths
 3699|       |    */
 3700|       |
 3701|       |    /**************************************/
 3702|       |    /* initialize new fictitious vertex   */
 3703|       |    /* representing c-point group         */
 3704|       |    /**************************************/
 3705|       |
 3706|      4|    ver_ficpont_prev = pBNS->vert + num_vertices - 1;
 3707|       |
 3708|      8|    for (cg = 0; cg < num_cg; cg++, ver_ficpont_prev = vert_ficpoint)
  ------------------
  |  Branch (3708:18): [True: 4, False: 4]
  ------------------
 3709|      4|    {
 3710|       |        /*
 3711|       |        vert_ficpoint-1 is the last vertex;
 3712|       |        vert_ficpoint   is the being added vertex
 3713|       |        Note: nGroupNumber are not contiguous
 3714|       |        */
 3715|      4|        vert_ficpoint = pBNS->vert + num_vertices + cg;
 3716|      4|        vert_ficpoint->iedge = ver_ficpont_prev->iedge + ver_ficpont_prev->max_adj_edges;
 3717|      4|        vert_ficpoint->max_adj_edges = num_CPoints + BNS_ADD_EDGES;
  ------------------
  |  |  117|      4|#define BNS_ADD_EDGES        1  /* max. number of edges to add to each atom (except edges to a t-group or c-group) */
  ------------------
 3718|      4|        vert_ficpoint->num_adj_edges = 0;
 3719|      4|        vert_ficpoint->st_edge.flow = vert_ficpoint->st_edge.flow0 = 0;
 3720|      4|        vert_ficpoint->st_edge.cap = vert_ficpoint->st_edge.cap0 = 0;
 3721|      4|        vert_ficpoint->type = BNS_VERT_TYPE_C_GROUP | ( ( nCharge < 0 ) ? BNS_VERT_TYPE_C_NEGATIVE : 0 );
  ------------------
  |  |   77|      4|#define BNS_VERT_TYPE_C_GROUP       0x0010
  ------------------
                      vert_ficpoint->type = BNS_VERT_TYPE_C_GROUP | ( ( nCharge < 0 ) ? BNS_VERT_TYPE_C_NEGATIVE : 0 );
  ------------------
  |  |   82|      4|#define BNS_VERT_TYPE_C_NEGATIVE    0x0100  /* negative charge group; attribute, should be used with BNS_VERT_TYPE_C_GROUP */
  ------------------
  |  Branch (3721:57): [True: 4, False: 0]
  ------------------
 3722|      4|    }
 3723|       |
 3724|       |    /************************************************/
 3725|       |    /* Connect c-points to the fictitious vertices  */
 3726|       |    /* representing c-point groups; set caps, flows */
 3727|       |    /************************************************/
 3728|      4|    cg = 1;
 3729|     24|    for (c_point = 0; c_point < num_atoms; c_point++)
  ------------------
  |  Branch (3729:23): [True: 20, False: 4]
  ------------------
 3730|     20|    {
 3731|     20|        if (( nType & ( type = GetAtomChargeType( at, c_point, NULL, &mask, 0 ) ) ) && ( mask & nMask )
  ------------------
  |  Branch (3731:13): [True: 4, False: 16]
  |  Branch (3731:88): [True: 4, False: 0]
  ------------------
 3732|       |#if ( OPPOSITE_CHARGE_IN_CGROUP == 0 )
 3733|       |             && ( at[c_point].charge == nCharge || !at[c_point].charge )
 3734|       |#endif
 3735|     20|             )
 3736|      4|        {
 3737|      4|            ;
 3738|      4|        }
 3739|     16|        else
 3740|     16|        {
 3741|     16|            continue;
 3742|     16|        }
 3743|       |
 3744|      4|        fictpoint = cg + num_vertices - 1; /* c-group vertex index */
 3745|      4|        vert_ficpoint = pBNS->vert + fictpoint; /* c-group vertex */
 3746|      4|        vertex_cpoint = pBNS->vert + c_point;   /* c_point vertex */
 3747|       |
 3748|       |                                                /* Debug: check overflow */
 3749|      4|        if (fictpoint >= pBNS->max_vertices ||
  ------------------
  |  Branch (3749:13): [True: 0, False: 4]
  ------------------
 3750|      4|             num_edges >= pBNS->max_edges ||
  ------------------
  |  Branch (3750:14): [True: 0, False: 4]
  ------------------
 3751|      4|             vert_ficpoint->num_adj_edges >= vert_ficpoint->max_adj_edges ||
  ------------------
  |  Branch (3751:14): [True: 0, False: 4]
  ------------------
 3752|      4|             vertex_cpoint->num_adj_edges >= vertex_cpoint->max_adj_edges)
  ------------------
  |  Branch (3752:14): [True: 0, False: 4]
  ------------------
 3753|      0|        {
 3754|      0|            ret = BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   82|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3755|      0|            break;
 3756|      0|        }
 3757|      4|        vertex_cpoint->type |= BNS_VERT_TYPE_C_POINT;
  ------------------
  |  |   76|      4|#define BNS_VERT_TYPE_C_POINT       0x0008
  ------------------
 3758|      4|        if (( KNOWN_ACIDIC_TYPE & type ) && nCharge < 0)
  ------------------
  |  |  164|      4|#define KNOWN_ACIDIC_TYPE   (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO)
  |  |  ------------------
  |  |  |  |   63|      4|#define ATT_ACIDIC_CO    0x0001
  |  |  ------------------
  |  |               #define KNOWN_ACIDIC_TYPE   (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO)
  |  |  ------------------
  |  |  |  |   64|      4|#define ATT_ACIDIC_S     0x0002
  |  |  ------------------
  |  |               #define KNOWN_ACIDIC_TYPE   (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO)
  |  |  ------------------
  |  |  |  |   65|      4|#define ATT_OO           0x0004
  |  |  ------------------
  |  |               #define KNOWN_ACIDIC_TYPE   (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO)
  |  |  ------------------
  |  |  |  |   66|      4|#define ATT_ZOO          0x0008
  |  |  ------------------
  |  |               #define KNOWN_ACIDIC_TYPE   (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO)
  |  |  ------------------
  |  |  |  |   67|      4|#define ATT_NO           0x0010
  |  |  ------------------
  ------------------
  |  Branch (3758:13): [True: 4, False: 0]
  |  Branch (3758:45): [True: 4, False: 0]
  ------------------
 3759|      4|        {
 3760|      4|            vertex_cpoint->type |= pBNS->type_TACN;
 3761|      4|        }
 3762|       |
 3763|       |#if ( FIX_CPOINT_BOND_CAP != 1 )  /* { */
 3764|       |        /* Set capacity = 1 to the edges from the c_point to the centerpoint(s)     */
 3765|       |        /* if their current capacity is zero                                        */
 3766|       |        /* the centerpoint is any adjacent atom that is adjacent to a multiple bond */
 3767|       |        for (k = 0; k < vertex_cpoint->num_adj_edges; k++)
 3768|       |        {
 3769|       |            int iedge = vertex_cpoint->iedge[k];
 3770|       |            if (!pBNS->edge[iedge].cap)
 3771|       |            {
 3772|       |                /* single bond, possibly between c_point and centerpoint */
 3773|       |                centerpoint = ( pBNS->edge[iedge].neighbor12 ^ c_point );
 3774|       |                if (centerpoint < pBNS->num_atoms &&
 3775|       |                     pBNS->vert[centerpoint].st_edge.cap >= 1)
 3776|       |                {
 3777|       |                    int bond_type = ( at[c_point].bond_type[k] & BOND_TYPE_MASK );
 3778|       |                    if (bond_type == BOND_TAUTOM ||
 3779|       |                         bond_type == BOND_ALTERN ||
 3780|       |                         bond_type == BOND_SINGLE)
 3781|       |                    {
 3782|       |                        pBNS->edge[iedge].cap = 1;
 3783|       |                    }
 3784|       |                }
 3785|       |            }
 3786|       |        }
 3787|       |#endif /* } FIX_CPOINT_BOND_CAP */
 3788|       |
 3789|       |        /* Create a new edge connecting c_point to the new fictitious c-group vertex vert_ficpoint */
 3790|      4|        edge = pBNS->edge + num_edges;
 3791|      4|        edge->cap = 1;
 3792|      4|        edge->flow = 0;
 3793|      4|        edge->pass = 0;
 3794|      4|#if ( RESET_EDGE_FORBIDDEN_MASK == 1 )
 3795|      4|        edge->forbidden &= pBNS->edge_forbidden_mask; /* remove previous temporary ban */
 3796|      4|#endif
 3797|       |
 3798|       |                                                      /* nCharge = +1: mark edge to c-point having no (+)-moveable charge with flow=1 */
 3799|       |                                                      /* nCharge = -1: mark edge to c-point having -1 moveable charge with flow=1 */
 3800|       |
 3801|      4|        if (nCharge == 1 && at[c_point].charge != 1 || nCharge == -1 && at[c_point].charge == -1)
  ------------------
  |  Branch (3801:13): [True: 0, False: 4]
  |  Branch (3801:29): [True: 0, False: 0]
  |  Branch (3801:56): [True: 4, False: 0]
  |  Branch (3801:73): [True: 0, False: 4]
  ------------------
 3802|       |            /*if ( !CHARGED_CPOINT(at,c_point) )*/
 3803|      0|        {
 3804|       |            /* Increment new edge flow, update st_edges of the adjacent vertices */
 3805|      0|            edge->flow++;
 3806|       |            /* Increment c-group vertex st-flow & cap */
 3807|      0|            vert_ficpoint->st_edge.flow++;
 3808|      0|            vert_ficpoint->st_edge.cap++;
 3809|       |            /* Increment c-point vertex st-flow & cap */
 3810|      0|            vertex_cpoint->st_edge.flow++;
 3811|      0|            vertex_cpoint->st_edge.cap++;
 3812|      0|        }
 3813|       |
 3814|      4|#if ( FIX_CPOINT_BOND_CAP == 1 ) /* { */
 3815|       |        /* Set capacity = 1 to the edges from the c_point to the centerpoint(s)     */
 3816|       |        /* if their current capacity is zero                                        */
 3817|       |        /* the centerpoint is any adjacent atom that is adjacent to a multiple bond */
 3818|      8|        for (k = 0; k < vertex_cpoint->num_adj_edges; k++)
  ------------------
  |  Branch (3818:21): [True: 4, False: 4]
  ------------------
 3819|      4|        {
 3820|      4|            int iedge = vertex_cpoint->iedge[k];
 3821|      4|            VertexFlow  nNewCap = vertex_cpoint->st_edge.cap;
 3822|      4|            centerpoint = ( pBNS->edge[iedge].neighbor12 ^ c_point );
 3823|      4|            if (!pBNS->edge[iedge].cap)
  ------------------
  |  Branch (3823:17): [True: 4, False: 0]
  ------------------
 3824|      4|            {
 3825|       |                /* Single bond, possibly between c_point and centerpoint */
 3826|      4|                if (centerpoint < pBNS->num_atoms &&
  ------------------
  |  Branch (3826:21): [True: 4, False: 0]
  ------------------
 3827|      4|                     pBNS->vert[centerpoint].st_edge.cap >= 1)
  ------------------
  |  Branch (3827:22): [True: 0, False: 4]
  ------------------
 3828|      0|                {
 3829|      0|                    nNewCap = inchi_min( pBNS->vert[centerpoint].st_edge.cap, nNewCap );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3830|      0|                    nNewCap = inchi_min( nNewCap, MAX_BOND_EDGE_CAP );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3831|      0|                    pBNS->edge[iedge].cap = nNewCap;
 3832|      0|                }
 3833|      4|            }
 3834|       |#if ( FIX_CPOINT_BOND_CAP2 == 1 ) /* multiple bond */
 3835|       |            else
 3836|       |            {
 3837|       |                if (centerpoint < pBNS->num_atoms &&
 3838|       |                     edge->flow && pBNS->edge[iedge].cap < MAX_BOND_EDGE_CAP)
 3839|       |                {
 3840|       |                    pBNS->edge[iedge].cap++;
 3841|       |                }
 3842|       |            }
 3843|       |#endif
 3844|      4|        }
 3845|      4|#endif  /* } FIX_CPOINT_BOND_CAP */
 3846|       |
 3847|       |        /* Connect edge to c_point and fictpoint and increment the counters of neighbors and edges */
 3848|      4|        edge->neighbor1 = c_point; /* the smallest out of v1=endopoint and v2=num_vertices */
 3849|      4|        edge->neighbor12 = c_point ^ fictpoint; /* v1 ^ v2 */
 3850|      4|        vertex_cpoint->iedge[vertex_cpoint->num_adj_edges] = num_edges;
 3851|      4|        vert_ficpoint->iedge[vert_ficpoint->num_adj_edges] = num_edges++;
 3852|      4|        edge->neigh_ord[0] = vertex_cpoint->num_adj_edges++;
 3853|      4|        edge->neigh_ord[1] = vert_ficpoint->num_adj_edges++;
 3854|      4|        edge->cap0 = edge->cap;
 3855|      4|        edge->flow0 = edge->flow;
 3856|      4|    }
 3857|       |
 3858|      4|    ret = pBNS->num_vertices; /* new c-group atom number */
 3859|      4|    pBNS->num_edges = num_edges;
 3860|      4|    pBNS->num_vertices += num_cg;
 3861|      4|    pBNS->num_c_groups += num_cg;
 3862|       |
 3863|      4|    return ret;
 3864|     20|}
CreateTGroupInBnStruct:
 3873|      8|{
 3874|      8|    int ret = 0;
 3875|       |    /* ret = ReInitBnStruct( pBNS ); */
 3876|      8|    int         k, endpoint, tg, centerpoint, fictpoint;
 3877|      8|    int         num_tg = 1;
 3878|      8|    int         num_edges = pBNS->num_edges;
 3879|      8|    int         num_vertices = pBNS->num_vertices;
 3880|      8|    BNS_VERTEX *vert_ficpoint, *ver_ficpont_prev;  /* fictitious vertex describing t-group */
 3881|      8|    BNS_VERTEX *vert_endpoint;
 3882|      8|    BNS_EDGE   *edge;      /* edge between that vertex and the tautomeric endpoint */
 3883|      8|    int        mask, num_endpoints, neutral_valence, edge_flow, edge_cap, num_bonds;
 3884|       |
 3885|       |    /* Debug: check overflow */
 3886|      8|    if (num_vertices + num_tg >= pBNS->max_vertices)
  ------------------
  |  Branch (3886:9): [True: 0, False: 8]
  ------------------
 3887|      0|    {
 3888|      0|        return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   82|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3889|      0|    }
 3890|       |
 3891|       |    /* Count new t-group edges */
 3892|     40|    for (endpoint = 0, num_endpoints = 0; endpoint < num_atoms; endpoint++)
  ------------------
  |  Branch (3892:43): [True: 32, False: 8]
  ------------------
 3893|     32|    {
 3894|     32|        if (( nType & GetAtomChargeType( at, endpoint, NULL, &mask, 0 ) ) && ( mask & nMask )
  ------------------
  |  Branch (3894:13): [True: 4, False: 28]
  |  Branch (3894:78): [True: 4, False: 0]
  ------------------
 3895|     32|             )
 3896|      4|        {
 3897|      4|            num_endpoints++;
 3898|      4|        }
 3899|     32|    }
 3900|       |
 3901|      8|    if (!num_endpoints)
  ------------------
  |  Branch (3901:9): [True: 4, False: 4]
  ------------------
 3902|      4|    {
 3903|      4|        return 0;
 3904|      4|    }
 3905|       |
 3906|       |    /* Since t-group IDs may be not contiguous, clear all vertices that will be added.
 3907|       |    all-zeroes-vertex will be ignored by the BNS
 3908|       |    */
 3909|      4|    memset( pBNS->vert + num_vertices, 0, num_tg * sizeof( pBNS->vert[0] ) );
 3910|       |
 3911|       |    /* *old* Make sure the last t-group has the largest t-group ID:
 3912|       |    this is necessary to correctly add new edges and vertices for testing augmenting paths
 3913|       |    */
 3914|       |
 3915|       |    /**************************************/
 3916|       |    /* Initialize new fictitious vertex   */
 3917|       |    /* representing t-point group         */
 3918|       |    /**************************************/
 3919|      4|    ver_ficpont_prev = pBNS->vert + num_vertices - 1;
 3920|       |
 3921|      8|    for (tg = 0; tg < num_tg; tg++, ver_ficpont_prev = vert_ficpoint)
  ------------------
  |  Branch (3921:18): [True: 4, False: 4]
  ------------------
 3922|      4|    {
 3923|       |        /*
 3924|       |        vert_ficpoint-1 is the last vertex;
 3925|       |        vert_ficpoint   is the vertex that is being added
 3926|       |        Note: nGroupNumber are not contiguous
 3927|       |        */
 3928|      4|        vert_ficpoint = pBNS->vert + num_vertices + tg;
 3929|      4|        vert_ficpoint->iedge = ver_ficpont_prev->iedge + ver_ficpont_prev->max_adj_edges;
 3930|      4|        vert_ficpoint->max_adj_edges = num_endpoints + BNS_ADD_EDGES + BNS_ADD_SUPER_TGROUP;
  ------------------
  |  |  117|      4|#define BNS_ADD_EDGES        1  /* max. number of edges to add to each atom (except edges to a t-group or c-group) */
  ------------------
                      vert_ficpoint->max_adj_edges = num_endpoints + BNS_ADD_EDGES + BNS_ADD_SUPER_TGROUP;
  ------------------
  |  |  113|      4|#define BNS_ADD_SUPER_TGROUP 1  /* reserve one more edge for a t-group to connect to a single super-t-group */
  ------------------
 3931|      4|        vert_ficpoint->num_adj_edges = 0;
 3932|      4|        vert_ficpoint->st_edge.flow = vert_ficpoint->st_edge.flow0 = 0;
 3933|      4|        vert_ficpoint->st_edge.cap = vert_ficpoint->st_edge.cap0 = 0;
 3934|      4|        vert_ficpoint->type |= BNS_VERT_TYPE_TGROUP;
  ------------------
  |  |   75|      4|#define BNS_VERT_TYPE_TGROUP        0x0004
  ------------------
 3935|      4|    }
 3936|       |
 3937|      4|    tg = 1;
 3938|     24|    for (endpoint = 0; endpoint < num_atoms; endpoint++)
  ------------------
  |  Branch (3938:24): [True: 20, False: 4]
  ------------------
 3939|     20|    {
 3940|     20|        if (( nType & GetAtomChargeType( at, endpoint, NULL, &mask, 0 ) ) && ( mask & nMask ))
  ------------------
  |  Branch (3940:13): [True: 4, False: 16]
  |  Branch (3940:78): [True: 4, False: 0]
  ------------------
 3941|      4|        {
 3942|      4|            ;
 3943|      4|        }
 3944|     16|        else
 3945|     16|        {
 3946|     16|            continue;
 3947|     16|        }
 3948|      4|        fictpoint = tg + num_vertices - 1;
 3949|      4|        vert_ficpoint = pBNS->vert + fictpoint;
 3950|      4|        vert_endpoint = pBNS->vert + endpoint;
 3951|       |        /* Debug: check overflow */
 3952|      4|        if (fictpoint >= pBNS->max_vertices ||
  ------------------
  |  Branch (3952:13): [True: 0, False: 4]
  ------------------
 3953|      4|             num_edges >= pBNS->max_edges ||
  ------------------
  |  Branch (3953:14): [True: 0, False: 4]
  ------------------
 3954|      4|             vert_ficpoint->num_adj_edges >= vert_ficpoint->max_adj_edges ||
  ------------------
  |  Branch (3954:14): [True: 0, False: 4]
  ------------------
 3955|      4|             vert_endpoint->num_adj_edges >= vert_endpoint->max_adj_edges)
  ------------------
  |  Branch (3955:14): [True: 0, False: 4]
  ------------------
 3956|      0|        {
 3957|      0|            ret = BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   82|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3958|      0|            break;
 3959|      0|        }
 3960|       |
 3961|       |        /* Obtain donor/acceptor info */
 3962|      4|        neutral_valence = at[endpoint].chem_bonds_valence + at[endpoint].num_H - at[endpoint].charge;
 3963|      4|        if (neutral_valence != 2 /* O, S, Se, Te */ &&
  ------------------
  |  Branch (3963:13): [True: 0, False: 4]
  ------------------
 3964|      4|             neutral_valence != 3 /* N, P */)
  ------------------
  |  Branch (3964:14): [True: 0, False: 0]
  ------------------
 3965|      0|        {
 3966|      0|            ret = BNS_PROGRAM_ERR; /* wrong endpoint neutral valence */
  ------------------
  |  |   78|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3967|      0|            break;
 3968|      0|        }
 3969|      4|        edge_flow = at[endpoint].num_H;
 3970|      4|        num_bonds = at[endpoint].valence;
 3971|      4|        edge_cap = neutral_valence - num_bonds; /* does not allow to reduce -NH3(+) to #N or -OH(+)- to -O- */
 3972|       |
 3973|      4|        if (3 == neutral_valence /* N or P */ && 1 < num_bonds)
  ------------------
  |  Branch (3973:13): [True: 0, False: 4]
  |  Branch (3973:50): [True: 0, False: 0]
  ------------------
 3974|      0|        {
 3975|      0|            edge_cap++; /* allow -NH2(+)- => -N=, >NH(+)- => >N- */
 3976|      0|        }
 3977|      4|        edge_flow = inchi_min( edge_flow, edge_cap );
  ------------------
  |  |  167|      4|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 4]
  |  |  ------------------
  ------------------
 3978|       |        /*
 3979|       |        if ( !nGetEndpointInfo( at, endpoint, &eif ) ) {
 3980|       |        ret = BNS_BOND_ERR;
 3981|       |        break;
 3982|       |        }
 3983|       |        */
 3984|      4|        vert_endpoint->type |= BNS_VERT_TYPE_ENDPOINT;
  ------------------
  |  |   74|      4|#define BNS_VERT_TYPE_ENDPOINT      0x0002  /* attribute */
  ------------------
 3985|       |
 3986|       |        /* Create a new edge connecting endpoint to the new fictitious t-group vertex vert_ficpoint */
 3987|      4|        edge = pBNS->edge + num_edges;
 3988|      4|        edge->cap = edge_cap;
 3989|      4|        edge->flow = edge_flow;
 3990|      4|        edge->pass = 0;
 3991|      4|#if ( RESET_EDGE_FORBIDDEN_MASK == 1 )
 3992|      4|        edge->forbidden &= pBNS->edge_forbidden_mask;
 3993|      4|#endif
 3994|       |
 3995|       |        /* Adjust st_flow and st_cap of the adjacent vertices */
 3996|       |        /* Adjust t-group vertex st-flow & cap */
 3997|      4|        vert_ficpoint->st_edge.flow += edge->flow;
 3998|      4|        vert_ficpoint->st_edge.cap += edge->flow;
 3999|       |        /* adjust endpoint vertex st-flow & cap */
 4000|      4|        vert_endpoint->st_edge.flow += edge->flow;
 4001|      4|        vert_endpoint->st_edge.cap += edge->flow;
 4002|       |
 4003|       |        /* Adjust edge cap & flow according to the number of H and number of bonds */
 4004|     12|        for (k = 0; k < vert_endpoint->num_adj_edges; k++)
  ------------------
  |  Branch (4004:21): [True: 8, False: 4]
  ------------------
 4005|      8|        {
 4006|      8|            int iedge = vert_endpoint->iedge[k];
 4007|      8|            VertexFlow  nNewCap = vert_endpoint->st_edge.cap;
 4008|      8|            if (!pBNS->edge[iedge].cap)
  ------------------
  |  Branch (4008:17): [True: 4, False: 4]
  ------------------
 4009|      4|            {
 4010|       |                /* single bond, possibly between endpoint and centerpoint */
 4011|      4|                centerpoint = ( pBNS->edge[iedge].neighbor12 ^ endpoint );
 4012|      4|                if (centerpoint < pBNS->num_atoms &&
  ------------------
  |  Branch (4012:21): [True: 4, False: 0]
  ------------------
 4013|      4|                     pBNS->vert[centerpoint].st_edge.cap >= 1)
  ------------------
  |  Branch (4013:22): [True: 0, False: 4]
  ------------------
 4014|      0|                {
 4015|      0|                    nNewCap = inchi_min( pBNS->vert[centerpoint].st_edge.cap, nNewCap );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4016|      0|                    nNewCap = inchi_min( nNewCap, MAX_BOND_EDGE_CAP );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4017|      0|                    pBNS->edge[iedge].cap = nNewCap;
 4018|      0|                }
 4019|      4|            }
 4020|      8|        }
 4021|       |
 4022|       |        /* Connect edge to endpoint and fictpoint and increment the counters of neighbors and edges */
 4023|      4|        edge->neighbor1 = endpoint; /* the smallest out of v1=endopoint and v2=num_vertices */
 4024|      4|        edge->neighbor12 = endpoint ^ fictpoint; /* v1 ^ v2 */
 4025|      4|        vert_endpoint->iedge[vert_endpoint->num_adj_edges] = num_edges;
 4026|      4|        vert_ficpoint->iedge[vert_ficpoint->num_adj_edges] = num_edges++;
 4027|      4|        edge->neigh_ord[0] = vert_endpoint->num_adj_edges++;
 4028|      4|        edge->neigh_ord[1] = vert_ficpoint->num_adj_edges++;
 4029|      4|        edge->cap0 = edge->cap;
 4030|      4|        edge->flow0 = edge->flow;
 4031|      4|    }
 4032|       |
 4033|      4|    ret = pBNS->num_vertices; /* new t-group atom number */
 4034|      4|    pBNS->num_edges = num_edges;
 4035|      4|    pBNS->num_vertices += num_tg;
 4036|      4|    pBNS->num_t_groups += num_tg;
 4037|       |
 4038|      4|    return ret;
 4039|      8|}
RemoveLastGroupFromBnStruct:
 4047|      8|{
 4048|      8|    int ret = 0;
 4049|       |    /* ret = ReInitBnStruct( pBNS ); */
 4050|      8|    int         k, endpoint, /*centerpoint, fictpoint,*/ iedge;
 4051|      8|    int         num_edges = pBNS->num_edges;
 4052|      8|    int         num_vertices = pBNS->num_vertices;
 4053|      8|    BNS_VERTEX *vert_ficpoint /*, *ver_ficpont_prev*/;  /* fictitious vertex describing t-group */
 4054|      8|    BNS_VERTEX *vert_endpoint;
 4055|      8|    BNS_EDGE   *edge;      /* edge between that vertex and the tautomeric endpoint */
 4056|       |                           /*int        mask, num_endpoints, neutral_valence, edge_flow, edge_cap, num_bonds;*/
 4057|      8|    int        is_t_group = 0, is_c_group = 0;
 4058|       |
 4059|       |    /* Debug: check overflow */
 4060|      8|    if (pBNS->num_added_atoms + pBNS->num_c_groups + pBNS->num_t_groups + num_atoms >= pBNS->max_vertices)
  ------------------
  |  Branch (4060:9): [True: 0, False: 8]
  ------------------
 4061|      0|    {
 4062|      0|        return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   82|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 4063|      0|    }
 4064|       |
 4065|      8|    if (tg + 1 != num_vertices)
  ------------------
  |  Branch (4065:9): [True: 0, False: 8]
  ------------------
 4066|      0|    {
 4067|      0|        return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   82|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 4068|      0|    }
 4069|       |
 4070|      8|    vert_ficpoint = pBNS->vert + tg;
 4071|       |
 4072|      8|    if (vert_ficpoint->type & BNS_VERT_TYPE_TGROUP)
  ------------------
  |  |   75|      8|#define BNS_VERT_TYPE_TGROUP        0x0004
  ------------------
  |  Branch (4072:9): [True: 4, False: 4]
  ------------------
 4073|      4|    {
 4074|      4|        is_t_group = 1;
 4075|      4|    }
 4076|      8|    if (vert_ficpoint->type & BNS_VERT_TYPE_C_GROUP)
  ------------------
  |  |   77|      8|#define BNS_VERT_TYPE_C_GROUP       0x0010
  ------------------
  |  Branch (4076:9): [True: 4, False: 4]
  ------------------
 4077|      4|    {
 4078|      4|        is_c_group = 1;
 4079|      4|        if (vert_ficpoint->type & BNS_VERT_TYPE_C_NEGATIVE)
  ------------------
  |  |   82|      4|#define BNS_VERT_TYPE_C_NEGATIVE    0x0100  /* negative charge group; attribute, should be used with BNS_VERT_TYPE_C_GROUP */
  ------------------
  |  Branch (4079:13): [True: 4, False: 0]
  ------------------
 4080|      4|        {
 4081|      4|            is_c_group = 2;
 4082|      4|        }
 4083|      4|    }
 4084|       |
 4085|     16|    for (k = vert_ficpoint->num_adj_edges - 1; 0 <= k; k--)
  ------------------
  |  Branch (4085:48): [True: 8, False: 8]
  ------------------
 4086|      8|    {
 4087|      8|        iedge = vert_ficpoint->iedge[k];
 4088|      8|        if (iedge + 1 != num_edges)
  ------------------
  |  Branch (4088:13): [True: 0, False: 8]
  ------------------
 4089|      0|        {
 4090|      0|            return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   82|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 4091|      0|        }
 4092|      8|        edge = pBNS->edge + iedge;
 4093|      8|        endpoint = edge->neighbor12 ^ tg;
 4094|      8|        vert_endpoint = pBNS->vert + endpoint;
 4095|       |        /* adjust st_flow, st_cap */
 4096|      8|        vert_endpoint->st_edge.cap0 =
 4097|      8|            vert_endpoint->st_edge.cap -= edge->flow;
 4098|      8|        vert_endpoint->st_edge.flow0 =
 4099|      8|            vert_endpoint->st_edge.flow -= edge->flow;
 4100|      8|        if (pBNS->type_TACN && ( vert_endpoint->type & pBNS->type_TACN ) == pBNS->type_TACN)
  ------------------
  |  Branch (4100:13): [True: 8, False: 0]
  |  Branch (4100:32): [True: 4, False: 4]
  ------------------
 4101|      4|        {
 4102|      4|            vert_endpoint->type ^= pBNS->type_TACN;
 4103|      4|        }
 4104|      8|        if (is_t_group)
  ------------------
  |  Branch (4104:13): [True: 4, False: 4]
  ------------------
 4105|      4|        {
 4106|      4|            vert_endpoint->type ^= ( vert_ficpoint->type & BNS_VERT_TYPE_ENDPOINT );
  ------------------
  |  |   74|      4|#define BNS_VERT_TYPE_ENDPOINT      0x0002  /* attribute */
  ------------------
 4107|      4|        }
 4108|      8|        if (is_c_group)
  ------------------
  |  Branch (4108:13): [True: 4, False: 4]
  ------------------
 4109|      4|        {
 4110|      4|            vert_endpoint->type ^= ( vert_ficpoint->type & BNS_VERT_TYPE_C_POINT );
  ------------------
  |  |   76|      4|#define BNS_VERT_TYPE_C_POINT       0x0008
  ------------------
 4111|      4|        }
 4112|       |        /* Remove edge */
 4113|      8|        if (edge->neigh_ord[0] + 1 != vert_endpoint->num_adj_edges)
  ------------------
  |  Branch (4113:13): [True: 0, False: 8]
  ------------------
 4114|      0|        {
 4115|      0|            return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   82|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 4116|      0|        }
 4117|      8|        vert_endpoint->num_adj_edges--;
 4118|      8|        memset( edge, 0, sizeof( *edge ) );
 4119|      8|        num_edges--;
 4120|      8|        if (1 == is_t_group && endpoint < num_atoms)
  ------------------
  |  Branch (4120:13): [True: 4, False: 4]
  |  Branch (4120:32): [True: 4, False: 0]
  ------------------
 4121|      4|        {
 4122|      4|            at->endpoint = 0;
 4123|      4|        }
 4124|      8|        if (1 == is_c_group && endpoint < num_atoms)
  ------------------
  |  Branch (4124:13): [True: 0, False: 8]
  |  Branch (4124:32): [True: 0, False: 0]
  ------------------
 4125|      0|        {
 4126|      0|            at->c_point = 0;
 4127|      0|        }
 4128|      8|    }
 4129|      8|    memset( vert_ficpoint, 0, sizeof( *vert_ficpoint ) );
 4130|      8|    num_vertices--;
 4131|       |
 4132|      8|    pBNS->num_edges = num_edges;
 4133|      8|    pBNS->num_vertices = num_vertices;
 4134|      8|    if (is_t_group)
  ------------------
  |  Branch (4134:9): [True: 4, False: 4]
  ------------------
 4135|      4|    {
 4136|      4|        pBNS->num_t_groups--;
 4137|      4|    }
 4138|      8|    if (is_c_group)
  ------------------
  |  Branch (4138:9): [True: 4, False: 4]
  ------------------
 4139|      4|    {
 4140|      4|        pBNS->num_c_groups--;
 4141|      4|    }
 4142|       |
 4143|      8|    return ret;
 4144|      8|}
SetInitCapFlowToCurrent:
 4150|      4|{
 4151|      4|    int       i, j;
 4152|      4|    BNS_EDGE *pEdge = NULL;
 4153|     24|    for (i = 0; i < pBNS->num_vertices; i++)
  ------------------
  |  Branch (4153:17): [True: 20, False: 4]
  ------------------
 4154|     20|    {
 4155|     20|        pBNS->vert[i].st_edge.flow0 = pBNS->vert[i].st_edge.flow;
 4156|     20|        pBNS->vert[i].st_edge.cap0 = pBNS->vert[i].st_edge.cap;
 4157|     52|        for (j = 0; j < pBNS->vert[i].num_adj_edges; j++)
  ------------------
  |  Branch (4157:21): [True: 32, False: 20]
  ------------------
 4158|     32|        {
 4159|     32|            pEdge = pBNS->edge + pBNS->vert[i].iedge[j];
 4160|     32|            pEdge->cap0 = pEdge->cap;
 4161|     32|            pEdge->flow0 = pEdge->flow;
 4162|     32|        }
 4163|     20|    }
 4164|       |
 4165|      4|    return 0;
 4166|      4|}
SimpleRemoveAcidicProtons:
 4188|      1|{
 4189|      1|    int i, j, max_j = -1, mask, type, num_removed;
 4190|      1|    int num[AR_SIMPLE_STEPS + 1], num_tot;
 4191|       |
 4192|      2|    for (j = 0; ArTypMask[2 * j]; j++)
  ------------------
  |  Branch (4192:17): [True: 1, False: 1]
  ------------------
 4193|      1|    {
 4194|      1|        num[max_j = j] = 0;
 4195|      1|    }
 4196|       |
 4197|      2|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (4197:17): [True: 1, False: 1]
  ------------------
 4198|      1|    {
 4199|      1|        if (!at[i].charge && at[i].num_H && ( type = GetAtomChargeType( at, i, NULL, &mask, 0 ) ))
  ------------------
  |  Branch (4199:13): [True: 0, False: 1]
  |  Branch (4199:30): [True: 0, False: 0]
  |  Branch (4199:45): [True: 0, False: 0]
  ------------------
 4200|      0|        {
 4201|      0|            for (j = 0; j <= max_j; j++)
  ------------------
  |  Branch (4201:25): [True: 0, False: 0]
  ------------------
 4202|      0|            {
 4203|      0|                if (( type & ArTypMask[2 * j] ) && ( mask && ArTypMask[2 * j + 1] ))
  ------------------
  |  Branch (4203:21): [True: 0, False: 0]
  |  Branch (4203:54): [True: 0, False: 0]
  |  Branch (4203:62): [True: 0, False: 0]
  ------------------
 4204|      0|                {
 4205|      0|                    num[j]  ++;
 4206|      0|                    break;
 4207|      0|                }
 4208|      0|            }
 4209|      0|        }
 4210|      1|    }
 4211|      2|    for (j = 0, num_tot = 0; j <= max_j; j++)
  ------------------
  |  Branch (4211:30): [True: 1, False: 1]
  ------------------
 4212|      1|    {
 4213|      1|        if (( num_tot += num[j] ) >= num2remove)
  ------------------
  |  Branch (4213:13): [True: 0, False: 1]
  ------------------
 4214|      0|        {
 4215|      0|            max_j = j;
 4216|      0|            break;
 4217|      0|        }
 4218|      1|    }
 4219|      1|    if (!num_tot)
  ------------------
  |  Branch (4219:9): [True: 1, False: 0]
  ------------------
 4220|      1|    {
 4221|      1|        return 0;
 4222|      1|    }
 4223|      0|    for (i = 0, num_removed = 0; i < num_atoms && num_removed < num2remove; i++)
  ------------------
  |  Branch (4223:34): [True: 0, False: 0]
  |  Branch (4223:51): [True: 0, False: 0]
  ------------------
 4224|      0|    {
 4225|      0|        if (!at[i].charge && at[i].num_H && ( type = GetAtomChargeType( at, i, NULL, &mask, 0 ) ))
  ------------------
  |  Branch (4225:13): [True: 0, False: 0]
  |  Branch (4225:30): [True: 0, False: 0]
  |  Branch (4225:45): [True: 0, False: 0]
  ------------------
 4226|      0|        {
 4227|      0|            for (j = 0; j <= max_j; j++)
  ------------------
  |  Branch (4227:25): [True: 0, False: 0]
  ------------------
 4228|      0|            {
 4229|      0|                if (num[j] && ( type & ArTypMask[2 * j] ) && ( mask && ArTypMask[2 * j + 1] ))
  ------------------
  |  Branch (4229:21): [True: 0, False: 0]
  |  Branch (4229:31): [True: 0, False: 0]
  |  Branch (4229:64): [True: 0, False: 0]
  |  Branch (4229:72): [True: 0, False: 0]
  ------------------
 4230|      0|                {
 4231|      0|                    type = GetAtomChargeType( at, i, pAATG->nAtTypeTotals, &mask, 1 ); /* subtract at[i] */
 4232|      0|                    num[j]  --;
 4233|      0|                    at[i].charge--;
 4234|      0|                    AddOrRemoveExplOrImplH( -1, at, num_atoms, (AT_NUMB) i, pAATG->t_group_info );
 4235|       |                    /*at[i].num_H  --;*/
 4236|      0|                    num_removed++;
 4237|      0|                    type = GetAtomChargeType( at, i, pAATG->nAtTypeTotals, &mask, 0 ); /* add changed at[i] */ /* ! THIS CHANGES pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] */
 4238|      0|                    break;
 4239|      0|                }
 4240|      0|            }
 4241|      0|        }
 4242|      0|    }
 4243|       |
 4244|       |    /*
 4245|       |    pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE]  -= num_removed;
 4246|       |    pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] += num_removed;
 4247|       |    */
 4248|       |
 4249|      0|    return num_removed;
 4250|      1|}
bHasAcidicHydrogen:
 4255|   112k|{
 4256|   112k|    int bFound = 0, j, type, mask;
 4257|   112k|    if (!at[i].charge && at[i].num_H && ( type = GetAtomChargeType( at, i, NULL, &mask, 0 ) ))
  ------------------
  |  Branch (4257:9): [True: 112k, False: 15]
  |  Branch (4257:26): [True: 4, False: 112k]
  |  Branch (4257:41): [True: 4, False: 0]
  ------------------
 4258|      4|    {
 4259|      4|        for (j = 0; ArTypMask[2 * j]; j++)
  ------------------
  |  Branch (4259:21): [True: 4, False: 0]
  ------------------
 4260|      4|        {
 4261|      4|            if (( type & ArTypMask[2 * j] ) && ( mask & ArTypMask[2 * j + 1] ))
  ------------------
  |  Branch (4261:17): [True: 4, False: 0]
  |  Branch (4261:48): [True: 4, False: 0]
  ------------------
 4262|      4|            {
 4263|      4|                bFound++;
 4264|      4|                break;
 4265|      4|            }
 4266|      4|        }
 4267|      4|    }
 4268|       |
 4269|   112k|    return bFound;
 4270|   112k|}
SimpleAddAcidicProtons:
 4311|      6|{
 4312|      6|    int i, j, max_j = -1, mask, type, num_added;
 4313|      6|    int num[AR_SIMPLE_STEPS + 1], num_tot;
 4314|       |
 4315|     18|    for (j = 0; AaTypMask[2 * j]; j++)
  ------------------
  |  Branch (4315:17): [True: 12, False: 6]
  ------------------
 4316|     12|    {
 4317|     12|        num[max_j = j] = 0;
 4318|     12|    }
 4319|       |
 4320|     36|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (4320:17): [True: 30, False: 6]
  ------------------
 4321|     30|    {
 4322|     30|        if (at[i].charge == -1 && ( type = GetAtomChargeType( at, i, NULL, &mask, 0 ) ))
  ------------------
  |  Branch (4322:13): [True: 20, False: 10]
  |  Branch (4322:35): [True: 4, False: 16]
  ------------------
 4323|      4|        {
 4324|      4|            for (j = 0; j <= max_j; j++)
  ------------------
  |  Branch (4324:25): [True: 4, False: 0]
  ------------------
 4325|      4|            {
 4326|      4|                if (( type & AaTypMask[2 * j] ) && ( mask && AaTypMask[2 * j + 1] ))
  ------------------
  |  Branch (4326:21): [True: 4, False: 0]
  |  Branch (4326:54): [True: 4, False: 0]
  |  Branch (4326:62): [True: 4, False: 0]
  ------------------
 4327|      4|                {
 4328|      4|                    num[j]  ++;
 4329|      4|                    break;
 4330|      4|                }
 4331|      4|            }
 4332|      4|        }
 4333|     30|    }
 4334|     18|    for (j = 0, num_tot = 0; j <= max_j; j++)
  ------------------
  |  Branch (4334:30): [True: 12, False: 6]
  ------------------
 4335|     12|    {
 4336|     12|        if (( num_tot += num[j] ) >= num2add)
  ------------------
  |  Branch (4336:13): [True: 0, False: 12]
  ------------------
 4337|      0|        {
 4338|      0|            max_j = j;
 4339|      0|            break;
 4340|      0|        }
 4341|     12|    }
 4342|      6|    if (!num_tot)
  ------------------
  |  Branch (4342:9): [True: 2, False: 4]
  ------------------
 4343|      2|    {
 4344|      2|        return 0;
 4345|      2|    }
 4346|     24|    for (i = 0, num_added = 0; i < num_atoms && num_added < num2add; i++)
  ------------------
  |  Branch (4346:32): [True: 20, False: 4]
  |  Branch (4346:49): [True: 20, False: 0]
  ------------------
 4347|     20|    {
 4348|     20|        if (at[i].charge == -1 && ( type = GetAtomChargeType( at, i, NULL, &mask, 0 ) ))
  ------------------
  |  Branch (4348:13): [True: 14, False: 6]
  |  Branch (4348:35): [True: 4, False: 10]
  ------------------
 4349|      4|        {
 4350|      4|            for (j = 0; j <= max_j; j++)
  ------------------
  |  Branch (4350:25): [True: 4, False: 0]
  ------------------
 4351|      4|            {
 4352|      4|                if (num[j] && ( type & AaTypMask[2 * j] ) && ( mask && AaTypMask[2 * j + 1] ))
  ------------------
  |  Branch (4352:21): [True: 4, False: 0]
  |  Branch (4352:31): [True: 4, False: 0]
  |  Branch (4352:64): [True: 4, False: 0]
  |  Branch (4352:72): [True: 4, False: 0]
  ------------------
 4353|      4|                {
 4354|      4|                    type = GetAtomChargeType( at, i, pAATG->nAtTypeTotals, &mask, 1 ); /* subtract at[i] */
 4355|      4|                    num[j]  --;
 4356|      4|                    at[i].charge++;
 4357|      4|                    AddOrRemoveExplOrImplH( 1, at, num_atoms, (AT_NUMB) i, pAATG->t_group_info );
 4358|       |                    /*at[i].num_H  ++;*/
 4359|      4|                    num_added++;
 4360|      4|                    type = GetAtomChargeType( at, i, pAATG->nAtTypeTotals, &mask, 0 ); /* add changed at[i] */
 4361|      4|                    break;
 4362|      4|                }
 4363|      4|            }
 4364|      4|        }
 4365|     20|    }
 4366|       |
 4367|       |    /*
 4368|       |    pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE]  += num_added;
 4369|       |    pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] -= num_added;
 4370|       |    */
 4371|       |
 4372|      4|    return num_added;
 4373|      6|}
bHasAcidicMinus:
 4378|   112k|{
 4379|   112k|    int bFound = 0, j, type, mask;
 4380|   112k|    if (at[i].charge == -1 && ( type = GetAtomChargeType( at, i, NULL, &mask, 0 ) ))
  ------------------
  |  Branch (4380:9): [True: 8, False: 112k]
  |  Branch (4380:31): [True: 0, False: 8]
  ------------------
 4381|      0|    {
 4382|      0|        for (j = 0; AaTypMask[2 * j]; j++)
  ------------------
  |  Branch (4382:21): [True: 0, False: 0]
  ------------------
 4383|      0|        {
 4384|      0|            if (( type & AaTypMask[2 * j] ) && ( mask & AaTypMask[2 * j + 1] ))
  ------------------
  |  Branch (4384:17): [True: 0, False: 0]
  |  Branch (4384:48): [True: 0, False: 0]
  ------------------
 4385|      0|            {
 4386|      0|                bFound++;
 4387|      0|                break;
 4388|      0|            }
 4389|      0|        }
 4390|      0|    }
 4391|       |
 4392|   112k|    return bFound;
 4393|   112k|}
HardRemoveAcidicProtons:
 4412|      1|{
 4413|      1|    int cg_Plus = 0;
 4414|      1|    int cg_Minus = 0;
 4415|      1|    int tg_H_Other = 0;
 4416|      1|    int tg_H_Acid = 0;
 4417|       |
 4418|      1|    int ret = 0, ret2;
 4419|      1|    int nDelta, nNumChanges = 0, nNumMoved2AcidH = 0, nNumNeutralized = 0, nPrevNumCharges;
 4420|       |
 4421|      1|    int nPosCharges, nPosCharges2;
 4422|      1|    int nNegCharges, nNegCharges2;
 4423|       |    /*
 4424|       |    int nNumNP_H, nNumNP_H2;
 4425|       |    int nNumOS_H, nNumOS_H2;
 4426|       |    */
 4427|       |
 4428|      1|    nPosCharges = ( pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] + pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] ) / 2;
 4429|      1|    nNegCharges = ( pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] - pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] ) / 2;
 4430|       |    /*
 4431|       |    nNumNP_H    =  pAATG->nAtTypeTotals[ATTOT_NUM_NP_H] +
 4432|       |    pAATG->nAtTypeTotals[ATTOT_NUM_NP_Proton];
 4433|       |    nNumOS_H    =  pAATG->nAtTypeTotals[ATTOT_NUM_COH] +
 4434|       |    pAATG->nAtTypeTotals[ATTOT_NUM_CSH] +
 4435|       |    pAATG->nAtTypeTotals[ATTOT_NUM_ZOH];
 4436|       |    */
 4437|       |
 4438|       |    /* Prevent free exchange H <-> (-) */
 4439|      1|    pBNS->type_CN = ( BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_C_NEGATIVE );
  ------------------
  |  |   77|      1|#define BNS_VERT_TYPE_C_GROUP       0x0010
  ------------------
                  pBNS->type_CN = ( BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_C_NEGATIVE );
  ------------------
  |  |   82|      1|#define BNS_VERT_TYPE_C_NEGATIVE    0x0100  /* negative charge group; attribute, should be used with BNS_VERT_TYPE_C_GROUP */
  ------------------
 4440|      1|    pBNS->type_T = BNS_VERT_TYPE_TGROUP;
  ------------------
  |  |   75|      1|#define BNS_VERT_TYPE_TGROUP        0x0004
  ------------------
 4441|      1|    pBNS->type_TACN = BNS_VERT_TYPE_ACID;
  ------------------
  |  |   83|      1|#define BNS_VERT_TYPE_ACID          0x0200  /* only for this type are allowed paths: t_group-atom-c_group_neg (path_TACN) */
  ------------------
 4442|       |
 4443|       |    /* Create (+) charge group */
 4444|      1|    cg_Plus = CreateCGroupInBnStruct( at, num_atoms, pBNS, AR_HARD_TYP_POS, AR_HARD_MSK_POS, 1 );
  ------------------
  |  |  226|      1|#define AR_HARD_TYP_POS   ATTYP_N
  |  |  ------------------
  |  |  |  |  174|      1|#define ATTYP_N     (ATT_ATOM_N)
  |  |  |  |  ------------------
  |  |  |  |  |  |   69|      1|#define ATT_ATOM_N       0x0040
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  cg_Plus = CreateCGroupInBnStruct( at, num_atoms, pBNS, AR_HARD_TYP_POS, AR_HARD_MSK_POS, 1 );
  ------------------
  |  |  225|      1|#define AR_HARD_MSK_POS   ATBIT_MSK_NP
  |  |  ------------------
  |  |  |  |  163|      1|#define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|      1|#define ATBIT_NP_Plus    (1 << ATTOT_NUM_NP_Plus)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|      1|#define ATBIT_NP_Proton  (1 << ATTOT_NUM_NP_Proton)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |  118|      1|#define ATBIT_NP_H       (1 << ATTOT_NUM_NP_H)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |  119|      1|#define ATBIT_N_Minus    (1 << ATTOT_NUM_N_Minus)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |  120|      1|#define ATBIT_NP         (1 << ATTOT_NUM_NP)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4445|       |
 4446|       |    /* create (-) charge group */
 4447|       |    /*
 4448|       |    if ( nAtTypeTotals[ATTOT_NUM_CO_Minus] +
 4449|       |    nAtTypeTotals[ATTOT_NUM_CS_Minus] +
 4450|       |    nAtTypeTotals[ATTOT_NUM_ZO_Minus] +
 4451|       |    nAtTypeTotals[ATTOT_NUM_N_Minus] )
 4452|       |    */
 4453|       |
 4454|      1|    cg_Minus = CreateCGroupInBnStruct( at, num_atoms, pBNS, AR_HARD_TYP_NEG, AR_HARD_MSK_NEG, -1 );
  ------------------
  |  |  229|      1|#define AR_HARD_TYP_NEG   (ATTYP_N | ATTYP_OS)
  |  |  ------------------
  |  |  |  |  174|      1|#define ATTYP_N     (ATT_ATOM_N)
  |  |  |  |  ------------------
  |  |  |  |  |  |   69|      1|#define ATT_ATOM_N       0x0040
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define AR_HARD_TYP_NEG   (ATTYP_N | ATTYP_OS)
  |  |  ------------------
  |  |  |  |  172|      1|#define ATTYP_OS    (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO /*| ATT_OTHER_NEG_O*/ | ATT_OTHER_ZO)
  |  |  |  |  ------------------
  |  |  |  |  |  |   63|      1|#define ATT_ACIDIC_CO    0x0001
  |  |  |  |  ------------------
  |  |  |  |               #define ATTYP_OS    (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO /*| ATT_OTHER_NEG_O*/ | ATT_OTHER_ZO)
  |  |  |  |  ------------------
  |  |  |  |  |  |   64|      1|#define ATT_ACIDIC_S     0x0002
  |  |  |  |  ------------------
  |  |  |  |               #define ATTYP_OS    (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO /*| ATT_OTHER_NEG_O*/ | ATT_OTHER_ZO)
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|      1|#define ATT_OO           0x0004
  |  |  |  |  ------------------
  |  |  |  |               #define ATTYP_OS    (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO /*| ATT_OTHER_NEG_O*/ | ATT_OTHER_ZO)
  |  |  |  |  ------------------
  |  |  |  |  |  |   66|      1|#define ATT_ZOO          0x0008
  |  |  |  |  ------------------
  |  |  |  |               #define ATTYP_OS    (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO /*| ATT_OTHER_NEG_O*/ | ATT_OTHER_ZO)
  |  |  |  |  ------------------
  |  |  |  |  |  |   67|      1|#define ATT_NO           0x0010
  |  |  |  |  ------------------
  |  |  |  |               #define ATTYP_OS    (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO /*| ATT_OTHER_NEG_O*/ | ATT_OTHER_ZO)
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      1|#define ATT_OTHER_ZO     0x0200   /* -Z=O or =Z=O */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  cg_Minus = CreateCGroupInBnStruct( at, num_atoms, pBNS, AR_HARD_TYP_NEG, AR_HARD_MSK_NEG, -1 );
  ------------------
  |  |  228|      1|#define AR_HARD_MSK_NEG   (ATBIT_MSK_NP | ATBIT_MSK_OS)
  |  |  ------------------
  |  |  |  |  163|      1|#define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|      1|#define ATBIT_NP_Plus    (1 << ATTOT_NUM_NP_Plus)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|      1|#define ATBIT_NP_Proton  (1 << ATTOT_NUM_NP_Proton)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |  118|      1|#define ATBIT_NP_H       (1 << ATTOT_NUM_NP_H)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |  119|      1|#define ATBIT_N_Minus    (1 << ATTOT_NUM_N_Minus)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |  120|      1|#define ATBIT_NP         (1 << ATTOT_NUM_NP)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define AR_HARD_MSK_NEG   (ATBIT_MSK_NP | ATBIT_MSK_OS)
  |  |  ------------------
  |  |  |  |  165|      1|#define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  122|      1|#define ATBIT_COH        (1 << ATTOT_NUM_COH)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  123|      1|#define ATBIT_CSH        (1 << ATTOT_NUM_CSH)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  124|      1|#define ATBIT_ZOH        (1 << ATTOT_NUM_ZOH)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|      1|#define ATBIT_OOH        (1 << ATTOT_NUM_OOH)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|      1|#define ATBIT_ZOOH       (1 << ATTOT_NUM_ZOOH)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  127|      1|#define ATBIT_NOH        (1 << ATTOT_NUM_NOH)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  128|      1|#define ATBIT_N_OH       (1 << ATTOT_NUM_N_OH)
  |  |  |  |  ------------------
  |  |  |  |  166|      1|                        ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|      1|#define ATBIT_CO         (1 << ATTOT_NUM_CO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  130|      1|#define ATBIT_ZO         (1 << ATTOT_NUM_ZO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  131|      1|#define ATBIT_NO         (1 << ATTOT_NUM_NO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  132|      1|#define ATBIT_N_O        (1 << ATTOT_NUM_N_O)
  |  |  |  |  ------------------
  |  |  |  |  167|      1|                        ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  133|      1|#define ATBIT_CO_Minus   (1 << ATTOT_NUM_CO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  134|      1|#define ATBIT_CS_Minus   (1 << ATTOT_NUM_CS_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  135|      1|#define ATBIT_ZO_Minus   (1 << ATTOT_NUM_ZO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  136|      1|#define ATBIT_OO_Minus   (1 << ATTOT_NUM_OO_Minus)
  |  |  |  |  ------------------
  |  |  |  |  168|      1|                        ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  137|      1|#define ATBIT_ZOO_Minus  (1 << ATTOT_NUM_ZOO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|      1|#define ATBIT_NO_Minus   (1 << ATTOT_NUM_NO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  139|      1|#define ATBIT_N_O_Minus  (1 << ATTOT_NUM_N_O_Minus)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4455|       |
 4456|      1|    pBNS->type_CN = ( BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_C_NEGATIVE );
  ------------------
  |  |   77|      1|#define BNS_VERT_TYPE_C_GROUP       0x0010
  ------------------
                  pBNS->type_CN = ( BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_C_NEGATIVE );
  ------------------
  |  |   82|      1|#define BNS_VERT_TYPE_C_NEGATIVE    0x0100  /* negative charge group; attribute, should be used with BNS_VERT_TYPE_C_GROUP */
  ------------------
 4457|      1|    pBNS->type_T = BNS_VERT_TYPE_TGROUP;
  ------------------
  |  |   75|      1|#define BNS_VERT_TYPE_TGROUP        0x0004
  ------------------
 4458|      1|    pBNS->type_TACN = BNS_VERT_TYPE_ACID;
  ------------------
  |  |   83|      1|#define BNS_VERT_TYPE_ACID          0x0200  /* only for this type are allowed paths: t_group-atom-c_group_neg (path_TACN) */
  ------------------
 4459|       |
 4460|       |    /* Create tautomeric group for non-acidic or negatively charged acidic O  */
 4461|      1|    tg_H_Other = CreateTGroupInBnStruct( at, num_atoms, pBNS, AR_HARD_TYP_HN, AR_HARD_MSK_HN );
  ------------------
  |  |  235|      1|#define AR_HARD_TYP_HN    ((ATTYP_N | ATTYP_OS) /*& ~AR_HARD_TYP_HA*/)
  |  |  ------------------
  |  |  |  |  174|      1|#define ATTYP_N     (ATT_ATOM_N)
  |  |  |  |  ------------------
  |  |  |  |  |  |   69|      1|#define ATT_ATOM_N       0x0040
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define AR_HARD_TYP_HN    ((ATTYP_N | ATTYP_OS) /*& ~AR_HARD_TYP_HA*/)
  |  |  ------------------
  |  |  |  |  172|      1|#define ATTYP_OS    (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO /*| ATT_OTHER_NEG_O*/ | ATT_OTHER_ZO)
  |  |  |  |  ------------------
  |  |  |  |  |  |   63|      1|#define ATT_ACIDIC_CO    0x0001
  |  |  |  |  ------------------
  |  |  |  |               #define ATTYP_OS    (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO /*| ATT_OTHER_NEG_O*/ | ATT_OTHER_ZO)
  |  |  |  |  ------------------
  |  |  |  |  |  |   64|      1|#define ATT_ACIDIC_S     0x0002
  |  |  |  |  ------------------
  |  |  |  |               #define ATTYP_OS    (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO /*| ATT_OTHER_NEG_O*/ | ATT_OTHER_ZO)
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|      1|#define ATT_OO           0x0004
  |  |  |  |  ------------------
  |  |  |  |               #define ATTYP_OS    (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO /*| ATT_OTHER_NEG_O*/ | ATT_OTHER_ZO)
  |  |  |  |  ------------------
  |  |  |  |  |  |   66|      1|#define ATT_ZOO          0x0008
  |  |  |  |  ------------------
  |  |  |  |               #define ATTYP_OS    (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO /*| ATT_OTHER_NEG_O*/ | ATT_OTHER_ZO)
  |  |  |  |  ------------------
  |  |  |  |  |  |   67|      1|#define ATT_NO           0x0010
  |  |  |  |  ------------------
  |  |  |  |               #define ATTYP_OS    (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO /*| ATT_OTHER_NEG_O*/ | ATT_OTHER_ZO)
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      1|#define ATT_OTHER_ZO     0x0200   /* -Z=O or =Z=O */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  tg_H_Other = CreateTGroupInBnStruct( at, num_atoms, pBNS, AR_HARD_TYP_HN, AR_HARD_MSK_HN );
  ------------------
  |  |  234|      1|#define AR_HARD_MSK_HN    ((ATBIT_MSK_NP | ATBIT_MSK_OS) & ~AR_HARD_MSK_HA)
  |  |  ------------------
  |  |  |  |  163|      1|#define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|      1|#define ATBIT_NP_Plus    (1 << ATTOT_NUM_NP_Plus)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|      1|#define ATBIT_NP_Proton  (1 << ATTOT_NUM_NP_Proton)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |  118|      1|#define ATBIT_NP_H       (1 << ATTOT_NUM_NP_H)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |  119|      1|#define ATBIT_N_Minus    (1 << ATTOT_NUM_N_Minus)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |  120|      1|#define ATBIT_NP         (1 << ATTOT_NUM_NP)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define AR_HARD_MSK_HN    ((ATBIT_MSK_NP | ATBIT_MSK_OS) & ~AR_HARD_MSK_HA)
  |  |  ------------------
  |  |  |  |  165|      1|#define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  122|      1|#define ATBIT_COH        (1 << ATTOT_NUM_COH)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  123|      1|#define ATBIT_CSH        (1 << ATTOT_NUM_CSH)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  124|      1|#define ATBIT_ZOH        (1 << ATTOT_NUM_ZOH)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|      1|#define ATBIT_OOH        (1 << ATTOT_NUM_OOH)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|      1|#define ATBIT_ZOOH       (1 << ATTOT_NUM_ZOOH)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  127|      1|#define ATBIT_NOH        (1 << ATTOT_NUM_NOH)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  128|      1|#define ATBIT_N_OH       (1 << ATTOT_NUM_N_OH)
  |  |  |  |  ------------------
  |  |  |  |  166|      1|                        ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|      1|#define ATBIT_CO         (1 << ATTOT_NUM_CO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  130|      1|#define ATBIT_ZO         (1 << ATTOT_NUM_ZO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  131|      1|#define ATBIT_NO         (1 << ATTOT_NUM_NO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  132|      1|#define ATBIT_N_O        (1 << ATTOT_NUM_N_O)
  |  |  |  |  ------------------
  |  |  |  |  167|      1|                        ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  133|      1|#define ATBIT_CO_Minus   (1 << ATTOT_NUM_CO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  134|      1|#define ATBIT_CS_Minus   (1 << ATTOT_NUM_CS_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  135|      1|#define ATBIT_ZO_Minus   (1 << ATTOT_NUM_ZO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  136|      1|#define ATBIT_OO_Minus   (1 << ATTOT_NUM_OO_Minus)
  |  |  |  |  ------------------
  |  |  |  |  168|      1|                        ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  137|      1|#define ATBIT_ZOO_Minus  (1 << ATTOT_NUM_ZOO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|      1|#define ATBIT_NO_Minus   (1 << ATTOT_NUM_NO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  139|      1|#define ATBIT_N_O_Minus  (1 << ATTOT_NUM_N_O_Minus)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define AR_HARD_MSK_HN    ((ATBIT_MSK_NP | ATBIT_MSK_OS) & ~AR_HARD_MSK_HA)
  |  |  ------------------
  |  |  |  |  231|      1|#define AR_HARD_MSK_HA    (ATBIT_CO | ATBIT_NO )
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|      1|#define ATBIT_CO         (1 << ATTOT_NUM_CO)
  |  |  |  |  ------------------
  |  |  |  |               #define AR_HARD_MSK_HA    (ATBIT_CO | ATBIT_NO )
  |  |  |  |  ------------------
  |  |  |  |  |  |  131|      1|#define ATBIT_NO         (1 << ATTOT_NUM_NO)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4462|       |
 4463|       |    /* Create tautomeric group for possibly acidic O */
 4464|      1|    tg_H_Acid = CreateTGroupInBnStruct( at, num_atoms, pBNS, AR_HARD_TYP_HA, AR_HARD_MSK_HA );
  ------------------
  |  |  232|      1|#define AR_HARD_TYP_HA    (ATT_ACIDIC_CO | ATT_NO)
  |  |  ------------------
  |  |  |  |   63|      1|#define ATT_ACIDIC_CO    0x0001
  |  |  ------------------
  |  |               #define AR_HARD_TYP_HA    (ATT_ACIDIC_CO | ATT_NO)
  |  |  ------------------
  |  |  |  |   67|      1|#define ATT_NO           0x0010
  |  |  ------------------
  ------------------
                  tg_H_Acid = CreateTGroupInBnStruct( at, num_atoms, pBNS, AR_HARD_TYP_HA, AR_HARD_MSK_HA );
  ------------------
  |  |  231|      1|#define AR_HARD_MSK_HA    (ATBIT_CO | ATBIT_NO )
  |  |  ------------------
  |  |  |  |  129|      1|#define ATBIT_CO         (1 << ATTOT_NUM_CO)
  |  |  ------------------
  |  |               #define AR_HARD_MSK_HA    (ATBIT_CO | ATBIT_NO )
  |  |  ------------------
  |  |  |  |  131|      1|#define ATBIT_NO         (1 << ATTOT_NUM_NO)
  |  |  ------------------
  ------------------
 4465|      1|    if (tg_H_Other >= num_atoms && tg_H_Acid >= num_atoms)
  ------------------
  |  Branch (4465:9): [True: 0, False: 1]
  |  Branch (4465:36): [True: 0, False: 0]
  ------------------
 4466|      0|    {
 4467|       |        /* Find alt path to remove one proton */
 4468|      0|        do
 4469|      0|        {
 4470|       |            /* Remove a proton */
 4471|      0|            nPrevNumCharges = pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES];
 4472|      0|            ret = bExistsAltPath( pCG, pBNS, pBD, pAATG,
 4473|      0|                                  at, num_atoms,
 4474|      0|                                  tg_H_Other /*nVertDoubleBond*/,
 4475|      0|                                  tg_H_Acid /*nVertSingleBond*/,
 4476|      0|                                  ALT_PATH_MODE_REM_PROTON );
  ------------------
  |  |  346|      0|#define ALT_PATH_MODE_REM_PROTON 9   /* remove proton, adjust bonds, charges, H-counts 2004-03-05 */
  ------------------
 4477|      0|            if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4478|      0|            {
 4479|      0|                return ret;
 4480|      0|            }
 4481|      0|            if (ret & 1)
  ------------------
  |  Branch (4481:17): [True: 0, False: 0]
  ------------------
 4482|      0|            {
 4483|      0|                nDelta = ( ret & ~3 ) >> 2;
 4484|      0|                nNumChanges += ( 0 != ( ret & 2 ) );
 4485|      0|                if (nDelta)
  ------------------
  |  Branch (4485:21): [True: 0, False: 0]
  ------------------
 4486|      0|                {
 4487|       |                    /* Radical pair has disappeared */
 4488|      0|                    ; /* goto quick_exit;*/
 4489|      0|                }
 4490|      0|                nNumMoved2AcidH++;
 4491|      0|                if (nPrevNumCharges > pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] + 1)
  ------------------
  |  Branch (4491:21): [True: 0, False: 0]
  ------------------
 4492|      0|                {
 4493|      0|                    nNumNeutralized += ( nPrevNumCharges - ( pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] - 1 ) ) / 2;
 4494|      0|                }
 4495|      0|            }
 4496|      0|        } while (( ret & 1 ) && nNumMoved2AcidH < num2remove);
  ------------------
  |  Branch (4496:18): [True: 0, False: 0]
  |  Branch (4496:33): [True: 0, False: 0]
  ------------------
 4497|       |
 4498|       |        /* Neutralize: remove ion pairs like >N(+)=-O(-) => >N-=O */
 4499|      0|        if (( nNumMoved2AcidH /*|| bCancelChargesAlways*/ ) && cg_Minus >= num_atoms && cg_Plus >= num_atoms &&
  ------------------
  |  Branch (4499:13): [True: 0, False: 0]
  |  Branch (4499:64): [True: 0, False: 0]
  |  Branch (4499:89): [True: 0, False: 0]
  ------------------
 4500|      0|             pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] > abs( pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] ))
  ------------------
  |  Branch (4500:14): [True: 0, False: 0]
  ------------------
 4501|      0|        {
 4502|      0|            do
 4503|      0|            {
 4504|      0|                nPrevNumCharges = pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES];
 4505|      0|                ret = bExistsAltPath( pCG, pBNS, pBD, pAATG,
 4506|      0|                                      at, num_atoms,
 4507|      0|                                      cg_Minus /*nVertDoubleBond*/,
 4508|      0|                                      cg_Plus /*nVertSingleBond*/,
 4509|      0|                                      ALT_PATH_MODE_REM_PROTON );
  ------------------
  |  |  346|      0|#define ALT_PATH_MODE_REM_PROTON 9   /* remove proton, adjust bonds, charges, H-counts 2004-03-05 */
  ------------------
 4510|      0|                if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4511|      0|                {
 4512|      0|                    return ret;
 4513|      0|                }
 4514|      0|                if (ret & 1)
  ------------------
  |  Branch (4514:21): [True: 0, False: 0]
  ------------------
 4515|      0|                {
 4516|      0|                    nDelta = ( ret & ~3 ) >> 2;
 4517|      0|                    nNumChanges += ( 0 != ( ret & 2 ) );
 4518|      0|                    if (nDelta)
  ------------------
  |  Branch (4518:25): [True: 0, False: 0]
  ------------------
 4519|      0|                    {
 4520|       |                        /* Radical pair has disappeared */
 4521|      0|                        ; /* goto quick_exit;*/
 4522|      0|                    }
 4523|      0|                    if (nPrevNumCharges > pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES])
  ------------------
  |  Branch (4523:25): [True: 0, False: 0]
  ------------------
 4524|      0|                    {
 4525|      0|                        nNumNeutralized += ( nPrevNumCharges - pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] ) / 2;
 4526|      0|                    }
 4527|      0|                }
 4528|      0|            } while (ret & 1);
  ------------------
  |  Branch (4528:22): [True: 0, False: 0]
  ------------------
 4529|      0|        }
 4530|      0|    }
 4531|       |
 4532|      1|    ret = 0;
 4533|      1|    if (tg_H_Acid >= num_atoms)
  ------------------
  |  Branch (4533:9): [True: 0, False: 1]
  ------------------
 4534|      0|    {
 4535|      0|        ret2 = RemoveLastGroupFromBnStruct( at, num_atoms, tg_H_Acid, pBNS );
 4536|      0|        if (!ret && ret2)
  ------------------
  |  Branch (4536:13): [True: 0, False: 0]
  |  Branch (4536:21): [True: 0, False: 0]
  ------------------
 4537|      0|        {
 4538|      0|            ret = ret2;
 4539|      0|        }
 4540|      0|    }
 4541|      1|    if (tg_H_Other >= num_atoms)
  ------------------
  |  Branch (4541:9): [True: 0, False: 1]
  ------------------
 4542|      0|    {
 4543|      0|        ret2 = RemoveLastGroupFromBnStruct( at, num_atoms, tg_H_Other, pBNS );
 4544|      0|        if (!ret && ret2)
  ------------------
  |  Branch (4544:13): [True: 0, False: 0]
  |  Branch (4544:21): [True: 0, False: 0]
  ------------------
 4545|      0|        {
 4546|      0|            ret = ret2;
 4547|      0|        }
 4548|      0|    }
 4549|      1|    if (cg_Minus >= num_atoms)
  ------------------
  |  Branch (4549:9): [True: 0, False: 1]
  ------------------
 4550|      0|    {
 4551|      0|        ret2 = RemoveLastGroupFromBnStruct( at, num_atoms, cg_Minus, pBNS );
 4552|      0|        if (!ret && ret2)
  ------------------
  |  Branch (4552:13): [True: 0, False: 0]
  |  Branch (4552:21): [True: 0, False: 0]
  ------------------
 4553|      0|        {
 4554|      0|            ret = ret2;
 4555|      0|        }
 4556|      0|    }
 4557|      1|    if (cg_Plus >= num_atoms)
  ------------------
  |  Branch (4557:9): [True: 0, False: 1]
  ------------------
 4558|      0|    {
 4559|      0|        ret2 = RemoveLastGroupFromBnStruct( at, num_atoms, cg_Plus, pBNS );
 4560|      0|        if (!ret && ret2)
  ------------------
  |  Branch (4560:13): [True: 0, False: 0]
  |  Branch (4560:21): [True: 0, False: 0]
  ------------------
 4561|      0|        {
 4562|      0|            ret = ret2;
 4563|      0|        }
 4564|      0|    }
 4565|       |
 4566|      1|    pBNS->type_CN = 0;
 4567|      1|    pBNS->type_T = 0;
 4568|      1|    pBNS->type_TACN = 0;
 4569|       |
 4570|      1|    if (ret)
  ------------------
  |  Branch (4570:9): [True: 0, False: 1]
  ------------------
 4571|      0|    {
 4572|      0|        return ret;
 4573|      0|    }
 4574|       |
 4575|      1|    if (pAATG->nAtTypeTotals[ATTOT_NUM_CO_Minus] + pAATG->nAtTypeTotals[ATTOT_NUM_ZO_Minus] &&
  ------------------
  |  Branch (4575:9): [True: 0, False: 1]
  ------------------
 4576|      1|         pAATG->nAtTypeTotals[ATTOT_NUM_N_Minus])
  ------------------
  |  Branch (4576:10): [True: 0, False: 0]
  ------------------
 4577|      0|    {
 4578|      0|    }
 4579|       |
 4580|      1|    nPosCharges2 = ( pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] + pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] ) / 2;
 4581|      1|    nNegCharges2 = ( pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] - pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] ) / 2;
 4582|       |    /*
 4583|       |    nNumNP_H2    = pAATG->nAtTypeTotals[ATTOT_NUM_NP_H] +
 4584|       |    pAATG->nAtTypeTotals[ATTOT_NUM_NP_Proton];
 4585|       |    nNumOS_H2    = pAATG->nAtTypeTotals[ATTOT_NUM_COH] +
 4586|       |    pAATG->nAtTypeTotals[ATTOT_NUM_CSH] +
 4587|       |    pAATG->nAtTypeTotals[ATTOT_NUM_ZOH];
 4588|       |    */
 4589|      1|    if (( nPosCharges - nNegCharges ) - ( nPosCharges2 - nNegCharges2 ) != 0)
  ------------------
  |  Branch (4589:9): [True: 0, False: 1]
  ------------------
 4590|      0|    {
 4591|      0|        return BNS_PROGRAM_ERR;
  ------------------
  |  |   78|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 4592|      0|    }
 4593|       |
 4594|      1|    if (nNumCanceledCharges)
  ------------------
  |  Branch (4594:9): [True: 1, False: 0]
  ------------------
 4595|      1|    {
 4596|       |#if ( FIX_CANCEL_CHARGE_COUNT_BUG == 1 )
 4597|       |        *nNumCanceledCharges += 2 * nNumNeutralized;
 4598|       |#else
 4599|      1|        *nNumCanceledCharges = 2 * nNumNeutralized;
 4600|      1|#endif
 4601|      1|    }
 4602|       |
 4603|      1|    return nNumMoved2AcidH;
 4604|      1|}
HardAddAcidicProtons:
 4616|      6|{
 4617|      6|    int cg_Plus = 0;
 4618|      6|    int cg_Minus_CO = 0;
 4619|      6|    int cg_Minus_Other = 0;
 4620|      6|    int tg_H = 0;
 4621|       |
 4622|      6|    int ret = 0, ret2;
 4623|      6|    int nDelta, nNumChanges = 0, nNumMoved2AcidMinus = 0, nNumNeutralized = 0, nPrevNumCharges;
 4624|       |
 4625|      6|    int nPosCharges, nPosCharges2;
 4626|      6|    int nNegCharges, nNegCharges2;
 4627|       |    /*
 4628|       |    int nNumNP_H, nNumNP_H2;
 4629|       |    int nNumOS_H, nNumOS_H2;
 4630|       |    */
 4631|      6|    nPosCharges = ( pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] + pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] ) / 2;
 4632|      6|    nNegCharges = ( pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] - pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] ) / 2;
 4633|       |    /*
 4634|       |    nNumNP_H    =  pAATG->nAtTypeTotals[ATTOT_NUM_NP_H] +
 4635|       |    pAATG->nAtTypeTotals[ATTOT_NUM_NP_Proton];
 4636|       |    nNumOS_H    =  pAATG->nAtTypeTotals[ATTOT_NUM_COH] +
 4637|       |    pAATG->nAtTypeTotals[ATTOT_NUM_CSH] +
 4638|       |    pAATG->nAtTypeTotals[ATTOT_NUM_ZOH];
 4639|       |    */
 4640|       |
 4641|       |    /* Prevent free exchange H <-> (-) */
 4642|      6|    pBNS->type_CN = ( BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_C_NEGATIVE );
  ------------------
  |  |   77|      6|#define BNS_VERT_TYPE_C_GROUP       0x0010
  ------------------
                  pBNS->type_CN = ( BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_C_NEGATIVE );
  ------------------
  |  |   82|      6|#define BNS_VERT_TYPE_C_NEGATIVE    0x0100  /* negative charge group; attribute, should be used with BNS_VERT_TYPE_C_GROUP */
  ------------------
 4643|      6|    pBNS->type_T = BNS_VERT_TYPE_TGROUP;
  ------------------
  |  |   75|      6|#define BNS_VERT_TYPE_TGROUP        0x0004
  ------------------
 4644|      6|    pBNS->type_TACN = BNS_VERT_TYPE_ACID;
  ------------------
  |  |   83|      6|#define BNS_VERT_TYPE_ACID          0x0200  /* only for this type are allowed paths: t_group-atom-c_group_neg (path_TACN) */
  ------------------
 4645|       |
 4646|       |    /* Create (+) charge group */
 4647|      6|    cg_Plus = CreateCGroupInBnStruct( at, num_atoms, pBNS, AA_HARD_TYP_POS, AA_HARD_MSK_POS, 1 );
  ------------------
  |  |  240|      6|#define AA_HARD_TYP_POS   ATTYP_N
  |  |  ------------------
  |  |  |  |  174|      6|#define ATTYP_N     (ATT_ATOM_N)
  |  |  |  |  ------------------
  |  |  |  |  |  |   69|      6|#define ATT_ATOM_N       0x0040
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  cg_Plus = CreateCGroupInBnStruct( at, num_atoms, pBNS, AA_HARD_TYP_POS, AA_HARD_MSK_POS, 1 );
  ------------------
  |  |  239|      6|#define AA_HARD_MSK_POS   ATBIT_MSK_NP
  |  |  ------------------
  |  |  |  |  163|      6|#define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|      6|#define ATBIT_NP_Plus    (1 << ATTOT_NUM_NP_Plus)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|      6|#define ATBIT_NP_Proton  (1 << ATTOT_NUM_NP_Proton)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |  118|      6|#define ATBIT_NP_H       (1 << ATTOT_NUM_NP_H)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |  119|      6|#define ATBIT_N_Minus    (1 << ATTOT_NUM_N_Minus)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |  120|      6|#define ATBIT_NP         (1 << ATTOT_NUM_NP)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4648|       |
 4649|       |    /* Create (-) charge group */
 4650|       |    /*
 4651|       |    if ( nAtTypeTotals[ATTOT_NUM_CO_Minus] +
 4652|       |    nAtTypeTotals[ATTOT_NUM_CS_Minus] +
 4653|       |    nAtTypeTotals[ATTOT_NUM_ZO_Minus] +
 4654|       |    nAtTypeTotals[ATTOT_NUM_N_Minus] )
 4655|       |    */
 4656|      6|    cg_Minus_CO = CreateCGroupInBnStruct( at, num_atoms, pBNS, AA_HARD_TYP_CO, AA_HARD_MSK_CO, -1 );
  ------------------
  |  |  246|      6|#define AA_HARD_TYP_CO    (ATT_ACIDIC_CO | ATT_NO)
  |  |  ------------------
  |  |  |  |   63|      6|#define ATT_ACIDIC_CO    0x0001
  |  |  ------------------
  |  |               #define AA_HARD_TYP_CO    (ATT_ACIDIC_CO | ATT_NO)
  |  |  ------------------
  |  |  |  |   67|      6|#define ATT_NO           0x0010
  |  |  ------------------
  ------------------
                  cg_Minus_CO = CreateCGroupInBnStruct( at, num_atoms, pBNS, AA_HARD_TYP_CO, AA_HARD_MSK_CO, -1 );
  ------------------
  |  |  245|      6|#define AA_HARD_MSK_CO    (ATBIT_CO | ATBIT_NO )
  |  |  ------------------
  |  |  |  |  129|      6|#define ATBIT_CO         (1 << ATTOT_NUM_CO)
  |  |  ------------------
  |  |               #define AA_HARD_MSK_CO    (ATBIT_CO | ATBIT_NO )
  |  |  ------------------
  |  |  |  |  131|      6|#define ATBIT_NO         (1 << ATTOT_NUM_NO)
  |  |  ------------------
  ------------------
 4657|       |
 4658|      6|    cg_Minus_Other = CreateCGroupInBnStruct( at, num_atoms, pBNS, AA_HARD_TYP_NEG, AA_HARD_MSK_NEG, -1 );
  ------------------
  |  |  243|      6|#define AA_HARD_TYP_NEG   (ATTYP_N | ATTYP_OS)
  |  |  ------------------
  |  |  |  |  174|      6|#define ATTYP_N     (ATT_ATOM_N)
  |  |  |  |  ------------------
  |  |  |  |  |  |   69|      6|#define ATT_ATOM_N       0x0040
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define AA_HARD_TYP_NEG   (ATTYP_N | ATTYP_OS)
  |  |  ------------------
  |  |  |  |  172|      6|#define ATTYP_OS    (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO /*| ATT_OTHER_NEG_O*/ | ATT_OTHER_ZO)
  |  |  |  |  ------------------
  |  |  |  |  |  |   63|      6|#define ATT_ACIDIC_CO    0x0001
  |  |  |  |  ------------------
  |  |  |  |               #define ATTYP_OS    (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO /*| ATT_OTHER_NEG_O*/ | ATT_OTHER_ZO)
  |  |  |  |  ------------------
  |  |  |  |  |  |   64|      6|#define ATT_ACIDIC_S     0x0002
  |  |  |  |  ------------------
  |  |  |  |               #define ATTYP_OS    (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO /*| ATT_OTHER_NEG_O*/ | ATT_OTHER_ZO)
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|      6|#define ATT_OO           0x0004
  |  |  |  |  ------------------
  |  |  |  |               #define ATTYP_OS    (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO /*| ATT_OTHER_NEG_O*/ | ATT_OTHER_ZO)
  |  |  |  |  ------------------
  |  |  |  |  |  |   66|      6|#define ATT_ZOO          0x0008
  |  |  |  |  ------------------
  |  |  |  |               #define ATTYP_OS    (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO /*| ATT_OTHER_NEG_O*/ | ATT_OTHER_ZO)
  |  |  |  |  ------------------
  |  |  |  |  |  |   67|      6|#define ATT_NO           0x0010
  |  |  |  |  ------------------
  |  |  |  |               #define ATTYP_OS    (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO /*| ATT_OTHER_NEG_O*/ | ATT_OTHER_ZO)
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      6|#define ATT_OTHER_ZO     0x0200   /* -Z=O or =Z=O */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  cg_Minus_Other = CreateCGroupInBnStruct( at, num_atoms, pBNS, AA_HARD_TYP_NEG, AA_HARD_MSK_NEG, -1 );
  ------------------
  |  |  242|      6|#define AA_HARD_MSK_NEG   ((ATBIT_MSK_NP | ATBIT_MSK_OS) & ~(ATBIT_CO | ATBIT_NO ))
  |  |  ------------------
  |  |  |  |  163|      6|#define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|      6|#define ATBIT_NP_Plus    (1 << ATTOT_NUM_NP_Plus)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|      6|#define ATBIT_NP_Proton  (1 << ATTOT_NUM_NP_Proton)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |  118|      6|#define ATBIT_NP_H       (1 << ATTOT_NUM_NP_H)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |  119|      6|#define ATBIT_N_Minus    (1 << ATTOT_NUM_N_Minus)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |  120|      6|#define ATBIT_NP         (1 << ATTOT_NUM_NP)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define AA_HARD_MSK_NEG   ((ATBIT_MSK_NP | ATBIT_MSK_OS) & ~(ATBIT_CO | ATBIT_NO ))
  |  |  ------------------
  |  |  |  |  165|      6|#define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  122|      6|#define ATBIT_COH        (1 << ATTOT_NUM_COH)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  123|      6|#define ATBIT_CSH        (1 << ATTOT_NUM_CSH)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  124|      6|#define ATBIT_ZOH        (1 << ATTOT_NUM_ZOH)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|      6|#define ATBIT_OOH        (1 << ATTOT_NUM_OOH)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|      6|#define ATBIT_ZOOH       (1 << ATTOT_NUM_ZOOH)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  127|      6|#define ATBIT_NOH        (1 << ATTOT_NUM_NOH)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  128|      6|#define ATBIT_N_OH       (1 << ATTOT_NUM_N_OH)
  |  |  |  |  ------------------
  |  |  |  |  166|      6|                        ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|      6|#define ATBIT_CO         (1 << ATTOT_NUM_CO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  130|      6|#define ATBIT_ZO         (1 << ATTOT_NUM_ZO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  131|      6|#define ATBIT_NO         (1 << ATTOT_NUM_NO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  132|      6|#define ATBIT_N_O        (1 << ATTOT_NUM_N_O)
  |  |  |  |  ------------------
  |  |  |  |  167|      6|                        ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  133|      6|#define ATBIT_CO_Minus   (1 << ATTOT_NUM_CO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  134|      6|#define ATBIT_CS_Minus   (1 << ATTOT_NUM_CS_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  135|      6|#define ATBIT_ZO_Minus   (1 << ATTOT_NUM_ZO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  136|      6|#define ATBIT_OO_Minus   (1 << ATTOT_NUM_OO_Minus)
  |  |  |  |  ------------------
  |  |  |  |  168|      6|                        ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  137|      6|#define ATBIT_ZOO_Minus  (1 << ATTOT_NUM_ZOO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|      6|#define ATBIT_NO_Minus   (1 << ATTOT_NUM_NO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  139|      6|#define ATBIT_N_O_Minus  (1 << ATTOT_NUM_N_O_Minus)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define AA_HARD_MSK_NEG   ((ATBIT_MSK_NP | ATBIT_MSK_OS) & ~(ATBIT_CO | ATBIT_NO ))
  |  |  ------------------
  |  |  |  |  129|      6|#define ATBIT_CO         (1 << ATTOT_NUM_CO)
  |  |  ------------------
  |  |               #define AA_HARD_MSK_NEG   ((ATBIT_MSK_NP | ATBIT_MSK_OS) & ~(ATBIT_CO | ATBIT_NO ))
  |  |  ------------------
  |  |  |  |  131|      6|#define ATBIT_NO         (1 << ATTOT_NUM_NO)
  |  |  ------------------
  ------------------
 4659|       |
 4660|      6|    pBNS->type_CN = ( BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_C_NEGATIVE );
  ------------------
  |  |   77|      6|#define BNS_VERT_TYPE_C_GROUP       0x0010
  ------------------
                  pBNS->type_CN = ( BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_C_NEGATIVE );
  ------------------
  |  |   82|      6|#define BNS_VERT_TYPE_C_NEGATIVE    0x0100  /* negative charge group; attribute, should be used with BNS_VERT_TYPE_C_GROUP */
  ------------------
 4661|      6|    pBNS->type_T = BNS_VERT_TYPE_TGROUP;
  ------------------
  |  |   75|      6|#define BNS_VERT_TYPE_TGROUP        0x0004
  ------------------
 4662|      6|    pBNS->type_TACN = BNS_VERT_TYPE_ACID;
  ------------------
  |  |   83|      6|#define BNS_VERT_TYPE_ACID          0x0200  /* only for this type are allowed paths: t_group-atom-c_group_neg (path_TACN) */
  ------------------
 4663|       |
 4664|       |    /* Create tautomeric group for all H  */
 4665|      6|    tg_H = CreateTGroupInBnStruct( at, num_atoms, pBNS, AA_HARD_TYP_H, AA_HARD_MSK_H );
  ------------------
  |  |  249|      6|#define AA_HARD_TYP_H     (ATTYP_N | ATTYP_OS)
  |  |  ------------------
  |  |  |  |  174|      6|#define ATTYP_N     (ATT_ATOM_N)
  |  |  |  |  ------------------
  |  |  |  |  |  |   69|      6|#define ATT_ATOM_N       0x0040
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define AA_HARD_TYP_H     (ATTYP_N | ATTYP_OS)
  |  |  ------------------
  |  |  |  |  172|      6|#define ATTYP_OS    (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO /*| ATT_OTHER_NEG_O*/ | ATT_OTHER_ZO)
  |  |  |  |  ------------------
  |  |  |  |  |  |   63|      6|#define ATT_ACIDIC_CO    0x0001
  |  |  |  |  ------------------
  |  |  |  |               #define ATTYP_OS    (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO /*| ATT_OTHER_NEG_O*/ | ATT_OTHER_ZO)
  |  |  |  |  ------------------
  |  |  |  |  |  |   64|      6|#define ATT_ACIDIC_S     0x0002
  |  |  |  |  ------------------
  |  |  |  |               #define ATTYP_OS    (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO /*| ATT_OTHER_NEG_O*/ | ATT_OTHER_ZO)
  |  |  |  |  ------------------
  |  |  |  |  |  |   65|      6|#define ATT_OO           0x0004
  |  |  |  |  ------------------
  |  |  |  |               #define ATTYP_OS    (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO /*| ATT_OTHER_NEG_O*/ | ATT_OTHER_ZO)
  |  |  |  |  ------------------
  |  |  |  |  |  |   66|      6|#define ATT_ZOO          0x0008
  |  |  |  |  ------------------
  |  |  |  |               #define ATTYP_OS    (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO /*| ATT_OTHER_NEG_O*/ | ATT_OTHER_ZO)
  |  |  |  |  ------------------
  |  |  |  |  |  |   67|      6|#define ATT_NO           0x0010
  |  |  |  |  ------------------
  |  |  |  |               #define ATTYP_OS    (ATT_ACIDIC_CO | ATT_ACIDIC_S | ATT_OO | ATT_ZOO | ATT_NO /*| ATT_OTHER_NEG_O*/ | ATT_OTHER_ZO)
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|      6|#define ATT_OTHER_ZO     0x0200   /* -Z=O or =Z=O */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  tg_H = CreateTGroupInBnStruct( at, num_atoms, pBNS, AA_HARD_TYP_H, AA_HARD_MSK_H );
  ------------------
  |  |  248|      6|#define AA_HARD_MSK_H     (ATBIT_MSK_NP | ATBIT_MSK_OS)
  |  |  ------------------
  |  |  |  |  163|      6|#define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|      6|#define ATBIT_NP_Plus    (1 << ATTOT_NUM_NP_Plus)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|      6|#define ATBIT_NP_Proton  (1 << ATTOT_NUM_NP_Proton)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |  118|      6|#define ATBIT_NP_H       (1 << ATTOT_NUM_NP_H)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |  119|      6|#define ATBIT_N_Minus    (1 << ATTOT_NUM_N_Minus)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_NP   (ATBIT_NP_Plus | ATBIT_NP_Proton | ATBIT_NP_H | ATBIT_N_Minus | ATBIT_NP)
  |  |  |  |  ------------------
  |  |  |  |  |  |  120|      6|#define ATBIT_NP         (1 << ATTOT_NUM_NP)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define AA_HARD_MSK_H     (ATBIT_MSK_NP | ATBIT_MSK_OS)
  |  |  ------------------
  |  |  |  |  165|      6|#define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  122|      6|#define ATBIT_COH        (1 << ATTOT_NUM_COH)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  123|      6|#define ATBIT_CSH        (1 << ATTOT_NUM_CSH)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  124|      6|#define ATBIT_ZOH        (1 << ATTOT_NUM_ZOH)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  125|      6|#define ATBIT_OOH        (1 << ATTOT_NUM_OOH)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|      6|#define ATBIT_ZOOH       (1 << ATTOT_NUM_ZOOH)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  127|      6|#define ATBIT_NOH        (1 << ATTOT_NUM_NOH)
  |  |  |  |  ------------------
  |  |  |  |               #define ATBIT_MSK_OS   (ATBIT_COH | ATBIT_CSH | ATBIT_ZOH | ATBIT_OOH | ATBIT_ZOOH | ATBIT_NOH | ATBIT_N_OH |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  128|      6|#define ATBIT_N_OH       (1 << ATTOT_NUM_N_OH)
  |  |  |  |  ------------------
  |  |  |  |  166|      6|                        ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|      6|#define ATBIT_CO         (1 << ATTOT_NUM_CO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  130|      6|#define ATBIT_ZO         (1 << ATTOT_NUM_ZO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  131|      6|#define ATBIT_NO         (1 << ATTOT_NUM_NO)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO | ATBIT_ZO  | ATBIT_NO | ATBIT_N_O |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  132|      6|#define ATBIT_N_O        (1 << ATTOT_NUM_N_O)
  |  |  |  |  ------------------
  |  |  |  |  167|      6|                        ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  133|      6|#define ATBIT_CO_Minus   (1 << ATTOT_NUM_CO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  134|      6|#define ATBIT_CS_Minus   (1 << ATTOT_NUM_CS_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  135|      6|#define ATBIT_ZO_Minus   (1 << ATTOT_NUM_ZO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_CO_Minus | ATBIT_CS_Minus | ATBIT_ZO_Minus | ATBIT_OO_Minus |\
  |  |  |  |  ------------------
  |  |  |  |  |  |  136|      6|#define ATBIT_OO_Minus   (1 << ATTOT_NUM_OO_Minus)
  |  |  |  |  ------------------
  |  |  |  |  168|      6|                        ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  137|      6|#define ATBIT_ZOO_Minus  (1 << ATTOT_NUM_ZOO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|      6|#define ATBIT_NO_Minus   (1 << ATTOT_NUM_NO_Minus)
  |  |  |  |  ------------------
  |  |  |  |                                       ATBIT_ZOO_Minus | ATBIT_NO_Minus | ATBIT_N_O_Minus /*| ATBIT_O_Minus*/ )
  |  |  |  |  ------------------
  |  |  |  |  |  |  139|      6|#define ATBIT_N_O_Minus  (1 << ATTOT_NUM_N_O_Minus)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4666|       |
 4667|      6|    if (cg_Minus_Other >= num_atoms && cg_Minus_CO >= num_atoms)
  ------------------
  |  Branch (4667:9): [True: 4, False: 2]
  |  Branch (4667:40): [True: 0, False: 4]
  ------------------
 4668|      0|    {
 4669|       |        /* Find alt path to remove one proton */
 4670|      0|        do
 4671|      0|        {
 4672|       |            /* Add a proton */
 4673|      0|            nPrevNumCharges = pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES];
 4674|      0|            ret = bExistsAltPath( pCG, pBNS, pBD, pAATG,
 4675|      0|                                  at, num_atoms,
 4676|      0|                                  cg_Minus_Other /*nVertDoubleBond*/,
 4677|      0|                                  cg_Minus_CO /*nVertSingleBond*/,
 4678|      0|                                  ALT_PATH_MODE_REM_PROTON );
  ------------------
  |  |  346|      0|#define ALT_PATH_MODE_REM_PROTON 9   /* remove proton, adjust bonds, charges, H-counts 2004-03-05 */
  ------------------
 4679|      0|            if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4680|      0|            {
 4681|      0|                return ret;
 4682|      0|            }
 4683|      0|            if (ret & 1)
  ------------------
  |  Branch (4683:17): [True: 0, False: 0]
  ------------------
 4684|      0|            {
 4685|      0|                nDelta = ( ret & ~3 ) >> 2;
 4686|      0|                nNumChanges += ( 0 != ( ret & 2 ) );
 4687|      0|                if (nDelta)
  ------------------
  |  Branch (4687:21): [True: 0, False: 0]
  ------------------
 4688|      0|                {
 4689|       |                    /* Radical pair has disappeared */
 4690|      0|                    ; /* goto quick_exit;*/
 4691|      0|                }
 4692|      0|                nNumMoved2AcidMinus++;
 4693|      0|                if (nPrevNumCharges > pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] + 1)
  ------------------
  |  Branch (4693:21): [True: 0, False: 0]
  ------------------
 4694|      0|                {
 4695|      0|                    nNumNeutralized += ( nPrevNumCharges - ( pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] - 1 ) ) / 2;
 4696|      0|                }
 4697|      0|            }
 4698|      0|        } while (( ret & 1 ) && nNumMoved2AcidMinus < num2add);
  ------------------
  |  Branch (4698:18): [True: 0, False: 0]
  |  Branch (4698:33): [True: 0, False: 0]
  ------------------
 4699|       |
 4700|       |        /* Neutralize: remove ion pairs like >N(+)=-O(-) => >N-=O */
 4701|      0|        if (( nNumMoved2AcidMinus /*|| bCancelChargesAlways*/ ) &&
  ------------------
  |  Branch (4701:13): [True: 0, False: 0]
  ------------------
 4702|      0|             cg_Minus_Other >= num_atoms && cg_Plus >= num_atoms &&
  ------------------
  |  Branch (4702:14): [True: 0, False: 0]
  |  Branch (4702:45): [True: 0, False: 0]
  ------------------
 4703|      0|             pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] > abs( pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] ))
  ------------------
  |  Branch (4703:14): [True: 0, False: 0]
  ------------------
 4704|      0|        {
 4705|      0|            do
 4706|      0|            {
 4707|      0|                nPrevNumCharges = pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES];
 4708|      0|                ret = bExistsAltPath( pCG, pBNS, pBD, pAATG,
 4709|      0|                                      at, num_atoms,
 4710|      0|                                      cg_Minus_Other /*nVertDoubleBond*/,
 4711|      0|                                      cg_Plus /*nVertSingleBond*/,
 4712|      0|                                      ALT_PATH_MODE_REM_PROTON );
  ------------------
  |  |  346|      0|#define ALT_PATH_MODE_REM_PROTON 9   /* remove proton, adjust bonds, charges, H-counts 2004-03-05 */
  ------------------
 4713|      0|                if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4714|      0|                {
 4715|      0|                    return ret;
 4716|      0|                }
 4717|      0|                if (ret & 1)
  ------------------
  |  Branch (4717:21): [True: 0, False: 0]
  ------------------
 4718|      0|                {
 4719|      0|                    nDelta = ( ret & ~3 ) >> 2;
 4720|      0|                    nNumChanges += ( 0 != ( ret & 2 ) );
 4721|      0|                    if (nDelta)
  ------------------
  |  Branch (4721:25): [True: 0, False: 0]
  ------------------
 4722|      0|                    {
 4723|       |                        /* Radical pair has disappeared */
 4724|      0|                        ; /* goto quick_exit;*/
 4725|      0|                    }
 4726|      0|                    if (nPrevNumCharges > pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES])
  ------------------
  |  Branch (4726:25): [True: 0, False: 0]
  ------------------
 4727|      0|                    {
 4728|      0|                        nNumNeutralized += ( nPrevNumCharges - pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] ) / 2;
 4729|      0|                    }
 4730|      0|                }
 4731|      0|            } while (ret & 1);
  ------------------
  |  Branch (4731:22): [True: 0, False: 0]
  ------------------
 4732|      0|        }
 4733|      0|    }
 4734|       |
 4735|      6|    ret = 0;
 4736|      6|    if (tg_H >= num_atoms)
  ------------------
  |  Branch (4736:9): [True: 4, False: 2]
  ------------------
 4737|      4|    {
 4738|      4|        ret2 = RemoveLastGroupFromBnStruct( at, num_atoms, tg_H, pBNS );
 4739|      4|        if (!ret && ret2)
  ------------------
  |  Branch (4739:13): [True: 4, False: 0]
  |  Branch (4739:21): [True: 0, False: 4]
  ------------------
 4740|      0|        {
 4741|      0|            ret = ret2;
 4742|      0|        }
 4743|      4|    }
 4744|      6|    if (cg_Minus_Other >= num_atoms)
  ------------------
  |  Branch (4744:9): [True: 4, False: 2]
  ------------------
 4745|      4|    {
 4746|      4|        ret2 = RemoveLastGroupFromBnStruct( at, num_atoms, cg_Minus_Other, pBNS );
 4747|      4|        if (!ret && ret2)
  ------------------
  |  Branch (4747:13): [True: 4, False: 0]
  |  Branch (4747:21): [True: 0, False: 4]
  ------------------
 4748|      0|        {
 4749|      0|            ret = ret2;
 4750|      0|        }
 4751|      4|    }
 4752|      6|    if (cg_Minus_CO >= num_atoms)
  ------------------
  |  Branch (4752:9): [True: 0, False: 6]
  ------------------
 4753|      0|    {
 4754|      0|        ret2 = RemoveLastGroupFromBnStruct( at, num_atoms, cg_Minus_CO, pBNS );
 4755|      0|        if (!ret && ret2)
  ------------------
  |  Branch (4755:13): [True: 0, False: 0]
  |  Branch (4755:21): [True: 0, False: 0]
  ------------------
 4756|      0|        {
 4757|      0|            ret = ret2;
 4758|      0|        }
 4759|      0|    }
 4760|      6|    if (cg_Plus >= num_atoms)
  ------------------
  |  Branch (4760:9): [True: 0, False: 6]
  ------------------
 4761|      0|    {
 4762|      0|        ret2 = RemoveLastGroupFromBnStruct( at, num_atoms, cg_Plus, pBNS );
 4763|      0|        if (!ret && ret2)
  ------------------
  |  Branch (4763:13): [True: 0, False: 0]
  |  Branch (4763:21): [True: 0, False: 0]
  ------------------
 4764|      0|        {
 4765|      0|            ret = ret2;
 4766|      0|        }
 4767|      0|    }
 4768|       |
 4769|      6|    pBNS->type_CN = 0;
 4770|      6|    pBNS->type_T = 0;
 4771|      6|    pBNS->type_TACN = 0;
 4772|       |
 4773|      6|    if (ret)
  ------------------
  |  Branch (4773:9): [True: 0, False: 6]
  ------------------
 4774|      0|    {
 4775|      0|        return ret;
 4776|      0|    }
 4777|       |
 4778|      6|    if (pAATG->nAtTypeTotals[ATTOT_NUM_CO_Minus] + pAATG->nAtTypeTotals[ATTOT_NUM_ZO_Minus] &&
  ------------------
  |  Branch (4778:9): [True: 0, False: 6]
  ------------------
 4779|      6|         pAATG->nAtTypeTotals[ATTOT_NUM_N_Minus])
  ------------------
  |  Branch (4779:10): [True: 0, False: 0]
  ------------------
 4780|      0|    {
 4781|      0|    }
 4782|       |
 4783|      6|    nPosCharges2 = ( pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] + pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] ) / 2;
 4784|      6|    nNegCharges2 = ( pAATG->nAtTypeTotals[ATTOT_NUM_CHARGES] - pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] ) / 2;
 4785|       |    /*
 4786|       |    nNumNP_H2    = pAATG->nAtTypeTotals[ATTOT_NUM_NP_H] +
 4787|       |    pAATG->nAtTypeTotals[ATTOT_NUM_NP_Proton];
 4788|       |    nNumOS_H2    = pAATG->nAtTypeTotals[ATTOT_NUM_COH] +
 4789|       |    pAATG->nAtTypeTotals[ATTOT_NUM_CSH] +
 4790|       |    pAATG->nAtTypeTotals[ATTOT_NUM_ZOH];
 4791|       |    */
 4792|       |
 4793|      6|    if (( nPosCharges - nNegCharges ) - ( nPosCharges2 - nNegCharges2 ) != 0)
  ------------------
  |  Branch (4793:9): [True: 0, False: 6]
  ------------------
 4794|      0|    {
 4795|      0|        return BNS_PROGRAM_ERR;
  ------------------
  |  |   78|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 4796|      0|    }
 4797|       |
 4798|      6|    if (nNumCanceledCharges)
  ------------------
  |  Branch (4798:9): [True: 6, False: 0]
  ------------------
 4799|      6|    {
 4800|       |#if ( FIX_CANCEL_CHARGE_COUNT_BUG == 1 )
 4801|       |        *nNumCanceledCharges += 2 * nNumNeutralized;
 4802|       |#else
 4803|      6|        *nNumCanceledCharges = 2 * nNumNeutralized;
 4804|      6|#endif
 4805|      6|    }
 4806|       |
 4807|      6|    return nNumMoved2AcidMinus;
 4808|      6|}
mark_at_type:
 5091|   110k|{
 5092|   110k|    int i, max_num_ions, mask, type;
 5093|       |    /*int max_protons, max_O_Minus, num_H = 0, num_CO=0;*/
 5094|       |
 5095|   110k|    if (nAtTypeTotals)
  ------------------
  |  Branch (5095:9): [True: 110k, False: 0]
  ------------------
 5096|   110k|    {
 5097|   110k|        memset( nAtTypeTotals, 0, ATTOT_ARRAY_LEN * sizeof( nAtTypeTotals[0] ) );
 5098|   110k|    }
 5099|       |
 5100|   222k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5100:17): [True: 112k, False: 110k]
  ------------------
 5101|   112k|    {
 5102|   112k|        type = GetAtomChargeType( atom, i, nAtTypeTotals, &mask, 0 );
 5103|   112k|        atom[i].at_type = type;
 5104|       |        /*
 5105|       |        num_H  += ((type & PR_HARD_TYP_H)  && (mask & ATBIT_MSK_H));
 5106|       |        num_CO += ((type & AR_HARD_TYP_HA) && (mask & AR_HARD_MSK_HA));
 5107|       |        */
 5108|   112k|    }
 5109|       |
 5110|   110k|    if (nAtTypeTotals)
  ------------------
  |  Branch (5110:9): [True: 110k, False: 0]
  ------------------
 5111|   110k|    {
 5112|       |        /*
 5113|       |        max_protons = nAtTypeTotals[ATTOT_NUM_NP_Proton] +
 5114|       |        inchi_min(num_H, nAtTypeTotals[ATTOT_NUM_NP_Plus]);
 5115|       |        max_O_Minus = nAtTypeTotals[ATTOT_NUM_CO_Minus] + nAtTypeTotals[ATTOT_NUM_CS_Minus] +
 5116|       |        nAtTypeTotals[ATTOT_NUM_ZO_Minus] + nAtTypeTotals[ATTOT_NUM_OO_Minus] +
 5117|       |        nAtTypeTotals[ATTOT_NUM_ZOO_Minus] + nAtTypeTotals[ATTOT_NUM_NO_Minus] +
 5118|       |        nAtTypeTotals[ATTOT_NUM_O_Minus] +nAtTypeTotals[ATTOT_NUM_N_Minus];
 5119|       |        ;
 5120|       |        max_num_ions = max_protons + max_O_Minus + nAtTypeTotals[ATTOT_NUM_CHARGES];
 5121|       |        */
 5122|   110k|        max_num_ions = nAtTypeTotals[ATTOT_NUM_CHARGES];
 5123|   110k|    }
 5124|      0|    else
 5125|      0|    {
 5126|      0|        max_num_ions = 0;
 5127|      0|    }
 5128|       |
 5129|   110k|    return max_num_ions;
 5130|   110k|}
RemoveNPProtonsAndAcidCharges:
 5140|      7|{
 5141|       |
 5142|       |    /* Prepare data structure */
 5143|      7|    int num;
 5144|      7|    int nNumCanceledCharges = 0;
 5145|      7|    int nNumHardRemovedProtons = 0;
 5146|      7|    int nNumHardRemovedAcidicProtons = 0;
 5147|      7|    T_GROUP_INFO *t_group_info = pAATG->t_group_info;
 5148|      7|    int ret = 0, bError = 0;
 5149|       |
 5150|      7|    int bAllowHardRemove = ( t_group_info->bTautFlags & TG_FLAG_TEST_TAUT__SALTS ) &&
  ------------------
  |  |  923|      7|#define TG_FLAG_TEST_TAUT__SALTS         0x00000004   /* DISCONNECT_SALTS if possible find long-range H/(-) taut. on =C-OH, >C=O    */
  ------------------
  |  Branch (5150:28): [True: 7, False: 0]
  ------------------
 5151|      7|        ( t_group_info->bTautFlags & TG_FLAG_TEST_TAUT2_SALTS ) &&
  ------------------
  |  |  925|      7|#define TG_FLAG_TEST_TAUT2_SALTS         0x00000010   /* TEST_REMOVE_S_ATOMS multi-attachement long-range H/(-) taut. on =C-OH, >C=O   */
  ------------------
  |  Branch (5151:9): [True: 7, False: 0]
  ------------------
 5152|      7|        ( t_group_info->bTautFlags & TG_FLAG_MOVE_POS_CHARGES ) &&
  ------------------
  |  |  924|      7|#define TG_FLAG_MOVE_POS_CHARGES         0x00000008   /* MOVE_CHARGES allow long-range movement of N(+), P(+) charges           */
  ------------------
  |  Branch (5152:9): [True: 7, False: 0]
  ------------------
 5153|      7|        ( t_group_info->bTautFlags & TG_FLAG_HARD_ADD_REM_PROTONS );
  ------------------
  |  |  939|      7|#define TG_FLAG_HARD_ADD_REM_PROTONS     0x00001000   /* add/remove protons to neutralize in hard way */
  ------------------
  |  Branch (5153:9): [True: 7, False: 0]
  ------------------
 5154|       |
 5155|      7|    if (pAATG->nMarkedAtom && num_atoms < pAATG->nAllocLen)
  ------------------
  |  Branch (5155:9): [True: 0, False: 7]
  |  Branch (5155:31): [True: 0, False: 0]
  ------------------
 5156|      0|    {
 5157|      0|        inchi_free( pAATG->nMarkedAtom );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 5158|      0|        qzfree( pAATG->nEndPoint );
  ------------------
  |  | 1160|      0|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 0, False: 0]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
 5159|      0|        memset( pAATG, 0, sizeof( *pAATG ) );
 5160|      0|    }
 5161|       |
 5162|      7|    if (!pAATG->nMarkedAtom && ( pAATG->nMarkedAtom = (S_CHAR *) inchi_malloc( num_atoms * sizeof( pAATG->nMarkedAtom[0] ) ) ))
  ------------------
  |  | 1130|      7|#define inchi_malloc   malloc
  ------------------
  |  Branch (5162:9): [True: 7, False: 0]
  |  Branch (5162:32): [True: 7, False: 0]
  ------------------
 5163|      7|    {
 5164|      7|        pAATG->nAllocLen = num_atoms;
 5165|      7|        pAATG->nNumFound = 0;
 5166|      7|    }
 5167|       |
 5168|       |    /* o TECHMAN-5.1. Remove protons from charged heteroatoms */
 5169|       |
 5170|       |    /* (TECHMAN-5.1a) Simple remove of protons from N, P, and O,S,Se,Te */
 5171|      7|    if (num = pAATG->nAtTypeTotals[ATTOT_NUM_NP_Proton] + pAATG->nAtTypeTotals[ATTOT_NUM_OH_Plus])
  ------------------
  |  Branch (5171:9): [True: 0, False: 7]
  ------------------
 5172|      0|    {
 5173|      0|        ret = SimpleRemoveHplusNPO( at, num_atoms, pAATG->nAtTypeTotals, t_group_info );
 5174|      0|        if (ret != num)
  ------------------
  |  Branch (5174:13): [True: 0, False: 0]
  ------------------
 5175|      0|        {
 5176|      0|            bError = BNS_PROGRAM_ERR;
  ------------------
  |  |   78|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 5177|      0|            goto exit_function;
 5178|      0|        }
 5179|       |        /*t_group_info->nNumRemovedProtons  += ret;*/
 5180|      0|        t_group_info->tni.bNormalizationFlags |= ( ret > 0 ) ? FLAG_PROTON_NPO_SIMPLE_REMOVED : 0;
  ------------------
  |  |  174|      0|#define FLAG_PROTON_NPO_SIMPLE_REMOVED 0x0001
  ------------------
  |  Branch (5180:50): [True: 0, False: 0]
  ------------------
 5181|      0|    }
 5182|       |
 5183|      7|    if (( num = pAATG->nAtTypeTotals[ATTOT_NUM_NP_Plus] ) && bAllowHardRemove)
  ------------------
  |  Branch (5183:9): [True: 0, False: 7]
  |  Branch (5183:62): [True: 0, False: 0]
  ------------------
 5184|      0|    {
 5185|       |        /* [TECHMAN-5.1b] Hard removing more protons from cationic N; charges may be canceled */
 5186|      0|        ret = HardRemoveHplusNP( pCG, at, num_atoms, 1, &nNumCanceledCharges, pAATG, pBNS, pBD );
 5187|      0|        if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 5188|      0|        {
 5189|      0|            bError = ret;
 5190|      0|            goto exit_function;
 5191|      0|        }
 5192|      0|        nNumHardRemovedProtons += ret;
 5193|       |        /*t_group_info->nNumRemovedProtons  += ret;*/
 5194|      0|        t_group_info->tni.bNormalizationFlags |= ( ret > 0 ) ? FLAG_PROTON_NP_HARD_REMOVED : 0;
  ------------------
  |  |  175|      0|#define FLAG_PROTON_NP_HARD_REMOVED    0x0002
  ------------------
  |  Branch (5194:50): [True: 0, False: 0]
  ------------------
 5195|      0|    }
 5196|       |
 5197|      7|    if (pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] > 0)
  ------------------
  |  Branch (5197:9): [True: 1, False: 6]
  ------------------
 5198|      1|    {
 5199|       |        /* o TECHMAN-5.2. Remove protons from neutral heteroatoms */
 5200|       |
 5201|       |        /* (TECHMAN-5.2a) Simple removal */
 5202|      1|        ret = SimpleRemoveAcidicProtons( at, num_atoms, pAATG, pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] );
 5203|      1|        if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      1|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      1|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      1|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      1|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 1, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 5204|      0|        {
 5205|      0|            bError = ret;
 5206|      0|            goto exit_function;
 5207|      0|        }
 5208|       |
 5209|       |        /*t_group_info->nNumRemovedProtons  += ret;*/
 5210|      1|        t_group_info->tni.bNormalizationFlags |= ( ret > 0 ) ? FLAG_PROTON_AC_SIMPLE_REMOVED : 0;
  ------------------
  |  |  177|      0|#define FLAG_PROTON_AC_SIMPLE_REMOVED  0x0008
  ------------------
  |  Branch (5210:50): [True: 0, False: 1]
  ------------------
 5211|       |
 5212|       |        
 5213|      1|        if (pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] > 0 && bAllowHardRemove)
  ------------------
  |  Branch (5213:13): [True: 1, False: 0]
  |  Branch (5213:59): [True: 1, False: 0]
  ------------------
 5214|      1|        {
 5215|       |            /* (TECHMAN-5.2b) Hard removal */
 5216|      1|            ret = HardRemoveAcidicProtons(pCG, at, num_atoms, pAATG, pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE], &nNumCanceledCharges, pBNS, pBD);
 5217|      1|            if (IS_BNS_ERROR(ret))
  ------------------
  |  |   95|      1|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      1|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      1|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      1|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 1, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 5218|      0|            {
 5219|      0|                bError = ret;
 5220|      0|                goto exit_function;
 5221|      0|            }
 5222|      1|            if (ret > 0)
  ------------------
  |  Branch (5222:17): [True: 0, False: 1]
  ------------------
 5223|      0|            {
 5224|      0|                int ret2 = SimpleRemoveAcidicProtons(at, num_atoms, pAATG, ret);
 5225|      0|                if (ret2 != ret)
  ------------------
  |  Branch (5225:21): [True: 0, False: 0]
  ------------------
 5226|      0|                {
 5227|      0|                    bError = BNS_PROGRAM_ERR;
  ------------------
  |  |   78|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 5228|      0|                    goto exit_function;
 5229|      0|                }
 5230|       |                /*t_group_info->nNumRemovedProtons  += ret;*/
 5231|      0|                t_group_info->tni.bNormalizationFlags |= (ret > 0) ? FLAG_PROTON_AC_HARD_REMOVED : 0;
  ------------------
  |  |  178|      0|#define FLAG_PROTON_AC_HARD_REMOVED    0x0010
  ------------------
  |  Branch (5231:58): [True: 0, False: 0]
  ------------------
 5232|      0|                nNumHardRemovedAcidicProtons += ret;
 5233|      0|            }
 5234|      1|        }
 5235|       |
 5236|       |
 5237|      1|    }
 5238|      6|    else
 5239|      6|    {
 5240|      6|        if (pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] < 0)
  ------------------
  |  Branch (5240:13): [True: 6, False: 0]
  ------------------
 5241|      6|        {
 5242|      6|            ret = SimpleAddAcidicProtons( at, num_atoms, pAATG, -pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] );
 5243|      6|            if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      6|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      6|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      6|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      6|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 6, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 6]
  |  |  ------------------
  ------------------
 5244|      0|            {
 5245|      0|                bError = ret;
 5246|      0|                goto exit_function;
 5247|      0|            }
 5248|       |            /*t_group_info->nNumRemovedProtons  -= ret;*/
 5249|       |            /*
 5250|       |            CHECK_TACN == 1 prohibits replacing (-) on N with H unless H can be moved to N
 5251|       |            along an alternating path from another heteroatom (t-group will be detected).
 5252|       |            */
 5253|      6|            t_group_info->tni.bNormalizationFlags |= ( ret > 0 ) ? FLAG_PROTON_AC_SIMPLE_ADDED : 0;
  ------------------
  |  |  176|      4|#define FLAG_PROTON_AC_SIMPLE_ADDED    0x0004
  ------------------
  |  Branch (5253:54): [True: 4, False: 2]
  ------------------
 5254|      6|            if (pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE] < 0 && bAllowHardRemove)
  ------------------
  |  Branch (5254:17): [True: 6, False: 0]
  |  Branch (5254:63): [True: 6, False: 0]
  ------------------
 5255|      6|            {
 5256|      6|                ret = HardAddAcidicProtons( pCG, at, num_atoms, pAATG, -pAATG->nAtTypeTotals[ATTOT_TOT_CHARGE], &nNumCanceledCharges, pBNS, pBD );
 5257|      6|                if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      6|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      6|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      6|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      6|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 6, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 6]
  |  |  ------------------
  ------------------
 5258|      0|                {
 5259|      0|                    bError = ret;
 5260|      0|                    goto exit_function;
 5261|      0|                }
 5262|      6|                if (ret > 0)
  ------------------
  |  Branch (5262:21): [True: 0, False: 6]
  ------------------
 5263|      0|                {
 5264|      0|                    int ret2 = SimpleAddAcidicProtons( at, num_atoms, pAATG, ret );
 5265|      0|                    if (ret2 != ret)
  ------------------
  |  Branch (5265:25): [True: 0, False: 0]
  ------------------
 5266|      0|                    {
 5267|      0|                        bError = BNS_PROGRAM_ERR;
  ------------------
  |  |   78|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 5268|      0|                        goto exit_function;
 5269|      0|                    }
 5270|       |                    /*t_group_info->nNumRemovedProtons  -= ret;*/
 5271|      0|                    t_group_info->tni.bNormalizationFlags |= ( ret > 0 ) ? FLAG_PROTON_AC_HARD_ADDED : 0;
  ------------------
  |  |  179|      0|#define FLAG_PROTON_AC_HARD_ADDED      0x0020
  ------------------
  |  Branch (5271:62): [True: 0, False: 0]
  ------------------
 5272|      0|                    nNumHardRemovedAcidicProtons -= ret;
 5273|      0|                }
 5274|      6|            }
 5275|      6|        }
 5276|      6|    }
 5277|       |
 5278|      7|    t_group_info->tni.bNormalizationFlags |= nNumCanceledCharges ? FLAG_PROTON_CHARGE_CANCEL : 0;
  ------------------
  |  |  180|      0|#define FLAG_PROTON_CHARGE_CANCEL      0x0040
  ------------------
  |  Branch (5278:46): [True: 0, False: 7]
  ------------------
 5279|       |
 5280|      7|exit_function:
 5281|      7|    if (bError)
  ------------------
  |  Branch (5281:9): [True: 0, False: 7]
  ------------------
 5282|      0|    {
 5283|      0|        ret = IS_BNS_ERROR( bError ) ? bError : BNS_PROGRAM_ERR;
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                      ret = IS_BNS_ERROR( bError ) ? bError : BNS_PROGRAM_ERR;
  ------------------
  |  |   78|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 5284|      0|    }
 5285|       |
 5286|      7|    return ret;
 5287|      7|}
mark_alt_bonds_and_taut_groups:
 5306|   110k|{
 5307|   110k|    BN_STRUCT *pBNS = NULL;
 5308|   110k|    BN_DATA   *pBD = NULL;
 5309|   110k|    int bError, nChanges, nTotChanges, taut_found, salt_found, taut_pass, salt_pass, salt_step, ret, ret2, num;
 5310|   110k|    int  nOrigDelta, num_changed_bonds;
 5311|   110k|    int max_altp = BN_MAX_ALTP;
  ------------------
  |  |   45|   110k|#define BN_MAX_ALTP  16
  ------------------
 5312|   110k|    int bChangeFlow = ( BNS_EF_CHNG_RSTR | BNS_EF_ALTR_BONDS );
  ------------------
  |  |  381|   110k|#define BNS_EF_CHNG_RSTR      (BNS_EF_CHNG_FLOW | BNS_EF_RSTR_FLOW)
  |  |  ------------------
  |  |  |  |  379|   110k|#define BNS_EF_CHNG_FLOW      1  /* change Balanced Network (BN) flow inside the BNS search */
  |  |  ------------------
  |  |               #define BNS_EF_CHNG_RSTR      (BNS_EF_CHNG_FLOW | BNS_EF_RSTR_FLOW)
  |  |  ------------------
  |  |  |  |  380|   110k|#define BNS_EF_RSTR_FLOW      2  /* undo BN flow changes after BNS */
  |  |  ------------------
  ------------------
                  int bChangeFlow = ( BNS_EF_CHNG_RSTR | BNS_EF_ALTR_BONDS );
  ------------------
  |  |  383|   110k|#define BNS_EF_ALTR_BONDS     8  /* make altern. bonds in the structure if the flow has changed */
  ------------------
 5313|   110k|    BNS_FLOW_CHANGES fcd[BNS_MAX_NUM_FLOW_CHANGES + 1];
 5314|   110k|    C_GROUP_INFO CGroupInfo;
 5315|   110k|    C_GROUP_INFO *c_group_info = &CGroupInfo;
 5316|   110k|    S_GROUP_INFO SGroupInfo;
 5317|   110k|    S_GROUP_INFO *s_group_info = &SGroupInfo;
 5318|   110k|    INCHI_MODE    *pbTautFlags = t_group_info ? &t_group_info->bTautFlags : inpbTautFlags;
  ------------------
  |  Branch (5318:34): [True: 110k, False: 3]
  ------------------
 5319|   110k|    INCHI_MODE    *pbTautFlagsDone = t_group_info ? &t_group_info->bTautFlagsDone : inpbTautFlagsDone;
  ------------------
  |  Branch (5319:38): [True: 110k, False: 3]
  ------------------
 5320|       |
 5321|   110k|    int nAtTypeTotals[ATTOT_ARRAY_LEN];
 5322|   110k|    int nNumOrigTotAtoms;
 5323|       |
 5324|   110k|    BN_AATG  aatg;
 5325|   110k|    BN_AATG *pAATG = &aatg;
 5326|       |
 5327|   110k|#ifdef FIX_AROM_RADICAL        /* Added 2011-05-09 IPl */
 5328|   110k|    int i, n_arom_radicals = 0, *stored_radicals = NULL;
 5329|   110k|#endif
 5330|       |
 5331|   110k|    nChanges = 0;
 5332|   110k|    bError = 0;
 5333|       |
 5334|   110k|    memset( c_group_info, 0, sizeof( *c_group_info ) );
 5335|   110k|    memset( s_group_info, 0, sizeof( *s_group_info ) );
 5336|   110k|    memset( pAATG, 0, sizeof( *pAATG ) );
 5337|       |
 5338|       |
 5339|   110k|#ifdef FIX_AROM_RADICAL        /* Added 2011-05-09 IPl */
 5340|   222k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5340:17): [True: 112k, False: 110k]
  ------------------
 5341|   112k|    {
 5342|   112k|        if (( at[i].radical == RADICAL_DOUBLET ) && ( at[i].valence == 2 ) &&
  ------------------
  |  |  104|   112k|#define RADICAL_DOUBLET 2
  ------------------
  |  Branch (5342:13): [True: 8, False: 112k]
  |  Branch (5342:53): [True: 6, False: 2]
  ------------------
 5343|   112k|            ( at[i].bond_type[0] == BOND_ALTERN ) && ( at[i].bond_type[1] == BOND_ALTERN ))
  ------------------
  |  |  208|      6|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   63|      6|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
                          ( at[i].bond_type[0] == BOND_ALTERN ) && ( at[i].bond_type[1] == BOND_ALTERN ))
  ------------------
  |  |  208|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   63|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (5343:13): [True: 0, False: 6]
  |  Branch (5343:54): [True: 0, False: 0]
  ------------------
 5344|      0|        {
 5345|      0|            n_arom_radicals++;
 5346|      0|            if (!stored_radicals)
  ------------------
  |  Branch (5346:17): [True: 0, False: 0]
  ------------------
 5347|      0|            {
 5348|      0|                stored_radicals = (int *) inchi_calloc( num_atoms, sizeof( int ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 5349|       |                /* 2011-08-05 explicit cast added due to Evan Bolton */
 5350|      0|                if (!stored_radicals)
  ------------------
  |  Branch (5350:21): [True: 0, False: 0]
  ------------------
 5351|      0|                {
 5352|      0|                    bError = BNS_OUT_OF_RAM;
  ------------------
  |  |   77|      0|#define BNS_OUT_OF_RAM     (BNS_ERR +  1) /*(-9998)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 5353|      0|                    goto exit_function;
 5354|      0|                }
 5355|      0|                stored_radicals[i] = RADICAL_DOUBLET;
  ------------------
  |  |  104|      0|#define RADICAL_DOUBLET 2
  ------------------
 5356|      0|                at[i].radical = 0;
 5357|      0|                at[i].num_H++;
 5358|      0|            }
 5359|      0|        }
 5360|   112k|    }
 5361|       |
 5362|   110k|#endif
 5363|       |
 5364|   110k|    if (( *pbTautFlags & TG_FLAG_MOVE_POS_CHARGES ) && num_atoms > 1)
  ------------------
  |  |  924|   110k|#define TG_FLAG_MOVE_POS_CHARGES         0x00000008   /* MOVE_CHARGES allow long-range movement of N(+), P(+) charges           */
  ------------------
  |  Branch (5364:9): [True: 110k, False: 0]
  |  Branch (5364:56): [True: 806, False: 109k]
  ------------------
 5365|    806|    {
 5366|       |        /* Charge groups memory allocation */
 5367|    806|        c_group_info->c_group = (C_GROUP *) inchi_calloc( num_atoms / 2, sizeof( c_group_info->c_group[0] ) );
  ------------------
  |  | 1133|    806|#define inchi_calloc   calloc
  ------------------
 5368|    806|        c_group_info->c_candidate = (C_CANDIDATE*) inchi_calloc( num_atoms, sizeof( c_group_info->c_candidate[0] ) );
  ------------------
  |  | 1133|    806|#define inchi_calloc   calloc
  ------------------
 5369|    806|        if (c_group_info->c_group && c_group_info->c_candidate)
  ------------------
  |  Branch (5369:13): [True: 806, False: 0]
  |  Branch (5369:38): [True: 806, False: 0]
  ------------------
 5370|    806|        {
 5371|    806|            c_group_info->max_num_c_groups = num_atoms / 2;
 5372|    806|            c_group_info->max_num_candidates = num_atoms;
 5373|    806|        }
 5374|      0|        else
 5375|      0|        {
 5376|      0|            bError = BNS_OUT_OF_RAM; /* error: out of RAM */
  ------------------
  |  |   77|      0|#define BNS_OUT_OF_RAM     (BNS_ERR +  1) /*(-9998)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 5377|       |                                     /*printf("BNS_OUT_OF_RAM-1: num_at=%d, c_gr=%lx c_can=%lx\n", num_atoms, c_group_info->c_group, c_group_info->c_candidate);*/
 5378|      0|            goto exit_function;
 5379|      0|        }
 5380|    806|    }
 5381|       |
 5382|   110k|    if (*pbTautFlags & TG_FLAG_TEST_TAUT__SALTS)
  ------------------
  |  |  923|   110k|#define TG_FLAG_TEST_TAUT__SALTS         0x00000004   /* DISCONNECT_SALTS if possible find long-range H/(-) taut. on =C-OH, >C=O    */
  ------------------
  |  Branch (5382:9): [True: 110k, False: 3]
  ------------------
 5383|   110k|    {
 5384|   110k|        if (t_group_info)
  ------------------
  |  Branch (5384:13): [True: 110k, False: 0]
  ------------------
 5385|   110k|        {
 5386|       |            /* Salt groups memory allocation */
 5387|   110k|            s_group_info->s_candidate =
 5388|   110k|                (S_CANDIDATE*) inchi_calloc( num_atoms,
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
 5389|   110k|                                             sizeof( s_group_info->s_candidate[0] ) );
 5390|   110k|            if (s_group_info->s_candidate)
  ------------------
  |  Branch (5390:17): [True: 110k, False: 0]
  ------------------
 5391|   110k|            {
 5392|   110k|                s_group_info->max_num_candidates = num_atoms;
 5393|   110k|            }
 5394|      0|            else
 5395|      0|            {
 5396|      0|                bError = BNS_OUT_OF_RAM; /* error: out of RAM */
  ------------------
  |  |   77|      0|#define BNS_OUT_OF_RAM     (BNS_ERR +  1) /*(-9998)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 5397|       |                                         /*printf("BNS_OUT_OF_RAM-2\n");*/
 5398|      0|                goto exit_function;
 5399|      0|            }
 5400|   110k|        }
 5401|   110k|    }
 5402|       |
 5403|   110k|    if (t_group_info)
  ------------------
  |  Branch (5403:9): [True: 110k, False: 3]
  ------------------
 5404|   110k|    {
 5405|   110k|        if (t_group_info->tGroupNumber)
  ------------------
  |  Branch (5405:13): [True: 0, False: 110k]
  ------------------
 5406|      0|        {
 5407|      0|            inchi_free( t_group_info->tGroupNumber );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 5408|      0|        }
 5409|   110k|        t_group_info->tGroupNumber = (AT_NUMB *) inchi_calloc( 2 * num_atoms + 1, sizeof( t_group_info->tGroupNumber[0] ) );
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
 5410|   110k|        if (!t_group_info->tGroupNumber)
  ------------------
  |  Branch (5410:13): [True: 0, False: 110k]
  ------------------
 5411|      0|        {
 5412|       |            /*printf("BNS_OUT_OF_RAM-9\n");*/
 5413|      0|            bError = BNS_OUT_OF_RAM; /* error: out of RAM */
  ------------------
  |  |   77|      0|#define BNS_OUT_OF_RAM     (BNS_ERR +  1) /*(-9998)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 5414|      0|            goto exit_function;
 5415|      0|        }
 5416|   110k|        num = t_group_info->tni.nNumRemovedExplicitH;
 5417|   110k|        memset( &t_group_info->tni, 0, sizeof( t_group_info->tni ) );
 5418|   110k|        t_group_info->tni.nNumRemovedExplicitH = num;
 5419|   110k|    }
 5420|       |
 5421|       |    /*
 5422|       |    again:
 5423|       |    */
 5424|       |
 5425|       |    /* Allocate Balanced Network Data Strucures; replace Alternating bonds with Single */
 5426|   110k|    if (( pBNS = AllocateAndInitBnStruct( at, num_atoms,
  ------------------
  |  Branch (5426:9): [True: 110k, False: 0]
  ------------------
 5427|   110k|                                          BNS_ADD_ATOMS, BNS_ADD_EDGES,
  ------------------
  |  |  116|   110k|#define BNS_ADD_ATOMS        2  /* max. number of fictitious atoms to add (except t-gtoups) */
  ------------------
                                                        BNS_ADD_ATOMS, BNS_ADD_EDGES,
  ------------------
  |  |  117|   110k|#define BNS_ADD_EDGES        1  /* max. number of edges to add to each atom (except edges to a t-group or c-group) */
  ------------------
 5428|   110k|                                          max_altp, &num_changed_bonds ) )
 5429|   110k|         &&
 5430|   110k|         ( pBD = AllocateAndInitBnData( pBNS->max_vertices ) ))
  ------------------
  |  Branch (5430:10): [True: 110k, False: 0]
  ------------------
 5431|   110k|    {
 5432|       |
 5433|       |
 5434|   110k|        pBNS->pbTautFlags = pbTautFlags;     /* carry through all functions */
 5435|   110k|        pBNS->pbTautFlagsDone = pbTautFlagsDone;  /* carry through all functions */
 5436|       |
 5437|   110k|        pBNS->ulTimeOutTime = ulTimeOutTime;    /* v. 1.05 */
 5438|   110k|        pBNS->ic = ic;    /* v. 1.05 */
 5439|       |
 5440|   110k|#if ( BNS_PROTECT_FROM_TAUT == 1 )
 5441|       |                          /* Protect bonds to acetyl and nitro */
 5442|   110k|        SetForbiddenEdges( pBNS, at, num_atoms, BNS_EDGE_FORBIDDEN_MASK, nebend, ebend );
  ------------------
  |  |   67|   110k|#define BNS_EDGE_FORBIDDEN_MASK  1
  ------------------
 5443|   110k|#endif
 5444|       |
 5445|       |        /* Set bonds in case of input "aromatic" bonds or multiple radicals */
 5446|   110k|#ifdef FIX_AROM_RADICAL        /* Added 2011-05-09 IPl */
 5447|   110k|        if (n_arom_radicals)
  ------------------
  |  Branch (5447:13): [True: 0, False: 110k]
  ------------------
 5448|      0|        {
 5449|      0|            ret = BnsAdjustFlowBondsRad( pBNS, pBD, at, num_atoms );
 5450|      0|            if (stored_radicals)
  ------------------
  |  Branch (5450:17): [True: 0, False: 0]
  ------------------
 5451|      0|            {
 5452|      0|                for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5452:29): [True: 0, False: 0]
  ------------------
 5453|      0|                {
 5454|      0|                    if (stored_radicals[i])
  ------------------
  |  Branch (5454:25): [True: 0, False: 0]
  ------------------
 5455|      0|                    {
 5456|      0|                        at[i].radical = stored_radicals[i];
 5457|      0|                        at[i].num_H--;
 5458|      0|                    }
 5459|      0|                }
 5460|      0|            }
 5461|      0|            if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 5462|      0|            {
 5463|      0|                bError = ret;
 5464|      0|                goto exit_function;
 5465|      0|            }
 5466|      0|        }
 5467|   110k|#endif
 5468|       |
 5469|   110k|        ret = BnsAdjustFlowBondsRad( pBNS, pBD, at, num_atoms );
 5470|       |
 5471|       |        /* (here pair(s) of radicals could have disappeared from the atoms) */
 5472|   110k|        if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|   110k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|   110k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|   110k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|   110k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 110k, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
 5473|      0|        {
 5474|      0|            bError = ret;
 5475|      0|            goto exit_function;
 5476|      0|        }
 5477|   110k|        pBNS->tot_st_flow += 2 * ret;
 5478|       |
 5479|       |        /*return 0;*/ /* debug */
 5480|   110k|        nOrigDelta = ret;
 5481|       |
 5482|   110k|        if (pBNS->tot_st_cap > pBNS->tot_st_flow)
  ------------------
  |  Branch (5482:13): [True: 6, False: 110k]
  ------------------
 5483|      6|        {
 5484|       |            /* has radical */
 5485|      6|            bChangeFlow |= BNS_EF_SET_NOSTEREO;
  ------------------
  |  |  386|      6|#define BNS_EF_SET_NOSTEREO  32  /* in combination with BNS_EF_ALTR_BONDS only:
  ------------------
 5486|      6|        }
 5487|       |
 5488|       |        /********************************************************************
 5489|       |        *  Remove protons from NH(+), but not PH(+)
 5490|       |        *  Add protons to COO(-) etc.
 5491|       |        *  or remove protons from COOH etc to make the organic part neutral
 5492|       |        *  Note: for now (-) from N(-) can be only canceled or moved to -C=O
 5493|       |        ********************************************************************/
 5494|   110k|        if (( *pbTautFlags & TG_FLAG_VARIABLE_PROTONS ) &&
  ------------------
  |  |  938|   110k|#define TG_FLAG_VARIABLE_PROTONS         0x00000800   /* add/remove protons to neutralize */
  ------------------
  |  Branch (5494:13): [True: 110k, False: 0]
  ------------------
 5495|   110k|             t_group_info &&
  ------------------
  |  Branch (5495:14): [True: 110k, False: 3]
  ------------------
 5496|   110k|             mark_at_type( at, num_atoms, nAtTypeTotals ) &&
  ------------------
  |  Branch (5496:14): [True: 7, False: 110k]
  ------------------
 5497|   110k|             nAtTypeTotals[ATTOT_NUM_CHARGES])
  ------------------
  |  Branch (5497:14): [True: 7, False: 0]
  ------------------
 5498|      7|        {
 5499|       |            /*
 5500|       |            the structure is simple to neutralize if it yields exactly
 5501|       |            num[H(+)]     = num[N,P H(+)]
 5502|       |            num[N,S,O(-)] = num[=C-O(-)] + num[C-S(-)] + num[N(-)] + num[other O(-), S(-)]
 5503|       |
 5504|       |            and n(p) = num[H(+)] - num[N,S,O(-)] (no protons, no negative N,O,S condition)
 5505|       |
 5506|       |            Additional check is needed if:
 5507|       |            min{num[N,PH], num[N,P(+), not onium]} > 0
 5508|       |            => possibility to yield more H(+)
 5509|       |
 5510|       |            min_charge = orig_charge(P,N,O,S) - n(p) - n(OH,SH)
 5511|       |            max_charge = orig_charge(P,N,O,S) - n(p) + n(O,S,N(-))
 5512|       |            */
 5513|       |
 5514|      7|            nNumOrigTotAtoms = t_group_info->tni.nNumRemovedExplicitH + num_atoms;
 5515|      7|            pAATG->nAtTypeTotals = nAtTypeTotals;
 5516|      7|            pAATG->t_group_info = t_group_info;
 5517|       |#if ( RESET_EDGE_FORBIDDEN_MASK == 0 )
 5518|       |            pBNS->edge_forbidden_mask |= BNS_EDGE_FORBIDDEN_TEMP;
 5519|       |#endif
 5520|       |
 5521|       |            /***********************************************************/
 5522|       |            /*                                                         */
 5523|       |            /*          ( D E ) P R O T O N A T I O N                  */
 5524|       |            /*                                                         */
 5525|       |            /***********************************************************/
 5526|       |
 5527|      7|            ret = RemoveNPProtonsAndAcidCharges( pCG, at, num_atoms, pAATG, pBNS, pBD );
 5528|       |
 5529|       |#if ( RESET_EDGE_FORBIDDEN_MASK == 0 )
 5530|       |            pBNS->edge_forbidden_mask &= ~BNS_EDGE_FORBIDDEN_TEMP;
 5531|       |#endif
 5532|      7|            if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      7|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      7|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      7|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      7|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 7, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 7]
  |  |  ------------------
  ------------------
 5533|      0|            {
 5534|      0|                bError = ret;
 5535|      0|                goto exit_function;
 5536|      0|            }
 5537|       |
 5538|      7|            if (t_group_info->tni.bNormalizationFlags)
  ------------------
  |  Branch (5538:17): [True: 4, False: 3]
  ------------------
 5539|      4|            {
 5540|      4|                SetInitCapFlowToCurrent( pBNS );
 5541|      4|                if (at_fixed_bonds_out)
  ------------------
  |  Branch (5541:21): [True: 4, False: 0]
  ------------------
 5542|      4|                {
 5543|       |                    /* Copy modified initial tautomeric structure for displaying
 5544|       |                    Warning: implicit H counts in at_fixed_bonds_out include explicit Hs */
 5545|       |
 5546|      4|                    memcpy( at_fixed_bonds_out, at, nNumOrigTotAtoms * sizeof( at_fixed_bonds_out[0] ) );
 5547|       |
 5548|       |                    /* -- will be done in FillOutInputInfAtom() --
 5549|       |                    RemoveExcessiveImplicitH( num_atoms, t_group_info->tni.nNumRemovedExplicitH, at_fixed_bonds_out );
 5550|       |                    */
 5551|      4|                }
 5552|      4|            }
 5553|      7|        }
 5554|       |
 5555|       |        /****************** Initial bonds normalization ***************/
 5556|       |
 5557|   110k|        if (*pbTautFlags & TG_FLAG_MOVE_POS_CHARGES)
  ------------------
  |  |  924|   110k|#define TG_FLAG_MOVE_POS_CHARGES         0x00000008   /* MOVE_CHARGES allow long-range movement of N(+), P(+) charges           */
  ------------------
  |  Branch (5557:13): [True: 110k, False: 0]
  ------------------
 5558|   110k|        {
 5559|       |            /******************* Find moveable positive charges **********************/
 5560|   110k|            do
 5561|   110k|            {
 5562|       |                /* Cycling while ret>0 added 2004-06-04 */
 5563|       |#if ( RESET_EDGE_FORBIDDEN_MASK == 0 )
 5564|       |                pBNS->edge_forbidden_mask |= BNS_EDGE_FORBIDDEN_TEMP;
 5565|       |                CorrectFixing_NH_NH_Bonds( pBNS, at, num_atoms );
 5566|       |#endif
 5567|   110k|                ret = MarkChargeGroups( pCG, at, num_atoms,
 5568|   110k|                                        c_group_info, t_group_info,
 5569|   110k|                                        pBNS, pBD );
 5570|       |
 5571|       |#if ( RESET_EDGE_FORBIDDEN_MASK == 0 )
 5572|       |                pBNS->edge_forbidden_mask &= ~BNS_EDGE_FORBIDDEN_TEMP;
 5573|       |#endif
 5574|   110k|                if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|   110k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|   110k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|   110k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|   110k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 110k, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
 5575|      0|                {
 5576|      0|                    bError = ret;
 5577|      0|                    goto exit_function;
 5578|      0|                }
 5579|   110k|                if (ret)
  ------------------
  |  Branch (5579:21): [True: 0, False: 110k]
  ------------------
 5580|      0|                {
 5581|      0|                    nChanges += ret;
 5582|      0|                    ret2 = AddCGroups2BnStruct( pCG, pBNS, at, num_atoms, c_group_info );
 5583|      0|                    if (IS_BNS_ERROR( ret2 ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 5584|      0|                    {
 5585|      0|                        bError = ret2;
 5586|      0|                        goto exit_function;
 5587|      0|                    }
 5588|      0|                    *pbTautFlagsDone |= TG_FLAG_MOVE_POS_CHARGES_DONE;
  ------------------
  |  |  963|      0|#define TG_FLAG_MOVE_POS_CHARGES_DONE    0x00000010
  ------------------
 5589|      0|                }
 5590|   110k|            } while (ret > 0);
  ------------------
  |  Branch (5590:22): [True: 0, False: 110k]
  ------------------
 5591|       |
 5592|       |
 5593|   110k|#if ( BNS_RAD_SEARCH == 1 )
 5594|       |#else
 5595|       |            /* moveable charges may allow to cancel radicals -- check it */
 5596|       |            if (pBNS->tot_st_cap > pBNS->tot_st_flow)
 5597|       |            {
 5598|       |                ret = BnsAdjustFlowBondsRad( pBNS, pBD, at, num_atoms );
 5599|       |                if (IS_BNS_ERROR( ret ))
 5600|       |                {
 5601|       |                    bError = ret;
 5602|       |                    goto exit_function;
 5603|       |                }
 5604|       |                if (ret > 0)
 5605|       |                {
 5606|       |                    /*
 5607|       |                    pBNS->tot_st_flow += 2*ret;
 5608|       |                    ret = ReInitBnStruct( pBNS, at, num_atoms, 1 );
 5609|       |                    if ( IS_BNS_ERROR( ret ) ) {
 5610|       |                    bError = ret;
 5611|       |                    goto exit_function;
 5612|       |                    }
 5613|       |                    */
 5614|       |                    bError = BNS_RADICAL_ERR;
 5615|       |                    goto exit_function;
 5616|       |                }
 5617|       |            }
 5618|       |#endif
 5619|   110k|        }
 5620|       |
 5621|       |        /************************************************************************/
 5622|       |        /********          Test bonds for bond tautomerism         **************/
 5623|       |        /******** replace moveable bonds with "alternating" bonds  **************/
 5624|       |        /************************************************************************/
 5625|   110k|        ret = BnsTestAndMarkAltBonds( pBNS, pBD, at, num_atoms, fcd, bChangeFlow, 0 );
 5626|       |
 5627|   110k|        if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|   110k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|   110k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|   110k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|   110k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 110k, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
 5628|      0|        {
 5629|      0|            bError = ret;
 5630|      0|            goto exit_function;
 5631|      0|        }
 5632|   110k|        nChanges += ret;
 5633|       |
 5634|       |        /*********************** End of initial bonds normalization *************/
 5635|       |
 5636|   110k|        nTotChanges = 0;
 5637|       |
 5638|       |        /* Check for tautomerism */
 5639|       |        /* find new tautomer groups */
 5640|   110k|        salt_pass = 0;
 5641|   110k|        salt_step = 0;
 5642|   110k|        salt_found = 0;
 5643|       |
 5644|       |        /*************************************************************/
 5645|       |        /*                                                           */
 5646|       |        /*           M A I N   C Y C L E   B E G I N                 */
 5647|       |        /*                                                           */
 5648|       |        /*************************************************************/
 5649|       |
 5650|   110k|        do
 5651|   110k|        {
 5652|   110k|            nTotChanges += nChanges;
 5653|   110k|            nChanges = 0;
 5654|   110k|            taut_pass = 0;
 5655|       |
 5656|       |            /**************** Regular bond/H/(-)/positive charges tautomerism cycle begin **************/
 5657|   110k|            do
 5658|   110k|            {
 5659|   110k|                taut_pass++;
 5660|   110k|                for (taut_found = 0;
 5661|   110k|                      0 < ( ret = MarkTautomerGroups( pCG, at, num_atoms,
  ------------------
  |  Branch (5661:23): [True: 0, False: 110k]
  ------------------
 5662|   110k|                                                      t_group_info, c_group_info,
 5663|   110k|                                                      pBNS, pBD ) );
 5664|   110k|                      taut_found++)
 5665|      0|                {
 5666|      0|                    ;
 5667|      0|                }
 5668|   110k|                if (ret < 0)
  ------------------
  |  Branch (5668:21): [True: 0, False: 110k]
  ------------------
 5669|      0|                {
 5670|      0|                    bError = ret;
 5671|      0|                }
 5672|   110k|                if (taut_found && !salt_pass)
  ------------------
  |  Branch (5672:21): [True: 0, False: 110k]
  |  Branch (5672:35): [True: 0, False: 0]
  ------------------
 5673|      0|                {
 5674|      0|                    *pbTautFlagsDone |= TG_FLAG_TEST_TAUT__ATOMS_DONE;
  ------------------
  |  |  960|      0|#define TG_FLAG_TEST_TAUT__ATOMS_DONE    0x00000002
  ------------------
 5675|      0|                }
 5676|       |
 5677|   110k|                if (taut_found || salt_found)
  ------------------
  |  Branch (5677:21): [True: 0, False: 110k]
  |  Branch (5677:35): [True: 0, False: 110k]
  ------------------
 5678|      0|                {
 5679|       |                    /****************** repeat bonds normalization ***************/
 5680|      0|                    ret = ReInitBnStructAddGroups( pCG, pBNS, at, num_atoms,
 5681|      0|                                                   t_group_info, c_group_info );
 5682|      0|                    if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 5683|      0|                    {
 5684|      0|                        bError = ret;
 5685|      0|                        goto exit_function;
 5686|      0|                    }
 5687|      0|#if ( BNS_RAD_SEARCH == 1 )
 5688|       |#else
 5689|       |                    /* discovered moveable charges and H-atoms may allow to cancel radicals */
 5690|       |                    if (pBNS->tot_st_cap > pBNS->tot_st_flow)
 5691|       |                    {
 5692|       |                        ret = BnsAdjustFlowBondsRad( pBNS, pBD, at, num_atoms );
 5693|       |                        if (IS_BNS_ERROR( ret ))
 5694|       |                        {
 5695|       |                            bError = ret;
 5696|       |                            goto exit_function;
 5697|       |                        }
 5698|       |                        if (ret > 0)
 5699|       |                        {
 5700|       |                            /*
 5701|       |                            pBNS->tot_st_flow += 2*ret;
 5702|       |                            ret = ReInitBnStruct( pBNS, at, num_atoms, 1 );
 5703|       |                            if ( IS_BNS_ERROR( ret ) ) {
 5704|       |                            bError = ret;
 5705|       |                            goto exit_function;
 5706|       |                            }
 5707|       |                            */
 5708|       |                            bError = BNS_RADICAL_ERR;
 5709|       |                            goto exit_function;
 5710|       |                        }
 5711|       |                    }
 5712|       |#endif
 5713|       |                    /****************** Update bonds normalization ***************/
 5714|      0|                    if (*pbTautFlags & TG_FLAG_MOVE_POS_CHARGES)
  ------------------
  |  |  924|      0|#define TG_FLAG_MOVE_POS_CHARGES         0x00000008   /* MOVE_CHARGES allow long-range movement of N(+), P(+) charges           */
  ------------------
  |  Branch (5714:25): [True: 0, False: 0]
  ------------------
 5715|      0|                    {
 5716|       |                        /******************* Find moveable charges ***************/
 5717|      0|                        do
 5718|      0|                        {
 5719|       |                            /* Cycling while ret>0 added 2004-06-04 */
 5720|       |#if ( RESET_EDGE_FORBIDDEN_MASK == 0 )
 5721|       |                            pBNS->edge_forbidden_mask |= BNS_EDGE_FORBIDDEN_TEMP;
 5722|       |                            CorrectFixing_NH_NH_Bonds( pBNS, at, num_atoms );
 5723|       |#endif
 5724|       |
 5725|      0|                            ret = MarkChargeGroups( pCG, at, num_atoms,
 5726|      0|                                                    c_group_info, t_group_info,
 5727|      0|                                                    pBNS, pBD );
 5728|       |#if ( RESET_EDGE_FORBIDDEN_MASK == 0 )
 5729|       |                            pBNS->edge_forbidden_mask &= ~BNS_EDGE_FORBIDDEN_TEMP;
 5730|       |#endif
 5731|      0|                            if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 5732|      0|                            {
 5733|      0|                                bError = ret;
 5734|      0|                                goto exit_function;
 5735|      0|                            }
 5736|      0|                            nChanges += ret;
 5737|      0|                            if (ret > 0)
  ------------------
  |  Branch (5737:33): [True: 0, False: 0]
  ------------------
 5738|      0|                            {
 5739|      0|                                ret2 = ReInitBnStructAddGroups( pCG, pBNS,
 5740|      0|                                                                at, num_atoms,
 5741|      0|                                                                t_group_info,
 5742|      0|                                                                c_group_info );
 5743|      0|                                if (IS_BNS_ERROR( ret2 ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 5744|      0|                                {
 5745|      0|                                    bError = ret2;
 5746|      0|                                    goto exit_function;
 5747|      0|                                }
 5748|      0|                                *pbTautFlagsDone |= TG_FLAG_MOVE_POS_CHARGES_DONE;
  ------------------
  |  |  963|      0|#define TG_FLAG_MOVE_POS_CHARGES_DONE    0x00000010
  ------------------
 5749|      0|                            }
 5750|      0|                        } while (ret > 0);
  ------------------
  |  Branch (5750:34): [True: 0, False: 0]
  ------------------
 5751|      0|                    }
 5752|       |
 5753|       |                    /************************************************************************/
 5754|       |                    /********             Find moveable bonds:                 **************/
 5755|       |                    /********          test bonds for bond tautomerism         **************/
 5756|       |                    /******** replace moveable bonds with "alternating" bonds  **************/
 5757|       |                    /************************************************************************/
 5758|      0|                    ret = BnsTestAndMarkAltBonds( pBNS, pBD, at, num_atoms, fcd, bChangeFlow, 0 );
 5759|      0|                    if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 5760|      0|                    {
 5761|      0|                        bError = ret;
 5762|      0|                        goto exit_function;
 5763|      0|                    }
 5764|      0|                    nChanges += ret;
 5765|       |                    /****************** End of update bonds normalization ***************/
 5766|       |
 5767|      0|                }
 5768|   110k|                salt_found = 0;
 5769|   110k|            } while (taut_found && !bError);
  ------------------
  |  Branch (5769:22): [True: 0, False: 110k]
  |  Branch (5769:36): [True: 0, False: 0]
  ------------------
 5770|       |
 5771|       |
 5772|       |            /**************** Regular bond/H/(-)/positive charges tautomerism cycle end **************/
 5773|       |
 5774|   110k|            if (bError)
  ------------------
  |  Branch (5774:17): [True: 0, False: 110k]
  ------------------
 5775|      0|            {
 5776|      0|                break;
 5777|      0|            }
 5778|       |
 5779|       |
 5780|       |            /******************* 'Salt' tautomerism permitted *************************/
 5781|   110k|            if (*pbTautFlags & TG_FLAG_TEST_TAUT__SALTS)
  ------------------
  |  |  923|   110k|#define TG_FLAG_TEST_TAUT__SALTS         0x00000004   /* DISCONNECT_SALTS if possible find long-range H/(-) taut. on =C-OH, >C=O    */
  ------------------
  |  Branch (5781:17): [True: 110k, False: 3]
  ------------------
 5782|   110k|            {
 5783|       |
 5784|   110k|                if (*pbTautFlags & TG_FLAG_TEST_TAUT2_SALTS)
  ------------------
  |  |  925|   110k|#define TG_FLAG_TEST_TAUT2_SALTS         0x00000010   /* TEST_REMOVE_S_ATOMS multi-attachement long-range H/(-) taut. on =C-OH, >C=O   */
  ------------------
  |  Branch (5784:21): [True: 110k, False: 0]
  ------------------
 5785|   110k|                {
 5786|       |                    /*********** Requested one or more "salt" attachement migrartion test ********/
 5787|   110k|                    if (!nChanges && salt_pass && salt_step)
  ------------------
  |  Branch (5787:25): [True: 110k, False: 0]
  |  Branch (5787:38): [True: 0, False: 110k]
  |  Branch (5787:51): [True: 0, False: 0]
  ------------------
 5788|      0|                    {
 5789|      0|                        break;  /* done */
 5790|      0|                    }
 5791|   110k|                    if (!salt_step)
  ------------------
  |  Branch (5791:25): [True: 110k, False: 0]
  ------------------
 5792|   110k|                    {
 5793|       |                        /* Salt step 0: process one attachment migrartion */
 5794|       |#if ( RESET_EDGE_FORBIDDEN_MASK == 0 )
 5795|       |                        pBNS->edge_forbidden_mask |= BNS_EDGE_FORBIDDEN_TEMP;
 5796|       |                        CorrectFixing_NH_NH_Bonds( pBNS, at, num_atoms );
 5797|       |#endif
 5798|   110k|                        salt_found = MarkSaltChargeGroups( pCG, at, num_atoms,
 5799|   110k|                                                           s_group_info,
 5800|   110k|                                                           t_group_info,
 5801|   110k|                                                           c_group_info,
 5802|   110k|                                                           pBNS, pBD );
 5803|       |#if ( RESET_EDGE_FORBIDDEN_MASK == 0 )
 5804|       |                        pBNS->edge_forbidden_mask &= ~BNS_EDGE_FORBIDDEN_TEMP;
 5805|       |#endif
 5806|   110k|                        if (salt_found < 0)
  ------------------
  |  Branch (5806:29): [True: 0, False: 110k]
  ------------------
 5807|      0|                        {
 5808|      0|                            bError = salt_found;
 5809|      0|                            break;
 5810|      0|                        }
 5811|   110k|                        else
 5812|   110k|                        {
 5813|   110k|                            if (salt_found > 0)
  ------------------
  |  Branch (5813:33): [True: 0, False: 110k]
  ------------------
 5814|      0|                            {
 5815|      0|                                *pbTautFlagsDone |= TG_FLAG_TEST_TAUT__SALTS_DONE;
  ------------------
  |  |  962|      0|#define TG_FLAG_TEST_TAUT__SALTS_DONE    0x00000008   /* multiple H tautomerism */
  ------------------
 5816|      0|                            }
 5817|   110k|                        }
 5818|   110k|                        salt_step = !salt_found;
 5819|       |                        /* if new 'salt' atoms have been found then repeat regular taut. search
 5820|       |                        *      MarkTautomerGroups() and do not perform salt step 1
 5821|       |                        * if new 'salt' atoms have NOT been found then switch to salt step 1
 5822|       |                        *      and never repeat salt step 0 for the current structure
 5823|       |                        */
 5824|   110k|                    }
 5825|       |
 5826|   110k|                    if (salt_step /*||
  ------------------
  |  Branch (5826:25): [True: 110k, False: 0]
  ------------------
 5827|   110k|                                  (t_group_info->tni.bNormalizationFlags & FLAG_NORM_CONSIDER_TAUT)*/)
 5828|   110k|                    {
 5829|       |                        /* Salt step 1: process more than one attachment migration */
 5830|       |#if ( RESET_EDGE_FORBIDDEN_MASK == 0 )
 5831|       |                        pBNS->edge_forbidden_mask |= BNS_EDGE_FORBIDDEN_TEMP;
 5832|       |                        CorrectFixing_NH_NH_Bonds( pBNS, at, num_atoms );
 5833|       |#endif
 5834|   110k|                        salt_found = MarkSaltChargeGroups2( pCG, at, num_atoms,
 5835|   110k|                                                            s_group_info,
 5836|   110k|                                                            t_group_info,
 5837|   110k|                                                            c_group_info,
 5838|   110k|                                                            pBNS, pBD );
 5839|       |#if ( RESET_EDGE_FORBIDDEN_MASK == 0 )
 5840|       |                        pBNS->edge_forbidden_mask &= ~BNS_EDGE_FORBIDDEN_TEMP;
 5841|       |#endif
 5842|   110k|                        if (salt_found < 0)
  ------------------
  |  Branch (5842:29): [True: 0, False: 110k]
  ------------------
 5843|      0|                        {
 5844|      0|                            bError = salt_found;
 5845|      0|                            break;
 5846|      0|                        }
 5847|   110k|                        else
 5848|   110k|                        {
 5849|   110k|                            if (salt_found == 1 || salt_found == 5)
  ------------------
  |  Branch (5849:33): [True: 0, False: 110k]
  |  Branch (5849:52): [True: 0, False: 110k]
  ------------------
 5850|      0|                            {
 5851|      0|                                *pbTautFlagsDone |= TG_FLAG_TEST_TAUT2_SALTS_DONE;
  ------------------
  |  |  964|      0|#define TG_FLAG_TEST_TAUT2_SALTS_DONE    0x00000020   /* merged t-groups */
  ------------------
 5852|      0|                                if (salt_found == 5)
  ------------------
  |  Branch (5852:37): [True: 0, False: 0]
  ------------------
 5853|      0|                                {
 5854|      0|                                    *pbTautFlagsDone |= TG_FLAG_TEST_TAUT3_SALTS_DONE;
  ------------------
  |  |  976|      0|#define TG_FLAG_TEST_TAUT3_SALTS_DONE    0x00001000   /* merged t-groups + non-O taut atoms */
  ------------------
 5855|      0|                                }
 5856|       |                                /* salt_found == 2 => only negative charges involved */
 5857|      0|                            }
 5858|   110k|                        }
 5859|   110k|                    }
 5860|       |
 5861|   110k|                    salt_pass++;
 5862|   110k|                }
 5863|      0|                else
 5864|      0|                {
 5865|       |                    /* !( *pbTautFlags & TG_FLAG_TEST_TAUT2_SALTS ) */
 5866|       |                    /*************** Requested only one attachement migration test **********/
 5867|      0|                    if (!nChanges && salt_pass)
  ------------------
  |  Branch (5867:25): [True: 0, False: 0]
  |  Branch (5867:38): [True: 0, False: 0]
  ------------------
 5868|      0|                    {
 5869|       |                        /* One attachment migration */
 5870|      0|                        break;
 5871|      0|                    }
 5872|       |                    /* Salt step 0: process one attachment migration */
 5873|       |#if ( RESET_EDGE_FORBIDDEN_MASK == 0 )
 5874|       |                    pBNS->edge_forbidden_mask |= BNS_EDGE_FORBIDDEN_TEMP;
 5875|       |                    CorrectFixing_NH_NH_Bonds( pBNS, at, num_atoms );
 5876|       |#endif
 5877|      0|                    salt_found = MarkSaltChargeGroups( pCG, at, num_atoms,
 5878|      0|                                                       s_group_info,
 5879|      0|                                                       t_group_info,
 5880|      0|                                                       c_group_info,
 5881|      0|                                                       pBNS, pBD );
 5882|       |#if ( RESET_EDGE_FORBIDDEN_MASK == 0 )
 5883|       |                    pBNS->edge_forbidden_mask &= ~BNS_EDGE_FORBIDDEN_TEMP;
 5884|       |#endif
 5885|      0|                    if (salt_found < 0)
  ------------------
  |  Branch (5885:25): [True: 0, False: 0]
  ------------------
 5886|      0|                    {
 5887|      0|                        bError = salt_found;
 5888|      0|                        break;
 5889|      0|                    }
 5890|      0|                    else
 5891|      0|                    {
 5892|      0|                        if (salt_found > 0)
  ------------------
  |  Branch (5892:29): [True: 0, False: 0]
  ------------------
 5893|      0|                        {
 5894|      0|                            *pbTautFlagsDone |= TG_FLAG_TEST_TAUT__SALTS_DONE;
  ------------------
  |  |  962|      0|#define TG_FLAG_TEST_TAUT__SALTS_DONE    0x00000008   /* multiple H tautomerism */
  ------------------
 5895|      0|                        }
 5896|      0|                    }
 5897|      0|                    salt_pass++;
 5898|      0|                } /* ( *pbTautFlags & TG_FLAG_TEST_TAUT2_SALTS ) */
 5899|   110k|            } /* ( *pbTautFlags & TG_FLAG_TEST_TAUT__SALTS ) */
 5900|   110k|        } while (salt_found && !bError);
  ------------------
  |  Branch (5900:18): [True: 0, False: 110k]
  |  Branch (5900:32): [True: 0, False: 0]
  ------------------
 5901|       |
 5902|       |        /*************************************************************/
 5903|       |        /*                                                           */
 5904|       |        /*           M A I N   C Y C L E   E N D                     */
 5905|       |        /*                                                           */
 5906|       |        /*************************************************************/
 5907|       |
 5908|       |
 5909|   110k|        if (*pbTautFlags & TG_FLAG_MERGE_TAUT_SALTS)
  ------------------
  |  |  927|   110k|#define TG_FLAG_MERGE_TAUT_SALTS         0x00000040   /* DISCONNECT_SALTS merge all "salt"-t-groups and other =C-OH into one t-group */
  ------------------
  |  Branch (5909:13): [True: 110k, False: 3]
  ------------------
 5910|   110k|        {
 5911|   110k|            if (!bError && s_group_info /*&& s_group_info->num_candidates > 0*/)
  ------------------
  |  Branch (5911:17): [True: 110k, False: 0]
  |  Branch (5911:28): [True: 110k, False: 0]
  ------------------
 5912|   110k|            {
 5913|   110k|                ret = MergeSaltTautGroups( pCG, at, num_atoms, s_group_info,
 5914|   110k|                                           t_group_info, c_group_info, pBNS );
 5915|   110k|                if (ret < 0)
  ------------------
  |  Branch (5915:21): [True: 0, False: 110k]
  ------------------
 5916|      0|                {
 5917|      0|                    bError = ret;
 5918|      0|                }
 5919|   110k|                else
 5920|   110k|                {
 5921|   110k|                    if (ret > 0)
  ------------------
  |  Branch (5921:25): [True: 4, False: 110k]
  ------------------
 5922|      4|                    {
 5923|      4|                        *pbTautFlagsDone |= TG_FLAG_MERGE_TAUT_SALTS_DONE;
  ------------------
  |  |  966|      4|#define TG_FLAG_MERGE_TAUT_SALTS_DONE    0x00000080   /* added non-taut O to taut groups */
  ------------------
 5924|      4|                    }
 5925|   110k|                }
 5926|   110k|            }
 5927|   110k|        }
 5928|       |
 5929|   110k|        if (!bError && t_group_info &&
  ------------------
  |  Branch (5929:13): [True: 110k, False: 0]
  |  Branch (5929:24): [True: 110k, False: 3]
  ------------------
 5930|   110k|            ( t_group_info->bTautFlags & TG_FLAG_VARIABLE_PROTONS ) &&
  ------------------
  |  |  938|   110k|#define TG_FLAG_VARIABLE_PROTONS         0x00000800   /* add/remove protons to neutralize */
  ------------------
  |  Branch (5930:13): [True: 110k, False: 0]
  ------------------
 5931|   110k|             ( t_group_info->bTautFlagsDone & ( TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE | TG_FLAG_FOUND_ISOTOPIC_H_DONE ) ))
  ------------------
  |  |  979|   110k|#define TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE 0x00008000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
                           ( t_group_info->bTautFlagsDone & ( TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE | TG_FLAG_FOUND_ISOTOPIC_H_DONE ) ))
  ------------------
  |  |  978|   110k|#define TG_FLAG_FOUND_ISOTOPIC_H_DONE    0x00004000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
  |  Branch (5931:14): [True: 45, False: 109k]
  ------------------
 5932|     45|        {
 5933|     45|            ret = MakeIsotopicHGroup( at, num_atoms, s_group_info, t_group_info );
 5934|     45|            if (ret < 0)
  ------------------
  |  Branch (5934:17): [True: 0, False: 45]
  ------------------
 5935|      0|            {
 5936|      0|                bError = ret;
 5937|      0|            }
 5938|     45|        }
 5939|       |
 5940|       |        /* Success */
 5941|       |
 5942|   110k|        remove_alt_bond_marks( at, num_atoms );
 5943|       |
 5944|       |        /************************************************
 5945|       |        *  Temporarily ignore all non-alternating bonds
 5946|       |        *  and mark non-ring alt bonds non-stereogenic
 5947|       |        ************************************************/
 5948|       |
 5949|   110k|        ReInitBnStructForAltBns( pBNS, at, num_atoms, 0 );
 5950|   110k|        MarkRingSystemsAltBns( pBNS, 0 );
 5951|   110k|        MarkNonStereoAltBns( pBNS, at, num_atoms, 0 );
 5952|       |#if ( FIX_EITHER_DB_AS_NONSTEREO == 1 )
 5953|       |        /* second time unknown ("Either") alternating bonds are treated as non-stereogenic */
 5954|       |        /* stereobonds bonds that lost stereo get "Either" stereo_type */
 5955|       |        ReInitBnStructForAltBns( pBNS, at, num_atoms, 1 );
 5956|       |        MarkRingSystemsAltBns( pBNS, 1 );
 5957|       |        MarkNonStereoAltBns( pBNS, at, num_atoms, 1 );
 5958|       |#endif
 5959|   110k|    }
 5960|      0|    else
 5961|      0|    {
 5962|      0|        bError = BNS_OUT_OF_RAM;
  ------------------
  |  |   77|      0|#define BNS_OUT_OF_RAM     (BNS_ERR +  1) /*(-9998)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 5963|       |        /*printf("BNS_OUT_OF_RAM-3\n");*/
 5964|      0|    }
 5965|       |
 5966|   110k|exit_function:
 5967|       |
 5968|   110k|    pBNS = DeAllocateBnStruct( pBNS );
 5969|   110k|    pBD = DeAllocateBnData( pBD );
 5970|       |    /*#if ( MOVE_CHARGES == 1 )*/
 5971|   110k|    if (c_group_info)
  ------------------
  |  Branch (5971:9): [True: 110k, False: 0]
  ------------------
 5972|   110k|    {
 5973|   110k|        if (c_group_info->c_group)
  ------------------
  |  Branch (5973:13): [True: 806, False: 109k]
  ------------------
 5974|    806|        {
 5975|    806|            inchi_free( c_group_info->c_group );
  ------------------
  |  | 1136|    806|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 806, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 5976|    806|        }
 5977|   110k|        if (c_group_info->c_candidate)
  ------------------
  |  Branch (5977:13): [True: 806, False: 109k]
  ------------------
 5978|    806|        {
 5979|    806|            inchi_free( c_group_info->c_candidate );
  ------------------
  |  | 1136|    806|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 806, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 5980|    806|        }
 5981|   110k|    }
 5982|       |    /*#endif*/
 5983|   110k|    if (s_group_info && s_group_info->s_candidate)
  ------------------
  |  Branch (5983:9): [True: 110k, False: 0]
  |  Branch (5983:25): [True: 110k, False: 3]
  ------------------
 5984|   110k|    {
 5985|   110k|        inchi_free( s_group_info->s_candidate );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 5986|   110k|    }
 5987|   110k|    if (pAATG && pAATG->nMarkedAtom)
  ------------------
  |  Branch (5987:9): [True: 110k, False: 0]
  |  Branch (5987:18): [True: 7, False: 110k]
  ------------------
 5988|      7|    {
 5989|      7|        inchi_free( pAATG->nMarkedAtom );
  ------------------
  |  | 1136|      7|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 7, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 5990|      7|        qzfree( pAATG->nEndPoint );
  ------------------
  |  | 1160|      7|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 0, False: 7]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
 5991|       |        /*qzfree( pAATG->nAtTypeTotals );*/ /* nAtTypeTotals is a stack array */
 5992|      7|    }
 5993|   110k|    if (t_group_info && t_group_info->tGroupNumber)
  ------------------
  |  Branch (5993:9): [True: 110k, False: 3]
  |  Branch (5993:25): [True: 110k, False: 0]
  ------------------
 5994|   110k|    {
 5995|   110k|        inchi_free( t_group_info->tGroupNumber );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 5996|   110k|        t_group_info->tGroupNumber = NULL;
 5997|   110k|    }
 5998|       |
 5999|   110k|    if (!bError && num_atoms == 1 && at[0].at_type == ATT_PROTON && t_group_info && !t_group_info->tni.nNumRemovedExplicitH)
  ------------------
  |  |   75|   219k|#define ATT_PROTON       0x1000
  ------------------
  |  Branch (5999:9): [True: 110k, False: 0]
  |  Branch (5999:20): [True: 109k, False: 806]
  |  Branch (5999:38): [True: 1, False: 109k]
  |  Branch (5999:69): [True: 1, False: 0]
  |  Branch (5999:85): [True: 1, False: 0]
  ------------------
 6000|      1|    {
 6001|       |        /* remove single isolated proton */
 6002|      1|        t_group_info->tni.nNumRemovedProtons = 1;
 6003|      1|        t_group_info->tni.bNormalizationFlags |= FLAG_PROTON_SINGLE_REMOVED;
  ------------------
  |  |  181|      1|#define FLAG_PROTON_SINGLE_REMOVED     0x0080
  ------------------
 6004|      1|        if (at[0].iso_atw_diff) 
  ------------------
  |  Branch (6004:13): [True: 0, False: 1]
  ------------------
 6005|      0|        {
 6006|      0|#if ( FIX_CURE53_ISSUE_NULL_DEREFERENCE_MAKE_A_COPY_OF_T_GROUP_INFO==1 || defined(FIX_IMPOSSIBLE_H_ISOTOPE_BUG) )
 6007|      0|            if (at[0].iso_atw_diff <= NUM_H_ISOTOPES)
  ------------------
  |  |   53|      0|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (6007:17): [True: 0, False: 0]
  ------------------
 6008|      0|            {
 6009|      0|                t_group_info->tni.nNumRemovedProtonsIsotopic[at[0].iso_atw_diff - 1] ++;
 6010|      0|            }
 6011|       |#else
 6012|       |            t_group_info->tni.nNumRemovedProtonsIsotopic[at[0].iso_atw_diff - 1] ++;
 6013|       |#endif
 6014|      0|        }
 6015|      1|        if (at_fixed_bonds_out)
  ------------------
  |  Branch (6015:13): [True: 1, False: 0]
  ------------------
 6016|      1|        {
 6017|      1|            memcpy( at_fixed_bonds_out, at, num_atoms * sizeof( at_fixed_bonds_out[0] ) );
 6018|      1|        }
 6019|       |        /*num_atoms --;*/
 6020|      1|    }
 6021|       |
 6022|       |
 6023|       |    /*
 6024|       |    Additional currently unused info:
 6025|       |
 6026|       |    nOrigDelta > 0: original structure has been changed
 6027|       |    due to fiund augmenting path(s)
 6028|       |    nChanges   > 0: either alt. bonds or taut. groups have been found
 6029|       |    */
 6030|       |
 6031|   110k|#ifdef FIX_AROM_RADICAL        /* Added 2011-05-09 IPl */
 6032|   110k|    if (stored_radicals)
  ------------------
  |  Branch (6032:9): [True: 0, False: 110k]
  ------------------
 6033|      0|    {
 6034|      0|        inchi_free( stored_radicals );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 6035|      0|    }
 6036|   110k|#endif
 6037|       |
 6038|   110k|    return bError ? bError : num_atoms;  /* ret = 0 => success, any other => error */
  ------------------
  |  Branch (6038:12): [True: 0, False: 110k]
  ------------------
 6039|   110k|}
nMaxFlow2Check:
 6044|     32|{
 6045|     32|    BNS_EDGE *pEdge = pBNS->edge + iedge;
 6046|     32|    int       nMaxFlow = ( pEdge->cap & EDGE_FLOW_MASK ); /* edge cap */
  ------------------
  |  |  161|     32|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
 6047|       |
 6048|     32|    if (nMaxFlow > MAX_BOND_EDGE_CAP)
  ------------------
  |  |  151|     32|#define MAX_BOND_EDGE_CAP           2  /* triple bond */
  ------------------
  |  Branch (6048:9): [True: 0, False: 32]
  ------------------
 6049|      0|    {
 6050|      0|        nMaxFlow = MAX_BOND_EDGE_CAP;
  ------------------
  |  |  151|      0|#define MAX_BOND_EDGE_CAP           2  /* triple bond */
  ------------------
 6051|      0|    }
 6052|     32|    return nMaxFlow;
 6053|     32|}
nCurFlow2Check:
 6058|     32|{
 6059|     32|    BNS_EDGE *pEdge = pBNS->edge + iedge;
 6060|     32|    int       nCurFlow = ( pEdge->flow & EDGE_FLOW_MASK ); /* edge flow */
  ------------------
  |  |  161|     32|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
 6061|     32|    return    nCurFlow;
 6062|     32|}
nMinFlow2Check:
 6067|     32|{
 6068|     32|    BNS_EDGE *pEdge = pBNS->edge + iedge;
 6069|     32|    Vertex    v1 = pEdge->neighbor1;
 6070|     32|    Vertex    v2 = v1 ^ pEdge->neighbor12;
 6071|     32|    int       f12 = ( pEdge->flow & EDGE_FLOW_MASK );
  ------------------
  |  |  161|     32|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
 6072|     32|    int       rescap1, rescap2, rescap12, i, iedge_i;
 6073|       |
 6074|     32|    if (f12 > 0)
  ------------------
  |  Branch (6074:9): [True: 8, False: 24]
  ------------------
 6075|      8|    {
 6076|     24|        for (i = 0, rescap1 = 0; i < pBNS->vert[v1].num_adj_edges; i++)
  ------------------
  |  Branch (6076:34): [True: 16, False: 8]
  ------------------
 6077|     16|        {
 6078|     16|            iedge_i = pBNS->vert[v1].iedge[i];
 6079|     16|            if (iedge_i == iedge)
  ------------------
  |  Branch (6079:17): [True: 8, False: 8]
  ------------------
 6080|      8|            {
 6081|      8|                continue;
 6082|      8|            }
 6083|      8|            rescap1 += ( pBNS->edge[iedge_i].cap & EDGE_FLOW_MASK ) - ( pBNS->edge[iedge_i].flow & EDGE_FLOW_MASK );
  ------------------
  |  |  161|      8|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
                          rescap1 += ( pBNS->edge[iedge_i].cap & EDGE_FLOW_MASK ) - ( pBNS->edge[iedge_i].flow & EDGE_FLOW_MASK );
  ------------------
  |  |  161|      8|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
 6084|      8|        }
 6085|     24|        for (i = 0, rescap2 = 0; i < pBNS->vert[v2].num_adj_edges; i++)
  ------------------
  |  Branch (6085:34): [True: 16, False: 8]
  ------------------
 6086|     16|        {
 6087|     16|            iedge_i = pBNS->vert[v2].iedge[i];
 6088|     16|            if (iedge_i == iedge)
  ------------------
  |  Branch (6088:17): [True: 8, False: 8]
  ------------------
 6089|      8|            {
 6090|      8|                continue;
 6091|      8|            }
 6092|      8|            rescap2 += ( pBNS->edge[iedge_i].cap & EDGE_FLOW_MASK ) - ( pBNS->edge[iedge_i].flow & EDGE_FLOW_MASK );
  ------------------
  |  |  161|      8|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
                          rescap2 += ( pBNS->edge[iedge_i].cap & EDGE_FLOW_MASK ) - ( pBNS->edge[iedge_i].flow & EDGE_FLOW_MASK );
  ------------------
  |  |  161|      8|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
 6093|      8|        }
 6094|      8|        rescap12 = inchi_min( rescap1, rescap2 );
  ------------------
  |  |  167|      8|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 8]
  |  |  ------------------
  ------------------
 6095|      8|        rescap12 = inchi_min( rescap12, f12 );
  ------------------
  |  |  167|      8|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 8, False: 0]
  |  |  ------------------
  ------------------
 6096|      8|        return f12 - rescap12;
 6097|      8|    }
 6098|       |
 6099|     24|    return 0;
 6100|     32|}
bRestoreFlowAfterCheckOneBond:
 6214|      6|{
 6215|      6|    int ifcd, iedge;
 6216|      6|    Vertex v1, v2;
 6217|      6|    BNS_EDGE *pEdge;
 6218|       |
 6219|       |    /* Find the next to the last changed */
 6220|     12|    for (ifcd = 0; NO_VERTEX != ( iedge = fcd[ifcd].iedge ); ifcd++)
  ------------------
  |  |  146|     12|#define NO_VERTEX    -2
  ------------------
  |  Branch (6220:20): [True: 6, False: 6]
  ------------------
 6221|      6|    {
 6222|      6|        ;
 6223|      6|    }
 6224|       |
 6225|       |    /* Restore in reversed order to correctly handle vertex changed more than once */
 6226|     12|    for (ifcd -= 1; 0 <= ifcd; ifcd--)
  ------------------
  |  Branch (6226:21): [True: 6, False: 6]
  ------------------
 6227|      6|    {
 6228|       |        /* Restore edge flow & cap */
 6229|      6|        iedge = fcd[ifcd].iedge;
 6230|      6|        pEdge = pBNS->edge + iedge;
 6231|      6|        pEdge->flow = fcd[ifcd].flow;
 6232|      6|        pEdge->cap = fcd[ifcd].cap;
 6233|      6|        pEdge->pass = 0;
 6234|       |
 6235|       |        /* Restore st-flow, cap */
 6236|      6|        if (NO_VERTEX != ( v1 = fcd[ifcd].v1 ))
  ------------------
  |  |  146|      6|#define NO_VERTEX    -2
  ------------------
  |  Branch (6236:13): [True: 6, False: 0]
  ------------------
 6237|      6|        {
 6238|      6|            pBNS->vert[v1].st_edge.flow = fcd[ifcd].flow_st1;
 6239|      6|            pBNS->vert[v1].st_edge.cap = fcd[ifcd].cap_st1;
 6240|      6|            pBNS->vert[v1].st_edge.pass = 0;
 6241|      6|        }
 6242|      6|        if (NO_VERTEX != ( v2 = fcd[ifcd].v2 ))
  ------------------
  |  |  146|      6|#define NO_VERTEX    -2
  ------------------
  |  Branch (6242:13): [True: 6, False: 0]
  ------------------
 6243|      6|        {
 6244|      6|            pBNS->vert[v2].st_edge.flow = fcd[ifcd].flow_st2;
 6245|      6|            pBNS->vert[v2].st_edge.cap = fcd[ifcd].cap_st2;
 6246|      6|            pBNS->vert[v2].st_edge.pass = 0;
 6247|      6|        }
 6248|      6|    }
 6249|       |
 6250|      6|    return 0;
 6251|      6|}
bSetFlowToCheckOneBond:
 6259|      6|{
 6260|      6|    BNS_EDGE *pEdge = pBNS->edge + iedge;
 6261|      6|    int       f12 = ( pEdge->flow & EDGE_FLOW_MASK ); /* the original flow */
  ------------------
  |  |  161|      6|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
 6262|      6|    int       ifcd = 0;
 6263|      6|    int       nDots = 0;
 6264|      6|    int       i, iedge_i;
 6265|       |
 6266|      6|    fcd[ifcd].iedge = NO_VERTEX;
  ------------------
  |  |  146|      6|#define NO_VERTEX    -2
  ------------------
 6267|       |
 6268|      6|    if (f12 < flow)
  ------------------
  |  Branch (6268:9): [True: 0, False: 6]
  ------------------
 6269|      0|    {
 6270|       |        /* Increase edge flow: Grab flow from the neighbors and delete it: set flow12=cap12 = 0 */
 6271|       |        /************************************************************************************/
 6272|       |        /* For example, simulate a new fixed double bond in place of a single bond and      */
 6273|       |        /* creates ONE or NONE (in case of a radical on adjacent atom) augmenting paths and */
 6274|       |        /* makes it impossible for the BNS to set same flow as it originally was            */
 6275|       |        /************************************************************************************/
 6276|      0|        Vertex    v1 = pEdge->neighbor1;
 6277|      0|        Vertex    v2 = v1 ^ pEdge->neighbor12;
 6278|      0|        Vertex    v_i;        /* neighbor of v1 or v2 */
 6279|      0|        BNS_EDGE *pEdge_i;
 6280|      0|        int       delta1, delta2, f, st_edge_rescap;
 6281|       |
 6282|      0|        if (( pBNS->vert[v1].st_edge.cap  & EDGE_FLOW_ST_MASK ) < flow ||
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (6282:13): [True: 0, False: 0]
  ------------------
 6283|      0|            ( pBNS->vert[v2].st_edge.cap  & EDGE_FLOW_ST_MASK ) < flow)
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (6283:13): [True: 0, False: 0]
  ------------------
 6284|      0|        {
 6285|      0|            return BNS_CANT_SET_BOND;
  ------------------
  |  |   85|      0|#define BNS_CANT_SET_BOND  (BNS_ERR +  9) /*(-9990)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 6286|      0|        }
 6287|      0|        if (( pBNS->vert[v1].st_edge.flow & EDGE_FLOW_ST_MASK ) < f12 ||
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (6287:13): [True: 0, False: 0]
  ------------------
 6288|      0|            ( pBNS->vert[v2].st_edge.flow & EDGE_FLOW_ST_MASK ) < f12)
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (6288:13): [True: 0, False: 0]
  ------------------
 6289|      0|        {
 6290|      0|            return BNS_CAP_FLOW_ERR;
  ------------------
  |  |   86|      0|#define BNS_CAP_FLOW_ERR   (BNS_ERR + 10) /*(-9989)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 6291|      0|        }
 6292|       |
 6293|      0|        fcd[ifcd].iedge = iedge;
 6294|      0|        fcd[ifcd].flow = pEdge->flow;
 6295|      0|        fcd[ifcd].cap = pEdge->cap;
 6296|       |
 6297|      0|        fcd[ifcd].v1 = v1;
 6298|      0|        fcd[ifcd].flow_st1 = pBNS->vert[v1].st_edge.flow;
 6299|      0|        fcd[ifcd].cap_st1 = pBNS->vert[v1].st_edge.cap;
 6300|       |
 6301|      0|        fcd[ifcd].v2 = v2;
 6302|      0|        fcd[ifcd].flow_st2 = pBNS->vert[v2].st_edge.flow;
 6303|      0|        fcd[ifcd].cap_st2 = pBNS->vert[v2].st_edge.cap;
 6304|       |
 6305|      0|        fcd[++ifcd].iedge = NO_VERTEX; /* mark the end of the fcd[] data */
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
 6306|      0|        pEdge->pass |= 64;
 6307|       |
 6308|      0|        delta1 = delta2 = flow - f12;
 6309|       |
 6310|      0|        if (f12 > 0)
  ------------------
  |  Branch (6310:13): [True: 0, False: 0]
  ------------------
 6311|      0|        {
 6312|       |            /* Remove old edge flow from the flow and cap of the adjacent vertices' st-edges */
 6313|      0|            pBNS->vert[v1].st_edge.cap = ( ( pBNS->vert[v1].st_edge.cap  & EDGE_FLOW_ST_MASK ) - f12 ) | ( pBNS->vert[v1].st_edge.cap  & ~EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
                          pBNS->vert[v1].st_edge.cap = ( ( pBNS->vert[v1].st_edge.cap  & EDGE_FLOW_ST_MASK ) - f12 ) | ( pBNS->vert[v1].st_edge.cap  & ~EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6314|      0|            pBNS->vert[v2].st_edge.cap = ( ( pBNS->vert[v2].st_edge.cap  & EDGE_FLOW_ST_MASK ) - f12 ) | ( pBNS->vert[v2].st_edge.cap  & ~EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
                          pBNS->vert[v2].st_edge.cap = ( ( pBNS->vert[v2].st_edge.cap  & EDGE_FLOW_ST_MASK ) - f12 ) | ( pBNS->vert[v2].st_edge.cap  & ~EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6315|      0|            pBNS->vert[v1].st_edge.flow = ( ( pBNS->vert[v1].st_edge.flow & EDGE_FLOW_ST_MASK ) - f12 ) | ( pBNS->vert[v1].st_edge.flow & ~EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
                          pBNS->vert[v1].st_edge.flow = ( ( pBNS->vert[v1].st_edge.flow & EDGE_FLOW_ST_MASK ) - f12 ) | ( pBNS->vert[v1].st_edge.flow & ~EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6316|      0|            pBNS->vert[v2].st_edge.flow = ( ( pBNS->vert[v2].st_edge.flow & EDGE_FLOW_ST_MASK ) - f12 ) | ( pBNS->vert[v2].st_edge.flow & ~EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
                          pBNS->vert[v2].st_edge.flow = ( ( pBNS->vert[v2].st_edge.flow & EDGE_FLOW_ST_MASK ) - f12 ) | ( pBNS->vert[v2].st_edge.flow & ~EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6317|       |            /* Delete current edge flow and capacity */
 6318|      0|            pEdge->flow = ( pEdge->flow & ~EDGE_FLOW_MASK );
  ------------------
  |  |  161|      0|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
 6319|      0|        }
 6320|      0|        pEdge->cap = ( pEdge->cap  & ~EDGE_FLOW_MASK );
  ------------------
  |  |  161|      0|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
 6321|       |
 6322|       |        /* Grab the adjacent vertex1 radical (st_edge_rescap) if it exists */
 6323|      0|        st_edge_rescap = ( pBNS->vert[v1].st_edge.cap & EDGE_FLOW_ST_MASK ) - ( pBNS->vert[v1].st_edge.flow & EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
                      st_edge_rescap = ( pBNS->vert[v1].st_edge.cap & EDGE_FLOW_ST_MASK ) - ( pBNS->vert[v1].st_edge.flow & EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6324|      0|        while (st_edge_rescap && delta1)
  ------------------
  |  Branch (6324:16): [True: 0, False: 0]
  |  Branch (6324:34): [True: 0, False: 0]
  ------------------
 6325|      0|        {
 6326|      0|            st_edge_rescap--;  /* grab the radical */
 6327|      0|            delta1--;
 6328|      0|            pBNS->vert[v1].st_edge.cap = ( ( pBNS->vert[v1].st_edge.cap & EDGE_FLOW_ST_MASK ) - 1 ) | ( pBNS->vert[v1].st_edge.cap & ~EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
                          pBNS->vert[v1].st_edge.cap = ( ( pBNS->vert[v1].st_edge.cap & EDGE_FLOW_ST_MASK ) - 1 ) | ( pBNS->vert[v1].st_edge.cap & ~EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6329|      0|            nDots--;
 6330|      0|        }
 6331|       |
 6332|       |        /* Grab the adjacent vertex2 radical (st_edge_rescap) if it exists */
 6333|      0|        st_edge_rescap = ( pBNS->vert[v2].st_edge.cap & EDGE_FLOW_ST_MASK ) - ( pBNS->vert[v2].st_edge.flow & EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
                      st_edge_rescap = ( pBNS->vert[v2].st_edge.cap & EDGE_FLOW_ST_MASK ) - ( pBNS->vert[v2].st_edge.flow & EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6334|      0|        while (st_edge_rescap && delta2)
  ------------------
  |  Branch (6334:16): [True: 0, False: 0]
  |  Branch (6334:34): [True: 0, False: 0]
  ------------------
 6335|      0|        {
 6336|      0|            st_edge_rescap--;  /* grab the radical */
 6337|      0|            delta2--;
 6338|      0|            pBNS->vert[v2].st_edge.cap = ( ( pBNS->vert[v2].st_edge.cap & EDGE_FLOW_ST_MASK ) - 1 ) | ( pBNS->vert[v2].st_edge.cap & ~EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
                          pBNS->vert[v2].st_edge.cap = ( ( pBNS->vert[v2].st_edge.cap & EDGE_FLOW_ST_MASK ) - 1 ) | ( pBNS->vert[v2].st_edge.cap & ~EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6339|      0|            nDots--;
 6340|      0|        }
 6341|       |
 6342|       |        /* Grab flows from v1 neighbors */
 6343|      0|        for (i = 0; delta1 && i < pBNS->vert[v1].num_adj_edges; i++)
  ------------------
  |  Branch (6343:21): [True: 0, False: 0]
  |  Branch (6343:31): [True: 0, False: 0]
  ------------------
 6344|      0|        {
 6345|      0|            iedge_i = pBNS->vert[v1].iedge[i];
 6346|      0|            if (iedge_i == iedge)
  ------------------
  |  Branch (6346:17): [True: 0, False: 0]
  ------------------
 6347|      0|            {
 6348|      0|                continue;
 6349|      0|            }
 6350|      0|            pEdge_i = pBNS->edge + iedge_i;
 6351|      0|            if (IS_FORBIDDEN( pEdge_i->forbidden, pBNS ))
  ------------------
  |  |   65|      0|#define IS_FORBIDDEN(EDGE_FORBIDDEN, PBNS)     (EDGE_FORBIDDEN)
  |  |  ------------------
  |  |  |  Branch (65:48): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 6352|      0|            {
 6353|      0|                continue;
 6354|      0|            }
 6355|      0|            f = ( pEdge_i->flow & EDGE_FLOW_MASK );
  ------------------
  |  |  161|      0|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
 6356|      0|            if (f)
  ------------------
  |  Branch (6356:17): [True: 0, False: 0]
  ------------------
 6357|      0|            {
 6358|      0|                v_i = pEdge_i->neighbor12 ^ v1;
 6359|       |
 6360|      0|                fcd[ifcd].iedge = iedge_i;
 6361|      0|                fcd[ifcd].flow = pEdge_i->flow;
 6362|      0|                fcd[ifcd].cap = pEdge_i->cap;
 6363|       |
 6364|      0|                fcd[ifcd].v1 = v_i;
 6365|      0|                fcd[ifcd].flow_st1 = pBNS->vert[v_i].st_edge.flow;
 6366|      0|                fcd[ifcd].cap_st1 = pBNS->vert[v_i].st_edge.cap;
 6367|       |
 6368|      0|                fcd[ifcd].v2 = NO_VERTEX;
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
 6369|      0|                fcd[ifcd].flow_st2 = 0;
 6370|      0|                fcd[ifcd].cap_st2 = 0;
 6371|       |
 6372|      0|                fcd[++ifcd].iedge = NO_VERTEX; /* mark the end of the fcd[] data */
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
 6373|      0|                pEdge_i->pass |= 64;
 6374|       |
 6375|      0|                while (f && delta1)
  ------------------
  |  Branch (6375:24): [True: 0, False: 0]
  |  Branch (6375:29): [True: 0, False: 0]
  ------------------
 6376|      0|                {
 6377|      0|                    f--;
 6378|      0|                    delta1--;
 6379|      0|                    pEdge_i->flow = ( ( pEdge_i->flow & EDGE_FLOW_MASK ) - 1 ) | ( pEdge_i->flow & ~EDGE_FLOW_MASK );
  ------------------
  |  |  161|      0|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
                                  pEdge_i->flow = ( ( pEdge_i->flow & EDGE_FLOW_MASK ) - 1 ) | ( pEdge_i->flow & ~EDGE_FLOW_MASK );
  ------------------
  |  |  161|      0|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
 6380|      0|                    pBNS->vert[v_i].st_edge.flow = ( ( pBNS->vert[v_i].st_edge.flow & EDGE_FLOW_ST_MASK ) - 1 ) | ( pBNS->vert[v_i].st_edge.flow & ~EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
                                  pBNS->vert[v_i].st_edge.flow = ( ( pBNS->vert[v_i].st_edge.flow & EDGE_FLOW_ST_MASK ) - 1 ) | ( pBNS->vert[v_i].st_edge.flow & ~EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6381|       |                    /* next 2 lines added 01-22-2002 */
 6382|      0|                    pBNS->vert[v1].st_edge.cap = ( ( pBNS->vert[v1].st_edge.cap  & EDGE_FLOW_ST_MASK ) - 1 ) | ( pBNS->vert[v1].st_edge.cap  & ~EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
                                  pBNS->vert[v1].st_edge.cap = ( ( pBNS->vert[v1].st_edge.cap  & EDGE_FLOW_ST_MASK ) - 1 ) | ( pBNS->vert[v1].st_edge.cap  & ~EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6383|      0|                    pBNS->vert[v1].st_edge.flow = ( ( pBNS->vert[v1].st_edge.flow & EDGE_FLOW_ST_MASK ) - 1 ) | ( pBNS->vert[v1].st_edge.flow & ~EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
                                  pBNS->vert[v1].st_edge.flow = ( ( pBNS->vert[v1].st_edge.flow & EDGE_FLOW_ST_MASK ) - 1 ) | ( pBNS->vert[v1].st_edge.flow & ~EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6384|       |
 6385|      0|                    nDots++;
 6386|      0|                }
 6387|      0|            }
 6388|      0|        }
 6389|       |
 6390|       |        /* Grab flows from v2 neighbors */
 6391|      0|        for (i = 0; delta2 && i < pBNS->vert[v2].num_adj_edges; i++)
  ------------------
  |  Branch (6391:21): [True: 0, False: 0]
  |  Branch (6391:31): [True: 0, False: 0]
  ------------------
 6392|      0|        {
 6393|      0|            iedge_i = pBNS->vert[v2].iedge[i];
 6394|      0|            if (iedge_i == iedge)
  ------------------
  |  Branch (6394:17): [True: 0, False: 0]
  ------------------
 6395|      0|            {
 6396|      0|                continue;
 6397|      0|            }
 6398|      0|            pEdge_i = pBNS->edge + iedge_i;
 6399|      0|            if (IS_FORBIDDEN( pEdge_i->forbidden, pBNS ))
  ------------------
  |  |   65|      0|#define IS_FORBIDDEN(EDGE_FORBIDDEN, PBNS)     (EDGE_FORBIDDEN)
  |  |  ------------------
  |  |  |  Branch (65:48): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 6400|      0|            {
 6401|      0|                continue;
 6402|      0|            }
 6403|      0|            f = ( pEdge_i->flow & EDGE_FLOW_MASK );
  ------------------
  |  |  161|      0|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
 6404|      0|            if (f)
  ------------------
  |  Branch (6404:17): [True: 0, False: 0]
  ------------------
 6405|      0|            {
 6406|      0|                v_i = pEdge_i->neighbor12 ^ v2;
 6407|       |
 6408|      0|                fcd[ifcd].iedge = iedge_i;
 6409|      0|                fcd[ifcd].flow = pEdge_i->flow;
 6410|      0|                fcd[ifcd].cap = pEdge_i->cap;
 6411|       |
 6412|      0|                fcd[ifcd].v1 = v_i;
 6413|      0|                fcd[ifcd].flow_st1 = pBNS->vert[v_i].st_edge.flow;
 6414|      0|                fcd[ifcd].cap_st1 = pBNS->vert[v_i].st_edge.cap;
 6415|       |
 6416|      0|                fcd[ifcd].v2 = NO_VERTEX;
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
 6417|      0|                fcd[ifcd].flow_st2 = 0;
 6418|      0|                fcd[ifcd].cap_st2 = 0;
 6419|       |
 6420|      0|                fcd[++ifcd].iedge = NO_VERTEX; /* mark the end of the fcd[] data */
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
 6421|      0|                pEdge_i->pass |= 64;
 6422|       |
 6423|      0|                while (f && delta2)
  ------------------
  |  Branch (6423:24): [True: 0, False: 0]
  |  Branch (6423:29): [True: 0, False: 0]
  ------------------
 6424|      0|                {
 6425|      0|                    f--;
 6426|      0|                    delta2--;
 6427|      0|                    pEdge_i->flow = ( ( pEdge_i->flow & EDGE_FLOW_MASK ) - 1 ) | ( pEdge_i->flow & ~EDGE_FLOW_MASK );
  ------------------
  |  |  161|      0|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
                                  pEdge_i->flow = ( ( pEdge_i->flow & EDGE_FLOW_MASK ) - 1 ) | ( pEdge_i->flow & ~EDGE_FLOW_MASK );
  ------------------
  |  |  161|      0|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
 6428|      0|                    pBNS->vert[v_i].st_edge.flow = ( ( pBNS->vert[v_i].st_edge.flow & EDGE_FLOW_ST_MASK ) - 1 ) | ( pBNS->vert[v_i].st_edge.flow & ~EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
                                  pBNS->vert[v_i].st_edge.flow = ( ( pBNS->vert[v_i].st_edge.flow & EDGE_FLOW_ST_MASK ) - 1 ) | ( pBNS->vert[v_i].st_edge.flow & ~EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6429|       |                    /* next 2 lines added 01-22-2002 */
 6430|      0|                    pBNS->vert[v2].st_edge.cap = ( ( pBNS->vert[v2].st_edge.cap  & EDGE_FLOW_ST_MASK ) - 1 ) | ( pBNS->vert[v2].st_edge.cap  & ~EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
                                  pBNS->vert[v2].st_edge.cap = ( ( pBNS->vert[v2].st_edge.cap  & EDGE_FLOW_ST_MASK ) - 1 ) | ( pBNS->vert[v2].st_edge.cap  & ~EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6431|      0|                    pBNS->vert[v2].st_edge.flow = ( ( pBNS->vert[v2].st_edge.flow & EDGE_FLOW_ST_MASK ) - 1 ) | ( pBNS->vert[v2].st_edge.flow & ~EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
                                  pBNS->vert[v2].st_edge.flow = ( ( pBNS->vert[v2].st_edge.flow & EDGE_FLOW_ST_MASK ) - 1 ) | ( pBNS->vert[v2].st_edge.flow & ~EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6432|       |
 6433|      0|                    nDots++;
 6434|      0|                }
 6435|      0|            }
 6436|      0|        }
 6437|      0|        if (delta1 || delta2)
  ------------------
  |  Branch (6437:13): [True: 0, False: 0]
  |  Branch (6437:23): [True: 0, False: 0]
  ------------------
 6438|      0|        {
 6439|      0|            return BNS_CANT_SET_BOND;
  ------------------
  |  |   85|      0|#define BNS_CANT_SET_BOND  (BNS_ERR +  9) /*(-9990)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 6440|      0|        }
 6441|      0|    }
 6442|       |
 6443|      6|    if (f12 >= flow)
  ------------------
  |  Branch (6443:9): [True: 6, False: 0]
  ------------------
 6444|      6|    {
 6445|       |        /* Decrease edge flow: Redirect flow to the neighbors and delete it on the edge: set flow12=cap12 = 0 */
 6446|       |        /* f12==flow fixes flow through the edge so that BNS cannot change it */
 6447|       |        /**********************************************************************************************/
 6448|       |        /* For example, simulate a removal of a double bond and create ONE or NONE augmenting path    */
 6449|       |        /* Make it impossible for BNS to set same flow as it originally was                           */
 6450|       |        /**********************************************************************************************/
 6451|      6|        Vertex    v1 = pEdge->neighbor1;
 6452|      6|        Vertex    v2 = ( v1 ^ pEdge->neighbor12 );
 6453|      6|        int       delta;
 6454|       |        /* if NOT (st-cap >= st-flow >= f12 >= flow) then error in the BN structure */
 6455|      6|        if (( pBNS->vert[v1].st_edge.flow & EDGE_FLOW_ST_MASK ) < f12 ||
  ------------------
  |  |  156|      6|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (6455:13): [True: 0, False: 6]
  ------------------
 6456|      6|            ( pBNS->vert[v2].st_edge.flow & EDGE_FLOW_ST_MASK ) < f12 ||
  ------------------
  |  |  156|      6|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (6456:13): [True: 0, False: 6]
  ------------------
 6457|      6|             ( pBNS->vert[v1].st_edge.cap  & EDGE_FLOW_ST_MASK ) < flow ||
  ------------------
  |  |  156|      6|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (6457:14): [True: 0, False: 6]
  ------------------
 6458|      6|             ( pBNS->vert[v2].st_edge.cap  & EDGE_FLOW_ST_MASK ) < flow)
  ------------------
  |  |  156|      6|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (6458:14): [True: 0, False: 6]
  ------------------
 6459|      0|        {
 6460|      0|            return BNS_CAP_FLOW_ERR;
  ------------------
  |  |   86|      0|#define BNS_CAP_FLOW_ERR   (BNS_ERR + 10) /*(-9989)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 6461|      0|        }
 6462|      6|        fcd[ifcd].iedge = iedge;
 6463|      6|        fcd[ifcd].flow = pEdge->flow;
 6464|      6|        fcd[ifcd].cap = pEdge->cap;
 6465|       |
 6466|      6|        fcd[ifcd].v1 = v1;
 6467|      6|        fcd[ifcd].flow_st1 = pBNS->vert[v1].st_edge.flow;
 6468|      6|        fcd[ifcd].cap_st1 = pBNS->vert[v1].st_edge.cap;
 6469|       |
 6470|      6|        fcd[ifcd].v2 = v2;
 6471|      6|        fcd[ifcd].flow_st2 = pBNS->vert[v2].st_edge.flow;
 6472|      6|        fcd[ifcd].cap_st2 = pBNS->vert[v2].st_edge.cap;
 6473|       |
 6474|      6|        fcd[++ifcd].iedge = NO_VERTEX; /* mark the end of the fcd[] data */
  ------------------
  |  |  146|      6|#define NO_VERTEX    -2
  ------------------
 6475|      6|        pEdge->pass |= 64;
 6476|       |
 6477|      6|        delta = f12 - flow;
 6478|       |
 6479|       |        /* Remove current edge flow from st-edges */
 6480|       |        /* -- seem to be a bug --
 6481|       |        pBNS->vert[v1].st_edge.flow = ((pBNS->vert[v1].st_edge.flow & EDGE_FLOW_ST_MASK)-delta) | (pBNS->vert[v1].st_edge.flow & ~EDGE_FLOW_ST_MASK);
 6482|       |        pBNS->vert[v2].st_edge.flow = ((pBNS->vert[v2].st_edge.flow & EDGE_FLOW_ST_MASK)-delta) | (pBNS->vert[v2].st_edge.flow & ~EDGE_FLOW_ST_MASK);
 6483|       |        */
 6484|       |
 6485|       |        /* Replacement to the above 2 lines 01-16-2002 */
 6486|       |        /* Remove old edge flow from the flow of the adjacent vertices' st-edges */
 6487|       |
 6488|      6|        pBNS->vert[v1].st_edge.flow = ( ( pBNS->vert[v1].st_edge.flow & EDGE_FLOW_ST_MASK ) - f12 ) | ( pBNS->vert[v1].st_edge.flow & ~EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      6|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
                      pBNS->vert[v1].st_edge.flow = ( ( pBNS->vert[v1].st_edge.flow & EDGE_FLOW_ST_MASK ) - f12 ) | ( pBNS->vert[v1].st_edge.flow & ~EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      6|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6489|      6|        pBNS->vert[v2].st_edge.flow = ( ( pBNS->vert[v2].st_edge.flow & EDGE_FLOW_ST_MASK ) - f12 ) | ( pBNS->vert[v2].st_edge.flow & ~EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      6|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
                      pBNS->vert[v2].st_edge.flow = ( ( pBNS->vert[v2].st_edge.flow & EDGE_FLOW_ST_MASK ) - f12 ) | ( pBNS->vert[v2].st_edge.flow & ~EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      6|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6490|       |
 6491|       |        /* Sdded 01-16-2002: reduce st-cap if new flow > 0  */
 6492|       |        /* Remove new edge flow from the cap of the adjacent vertices' st-edges */
 6493|      6|        pBNS->vert[v1].st_edge.cap = ( ( pBNS->vert[v1].st_edge.cap & EDGE_FLOW_ST_MASK ) - flow ) | ( pBNS->vert[v1].st_edge.cap & ~EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      6|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
                      pBNS->vert[v1].st_edge.cap = ( ( pBNS->vert[v1].st_edge.cap & EDGE_FLOW_ST_MASK ) - flow ) | ( pBNS->vert[v1].st_edge.cap & ~EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      6|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6494|      6|        pBNS->vert[v2].st_edge.cap = ( ( pBNS->vert[v2].st_edge.cap & EDGE_FLOW_ST_MASK ) - flow ) | ( pBNS->vert[v2].st_edge.cap & ~EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      6|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
                      pBNS->vert[v2].st_edge.cap = ( ( pBNS->vert[v2].st_edge.cap & EDGE_FLOW_ST_MASK ) - flow ) | ( pBNS->vert[v2].st_edge.cap & ~EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      6|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 6495|       |
 6496|       |        /* delete current edge flow and capacity */
 6497|      6|        pEdge->flow = ( pEdge->flow & ~EDGE_FLOW_MASK );
  ------------------
  |  |  161|      6|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
 6498|      6|        pEdge->cap = ( pEdge->cap  & ~EDGE_FLOW_MASK );
  ------------------
  |  |  161|      6|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
 6499|      6|        nDots = 2 * delta;
 6500|      6|    }
 6501|       |
 6502|      6|    return nDots;
 6503|      6|}
bAddNewVertex:
 6521|      2|{
 6522|      2|    Vertex      vlast = pBNS->num_vertices - 1;
 6523|      2|    Vertex      vnew = pBNS->num_vertices;
 6524|      2|    Vertex      v2 = nVertDoubleBond;
 6525|      2|    BNS_VERTEX *pVert2 = pBNS->vert + v2;   /* pointer to an old vertex */
 6526|      2|    BNS_VERTEX *pNewVert = pBNS->vert + vnew; /* pointer to a new vertex */
 6527|       |
 6528|      2|    EdgeIndex   iedge = pBNS->num_edges;
 6529|      2|    BNS_EDGE   *pEdge = pBNS->edge + iedge; /* pointer to a new edge */
 6530|       |
 6531|      2|    if (iedge >= pBNS->max_edges || vnew >= pBNS->max_vertices)
  ------------------
  |  Branch (6531:9): [True: 0, False: 2]
  |  Branch (6531:37): [True: 0, False: 2]
  ------------------
 6532|      0|    {
 6533|      0|        return BNS_VERT_EDGE_OVFL; /* edges or vertices overflow */
  ------------------
  |  |   82|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 6534|      0|    }
 6535|      2|    if (( pBNS->vert[vlast].iedge - pBNS->iedge ) + pBNS->vert[vlast].max_adj_edges + nMaxAdjEdges >= pBNS->max_iedges)
  ------------------
  |  Branch (6535:9): [True: 0, False: 2]
  ------------------
 6536|      0|    {
 6537|      0|        return BNS_VERT_EDGE_OVFL; /* iedges overflow */
  ------------------
  |  |   82|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 6538|      0|    }
 6539|      2|    if (pVert2->num_adj_edges >= pVert2->max_adj_edges || nMaxAdjEdges <= 0)
  ------------------
  |  Branch (6539:9): [True: 0, False: 2]
  |  Branch (6539:59): [True: 0, False: 2]
  ------------------
 6540|      0|    {
 6541|      0|        return BNS_VERT_EDGE_OVFL; /* neighbors overflow */
  ------------------
  |  |   82|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 6542|      0|    }
 6543|       |
 6544|       |    /* Fill out the new edge, set its cap and flow, connect */
 6545|       |    /* memset( pEdge, 0, sizeof(*pEdge) ); */
 6546|      2|    pEdge->cap = pEdge->cap0 = nCap;
 6547|      2|    pEdge->flow = pEdge->flow0 = nFlow;
 6548|      2|    pEdge->pass = 0;
 6549|      2|    pEdge->neighbor1 = v2;
 6550|      2|    pEdge->neighbor12 = v2 ^ vnew;
 6551|      2|    pEdge->forbidden = 0;
 6552|       |
 6553|       |    /* Fill out the new vertex */
 6554|       |    /* memset( pNewVert, 0, sizeof(*pNewVert) ); */
 6555|      2|    pNewVert->max_adj_edges = nMaxAdjEdges;
 6556|      2|    pNewVert->num_adj_edges = 0;
 6557|      2|    pNewVert->st_edge.cap0 = pNewVert->st_edge.cap = nCap;
 6558|      2|    pNewVert->st_edge.flow0 = pNewVert->st_edge.flow = nFlow;
 6559|      2|    pNewVert->st_edge.pass = 0; /* add initialization; added 2006-03-25 */
 6560|      2|    pNewVert->iedge = pBNS->vert[vlast].iedge + pBNS->vert[vlast].max_adj_edges;
 6561|      2|    pNewVert->type = BNS_VERT_TYPE_TEMP;
  ------------------
  |  |   79|      2|#define BNS_VERT_TYPE_TEMP          0x0040
  ------------------
 6562|      2|    *nDots += nCap - nFlow;
 6563|       |
 6564|      2|    pEdge->neigh_ord[v2 > vnew] = pVert2->num_adj_edges;
 6565|      2|    pEdge->neigh_ord[v2 < vnew] = pNewVert->num_adj_edges;
 6566|       |
 6567|       |    /* Connect new edge to v2 */
 6568|      2|    pVert2->iedge[pVert2->num_adj_edges++] = iedge;
 6569|       |    /* Connect new edge to vnew */
 6570|      2|    pNewVert->iedge[pNewVert->num_adj_edges++] = iedge;
 6571|       |
 6572|       |    /* Fix v2 flow and cap */
 6573|      2|    *nDots -= (int) pVert2->st_edge.cap - (int) pVert2->st_edge.flow;
 6574|      2|    pVert2->st_edge.flow += nFlow;
 6575|      2|    if (pVert2->st_edge.cap < pVert2->st_edge.flow)
  ------------------
  |  Branch (6575:9): [True: 0, False: 2]
  ------------------
 6576|      0|    {
 6577|      0|        pVert2->st_edge.cap = pVert2->st_edge.flow;
 6578|      0|    }
 6579|      2|    *nDots += (int) pVert2->st_edge.cap - (int) pVert2->st_edge.flow;
 6580|       |
 6581|      2|    pBNS->num_edges++;
 6582|      2|    pBNS->num_vertices++;
 6583|       |
 6584|      2|    return vnew;
 6585|      2|}
AddNewEdge:
 6594|      3|{
 6595|      3|    int ip1 = (int) ( p1 - pBNS->vert );
 6596|      3|    int ip2 = (int) ( p2 - pBNS->vert );
 6597|      3|    int ie = pBNS->num_edges;
 6598|      3|    BNS_EDGE *e = pBNS->edge + ie;
 6599|       |
 6600|       |    /* Debug: check bounds */
 6601|      3|    if (ip1 >= pBNS->max_vertices || ip1 < 0 ||
  ------------------
  |  Branch (6601:9): [True: 0, False: 3]
  |  Branch (6601:38): [True: 0, False: 3]
  ------------------
 6602|      3|         ip2 >= pBNS->max_vertices || ip2 < 0 ||
  ------------------
  |  Branch (6602:10): [True: 0, False: 3]
  |  Branch (6602:39): [True: 0, False: 3]
  ------------------
 6603|      3|         ie >= pBNS->max_edges || ie < 0 ||
  ------------------
  |  Branch (6603:10): [True: 0, False: 3]
  |  Branch (6603:35): [True: 0, False: 3]
  ------------------
 6604|      3|         ( p1->iedge - pBNS->iedge ) < 0 ||
  ------------------
  |  Branch (6604:10): [True: 0, False: 3]
  ------------------
 6605|      3|         ( p1->iedge - pBNS->iedge ) + p1->max_adj_edges > pBNS->max_iedges ||
  ------------------
  |  Branch (6605:10): [True: 0, False: 3]
  ------------------
 6606|      3|         ( p2->iedge - pBNS->iedge ) < 0 ||
  ------------------
  |  Branch (6606:10): [True: 0, False: 3]
  ------------------
 6607|      3|         ( p2->iedge - pBNS->iedge ) + p2->max_adj_edges > pBNS->max_iedges ||
  ------------------
  |  Branch (6607:10): [True: 0, False: 3]
  ------------------
 6608|      3|         p1->num_adj_edges >= p1->max_adj_edges ||
  ------------------
  |  Branch (6608:10): [True: 0, False: 3]
  ------------------
 6609|      3|         p2->num_adj_edges >= p2->max_adj_edges)
  ------------------
  |  Branch (6609:10): [True: 0, False: 3]
  ------------------
 6610|      0|    {
 6611|      0|        return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   82|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 6612|      0|    }
 6613|       |
 6614|       |    /* Clear the edge */
 6615|      3|    memset( e, 0, sizeof( *e ) );
 6616|       |
 6617|       |    /* Connect */
 6618|      3|    e->neighbor1 = inchi_min( ip1, ip2 );
  ------------------
  |  |  167|      3|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 3]
  |  |  ------------------
  ------------------
 6619|      3|    e->neighbor12 = ip1 ^ ip2;
 6620|      3|    p1->iedge[p1->num_adj_edges] = ie;
 6621|      3|    p2->iedge[p2->num_adj_edges] = ie;
 6622|      3|    e->neigh_ord[ip1 > ip2] = p1->num_adj_edges++;
 6623|      3|    e->neigh_ord[ip1 < ip2] = p2->num_adj_edges++;
 6624|      3|    e->cap = e->cap0 = nEdgeCap;
 6625|      3|    e->flow = e->flow0 = nEdgeFlow;
 6626|      3|    p1->st_edge.flow += nEdgeFlow;
 6627|      3|    p2->st_edge.flow += nEdgeFlow;
 6628|      3|    if (p1->st_edge.cap < p1->st_edge.flow)
  ------------------
  |  Branch (6628:9): [True: 0, False: 3]
  ------------------
 6629|      0|    {
 6630|      0|        p1->st_edge.cap = p1->st_edge.flow;
 6631|      0|    }
 6632|      3|    if (p2->st_edge.cap < p2->st_edge.flow)
  ------------------
  |  Branch (6632:9): [True: 0, False: 3]
  ------------------
 6633|      0|    {
 6634|      0|        p2->st_edge.cap = p2->st_edge.flow;
 6635|      0|    }
 6636|      3|    pBNS->num_edges++;
 6637|       |
 6638|      3|    return ie;
 6639|      3|}
RegisterRadEndpoint:
 7673|     18|{
 7674|     18|    EdgeIndex iuv;
 7675|     18|    int       i, num_found;
 7676|     18|    Vertex    v, w;
 7677|     18|    Vertex    u_last, v2;
 7678|     18|    switch (pBD->bRadSrchMode)
  ------------------
  |  Branch (7678:13): [True: 0, False: 18]
  ------------------
 7679|     18|    {
 7680|      0|        case  RAD_SRCH_NORM:
  ------------------
  |  Branch (7680:9): [True: 0, False: 18]
  ------------------
 7681|       |            /* Go backwards along alt path and stop at the 1st found atom (not a fictitious vertex) */
 7682|       |            /* we need only vertices where a radical may be moved, therefore exclude u%2=1 (odd) vertices */
 7683|       |            /* atom number = u/2-1; u = 0 or 1 is 's' or 't' vertices, respectively, they are not atoms  */
 7684|      0|            num_found = 0;
 7685|      0|            while (u > Vertex_t && ( u % 2 || u / 2 > pBNS->num_atoms ))
  ------------------
  |  |  144|      0|#define Vertex_t 1
  ------------------
  |  Branch (7685:20): [True: 0, False: 0]
  |  Branch (7685:38): [True: 0, False: 0]
  |  Branch (7685:47): [True: 0, False: 0]
  ------------------
 7686|      0|            {
 7687|      0|                u = GetPrevVertex( pBNS, u, pBD->SwitchEdge, &iuv );
 7688|      0|            }
 7689|      0|            w = u / 2 - 1; /* Check whether u is a radical endpoint */
 7690|      0|            if (Vertex_t < u && w < pBNS->num_atoms &&
  ------------------
  |  |  144|      0|#define Vertex_t 1
  ------------------
  |  Branch (7690:17): [True: 0, False: 0]
  |  Branch (7690:33): [True: 0, False: 0]
  ------------------
 7691|      0|                 pBNS->vert[w].st_edge.cap == ( pBNS->vert[w].st_edge.flow & EDGE_FLOW_ST_MASK ))
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (7691:18): [True: 0, False: 0]
  ------------------
 7692|      0|            {
 7693|       |                /* u is an atom; it is not a radical atom */
 7694|       |                /* now search for the starting radical atom by following the path back from u */
 7695|      0|                v = u_last = u;
 7696|      0|                while (v > Vertex_t)
  ------------------
  |  |  144|      0|#define Vertex_t 1
  ------------------
  |  Branch (7696:24): [True: 0, False: 0]
  ------------------
 7697|      0|                {
 7698|      0|                    u = v;
 7699|      0|                    v = GetPrevVertex( pBNS, u, pBD->SwitchEdge, &iuv ); /* Radical endpoint */
 7700|      0|                }
 7701|       |                /* Check whether u is a radical atom */
 7702|      0|                if (!( u % 2 ) && Vertex_t < u &&
  ------------------
  |  |  144|      0|#define Vertex_t 1
  ------------------
  |  Branch (7702:21): [True: 0, False: 0]
  |  Branch (7702:35): [True: 0, False: 0]
  ------------------
 7703|      0|                    ( u = u / 2 - 1 ) < pBNS->num_atoms &&
  ------------------
  |  Branch (7703:21): [True: 0, False: 0]
  ------------------
 7704|      0|                     pBNS->vert[u].st_edge.cap > ( pBNS->vert[u].st_edge.flow & EDGE_FLOW_ST_MASK ))
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (7704:22): [True: 0, False: 0]
  ------------------
 7705|      0|                {
 7706|       |                    /* at pBNS->vert[u] we have found the radical that originated the path */
 7707|       |                    /* pBD->RadEndpoints[2k] is the radical, pBD->RadEndpoints[2k+1] is the farthest atom */
 7708|       |                    /* to which the radical may be moved (farthest reachable atom) */
 7709|       |
 7710|       |                    /* add *all* atoms that may receive radical from u_rad */
 7711|       |                    /* exception: at2 in: ==(+/-/H)---at1==at2(possible rad endpoint) if pBNS->type_TACN */
 7712|      0|                    for (v = u_last; v > Vertex_t; v = GetPrevVertex( pBNS, v, pBD->SwitchEdge, &iuv ))
  ------------------
  |  |  144|      0|#define Vertex_t 1
  ------------------
  |  Branch (7712:38): [True: 0, False: 0]
  ------------------
 7713|      0|                    {
 7714|      0|                        if (!( v % 2 ) && ( v2 = v / 2 - 1 ) < pBNS->num_atoms &&
  ------------------
  |  Branch (7714:29): [True: 0, False: 0]
  |  Branch (7714:43): [True: 0, False: 0]
  ------------------
 7715|      0|                             pBNS->vert[v2].st_edge.cap == ( pBNS->vert[v2].st_edge.flow & EDGE_FLOW_ST_MASK ))
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (7715:30): [True: 0, False: 0]
  ------------------
 7716|      0|                        {
 7717|       |                            /* Check exception */
 7718|      0|                            if (pBNS->type_TACN &&
  ------------------
  |  Branch (7718:33): [True: 0, False: 0]
  ------------------
 7719|      0|                                 bRadChangesAtomType( pBNS, pBD, v, NO_VERTEX, NO_VERTEX ))
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
                                               bRadChangesAtomType( pBNS, pBD, v, NO_VERTEX, NO_VERTEX ))
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (7719:34): [True: 0, False: 0]
  ------------------
 7720|      0|                            {
 7721|      0|                                continue;
 7722|      0|                            }
 7723|       |                            /* Add */
 7724|      0|                            for (i = 0; i < pBD->nNumRadEndpoints; i += 2)
  ------------------
  |  Branch (7724:41): [True: 0, False: 0]
  ------------------
 7725|      0|                            {
 7726|       |                                /* Check whether this pair, (u,w), has already been saved */
 7727|      0|                                if (u == pBD->RadEndpoints[i] &&
  ------------------
  |  Branch (7727:37): [True: 0, False: 0]
  ------------------
 7728|      0|                                     v2 == pBD->RadEndpoints[i + 1])
  ------------------
  |  Branch (7728:38): [True: 0, False: 0]
  ------------------
 7729|      0|                                {
 7730|      0|                                    break;
 7731|      0|                                }
 7732|      0|                            }
 7733|      0|                            if (i >= pBD->nNumRadEndpoints)
  ------------------
  |  Branch (7733:33): [True: 0, False: 0]
  ------------------
 7734|      0|                            {
 7735|       |                                /* Add new (u,w) pair */
 7736|      0|                                if (pBD->nNumRadEndpoints + 2 <= pBD->max_num_vertices)
  ------------------
  |  Branch (7736:37): [True: 0, False: 0]
  ------------------
 7737|      0|                                {
 7738|       |                                    /* add */
 7739|      0|                                    pBD->RadEndpoints[pBD->nNumRadEndpoints++] = u; /* radical */
 7740|      0|                                    pBD->RadEndpoints[pBD->nNumRadEndpoints++] = v2; /* endpoint */
 7741|      0|                                    num_found++;
 7742|       |                                    /*return 1;*/ /* registered */
 7743|      0|                                }
 7744|      0|                                else
 7745|      0|                                {
 7746|      0|                                    return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   82|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 7747|      0|                                }
 7748|      0|                            }
 7749|      0|                        }
 7750|      0|                    }
 7751|      0|                    if (num_found)
  ------------------
  |  Branch (7751:25): [True: 0, False: 0]
  ------------------
 7752|      0|                    {
 7753|      0|                        return 1;
 7754|      0|                    }
 7755|      0|                }
 7756|      0|            }
 7757|      0|            break;
 7758|       |
 7759|     18|        case RAD_SRCH_FROM_FICT:
  ------------------
  |  Branch (7759:9): [True: 18, False: 0]
  ------------------
 7760|       |            /* Find the nearest atom accessible from a fictitious vertex */
 7761|       |            /* go backwards along alt path and stop at the 1st found atom (not a fictitious vertex) */
 7762|       |
 7763|     18|            v = u;
 7764|     18|            w = NO_VERTEX; /* the nearest atom -- radical-endpoint */
  ------------------
  |  |  146|     18|#define NO_VERTEX    -2
  ------------------
 7765|     18|            u = NO_VERTEX; /* fictitious vertex carrying a radical */
  ------------------
  |  |  146|     18|#define NO_VERTEX    -2
  ------------------
 7766|       |
 7767|    208|            while (v > Vertex_t)
  ------------------
  |  |  144|    208|#define Vertex_t 1
  ------------------
  |  Branch (7767:20): [True: 190, False: 18]
  ------------------
 7768|    190|            {
 7769|    190|                u = v;
 7770|    190|                if (!( v % 2 ) && v / 2 <= pBNS->num_atoms &&
  ------------------
  |  Branch (7770:21): [True: 98, False: 92]
  |  Branch (7770:35): [True: 16, False: 82]
  ------------------
 7771|    190|                     pBNS->vert[v / 2 - 1].st_edge.cap - pBNS->vert[v / 2 - 1].st_edge.flow < 2)
  ------------------
  |  Branch (7771:22): [True: 16, False: 0]
  ------------------
 7772|     16|                {
 7773|     16|                    w = v; /* vertex w is atom that may be singlet or doublet but not triplet */
 7774|     16|                }
 7775|    190|                v = GetPrevVertex( pBNS, u, pBD->SwitchEdge, &iuv );
 7776|    190|            }
 7777|     18|            v = u / 2 - 1; /* vertex u may be the radical from which the path originated; w is the nearest atom */
 7778|     18|            if (w == NO_VERTEX || u == NO_VERTEX || w % 2 || u == w || v < pBNS->num_atoms ||
  ------------------
  |  |  146|     36|#define NO_VERTEX    -2
  ------------------
                          if (w == NO_VERTEX || u == NO_VERTEX || w % 2 || u == w || v < pBNS->num_atoms ||
  ------------------
  |  |  146|     32|#define NO_VERTEX    -2
  ------------------
  |  Branch (7778:17): [True: 4, False: 14]
  |  Branch (7778:35): [True: 0, False: 14]
  |  Branch (7778:53): [True: 0, False: 14]
  |  Branch (7778:62): [True: 0, False: 14]
  |  Branch (7778:72): [True: 0, False: 14]
  ------------------
 7779|     18|                 pBNS->vert[v].st_edge.cap == pBNS->vert[v].st_edge.flow ||
  ------------------
  |  Branch (7779:18): [True: 0, False: 14]
  ------------------
 7780|     18|                 ( w = w / 2 - 1 ) >= pBNS->num_atoms)
  ------------------
  |  Branch (7780:18): [True: 0, False: 14]
  ------------------
 7781|      4|            {
 7782|      4|                break; /* reject */
 7783|      4|            }
 7784|     14|            u = v;
 7785|       |            /* At pBNS->vert[u] we have found the radical that originated the path, w is the nearest atom */
 7786|     20|            for (i = 0; i < pBD->nNumRadEndpoints; i += 2)
  ------------------
  |  Branch (7786:25): [True: 17, False: 3]
  ------------------
 7787|     17|            {
 7788|     17|                if (u == pBD->RadEndpoints[i] &&
  ------------------
  |  Branch (7788:21): [True: 17, False: 0]
  ------------------
 7789|     17|                     w == pBD->RadEndpoints[i + 1])
  ------------------
  |  Branch (7789:22): [True: 11, False: 6]
  ------------------
 7790|     11|                {
 7791|     11|                    break; /* this pair has already been stored */
 7792|     11|                }
 7793|     17|            }
 7794|     14|            if (i >= pBD->nNumRadEndpoints)
  ------------------
  |  Branch (7794:17): [True: 3, False: 11]
  ------------------
 7795|      3|            {
 7796|       |                /* A new pair has been found */
 7797|      3|                if (pBD->nNumRadEndpoints + 2 <= pBD->max_num_vertices)
  ------------------
  |  Branch (7797:21): [True: 3, False: 0]
  ------------------
 7798|      3|                {
 7799|       |                    /* Add */
 7800|      3|                    pBD->RadEndpoints[pBD->nNumRadEndpoints++] = u; /* radical */
 7801|      3|                    pBD->RadEndpoints[pBD->nNumRadEndpoints++] = w; /* endpoint */
 7802|      3|                    return 1; /* registered */
 7803|      3|                }
 7804|      0|                else
 7805|      0|                {
 7806|      0|                    return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   82|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 7807|      0|                }
 7808|      3|            }
 7809|     11|            break;
 7810|     18|    }
 7811|       |
 7812|     15|    return 0; /* rejected */
 7813|     18|}
cmp_rad_endpoints:
 7818|      1|{
 7819|       |    /* Vertex radical_vertex, radical_endpoint */
 7820|      1|    const Vertex *p1 = (const Vertex *) a1;
 7821|      1|    const Vertex *p2 = (const Vertex *) a2;
 7822|       |
 7823|      1|    if (p1[0] < p2[0])
  ------------------
  |  Branch (7823:9): [True: 0, False: 1]
  ------------------
 7824|      0|    {
 7825|      0|        return -1;
 7826|      0|    }
 7827|      1|    if (p1[0] > p2[0])
  ------------------
  |  Branch (7827:9): [True: 0, False: 1]
  ------------------
 7828|      0|    {
 7829|      0|        return 1;
 7830|      0|    }
 7831|      1|    if (p1[1] < p2[1])
  ------------------
  |  Branch (7831:9): [True: 1, False: 0]
  ------------------
 7832|      1|    {
 7833|      1|        return -1;
 7834|      1|    }
 7835|      0|    if (p1[1] > p2[1])
  ------------------
  |  Branch (7835:9): [True: 0, False: 0]
  ------------------
 7836|      0|    {
 7837|      0|        return 1;
 7838|      0|    }
 7839|       |
 7840|      0|    return 0;
 7841|      0|}
RemoveRadEndpoints:
 7846|      2|{
 7847|      2|    BNS_EDGE   *e;
 7848|      2|    EdgeIndex   ie;
 7849|      2|    BNS_VERTEX *p1, *p2;
 7850|      2|    Vertex      v1, v2;
 7851|      2|    int         i, delta, rad;
 7852|       |
 7853|      7|    for (i = pBD->nNumRadEdges - 1; 0 <= i; i--)
  ------------------
  |  Branch (7853:37): [True: 5, False: 2]
  ------------------
 7854|      5|    {
 7855|      5|        ie = pBD->RadEdges[i];
 7856|      5|        if (ie < 0 || ie >= pBNS->num_edges)
  ------------------
  |  Branch (7856:13): [True: 0, False: 5]
  |  Branch (7856:23): [True: 0, False: 5]
  ------------------
 7857|      0|        {
 7858|      0|            goto error_exit;
 7859|      0|        }
 7860|      5|        e = pBNS->edge + ie;
 7861|      5|        v1 = e->neighbor1;
 7862|      5|        v2 = e->neighbor12 ^ v1;   /* v2 > v1 <=> v2 was added later */
 7863|      5|        if (ie + 1 != pBNS->num_edges ||
  ------------------
  |  Branch (7863:13): [True: 0, False: 5]
  ------------------
 7864|      5|             v1 < 0 || v1 >= pBNS->num_vertices ||
  ------------------
  |  Branch (7864:14): [True: 0, False: 5]
  |  Branch (7864:24): [True: 0, False: 5]
  ------------------
 7865|      5|             v2 < 0 || v2 >= pBNS->num_vertices)
  ------------------
  |  Branch (7865:14): [True: 0, False: 5]
  |  Branch (7865:24): [True: 0, False: 5]
  ------------------
 7866|      0|        {
 7867|      0|            goto error_exit;
 7868|      0|        }
 7869|      5|        p1 = pBNS->vert + v1;
 7870|      5|        p2 = pBNS->vert + v2;
 7871|       |
 7872|      5|        if (p2->iedge[p2->num_adj_edges - 1] != ie ||
  ------------------
  |  Branch (7872:13): [True: 0, False: 5]
  ------------------
 7873|      5|             p1->iedge[p1->num_adj_edges - 1] != ie)
  ------------------
  |  Branch (7873:14): [True: 0, False: 5]
  ------------------
 7874|      0|        {
 7875|      0|            goto error_exit;
 7876|      0|        }
 7877|       |
 7878|      5|        p2->num_adj_edges--;
 7879|      5|        p1->num_adj_edges--;
 7880|      5|        p2->iedge[p2->num_adj_edges] = 0;
 7881|      5|        p1->iedge[p1->num_adj_edges] = 0;
 7882|      5|        p2->st_edge.flow -= e->flow;
 7883|      5|        p1->st_edge.flow -= e->flow;
 7884|       |
 7885|      5|        if (!p2->num_adj_edges && v2 >= pBNS->num_atoms)
  ------------------
  |  Branch (7885:13): [True: 2, False: 3]
  |  Branch (7885:35): [True: 2, False: 0]
  ------------------
 7886|      2|        {
 7887|      2|            if (v2 + 1 != pBNS->num_vertices)
  ------------------
  |  Branch (7887:17): [True: 0, False: 2]
  ------------------
 7888|      0|            {
 7889|      0|                goto error_exit;
 7890|      0|            }
 7891|      2|            memset( p2, 0, sizeof( *p2 ) );
 7892|      2|            pBNS->num_vertices--;
 7893|      2|        }
 7894|       |
 7895|      5|        if (!p1->num_adj_edges && v1 >= pBNS->num_atoms)
  ------------------
  |  Branch (7895:13): [True: 0, False: 5]
  |  Branch (7895:35): [True: 0, False: 0]
  ------------------
 7896|      0|        {
 7897|      0|            if (v1 + 1 != pBNS->num_vertices)
  ------------------
  |  Branch (7897:17): [True: 0, False: 0]
  ------------------
 7898|      0|            {
 7899|      0|                goto error_exit;
 7900|      0|            }
 7901|      0|            memset( p1, 0, sizeof( *p1 ) );
 7902|      0|            pBNS->num_vertices--;
 7903|      0|        }
 7904|       |
 7905|      5|        if (at && v1 < pBNS->num_atoms)
  ------------------
  |  Branch (7905:13): [True: 0, False: 5]
  |  Branch (7905:19): [True: 0, False: 0]
  ------------------
 7906|      0|        {
 7907|      0|            delta = p1->st_edge.cap - p1->st_edge.flow;
 7908|      0|            rad = at[v1].radical;
 7909|      0|            switch (delta)
  ------------------
  |  Branch (7909:21): [True: 0, False: 0]
  ------------------
 7910|      0|            {
 7911|      0|                case 0:
  ------------------
  |  Branch (7911:17): [True: 0, False: 0]
  ------------------
 7912|      0|                    if (rad == RADICAL_DOUBLET)
  ------------------
  |  |  104|      0|#define RADICAL_DOUBLET 2
  ------------------
  |  Branch (7912:25): [True: 0, False: 0]
  ------------------
 7913|      0|                    {
 7914|      0|                        rad = 0;
 7915|      0|                    }
 7916|      0|                    break;
 7917|      0|                case 1:
  ------------------
  |  Branch (7917:17): [True: 0, False: 0]
  ------------------
 7918|      0|                    if (rad != RADICAL_DOUBLET)
  ------------------
  |  |  104|      0|#define RADICAL_DOUBLET 2
  ------------------
  |  Branch (7918:25): [True: 0, False: 0]
  ------------------
 7919|      0|                    {
 7920|      0|                        rad = RADICAL_DOUBLET;
  ------------------
  |  |  104|      0|#define RADICAL_DOUBLET 2
  ------------------
 7921|      0|                    }
 7922|      0|            }
 7923|      0|            at[v1].radical = rad;
 7924|      0|        }
 7925|      5|        memset( e, 0, sizeof( *e ) );
 7926|      5|        pBNS->num_edges--;
 7927|      5|    }
 7928|      2|    pBD->nNumRadEdges = 0;
 7929|      2|    pBD->nNumRadicals = 0;
 7930|      2|    pBD->bRadSrchMode = RAD_SRCH_NORM;
 7931|      2|    return 0;
 7932|       |
 7933|      0|error_exit:
 7934|       |
 7935|      0|    return BNS_PROGRAM_ERR;
  ------------------
  |  |   78|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 7936|      2|}
SetRadEndpoints:
 8003|      5|{
 8004|      5|    int ret, i, j, k, num_new_edges, delta;
 8005|      5|    BNS_VERTEX *pRad, *pEndp;
 8006|      5|    Vertex     wRad, vRad, vEndp, nNumRadicals;
 8007|      5|    int        nDots = 0 /* added initialization, 2006-03 */, nNumEdges;
 8008|       |
 8009|      5|    if (pBNS->tot_st_cap <= pBNS->tot_st_flow)
  ------------------
  |  Branch (8009:9): [True: 0, False: 5]
  ------------------
 8010|      0|    {
 8011|      0|        return 0;
 8012|      0|    }
 8013|       |
 8014|      5|    pBD->nNumRadEndpoints = 0;
 8015|      5|    pBD->nNumRadEdges = 0;
 8016|      5|    pBD->bRadSrchMode = bRadSrchMode;
 8017|      5|    pBNS->alt_path = pBNS->altp[0];
 8018|      5|    pBNS->bChangeFlow = 0;
 8019|      5|    ret = BalancedNetworkSearch( pBNS, pBD, BNS_EF_RAD_SRCH );
  ------------------
  |  |  393|      5|#define BNS_EF_RAD_SRCH     128  /* search for rafical paths closures */
  ------------------
 8020|      5|    ReInitBnData( pBD );
 8021|      5|    ReInitBnStructAltPaths( pBNS );
 8022|      5|    if (!ret && pBD->nNumRadEndpoints >= 2)
  ------------------
  |  Branch (8022:9): [True: 5, False: 0]
  |  Branch (8022:17): [True: 2, False: 3]
  ------------------
 8023|      2|    {
 8024|       |        /* Sort by radical locations */
 8025|      2|        qsort( pBD->RadEndpoints, pBD->nNumRadEndpoints / 2, 2 * sizeof( pBD->RadEndpoints[0] ), cmp_rad_endpoints );
 8026|      2|        num_new_edges = 0;
 8027|      2|        nNumRadicals = 0;
 8028|       |
 8029|       |        /* Create new vertices (type=BNS_VERT_TYPE_TEMP) and edges with flow=cap=1 */
 8030|       |        /* connecting the new vertices radical vertices */
 8031|      4|        for (i = 0; i < pBD->nNumRadEndpoints; i = j)
  ------------------
  |  Branch (8031:21): [True: 2, False: 2]
  ------------------
 8032|      2|        {
 8033|      2|            wRad = pBD->RadEndpoints[i];
 8034|      2|            pRad = pBNS->vert + wRad;
 8035|      2|            delta = pRad->st_edge.cap - ( pRad->st_edge.flow & EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|      2|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 8036|      2|            if (delta <= 0)
  ------------------
  |  Branch (8036:17): [True: 0, False: 2]
  ------------------
 8037|      0|            {
 8038|      0|                delta = 1;
 8039|      0|            }
 8040|      2|            nNumEdges = 0;
 8041|      5|            for (j = i; j < pBD->nNumRadEndpoints && wRad == pBD->RadEndpoints[j]; j += 2)
  ------------------
  |  Branch (8041:25): [True: 3, False: 2]
  |  Branch (8041:54): [True: 3, False: 0]
  ------------------
 8042|      3|            {
 8043|      3|                nNumEdges++;
 8044|      3|            }
 8045|       |            /* Add new aux vertex to the radical atom/vertex */
 8046|      2|            vRad = bAddNewVertex( pBNS, wRad, delta, delta, nNumEdges + 1, &nDots );
 8047|      2|            if (IS_BNS_ERROR( vRad ))
  ------------------
  |  |   95|      2|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      2|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      2|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      2|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 2, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 2]
  |  |  ------------------
  ------------------
 8048|      0|            {
 8049|      0|                ret = vRad;
 8050|      0|                goto error_exit;
 8051|      0|            }
 8052|      2|            pRad = pBNS->vert + vRad;
 8053|      2|            pBD->RadEdges[pBD->nNumRadEdges++] = pRad->iedge[pRad->num_adj_edges - 1];
 8054|       |            /* Replace references to vertex wRad with vRad */
 8055|      5|            for (k = i, nNumEdges = 0; k < j; k += 2)
  ------------------
  |  Branch (8055:40): [True: 3, False: 2]
  ------------------
 8056|      3|            {
 8057|      3|                pBD->RadEndpoints[k] = vRad;
 8058|      3|            }
 8059|      2|            nNumRadicals++;
 8060|      2|        }
 8061|       |        /* All vRad vertex indices should be in the range vFirstNewVertex...vFirstNewVertex+nNumRadicals-1 */
 8062|       |        /* connect new vertices to the radical endpoints thus replacing radicals with even-length alternating cycles */
 8063|      4|        for (i = 0; i < pBD->nNumRadEndpoints; i = j)
  ------------------
  |  Branch (8063:21): [True: 2, False: 2]
  ------------------
 8064|      2|        {
 8065|      2|            vRad = pBD->RadEndpoints[i];
 8066|      2|            pRad = pBNS->vert + vRad;
 8067|      5|            for (j = i; j < pBD->nNumRadEndpoints && vRad == pBD->RadEndpoints[j]; j += 2)
  ------------------
  |  Branch (8067:25): [True: 3, False: 2]
  |  Branch (8067:54): [True: 3, False: 0]
  ------------------
 8068|      3|            {
 8069|       |                /* Connect vew vertex pRad to radical endpoints */
 8070|      3|                vEndp = pBD->RadEndpoints[j + 1];
 8071|      3|                pEndp = pBNS->vert + vEndp;
 8072|      3|                ret = AddNewEdge( pRad, pEndp, pBNS, 1, 0 );
 8073|      3|                if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      3|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      3|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      3|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      3|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 3, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 3]
  |  |  ------------------
  ------------------
 8074|      0|                {
 8075|      0|                    goto error_exit;
 8076|      0|                }
 8077|      3|                pBD->RadEdges[pBD->nNumRadEdges++] = ret;
 8078|      3|            }
 8079|      2|        }
 8080|      2|        pBD->nNumRadicals = nNumRadicals;
 8081|      2|        return nNumRadicals; /* done */
 8082|      2|    }
 8083|       |
 8084|      3|    return 0; /* nothing to do */
 8085|       |
 8086|      0|error_exit:
 8087|      0|    RemoveRadEndpoints( pBNS, pBD, NULL );
 8088|       |
 8089|      0|    return ret;
 8090|      5|}
AllocateAndInitBnStruct:
 8736|   110k|{
 8737|   110k|    BN_STRUCT   *pBNS = NULL;
 8738|   110k|    BNS_VERTEX  *vert;
 8739|       |
 8740|   110k|    int    neigh, num_changed_bonds = 0;
 8741|   110k|    U_CHAR bond_type, bond_mark;
 8742|       |
 8743|   110k|    int i, j, k, n_edges, num_bonds, num_edges, f1, f2, edge_cap, edge_flow, st_cap, st_flow, flag_alt_bond;
 8744|   110k|    int tot_st_cap, tot_st_flow;
 8745|   110k|    int max_tg, max_edges, max_vertices, len_alt_path, max_iedges, num_altp;
 8746|   110k|#if ( BNS_RAD_SEARCH == 1 )
 8747|   110k|    int num_rad = 0;
 8748|       |
 8749|   110k|    nMaxAddEdges += 1;
 8750|   110k|#endif
 8751|       |#if ( FIX_NUM_TG == 1 )
 8752|       |    max_tg = inchi_max( num_atoms / 2, 5 );
 8753|       |#else
 8754|   110k|    max_tg = num_atoms;
 8755|   110k|#endif
 8756|   110k|    num_changed_bonds = 0;
 8757|       |
 8758|   222k|    for (i = 0, num_bonds = 0; i < num_atoms; i++)
  ------------------
  |  Branch (8758:32): [True: 112k, False: 110k]
  ------------------
 8759|   112k|    {
 8760|   112k|        num_bonds += at[i].valence;
 8761|   112k|#if ( BNS_RAD_SEARCH == 1 )
 8762|   112k|        num_rad += ( at[i].radical == RADICAL_DOUBLET );
  ------------------
  |  |  104|   112k|#define RADICAL_DOUBLET 2
  ------------------
 8763|   112k|#endif
 8764|   112k|    }
 8765|       |    /* Each atom has enough edges to belong to a tautomeric group + nMaxAddEdges */
 8766|       |    /* number of atoms is large enough to accommodate max. possible number of t-groups + nMaxAddAtoms */
 8767|       |    /* max_altp cannot be larger than BN_MAX_ALTP = 16 */
 8768|   110k|    num_edges = ( num_bonds /= 2 );
 8769|       |    /* +1 for a super-tautomeric group */
 8770|   110k|    max_vertices = num_atoms + nMaxAddAtoms + max_tg + 1;
 8771|       |    /* +max_tg for edges between t-groups and super-tautomeric group */
 8772|   110k|    max_edges = num_edges + ( nMaxAddEdges + NUM_KINDS_OF_GROUPS )*max_vertices + max_tg;
  ------------------
  |  |  114|   110k|#define NUM_KINDS_OF_GROUPS  2  /* 1 accounts for t-group kind, one more 1 accounts for c-group kind */
  ------------------
 8773|   110k|#if ( BNS_RAD_SEARCH == 1 )
 8774|   110k|    if (num_rad)
  ------------------
  |  Branch (8774:9): [True: 6, False: 110k]
  ------------------
 8775|      6|    {
 8776|      6|        max_vertices *= 2;
 8777|      6|        max_edges *= 2;
 8778|      6|    }
 8779|   110k|#endif
 8780|   110k|    max_iedges = 2 * max_edges;
 8781|   110k|    len_alt_path = max_vertices + iALTP_HDR_LEN + 1; /* may overflow if an edge is traversed in 2 directions */
 8782|       |
 8783|   110k|    if (!( pBNS = (BN_STRUCT   *) inchi_calloc( 1, sizeof( BN_STRUCT ) ) ) ||
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
  |  Branch (8783:9): [True: 0, False: 110k]
  ------------------
 8784|   110k|         !( pBNS->edge = (BNS_EDGE    *) inchi_calloc( max_edges, sizeof( BNS_EDGE ) ) ) ||
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
  |  Branch (8784:10): [True: 0, False: 110k]
  ------------------
 8785|   110k|         !( pBNS->vert = (BNS_VERTEX  *) inchi_calloc( max_vertices, sizeof( BNS_VERTEX ) ) ) ||
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
  |  Branch (8785:10): [True: 0, False: 110k]
  ------------------
 8786|   110k|         !( pBNS->iedge = (BNS_IEDGE   *) inchi_calloc( max_iedges, sizeof( BNS_IEDGE ) ) ))
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
  |  Branch (8786:10): [True: 0, False: 110k]
  ------------------
 8787|      0|    {
 8788|      0|        return DeAllocateBnStruct( pBNS );
 8789|      0|    }
 8790|       |    /* Alt path init */
 8791|  1.87M|    for (num_altp = 0; num_altp < max_altp && num_altp < BN_MAX_ALTP; num_altp++)
  ------------------
  |  |   45|  1.76M|#define BN_MAX_ALTP  16
  ------------------
  |  Branch (8791:24): [True: 1.76M, False: 110k]
  |  Branch (8791:47): [True: 1.76M, False: 0]
  ------------------
 8792|  1.76M|    {
 8793|  1.76M|        if (!( pBNS->altp[num_altp] = (BNS_ALT_PATH*) inchi_calloc( len_alt_path, sizeof( BNS_ALT_PATH ) ) ))
  ------------------
  |  | 1133|  1.76M|#define inchi_calloc   calloc
  ------------------
  |  Branch (8793:13): [True: 0, False: 1.76M]
  ------------------
 8794|      0|        {
 8795|      0|            return DeAllocateBnStruct( pBNS );
 8796|      0|        }
 8797|  1.76M|        ALTP_ALLOCATED_LEN( pBNS->altp[num_altp] ) = len_alt_path;
  ------------------
  |  |  139|  1.76M|#define ALTP_ALLOCATED_LEN(altp)        (altp)[iALTP_MAX_LEN].number
  ------------------
 8798|  1.76M|        pBNS->len_alt_path = len_alt_path;  /* ??? duplication ??? */
 8799|       |                                            /* re-init */
 8800|  1.76M|        ALTP_DELTA( pBNS->altp[num_altp] ) = 0;
  ------------------
  |  |  140|  1.76M|#define ALTP_DELTA(altp)                 (altp)[iALTP_FLOW].flow[0]
  ------------------
 8801|  1.76M|        ALTP_START_ATOM( pBNS->altp[num_altp] ) = NO_VERTEX;
  ------------------
  |  |  131|  1.76M|#define ALTP_START_ATOM(altp)           (altp)[iALTP_START_ATOM].number
  ------------------
                      ALTP_START_ATOM( pBNS->altp[num_altp] ) = NO_VERTEX;
  ------------------
  |  |  146|  1.76M|#define NO_VERTEX    -2
  ------------------
 8802|  1.76M|        ALTP_END_ATOM( pBNS->altp[num_altp] ) = NO_VERTEX;
  ------------------
  |  |  130|  1.76M|#define ALTP_END_ATOM(altp)             (altp)[iALTP_END_ATOM].number
  ------------------
                      ALTP_END_ATOM( pBNS->altp[num_altp] ) = NO_VERTEX;
  ------------------
  |  |  146|  1.76M|#define NO_VERTEX    -2
  ------------------
 8803|  1.76M|        ALTP_PATH_LEN( pBNS->altp[num_altp] ) = 0;
  ------------------
  |  |  129|  1.76M|#define ALTP_PATH_LEN(altp)             (altp)[iALTP_PATH_LEN].number  /* number of bonds = number of atoms-1*/
  ------------------
 8804|  1.76M|    }
 8805|   110k|    pBNS->alt_path = NULL;
 8806|   110k|    pBNS->num_altp = 0;
 8807|   110k|    pBNS->max_altp = num_altp;
 8808|       |
 8809|       |    /* Fill vertices (no connectivity) */
 8810|   110k|    pBNS->vert[0].iedge = pBNS->iedge;
 8811|   222k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (8811:17): [True: 112k, False: 110k]
  ------------------
 8812|   112k|    {
 8813|   112k|        k = pBNS->vert[i].max_adj_edges = at[i].valence + ( nMaxAddEdges + NUM_KINDS_OF_GROUPS );
  ------------------
  |  |  114|   112k|#define NUM_KINDS_OF_GROUPS  2  /* 1 accounts for t-group kind, one more 1 accounts for c-group kind */
  ------------------
 8814|   112k|        pBNS->vert[i + 1].iedge = pBNS->vert[i].iedge + k;
 8815|   112k|    }
 8816|   110k|    pBNS->num_atoms = num_atoms;      /* number of real atoms */
 8817|   110k|    pBNS->num_added_atoms = 0;
 8818|   110k|    pBNS->num_t_groups = 0;              /* number of added t-groups */
 8819|   110k|    pBNS->num_c_groups = 0;
 8820|   110k|    pBNS->nMaxAddAtoms = nMaxAddAtoms;
 8821|   110k|    pBNS->nMaxAddEdges = nMaxAddEdges;
 8822|       |
 8823|   110k|    pBNS->num_vertices = num_atoms;     /*  current number of vertices, a sum of
 8824|       |                                        pBNS->num_atoms
 8825|       |                                        pBNS->num_t_groups
 8826|       |                                        pBNS->num_added_atoms           */
 8827|   110k|    pBNS->max_vertices = max_vertices;
 8828|       |
 8829|       |
 8830|   110k|    pBNS->num_bonds = num_bonds;        /* number of real edges (bonds)         */
 8831|   110k|    pBNS->max_edges = max_edges;
 8832|   110k|    pBNS->max_iedges = max_iedges;
 8833|       |
 8834|       |    /*
 8835|       |    To remove t-groups and added atoms:
 8836|       |    In atoms i = 0..pBNS->num_atoms-1
 8837|       |    pBNS->vert[i].num_adj_edges = pBNS->vert[i].max_adj_edges - pBNS->nMaxAddEdges - NUM_KINDS_OF_GROUPS;
 8838|       |    pBNS->num_vertices    = pBNS->num_atoms;
 8839|       |    pBNS->num_edges       = pBNS->num_bonds;
 8840|       |    pBNS->num_added_atoms = 0;
 8841|       |    pBNS->num_t_groups    = 0;
 8842|       |    pBNS->num_added_edges = 0;
 8843|       |
 8844|       |    ALTP_DELTA(pBNS->alt_path)      = 0;
 8845|       |    ALTP_START_ATOM(pBNS->alt_path) = NO_VERTEX;
 8846|       |    ALTP_END_ATOM(pBNS->alt_path)   = NO_VERTEX;
 8847|       |    ALTP_PATH_LEN(pBNS->alt_path)   = 0;
 8848|       |    */
 8849|       |
 8850|       |    /* Fill edges and connectivity */
 8851|   110k|    tot_st_cap = tot_st_flow = 0;
 8852|   222k|    for (i = 0, n_edges = 0; i < num_atoms; i++)
  ------------------
  |  Branch (8852:30): [True: 112k, False: 110k]
  ------------------
 8853|   112k|    {
 8854|   112k|        vert = &pBNS->vert[i];
 8855|   112k|        st_cap = 0;
 8856|   112k|        st_flow = 0;
 8857|   112k|        flag_alt_bond = 0;
 8858|   112k|        for (j = 0; j < at[i].valence; j++)
  ------------------
  |  Branch (8858:21): [True: 64, False: 112k]
  ------------------
 8859|     64|        {
 8860|     64|            neigh = at[i].neighbor[j];
 8861|       |            /* find this bond at the neighbor */
 8862|     88|            for (k = 0; k < at[neigh].valence; k++)
  ------------------
  |  Branch (8862:25): [True: 88, False: 0]
  ------------------
 8863|     88|            {
 8864|     88|                if (at[neigh].neighbor[k] == i)
  ------------------
  |  Branch (8864:21): [True: 64, False: 24]
  ------------------
 8865|     64|                {
 8866|     64|                    break;
 8867|     64|                }
 8868|     88|            }
 8869|     64|            bond_type = ( at[i].bond_type[j] & BOND_TYPE_MASK );
  ------------------
  |  |  217|     64|#define BOND_TYPE_MASK        0x0f
  ------------------
 8870|     64|            bond_mark = ( at[i].bond_type[j] & ~BOND_TYPE_MASK );
  ------------------
  |  |  217|     64|#define BOND_TYPE_MASK        0x0f
  ------------------
 8871|     64|            if (bond_type != BOND_SINGLE && bond_type != BOND_DOUBLE &&
  ------------------
  |  |  205|     64|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   60|    128|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
                          if (bond_type != BOND_SINGLE && bond_type != BOND_DOUBLE &&
  ------------------
  |  |  206|     16|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   61|     80|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (8871:17): [True: 16, False: 48]
  |  Branch (8871:45): [True: 0, False: 16]
  ------------------
 8872|     64|                 bond_type != BOND_TRIPLE /*&& bond_type != BOND_ALTERN*/)
  ------------------
  |  |  207|      0|#define BOND_TRIPLE BOND_TYPE_TRIPLE  /* 3                                  */
  |  |  ------------------
  |  |  |  |   62|      0|#define BOND_TYPE_TRIPLE    3
  |  |  ------------------
  ------------------
  |  Branch (8872:18): [True: 0, False: 0]
  ------------------
 8873|      0|            {
 8874|       |                /* Make Unknown or Alternating bonds single */
 8875|      0|                bond_type = 1;
 8876|      0|                at[i].bond_type[j] = bond_mark | bond_type;
 8877|      0|                num_changed_bonds++;
 8878|      0|            }
 8879|     64|            if (neigh > i)
  ------------------
  |  Branch (8879:17): [True: 32, False: 32]
  ------------------
 8880|     32|            {
 8881|       |                /* This is the first time we encounter this bond */
 8882|     32|                f1 = MAX_AT_FLOW( at[i] );
  ------------------
  |  |  171|     32|#define MAX_AT_FLOW(X) (((X).chem_bonds_valence - (X).valence)+\
  |  |  172|     32|                       ((is_centerpoint_elem((X).el_number)||get_endpoint_valence((X).el_number))?\
  |  |  ------------------
  |  |  |  Branch (172:26): [True: 20, False: 12]
  |  |  |  Branch (172:62): [True: 12, False: 0]
  |  |  ------------------
  |  |  173|     32|                           (((X).radical==RADICAL_DOUBLET)/*+2*((X).radical==RADICAL_TRIPLET)*/):0))
  |  |  ------------------
  |  |  |  |  104|     32|#define RADICAL_DOUBLET 2
  |  |  ------------------
  ------------------
 8883|     32|                f2 = MAX_AT_FLOW( at[neigh] );
  ------------------
  |  |  171|     32|#define MAX_AT_FLOW(X) (((X).chem_bonds_valence - (X).valence)+\
  |  |  172|     32|                       ((is_centerpoint_elem((X).el_number)||get_endpoint_valence((X).el_number))?\
  |  |  ------------------
  |  |  |  Branch (172:26): [True: 22, False: 10]
  |  |  |  Branch (172:62): [True: 6, False: 4]
  |  |  ------------------
  |  |  173|     32|                           (((X).radical==RADICAL_DOUBLET)/*+2*((X).radical==RADICAL_TRIPLET)*/):0))
  |  |  ------------------
  |  |  |  |  104|     28|#define RADICAL_DOUBLET 2
  |  |  ------------------
  ------------------
 8884|     32|                edge_flow = bond_type - 1;
 8885|     32|                if (edge_flow > MAX_BOND_EDGE_CAP)
  ------------------
  |  |  151|     32|#define MAX_BOND_EDGE_CAP           2  /* triple bond */
  ------------------
  |  Branch (8885:21): [True: 0, False: 32]
  ------------------
 8886|      0|                {
 8887|      0|                    flag_alt_bond++;
 8888|      0|                    edge_flow = 0;  /* BNS will determine flows (that is, bonds) */
 8889|      0|                    edge_cap = AROM_BOND_EDGE_CAP;
  ------------------
  |  |  152|      0|#define AROM_BOND_EDGE_CAP          1
  ------------------
 8890|      0|                }
 8891|     32|                else
 8892|     32|                {
 8893|       |#if ( 0 && KETO_ENOL_TAUT == 1 )  /* ????? */
 8894|       |                    edge_cap = inchi_max( f1, f2 );
 8895|       |#else
 8896|     32|                    edge_cap = inchi_min( f1, f2 );
  ------------------
  |  |  167|     32|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 14, False: 18]
  |  |  ------------------
  ------------------
 8897|     32|#endif
 8898|     32|                    edge_cap = inchi_min( edge_cap, MAX_BOND_EDGE_CAP ); /* max capacity = 2 means up to triple bond */
  ------------------
  |  |  167|     32|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 32, False: 0]
  |  |  ------------------
  ------------------
 8899|     32|                }
 8900|       |
 8901|     32|                pBNS->edge[n_edges].neighbor1 = (AT_NUMB) i;
 8902|     32|                pBNS->edge[n_edges].neighbor12 = (AT_NUMB) ( i ^ neigh );
 8903|     32|                pBNS->edge[n_edges].flow = pBNS->edge[n_edges].flow0 = edge_flow;
 8904|     32|                pBNS->edge[n_edges].cap = pBNS->edge[n_edges].cap0 = edge_cap;
 8905|     32|                pBNS->edge[n_edges].neigh_ord[0] = j;
 8906|     32|                pBNS->edge[n_edges].neigh_ord[1] = k;
 8907|     32|                pBNS->edge[n_edges].pass = 0;
 8908|     32|                pBNS->edge[n_edges].forbidden = 0;
 8909|       |
 8910|     32|                vert->iedge[j] = pBNS->vert[neigh].iedge[k] = n_edges++;
 8911|     32|            }
 8912|     32|            else
 8913|     32|            {
 8914|       |                /* This is the second time we encounter this bond. It was stored at */
 8915|     32|                int  iedge = pBNS->vert[neigh].iedge[k];
 8916|     32|                edge_cap = pBNS->edge[iedge].cap;
 8917|     32|                edge_flow = pBNS->edge[iedge].flow;
 8918|     32|            }
 8919|     64|            st_flow += edge_flow;
 8920|     64|            st_cap += edge_cap;
 8921|     64|        }
 8922|   112k|        vert->num_adj_edges = j;
 8923|   112k|        vert->st_edge.cap =
 8924|   112k|            vert->st_edge.cap0 = MAX_AT_FLOW( at[i] );
  ------------------
  |  |  171|   112k|#define MAX_AT_FLOW(X) (((X).chem_bonds_valence - (X).valence)+\
  |  |  172|   112k|                       ((is_centerpoint_elem((X).el_number)||get_endpoint_valence((X).el_number))?\
  |  |  ------------------
  |  |  |  Branch (172:26): [True: 1.57k, False: 111k]
  |  |  |  Branch (172:62): [True: 64, False: 111k]
  |  |  ------------------
  |  |  173|   112k|                           (((X).radical==RADICAL_DOUBLET)/*+2*((X).radical==RADICAL_TRIPLET)*/):0))
  |  |  ------------------
  |  |  |  |  104|  1.63k|#define RADICAL_DOUBLET 2
  |  |  ------------------
  ------------------
 8925|   112k|        vert->st_edge.flow =
 8926|   112k|            vert->st_edge.flow0 = st_flow;
 8927|   112k|        vert->type = BNS_VERT_TYPE_ATOM;
  ------------------
  |  |   73|   112k|#define BNS_VERT_TYPE_ATOM          0x0001
  ------------------
 8928|   112k|        tot_st_cap += vert->st_edge.cap;
 8929|   112k|        tot_st_flow += vert->st_edge.flow;
 8930|   112k|    }
 8931|   110k|    *pNum_changed_bonds = num_changed_bonds / 2;
 8932|       |
 8933|   110k|    pBNS->num_edges = n_edges;   /* number of edges */
 8934|   110k|    pBNS->num_added_edges = 0;
 8935|       |
 8936|   110k|    pBNS->tot_st_cap = tot_st_cap;
 8937|   110k|    pBNS->tot_st_flow = tot_st_flow;
 8938|       |
 8939|   110k|    return pBNS;
 8940|   110k|}
DeAllocateBnStruct:
 8945|   110k|{
 8946|   110k|    int i;
 8947|   110k|    if (pBNS)
  ------------------
  |  Branch (8947:9): [True: 110k, False: 39]
  ------------------
 8948|   110k|    {
 8949|   110k|        if (pBNS->edge)
  ------------------
  |  Branch (8949:13): [True: 110k, False: 0]
  ------------------
 8950|   110k|        {
 8951|   110k|            inchi_free( pBNS->edge );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 8952|   110k|        }
 8953|  1.88M|        for (i = 0; i < pBNS->max_altp && i < BN_MAX_ALTP; i++)
  ------------------
  |  |   45|  1.77M|#define BN_MAX_ALTP  16
  ------------------
  |  Branch (8953:21): [True: 1.77M, False: 110k]
  |  Branch (8953:43): [True: 1.77M, False: 0]
  ------------------
 8954|  1.77M|        {
 8955|  1.77M|            if (pBNS->altp[i])
  ------------------
  |  Branch (8955:17): [True: 1.77M, False: 0]
  ------------------
 8956|  1.77M|            {
 8957|  1.77M|                inchi_free( pBNS->altp[i] );
  ------------------
  |  | 1136|  1.77M|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 1.77M, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 8958|  1.77M|            }
 8959|  1.77M|        }
 8960|   110k|        if (pBNS->vert)
  ------------------
  |  Branch (8960:13): [True: 110k, False: 0]
  ------------------
 8961|   110k|        {
 8962|   110k|            if (pBNS->vert[0].iedge)
  ------------------
  |  Branch (8962:17): [True: 110k, False: 0]
  ------------------
 8963|   110k|            {
 8964|   110k|                inchi_free( pBNS->vert[0].iedge );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 8965|   110k|            }
 8966|   110k|            inchi_free( pBNS->vert );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 8967|   110k|        }
 8968|   110k|        inchi_free( pBNS );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 8969|   110k|    }
 8970|       |
 8971|   110k|    return NULL;
 8972|   110k|}
ReInitBnStructAltPaths:
 8977|   221k|{
 8978|   221k|    int i;
 8979|  3.76M|    for (i = 0; i < pBNS->max_altp && i < BN_MAX_ALTP; i++)
  ------------------
  |  |   45|  3.54M|#define BN_MAX_ALTP  16
  ------------------
  |  Branch (8979:17): [True: 3.54M, False: 221k]
  |  Branch (8979:39): [True: 3.54M, False: 0]
  ------------------
 8980|  3.54M|    {
 8981|  3.54M|        if (pBNS->altp[i])
  ------------------
  |  Branch (8981:13): [True: 3.54M, False: 0]
  ------------------
 8982|  3.54M|        {
 8983|  3.54M|            ALTP_DELTA( pBNS->altp[i] ) = 0;
  ------------------
  |  |  140|  3.54M|#define ALTP_DELTA(altp)                 (altp)[iALTP_FLOW].flow[0]
  ------------------
 8984|  3.54M|            ALTP_PATH_LEN( pBNS->altp[i] ) = 0;
  ------------------
  |  |  129|  3.54M|#define ALTP_PATH_LEN(altp)             (altp)[iALTP_PATH_LEN].number  /* number of bonds = number of atoms-1*/
  ------------------
 8985|  3.54M|            ALTP_START_ATOM( pBNS->altp[i] ) = NO_VERTEX;
  ------------------
  |  |  131|  3.54M|#define ALTP_START_ATOM(altp)           (altp)[iALTP_START_ATOM].number
  ------------------
                          ALTP_START_ATOM( pBNS->altp[i] ) = NO_VERTEX;
  ------------------
  |  |  146|  3.54M|#define NO_VERTEX    -2
  ------------------
 8986|  3.54M|            ALTP_END_ATOM( pBNS->altp[i] ) = NO_VERTEX;
  ------------------
  |  |  130|  3.54M|#define ALTP_END_ATOM(altp)             (altp)[iALTP_END_ATOM].number
  ------------------
                          ALTP_END_ATOM( pBNS->altp[i] ) = NO_VERTEX;
  ------------------
  |  |  146|  3.54M|#define NO_VERTEX    -2
  ------------------
 8987|  3.54M|        }
 8988|  3.54M|    }
 8989|   221k|    pBNS->alt_path = NULL;
 8990|   221k|    pBNS->num_altp = 0;
 8991|   221k|    return i;
 8992|   221k|}
ReInitBnStruct:
 9040|   110k|{
 9041|   110k|    int i, vfict, kfict, iedgefict, endpoint, centerpoint, iedge, k;
 9042|   110k|    int ret = 0;
 9043|   110k|    if (pBNS)
  ------------------
  |  Branch (9043:9): [True: 110k, False: 0]
  ------------------
 9044|   110k|    {
 9045|   110k|        if (pBNS->vert && pBNS->edge)
  ------------------
  |  Branch (9045:13): [True: 110k, False: 0]
  |  Branch (9045:27): [True: 110k, False: 0]
  ------------------
 9046|   110k|        {
 9047|       |            /* Debug */
 9048|   110k|            for (k = 0, i = 0; k < pBNS->num_edges; k++)
  ------------------
  |  Branch (9048:32): [True: 56, False: 110k]
  ------------------
 9049|     56|            {
 9050|     56|                if (pBNS->edge[k].pass)
  ------------------
  |  Branch (9050:21): [True: 0, False: 56]
  ------------------
 9051|      0|                {
 9052|      0|                    i++;
 9053|      0|                }
 9054|     56|            }
 9055|   110k|            ret += i * 100;
 9056|       |            /* Restore flow and cap on edges to vertices connected to fictitious atoms */
 9057|   110k|            for (vfict = pBNS->num_atoms; vfict < pBNS->num_vertices; vfict++)
  ------------------
  |  Branch (9057:43): [True: 4, False: 110k]
  ------------------
 9058|      4|            {
 9059|     12|                for (kfict = 0; kfict < pBNS->vert[vfict].num_adj_edges; kfict++)
  ------------------
  |  Branch (9059:33): [True: 8, False: 4]
  ------------------
 9060|      8|                {
 9061|      8|                    iedgefict = pBNS->vert[vfict].iedge[kfict]; /* fictitious edge to the endpoint */
 9062|      8|                    endpoint = pBNS->edge[iedgefict].neighbor12 ^ vfict;  /* the endpoint */
 9063|       |                                                                          /* To simlify restore cap and flow in ALL edges to the endpoint */
 9064|      8|                    if (bRemoveGroupsFromAtoms && endpoint < num_at)
  ------------------
  |  Branch (9064:25): [True: 0, False: 8]
  |  Branch (9064:51): [True: 0, False: 0]
  ------------------
 9065|      0|                    {
 9066|      0|                        at[endpoint].c_point = 0;
 9067|      0|                        at[endpoint].endpoint = 0;
 9068|      0|                    }
 9069|     24|                    for (k = 0; k < pBNS->vert[endpoint].num_adj_edges; k++)
  ------------------
  |  Branch (9069:33): [True: 16, False: 8]
  ------------------
 9070|     16|                    {
 9071|     16|                        iedge = pBNS->vert[endpoint].iedge[k]; /* edge to endpoint */
 9072|     16|                        centerpoint = pBNS->edge[iedge].neighbor12 ^ endpoint;
 9073|     16|                        pBNS->edge[iedge].cap = pBNS->edge[iedge].cap0;
 9074|     16|                        pBNS->edge[iedge].flow = pBNS->edge[iedge].flow0;
 9075|     16|                        pBNS->edge[iedge].pass = 0;
 9076|     16|#if ( RESET_EDGE_FORBIDDEN_MASK == 1 )
 9077|     16|                        pBNS->edge[iedge].forbidden &= pBNS->edge_forbidden_mask;
 9078|     16|#endif
 9079|     16|                        pBNS->vert[centerpoint].st_edge.cap = pBNS->vert[centerpoint].st_edge.cap0;
 9080|     16|                        pBNS->vert[centerpoint].st_edge.flow = pBNS->vert[centerpoint].st_edge.flow0;
 9081|     16|                    }
 9082|      8|                    pBNS->vert[endpoint].st_edge.cap = pBNS->vert[endpoint].st_edge.cap0;
 9083|      8|                    pBNS->vert[endpoint].st_edge.flow = pBNS->vert[endpoint].st_edge.flow0;
 9084|      8|                    pBNS->vert[endpoint].type &= BNS_VERT_TYPE_ATOM;
  ------------------
  |  |   73|      8|#define BNS_VERT_TYPE_ATOM          0x0001
  ------------------
 9085|      8|                }
 9086|      4|            }
 9087|       |            /* Reset number of neighbors */
 9088|   110k|            if (pBNS->num_edges > pBNS->num_bonds)
  ------------------
  |  Branch (9088:17): [True: 4, False: 110k]
  ------------------
 9089|      4|            {
 9090|     24|                for (i = 0; i < pBNS->num_atoms; i++)
  ------------------
  |  Branch (9090:29): [True: 20, False: 4]
  ------------------
 9091|     20|                {
 9092|     20|                    pBNS->vert[i].num_adj_edges =
 9093|     20|                        pBNS->vert[i].max_adj_edges - pBNS->nMaxAddEdges - NUM_KINDS_OF_GROUPS;
  ------------------
  |  |  114|     20|#define NUM_KINDS_OF_GROUPS  2  /* 1 accounts for t-group kind, one more 1 accounts for c-group kind */
  ------------------
 9094|     20|                }
 9095|      4|            }
 9096|   110k|        }
 9097|      0|        else
 9098|      0|        {
 9099|      0|            ret += 2;
 9100|      0|        }
 9101|   110k|        if (!pBNS->edge)
  ------------------
  |  Branch (9101:13): [True: 0, False: 110k]
  ------------------
 9102|      0|        {
 9103|      0|            ret += 4;
 9104|      0|        }
 9105|   110k|        if (!pBNS->iedge)
  ------------------
  |  Branch (9105:13): [True: 0, False: 110k]
  ------------------
 9106|      0|        {
 9107|      0|            ret += 8;
 9108|      0|        }
 9109|       |
 9110|   110k|        ReInitBnStructAltPaths( pBNS );
 9111|       |
 9112|   110k|        pBNS->num_vertices = pBNS->num_atoms;
 9113|   110k|        pBNS->num_edges = pBNS->num_bonds;
 9114|   110k|        pBNS->num_added_atoms = 0;
 9115|   110k|        pBNS->num_t_groups = 0;
 9116|   110k|        pBNS->num_c_groups = 0;
 9117|   110k|        pBNS->num_added_edges = 0;
 9118|   110k|    }
 9119|      0|    else
 9120|      0|    {
 9121|      0|        ret += 1;
 9122|      0|    }
 9123|       |
 9124|   110k|    return ret;
 9125|   110k|}
AddTGroups2BnStruct:
 9148|      4|{
 9149|      4|    int ret = 0;
 9150|       |    /* ret = ReInitBnStruct( pBNS ); */
 9151|      4|    if (tgi && tgi->num_t_groups && tgi->t_group)
  ------------------
  |  Branch (9151:9): [True: 4, False: 0]
  |  Branch (9151:16): [True: 4, False: 0]
  |  Branch (9151:37): [True: 4, False: 0]
  ------------------
 9152|      4|    {
 9153|      4|        int         i, k, endpoint, centerpoint, fictpoint;
 9154|      4|        int         num_tg = tgi->num_t_groups;
 9155|      4|        int         num_edges = pBNS->num_edges;
 9156|      4|        int         num_vertices = pBNS->num_vertices;
 9157|      4|        BNS_VERTEX *vert_ficpoint, *ver_ficpont_prev;  /* fictitious vertex describing t-group */
 9158|      4|        BNS_VERTEX *vert_endpoint;
 9159|      4|        BNS_EDGE   *edge;      /* edge between that vertex and the tautomeric endpoint */
 9160|      4|        int        nMaxTGroupNumber = 0;
 9161|      4|        ENDPOINT_INFO eif;
 9162|       |
 9163|       |        /* Debug: check overflow */
 9164|      4|        if (num_vertices + num_tg >= pBNS->max_vertices)
  ------------------
  |  Branch (9164:13): [True: 0, False: 4]
  ------------------
 9165|      0|        {
 9166|      0|            return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   82|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 9167|      0|        }
 9168|       |        /* Find the largest t-group ID */
 9169|      8|        for (i = 0; i < num_tg; i++)
  ------------------
  |  Branch (9169:21): [True: 4, False: 4]
  ------------------
 9170|      4|        {
 9171|      4|            if (tgi->t_group[i].nGroupNumber > nMaxTGroupNumber)
  ------------------
  |  Branch (9171:17): [True: 4, False: 0]
  ------------------
 9172|      4|            {
 9173|      4|                nMaxTGroupNumber = tgi->t_group[i].nGroupNumber;
 9174|      4|            }
 9175|      4|        }
 9176|       |        /* Since t-group IDs may be not contiguous, clear all vertices that will be added.
 9177|       |        all-zeroes-vertex will be ignored by the BNS
 9178|       |        */
 9179|      4|        memset( pBNS->vert + num_vertices, 0, nMaxTGroupNumber * sizeof( pBNS->vert[0] ) );
 9180|       |        /* Make sure the last t-group has the largest t-group ID:
 9181|       |        this is necessary to correctly add new edges
 9182|       |        and vertices for testing augmenting paths            */
 9183|       |#if ( bRELEASE_VERSION != 1 )
 9184|       |        insertions_sort( pCG, tgi->t_group, num_tg, sizeof( tgi->t_group[0] ), CompTGroupNumber );
 9185|       |        for (i = 1; i < num_tg; i++)
 9186|       |        {
 9187|       |            if (1 != tgi->t_group[i].nGroupNumber - tgi->t_group[i - 1].nGroupNumber)
 9188|       |            {
 9189|       |                return BNS_BOND_ERR;
 9190|       |            }
 9191|       |        }
 9192|       |#else
 9193|      4|        if (nMaxTGroupNumber != tgi->t_group[num_tg - 1].nGroupNumber)
  ------------------
  |  Branch (9193:13): [True: 0, False: 4]
  ------------------
 9194|      0|        {
 9195|      0|            insertions_sort( pCG, tgi->t_group, num_tg, sizeof( tgi->t_group[0] ), CompTGroupNumber );
 9196|      0|        }
 9197|      4|#endif
 9198|       |        /* Initialize new fictitious vertices */
 9199|      4|        ver_ficpont_prev = pBNS->vert + num_vertices - 1;
 9200|       |
 9201|      8|        for (i = 0; i < num_tg; i++, ver_ficpont_prev = vert_ficpoint)
  ------------------
  |  Branch (9201:21): [True: 4, False: 4]
  ------------------
 9202|      4|        {
 9203|       |            /*
 9204|       |            vert_ficpoint-1 is the last vertex;
 9205|       |            vert_ficpoint   is the vertex that is being added
 9206|       |            Note: nGroupNumber are not contiguous
 9207|       |            */
 9208|      4|            vert_ficpoint = pBNS->vert + num_vertices + tgi->t_group[i].nGroupNumber - 1;
 9209|      4|            vert_ficpoint->iedge = ver_ficpont_prev->iedge + ver_ficpont_prev->max_adj_edges;
 9210|      4|            vert_ficpoint->max_adj_edges = tgi->t_group[i].nNumEndpoints + BNS_ADD_EDGES + BNS_ADD_SUPER_TGROUP;
  ------------------
  |  |  117|      4|#define BNS_ADD_EDGES        1  /* max. number of edges to add to each atom (except edges to a t-group or c-group) */
  ------------------
                          vert_ficpoint->max_adj_edges = tgi->t_group[i].nNumEndpoints + BNS_ADD_EDGES + BNS_ADD_SUPER_TGROUP;
  ------------------
  |  |  113|      4|#define BNS_ADD_SUPER_TGROUP 1  /* reserve one more edge for a t-group to connect to a single super-t-group */
  ------------------
 9211|      4|            vert_ficpoint->num_adj_edges = 0;
 9212|      4|            vert_ficpoint->st_edge.flow = vert_ficpoint->st_edge.flow0 = 0;
 9213|      4|            vert_ficpoint->st_edge.cap = vert_ficpoint->st_edge.cap0 = 0;
 9214|      4|            vert_ficpoint->type = BNS_VERT_TYPE_TGROUP;
  ------------------
  |  |   75|      4|#define BNS_VERT_TYPE_TGROUP        0x0004
  ------------------
 9215|      4|        }
 9216|       |
 9217|     24|        for (endpoint = 0; endpoint < num_atoms; endpoint++)
  ------------------
  |  Branch (9217:28): [True: 20, False: 4]
  ------------------
 9218|     20|        {
 9219|     20|            if (!at[endpoint].endpoint)
  ------------------
  |  Branch (9219:17): [True: 12, False: 8]
  ------------------
 9220|     12|            {
 9221|     12|                continue;
 9222|     12|            }
 9223|      8|            fictpoint = at[endpoint].endpoint + num_vertices - 1;
 9224|      8|            vert_ficpoint = pBNS->vert + fictpoint;
 9225|      8|            vert_endpoint = pBNS->vert + endpoint;
 9226|       |            /* Debug: check overflow */
 9227|      8|            if (fictpoint >= pBNS->max_vertices ||
  ------------------
  |  Branch (9227:17): [True: 0, False: 8]
  ------------------
 9228|      8|                 num_edges >= pBNS->max_edges ||
  ------------------
  |  Branch (9228:18): [True: 0, False: 8]
  ------------------
 9229|      8|                 vert_ficpoint->num_adj_edges >= vert_ficpoint->max_adj_edges ||
  ------------------
  |  Branch (9229:18): [True: 0, False: 8]
  ------------------
 9230|      8|                 vert_endpoint->num_adj_edges >= vert_endpoint->max_adj_edges)
  ------------------
  |  Branch (9230:18): [True: 0, False: 8]
  ------------------
 9231|      0|            {
 9232|      0|                ret = BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   82|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 9233|      0|                break;
 9234|      0|            }
 9235|       |            /* Obtain donor/acceptor info */
 9236|      8|            if (!nGetEndpointInfo(at, endpoint, &eif)
  ------------------
  |  Branch (9236:17): [True: 0, False: 8]
  ------------------
 9237|      8|                ) {
 9238|      0|#if ( KETO_ENOL_TAUT == 1 )
 9239|      0|                if (!( ( tgi->bTautFlags & TG_FLAG_KETO_ENOL_TAUT ) &&
  ------------------
  |  |  949|      0|#define TG_FLAG_KETO_ENOL_TAUT           0x00080000   /* turn on keto-enol tautomerism detection */
  ------------------
  |  Branch (9239:24): [True: 0, False: 0]
  ------------------
 9240|      0|                       nGetEndpointInfo_KET( at, endpoint, &eif ) ))
  ------------------
  |  Branch (9240:24): [True: 0, False: 0]
  ------------------
 9241|      0|#endif
 9242|      0|                {
 9243|      0|                    ret = BNS_BOND_ERR;
  ------------------
  |  |   80|      0|#define BNS_BOND_ERR       (BNS_ERR +  4) /*(-9995)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 9244|      0|                    break;
 9245|      0|                }
 9246|      0|            }
 9247|       |
 9248|      8|            vert_endpoint->type |= BNS_VERT_TYPE_ENDPOINT;
  ------------------
  |  |   74|      8|#define BNS_VERT_TYPE_ENDPOINT      0x0002  /* attribute */
  ------------------
 9249|       |
 9250|       |            /* Set capacity = 1 to the edges from the endpoint to the centerpoint(s) */
 9251|     16|            for (k = 0; k < vert_endpoint->num_adj_edges; k++)
  ------------------
  |  Branch (9251:25): [True: 8, False: 8]
  ------------------
 9252|      8|            {
 9253|      8|                int iedge = vert_endpoint->iedge[k];
 9254|      8|                if (!pBNS->edge[iedge].cap)
  ------------------
  |  Branch (9254:21): [True: 8, False: 0]
  ------------------
 9255|      8|                {
 9256|       |                    /* Single bond, possibly between endpoint and centerpoint */
 9257|      8|                    centerpoint = ( pBNS->edge[iedge].neighbor12 ^ endpoint );
 9258|      8|                    if (centerpoint < pBNS->num_atoms &&
  ------------------
  |  Branch (9258:25): [True: 8, False: 0]
  ------------------
 9259|      8|                         pBNS->vert[centerpoint].st_edge.cap >= 1)
  ------------------
  |  Branch (9259:26): [True: 4, False: 4]
  ------------------
 9260|      4|                    {
 9261|      4|                        int bond_type = ( at[endpoint].bond_type[k] & BOND_TYPE_MASK );
  ------------------
  |  |  217|      4|#define BOND_TYPE_MASK        0x0f
  ------------------
 9262|      4|                        if (bond_type == BOND_TAUTOM ||
  ------------------
  |  |  213|      8|#define BOND_TAUTOM              8
  ------------------
  |  Branch (9262:29): [True: 0, False: 4]
  ------------------
 9263|      4|                             bond_type == BOND_ALTERN ||
  ------------------
  |  |  208|      4|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   63|      8|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (9263:30): [True: 0, False: 4]
  ------------------
 9264|      4|                             bond_type == BOND_ALT12NS ||
  ------------------
  |  |  214|      8|#define BOND_ALT12NS             9
  ------------------
  |  Branch (9264:30): [True: 0, False: 4]
  ------------------
 9265|      4|                             bond_type == BOND_SINGLE)
  ------------------
  |  |  205|      4|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   60|      4|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (9265:30): [True: 4, False: 0]
  ------------------
 9266|      4|                        {
 9267|      4|                            pBNS->edge[iedge].cap = 1;
 9268|      4|                        }
 9269|      4|                    }
 9270|      8|                }
 9271|      8|            }
 9272|       |
 9273|       |            /* Create a new edge connecting endpoint to the new fictitious t-group vertex vert_ficpoint */
 9274|      8|            edge = pBNS->edge + num_edges;
 9275|      8|            edge->cap = 1;
 9276|      8|            edge->flow = 0;
 9277|      8|            edge->pass = 0;
 9278|      8|#if ( RESET_EDGE_FORBIDDEN_MASK == 1 )
 9279|      8|            edge->forbidden &= pBNS->edge_forbidden_mask;
 9280|      8|#endif
 9281|       |            /* Later include case when the charge change allows the endpoint to become tautomeric */
 9282|       |            /* mark endoint having moveable H atom with flow=1 */
 9283|       |
 9284|       |            /* -- old "no charges" version -- */
 9285|       |            /* if (at[endpoint].chem_bonds_valence == at[endpoint].valence) */
 9286|       |            /* -- the following line takes charges into account -- */
 9287|      8|            if (eif.cDonor) /* means the endpoint has an H-atom to donate */
  ------------------
  |  Branch (9287:17): [True: 8, False: 0]
  ------------------
 9288|      8|            {
 9289|       |                /* increment edge flow */
 9290|      8|                edge->flow++;
 9291|       |                /* increment one vertex st-flow & cap */
 9292|      8|                vert_ficpoint->st_edge.flow++;
 9293|      8|                vert_ficpoint->st_edge.cap++;
 9294|       |                /* increment another vertex st-flow & cap */
 9295|      8|                vert_endpoint->st_edge.flow++;
 9296|      8|                vert_endpoint->st_edge.cap++;
 9297|      8|            }
 9298|       |            /* Connect edge to endpoint and fictpoint and increment the counters of neighbors and edges */
 9299|      8|            edge->neighbor1 = endpoint; /* the smallest out of v1=endopoint and v2=num_vertices */
 9300|      8|            edge->neighbor12 = endpoint ^ fictpoint; /* v1 ^ v2 */
 9301|      8|            vert_endpoint->iedge[vert_endpoint->num_adj_edges] = num_edges;
 9302|      8|            vert_ficpoint->iedge[vert_ficpoint->num_adj_edges] = num_edges++;
 9303|      8|            edge->neigh_ord[0] = vert_endpoint->num_adj_edges++;
 9304|      8|            edge->neigh_ord[1] = vert_ficpoint->num_adj_edges++;
 9305|      8|            edge->cap0 = edge->cap;
 9306|      8|            edge->flow0 = edge->flow;
 9307|      8|        }
 9308|       |
 9309|      4|        pBNS->num_edges = num_edges;
 9310|      4|        pBNS->num_vertices += nMaxTGroupNumber;
 9311|      4|        pBNS->num_t_groups = num_tg;
 9312|      4|    }
 9313|       |
 9314|      4|    return ret;
 9315|      4|}
AddCGroups2BnStruct:
 9327|      4|{
 9328|      4|    int ret = 0;
 9329|       |    /* ret = ReInitBnStruct( pBNS ); */
 9330|      4|    if (cgi && cgi->num_c_groups && cgi->c_group)
  ------------------
  |  Branch (9330:9): [True: 4, False: 0]
  |  Branch (9330:16): [True: 0, False: 4]
  |  Branch (9330:37): [True: 0, False: 0]
  ------------------
 9331|      0|    {
 9332|      0|        int         i, k, c_point, centerpoint, fictpoint;
 9333|      0|        int         num_cg = cgi->num_c_groups;
 9334|      0|        int         num_edges = pBNS->num_edges;
 9335|      0|        int         num_vertices = pBNS->num_vertices;
 9336|      0|        BNS_VERTEX *vert_ficpoint, *ver_ficpont_prev;  /* fictitious vertex describing charge c-group */
 9337|      0|        BNS_VERTEX *vertex_cpoint;
 9338|      0|        BNS_EDGE   *edge;      /* edge between that vertex and the tautomeric c_point */
 9339|      0|        int        nMaxCGroupNumber = 0;
 9340|       |
 9341|       |        /* Debug: check overflow */
 9342|      0|        if (num_vertices + num_cg >= pBNS->max_vertices)
  ------------------
  |  Branch (9342:13): [True: 0, False: 0]
  ------------------
 9343|      0|        {
 9344|      0|            return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   82|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 9345|      0|        }
 9346|       |        /* Find the largest t-group ID */
 9347|      0|        for (i = 0; i < num_cg; i++)
  ------------------
  |  Branch (9347:21): [True: 0, False: 0]
  ------------------
 9348|      0|        {
 9349|      0|            if (cgi->c_group[i].nGroupNumber > nMaxCGroupNumber)
  ------------------
  |  Branch (9349:17): [True: 0, False: 0]
  ------------------
 9350|      0|            {
 9351|      0|                nMaxCGroupNumber = cgi->c_group[i].nGroupNumber;
 9352|      0|            }
 9353|      0|        }
 9354|       |        /* Since t-group IDs may be not contiguous, clear all vertices that will be added.
 9355|       |        all-zeroes-vertex will be ignored by the BNS
 9356|       |        */
 9357|      0|        memset( pBNS->vert + num_vertices, 0, nMaxCGroupNumber * sizeof( pBNS->vert[0] ) );
 9358|       |        /* Make sure the last t-group has the largest t-group ID:
 9359|       |        this is necessary to correctly add new edges and vertices for testing augmenting paths
 9360|       |        */
 9361|       |#if ( bRELEASE_VERSION != 1 )
 9362|       |        insertions_sort( cgi->c_group, num_cg, sizeof( cgi->c_group[0] ), CompCGroupNumber );
 9363|       |        for (i = 1; i < num_cg; i++)
 9364|       |        {
 9365|       |            if (1 != cgi->c_group[i].nGroupNumber - cgi->c_group[i - 1].nGroupNumber)
 9366|       |            {
 9367|       |                return BNS_BOND_ERR;
 9368|       |            }
 9369|       |        }
 9370|       |#else
 9371|      0|        if (nMaxCGroupNumber != cgi->c_group[num_cg - 1].nGroupNumber)
  ------------------
  |  Branch (9371:13): [True: 0, False: 0]
  ------------------
 9372|      0|        {
 9373|      0|            insertions_sort( pCG, cgi->c_group, num_cg,
 9374|      0|                             sizeof( cgi->c_group[0] ),
 9375|      0|                             CompCGroupNumber );
 9376|      0|        }
 9377|      0|#endif
 9378|       |        /**************************************/
 9379|       |        /* initialize new fictitious vertices */
 9380|       |        /* representing c-point groups        */
 9381|       |        /**************************************/
 9382|      0|        ver_ficpont_prev = pBNS->vert + num_vertices - 1;
 9383|       |
 9384|      0|        for (i = 0; i < num_cg; i++, ver_ficpont_prev = vert_ficpoint)
  ------------------
  |  Branch (9384:21): [True: 0, False: 0]
  ------------------
 9385|      0|        {
 9386|       |            /*
 9387|       |            vert_ficpoint-1 is the last vertex;
 9388|       |            vert_ficpoint   is the being added vertex
 9389|       |            Note: nGroupNumber are not contiguous
 9390|       |            */
 9391|      0|            vert_ficpoint = pBNS->vert + num_vertices + cgi->c_group[i].nGroupNumber - 1;
 9392|      0|            vert_ficpoint->iedge = ver_ficpont_prev->iedge + ver_ficpont_prev->max_adj_edges;
 9393|      0|            vert_ficpoint->max_adj_edges = cgi->c_group[i].num_CPoints + BNS_ADD_EDGES;
  ------------------
  |  |  117|      0|#define BNS_ADD_EDGES        1  /* max. number of edges to add to each atom (except edges to a t-group or c-group) */
  ------------------
 9394|      0|            vert_ficpoint->num_adj_edges = 0;
 9395|      0|            vert_ficpoint->st_edge.flow = vert_ficpoint->st_edge.flow0 = 0;
 9396|      0|            vert_ficpoint->st_edge.cap = vert_ficpoint->st_edge.cap0 = 0;
 9397|      0|            vert_ficpoint->type = BNS_VERT_TYPE_C_GROUP;
  ------------------
  |  |   77|      0|#define BNS_VERT_TYPE_C_GROUP       0x0010
  ------------------
 9398|      0|        }
 9399|       |
 9400|       |        /************************************************/
 9401|       |        /* Connect c-points to the fictitious vertices  */
 9402|       |        /* representing c-point groups; set caps, flows */
 9403|       |        /************************************************/
 9404|      0|        for (c_point = 0; c_point < num_atoms; c_point++)
  ------------------
  |  Branch (9404:27): [True: 0, False: 0]
  ------------------
 9405|      0|        {
 9406|      0|            if (!at[c_point].c_point)
  ------------------
  |  Branch (9406:17): [True: 0, False: 0]
  ------------------
 9407|      0|            {
 9408|      0|                continue;
 9409|      0|            }
 9410|      0|            fictpoint = at[c_point].c_point + num_vertices - 1; /* c-group vertex index */
 9411|      0|            vert_ficpoint = pBNS->vert + fictpoint; /* c-group vertex */
 9412|      0|            vertex_cpoint = pBNS->vert + c_point;   /* c_point vertex */
 9413|       |                                                    /* Debug: check overflow */
 9414|      0|            if (fictpoint >= pBNS->max_vertices ||
  ------------------
  |  Branch (9414:17): [True: 0, False: 0]
  ------------------
 9415|      0|                 num_edges >= pBNS->max_edges ||
  ------------------
  |  Branch (9415:18): [True: 0, False: 0]
  ------------------
 9416|      0|                 vert_ficpoint->num_adj_edges >= vert_ficpoint->max_adj_edges ||
  ------------------
  |  Branch (9416:18): [True: 0, False: 0]
  ------------------
 9417|      0|                 vertex_cpoint->num_adj_edges >= vertex_cpoint->max_adj_edges)
  ------------------
  |  Branch (9417:18): [True: 0, False: 0]
  ------------------
 9418|      0|            {
 9419|      0|                ret = BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   82|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 9420|      0|                break;
 9421|      0|            }
 9422|      0|            vertex_cpoint->type |= BNS_VERT_TYPE_C_POINT;
  ------------------
  |  |   76|      0|#define BNS_VERT_TYPE_C_POINT       0x0008
  ------------------
 9423|       |#if ( FIX_CPOINT_BOND_CAP != 1 )  /* { */
 9424|       |            /* set capacity = 1 to the edges from the c_point to the centerpoint(s)     */
 9425|       |            /* if their current capacity is zero                                        */
 9426|       |            /* the centerpoint is any adjacent atom that is adjacent to a multiple bond */
 9427|       |            for (k = 0; k < vertex_cpoint->num_adj_edges; k++)
 9428|       |            {
 9429|       |                int iedge = vertex_cpoint->iedge[k];
 9430|       |                if (!pBNS->edge[iedge].cap)
 9431|       |                {
 9432|       |                    /* single bond, possibly between c_point and centerpoint */
 9433|       |                    centerpoint = ( pBNS->edge[iedge].neighbor12 ^ c_point );
 9434|       |                    if (centerpoint < pBNS->num_atoms &&
 9435|       |                         pBNS->vert[centerpoint].st_edge.cap >= 1)
 9436|       |                    {
 9437|       |                        int bond_type = ( at[c_point].bond_type[k] & BOND_TYPE_MASK );
 9438|       |                        if (bond_type == BOND_TAUTOM ||
 9439|       |                             bond_type == BOND_ALTERN ||
 9440|       |                             bond_type == BOND_SINGLE)
 9441|       |                        {
 9442|       |                            pBNS->edge[iedge].cap = 1;
 9443|       |                        }
 9444|       |                    }
 9445|       |                }
 9446|       |            }
 9447|       |#endif /* } FIX_CPOINT_BOND_CAP */
 9448|       |
 9449|       |            /* Create a new edge connecting c_point to the new fictitious c-group vertex vert_ficpoint */
 9450|      0|            edge = pBNS->edge + num_edges;
 9451|      0|            edge->cap = 1;
 9452|      0|            edge->flow = 0;
 9453|      0|            edge->pass = 0;
 9454|      0|#if ( RESET_EDGE_FORBIDDEN_MASK == 1 )
 9455|      0|            edge->forbidden &= pBNS->edge_forbidden_mask;
 9456|      0|#endif
 9457|       |            /* Mark edge to c-point having NO moveable charge with flow=1 */
 9458|      0|            if (!CHARGED_CPOINT( at, c_point ))
  ------------------
  |  |  281|      0|#define CHARGED_CPOINT(X,i) ((X)[i].charge==1)
  ------------------
  |  Branch (9458:17): [True: 0, False: 0]
  ------------------
 9459|      0|            {
 9460|       |                /* Increment edge flow */
 9461|      0|                edge->flow++;
 9462|       |                /* Increment c-group vertex st-flow & cap */
 9463|      0|                vert_ficpoint->st_edge.flow++;
 9464|      0|                vert_ficpoint->st_edge.cap++;
 9465|       |                /* Increment c-point vertex st-flow & cap */
 9466|      0|                vertex_cpoint->st_edge.flow++;
 9467|      0|                vertex_cpoint->st_edge.cap++;
 9468|      0|            }
 9469|       |
 9470|      0|#if ( FIX_CPOINT_BOND_CAP == 1 ) /* { */
 9471|       |
 9472|       |            /* Set capacity = 1 to the edges from the c_point to the centerpoint(s)     */
 9473|       |            /* if their current capacity is zero                                        */
 9474|       |            /* the centerpoint is any adjacent atom that is adjacent to a multiple bond */
 9475|      0|            for (k = 0; k < vertex_cpoint->num_adj_edges; k++)
  ------------------
  |  Branch (9475:25): [True: 0, False: 0]
  ------------------
 9476|      0|            {
 9477|      0|                int iedge = vertex_cpoint->iedge[k];
 9478|      0|                VertexFlow  nNewCap = vertex_cpoint->st_edge.cap;
 9479|      0|                centerpoint = ( pBNS->edge[iedge].neighbor12 ^ c_point );
 9480|      0|                if (!pBNS->edge[iedge].cap)
  ------------------
  |  Branch (9480:21): [True: 0, False: 0]
  ------------------
 9481|      0|                {
 9482|       |                    /* Single bond, possibly between c_point and centerpoint */
 9483|      0|                    if (centerpoint < pBNS->num_atoms &&
  ------------------
  |  Branch (9483:25): [True: 0, False: 0]
  ------------------
 9484|      0|                         pBNS->vert[centerpoint].st_edge.cap >= 1)
  ------------------
  |  Branch (9484:26): [True: 0, False: 0]
  ------------------
 9485|      0|                    {
 9486|      0|                        nNewCap = inchi_min( pBNS->vert[centerpoint].st_edge.cap, nNewCap );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 9487|      0|                        nNewCap = inchi_min( nNewCap, MAX_BOND_EDGE_CAP );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 9488|      0|                        pBNS->edge[iedge].cap = nNewCap;
 9489|      0|                    }
 9490|       |#if ( FIX_CPOINT_BOND_CAP2 == 1 ) /* multiple bond */
 9491|       |                    else
 9492|       |                        if (centerpoint < pBNS->num_atoms &&
 9493|       |                             edge->flow && pBNS->edge[iedge].cap < MAX_BOND_EDGE_CAP)
 9494|       |                        {
 9495|       |                            pBNS->edge[iedge].cap++;
 9496|       |                        }
 9497|       |#endif
 9498|      0|                }
 9499|      0|            }
 9500|      0|#endif  /* } FIX_CPOINT_BOND_CAP */
 9501|       |
 9502|       |            /* Connect edge to c_point and fictpoint and increment the counters of neighbors and edges */
 9503|      0|            edge->neighbor1 = c_point; /* the smallest out of v1=endopoint and v2=num_vertices */
 9504|      0|            edge->neighbor12 = c_point ^ fictpoint; /* v1 ^ v2 */
 9505|      0|            vertex_cpoint->iedge[vertex_cpoint->num_adj_edges] = num_edges;
 9506|      0|            vert_ficpoint->iedge[vert_ficpoint->num_adj_edges] = num_edges++;
 9507|      0|            edge->neigh_ord[0] = vertex_cpoint->num_adj_edges++;
 9508|      0|            edge->neigh_ord[1] = vert_ficpoint->num_adj_edges++;
 9509|      0|            edge->cap0 = edge->cap;
 9510|      0|            edge->flow0 = edge->flow;
 9511|      0|        }
 9512|       |
 9513|      0|        pBNS->num_edges = num_edges;
 9514|      0|        pBNS->num_vertices += nMaxCGroupNumber;
 9515|      0|        pBNS->num_c_groups = num_cg;
 9516|      0|    }
 9517|       |
 9518|      4|    return ret;
 9519|      4|}
ClearAllBnDataVertices:
 9526|   110k|{
 9527|   110k|    int i;
 9528|  1.46M|    for (i = 0; i < size; i++)
  ------------------
  |  Branch (9528:17): [True: 1.34M, False: 110k]
  ------------------
 9529|  1.34M|    {
 9530|  1.34M|        v[i] = value;
 9531|  1.34M|    }
 9532|   110k|}
ClearAllBnDataEdges:
 9537|   110k|{
 9538|   110k|    int i;
 9539|  1.46M|    for (i = 0; i < size; i++)
  ------------------
  |  Branch (9539:17): [True: 1.34M, False: 110k]
  ------------------
 9540|  1.34M|    {
 9541|  1.34M|        e[i][0] = value;
 9542|  1.34M|    }
 9543|   110k|}
DeAllocateBnData:
 9548|   110k|{
 9549|   110k|    if (pBD)
  ------------------
  |  Branch (9549:9): [True: 110k, False: 39]
  ------------------
 9550|   110k|    {
 9551|   110k|        if (pBD->BasePtr)
  ------------------
  |  Branch (9551:13): [True: 110k, False: 0]
  ------------------
 9552|   110k|        {
 9553|   110k|            inchi_free( pBD->BasePtr );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 9554|   110k|        }
 9555|   110k|        if (pBD->SwitchEdge)
  ------------------
  |  Branch (9555:13): [True: 110k, False: 0]
  ------------------
 9556|   110k|        {
 9557|   110k|            inchi_free( pBD->SwitchEdge );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 9558|   110k|        }
 9559|   110k|        if (pBD->Tree)
  ------------------
  |  Branch (9559:13): [True: 110k, False: 0]
  ------------------
 9560|   110k|        {
 9561|   110k|            inchi_free( pBD->Tree );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 9562|   110k|        }
 9563|   110k|        if (pBD->ScanQ)
  ------------------
  |  Branch (9563:13): [True: 110k, False: 0]
  ------------------
 9564|   110k|        {
 9565|   110k|            inchi_free( pBD->ScanQ );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 9566|   110k|        }
 9567|   110k|        if (pBD->Pu)
  ------------------
  |  Branch (9567:13): [True: 110k, False: 0]
  ------------------
 9568|   110k|        {
 9569|   110k|            inchi_free( pBD->Pu );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 9570|   110k|        }
 9571|   110k|        if (pBD->Pv)
  ------------------
  |  Branch (9571:13): [True: 110k, False: 0]
  ------------------
 9572|   110k|        {
 9573|   110k|            inchi_free( pBD->Pv );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 9574|   110k|        }
 9575|   110k|#if ( BNS_RAD_SEARCH == 1 )
 9576|   110k|        if (pBD->RadEndpoints)
  ------------------
  |  Branch (9576:13): [True: 110k, False: 0]
  ------------------
 9577|   110k|        {
 9578|   110k|            inchi_free( pBD->RadEndpoints );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 9579|   110k|        }
 9580|   110k|        if (pBD->RadEdges)
  ------------------
  |  Branch (9580:13): [True: 110k, False: 0]
  ------------------
 9581|   110k|        {
 9582|   110k|            inchi_free( pBD->RadEdges );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 9583|   110k|        }
 9584|   110k|#endif
 9585|   110k|        inchi_free( pBD );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 9586|   110k|    }
 9587|       |
 9588|   110k|    return NULL;
 9589|   110k|}
AllocateAndInitBnData:
 9594|   110k|{
 9595|   110k|    BN_DATA *pBD = NULL;
 9596|   110k|    int      max_len_Pu_Pv;
 9597|   110k|    max_num_vertices = 2 * max_num_vertices + 2;
 9598|   110k|    max_len_Pu_Pv = max_num_vertices / 2 + 1;
 9599|   110k|    max_len_Pu_Pv += max_len_Pu_Pv % 2; /* even length */
 9600|   110k|    if (!( pBD = (BN_DATA *) inchi_calloc( 1, sizeof( BN_DATA ) ) ) ||
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
  |  Branch (9600:9): [True: 0, False: 110k]
  ------------------
 9601|   110k|         !( pBD->BasePtr = (Vertex *) inchi_calloc( max_num_vertices, sizeof( Vertex ) ) ) ||
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
  |  Branch (9601:10): [True: 0, False: 110k]
  ------------------
 9602|   110k|         !( pBD->SwitchEdge = (Edge   *) inchi_calloc( max_num_vertices, sizeof( Edge ) ) ) ||
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
  |  Branch (9602:10): [True: 0, False: 110k]
  ------------------
 9603|   110k|         !( pBD->Tree = (S_CHAR *) inchi_calloc( max_num_vertices, sizeof( S_CHAR ) ) ) ||
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
  |  Branch (9603:10): [True: 0, False: 110k]
  ------------------
 9604|   110k|         !( pBD->ScanQ = (Vertex *) inchi_calloc( max_num_vertices, sizeof( Vertex ) ) ) ||
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
  |  Branch (9604:10): [True: 0, False: 110k]
  ------------------
 9605|   110k|         !( pBD->Pu = (Vertex *) inchi_calloc( max_len_Pu_Pv, sizeof( Vertex ) ) ) ||
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
  |  Branch (9605:10): [True: 0, False: 110k]
  ------------------
 9606|   110k|#if ( BNS_RAD_SEARCH == 1 )
 9607|   110k|         !( pBD->RadEndpoints = (Vertex *) inchi_calloc( max_len_Pu_Pv, sizeof( Vertex ) ) ) ||
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
  |  Branch (9607:10): [True: 0, False: 110k]
  ------------------
 9608|   110k|         !( pBD->RadEdges = (EdgeIndex*) inchi_calloc( max_len_Pu_Pv, sizeof( EdgeIndex ) ) ) ||
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
  |  Branch (9608:10): [True: 0, False: 110k]
  ------------------
 9609|   110k|#endif
 9610|   110k|         !( pBD->Pv = (Vertex *) inchi_calloc( max_len_Pu_Pv, sizeof( Vertex ) ) )
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
  |  Branch (9610:10): [True: 0, False: 110k]
  ------------------
 9611|   110k|         )
 9612|      0|    {
 9613|      0|        pBD = DeAllocateBnData( pBD );
 9614|      0|    }
 9615|   110k|    else
 9616|   110k|    {
 9617|       |        /* Initialize data */
 9618|   110k|        ClearAllBnDataEdges( pBD->SwitchEdge, NO_VERTEX, max_num_vertices );
  ------------------
  |  |  146|   110k|#define NO_VERTEX    -2
  ------------------
 9619|   110k|        ClearAllBnDataVertices( pBD->BasePtr, NO_VERTEX, max_num_vertices );
  ------------------
  |  |  146|   110k|#define NO_VERTEX    -2
  ------------------
 9620|   110k|        memset( pBD->Tree, TREE_NOT_IN_M, max_num_vertices );
  ------------------
  |  |  261|   110k|#define TREE_NOT_IN_M  0  /* not in T or T' */
  ------------------
 9621|   110k|        pBD->QSize = -1;
 9622|   110k|        pBD->max_len_Pu_Pv = max_len_Pu_Pv;
 9623|   110k|        pBD->max_num_vertices = max_num_vertices;
 9624|   110k|#if ( BNS_RAD_SEARCH == 1 )
 9625|   110k|        pBD->nNumRadEndpoints = 0;
 9626|   110k|#endif
 9627|   110k|    }
 9628|       |
 9629|   110k|    return pBD;
 9630|   110k|}
ReInitBnData:
 9635|   111k|{
 9636|   111k|    int i, ret = 0;
 9637|   111k|    Vertex u, v;
 9638|   111k|    if (pBD)
  ------------------
  |  Branch (9638:9): [True: 111k, False: 0]
  ------------------
 9639|   111k|    {
 9640|   111k|        if (!pBD->ScanQ)
  ------------------
  |  Branch (9640:13): [True: 0, False: 111k]
  ------------------
 9641|      0|        {
 9642|      0|            ret += 2;
 9643|      0|        }
 9644|   111k|        if (!pBD->BasePtr)
  ------------------
  |  Branch (9644:13): [True: 0, False: 111k]
  ------------------
 9645|      0|        {
 9646|      0|            ret += 4;
 9647|      0|        }
 9648|   111k|        if (!pBD->SwitchEdge)
  ------------------
  |  Branch (9648:13): [True: 0, False: 111k]
  ------------------
 9649|      0|        {
 9650|      0|            ret += 8;
 9651|      0|        }
 9652|   111k|        if (!pBD->Tree)
  ------------------
  |  Branch (9652:13): [True: 0, False: 111k]
  ------------------
 9653|      0|        {
 9654|      0|            ret += 16;
 9655|      0|        }
 9656|   111k|        if (!ret)
  ------------------
  |  Branch (9656:13): [True: 111k, False: 0]
  ------------------
 9657|   111k|        {
 9658|   222k|            for (i = 0; i <= pBD->QSize; i++)
  ------------------
  |  Branch (9658:25): [True: 111k, False: 111k]
  ------------------
 9659|   111k|            {
 9660|   111k|                u = pBD->ScanQ[i];
 9661|   111k|                v = prim( u );
  ------------------
  |  |  414|   111k|#define prim(v) (Vertex)((v)^1)
  ------------------
 9662|   111k|                pBD->BasePtr[u] =
 9663|   111k|                    pBD->BasePtr[v] =
 9664|   111k|                    pBD->SwitchEdge_Vert1( u ) =
  ------------------
  |  |  417|   111k|#define SwitchEdge_Vert1(u) SwitchEdge[u][0]
  ------------------
 9665|   111k|                    pBD->SwitchEdge_Vert1( v ) = NO_VERTEX;
  ------------------
  |  |  417|   111k|#define SwitchEdge_Vert1(u) SwitchEdge[u][0]
  ------------------
                                  pBD->SwitchEdge_Vert1( v ) = NO_VERTEX;
  ------------------
  |  |  146|   111k|#define NO_VERTEX    -2
  ------------------
 9666|   111k|                pBD->Tree[u] =
 9667|   111k|                    pBD->Tree[v] = TREE_NOT_IN_M;
  ------------------
  |  |  261|   111k|#define TREE_NOT_IN_M  0  /* not in T or T' */
  ------------------
 9668|   111k|            }
 9669|   111k|        }
 9670|   111k|        pBD->QSize = -1;
 9671|   111k|        if (!pBD->Pu)
  ------------------
  |  Branch (9671:13): [True: 0, False: 111k]
  ------------------
 9672|      0|        {
 9673|      0|            ret += 32;
 9674|      0|        }
 9675|   111k|        if (!pBD->Pv)
  ------------------
  |  Branch (9675:13): [True: 0, False: 111k]
  ------------------
 9676|      0|        {
 9677|      0|            ret += 64;
 9678|      0|        }
 9679|   111k|    }
 9680|      0|    else
 9681|      0|    {
 9682|      0|        ret += 1;
 9683|      0|    }
 9684|       |
 9685|   111k|    return ret;
 9686|   111k|}
GetVertexDegree:
 9691|   111k|{
 9692|   111k|    int i = v / 2 - 1;
 9693|   111k|    if (i >= 0)
  ------------------
  |  Branch (9693:9): [True: 307, False: 110k]
  ------------------
 9694|    307|    {
 9695|    307|        if (pBNS->vert[i].st_edge.cap > 0)
  ------------------
  |  Branch (9695:13): [True: 307, False: 0]
  ------------------
 9696|    307|        {
 9697|    307|            return pBNS->vert[i].num_adj_edges + 1; /* add 1 neighbor for s or t */
 9698|    307|        }
 9699|      0|        else
 9700|      0|        {
 9701|      0|            return 0;   /* since the edge s-v has zero capacity, we ignore vertex v */
 9702|      0|        }
 9703|    307|    }
 9704|   110k|    else
 9705|   110k|    {
 9706|   110k|        return pBNS->num_vertices;
 9707|   110k|    }
 9708|   111k|}
Get2ndEdgeVertex:
 9713|    774|{
 9714|       |    /*
 9715|       |    Vertex ret;
 9716|       |    */
 9717|    774|    if (uv[1] >= 0)
  ------------------
  |  Branch (9717:9): [True: 621, False: 153]
  ------------------
 9718|    621|    {
 9719|       |        /* -- debug --
 9720|       |        if ( uv[1] > pBNS->num_edges || uv[0] > 2*pBNS->num_vertices+3 ) {
 9721|       |        int stop = 1;
 9722|       |        }
 9723|       |        ret = ((uv[0]-2) ^ (2*pBNS->edge[uv[1]].neighbor12+1)) + 2;
 9724|       |        if ( ret > 2*pBNS->num_vertices+3 ) {
 9725|       |        int stop = 1;
 9726|       |        }
 9727|       |        return ret;
 9728|       |        -- end debug -- */
 9729|       |
 9730|    621|        return ( ( uv[0] - 2 ) ^ ( 2 * pBNS->edge[uv[1]].neighbor12 + 1 ) ) + 2;
 9731|       |
 9732|       |        /*short u = uv[0]-FIRST_INDX; */
 9733|       |        /*short t = 2*(((u / 2 - 1) ^ pBNS->edge[uv[1]].neighbor12) + 1) + ((u+1) & 1) + FIRST_INDX; */
 9734|       |        /*return t; */
 9735|    621|    }
 9736|       |
 9737|    153|    if (uv[0] <= 1)
  ------------------
  |  Branch (9737:9): [True: 153, False: 0]
  ------------------
 9738|    153|    {
 9739|    153|        return -( 1 + uv[1] ); /* vertex1 is s or t, return x or y */
 9740|    153|    }
 9741|      0|    else
 9742|      0|    {
 9743|      0|        return uv[0] % 2; /* vertex1 is x or y, return s or t; never happens? -- NSC 3737, 7634,... */
 9744|      0|    }
 9745|       |
 9746|    153|}
GetVertexNeighbor:
 9754|   118k|{
 9755|       |    /* neigh = 0 => the neighbor is s or t except case when v is s or t. */
 9756|       |    /* v= FIRST_INDX or FIRST_INDX+1: v is s or t respectively */
 9757|   118k|    int i, neighbor;
 9758|   118k|    if (( i = v - 2 ) >= 0)
  ------------------
  |  Branch (9758:9): [True: 1.09k, False: 117k]
  ------------------
 9759|  1.09k|    {
 9760|       |        /* Neighbor of x or y */
 9761|  1.09k|        if (neigh)
  ------------------
  |  Branch (9761:13): [True: 792, False: 307]
  ------------------
 9762|    792|        {
 9763|    792|            neigh--;
 9764|       |            /* x or y */
 9765|    792|            *iedge = pBNS->vert[i / 2].iedge[neigh];
 9766|    792|            if (!( pBNS->edge[*iedge].cap & EDGE_FLOW_MASK ) || IS_FORBIDDEN( pBNS->edge[*iedge].forbidden, pBNS ))
  ------------------
  |  |  161|    792|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
                          if (!( pBNS->edge[*iedge].cap & EDGE_FLOW_MASK ) || IS_FORBIDDEN( pBNS->edge[*iedge].forbidden, pBNS ))
  ------------------
  |  |   65|    758|#define IS_FORBIDDEN(EDGE_FORBIDDEN, PBNS)     (EDGE_FORBIDDEN)
  |  |  ------------------
  |  |  |  Branch (65:48): [True: 30, False: 728]
  |  |  ------------------
  ------------------
  |  Branch (9766:17): [True: 34, False: 758]
  ------------------
 9767|     64|            {
 9768|     64|                return NO_VERTEX;
  ------------------
  |  |  146|     64|#define NO_VERTEX    -2
  ------------------
 9769|     64|            }
 9770|    728|            neighbor = ( i ^ ( 2 * pBNS->edge[*iedge].neighbor12 + 1 ) ) + 2; /* parity opposite to v parity */
 9771|    728|        }
 9772|    307|        else
 9773|    307|        {
 9774|       |            /* neighbor of x or y is s or t */
 9775|    307|            neighbor = ( v & 1 ); /* s or t, same parity as v */
 9776|    307|            *iedge = -( neighbor + 1 );
 9777|    307|        }
 9778|  1.09k|    }
 9779|   117k|    else
 9780|   117k|    {
 9781|       |        /* neighbor of s or t: x or y, same parity as v */
 9782|   117k|        if (!( pBNS->vert[neigh].st_edge.cap & EDGE_FLOW_ST_MASK ))
  ------------------
  |  |  156|   117k|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (9782:13): [True: 116k, False: 719]
  ------------------
 9783|   116k|        {
 9784|   116k|            return NO_VERTEX;
  ------------------
  |  |  146|   116k|#define NO_VERTEX    -2
  ------------------
 9785|   116k|        }
 9786|    719|        neighbor = 2 * neigh + 2 + ( v & 1 ); /* parity same as the parity of v */
 9787|    719|        *iedge = -( neighbor + 1 );
 9788|    719|    }
 9789|       |
 9790|  1.75k|    return neighbor;
 9791|   118k|}
GetEdgePointer:
 9801|  1.72k|{
 9802|  1.72k|    int i = u / 2 - 1;
 9803|  1.72k|    int j = v / 2 - 1;
 9804|  1.72k|    int bBackward = BNS_WRONG_PARMS;
  ------------------
  |  |   76|  1.72k|#define BNS_WRONG_PARMS    (BNS_ERR +  0) /*(-9999)*/
  |  |  ------------------
  |  |  |  |   75|  1.72k|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 9805|  1.72k|    *uv = NULL;
 9806|  1.72k|    if (i >= 0)
  ------------------
  |  Branch (9806:9): [True: 961, False: 759]
  ------------------
 9807|    961|    {
 9808|       |        /* u is an atom */
 9809|    961|        if (j >= 0)
  ------------------
  |  Branch (9809:13): [True: 727, False: 234]
  ------------------
 9810|    727|        {
 9811|       |            /* v is an atom */
 9812|    727|            if (( u + v ) % 2)
  ------------------
  |  Branch (9812:17): [True: 727, False: 0]
  ------------------
 9813|    727|            {
 9814|    727|                *uv = pBNS->edge + iuv;
 9815|    727|                bBackward = ( u & 1 );
 9816|    727|                *s_or_t = 0;
 9817|    727|            }
 9818|    727|        }
 9819|    234|        else
 9820|    234|        {
 9821|       |            /* v is s or t */
 9822|    234|            if (v >= 0 && !( ( u + v ) % 2 ))
  ------------------
  |  Branch (9822:17): [True: 234, False: 0]
  |  Branch (9822:27): [True: 234, False: 0]
  ------------------
 9823|    234|            {
 9824|    234|                *uv = (BNS_EDGE*) &pBNS->vert[i].st_edge;
 9825|    234|                bBackward = !( v & 1 );
 9826|    234|                *s_or_t = v + 3; /* 3=> v=s, 4=> v=t */
 9827|    234|            }
 9828|    234|        }
 9829|    961|    }
 9830|    759|    else
 9831|    759|    {
 9832|    759|        if (j >= 0)
  ------------------
  |  Branch (9832:13): [True: 759, False: 0]
  ------------------
 9833|    759|        {
 9834|       |            /* u is s or t */
 9835|    759|            if (u >= 0 && !( ( u + v ) % 2 ))
  ------------------
  |  Branch (9835:17): [True: 759, False: 0]
  |  Branch (9835:27): [True: 759, False: 0]
  ------------------
 9836|    759|            {
 9837|       |                /* v is an atom */
 9838|    759|                *uv = (BNS_EDGE*) &pBNS->vert[j].st_edge;
 9839|    759|                bBackward = ( u & 1 );
 9840|    759|                *s_or_t = u + 1; /* 1=> u=s, 2=> u=t */
 9841|    759|            }
 9842|    759|        }
 9843|    759|    }
 9844|       |
 9845|  1.72k|    return bBackward;
 9846|  1.72k|}
AugmentEdge:
 9857|    123|{
 9858|    123|    int f, flow, ret = 0;
 9859|       |
 9860|    123|    BNS_ST_EDGE    *pst_edge;
 9861|    123|    BNS_EDGE       *pedge;
 9862|    123|    S_CHAR          s_or_t;
 9863|    123|    int bBackward = GetEdgePointer( pBNS, u, v, iuv, &pedge, &s_or_t );
 9864|    123|    if (!IS_BNS_ERROR( bBackward ))
  ------------------
  |  |   95|    123|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|    123|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|    123|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|    123|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 123, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 123]
  |  |  ------------------
  ------------------
 9865|    123|    {
 9866|    123|        if (bBackward)
  ------------------
  |  Branch (9866:13): [True: 39, False: 84]
  ------------------
 9867|     39|        {
 9868|     39|            delta = -delta;
 9869|     39|        }
 9870|       |
 9871|    123|        if (s_or_t)
  ------------------
  |  Branch (9871:13): [True: 30, False: 93]
  ------------------
 9872|     30|        {
 9873|     30|            pst_edge = (BNS_ST_EDGE *) pedge;
 9874|     30|            flow = pst_edge->flow;
 9875|     30|            f = ( flow & EDGE_FLOW_ST_MASK ) + delta; /* new flow */
  ------------------
  |  |  156|     30|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 9876|     30|            if (!delta)
  ------------------
  |  Branch (9876:17): [True: 0, False: 30]
  ------------------
 9877|      0|            {
 9878|       |                /*((BNS_ST_EDGE *)pedge)->flow = pst_edge->flow & ~EDGE_FLOW_ST_PATH;*/
 9879|      0|                pst_edge->flow = pst_edge->flow & ~EDGE_FLOW_ST_PATH;
  ------------------
  |  |  157|      0|#define EDGE_FLOW_ST_PATH       0x4000  /* mark: the edge belongs to the augmenting path */
  ------------------
 9880|      0|            }
 9881|     30|            else
 9882|     30|            {
 9883|     30|                int cap = pst_edge->cap;
 9884|     30|                if (f < 0 || f > cap)
  ------------------
  |  Branch (9884:21): [True: 0, False: 30]
  |  Branch (9884:30): [True: 0, False: 30]
  ------------------
 9885|      0|                {
 9886|      0|                    ret = BNS_WRONG_PARMS;
  ------------------
  |  |   76|      0|#define BNS_WRONG_PARMS    (BNS_ERR +  0) /*(-9999)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 9887|      0|                }
 9888|     30|                else
 9889|     30|                {
 9890|     30|                    if (!( bChangeFlow & BNS_EF_CHNG_FLOW ))
  ------------------
  |  |  379|     30|#define BNS_EF_CHNG_FLOW      1  /* change Balanced Network (BN) flow inside the BNS search */
  ------------------
  |  Branch (9890:25): [True: 0, False: 30]
  ------------------
 9891|      0|                    {
 9892|      0|                        f -= delta; /* do not actually change the flow, only find the augmenting path */
 9893|      0|                    }
 9894|     30|                    else
 9895|     30|                    {
 9896|     30|                        if (delta)
  ------------------
  |  Branch (9896:29): [True: 30, False: 0]
  ------------------
 9897|     30|                        {
 9898|       |                            /*((BNS_ST_EDGE *)pedge)->pass ++;*/
 9899|     30|                            pst_edge->pass++;
 9900|     30|                        }
 9901|     30|                    }
 9902|     30|                    flow = ( flow & ~( EDGE_FLOW_ST_PATH | EDGE_FLOW_ST_MASK ) ) + f;
  ------------------
  |  |  157|     30|#define EDGE_FLOW_ST_PATH       0x4000  /* mark: the edge belongs to the augmenting path */
  ------------------
                                  flow = ( flow & ~( EDGE_FLOW_ST_PATH | EDGE_FLOW_ST_MASK ) ) + f;
  ------------------
  |  |  156|     30|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
 9903|       |                    /*((BNS_ST_EDGE *)pedge)->flow = flow;*/
 9904|     30|                    pst_edge->flow = flow;
 9905|       |                    /*((BNS_ST_EDGE *)pedge)->delta += delta; */
 9906|     30|                    if (bReverse)
  ------------------
  |  Branch (9906:25): [True: 15, False: 15]
  ------------------
 9907|     15|                    {
 9908|       |                        /* u <- v; Note: in case of bReverse s_or_t has actually been determined
 9909|       |                        for the u' <- v' pair; therefore s and t should be switched
 9910|       |                        in order to correctly determine the 1st or the last atom
 9911|       |                        on the augmenting path.
 9912|       |                        */
 9913|     15|                        switch (s_or_t)
 9914|     15|                        {
 9915|     15|                            case 1: /* u = t: t<-v, v is the last vertex */
  ------------------
  |  Branch (9915:29): [True: 15, False: 0]
  ------------------
 9916|     15|                                ALTP_END_ATOM( pBNS->alt_path ) = v / 2 - 1;
  ------------------
  |  |  130|     15|#define ALTP_END_ATOM(altp)             (altp)[iALTP_END_ATOM].number
  ------------------
 9917|     15|                                break;
 9918|      0|                            case 2: /* u = s: s<-v, error */
  ------------------
  |  Branch (9918:29): [True: 0, False: 15]
  ------------------
 9919|      0|                                ret = BNS_WRONG_PARMS;
  ------------------
  |  |   76|      0|#define BNS_WRONG_PARMS    (BNS_ERR +  0) /*(-9999)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 9920|      0|                                break;
 9921|      0|                            case 3: /* v = t: u<-t, error */
  ------------------
  |  Branch (9921:29): [True: 0, False: 15]
  ------------------
 9922|      0|                                ret = BNS_WRONG_PARMS;
  ------------------
  |  |   76|      0|#define BNS_WRONG_PARMS    (BNS_ERR +  0) /*(-9999)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 9923|      0|                                break;
 9924|      0|                            case 4: /* v = s: u<-s, u is the first vertex */
  ------------------
  |  Branch (9924:29): [True: 0, False: 15]
  ------------------
 9925|      0|                                ALTP_START_ATOM( pBNS->alt_path ) = u / 2 - 1;
  ------------------
  |  |  131|      0|#define ALTP_START_ATOM(altp)           (altp)[iALTP_START_ATOM].number
  ------------------
 9926|      0|                                ALTP_DELTA( pBNS->alt_path ) = delta;
  ------------------
  |  |  140|      0|#define ALTP_DELTA(altp)                 (altp)[iALTP_FLOW].flow[0]
  ------------------
 9927|      0|                                break;
 9928|      0|                            default:
  ------------------
  |  Branch (9928:29): [True: 0, False: 15]
  ------------------
 9929|      0|                                ret = BNS_WRONG_PARMS;
  ------------------
  |  |   76|      0|#define BNS_WRONG_PARMS    (BNS_ERR +  0) /*(-9999)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 9930|      0|                                break;
 9931|     15|                        }
 9932|     15|                    }
 9933|     15|                    else
 9934|     15|                    {
 9935|       |                        /* u -> v */
 9936|     15|                        switch (s_or_t)
 9937|     15|                        {
 9938|     15|                            case 1: /* u = s: s->v, v is the first vertex */
  ------------------
  |  Branch (9938:29): [True: 15, False: 0]
  ------------------
 9939|     15|                                ALTP_START_ATOM( pBNS->alt_path ) = v / 2 - 1;
  ------------------
  |  |  131|     15|#define ALTP_START_ATOM(altp)           (altp)[iALTP_START_ATOM].number
  ------------------
 9940|     15|                                ALTP_DELTA( pBNS->alt_path ) = delta;
  ------------------
  |  |  140|     15|#define ALTP_DELTA(altp)                 (altp)[iALTP_FLOW].flow[0]
  ------------------
 9941|     15|                                break;
 9942|      0|                            case 2: /* u = t: t->v, error */
  ------------------
  |  Branch (9942:29): [True: 0, False: 15]
  ------------------
 9943|      0|                                ret = BNS_WRONG_PARMS;
  ------------------
  |  |   76|      0|#define BNS_WRONG_PARMS    (BNS_ERR +  0) /*(-9999)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 9944|      0|                                break;
 9945|      0|                            case 3: /* v = s: u->s, error */
  ------------------
  |  Branch (9945:29): [True: 0, False: 15]
  ------------------
 9946|      0|                                ret = BNS_WRONG_PARMS;
  ------------------
  |  |   76|      0|#define BNS_WRONG_PARMS    (BNS_ERR +  0) /*(-9999)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 9947|      0|                                break;
 9948|      0|                            case 4: /* v = t: u->t, u is the last vertex */
  ------------------
  |  Branch (9948:29): [True: 0, False: 15]
  ------------------
 9949|      0|                                ALTP_END_ATOM( pBNS->alt_path ) = u / 2 - 1;
  ------------------
  |  |  130|      0|#define ALTP_END_ATOM(altp)             (altp)[iALTP_END_ATOM].number
  ------------------
 9950|      0|                                break;
 9951|      0|                            default:
  ------------------
  |  Branch (9951:29): [True: 0, False: 15]
  ------------------
 9952|      0|                                ret = BNS_WRONG_PARMS;
  ------------------
  |  |   76|      0|#define BNS_WRONG_PARMS    (BNS_ERR +  0) /*(-9999)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 9953|      0|                                break;
 9954|     15|                        }
 9955|     15|                    }
 9956|     30|                }
 9957|     30|            }
 9958|     30|        }
 9959|     93|        else
 9960|     93|        {
 9961|     93|            f = ( pedge->flow & EDGE_FLOW_MASK ) + delta;
  ------------------
  |  |  161|     93|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
 9962|     93|            if (!delta)
  ------------------
  |  Branch (9962:17): [True: 0, False: 93]
  ------------------
 9963|      0|            {
 9964|      0|                pedge->flow &= ~EDGE_FLOW_PATH;
  ------------------
  |  |  162|      0|#define EDGE_FLOW_PATH          0x4000  /* mark: the edge belongs to the augmenting path */
  ------------------
 9965|      0|            }
 9966|     93|            else
 9967|     93|            {
 9968|     93|                if (f < 0 || f > pedge->cap)
  ------------------
  |  Branch (9968:21): [True: 0, False: 93]
  |  Branch (9968:30): [True: 0, False: 93]
  ------------------
 9969|      0|                {
 9970|      0|                    ret = BNS_WRONG_PARMS;
  ------------------
  |  |   76|      0|#define BNS_WRONG_PARMS    (BNS_ERR +  0) /*(-9999)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 9971|      0|                }
 9972|     93|                else
 9973|     93|                {
 9974|     93|                    AT_NUMB   iu = u / 2 - 1;
 9975|     93|                    AT_NUMB   iv = v / 2 - 1;
 9976|     93|                    int       indx;
 9977|     93|                    if (!( bChangeFlow & BNS_EF_CHNG_FLOW ))
  ------------------
  |  |  379|     93|#define BNS_EF_CHNG_FLOW      1  /* change Balanced Network (BN) flow inside the BNS search */
  ------------------
  |  Branch (9977:25): [True: 0, False: 93]
  ------------------
 9978|      0|                    {
 9979|      0|                        f -= delta; /* do not actually change the flow, only find the augmenting path */
 9980|      0|                    }
 9981|     93|                    else
 9982|     93|                    {
 9983|     93|                        if (delta)
  ------------------
  |  Branch (9983:29): [True: 93, False: 0]
  ------------------
 9984|     93|                        {
 9985|     93|                            pedge->pass++;
 9986|     93|                        }
 9987|     93|                    }
 9988|     93|                    pedge->flow = ( pedge->flow & ~( EDGE_FLOW_PATH | EDGE_FLOW_MASK ) ) | f;
  ------------------
  |  |  162|     93|#define EDGE_FLOW_PATH          0x4000  /* mark: the edge belongs to the augmenting path */
  ------------------
                                  pedge->flow = ( pedge->flow & ~( EDGE_FLOW_PATH | EDGE_FLOW_MASK ) ) | f;
  ------------------
  |  |  161|     93|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
 9989|     93|                    if (ALTP_MAY_ADD( pBNS->alt_path ))
  ------------------
  |  |  138|     93|#define ALTP_MAY_ADD(altp)              (iALTP_NEIGHBOR + (altp)[iALTP_PATH_LEN].number < (altp)[iALTP_MAX_LEN].number)
  |  |  ------------------
  |  |  |  Branch (138:41): [True: 93, False: 0]
  |  |  ------------------
  ------------------
 9990|     93|                    {
 9991|       |                        /* bReverse? u <- v : u -> v */
 9992|     93|                        indx = bReverse ? ( pedge->neighbor1 == iv ) : ( pedge->neighbor1 == iu );
  ------------------
  |  Branch (9992:32): [True: 37, False: 56]
  ------------------
 9993|     93|                        ALTP_CUR_THIS_ATOM_NEIGHBOR( pBNS->alt_path ) = pedge->neigh_ord[1 - indx];
  ------------------
  |  |  134|     93|#define ALTP_CUR_THIS_ATOM_NEIGHBOR(altp) (altp)[iALTP_NEIGHBOR+ALTP_PATH_LEN(altp)].ineigh[0]  /* 0 <= X < path_len */
  |  |  ------------------
  |  |  |  |  129|     93|#define ALTP_PATH_LEN(altp)             (altp)[iALTP_PATH_LEN].number  /* number of bonds = number of atoms-1*/
  |  |  ------------------
  ------------------
 9994|     93|                        ALTP_CUR_NEXT_ATOM_NEIGHBOR( pBNS->alt_path ) = pedge->neigh_ord[indx];
  ------------------
  |  |  135|     93|#define ALTP_CUR_NEXT_ATOM_NEIGHBOR(altp) (altp)[iALTP_NEIGHBOR+ALTP_PATH_LEN(altp)].ineigh[1]
  |  |  ------------------
  |  |  |  |  129|     93|#define ALTP_PATH_LEN(altp)             (altp)[iALTP_PATH_LEN].number  /* number of bonds = number of atoms-1*/
  |  |  ------------------
  ------------------
 9995|     93|                        ALTP_NEXT( pBNS->alt_path );
  ------------------
  |  |  136|     93|#define ALTP_NEXT(altp)                 (++ALTP_PATH_LEN(altp))
  |  |  ------------------
  |  |  |  |  129|     93|#define ALTP_PATH_LEN(altp)             (altp)[iALTP_PATH_LEN].number  /* number of bonds = number of atoms-1*/
  |  |  ------------------
  ------------------
 9996|     93|                    }
 9997|      0|                    else
 9998|      0|                    {
 9999|      0|                        ALTP_OVERFLOW( pBNS->alt_path ) = 1;
  ------------------
  |  |  141|      0|#define ALTP_OVERFLOW(altp)             (altp)[iALTP_FLOW].flow[1]
  ------------------
10000|      0|                        ret = BNS_ALTPATH_OVFL;
  ------------------
  |  |   79|      0|#define BNS_ALTPATH_OVFL   (BNS_ERR +  3) /*(-9996)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
10001|      0|                    }
10002|     93|                }
10003|     93|            }
10004|     93|        }
10005|    123|        return ret ? ret : f;
  ------------------
  |  Branch (10005:16): [True: 0, False: 123]
  ------------------
10006|    123|    }
10007|       |
10008|      0|    return bBackward;
10009|    123|}
rescap_mark:
10019|    123|{
10020|    123|    BNS_ST_EDGE    *pst_edge;
10021|    123|    BNS_EDGE       *pedge;
10022|       |
10023|    123|    int    f, flow;
10024|    123|    S_CHAR s_or_t;
10025|    123|    int    bBackward = GetEdgePointer( pBNS, u, v, iuv, &pedge, &s_or_t );
10026|       |
10027|    123|    if (!IS_BNS_ERROR( bBackward ))
  ------------------
  |  |   95|    123|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|    123|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|    123|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|    123|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 123, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 123]
  |  |  ------------------
  ------------------
10028|    123|    {
10029|    123|        if (s_or_t)
  ------------------
  |  Branch (10029:13): [True: 30, False: 93]
  ------------------
10030|     30|        {
10031|     30|            pst_edge = (BNS_ST_EDGE *) pedge;
10032|     30|            flow = pst_edge->flow;
10033|     30|            f = ( flow & EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|     30|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
10034|     30|            if (!bBackward)
  ------------------
  |  Branch (10034:17): [True: 30, False: 0]
  ------------------
10035|     30|            {
10036|     30|                f = (int) pst_edge->cap - f;
10037|     30|            }
10038|     30|            if (flow & EDGE_FLOW_ST_PATH)
  ------------------
  |  |  157|     30|#define EDGE_FLOW_ST_PATH       0x4000  /* mark: the edge belongs to the augmenting path */
  ------------------
  |  Branch (10038:17): [True: 1, False: 29]
  ------------------
10039|      1|            {
10040|      1|                pBNS->bNotASimplePath++;
10041|      1|                f /= 2;   /* this is the second time we pass the same edge: reduce flow by a factor of 2 */
10042|      1|            }
10043|     29|            else
10044|     29|            {
10045|     29|                pst_edge->flow |= EDGE_FLOW_ST_PATH; /* mark the edge */
  ------------------
  |  |  157|     29|#define EDGE_FLOW_ST_PATH       0x4000  /* mark: the edge belongs to the augmenting path */
  ------------------
10046|     29|            }
10047|     30|        }
10048|     93|        else
10049|     93|        {
10050|     93|            flow = pedge->flow;
10051|     93|            f = flow & EDGE_FLOW_MASK;
  ------------------
  |  |  161|     93|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
10052|     93|            if (!bBackward)
  ------------------
  |  Branch (10052:17): [True: 54, False: 39]
  ------------------
10053|     54|            {
10054|     54|                f = (int) pedge->cap - f;
10055|     54|            }
10056|     93|            if (flow & EDGE_FLOW_PATH)
  ------------------
  |  |  162|     93|#define EDGE_FLOW_PATH          0x4000  /* mark: the edge belongs to the augmenting path */
  ------------------
  |  Branch (10056:17): [True: 8, False: 85]
  ------------------
10057|      8|            {
10058|      8|                f /= 2;    /* this is the second time we pass the same edge: reduce flow by a factor of 2 */
10059|      8|                pBNS->bNotASimplePath++;
10060|      8|            }
10061|     85|            else
10062|     85|            {
10063|     85|                pedge->flow |= EDGE_FLOW_PATH;  /* mark the edge */
  ------------------
  |  |  162|     85|#define EDGE_FLOW_PATH          0x4000  /* mark: the edge belongs to the augmenting path */
  ------------------
10064|     85|            }
10065|     93|        }
10066|    123|        return f;
10067|    123|    }
10068|       |
10069|      0|    return bBackward;
10070|    123|}
GetPrevVertex:
10080|    190|{
10081|    190|    Vertex w, z, x2, y2, n;
10082|    190|    EdgeIndex iwy;
10083|       |
10084|    190|    w = SwitchEdge_Vert1( y );
  ------------------
  |  |  417|    190|#define SwitchEdge_Vert1(u) SwitchEdge[u][0]
  ------------------
10085|    190|    z = SwitchEdge_Vert2( y );
  ------------------
  |  |  418|    190|#define SwitchEdge_Vert2(u) Get2ndEdgeVertex( pBNS, SwitchEdge[u] )
  ------------------
10086|    190|    iwy = SwitchEdge_IEdge( y );
  ------------------
  |  |  419|    190|#define SwitchEdge_IEdge(u) SwitchEdge[u][1]
  ------------------
10087|    190|    if (z == y)
  ------------------
  |  Branch (10087:9): [True: 178, False: 12]
  ------------------
10088|    178|    {
10089|    178|        *iuv = iwy;
10090|    178|        return w;
10091|    178|    }
10092|     12|    x2 = prim( y );
  ------------------
  |  |  414|     12|#define prim(v) (Vertex)((v)^1)
  ------------------
10093|     12|    y2 = prim( z );
  ------------------
  |  |  414|     12|#define prim(v) (Vertex)((v)^1)
  ------------------
10094|     12|    n = 0;
10095|     20|    while (y2 != NO_VERTEX)
  ------------------
  |  |  146|     20|#define NO_VERTEX    -2
  ------------------
  |  Branch (10095:12): [True: 20, False: 0]
  ------------------
10096|     20|    {
10097|     20|        w = SwitchEdge_Vert1( y2 );
  ------------------
  |  |  417|     20|#define SwitchEdge_Vert1(u) SwitchEdge[u][0]
  ------------------
10098|     20|        z = SwitchEdge_Vert2( y2 );
  ------------------
  |  |  418|     20|#define SwitchEdge_Vert2(u) Get2ndEdgeVertex( pBNS, SwitchEdge[u] )
  ------------------
10099|     20|        iwy = SwitchEdge_IEdge( y2 );
  ------------------
  |  |  419|     20|#define SwitchEdge_IEdge(u) SwitchEdge[u][1]
  ------------------
10100|     20|        if (w == x2)
  ------------------
  |  Branch (10100:13): [True: 12, False: 8]
  ------------------
10101|     12|        {
10102|     12|            *iuv = iwy;
10103|       |            /*return z; */
10104|     12|            return ( y + z ) % 2 ? z : prim( z );
  ------------------
  |  |  414|     12|#define prim(v) (Vertex)((v)^1)
  ------------------
  |  Branch (10104:20): [True: 0, False: 12]
  ------------------
10105|     12|        }
10106|      8|        n++;
10107|       |        /*
10108|       |        #ifdef _DEBUG
10109|       |        if ( n ) {
10110|       |        int stop = 1;
10111|       |        }
10112|       |        #endif
10113|       |        */
10114|      8|        if (w == y2)
  ------------------
  |  Branch (10114:13): [True: 0, False: 8]
  ------------------
10115|      0|        {
10116|      0|            return NO_VERTEX;
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
10117|      0|        }
10118|      8|        y2 = w;
10119|      8|    }
10120|       |
10121|      0|    return y2;
10122|     12|}
rescap:
10561|  1.47k|{
10562|  1.47k|    BNS_ST_EDGE    *pst_edge;
10563|  1.47k|    BNS_EDGE       *pedge;
10564|       |
10565|  1.47k|    int f;
10566|  1.47k|    S_CHAR s_or_t;
10567|  1.47k|    int    bBackward = GetEdgePointer( pBNS, u, v, iuv, &pedge, &s_or_t );
10568|       |
10569|  1.47k|    if (!IS_BNS_ERROR( bBackward ))
  ------------------
  |  |   95|  1.47k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|  1.47k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|  1.47k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|  1.47k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 1.47k, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 1.47k]
  |  |  ------------------
  ------------------
10570|  1.47k|    {
10571|       |
10572|  1.47k|        if (s_or_t)
  ------------------
  |  Branch (10572:13): [True: 933, False: 541]
  ------------------
10573|    933|        {
10574|    933|            pst_edge = (BNS_ST_EDGE *) pedge;
10575|    933|            f = ( pst_edge->flow & EDGE_FLOW_ST_MASK );
  ------------------
  |  |  156|    933|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
10576|    933|            if (!bBackward)
  ------------------
  |  Branch (10576:17): [True: 833, False: 100]
  ------------------
10577|    833|            {
10578|    833|                f = (int) pst_edge->cap - f;
10579|    833|            }
10580|    933|        }
10581|    541|        else
10582|    541|        {
10583|    541|            f = ( pedge->flow & EDGE_FLOW_MASK );
  ------------------
  |  |  161|    541|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
10584|    541|            if (!bBackward)
  ------------------
  |  Branch (10584:17): [True: 310, False: 231]
  ------------------
10585|    310|            {
10586|    310|                f = (int) pedge->cap - f;
10587|    310|            }
10588|    541|        }
10589|  1.47k|        return f;
10590|  1.47k|    }
10591|       |
10592|      0|    return bBackward; /* error */
10593|  1.47k|}
BalancedNetworkSearch:
10697|   110k|{
10698|   110k|    Vertex          *BasePtr = pBD->BasePtr;
10699|   110k|    Edge            *SwitchEdge = pBD->SwitchEdge;
10700|   110k|    S_CHAR          *Tree = pBD->Tree;
10701|   110k|    Vertex          *ScanQ = pBD->ScanQ;
10702|   110k|    int              QSize = pBD->QSize;
10703|   110k|    Vertex          *Pu = pBD->Pu;
10704|   110k|    Vertex          *Pv = pBD->Pv;
10705|   110k|    int              max_len_Pu_Pv = pBD->max_len_Pu_Pv;
10706|       |
10707|       |    /* added to translate into C */
10708|   110k|    int i, k, degree, delta, ret = 0;
10709|   110k|    Vertex u, b_u, v, b_v, w;
10710|   110k|    EdgeIndex iuv;
10711|   110k|#if ( BNS_RAD_SEARCH == 1 )
10712|   110k|    int              n, bRadSearch = ( BNS_EF_RAD_SRCH & bChangeFlow ) && pBD->RadEndpoints;
  ------------------
  |  |  393|   110k|#define BNS_EF_RAD_SRCH     128  /* search for rafical paths closures */
  ------------------
  |  Branch (10712:38): [True: 5, False: 110k]
  |  Branch (10712:75): [True: 5, False: 0]
  ------------------
10713|   110k|    BRS_MODE         bRadSrchMode = RAD_SRCH_NORM;
10714|   110k|    int              bRadSearchPrelim = 0;
10715|   110k|    if (bRadSearch)
  ------------------
  |  Branch (10715:9): [True: 5, False: 110k]
  ------------------
10716|      5|    {
10717|      5|        pBD->nNumRadEndpoints = 0;
10718|      5|        bRadSrchMode = pBD->bRadSrchMode;
10719|      5|        bRadSearchPrelim = pBNS->type_TACN && bRadSrchMode == RAD_SRCH_NORM;
  ------------------
  |  Branch (10719:28): [True: 0, False: 5]
  |  Branch (10719:47): [True: 0, False: 0]
  ------------------
10720|      5|    }
10721|   110k|#endif
10722|       |
10723|       |    /*  -- Always --
10724|       |    Vertex_s = FIRST_INDX;
10725|       |    Vertex_t = Vertex_s+1;
10726|       |    */
10727|   110k|    QSize = k = 0;     /* put s on ScanQ = set S */
10728|   110k|    ScanQ[QSize] = Vertex_s;
  ------------------
  |  |  143|   110k|#define Vertex_s 0
  ------------------
10729|   110k|    BasePtr[Vertex_t] = Vertex_s;
  ------------------
  |  |  144|   110k|#define Vertex_t 1
  ------------------
                  BasePtr[Vertex_t] = Vertex_s;
  ------------------
  |  |  143|   110k|#define Vertex_s 0
  ------------------
10730|   110k|    BasePtr[Vertex_s] = BLOSSOM_BASE; /* create initial blossom C(Vertex_s) with base s */
  ------------------
  |  |  143|   110k|#define Vertex_s 0
  ------------------
                  BasePtr[Vertex_s] = BLOSSOM_BASE; /* create initial blossom C(Vertex_s) with base s */
  ------------------
  |  |  147|   110k|#define BLOSSOM_BASE -1
  ------------------
10731|   110k|    Tree[Vertex_s] = TREE_IN_1;
  ------------------
  |  |  143|   110k|#define Vertex_s 0
  ------------------
                  Tree[Vertex_s] = TREE_IN_1;
  ------------------
  |  |  264|   110k|#define TREE_IN_1      3  /* in T and is s-reachable */
  ------------------
10732|       |
10733|   110k|    do
10734|   111k|    {
10735|   111k|        u = ScanQ[k]; /* select u from the head of ScanQ */
10736|       |                      /* since u is on the queue, it has a blossom C(U) with base b_u */
10737|   111k|        b_u = FindBase( u, BasePtr );
10738|   111k|        degree = GetVertexDegree( pBNS, u );
10739|   111k|#if ( BNS_RAD_SEARCH == 1 )
10740|   111k|        n = 0;
10741|   111k|#endif
10742|   229k|        for (i = 0; i < degree; i++)
  ------------------
  |  Branch (10742:21): [True: 118k, False: 111k]
  ------------------
10743|   118k|        {
10744|       |            /* v = vert[u].neighbor[i]; */
10745|   118k|            v = GetVertexNeighbor( pBNS, u, i, &iuv );
10746|   118k|            if (v == NO_VERTEX)
  ------------------
  |  |  146|   118k|#define NO_VERTEX    -2
  ------------------
  |  Branch (10746:17): [True: 116k, False: 1.75k]
  ------------------
10747|   116k|            {
10748|   116k|                continue; /* the atom has only single bonds, ignore it */
10749|   116k|            }
10750|  1.75k|#if ( BNS_RAD_SEARCH == 1 )
10751|  1.75k|            if (!k && bRadSrchMode == RAD_SRCH_FROM_FICT && v / 2 <= pBNS->num_atoms)
  ------------------
  |  Branch (10751:17): [True: 719, False: 1.03k]
  |  Branch (10751:23): [True: 100, False: 619]
  |  Branch (10751:61): [True: 25, False: 75]
  ------------------
10752|     25|            {
10753|     25|                continue; /* start from fict. vertices only */
10754|     25|            }
10755|  1.72k|            if (bRadSearchPrelim && v / 2 > pBNS->num_atoms)
  ------------------
  |  Branch (10755:17): [True: 0, False: 1.72k]
  |  Branch (10755:37): [True: 0, False: 0]
  ------------------
10756|      0|            {
10757|      0|                continue; /* during initial add/remove H allow radical movement only through real atoms */
10758|      0|            }
10759|  1.72k|#endif
10760|  1.72k|            if ( /* PrevPt[u] != v ** avoid edges of T */
10761|  1.72k|                ( SwitchEdge_Vert1( u ) != v || SwitchEdge_Vert2( u ) != u )  /* avoid edges of T */
  ------------------
  |  |  417|  1.72k|#define SwitchEdge_Vert1(u) SwitchEdge[u][0]
  ------------------
                              ( SwitchEdge_Vert1( u ) != v || SwitchEdge_Vert2( u ) != u )  /* avoid edges of T */
  ------------------
  |  |  418|    281|#define SwitchEdge_Vert2(u) Get2ndEdgeVertex( pBNS, SwitchEdge[u] )
  ------------------
  |  Branch (10761:19): [True: 1.44k, False: 281]
  |  Branch (10761:49): [True: 0, False: 281]
  ------------------
10762|  1.72k|                 && ( ret = rescap( pBNS, u, v, iuv ) ) > 0)
  ------------------
  |  Branch (10762:21): [True: 520, False: 928]
  ------------------
10763|    520|            {
10764|       |                /* Special treatment to prevent H<->(-) replacement on non-acidic atoms */
10765|       |                /*----------------------------------------------------------------------*/
10766|    520|                if (pBNS->type_TACN)
  ------------------
  |  Branch (10766:21): [True: 0, False: 520]
  ------------------
10767|      0|                {
10768|      0|                    if (bIgnoreVertexNonTACN_atom( pBNS, u, v ))
  ------------------
  |  Branch (10768:25): [True: 0, False: 0]
  ------------------
10769|      0|                    {
10770|      0|                        continue;
10771|      0|                    }
10772|      0|                    if (bIgnoreVertexNonTACN_group( pBNS, u, v, SwitchEdge ))
  ------------------
  |  Branch (10772:25): [True: 0, False: 0]
  ------------------
10773|      0|                    {
10774|      0|                        continue;
10775|      0|                    }
10776|       |#if ( FIX_KEEP_H_ON_NH_ANION == 1 )
10777|       |                    if (bIsRemovedHfromNHaion( pBNS, u, v ))
10778|       |                    {
10779|       |                        continue;
10780|       |                    }
10781|       |#endif
10782|       |#if ( FIX_AVOID_ADP == 1 )
10783|       |                    if (bIsAggressiveDeprotonation( pBNS, u, v, SwitchEdge ))
10784|       |                    {
10785|       |                        continue;
10786|       |                    }
10787|       |#endif
10788|      0|                }
10789|       |                /*----------------------------------------------------------------------*/
10790|    520|                b_v = FindBase( v, BasePtr ); /* Notation: b_x is a base of x */
10791|       |
10792|    520|                if (b_v == NO_VERTEX)
  ------------------
  |  |  146|    520|#define NO_VERTEX    -2
  ------------------
  |  Branch (10792:21): [True: 329, False: 191]
  ------------------
10793|    329|                {
10794|       |                    /* Originally 0 instead of NO_VERTEX */
10795|       |
10796|       |                    /* Important note: following "A. Note of Implementing the Algorithm" from the
10797|       |                    article by Kocay and Stone, all references to PrevPt[a] have been
10798|       |                    replaced with SwitchEdge[a][0]=SwitchEdge_Vert1(a); to be on a safe side
10799|       |                    the check whether (SwitchEdge_Vert2(a)==a) has been added.
10800|       |                    */
10801|       |
10802|       |                    /* v is not yet in T or T' -- add it to T and M */
10803|       |                    /*PrevPt[v] = u; ** this effectively adds v to T and v' to T' */
10804|       |
10805|    329|                    QSize++;
10806|    329|                    ScanQ[QSize] = v;
10807|    329|                    TREE_MARK( v, TREE_IN_1 ); /* mark v s-reachable (in T) */
  ------------------
  |  |  269|    329|#define TREE_MARK(X, MARK)           do{ if( Tree[X] < MARK ) Tree[X]=MARK; }while(0)
  |  |  ------------------
  |  |  |  Branch (269:46): [True: 329, False: 0]
  |  |  |  Branch (269:84): [Folded - Ignored]
  |  |  ------------------
  ------------------
10808|    329|                    TREE_MARK( prim( v ), TREE_IN_2 ); /* mark v' in T' */
  ------------------
  |  |  269|    329|#define TREE_MARK(X, MARK)           do{ if( Tree[X] < MARK ) Tree[X]=MARK; }while(0)
  |  |  ------------------
  |  |  |  Branch (269:46): [True: 329, False: 0]
  |  |  |  Branch (269:84): [Folded - Ignored]
  |  |  ------------------
  ------------------
10809|       |
10810|       |                                                       /* Switch Edges: If u in T then Pu (a valid su-path) can be constructed
10811|       |                                                       by successfully executing u=PrevPt[u] until u=s.
10812|       |                                                       For vertices in T' the situation is different.
10813|       |                                                       Suppose uv and v'u' are added to a mirror network M creating a blossom:
10814|       |
10815|       |                                                       s            T    (Note: in the code v' is prim(v),
10816|       |                                                       T             / \                       u' is prim(u), etc.)
10817|       |                                                       /   ...
10818|       |                                                       w=x1
10819|       |                                                       / \          u in T,   v in T'
10820|       |                                                       u=y2   v'=y3
10821|       |                                                       \ /      <--- two added edges uv and (uv)'=v'u'
10822|       |                                                       --------    X   ------------intersection of the edges ------------------------
10823|       |                                                       / \      <--- (the edges intersection in the picture is shown as X)
10824|       |                                                       u'=x2   v=x3      u' it T', v' in T
10825|       |                                                       \ /
10826|       |                                                       T'           w'=y1
10827|       |                                                       \   ...
10828|       |                                                       \ /
10829|       |                                                       t           T'
10830|       |
10831|       |                                                       Vertices v and u' now become s-reachable;
10832|       |                                                       The valid paths to v and u' must use the edges uv and v'u' respectively.
10833|       |
10834|       |                                                       For each vertex z in S we define a switch-edge that allows a valid sz-path
10835|       |                                                       to be constructed, SwitchEdge[v]=uv and SwitchEdge[u']=v'u'. (We don't
10836|       |                                                       know the direction of the edge uv, it may be (u,v) or (v,u). In either case,
10837|       |                                                       the complementary edge is indicated by v'u').
10838|       |
10839|       |                                                       Vertex w' also becomes s-reachable when uv is added to M, and a valid sw'-path
10840|       |                                                       must use one of uv and v'u'. Therefore we choose one of them, say uv (see below
10841|       |                                                       the rule of choosing the switch-edge), and define SwitchEdge[w'] = uv.
10842|       |
10843|       |                                                       When the addition of an edge uv to M causes a vertex z to become s-reachable
10844|       |                                                       (where z was previously non-reachable), z is placed on the ScanQ, that is, into S.
10845|       |                                                       The edge uv is said to be a switch-edge for z.
10846|       |
10847|       |                                                       Rule: We choose the the order of the vertices uv to be such that the valid sz-path
10848|       |                                                       consists of a valid su-path, followed by edge uv, followed by a valid vz-path.
10849|       |
10850|       |                                                       For vertices z in T we can take SwitchEdge[z]=yz where y=PrevPt[z] since
10851|       |                                                       it is the edge yz that allows z to be s-reachable.
10852|       |                                                       For vertices z not in S we take SwitchEdge[z]=NONE.
10853|       |
10854|       |                                                       */
10855|       |
10856|       |                                                       /* v is not yet in T or T' -- add it to T and M */
10857|    329|                    SwitchEdge_Vert1( v ) = u; /* this effectively adds uv and v'u' to M */
  ------------------
  |  |  417|    329|#define SwitchEdge_Vert1(u) SwitchEdge[u][0]
  ------------------
10858|    329|                    SwitchEdge_IEdge( v ) = iuv;
  ------------------
  |  |  419|    329|#define SwitchEdge_IEdge(u) SwitchEdge[u][1]
  ------------------
10859|       |
10860|    329|                    BasePtr[prim( v )] = v;
  ------------------
  |  |  414|    329|#define prim(v) (Vertex)((v)^1)
  ------------------
10861|    329|                    BasePtr[v] = BLOSSOM_BASE; /* create a trivial blossom C(v) with base v */
  ------------------
  |  |  147|    329|#define BLOSSOM_BASE -1
  ------------------
10862|    329|#if ( BNS_RAD_SEARCH == 1 )
10863|    329|                    n++;
10864|    329|#endif
10865|    329|                }
10866|       |
10867|       |                else if (TREE_IS_S_REACHABLE( prim( v ) ) /*Is_s_Reachable(prim(v)*/
  ------------------
  |  |  266|    382|#define TREE_IS_S_REACHABLE(X) (Tree[X] >= TREE_IN_2BLOSS)
  |  |  ------------------
  |  |  |  |  263|    191|#define TREE_IN_2BLOSS 2  /* in T' and in a blossom, is s-reachable */
  |  |  ------------------
  |  |  |  Branch (266:32): [True: 61, False: 130]
  |  |  ------------------
  ------------------
10868|    191|                                                          /* if v' is reachable, an st-path is given by P(u)-uv-P'(v') */
10869|    191|                                                          /*&& PrevPt[prim(u)] != prim(v) ** avoid edges of T' */
10870|    191|                          && ( SwitchEdge_Vert1( prim( u ) ) != prim( v ) || SwitchEdge_Vert2( prim( u ) ) != prim( u ) ) /* avoid edges of T' */
  ------------------
  |  |  417|     61|#define SwitchEdge_Vert1(u) SwitchEdge[u][0]
  ------------------
                                        && ( SwitchEdge_Vert1( prim( u ) ) != prim( v ) || SwitchEdge_Vert2( prim( u ) ) != prim( u ) ) /* avoid edges of T' */
  ------------------
  |  |  414|    122|#define prim(v) (Vertex)((v)^1)
  ------------------
                                        && ( SwitchEdge_Vert1( prim( u ) ) != prim( v ) || SwitchEdge_Vert2( prim( u ) ) != prim( u ) ) /* avoid edges of T' */
  ------------------
  |  |  418|     37|#define SwitchEdge_Vert2(u) Get2ndEdgeVertex( pBNS, SwitchEdge[u] )
  ------------------
                                        && ( SwitchEdge_Vert1( prim( u ) ) != prim( v ) || SwitchEdge_Vert2( prim( u ) ) != prim( u ) ) /* avoid edges of T' */
  ------------------
  |  |  414|     37|#define prim(v) (Vertex)((v)^1)
  ------------------
  |  Branch (10870:32): [True: 24, False: 37]
  |  Branch (10870:78): [True: 0, False: 37]
  ------------------
10871|    191|                          && b_u != b_v
  ------------------
  |  Branch (10871:30): [True: 24, False: 0]
  ------------------
10872|    191|                          && !( pBNS->type_TACN && bIgnoreVertexNonTACN_group( pBNS, prim( v ), u, SwitchEdge ) )
  ------------------
  |  |  414|      0|#define prim(v) (Vertex)((v)^1)
  ------------------
  |  Branch (10872:33): [True: 0, False: 24]
  |  Branch (10872:52): [True: 0, False: 0]
  ------------------
10873|       |#if ( FIX_KEEP_H_ON_NH_ANION == 1 )
10874|       |                          && !( pBNS->type_TACN && bIsRemovedHfromNHaion( pBNS, prim( v ), u ) )
10875|       |#endif
10876|    191|                          )
10877|     24|                {
10878|     24|#if ( BNS_RAD_SEARCH == 1 )
10879|     24|                    n++;
10880|     24|#endif
10881|       |                    /* There is now a valid sv-path via u avoiding b_v (unless v==b_v)
10882|       |                    => u, v, u', and v' now all become part of the same connected component of M[C] */
10883|       |
10884|     24|                    w = MakeBlossom( pBNS, ScanQ, &QSize, Pu, Pv, max_len_Pu_Pv, SwitchEdge, BasePtr, u, v, iuv, b_u, b_v, Tree );
10885|       |                    /* this constructed the new blossom and returned its base */
10886|       |
10887|     24|                    if (IS_BNS_ERROR( w ))
  ------------------
  |  |   95|     24|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|     24|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|     24|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|     24|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 24, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 24]
  |  |  ------------------
  ------------------
10888|      0|                    {
10889|      0|                        pBD->QSize = QSize;
10890|      0|                        return w; /* error */
10891|      0|                    }
10892|       |
10893|     24|                    b_u = w; /* the new base of C(u) */
10894|     24|                    if (prim( w ) == Vertex_t)
  ------------------
  |  |  414|     24|#define prim(v) (Vertex)((v)^1)
  ------------------
                                  if (prim( w ) == Vertex_t)
  ------------------
  |  |  144|     24|#define Vertex_t 1
  ------------------
  |  Branch (10894:25): [True: 15, False: 9]
  ------------------
10895|     15|                    {
10896|       |                        /* t is now s-reachable, a valid augmenting path P exists in M */
10897|     15|                        delta = FindPathCap( pBNS, SwitchEdge, Vertex_s, Vertex_t, 10000 ); /* compute the residual capacity of P + P' */
  ------------------
  |  |  143|     15|#define Vertex_s 0
  ------------------
                                      delta = FindPathCap( pBNS, SwitchEdge, Vertex_s, Vertex_t, 10000 ); /* compute the residual capacity of P + P' */
  ------------------
  |  |  144|     15|#define Vertex_t 1
  ------------------
10898|     15|                        if (IS_BNS_ERROR( delta ))
  ------------------
  |  |   95|     15|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|     15|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|     15|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|     15|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 15, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 15]
  |  |  ------------------
  ------------------
10899|      0|                        {
10900|      0|                            pBD->QSize = QSize;
10901|      0|                            return delta; /* error */
10902|      0|                        }
10903|       |#if ( ALLOW_ONLY_SIMPLE_ALT_PATH == 1 )
10904|       |                        if (pBNS->bNotASimplePath || abs( delta ) > 1)
10905|       |                        {
10906|       |                            delta = 0;
10907|       |                        }
10908|       |#endif
10909|     15|                        if (delta)
  ------------------
  |  Branch (10909:29): [True: 15, False: 0]
  ------------------
10910|     15|                        {
10911|     15|                            pBNS->bChangeFlow |= ( bChangeFlow & BNS_EF_CHNG_FLOW );
  ------------------
  |  |  379|     15|#define BNS_EF_CHNG_FLOW      1  /* change Balanced Network (BN) flow inside the BNS search */
  ------------------
10912|     15|                        }
10913|     15|                        ret = PullFlow( pBNS, SwitchEdge, Vertex_s, Vertex_t, delta, 0, bChangeFlow ); /* augment on a pair of valid st-paths */
  ------------------
  |  |  143|     15|#define Vertex_s 0
  ------------------
                                      ret = PullFlow( pBNS, SwitchEdge, Vertex_s, Vertex_t, delta, 0, bChangeFlow ); /* augment on a pair of valid st-paths */
  ------------------
  |  |  144|     15|#define Vertex_t 1
  ------------------
10914|     15|                        pBD->QSize = QSize;
10915|     15|                        return
10916|     15|                            ( IS_BNS_ERROR( ret ) ? ret : delta );
  ------------------
  |  |   95|     15|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|     15|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|     15|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|     15|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 15, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 15]
  |  |  ------------------
  ------------------
10917|     15|                    }
10918|     24|                }
10919|    520|            }
10920|       |
10921|  1.20k|            else if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|  1.20k|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|  1.20k|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|  1.20k|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|  1.20k|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 1.20k, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 1.20k]
  |  |  ------------------
  ------------------
10922|      0|            {
10923|      0|                pBD->QSize = QSize;
10924|      0|                return ret; /* error */
10925|      0|            }
10926|  1.72k|        }
10927|       |
10928|   111k|#if ( BNS_RAD_SEARCH == 1 )
10929|   111k|        if (bRadSearch && !n)
  ------------------
  |  Branch (10929:13): [True: 56, False: 111k]
  |  Branch (10929:27): [True: 18, False: 38]
  ------------------
10930|     18|        {
10931|       |            /* The BNS stopped at u */
10932|     18|            n = RegisterRadEndpoint( pBNS, pBD, u );
10933|     18|            if (IS_BNS_ERROR( n ))
  ------------------
  |  |   95|     18|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|     18|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|     18|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|     18|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 18, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 18]
  |  |  ------------------
  ------------------
10934|      0|            {
10935|      0|                pBD->QSize = QSize;
10936|      0|                return n;
10937|      0|            }
10938|     18|        }
10939|   111k|#endif
10940|       |
10941|   111k|        k++; /* advance ScanQ */
10942|   111k|    } while (k <= QSize);
  ------------------
  |  Branch (10942:14): [True: 307, False: 110k]
  ------------------
10943|       |
10944|       |
10945|       |    /* if this point is reached, no valid augmenting path exists, ScanQ contains
10946|       |    the set S of all s-reachable vertices and K=[S,S-] is a minimum balanced edge-cut */
10947|       |    /* ClearFlowMarks( vert, num_vert); */
10948|       |
10949|   110k|    pBD->QSize = QSize;
10950|       |
10951|   110k|    return 0;
10952|   110k|}
FindBase:
10984|   111k|{
10985|   111k|    if (BasePtr[u] == NO_VERTEX)
  ------------------
  |  |  146|   111k|#define NO_VERTEX    -2
  ------------------
  |  Branch (10985:9): [True: 329, False: 111k]
  ------------------
10986|    329|    {
10987|    329|        return NO_VERTEX;
  ------------------
  |  |  146|    329|#define NO_VERTEX    -2
  ------------------
10988|    329|    }
10989|   111k|    else if (BasePtr[u] == BLOSSOM_BASE)
  ------------------
  |  |  147|   111k|#define BLOSSOM_BASE -1
  ------------------
  |  Branch (10989:14): [True: 111k, False: 98]
  ------------------
10990|   111k|    {
10991|   111k|        return u;
10992|   111k|    }
10993|     98|    else
10994|     98|    {
10995|     98|        Vertex b;
10996|     98|        b = FindBase( BasePtr[u], BasePtr );
10997|     98|        BasePtr[u] = b; /* path compression */
10998|     98|        return b;
10999|     98|    }
11000|       |
11001|   111k|}
FindPathToVertex_s:
11012|     48|{
11013|       |    /* x is the base of a blossom, construct a valid Path of blossom bases to s */
11014|     48|    int i = 0;
11015|     48|    Path[i] = x;
11016|    254|    while (x != Vertex_s)
  ------------------
  |  |  143|    254|#define Vertex_s 0
  ------------------
  |  Branch (11016:12): [True: 206, False: 48]
  ------------------
11017|    206|    {
11018|    206|        x = FindBase( SwitchEdge_Vert1( x ), BasePtr );
  ------------------
  |  |  417|    206|#define SwitchEdge_Vert1(u) SwitchEdge[u][0]
  ------------------
11019|    206|        if (++i < MaxPathLen)
  ------------------
  |  Branch (11019:13): [True: 206, False: 0]
  ------------------
11020|    206|        {
11021|    206|            Path[i] = x;
11022|    206|        }
11023|      0|        else
11024|      0|        {
11025|      0|            return BNS_WRONG_PARMS;
  ------------------
  |  |   76|      0|#define BNS_WRONG_PARMS    (BNS_ERR +  0) /*(-9999)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
11026|      0|        }
11027|    206|    }
11028|       |
11029|     48|    return i;
11030|     48|}
MakeBlossom:
11051|     24|{
11052|       |    /* In order to find the base of the new blossom, the paths
11053|       |    P(u) and P(v') are constructed and compared in order to
11054|       |    find the last blossom base they have in common which
11055|       |    is reachable on a valid path.
11056|       |
11057|       |    Edge uv connects two blossoms, their bases are b_u and b_v.
11058|       |    */
11059|     24|    Vertex w, z;
11060|     24|    int len_Pu, len_Pv;
11061|     24|    int i, j;
11062|     24|    EdgeIndex izw;
11063|       |
11064|     24|    len_Pu = FindPathToVertex_s( b_u, SwitchEdge, BasePtr, Pu, max_len_Pu_Pv );
11065|     24|    if (IS_BNS_ERROR( len_Pu ))
  ------------------
  |  |   95|     24|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|     24|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|     24|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|     24|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 24, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 24]
  |  |  ------------------
  ------------------
11066|      0|    {
11067|      0|        return len_Pu;
11068|      0|    }
11069|     24|    len_Pv = FindPathToVertex_s( b_v, SwitchEdge, BasePtr, Pv, max_len_Pu_Pv );
11070|     24|    if (IS_BNS_ERROR( len_Pv ))
  ------------------
  |  |   95|     24|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|     24|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|     24|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|     24|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 24, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 24]
  |  |  ------------------
  ------------------
11071|      0|    {
11072|      0|        return len_Pv;
11073|      0|    }
11074|     24|    i = len_Pu;
11075|     24|    j = len_Pv;
11076|       |    /* Initially Pu[i] and Pv[j] both equal to s, but their first elements are different */
11077|       |    /* Find the last blossom base common to Pu and Pv */
11078|    103|    while (i >= 0 && j >= 0 && Pu[i] == Pv[j])
  ------------------
  |  Branch (11078:12): [True: 101, False: 2]
  |  Branch (11078:22): [True: 101, False: 0]
  |  Branch (11078:32): [True: 79, False: 22]
  ------------------
11079|     79|    {
11080|       |        /* Was (Pu[i]==Pv[j] && i>=0 && j>=0) => tested Pu[-1], Pv[-1] <- pointed by W.Ihlenfeldt 08-26-2004*/
11081|     79|        i--;
11082|     79|        j--;
11083|     79|    }
11084|     24|    i++;
11085|     24|    w = Pu[i]; /* w is the last common vertex */
11086|     24|    z = SwitchEdge_Vert1( w );
  ------------------
  |  |  417|     24|#define SwitchEdge_Vert1(u) SwitchEdge[u][0]
  ------------------
11087|     24|    izw = SwitchEdge_IEdge( w );
  ------------------
  |  |  419|     24|#define SwitchEdge_IEdge(u) SwitchEdge[u][1]
  ------------------
11088|       |    /* now extend the blossom if rescap(zw) >= 2 */
11089|     41|    while (w != Vertex_s && rescap( pBNS, z, w, izw ) >= 2)
  ------------------
  |  |  143|     82|#define Vertex_s 0
  ------------------
  |  Branch (11089:12): [True: 26, False: 15]
  |  Branch (11089:29): [True: 17, False: 9]
  ------------------
11090|     17|    {
11091|     17|        i++;
11092|     17|        w = Pu[i];
11093|     17|        z = SwitchEdge_Vert1( w );
  ------------------
  |  |  417|     17|#define SwitchEdge_Vert1(u) SwitchEdge[u][0]
  ------------------
11094|     17|        izw = SwitchEdge_IEdge( w );
  ------------------
  |  |  419|     17|#define SwitchEdge_IEdge(u) SwitchEdge[u][1]
  ------------------
11095|     17|    }
11096|       |    /* w is the base of the new blossom */
11097|       |    /* first follow the path Pu from w to b_u */
11098|     93|    for (i = i - 1; i >= 0; i--)
  ------------------
  |  Branch (11098:21): [True: 69, False: 24]
  ------------------
11099|     69|    {
11100|     69|        z = Pu[i];  /* z is the base of the blossom */
11101|     69|        BasePtr[z] = w;
11102|     69|        BasePtr[prim( z )] = w; /* w is the new base of the blossom */
  ------------------
  |  |  414|     69|#define prim(v) (Vertex)((v)^1)
  ------------------
11103|       |                                /* z and z' may already be part of a blossom that is being
11104|       |                                swallowed into a larger blossom.
11105|       |                                We don't want to change the switch edge in that case.
11106|       |                                */
11107|       |
11108|     69|        if (!TREE_IS_ON_SCANQ( prim( z ) ) /*!IsInScanQ(prim(z)) */)
  ------------------
  |  |  267|     69|#define TREE_IS_ON_SCANQ TREE_IS_S_REACHABLE
  |  |  ------------------
  |  |  |  |  266|     69|#define TREE_IS_S_REACHABLE(X) (Tree[X] >= TREE_IN_2BLOSS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  263|     69|#define TREE_IN_2BLOSS 2  /* in T' and in a blossom, is s-reachable */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (11108:13): [True: 69, False: 0]
  ------------------
11109|     69|        {
11110|     69|            SwitchEdge_Vert1( prim( z ) ) = prim( v );     /* set the switch edge of z' */
  ------------------
  |  |  417|     69|#define SwitchEdge_Vert1(u) SwitchEdge[u][0]
  ------------------
                          SwitchEdge_Vert1( prim( z ) ) = prim( v );     /* set the switch edge of z' */
  ------------------
  |  |  414|     69|#define prim(v) (Vertex)((v)^1)
  ------------------
11111|       |                                                           /* SwitchEdge[prim(z)][1] = prim(u);  */
11112|     69|            SwitchEdge_IEdge( prim( z ) ) = iuv;
  ------------------
  |  |  419|     69|#define SwitchEdge_IEdge(u) SwitchEdge[u][1]
  ------------------
11113|     69|            ( *pQSize )++;
11114|     69|            ScanQ[*pQSize] = prim( z );    /* add z' to ScanQ */
  ------------------
  |  |  414|     69|#define prim(v) (Vertex)((v)^1)
  ------------------
11115|     69|            TREE_MARK( prim( z ), TREE_IN_2BLOSS ); /* mark z' s-reachable */
  ------------------
  |  |  269|     69|#define TREE_MARK(X, MARK)           do{ if( Tree[X] < MARK ) Tree[X]=MARK; }while(0)
  |  |  ------------------
  |  |  |  Branch (269:46): [True: 69, False: 0]
  |  |  |  Branch (269:84): [Folded - Ignored]
  |  |  ------------------
  ------------------
11116|     69|        }
11117|     69|    }
11118|       |    /* Now follow the path Pv */
11119|     68|    for (j = j; j >= 0; j--)
  ------------------
  |  Branch (11119:17): [True: 44, False: 24]
  ------------------
11120|     44|    {
11121|     44|        z = Pv[j]; /* z is the base of the blossom */
11122|     44|        BasePtr[z] = w;
11123|     44|        BasePtr[prim( z )] = w; /* w is the new base of the blossom */
  ------------------
  |  |  414|     44|#define prim(v) (Vertex)((v)^1)
  ------------------
11124|       |                                /* z and z' may already be part of a blossom that is being
11125|       |                                swallowed into a larger blossom.
11126|       |                                We don't want to change the switch edge in that case.
11127|       |                                */
11128|       |
11129|     44|        if (!TREE_IS_ON_SCANQ( prim( z ) ) /*!IsInScanQ(prim(z)) */)
  ------------------
  |  |  267|     44|#define TREE_IS_ON_SCANQ TREE_IS_S_REACHABLE
  |  |  ------------------
  |  |  |  |  266|     44|#define TREE_IS_S_REACHABLE(X) (Tree[X] >= TREE_IN_2BLOSS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  263|     44|#define TREE_IN_2BLOSS 2  /* in T' and in a blossom, is s-reachable */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (11129:13): [True: 41, False: 3]
  ------------------
11130|     41|        {
11131|     41|            SwitchEdge_Vert1( prim( z ) ) = u;     /* set the switch edge of z' */
  ------------------
  |  |  417|     41|#define SwitchEdge_Vert1(u) SwitchEdge[u][0]
  ------------------
11132|       |                                                   /* SwitchEdge[prim(z)][1] = v;  */
11133|     41|            SwitchEdge_IEdge( prim( z ) ) = iuv;
  ------------------
  |  |  419|     41|#define SwitchEdge_IEdge(u) SwitchEdge[u][1]
  ------------------
11134|     41|            ( *pQSize )++;
11135|     41|            ScanQ[*pQSize] = prim( z );    /* add z' to ScanQ */
  ------------------
  |  |  414|     41|#define prim(v) (Vertex)((v)^1)
  ------------------
11136|     41|            TREE_MARK( prim( z ), TREE_IN_2BLOSS ); /* mark z' s-reachable */
  ------------------
  |  |  269|     41|#define TREE_MARK(X, MARK)           do{ if( Tree[X] < MARK ) Tree[X]=MARK; }while(0)
  |  |  ------------------
  |  |  |  Branch (269:46): [True: 41, False: 0]
  |  |  |  Branch (269:84): [Folded - Ignored]
  |  |  ------------------
  ------------------
11137|     41|        }
11138|     44|    }
11139|       |
11140|     24|    if (!TREE_IS_ON_SCANQ( prim( w ) ) /* !IsInScanQ(prim(w))*/)
  ------------------
  |  |  267|     24|#define TREE_IS_ON_SCANQ TREE_IS_S_REACHABLE
  |  |  ------------------
  |  |  |  |  266|     24|#define TREE_IS_S_REACHABLE(X) (Tree[X] >= TREE_IN_2BLOSS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  263|     24|#define TREE_IN_2BLOSS 2  /* in T' and in a blossom, is s-reachable */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (11140:9): [True: 22, False: 2]
  ------------------
11141|     22|    {   /* add w' to the blossom */
11142|     22|        SwitchEdge_Vert1( prim( w ) ) = u;     /* set the switch edge of w' */
  ------------------
  |  |  417|     22|#define SwitchEdge_Vert1(u) SwitchEdge[u][0]
  ------------------
11143|       |                                               /* SwitchEdge[prim(w)][1] = v;  */
11144|     22|        SwitchEdge_IEdge( prim( w ) ) = iuv;
  ------------------
  |  |  419|     22|#define SwitchEdge_IEdge(u) SwitchEdge[u][1]
  ------------------
11145|     22|        ( *pQSize )++;
11146|     22|        ScanQ[*pQSize] = prim( w ); /* add w' to ScanQ */
  ------------------
  |  |  414|     22|#define prim(v) (Vertex)((v)^1)
  ------------------
11147|     22|        TREE_MARK( prim( w ), TREE_IN_2BLOSS );  /* mark w' s-reachable */
  ------------------
  |  |  269|     22|#define TREE_MARK(X, MARK)           do{ if( Tree[X] < MARK ) Tree[X]=MARK; }while(0)
  |  |  ------------------
  |  |  |  Branch (269:46): [True: 22, False: 0]
  |  |  |  Branch (269:84): [Folded - Ignored]
  |  |  ------------------
  ------------------
11148|     22|    }
11149|       |
11150|     24|    return w;
11151|     24|}
PullFlow:
11212|    123|{
11213|    123|    Vertex w, z;
11214|    123|    EdgeIndex iwz;
11215|    123|    int ret = 0;
11216|       |
11217|    123|    w = SwitchEdge_Vert1( y );
  ------------------
  |  |  417|    123|#define SwitchEdge_Vert1(u) SwitchEdge[u][0]
  ------------------
11218|    123|    z = SwitchEdge_Vert2( y );
  ------------------
  |  |  418|    123|#define SwitchEdge_Vert2(u) Get2ndEdgeVertex( pBNS, SwitchEdge[u] )
  ------------------
11219|    123|    iwz = SwitchEdge_IEdge( y );
  ------------------
  |  |  419|    123|#define SwitchEdge_IEdge(u) SwitchEdge[u][1]
  ------------------
11220|    123|    if (bReverse)
  ------------------
  |  Branch (11220:9): [True: 52, False: 71]
  ------------------
11221|     52|    {
11222|       |        /* P consists of a path from x to w, then wz, then a path from z to y.  */
11223|       |        /* z may equal y, in which case z is just PrevPt[y] */
11224|     52|        if (z != y)
  ------------------
  |  Branch (11224:13): [True: 2, False: 50]
  ------------------
11225|      2|        {
11226|      2|            ret = PullFlow( pBNS, SwitchEdge, prim( y ), prim( z ), delta, (S_CHAR) ( 1 - bReverse ), bChangeFlow ); /* augment between z and y */
  ------------------
  |  |  414|      2|#define prim(v) (Vertex)((v)^1)
  ------------------
                          ret = PullFlow( pBNS, SwitchEdge, prim( y ), prim( z ), delta, (S_CHAR) ( 1 - bReverse ), bChangeFlow ); /* augment between z and y */
  ------------------
  |  |  414|      2|#define prim(v) (Vertex)((v)^1)
  ------------------
11227|      2|        }
11228|     52|        if (!IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|     52|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|     52|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|     52|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|     52|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 52, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 52]
  |  |  ------------------
  ------------------
11229|     52|        {
11230|     52|            ret = AugmentEdge( pBNS, w, z, iwz, delta, bReverse, bChangeFlow );
11231|     52|        }
11232|       |        /* Do not augment the complementary path: AugmentEdge( prim(z), prim(w), vert, delta); */
11233|       |        /* w may equal x, in which case there is no need to call PullFlow(x, w) */
11234|     52|        if (w != x && !IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|     37|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|     37|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|     37|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|     37|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 37, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 37]
  |  |  ------------------
  ------------------
  |  Branch (11234:13): [True: 37, False: 15]
  ------------------
11235|     37|        {
11236|     37|            ret = PullFlow( pBNS, SwitchEdge, x, w, delta, bReverse, bChangeFlow ); /* augment between x and w */
11237|     37|        }
11238|     52|    }
11239|     71|    else
11240|     71|    {
11241|       |        /* P consists of a path from x to w, then wz, then a path from z to y.  */
11242|       |        /* w may equal x, in which case there is no need to call PullFlow(x, w) */
11243|     71|        if (w != x && !IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|     54|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|     54|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|     54|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|     54|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 54, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 54]
  |  |  ------------------
  ------------------
  |  Branch (11243:13): [True: 54, False: 17]
  ------------------
11244|     54|        {
11245|     54|            ret = PullFlow( pBNS, SwitchEdge, x, w, delta, bReverse, bChangeFlow ); /* augment between x and w */
11246|     54|        }
11247|     71|        if (!IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|     71|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|     71|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|     71|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|     71|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 71, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 71]
  |  |  ------------------
  ------------------
11248|     71|        {
11249|     71|            ret = AugmentEdge( pBNS, w, z, iwz, delta, bReverse, bChangeFlow );
11250|     71|        }
11251|       |        /* z may equal y, in which case z is just PrevPt[y] */
11252|     71|        if (z != y && !IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|     15|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|     15|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|     15|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|     15|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 15, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 15]
  |  |  ------------------
  ------------------
  |  Branch (11252:13): [True: 15, False: 56]
  ------------------
11253|     15|        {
11254|     15|            ret = PullFlow( pBNS, SwitchEdge, prim( y ), prim( z ), delta, (S_CHAR) ( 1 - bReverse ), bChangeFlow ); /* augment between z and y */
  ------------------
  |  |  414|     15|#define prim(v) (Vertex)((v)^1)
  ------------------
                          ret = PullFlow( pBNS, SwitchEdge, prim( y ), prim( z ), delta, (S_CHAR) ( 1 - bReverse ), bChangeFlow ); /* augment between z and y */
  ------------------
  |  |  414|     15|#define prim(v) (Vertex)((v)^1)
  ------------------
11255|     15|        }
11256|     71|    }
11257|       |
11258|    123|    return ret;
11259|    123|}
FindPathCap:
11283|    123|{
11284|       |
11285|    123|    Vertex w, z, iwz;
11286|    123|    int    cap, delta2;
11287|       |
11288|       |    /*    static int level;
11289|       |    if ( level ++ > 50 )
11290|       |    {
11291|       |    #ifdef _DEBUG
11292|       |    int stop = 1;
11293|       |    #else
11294|       |    ;
11295|       |    #endif
11296|       |    }
11297|       |    */
11298|       |
11299|    123|    w = SwitchEdge_Vert1( y );
  ------------------
  |  |  417|    123|#define SwitchEdge_Vert1(u) SwitchEdge[u][0]
  ------------------
11300|    123|    z = SwitchEdge_Vert2( y ); /* wz is on the path P */
  ------------------
  |  |  418|    123|#define SwitchEdge_Vert2(u) Get2ndEdgeVertex( pBNS, SwitchEdge[u] )
  ------------------
11301|    123|    iwz = SwitchEdge_IEdge( y ); /* edge index */
  ------------------
  |  |  419|    123|#define SwitchEdge_IEdge(u) SwitchEdge[u][1]
  ------------------
11302|       |
11303|       |                                 /* Rescap_mark() detects edges passed 2 times and reduces rescap */
11304|    123|    cap = rescap_mark( pBNS, w, z, iwz );
11305|       |
11306|    123|    if (IS_BNS_ERROR( cap ))
  ------------------
  |  |   95|    123|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|    123|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|    123|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|    123|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 123, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 123]
  |  |  ------------------
  ------------------
11307|      0|    {
11308|       |        /* level --; */
11309|      0|        return cap;
11310|      0|    }
11311|    123|    if (cap < delta)
  ------------------
  |  Branch (11311:9): [True: 27, False: 96]
  ------------------
11312|     27|    {
11313|     27|        delta = cap;
11314|     27|    }
11315|       |    /* P consists of a path from x to w, then wz, then a path from z to y */
11316|    123|    if (w != x)
  ------------------
  |  Branch (11316:9): [True: 91, False: 32]
  ------------------
11317|     91|    {
11318|     91|        delta2 = FindPathCap( pBNS, SwitchEdge, x, w, delta );
11319|     91|        delta = inchi_min( delta2, delta );
  ------------------
  |  |  167|     91|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 8, False: 83]
  |  |  ------------------
  ------------------
11320|     91|    }
11321|    123|    if (z != y)
  ------------------
  |  Branch (11321:9): [True: 17, False: 106]
  ------------------
11322|     17|    {
11323|     17|        delta2 = FindPathCap( pBNS, SwitchEdge, prim( y ), prim( z ), delta );
  ------------------
  |  |  414|     17|#define prim(v) (Vertex)((v)^1)
  ------------------
                      delta2 = FindPathCap( pBNS, SwitchEdge, prim( y ), prim( z ), delta );
  ------------------
  |  |  414|     17|#define prim(v) (Vertex)((v)^1)
  ------------------
11324|     17|        delta = inchi_min( delta2, delta );
  ------------------
  |  |  167|     17|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 4, False: 13]
  |  |  ------------------
  ------------------
11325|     17|    }
11326|       |    /* level --; */
11327|       |
11328|    123|    return delta;
11329|    123|}
MarkRingSystemsAltBns:
11375|   110k|{
11376|   110k|    AT_NUMB   *nStackAtom = NULL;
11377|   110k|    int        nTopStackAtom;
11378|   110k|    AT_NUMB   *nRingStack = NULL;
11379|   110k|    int        nTopRingStack; /* was AT_NUMB */
11380|   110k|    AT_NUMB   *nBondStack = NULL;
11381|   110k|    int        nTopBondStack;
11382|   110k|    AT_NUMB   *nDfsNumber = NULL;
11383|   110k|    AT_NUMB   *nLowNumber = NULL;
11384|   110k|    S_CHAR    *cNeighNumb = NULL;
11385|   110k|    AT_NUMB    nDfs;
11386|   110k|    AT_NUMB    nNumAtInRingSystem;
11387|   110k|    int        i, j, u, w, start, nNumRingSystems, nNumStartChildren;
11388|   110k|    BNS_VERTEX *at = pBNS->vert;
11389|   110k|    BNS_EDGE   *bond = pBNS->edge;
11390|   110k|    int        num_atoms = pBNS->num_atoms;
11391|   110k|    int        num_edges = pBNS->num_bonds;
11392|       |
11393|       |    /* Allocate arrays */
11394|   110k|    nStackAtom = (AT_NUMB *) inchi_malloc( num_atoms * sizeof( nStackAtom[0] ) );
  ------------------
  |  | 1130|   110k|#define inchi_malloc   malloc
  ------------------
11395|   110k|    nRingStack = (AT_NUMB *) inchi_malloc( num_atoms * sizeof( nRingStack[0] ) );
  ------------------
  |  | 1130|   110k|#define inchi_malloc   malloc
  ------------------
11396|   110k|    nDfsNumber = (AT_NUMB *) inchi_malloc( num_atoms * sizeof( nDfsNumber[0] ) );
  ------------------
  |  | 1130|   110k|#define inchi_malloc   malloc
  ------------------
11397|   110k|    nLowNumber = (AT_NUMB *) inchi_malloc( num_atoms * sizeof( nLowNumber[0] ) );
  ------------------
  |  | 1130|   110k|#define inchi_malloc   malloc
  ------------------
11398|   110k|    nBondStack = num_edges ? ( (AT_NUMB *) inchi_malloc( num_edges * sizeof( nBondStack[0] ) ) ) : (AT_NUMB *) ( NULL ); /* special case: no bonds 2006-03 */
  ------------------
  |  | 1130|      8|#define inchi_malloc   malloc
  ------------------
  |  Branch (11398:18): [True: 8, False: 110k]
  ------------------
11399|   110k|    cNeighNumb = (S_CHAR  *) inchi_malloc( num_atoms * sizeof( cNeighNumb[0] ) );
  ------------------
  |  | 1130|   110k|#define inchi_malloc   malloc
  ------------------
11400|       |
11401|       |    /* Check allocation */
11402|   110k|    if (!nStackAtom || !nRingStack || !nDfsNumber || !nLowNumber || !nBondStack && num_edges || !cNeighNumb
  ------------------
  |  Branch (11402:9): [True: 0, False: 110k]
  |  Branch (11402:24): [True: 0, False: 110k]
  |  Branch (11402:39): [True: 0, False: 110k]
  |  Branch (11402:54): [True: 0, False: 110k]
  |  Branch (11402:69): [True: 110k, False: 8]
  |  Branch (11402:84): [True: 0, False: 110k]
  |  Branch (11402:97): [True: 0, False: 110k]
  ------------------
11403|   110k|         )
11404|      0|    {
11405|      0|        nNumRingSystems = CT_OUT_OF_RAM;  /*  program error */ /*   <BRKPT> */
  ------------------
  |  |   49|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
11406|      0|        goto exit_function;
11407|      0|    }
11408|       |
11409|       |    /********************************************
11410|       |    *
11411|       |    * Find Cut-vertices & Blocks
11412|       |    *
11413|       |    *             1\      /5   has 3 blocks (maximal subgraphs that
11414|       |    *  Example:   | >3--4< |   are nonseparable by deleting a single vertex):
11415|       |    *             2/      \6   (1,2,3, has 3 bonds), (3,4, has 1 bond), and (4,5,6, has 3 bonds)
11416|       |    *
11417|       |    *                          Cut-vertices or articulation points are
11418|       |    *                          intersections of the blocks: points 3 and 4.
11419|       |    ********************************************/
11420|       |
11421|       |    /********************************************************
11422|       |
11423|       |    RingSystemAlt are atoms connected by alternating bonds
11424|       |    (as must be indicated in bIsAltBond()):
11425|       |
11426|       |    BOND_ALTERN
11427|       |    BOND_ALT_123
11428|       |    BOND_ALT_13
11429|       |    BOND_ALT_23
11430|       |
11431|       |    Since other bonds may be present, we possibly need
11432|       |    to restart to move to another component
11433|       |    *********************************************************/
11434|       |
11435|   110k|    nNumRingSystems = 0;
11436|   110k|    memset( nDfsNumber, 0, num_atoms * sizeof( nDfsNumber[0] ) );
11437|       |
11438|   222k|    for (start = 0; start < num_atoms; start++)
  ------------------
  |  Branch (11438:21): [True: 112k, False: 110k]
  ------------------
11439|   112k|    {
11440|   112k|        if (nDfsNumber[start])
  ------------------
  |  Branch (11440:13): [True: 0, False: 112k]
  ------------------
11441|      0|        {
11442|      0|            continue;
11443|      0|        }
11444|   112k|        for (i = 0; i < at[start].valenceAltBns; i++)
  ------------------
  |  |11370|   112k|#define valenceAltBns            num_adj_edges
  ------------------
  |  Branch (11444:21): [True: 64, False: 112k]
  ------------------
11445|     64|        {
11446|     64|            if (bond[at[start].iedge[i]].nBondTypeInpAltBns & BT_ALTERN_BOND)
  ------------------
  |  |11358|     64|#define nBondTypeInpAltBns   pass    /* 0=>cannot be stereo at all, 1=>alt or taut non-stereo, 2=>can be stereo */
  ------------------
                          if (bond[at[start].iedge[i]].nBondTypeInpAltBns & BT_ALTERN_BOND)
  ------------------
  |  |11337|     64|#define BT_ALTERN_BOND           1      /* 1-2, possibly stereo */
  ------------------
  |  Branch (11446:17): [True: 0, False: 64]
  ------------------
11447|      0|                goto found_alt;
11448|     64|        }
11449|   112k|        continue;
11450|       |
11451|   112k|    found_alt:
11452|       |
11453|       |        /*  Initiation */
11454|      0|        u = start; /*  start atom */
11455|      0|        nDfs = 0;
11456|      0|        nTopStackAtom = -1;
11457|      0|        nTopRingStack = -1;
11458|      0|        nTopBondStack = -1;
11459|      0|        memset( cNeighNumb, 0, num_atoms * sizeof( cNeighNumb[0] ) );
11460|       |        /*  Push the start atom on the stack */
11461|      0|        nLowNumber[u] = nDfsNumber[u] = ++nDfs;
11462|      0|        nStackAtom[++nTopStackAtom] = (AT_NUMB) u;
11463|      0|        nRingStack[++nTopRingStack] = (AT_NUMB) u;
11464|       |
11465|      0|        nNumStartChildren = 0;
11466|       |
11467|      0|        do
11468|      0|        {
11469|       |            /* advance */
11470|       |            /*while ( (int)at[i=nStackAtom[nTopStackAtom]].valenceAltBns > (j = (int)cNeighNumb[i]) )*/
11471|       |            /* replaced due to missing sequence point */
11472|      0|            while (i = (int) nStackAtom[nTopStackAtom], j = (int) cNeighNumb[i], (int) at[i].valenceAltBns > j)
  ------------------
  |  |11370|      0|#define valenceAltBns            num_adj_edges
  ------------------
  |  Branch (11472:20): [True: 0, False: 0]
  ------------------
11473|      0|            {
11474|      0|                cNeighNumb[i] ++;
11475|      0|                if (!( bond[w = at[i].iedge[j]].nBondTypeInpAltBns & BT_ALT_BOND_MASK ))
  ------------------
  |  |11358|      0|#define nBondTypeInpAltBns   pass    /* 0=>cannot be stereo at all, 1=>alt or taut non-stereo, 2=>can be stereo */
  ------------------
                              if (!( bond[w = at[i].iedge[j]].nBondTypeInpAltBns & BT_ALT_BOND_MASK ))
  ------------------
  |  |11350|      0|#define BT_ALT_BOND_MASK         (BT_ALTERN_BOND|BT_OTHER_ALTERN_BOND)
  |  |  ------------------
  |  |  |  |11337|      0|#define BT_ALTERN_BOND           1      /* 1-2, possibly stereo */
  |  |  ------------------
  |  |               #define BT_ALT_BOND_MASK         (BT_ALTERN_BOND|BT_OTHER_ALTERN_BOND)
  |  |  ------------------
  |  |  |  |11338|      0|#define BT_OTHER_ALTERN_BOND     2      /* 1-3, 2-3, 1-2-3 alternating non-stereo non-taut bonds */
  |  |  ------------------
  ------------------
  |  Branch (11475:21): [True: 0, False: 0]
  ------------------
11476|      0|                {
11477|      0|                    continue;
11478|      0|                }
11479|      0|                u = (int) ( bond[at[i].iedge[j]].neighbor12 ^ i );
11480|      0|                if (!nDfsNumber[u])
  ------------------
  |  Branch (11480:21): [True: 0, False: 0]
  ------------------
11481|      0|                {
11482|       |                    /* tree edge, 1st visit -- advance */
11483|      0|                    nStackAtom[++nTopStackAtom] = (AT_NUMB) u;
11484|      0|                    nRingStack[++nTopRingStack] = (AT_NUMB) u;
11485|      0|                    nBondStack[++nTopBondStack] = (AT_NUMB) w;
11486|      0|                    nLowNumber[u] = nDfsNumber[u] = ++nDfs;
11487|      0|                    nNumStartChildren += ( i == start );
11488|      0|                }
11489|      0|                else
11490|      0|                {
11491|      0|                    if (!nTopStackAtom || u != (int) nStackAtom[nTopStackAtom - 1])
  ------------------
  |  Branch (11491:25): [True: 0, False: 0]
  |  Branch (11491:43): [True: 0, False: 0]
  ------------------
11492|      0|                    { /*  may comment out ? */
11493|       |                      /* back edge: u is not a predecessor of i */
11494|      0|                        if (nDfsNumber[u] < nDfsNumber[i])
  ------------------
  |  Branch (11494:29): [True: 0, False: 0]
  ------------------
11495|      0|                        {
11496|       |                            /* Back edge, 1st visit: u is ancestor of i. Save and compare */
11497|      0|                            nBondStack[++nTopBondStack] = (AT_NUMB) w;
11498|      0|                            if (nLowNumber[i] > nDfsNumber[u])
  ------------------
  |  Branch (11498:33): [True: 0, False: 0]
  ------------------
11499|      0|                            {
11500|      0|                                nLowNumber[i] = nDfsNumber[u];
11501|      0|                            }
11502|      0|                        }
11503|      0|                    }
11504|      0|                }
11505|      0|            }
11506|      0|            cNeighNumb[i] = 0;
11507|       |
11508|       |            /* Back up */
11509|      0|            if (i != start)
  ------------------
  |  Branch (11509:17): [True: 0, False: 0]
  ------------------
11510|      0|            {
11511|      0|                u = (int) nStackAtom[nTopStackAtom - 1]; /* predecessor of i */
11512|      0|                if (nLowNumber[i] >= nDfsNumber[u])
  ------------------
  |  Branch (11512:21): [True: 0, False: 0]
  ------------------
11513|      0|                {
11514|       |                    /* Output the block; the block was entered through its first bond u->i */
11515|      0|                    nNumRingSystems++;
11516|       |                    /*at[u].nBlockSystemAltBns = nNumRingSystems;*/ /* mark the atom */
11517|      0|                    nNumAtInRingSystem = 1;
11518|       |                    /*
11519|       |                    if ( u != start || nNumStartChildren > 1 ) {
11520|       |                    at[u].bCutVertexAltBns += 1;  // mark cut-vertex (articulation point)
11521|       |                    }
11522|       |                    */
11523|      0|                    while (nTopRingStack >= 0)
  ------------------
  |  Branch (11523:28): [True: 0, False: 0]
  ------------------
11524|      0|                    {
11525|      0|                        j = nRingStack[nTopRingStack--];
11526|       |                        /*at[j].nBlockSystemAltBns = nNumRingSystems;*/ /*  mark the atom */
11527|      0|                        nNumAtInRingSystem++;
11528|      0|                        if (i == j)
  ------------------
  |  Branch (11528:29): [True: 0, False: 0]
  ------------------
11529|      0|                        {
11530|      0|                            break;
11531|      0|                        }
11532|      0|                    }
11533|      0|                    while (nTopBondStack >= 0)
  ------------------
  |  Branch (11533:28): [True: 0, False: 0]
  ------------------
11534|      0|                    {
11535|      0|                        w = nBondStack[nTopBondStack--];
11536|      0|                        bond[w].nBlockNumberAltBns = nNumRingSystems; /*  mark the bond */
  ------------------
  |  |11356|      0|#define nBlockNumberAltBns   flow   /* internal variable of the DFS traversal: mark traversed bonds */
  ------------------
11537|      0|                        bond[w].nNumAtInBlockAltBns = nNumAtInRingSystem;
  ------------------
  |  |11357|      0|#define nNumAtInBlockAltBns  cap
  ------------------
11538|      0|                        if (i == bond[w].neighbor1 && u == ( i ^ bond[w].neighbor12 ) ||
  ------------------
  |  Branch (11538:29): [True: 0, False: 0]
  |  Branch (11538:55): [True: 0, False: 0]
  ------------------
11539|      0|                             u == bond[w].neighbor1 && i == ( u ^ bond[w].neighbor12 ))
  ------------------
  |  Branch (11539:30): [True: 0, False: 0]
  |  Branch (11539:56): [True: 0, False: 0]
  ------------------
11540|      0|                        {
11541|      0|                            break;
11542|      0|                        }
11543|      0|                    }
11544|      0|                }
11545|      0|                else
11546|      0|                {
11547|      0|                    if (nLowNumber[u] > nLowNumber[i])
  ------------------
  |  Branch (11547:25): [True: 0, False: 0]
  ------------------
11548|      0|                    {
11549|       |                        /* inherit */
11550|      0|                        nLowNumber[u] = nLowNumber[i];
11551|      0|                    }
11552|      0|                }
11553|      0|            }
11554|      0|        } while (--nTopStackAtom >= 0);
  ------------------
  |  Branch (11554:18): [True: 0, False: 0]
  ------------------
11555|      0|    }
11556|       |
11557|       |#if ( BNS_MARK_ONLY_BLOCKS != 1 )  /* { */
11558|       |
11559|       |    /********************************************
11560|       |    *
11561|       |    * Find Ring Systems
11562|       |    * Including chain atoms X: A-X-B, where the bonds (of any kind) are bridges.
11563|       |    *
11564|       |    ********************************************/
11565|       |
11566|       |    /*  Initiation */
11567|       |    nNumRingSystems = 0;
11568|       |    for (start = 0; start < num_atoms; start++)
11569|       |    {
11570|       |        if (at[start].nRingSystemAltBns)
11571|       |        {
11572|       |            continue;
11573|       |        }
11574|       |        for (i = 0; i < at[start].valenceAltBns; i++)
11575|       |        {
11576|       |            if (bond[at[start].iedge[i]].nBondTypeInpAltBns & BT_ALT_BOND_MASK)
11577|       |            {
11578|       |                goto found_alt2;
11579|       |            }
11580|       |        }
11581|       |        continue;
11582|       |
11583|       |    found_alt2:
11584|       |        u = start; /*  start atom */
11585|       |        nDfs = 0;
11586|       |        nTopStackAtom = -1;
11587|       |        nTopRingStack = -1;
11588|       |        memset( nDfsNumber, 0, num_atoms * sizeof( nDfsNumber[0] ) );
11589|       |        memset( cNeighNumb, 0, num_atoms * sizeof( cNeighNumb[0] ) );
11590|       |        /*  push the start atom on the stack */
11591|       |        nLowNumber[u] = nDfsNumber[u] = ++nDfs;
11592|       |        nStackAtom[++nTopStackAtom] = (AT_NUMB) u;
11593|       |        nRingStack[++nTopRingStack] = (AT_NUMB) u;
11594|       |
11595|       |        do
11596|       |        {
11597|       |            /* advance */
11598|       |        advance_ring:
11599|       |            /*if ( (int)at[i=nStackAtom[nTopStackAtom]].valenceAltBns > (j = (int)cNeighNumb[i]) )*/
11600|       |            /* replaced due to missing sequence point */
11601|       |            if (i = (int) nStackAtom[nTopStackAtom], j = (int) cNeighNumb[i], (int) at[i].valenceAltBns > j)
11602|       |            {
11603|       |                cNeighNumb[i] ++;
11604|       |                if (!( bond[at[i].iedge[j]].nBondTypeInpAltBns & BT_ALTERN_BOND ))
11605|       |                {
11606|       |                    goto advance_ring;
11607|       |                }
11608|       |                u = (int) ( bond[at[i].iedge[j]].neighbor12 ^ i );
11609|       |                if (!nDfsNumber[u])
11610|       |                {
11611|       |                    /* tree edge, 1st visit -- advance */
11612|       |                    nStackAtom[++nTopStackAtom] = (AT_NUMB) u;
11613|       |                    nRingStack[++nTopRingStack] = (AT_NUMB) u;
11614|       |                    nLowNumber[u] = nDfsNumber[u] = ++nDfs;
11615|       |                }
11616|       |                else
11617|       |                {
11618|       |                    if (!nTopStackAtom || u != (int) nStackAtom[nTopStackAtom - 1])
11619|       |                    {
11620|       |                        /* back edge: u is not a predecessor of i */
11621|       |                        if (nDfsNumber[u] < nDfsNumber[i])
11622|       |                        {
11623|       |                            /* Back edge, 1st visit: u is ancestor of i. Compare */
11624|       |                            if (nLowNumber[i] > nDfsNumber[u])
11625|       |                            {
11626|       |                                nLowNumber[i] = nDfsNumber[u];
11627|       |                            }
11628|       |                        }
11629|       |                    }
11630|       |                }
11631|       |                goto advance_ring;
11632|       |            }
11633|       |            else
11634|       |            {
11635|       |                cNeighNumb[i] = 0;
11636|       |            }
11637|       |
11638|       |            /* Back up */
11639|       |            if (nDfsNumber[i] == nLowNumber[i])
11640|       |            {
11641|       |                /*  Found a ring system */
11642|       |                nNumRingSystems++;
11643|       |
11644|       |                /*  Unwind nRingStack[] down to i */
11645|       |
11646|       |                /*  Count atoms in a ring system */
11647|       |                for (nNumAtInRingSystem = 0, j = nTopRingStack; 0 <= j; j--)
11648|       |                {
11649|       |                    nNumAtInRingSystem++;
11650|       |                    if (i == (int) nRingStack[j])
11651|       |                    {
11652|       |                        break;
11653|       |                    }
11654|       |                }
11655|       |                while (nTopRingStack >= 0)
11656|       |                {
11657|       |                    j = (int) nRingStack[nTopRingStack--];
11658|       |                    at[j].nRingSystemAltBns = (AT_NUMB) nNumRingSystems; /*  ring system id */
11659|       |                    at[j].nNumAtInRingSystemAltBns = nNumAtInRingSystem;
11660|       |                    if (i == j)
11661|       |                    {
11662|       |                        /*  Reached atom on the top of nStackAtom[] stack  */
11663|       |                        break;
11664|       |                    }
11665|       |                }
11666|       |            }
11667|       |            else
11668|       |            {
11669|       |                if (nTopStackAtom > 0)
11670|       |                {
11671|       |                    j = (int) nStackAtom[nTopStackAtom - 1];
11672|       |                    /* inherit nLowNumber */
11673|       |                    if (nLowNumber[j] > nLowNumber[i])
11674|       |                    {
11675|       |                        nLowNumber[j] = nLowNumber[i];
11676|       |                    }
11677|       |                }
11678|       |            }
11679|       |        } while (--nTopStackAtom >= 0);
11680|       |    }
11681|       |
11682|       |#endif /* }  BNS_MARK_ONLY_BLOCKS != 1 */
11683|       |
11684|   110k|exit_function:
11685|   110k|    if (nStackAtom)
  ------------------
  |  Branch (11685:9): [True: 110k, False: 0]
  ------------------
11686|   110k|    {
11687|   110k|        inchi_free( nStackAtom );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
11688|   110k|    }
11689|   110k|    if (nRingStack)
  ------------------
  |  Branch (11689:9): [True: 110k, False: 0]
  ------------------
11690|   110k|    {
11691|   110k|        inchi_free( nRingStack );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
11692|   110k|    }
11693|   110k|    if (nDfsNumber)
  ------------------
  |  Branch (11693:9): [True: 110k, False: 0]
  ------------------
11694|   110k|    {
11695|   110k|        inchi_free( nDfsNumber );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
11696|   110k|    }
11697|   110k|    if (nLowNumber)
  ------------------
  |  Branch (11697:9): [True: 110k, False: 0]
  ------------------
11698|   110k|    {
11699|   110k|        inchi_free( nLowNumber );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
11700|   110k|    }
11701|   110k|    if (nBondStack)
  ------------------
  |  Branch (11701:9): [True: 8, False: 110k]
  ------------------
11702|      8|    {
11703|      8|        inchi_free( nBondStack );
  ------------------
  |  | 1136|      8|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 8, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
11704|      8|    }
11705|   110k|    if (cNeighNumb)
  ------------------
  |  Branch (11705:9): [True: 110k, False: 0]
  ------------------
11706|   110k|    {
11707|   110k|        inchi_free( cNeighNumb );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
11708|   110k|    }
11709|       |
11710|   110k|    return nNumRingSystems;
11711|   110k|}
ReInitBnStructForAltBns:
11719|   110k|{
11720|   110k|    Vertex v, v2;
11721|   110k|    int ret, bond_type, num_to_test, j;
11722|   110k|    BNS_EDGE   *pBond;
11723|   110k|    BNS_VERTEX *pAtom;
11724|       |
11725|       |    /* Strip all t-groups and c-groups */
11726|   110k|    num_to_test = 0;
11727|   110k|    if (bUnknAltAsNoStereo)
  ------------------
  |  Branch (11727:9): [True: 0, False: 110k]
  ------------------
11728|      0|    {
11729|      0|        for (j = 0; j < pBNS->num_edges; j++)
  ------------------
  |  Branch (11729:21): [True: 0, False: 0]
  ------------------
11730|      0|        {
11731|      0|            pBNS->edge[j].pass = 0;
11732|      0|        }
11733|      0|    }
11734|       |
11735|   110k|    ret = ReInitBnStruct( pBNS, at, num_atoms, 0 );
11736|       |
11737|   110k|    if (ret || pBNS->num_atoms != num_atoms || pBNS->num_vertices != num_atoms || pBNS->num_bonds != pBNS->num_edges)
  ------------------
  |  Branch (11737:9): [True: 0, False: 110k]
  |  Branch (11737:16): [True: 0, False: 110k]
  |  Branch (11737:48): [True: 0, False: 110k]
  |  Branch (11737:83): [True: 0, False: 110k]
  ------------------
11738|      0|    {
11739|      0|        ret = BNS_REINIT_ERR;
  ------------------
  |  |   88|      0|#define BNS_REINIT_ERR     (BNS_ERR + 12) /*(-9987)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
11740|      0|        goto exit_function;
11741|      0|    }
11742|       |
11743|       |    /* Eliminate bonds and fix st-caps */
11744|   222k|    for (v = 0; v < num_atoms; v++)
  ------------------
  |  Branch (11744:17): [True: 112k, False: 110k]
  ------------------
11745|   112k|    {
11746|   112k|        pAtom = pBNS->vert + v;
11747|   112k|        for (j = 0; j < pAtom->valenceAltBns; j++)
  ------------------
  |  |11370|   112k|#define valenceAltBns            num_adj_edges
  ------------------
  |  Branch (11747:21): [True: 64, False: 112k]
  ------------------
11748|     64|        {
11749|     64|            pBond = pBNS->edge + pAtom->iedge[j];
11750|     64|            if (pBond->neighbor1 == v)
  ------------------
  |  Branch (11750:17): [True: 32, False: 32]
  ------------------
11751|     32|            {
11752|     32|                bond_type = ( at[v].bond_type[j] & BOND_TYPE_MASK );
  ------------------
  |  |  217|     32|#define BOND_TYPE_MASK        0x0f
  ------------------
11753|     32|                v2 = pBond->neighbor12 ^ v;
11754|     32|                if (at[v].endpoint || at[v2].endpoint)
  ------------------
  |  Branch (11754:21): [True: 4, False: 28]
  |  Branch (11754:39): [True: 4, False: 24]
  ------------------
11755|      8|                {
11756|      8|                    bond_type = 0; /* any bond to an endpoint considered non-stereogenic */
11757|      8|                }
11758|       |#if ( FIX_EITHER_DB_AS_NONSTEREO == 1 )
11759|       |                if (bUnknAltAsNoStereo)
11760|       |                {
11761|       |                    if (bond_type == BOND_ALTERN && at[v].bond_stereo[j] == STEREO_DBLE_EITHER)
11762|       |                    {
11763|       |                        bond_type = 0; /* treat unknown (Either) ALT bond as non-stereo */
11764|       |                    }
11765|       |                }
11766|       |#endif
11767|     32|                switch (bond_type)
11768|     32|                {
11769|       |
11770|      0|                    case BOND_ALTERN:
  ------------------
  |  |  208|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   63|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (11770:21): [True: 0, False: 32]
  ------------------
11771|      0|                        pBond->nBondTypeInpAltBns = BT_ALTERN_BOND;
  ------------------
  |  |11358|      0|#define nBondTypeInpAltBns   pass    /* 0=>cannot be stereo at all, 1=>alt or taut non-stereo, 2=>can be stereo */
  ------------------
                                      pBond->nBondTypeInpAltBns = BT_ALTERN_BOND;
  ------------------
  |  |11337|      0|#define BT_ALTERN_BOND           1      /* 1-2, possibly stereo */
  ------------------
11772|      0|                        num_to_test++;
11773|      0|                        break;
11774|       |
11775|      0|                    case BOND_ALT_123:
  ------------------
  |  |  210|      0|#define BOND_ALT_123             5   /* single/double/triple                */
  ------------------
  |  Branch (11775:21): [True: 0, False: 32]
  ------------------
11776|      0|                    case BOND_ALT_13:
  ------------------
  |  |  211|      0|#define BOND_ALT_13              6   /* single/triple                       */
  ------------------
  |  Branch (11776:21): [True: 0, False: 32]
  ------------------
11777|      0|                    case BOND_ALT_23:
  ------------------
  |  |  212|      0|#define BOND_ALT_23              7   /* double/triple                       */
  ------------------
  |  Branch (11777:21): [True: 0, False: 32]
  ------------------
11778|      0|                        pBond->nBondTypeInpAltBns = BT_OTHER_ALTERN_BOND;
  ------------------
  |  |11358|      0|#define nBondTypeInpAltBns   pass    /* 0=>cannot be stereo at all, 1=>alt or taut non-stereo, 2=>can be stereo */
  ------------------
                                      pBond->nBondTypeInpAltBns = BT_OTHER_ALTERN_BOND;
  ------------------
  |  |11338|      0|#define BT_OTHER_ALTERN_BOND     2      /* 1-3, 2-3, 1-2-3 alternating non-stereo non-taut bonds */
  ------------------
11779|      0|                        break;
11780|       |
11781|      0|                    case BOND_TAUTOM:
  ------------------
  |  |  213|      0|#define BOND_TAUTOM              8
  ------------------
  |  Branch (11781:21): [True: 0, False: 32]
  ------------------
11782|      0|                        pBond->nBondTypeInpAltBns = BT_TAUTOM_BOND;
  ------------------
  |  |11358|      0|#define nBondTypeInpAltBns   pass    /* 0=>cannot be stereo at all, 1=>alt or taut non-stereo, 2=>can be stereo */
  ------------------
                                      pBond->nBondTypeInpAltBns = BT_TAUTOM_BOND;
  ------------------
  |  |11342|      0|#define BT_TAUTOM_BOND           8
  ------------------
11783|      0|                        break;
11784|       |
11785|      0|                    case BOND_ALT12NS:
  ------------------
  |  |  214|      0|#define BOND_ALT12NS             9
  ------------------
  |  Branch (11785:21): [True: 0, False: 32]
  ------------------
11786|      0|                        pBond->nBondTypeInpAltBns = BT_ALTERN_NS_BOND;
  ------------------
  |  |11358|      0|#define nBondTypeInpAltBns   pass    /* 0=>cannot be stereo at all, 1=>alt or taut non-stereo, 2=>can be stereo */
  ------------------
                                      pBond->nBondTypeInpAltBns = BT_ALTERN_NS_BOND;
  ------------------
  |  |11340|      0|#define BT_ALTERN_NS_BOND        4
  ------------------
11787|      0|                        break;
11788|       |
11789|      8|                    case 0:
  ------------------
  |  Branch (11789:21): [True: 8, False: 24]
  ------------------
11790|     24|                    case BOND_SINGLE:
  ------------------
  |  |  205|     24|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   60|     24|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (11790:21): [True: 16, False: 16]
  ------------------
11791|     32|                    case BOND_DOUBLE:
  ------------------
  |  |  206|     32|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   61|     32|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (11791:21): [True: 8, False: 24]
  ------------------
11792|     32|                    case BOND_TRIPLE:
  ------------------
  |  |  207|     32|#define BOND_TRIPLE BOND_TYPE_TRIPLE  /* 3                                  */
  |  |  ------------------
  |  |  |  |   62|     32|#define BOND_TYPE_TRIPLE    3
  |  |  ------------------
  ------------------
  |  Branch (11792:21): [True: 0, False: 32]
  ------------------
11793|     32|                        pBond->nBondTypeInpAltBns = BT_IGNORE_BOND;
  ------------------
  |  |11358|     32|#define nBondTypeInpAltBns   pass    /* 0=>cannot be stereo at all, 1=>alt or taut non-stereo, 2=>can be stereo */
  ------------------
                                      pBond->nBondTypeInpAltBns = BT_IGNORE_BOND;
  ------------------
  |  |11346|     32|#define BT_IGNORE_BOND           0
  ------------------
11794|     32|                        break;
11795|       |
11796|      0|                    default:
  ------------------
  |  Branch (11796:21): [True: 0, False: 32]
  ------------------
11797|      0|                        pBond->nBondTypeInpAltBns = BT_IGNORE_BOND;
  ------------------
  |  |11358|      0|#define nBondTypeInpAltBns   pass    /* 0=>cannot be stereo at all, 1=>alt or taut non-stereo, 2=>can be stereo */
  ------------------
                                      pBond->nBondTypeInpAltBns = BT_IGNORE_BOND;
  ------------------
  |  |11346|      0|#define BT_IGNORE_BOND           0
  ------------------
11798|      0|                        break;
11799|     32|                }
11800|     32|                pBond->nBondNonStereoAltBns =
  ------------------
  |  |11359|     32|#define nBondNonStereoAltBns cap     /* 1=>found to be non-stereogenic although BondTypeInp=2; 0=>as in BondTypeInp */
  ------------------
11801|     32|                    pBond->nBlockNumberAltBns =
  ------------------
  |  |11356|     32|#define nBlockNumberAltBns   flow   /* internal variable of the DFS traversal: mark traversed bonds */
  ------------------
11802|     32|                    pBond->nNumAtInBlockAltBns = 0;
  ------------------
  |  |11357|     32|#define nNumAtInBlockAltBns  cap
  ------------------
11803|       |
11804|     32|#if ( RESET_EDGE_FORBIDDEN_MASK == 1 )
11805|     32|                pBond->forbidden &= pBNS->edge_forbidden_mask;
11806|     32|#endif
11807|     32|            }
11808|     64|        }
11809|   112k|        pAtom->bCutVertexAltBns =
  ------------------
  |  |11363|   112k|#define bCutVertexAltBns         st_edge.cap0  /* cut-vertex flag */
  ------------------
11810|   112k|            pAtom->nRingSystemAltBns =
  ------------------
  |  |11364|   112k|#define nRingSystemAltBns        st_edge.cap   /* ordering number of a ring system */
  ------------------
11811|   112k|            pAtom->nNumAtInRingSystemAltBns =
  ------------------
  |  |11365|   112k|#define nNumAtInRingSystemAltBns st_edge.flow0 /* number of vertices in a ring system */
  ------------------
11812|   112k|            pAtom->nBlockSystemAltBns = 0;
  ------------------
  |  |11366|   112k|#define nBlockSystemAltBns       st_edge.flow  /* result of the DFS traversal: even cirquit must be within one block */
  ------------------
11813|   112k|    }
11814|       |
11815|   110k|    return num_to_test;
11816|       |
11817|      0|exit_function:
11818|       |
11819|      0|    return ret;
11820|   110k|}
MarkNonStereoAltBns:
11828|   110k|{
11829|   110k|    int       num_bonds = pBNS->num_bonds;
11830|   110k|    int       ret;
11831|   110k|    int       ibond, ib1, ib2;
11832|   110k|    BNS_EDGE *pBond;
11833|   110k|    Vertex    iat1, iat2;
11834|       |
11835|   110k|    ret = 0;
11836|       |
11837|   110k|    if (pBNS->num_atoms != num_atoms || pBNS->num_vertices != num_atoms || pBNS->num_bonds != pBNS->num_edges)
  ------------------
  |  Branch (11837:9): [True: 0, False: 110k]
  |  Branch (11837:41): [True: 0, False: 110k]
  |  Branch (11837:76): [True: 0, False: 110k]
  ------------------
11838|      0|    {
11839|      0|        ret = BNS_REINIT_ERR;
  ------------------
  |  |   88|      0|#define BNS_REINIT_ERR     (BNS_ERR + 12) /*(-9987)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
11840|      0|        goto exit_function;
11841|      0|    }
11842|   110k|    if (bUnknAltAsNoStereo)
  ------------------
  |  Branch (11842:9): [True: 0, False: 110k]
  ------------------
11843|      0|    {
11844|      0|        for (ibond = 0; ibond < num_bonds; ibond++)
  ------------------
  |  Branch (11844:25): [True: 0, False: 0]
  ------------------
11845|      0|        {
11846|      0|            pBond = pBNS->edge + ibond;
11847|      0|            if (pBond->nBondTypeInpAltBns != BT_ALTERN_BOND && pBond->nBondTypeInpAltBns != BT_IGNORE_BOND)
  ------------------
  |  |11358|      0|#define nBondTypeInpAltBns   pass    /* 0=>cannot be stereo at all, 1=>alt or taut non-stereo, 2=>can be stereo */
  ------------------
                          if (pBond->nBondTypeInpAltBns != BT_ALTERN_BOND && pBond->nBondTypeInpAltBns != BT_IGNORE_BOND)
  ------------------
  |  |11337|      0|#define BT_ALTERN_BOND           1      /* 1-2, possibly stereo */
  ------------------
                          if (pBond->nBondTypeInpAltBns != BT_ALTERN_BOND && pBond->nBondTypeInpAltBns != BT_IGNORE_BOND)
  ------------------
  |  |11358|      0|#define nBondTypeInpAltBns   pass    /* 0=>cannot be stereo at all, 1=>alt or taut non-stereo, 2=>can be stereo */
  ------------------
                          if (pBond->nBondTypeInpAltBns != BT_ALTERN_BOND && pBond->nBondTypeInpAltBns != BT_IGNORE_BOND)
  ------------------
  |  |11346|      0|#define BT_IGNORE_BOND           0
  ------------------
  |  Branch (11847:17): [True: 0, False: 0]
  |  Branch (11847:64): [True: 0, False: 0]
  ------------------
11848|      0|            {
11849|      0|                continue;
11850|      0|            }
11851|      0|            iat1 = pBond->neighbor1;
11852|      0|            iat2 = pBond->neighbor12 ^ iat1;
11853|      0|            ib1 = pBond->neigh_ord[0];
11854|      0|            ib2 = pBond->neigh_ord[1];
11855|      0|            if ( /* alt bond non-adjacent to a taut. endpoint: */
11856|      0|                ( pBond->nBondTypeInpAltBns == BT_ALTERN_BOND &&
  ------------------
  |  |11358|      0|#define nBondTypeInpAltBns   pass    /* 0=>cannot be stereo at all, 1=>alt or taut non-stereo, 2=>can be stereo */
  ------------------
                              ( pBond->nBondTypeInpAltBns == BT_ALTERN_BOND &&
  ------------------
  |  |11337|      0|#define BT_ALTERN_BOND           1      /* 1-2, possibly stereo */
  ------------------
  |  Branch (11856:19): [True: 0, False: 0]
  ------------------
11857|      0|                  pBond->nNumAtInBlockAltBns <= 3 )  /* non-ring bond */ ||
  ------------------
  |  |11357|      0|#define nNumAtInBlockAltBns  cap
  ------------------
  |  Branch (11857:19): [True: 0, False: 0]
  ------------------
11858|       |                 /* alt bond adjacent to a taut. endpoint: */
11859|      0|                  ( pBond->nBondTypeInpAltBns == BT_IGNORE_BOND &&
  ------------------
  |  |11358|      0|#define nBondTypeInpAltBns   pass    /* 0=>cannot be stereo at all, 1=>alt or taut non-stereo, 2=>can be stereo */
  ------------------
                                ( pBond->nBondTypeInpAltBns == BT_IGNORE_BOND &&
  ------------------
  |  |11346|      0|#define BT_IGNORE_BOND           0
  ------------------
  |  Branch (11859:21): [True: 0, False: 0]
  ------------------
11860|      0|                 ( at[iat1].bond_type[ib1] & BOND_TYPE_MASK ) == BOND_ALTERN )
  ------------------
  |  |  217|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
                               ( at[iat1].bond_type[ib1] & BOND_TYPE_MASK ) == BOND_ALTERN )
  ------------------
  |  |  208|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   63|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (11860:18): [True: 0, False: 0]
  ------------------
11861|      0|                 )
11862|      0|            {
11863|      0|                if (( at[iat1].bond_type[ib1] & BOND_TYPE_MASK ) == BOND_ALTERN)
  ------------------
  |  |  217|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
                              if (( at[iat1].bond_type[ib1] & BOND_TYPE_MASK ) == BOND_ALTERN)
  ------------------
  |  |  208|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   63|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (11863:21): [True: 0, False: 0]
  ------------------
11864|      0|                {
11865|       |                    /* bond_type = BOND_ALT12NS; */
11866|      0|                    at[iat1].bond_stereo[ib1] =
11867|      0|                        at[iat2].bond_stereo[ib2] = STEREO_DBLE_EITHER;
  ------------------
  |  |   68|      0|#define STEREO_DBLE_EITHER   3
  ------------------
11868|      0|                    ret++;
11869|      0|                }
11870|      0|            }
11871|      0|        }
11872|      0|    }
11873|   110k|    else
11874|   110k|    {
11875|   110k|        for (ibond = 0; ibond < num_bonds; ibond++)
  ------------------
  |  Branch (11875:25): [True: 32, False: 110k]
  ------------------
11876|     32|        {
11877|     32|            pBond = pBNS->edge + ibond;
11878|     32|            if (pBond->nBondTypeInpAltBns != BT_ALTERN_BOND && pBond->nBondTypeInpAltBns != BT_IGNORE_BOND)
  ------------------
  |  |11358|     32|#define nBondTypeInpAltBns   pass    /* 0=>cannot be stereo at all, 1=>alt or taut non-stereo, 2=>can be stereo */
  ------------------
                          if (pBond->nBondTypeInpAltBns != BT_ALTERN_BOND && pBond->nBondTypeInpAltBns != BT_IGNORE_BOND)
  ------------------
  |  |11337|     64|#define BT_ALTERN_BOND           1      /* 1-2, possibly stereo */
  ------------------
                          if (pBond->nBondTypeInpAltBns != BT_ALTERN_BOND && pBond->nBondTypeInpAltBns != BT_IGNORE_BOND)
  ------------------
  |  |11358|     32|#define nBondTypeInpAltBns   pass    /* 0=>cannot be stereo at all, 1=>alt or taut non-stereo, 2=>can be stereo */
  ------------------
                          if (pBond->nBondTypeInpAltBns != BT_ALTERN_BOND && pBond->nBondTypeInpAltBns != BT_IGNORE_BOND)
  ------------------
  |  |11346|     32|#define BT_IGNORE_BOND           0
  ------------------
  |  Branch (11878:17): [True: 32, False: 0]
  |  Branch (11878:64): [True: 0, False: 32]
  ------------------
11879|      0|            {
11880|      0|                continue;
11881|      0|            }
11882|     32|            iat1 = pBond->neighbor1;
11883|     32|            iat2 = pBond->neighbor12 ^ iat1;
11884|     32|            ib1 = pBond->neigh_ord[0];
11885|     32|            ib2 = pBond->neigh_ord[1];
11886|     32|            if ( /* alt bond non-adjacent to a taut. endpoint: */
11887|     32|                ( pBond->nBondTypeInpAltBns == BT_ALTERN_BOND &&
  ------------------
  |  |11358|     32|#define nBondTypeInpAltBns   pass    /* 0=>cannot be stereo at all, 1=>alt or taut non-stereo, 2=>can be stereo */
  ------------------
                              ( pBond->nBondTypeInpAltBns == BT_ALTERN_BOND &&
  ------------------
  |  |11337|     64|#define BT_ALTERN_BOND           1      /* 1-2, possibly stereo */
  ------------------
  |  Branch (11887:19): [True: 0, False: 32]
  ------------------
11888|     32|                  pBond->nNumAtInBlockAltBns <= 3 ) /* non-ring bond */ ||
  ------------------
  |  |11357|      0|#define nNumAtInBlockAltBns  cap
  ------------------
  |  Branch (11888:19): [True: 0, False: 0]
  ------------------
11889|       |                 /* alt bond adjacent to a taut. endpoint: */
11890|     32|                  ( pBond->nBondTypeInpAltBns == BT_IGNORE_BOND &&
  ------------------
  |  |11358|     32|#define nBondTypeInpAltBns   pass    /* 0=>cannot be stereo at all, 1=>alt or taut non-stereo, 2=>can be stereo */
  ------------------
                                ( pBond->nBondTypeInpAltBns == BT_IGNORE_BOND &&
  ------------------
  |  |11346|     64|#define BT_IGNORE_BOND           0
  ------------------
  |  Branch (11890:21): [True: 32, False: 0]
  ------------------
11891|     32|                 ( at[iat1].bond_type[ib1] & BOND_TYPE_MASK ) == BOND_ALTERN )
  ------------------
  |  |  217|     32|#define BOND_TYPE_MASK        0x0f
  ------------------
                               ( at[iat1].bond_type[ib1] & BOND_TYPE_MASK ) == BOND_ALTERN )
  ------------------
  |  |  208|     32|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   63|     32|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (11891:18): [True: 0, False: 32]
  ------------------
11892|     32|                 )
11893|      0|            {
11894|      0|                at[iat1].bond_type[ib1] =
11895|      0|                    at[iat2].bond_type[ib2] = BOND_ALT12NS;
  ------------------
  |  |  214|      0|#define BOND_ALT12NS             9
  ------------------
11896|      0|                ret++;
11897|      0|            }
11898|     32|        }
11899|   110k|    }
11900|       |
11901|   110k|exit_function:
11902|       |
11903|   110k|    return ret;
11904|   110k|}
bHasChargedNeighbor:
11921|      1|{
11922|      1|    int i;
11923|      1|    for (i = 0; i < at[iat].valence; i++)
  ------------------
  |  Branch (11923:17): [True: 1, False: 0]
  ------------------
11924|      1|    {
11925|      1|        if (at[(int) at[iat].neighbor[i]].charge)
  ------------------
  |  Branch (11925:13): [True: 1, False: 0]
  ------------------
11926|      1|        {
11927|      1|            return 1;
11928|      1|        }
11929|      1|    }
11930|       |
11931|      0|    return 0;
11932|      1|}
AddRemoveProtonsRestr:
11979|      1|{
11980|      1|    int i, j, ret = 0;
11981|      1|    int nAtTypeTotals[ATTOT_ARRAY_LEN];
11982|      1|    int   num_prot = *num_protons_to_add;
11983|      1|    int   type, mask, bSuccess, nTotCharge, nNumSuccess = 0;
11984|      1|    int max_j_Aa = -1, max_j_Ar = -1;
11985|       |
11986|       |    /* for the reference:
11987|       |
11988|       |    #define FLAG_NORM_CONSIDER_TAUT      ( FLAG_PROTON_NPO_SIMPLE_REMOVED | \
11989|       |    FLAG_PROTON_NP_HARD_REMOVED    | \
11990|       |    FLAG_PROTON_AC_SIMPLE_ADDED    | \
11991|       |    FLAG_PROTON_AC_SIMPLE_REMOVED  | \
11992|       |    FLAG_PROTON_AC_HARD_REMOVED    | \
11993|       |    FLAG_PROTON_AC_HARD_ADDED      | \
11994|       |    FLAG_PROTON_SINGLE_REMOVED     | \
11995|       |    FLAG_PROTON_CHARGE_CANCEL    )
11996|       |
11997|       |    #define FLAG_FORCE_SALT_TAUT         ( FLAG_PROTON_NP_HARD_REMOVED  | \
11998|       |    FLAG_PROTON_AC_HARD_REMOVED  | \
11999|       |    FLAG_PROTON_AC_HARD_ADDED    )
12000|       |
12001|       |    */
12002|       |
12003|       |    /* if ChargeRevrs > nChargeInChI then we should prevent proton addition or facilitate proton removal
12004|       |    a typical case is (=) on N or O instead of C(-)
12005|       |
12006|       |    if ChargeRevrs < nChargeInChI then we should prevent proton removal or facilitate proton addition
12007|       |    */
12008|       |
12009|      1|    mark_at_type( at, num_atoms, nAtTypeTotals );
12010|      6|    for (i = nTotCharge = 0; i < num_atoms; i++)
  ------------------
  |  Branch (12010:30): [True: 5, False: 1]
  ------------------
12011|      5|    {
12012|      5|        nTotCharge += at[i].charge;
12013|      5|    }
12014|       |    /* Size for SimpleAddAcidicProtons() */
12015|      3|    for (max_j_Aa = 0; AaTypMask[2 * max_j_Aa]; max_j_Aa++)
  ------------------
  |  Branch (12015:24): [True: 2, False: 1]
  ------------------
12016|      2|    {
12017|      2|        ;
12018|      2|    }
12019|       |    /* Size for SimpleRemoveAcidicProtons */
12020|      2|    for (max_j_Ar = 0; ArTypMask[2 * max_j_Ar]; max_j_Ar++)
  ------------------
  |  Branch (12020:24): [True: 1, False: 1]
  ------------------
12021|      1|    {
12022|      1|        ;
12023|      1|    }
12024|      1|    if (num_prot < 0 && nAtTypeTotals[ATTOT_TOT_CHARGE] - nNumProtAddedByRestr <= 0)
  ------------------
  |  Branch (12024:9): [True: 0, False: 1]
  |  Branch (12024:25): [True: 0, False: 0]
  ------------------
12025|      0|    {
12026|       |        /* Remove proton(s) */
12027|       |        /* use test from SimpleAddAcidicProtons() to test whether removal of H(+) from =C-OH, etc. is correct */
12028|      0|        for (i = 0; i < num_atoms && num_prot; i++)
  ------------------
  |  Branch (12028:21): [True: 0, False: 0]
  |  Branch (12028:38): [True: 0, False: 0]
  ------------------
12029|      0|        {
12030|       |            /* Choose an atom */
12031|      0|            if (at[i].sb_parity[0] || at[i].p_parity || at[i].charge ||
  ------------------
  |  Branch (12031:17): [True: 0, False: 0]
  |  Branch (12031:39): [True: 0, False: 0]
  |  Branch (12031:57): [True: 0, False: 0]
  ------------------
12032|      0|                 !at[i].num_H || at[i].radical || bHasChargedNeighbor( at, i ))
  ------------------
  |  Branch (12032:18): [True: 0, False: 0]
  |  Branch (12032:34): [True: 0, False: 0]
  |  Branch (12032:51): [True: 0, False: 0]
  ------------------
12033|      0|            {
12034|      0|                continue;
12035|      0|            }
12036|       |            /* try to remove a proton and check whether InChI would add it back */
12037|      0|            at[i].charge--;
12038|      0|            at[i].num_H--;
12039|      0|            type = GetAtomChargeType( at, i, NULL, &mask, 0 );
12040|      0|            at[i].charge++;
12041|      0|            at[i].num_H++;
12042|       |
12043|      0|            if (type)
  ------------------
  |  Branch (12043:17): [True: 0, False: 0]
  ------------------
12044|      0|            {
12045|      0|                for (bSuccess = 0, j = 0; j < max_j_Aa; j++)
  ------------------
  |  Branch (12045:43): [True: 0, False: 0]
  ------------------
12046|      0|                {
12047|      0|                    if (bSuccess = ( type & AaTypMask[2 * j] ) && ( mask && AaTypMask[2 * j + 1] ))
  ------------------
  |  Branch (12047:25): [True: 0, False: 0]
  |  Branch (12047:36): [True: 0, False: 0]
  |  Branch (12047:69): [True: 0, False: 0]
  |  Branch (12047:77): [True: 0, False: 0]
  ------------------
12048|      0|                    {
12049|      0|                        break; /* the proton may be added to this atom */
12050|      0|                    }
12051|      0|                }
12052|      0|                if (bSuccess)
  ------------------
  |  Branch (12052:21): [True: 0, False: 0]
  ------------------
12053|      0|                {
12054|      0|                    type = GetAtomChargeType( at, i, nAtTypeTotals, &mask, 1 ); /* subtract at[i] */
12055|      0|                    at[i].charge--;
12056|      0|                    at[i].num_H--;
12057|      0|                    type = GetAtomChargeType( at, i, nAtTypeTotals, &mask, 0 ); /* add changed at[i] */
12058|      0|                    num_prot++; /* success */
12059|      0|                    nNumSuccess++;
12060|      0|                }
12061|      0|            }
12062|      0|        }
12063|      0|    }
12064|       |
12065|      1|    if (num_prot < 0 && num_tg && nAtTypeTotals[ATTOT_TOT_CHARGE] - nNumProtAddedByRestr <= 0)
  ------------------
  |  Branch (12065:9): [True: 0, False: 1]
  |  Branch (12065:25): [True: 0, False: 0]
  |  Branch (12065:35): [True: 0, False: 0]
  ------------------
12066|      0|    {
12067|       |        /* Alternative proton removal: O=C-NH => (-)O-C=N, O and N are taut. endpoints */
12068|      0|        int endp2, centp, k, i0, k0;
12069|      0|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (12069:21): [True: 0, False: 0]
  ------------------
12070|      0|        {
12071|       |            /* Choose an atom */
12072|      0|            if (!at[i].endpoint || at[i].sb_parity[0] || at[i].p_parity ||
  ------------------
  |  Branch (12072:17): [True: 0, False: 0]
  |  Branch (12072:36): [True: 0, False: 0]
  |  Branch (12072:58): [True: 0, False: 0]
  ------------------
12073|      0|                 at[i].radical || at[i].charge || bHasChargedNeighbor( at, i ))
  ------------------
  |  Branch (12073:18): [True: 0, False: 0]
  |  Branch (12073:35): [True: 0, False: 0]
  |  Branch (12073:51): [True: 0, False: 0]
  ------------------
12074|      0|            {
12075|      0|                continue;
12076|      0|            }
12077|       |            /* Looking for tautomeric =O */
12078|      0|            if (1 != at[i].valence || BOND_TYPE_DOUBLE != at[i].bond_type[0] || at[i].num_H ||
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (12078:17): [True: 0, False: 0]
  |  Branch (12078:39): [True: 0, False: 0]
  |  Branch (12078:81): [True: 0, False: 0]
  ------------------
12079|      0|                 2 != get_endpoint_valence( at[i].el_number ))
  ------------------
  |  Branch (12079:18): [True: 0, False: 0]
  ------------------
12080|      0|            {
12081|      0|                continue;
12082|      0|            }
12083|      0|            centp = at[i].neighbor[0];
12084|      0|            if (at[centp].sb_parity[0] || at[centp].p_parity || !is_centerpoint_elem( at[centp].el_number ))
  ------------------
  |  Branch (12084:17): [True: 0, False: 0]
  |  Branch (12084:43): [True: 0, False: 0]
  |  Branch (12084:65): [True: 0, False: 0]
  ------------------
12085|      0|            {
12086|      0|                continue;
12087|      0|            }
12088|       |            /* Found a possible centerpoint, looking for -NH endpoint */
12089|      0|            for (k = 0; k < at[centp].valence; k++)
  ------------------
  |  Branch (12089:25): [True: 0, False: 0]
  ------------------
12090|      0|            {
12091|      0|                if (at[centp].bond_type[k] != BOND_TYPE_SINGLE)
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (12091:21): [True: 0, False: 0]
  ------------------
12092|      0|                {
12093|      0|                    continue;
12094|      0|                }
12095|      0|                endp2 = at[centp].neighbor[k];
12096|      0|                if (at[endp2].endpoint != at[i].endpoint ||
  ------------------
  |  Branch (12096:21): [True: 0, False: 0]
  ------------------
12097|      0|                     !at[endp2].num_H || at[endp2].charge ||
  ------------------
  |  Branch (12097:22): [True: 0, False: 0]
  |  Branch (12097:42): [True: 0, False: 0]
  ------------------
12098|      0|                     at[endp2].sb_parity[0] || at[endp2].p_parity ||
  ------------------
  |  Branch (12098:22): [True: 0, False: 0]
  |  Branch (12098:48): [True: 0, False: 0]
  ------------------
12099|      0|                     at[endp2].valence != at[endp2].chem_bonds_valence ||
  ------------------
  |  Branch (12099:22): [True: 0, False: 0]
  ------------------
12100|      0|                     3 != at[endp2].chem_bonds_valence + at[endp2].num_H ||
  ------------------
  |  Branch (12100:22): [True: 0, False: 0]
  ------------------
12101|      0|                     3 != get_endpoint_valence( at[endp2].el_number ))
  ------------------
  |  Branch (12101:22): [True: 0, False: 0]
  ------------------
12102|      0|                {
12103|      0|                    continue;
12104|      0|                }
12105|       |                /* Find bonds in reciprocal ajacency lists */
12106|      0|                for (i0 = 0; i0 < at[centp].valence && i != at[centp].neighbor[i0]; i0++)
  ------------------
  |  Branch (12106:30): [True: 0, False: 0]
  |  Branch (12106:56): [True: 0, False: 0]
  ------------------
12107|      0|                {
12108|      0|                    ;
12109|      0|                }
12110|      0|                for (k0 = 0; k0 < at[endp2].valence && centp != at[endp2].neighbor[k0]; k0++)
  ------------------
  |  Branch (12110:30): [True: 0, False: 0]
  |  Branch (12110:56): [True: 0, False: 0]
  ------------------
12111|      0|                {
12112|      0|                    ;
12113|      0|                }
12114|      0|                if (i0 == at[centp].valence || k0 == at[endp2].valence)
  ------------------
  |  Branch (12114:21): [True: 0, False: 0]
  |  Branch (12114:48): [True: 0, False: 0]
  ------------------
12115|      0|                {
12116|      0|                    return RI_ERR_PROGR;
  ------------------
  |  |11913|      0|#define RI_ERR_PROGR   (-3)
  ------------------
12117|      0|                }
12118|       |                /* -NH has been found */
12119|      0|                type = GetAtomChargeType( at, i, nAtTypeTotals, &mask, 1 ); /* subtract at[i] */
12120|      0|                type = GetAtomChargeType( at, endp2, nAtTypeTotals, &mask, 1 ); /* subtract at[endp2] */
12121|       |
12122|      0|                at[i].bond_type[0] --;
12123|      0|                at[centp].bond_type[i0] --;
12124|      0|                at[i].chem_bonds_valence--;
12125|      0|                at[i].charge--;
12126|       |
12127|      0|                at[endp2].bond_type[k0] ++;
12128|      0|                at[centp].bond_type[k] ++;
12129|      0|                at[endp2].chem_bonds_valence++;
12130|      0|                at[endp2].num_H--;
12131|       |
12132|      0|                num_prot++;
12133|      0|                nNumSuccess++;
12134|       |
12135|      0|                type = GetAtomChargeType( at, i, nAtTypeTotals, &mask, 0 ); /* add at[i] */
12136|      0|                type = GetAtomChargeType( at, endp2, nAtTypeTotals, &mask, 0 ); /* add at[endp2] */
12137|      0|            }
12138|      0|        }
12139|      0|    }
12140|       |
12141|      1|    if (num_prot > 0)
  ------------------
  |  Branch (12141:9): [True: 1, False: 0]
  ------------------
12142|      1|    {
12143|       |        /* Add protons */
12144|       |        /* 1. Use test from SimpleRemoveAcidicProtons() to test whether addition of H(+) to =C-O(-), etc. is correct */
12145|      1|        for (i = 0; i < num_atoms && num_prot && nAtTypeTotals[ATTOT_TOT_CHARGE] - nNumProtAddedByRestr >= 0; i++)
  ------------------
  |  Branch (12145:21): [True: 1, False: 0]
  |  Branch (12145:38): [True: 1, False: 0]
  |  Branch (12145:50): [True: 0, False: 1]
  ------------------
12146|      0|        {
12147|       |            /* Choose an atom */
12148|      0|            if (at[i].sb_parity[0] || at[i].p_parity || at[i].num_H ||
  ------------------
  |  Branch (12148:17): [True: 0, False: 0]
  |  Branch (12148:39): [True: 0, False: 0]
  |  Branch (12148:57): [True: 0, False: 0]
  ------------------
12149|      0|                 at[i].charge != -1 || at[i].radical || bHasChargedNeighbor( at, i ))
  ------------------
  |  Branch (12149:18): [True: 0, False: 0]
  |  Branch (12149:40): [True: 0, False: 0]
  |  Branch (12149:57): [True: 0, False: 0]
  ------------------
12150|      0|            {
12151|      0|                continue;
12152|      0|            }
12153|       |            /* Try to add a proton and check whether InChI would remove it back */
12154|      0|            at[i].charge++;
12155|      0|            at[i].num_H++;
12156|      0|            type = GetAtomChargeType( at, i, NULL, &mask, 0 );
12157|      0|            at[i].charge--;
12158|      0|            at[i].num_H--;
12159|      0|            if (type)
  ------------------
  |  Branch (12159:17): [True: 0, False: 0]
  ------------------
12160|      0|            {
12161|      0|                for (bSuccess = 0, j = 0; j < max_j_Ar; j++)
  ------------------
  |  Branch (12161:43): [True: 0, False: 0]
  ------------------
12162|      0|                {
12163|      0|                    if (bSuccess = ( type & ArTypMask[2 * j] ) && ( mask && ArTypMask[2 * j + 1] ))
  ------------------
  |  Branch (12163:25): [True: 0, False: 0]
  |  Branch (12163:36): [True: 0, False: 0]
  |  Branch (12163:69): [True: 0, False: 0]
  |  Branch (12163:77): [True: 0, False: 0]
  ------------------
12164|      0|                    {
12165|      0|                        break;
12166|      0|                    }
12167|      0|                }
12168|      0|                if (bSuccess)
  ------------------
  |  Branch (12168:21): [True: 0, False: 0]
  ------------------
12169|      0|                {
12170|      0|                    type = GetAtomChargeType( at, i, nAtTypeTotals, &mask, 1 ); /* subtract at[i] */
12171|      0|                    at[i].charge++;
12172|      0|                    at[i].num_H++;
12173|      0|                    type = GetAtomChargeType( at, i, nAtTypeTotals, &mask, 0 ); /* add changed at[i] */
12174|      0|                    num_prot--; /* success */
12175|      0|                    nNumSuccess++;
12176|      0|                }
12177|      0|            }
12178|      0|        }
12179|       |        /* 2. Use test from SimpleRemoveHplusNPO() */
12180|      6|        for (i = 0; i < num_atoms && num_prot; i++)
  ------------------
  |  Branch (12180:21): [True: 5, False: 1]
  |  Branch (12180:38): [True: 5, False: 0]
  ------------------
12181|      5|        {
12182|       |            /* Choose an atom */
12183|      5|            if (at[i].sb_parity[0] || at[i].p_parity ||
  ------------------
  |  Branch (12183:17): [True: 0, False: 5]
  |  Branch (12183:39): [True: 0, False: 5]
  ------------------
12184|      5|                 at[i].charge || at[i].radical || bHasChargedNeighbor( at, i ))
  ------------------
  |  Branch (12184:18): [True: 4, False: 1]
  |  Branch (12184:34): [True: 0, False: 1]
  |  Branch (12184:51): [True: 1, False: 0]
  ------------------
12185|      5|            {
12186|      5|                continue;
12187|      5|            }
12188|       |            /* Try to add a proton and check whether InChI would remove it back */
12189|      0|            at[i].num_H++;
12190|      0|            at[i].charge++;
12191|      0|            bSuccess = ( PR_SIMPLE_TYP & ( type = GetAtomChargeType( at, i, NULL, &mask, 0 ) ) ) &&
  ------------------
  |  |  161|      0|#define PR_SIMPLE_TYP  (ATT_ATOM_N | ATT_ATOM_P | ATT_O_PLUS)
  |  |  ------------------
  |  |  |  |   69|      0|#define ATT_ATOM_N       0x0040
  |  |  ------------------
  |  |               #define PR_SIMPLE_TYP  (ATT_ATOM_N | ATT_ATOM_P | ATT_O_PLUS)
  |  |  ------------------
  |  |  |  |   70|      0|#define ATT_ATOM_P       0x0080
  |  |  ------------------
  |  |               #define PR_SIMPLE_TYP  (ATT_ATOM_N | ATT_ATOM_P | ATT_O_PLUS)
  |  |  ------------------
  |  |  |  |   74|      0|#define ATT_O_PLUS       0x0800   /* -OH2(+), =OH(+), -OH(+)-, OH3(+), =O(+)-, etc; O=O,S,Se,Te */
  |  |  ------------------
  ------------------
  |  Branch (12191:24): [True: 0, False: 0]
  ------------------
12192|      0|                ( PR_SIMPLE_MSK & mask );
  ------------------
  |  |  160|      0|#define PR_SIMPLE_MSK  (ATBIT_NP_Proton | ATBIT_OH_Plus)
  |  |  ------------------
  |  |  |  |  117|      0|#define ATBIT_NP_Proton  (1 << ATTOT_NUM_NP_Proton)
  |  |  ------------------
  |  |               #define PR_SIMPLE_MSK  (ATBIT_NP_Proton | ATBIT_OH_Plus)
  |  |  ------------------
  |  |  |  |  141|      0|#define ATBIT_OH_Plus    (1 << ATTOT_NUM_OH_Plus)
  |  |  ------------------
  ------------------
  |  Branch (12192:17): [True: 0, False: 0]
  ------------------
12193|      0|            at[i].num_H--;  /* failed */
12194|      0|            at[i].charge--;
12195|      0|            if (bSuccess)
  ------------------
  |  Branch (12195:17): [True: 0, False: 0]
  ------------------
12196|      0|            {
12197|      0|                type = GetAtomChargeType( at, i, nAtTypeTotals, &mask, 1 ); /* subtract at[i] */
12198|      0|                at[i].num_H++;
12199|      0|                at[i].charge++;
12200|      0|                type = GetAtomChargeType( at, i, nAtTypeTotals, &mask, 0 ); /* add changed at[i] */
12201|      0|                num_prot--;     /* succeeded */
12202|      0|                nNumSuccess++;
12203|      0|            }
12204|      0|        }
12205|      1|    }
12206|       |
12207|      1|    if (num_prot < 0 && ( bNormalizationFlags & FLAG_PROTON_AC_HARD_ADDED ) && 1 == num_tg &&
  ------------------
  |  |  179|      0|#define FLAG_PROTON_AC_HARD_ADDED      0x0020
  ------------------
  |  Branch (12207:9): [True: 0, False: 1]
  |  Branch (12207:25): [True: 0, False: 0]
  |  Branch (12207:80): [True: 0, False: 0]
  ------------------
12208|      1|         nAtTypeTotals[ATTOT_TOT_CHARGE] - nNumProtAddedByRestr <= 0)
  ------------------
  |  Branch (12208:10): [True: 0, False: 0]
  ------------------
12209|      0|    {
12210|       |        /* Try to remove protons from tautomeric N (specific ADP must be present) */
12211|      0|        int nNumAcceptors_DB_O = 0, nNumDonors_SB_NH = 0, num_max, num_success;
12212|      0|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (12212:21): [True: 0, False: 0]
  ------------------
12213|      0|        {
12214|       |            /* Choose an atom */
12215|      0|            if (!at[i].endpoint || at[i].radical ||
  ------------------
  |  Branch (12215:17): [True: 0, False: 0]
  |  Branch (12215:36): [True: 0, False: 0]
  ------------------
12216|      0|                 at[i].sb_parity[0] || at[i].p_parity || bHasChargedNeighbor( at, i ))
  ------------------
  |  Branch (12216:18): [True: 0, False: 0]
  |  Branch (12216:40): [True: 0, False: 0]
  |  Branch (12216:58): [True: 0, False: 0]
  ------------------
12217|      0|            {
12218|      0|                continue;
12219|      0|            }
12220|      0|            type = GetAtomChargeType( at, i, NULL, &mask, 0 );
12221|      0|            if (( type & AA_HARD_TYP_CO ) && ( mask & AA_HARD_MSK_CO ))
  ------------------
  |  |  246|      0|#define AA_HARD_TYP_CO    (ATT_ACIDIC_CO | ATT_NO)
  |  |  ------------------
  |  |  |  |   63|      0|#define ATT_ACIDIC_CO    0x0001
  |  |  ------------------
  |  |               #define AA_HARD_TYP_CO    (ATT_ACIDIC_CO | ATT_NO)
  |  |  ------------------
  |  |  |  |   67|      0|#define ATT_NO           0x0010
  |  |  ------------------
  ------------------
                          if (( type & AA_HARD_TYP_CO ) && ( mask & AA_HARD_MSK_CO ))
  ------------------
  |  |  245|      0|#define AA_HARD_MSK_CO    (ATBIT_CO | ATBIT_NO )
  |  |  ------------------
  |  |  |  |  129|      0|#define ATBIT_CO         (1 << ATTOT_NUM_CO)
  |  |  ------------------
  |  |               #define AA_HARD_MSK_CO    (ATBIT_CO | ATBIT_NO )
  |  |  ------------------
  |  |  |  |  131|      0|#define ATBIT_NO         (1 << ATTOT_NUM_NO)
  |  |  ------------------
  ------------------
  |  Branch (12221:17): [True: 0, False: 0]
  |  Branch (12221:46): [True: 0, False: 0]
  ------------------
12222|      0|            {
12223|      0|                nNumAcceptors_DB_O++;
12224|      0|            }
12225|      0|            else
12226|      0|            {
12227|      0|                if (( type == ATT_ATOM_N ) && ( mask == ATBIT_NP_H ) && !at[i].charge &&
  ------------------
  |  |   69|      0|#define ATT_ATOM_N       0x0040
  ------------------
                              if (( type == ATT_ATOM_N ) && ( mask == ATBIT_NP_H ) && !at[i].charge &&
  ------------------
  |  |  118|      0|#define ATBIT_NP_H       (1 << ATTOT_NUM_NP_H)
  ------------------
  |  Branch (12227:21): [True: 0, False: 0]
  |  Branch (12227:47): [True: 0, False: 0]
  |  Branch (12227:73): [True: 0, False: 0]
  ------------------
12228|      0|                     at[i].valence == at[i].chem_bonds_valence)
  ------------------
  |  Branch (12228:22): [True: 0, False: 0]
  ------------------
12229|      0|                {
12230|      0|                    nNumDonors_SB_NH++;
12231|      0|                }
12232|      0|            }
12233|      0|        }
12234|      0|        num_max = inchi_min( nNumAcceptors_DB_O, nNumDonors_SB_NH );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
12235|      0|        for (i = 0, num_success = 0; i < num_atoms && num_success < num_max && num_prot < 0; i++)
  ------------------
  |  Branch (12235:38): [True: 0, False: 0]
  |  Branch (12235:55): [True: 0, False: 0]
  |  Branch (12235:80): [True: 0, False: 0]
  ------------------
12236|      0|        {
12237|       |            /* Choose an atom */
12238|      0|            if (!at[i].endpoint || at[i].radical || at[i].sb_parity[0] ||
  ------------------
  |  Branch (12238:17): [True: 0, False: 0]
  |  Branch (12238:36): [True: 0, False: 0]
  |  Branch (12238:53): [True: 0, False: 0]
  ------------------
12239|      0|                 at[i].p_parity || bHasChargedNeighbor( at, i ))
  ------------------
  |  Branch (12239:18): [True: 0, False: 0]
  |  Branch (12239:36): [True: 0, False: 0]
  ------------------
12240|      0|            {
12241|      0|                continue;
12242|      0|            }
12243|      0|            type = GetAtomChargeType( at, i, NULL, &mask, 0 );
12244|      0|            if (( type == ATT_ATOM_N ) && ( mask == ATBIT_NP_H ) && !at[i].charge &&
  ------------------
  |  |   69|      0|#define ATT_ATOM_N       0x0040
  ------------------
                          if (( type == ATT_ATOM_N ) && ( mask == ATBIT_NP_H ) && !at[i].charge &&
  ------------------
  |  |  118|      0|#define ATBIT_NP_H       (1 << ATTOT_NUM_NP_H)
  ------------------
  |  Branch (12244:17): [True: 0, False: 0]
  |  Branch (12244:43): [True: 0, False: 0]
  |  Branch (12244:69): [True: 0, False: 0]
  ------------------
12245|      0|                 at[i].valence == at[i].chem_bonds_valence)
  ------------------
  |  Branch (12245:18): [True: 0, False: 0]
  ------------------
12246|      0|            {
12247|      0|                type = GetAtomChargeType( at, i, nAtTypeTotals, &mask, 1 ); /* subtract at[i] */
12248|      0|                at[i].num_H--;
12249|      0|                at[i].charge--;
12250|      0|                type = GetAtomChargeType( at, i, nAtTypeTotals, &mask, 0 ); /* add changed at[i] */
12251|      0|                num_prot++;
12252|      0|                num_success++;
12253|      0|                nNumSuccess++;
12254|      0|            }
12255|      0|        }
12256|      0|    }
12257|       |
12258|       |    /*exit_function:*/
12259|       |
12260|      1|    *num_protons_to_add = num_prot;
12261|       |
12262|      1|    return ret < 0 ? ret : nNumSuccess;
  ------------------
  |  Branch (12262:12): [True: 0, False: 1]
  ------------------
12263|      1|}
ichi_bns.c:remove_alt_bond_marks:
 1974|   110k|{
 1975|   110k|    int i, j, val;
 1976|   222k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1976:17): [True: 112k, False: 110k]
  ------------------
 1977|   112k|    {
 1978|   112k|        for (val = at[i].valence, j = 0; j < val; j++)
  ------------------
  |  Branch (1978:42): [True: 64, False: 112k]
  ------------------
 1979|     64|        {
 1980|     64|            at[i].bond_type[j] &= BOND_TYPE_MASK;
  ------------------
  |  |  217|     64|#define BOND_TYPE_MASK        0x0f
  ------------------
 1981|     64|        }
 1982|   112k|    }
 1983|       |
 1984|   110k|}

inchi_ios_init:
   79|  1.95k|{
   80|  1.95k|    memset( ios, 0, sizeof( *ios ) );
   81|  1.95k|    switch (io_type)
   82|  1.95k|    {
   83|      0|        case INCHI_IOS_TYPE_FILE:
  ------------------
  |  | 1012|      0|#define INCHI_IOS_TYPE_FILE 2
  ------------------
  |  Branch (83:9): [True: 0, False: 1.95k]
  ------------------
   84|      0|            ios->type = INCHI_IOS_TYPE_FILE;
  ------------------
  |  | 1012|      0|#define INCHI_IOS_TYPE_FILE 2
  ------------------
   85|      0|            break;
   86|  1.95k|        case INCHI_IOS_TYPE_STRING:
  ------------------
  |  | 1011|  1.95k|#define INCHI_IOS_TYPE_STRING 1
  ------------------
  |  Branch (86:9): [True: 1.95k, False: 0]
  ------------------
   87|  1.95k|        default:
  ------------------
  |  Branch (87:9): [True: 0, False: 1.95k]
  ------------------
   88|  1.95k|            ios->type = INCHI_IOS_TYPE_STRING;
  ------------------
  |  | 1011|  1.95k|#define INCHI_IOS_TYPE_STRING 1
  ------------------
   89|  1.95k|            break;
   90|  1.95k|    }
   91|  1.95k|    ios->f = f;
   92|  1.95k|    return;
   93|  1.95k|}
inchi_ios_close:
  222|  1.44k|{
  223|  1.44k|    if (NULL == ios)
  ------------------
  |  Branch (223:9): [True: 0, False: 1.44k]
  ------------------
  224|      0|    {
  225|      0|        return;
  226|      0|    }
  227|  1.44k|    if (ios->s.pStr)
  ------------------
  |  Branch (227:9): [True: 227, False: 1.21k]
  ------------------
  228|    227|    {
  229|    227|        inchi_free( ios->s.pStr );
  ------------------
  |  | 1136|    227|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 227, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  230|    227|    }
  231|  1.44k|    ios->s.pStr = NULL;
  232|  1.44k|    ios->s.nUsedLength = ios->s.nAllocatedLength = ios->s.nPtr = 0;
  233|       |
  234|  1.44k|    if (NULL != ios->f && stdout != ios->f && stderr != ios->f && stdin != ios->f)
  ------------------
  |  Branch (234:9): [True: 0, False: 1.44k]
  |  Branch (234:27): [True: 0, False: 0]
  |  Branch (234:47): [True: 0, False: 0]
  |  Branch (234:67): [True: 0, False: 0]
  ------------------
  235|      0|    {
  236|      0|        fclose( ios->f );
  237|      0|    }
  238|       |
  239|  1.44k|    return;
  240|  1.44k|}
inchi_ios_reset:
  248|    288|{
  249|    288|    ios->s.pStr = NULL;
  250|    288|    ios->s.nUsedLength = ios->s.nAllocatedLength = ios->s.nPtr = 0;
  251|    288|    if (NULL != ios->f && stdout != ios->f && stderr != ios->f && stdin != ios->f)
  ------------------
  |  Branch (251:9): [True: 0, False: 288]
  |  Branch (251:27): [True: 0, False: 0]
  |  Branch (251:47): [True: 0, False: 0]
  |  Branch (251:67): [True: 0, False: 0]
  ------------------
  252|      0|    {
  253|      0|        fclose( ios->f );
  254|      0|    }
  255|       |
  256|    288|    return;
  257|    288|}
inchi_ios_print:
  471|     71|{
  472|     71|    int ret = 0, ret2 = 0;
  473|     71|    va_list argList;
  474|       |
  475|     71|    if (!ios)
  ------------------
  |  Branch (475:9): [True: 0, False: 71]
  ------------------
  476|      0|    {
  477|      0|        return -1;
  478|      0|    }
  479|       |
  480|     71|    if (ios->type == INCHI_IOS_TYPE_STRING)
  ------------------
  |  | 1011|     71|#define INCHI_IOS_TYPE_STRING 1
  ------------------
  |  Branch (480:9): [True: 71, False: 0]
  ------------------
  481|     71|    {
  482|       |        /* output to string buffer */
  483|     71|        int max_len;
  484|     71|        my_va_start( argList, lpszFormat );
  ------------------
  |  |   50|     71|#define my_va_start va_start
  ------------------
  485|     71|        max_len = GetMaxPrintfLength( lpszFormat, argList );
  486|     71|        va_end( argList );
  487|     71|        if (max_len >= 0)
  ------------------
  |  Branch (487:13): [True: 71, False: 0]
  ------------------
  488|     71|        {
  489|     71|            if (ios->s.nAllocatedLength - ios->s.nUsedLength <= max_len)
  ------------------
  |  Branch (489:17): [True: 71, False: 0]
  ------------------
  490|     71|            {
  491|       |                /* enlarge output string */
  492|     71|                int  nAddLength = inchi_max( INCHI_ADD_STR_LEN, max_len );
  ------------------
  |  |  166|     71|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 57, False: 14]
  |  |  ------------------
  ------------------
  493|     71|                char *new_str =
  494|     71|                    (char *) inchi_calloc( ios->s.nAllocatedLength + nAddLength, sizeof( char ) );
  ------------------
  |  | 1133|     71|#define inchi_calloc   calloc
  ------------------
  495|     71|                if (new_str)
  ------------------
  |  Branch (495:21): [True: 71, False: 0]
  ------------------
  496|     71|                {
  497|     71|                    if (ios->s.pStr)
  ------------------
  |  Branch (497:25): [True: 0, False: 71]
  ------------------
  498|      0|                    {
  499|      0|                        if (ios->s.nUsedLength > 0)
  ------------------
  |  Branch (499:29): [True: 0, False: 0]
  ------------------
  500|      0|                        {
  501|      0|                            memcpy( new_str, ios->s.pStr, sizeof( new_str[0] )* ios->s.nUsedLength );
  502|      0|                        }
  503|      0|                        inchi_free( ios->s.pStr );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  504|      0|                    }
  505|     71|                    ios->s.pStr = new_str;
  506|     71|                    ios->s.nAllocatedLength += nAddLength;
  507|     71|                }
  508|      0|                else
  509|      0|                {
  510|      0|                    return -1; /* failed */
  511|      0|                }
  512|     71|            }
  513|       |            /* output */
  514|     71|            my_va_start( argList, lpszFormat );
  ------------------
  |  |   50|     71|#define my_va_start va_start
  ------------------
  515|     71|            ret = vsprintf( ios->s.pStr + ios->s.nUsedLength, lpszFormat, argList );
  516|     71|            va_end( argList );
  517|     71|            if (ret >= 0)
  ------------------
  |  Branch (517:17): [True: 71, False: 0]
  ------------------
  518|     71|            {
  519|     71|                ios->s.nUsedLength += ret;
  520|     71|            }
  521|       |#ifdef TARGET_LIB_FOR_WINCHI
  522|       |#if 0
  523|       |            if (FWPRINT)
  524|       |            {
  525|       |                my_va_start( argList, lpszFormat );
  526|       |                FWPRINT( lpszFormat, argList );
  527|       |                va_end( argList );
  528|       |            }
  529|       |#endif
  530|       |#endif
  531|     71|            return ret;
  532|     71|        }
  533|      0|        return -1;
  534|     71|    }
  535|       |
  536|      0|    else if (ios->type == INCHI_IOS_TYPE_FILE)
  ------------------
  |  | 1012|      0|#define INCHI_IOS_TYPE_FILE 2
  ------------------
  |  Branch (536:14): [True: 0, False: 0]
  ------------------
  537|      0|    {
  538|       |        /* output to file */
  539|      0|        if (ios->f)
  ------------------
  |  Branch (539:13): [True: 0, False: 0]
  ------------------
  540|      0|        {
  541|      0|            my_va_start( argList, lpszFormat );
  ------------------
  |  |   50|      0|#define my_va_start va_start
  ------------------
  542|      0|            ret = vfprintf( ios->f, lpszFormat, argList );
  543|      0|            va_end( argList );
  544|      0|        }
  545|      0|        else
  546|      0|        {
  547|      0|            my_va_start( argList, lpszFormat );
  ------------------
  |  |   50|      0|#define my_va_start va_start
  ------------------
  548|      0|            ret2 = vfprintf( stdout, lpszFormat, argList );
  549|      0|            va_end( argList );
  550|      0|        }
  551|       |#ifdef TARGET_LIB_FOR_WINCHI
  552|       |        if (FWPRINT)
  553|       |        {
  554|       |            my_va_start( argList, lpszFormat );
  555|       |            FWPRINT( lpszFormat, argList );
  556|       |            va_end( argList );
  557|       |        }
  558|       |#endif
  559|      0|        return ret ? ret : ret2;
  ------------------
  |  Branch (559:16): [True: 0, False: 0]
  ------------------
  560|      0|    }
  561|       |
  562|       |    /* no output */
  563|      0|    return 0;
  564|     71|}
inchi_ios_print_nodisplay:
  599|    606|{
  600|    606|    va_list argList;
  601|       |
  602|    606|    if (!ios)
  ------------------
  |  Branch (602:9): [True: 0, False: 606]
  ------------------
  603|      0|    {
  604|      0|        return -1;
  605|      0|    }
  606|       |
  607|    606|    if (ios->type == INCHI_IOS_TYPE_STRING)
  ------------------
  |  | 1011|    606|#define INCHI_IOS_TYPE_STRING 1
  ------------------
  |  Branch (607:9): [True: 606, False: 0]
  ------------------
  608|    606|    {
  609|       |        /* output to string buffer */
  610|    606|        int ret = 0, max_len;
  611|    606|        my_va_start( argList, lpszFormat );
  ------------------
  |  |   50|    606|#define my_va_start va_start
  ------------------
  612|    606|        max_len = GetMaxPrintfLength( lpszFormat, argList );
  613|    606|        va_end( argList );
  614|    606|        if (max_len >= 0)
  ------------------
  |  Branch (614:13): [True: 606, False: 0]
  ------------------
  615|    606|        {
  616|    606|            if (ios->s.nAllocatedLength - ios->s.nUsedLength <= max_len)
  ------------------
  |  Branch (616:17): [True: 307, False: 299]
  ------------------
  617|    307|            {
  618|       |                /* enlarge output string */
  619|    307|                int  nAddLength = inchi_max( INCHI_ADD_STR_LEN, max_len );
  ------------------
  |  |  166|    307|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 307, False: 0]
  |  |  ------------------
  ------------------
  620|    307|                char *new_str = (char *) inchi_calloc( ios->s.nAllocatedLength + nAddLength, sizeof( new_str[0] ) );
  ------------------
  |  | 1133|    307|#define inchi_calloc   calloc
  ------------------
  621|    307|                if (new_str)
  ------------------
  |  Branch (621:21): [True: 307, False: 0]
  ------------------
  622|    307|                {
  623|    307|                    if (ios->s.pStr)
  ------------------
  |  Branch (623:25): [True: 0, False: 307]
  ------------------
  624|      0|                    {
  625|      0|                        if (ios->s.nUsedLength > 0)
  ------------------
  |  Branch (625:29): [True: 0, False: 0]
  ------------------
  626|      0|                        {
  627|      0|                            memcpy( new_str, ios->s.pStr, sizeof( new_str[0] )*ios->s.nUsedLength );
  628|      0|                        }
  629|      0|                        inchi_free( ios->s.pStr );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  630|      0|                    }
  631|    307|                    ios->s.pStr = new_str;
  632|    307|                    ios->s.nAllocatedLength += nAddLength;
  633|    307|                }
  634|      0|                else
  635|      0|                {
  636|      0|                    return -1; /* failed */
  637|      0|                }
  638|    307|            }
  639|       |            /* output */
  640|    606|            my_va_start( argList, lpszFormat );
  ------------------
  |  |   50|    606|#define my_va_start va_start
  ------------------
  641|    606|            ret = vsprintf( ios->s.pStr + ios->s.nUsedLength, lpszFormat, argList );
  642|    606|            va_end( argList );
  643|    606|            if (ret >= 0)
  ------------------
  |  Branch (643:17): [True: 606, False: 0]
  ------------------
  644|    606|            {
  645|    606|                ios->s.nUsedLength += ret;
  646|    606|            }
  647|    606|            return ret;
  648|    606|        }
  649|      0|        return -1;
  650|    606|    }
  651|       |
  652|      0|    else if (ios->type == INCHI_IOS_TYPE_FILE)
  ------------------
  |  | 1012|      0|#define INCHI_IOS_TYPE_FILE 2
  ------------------
  |  Branch (652:14): [True: 0, False: 0]
  ------------------
  653|      0|    {
  654|      0|        my_va_start( argList, lpszFormat );
  ------------------
  |  |   50|      0|#define my_va_start va_start
  ------------------
  655|      0|        inchi_print_nodisplay( ios->f, lpszFormat, argList );
  656|      0|        va_end( argList );
  657|      0|    }
  658|       |
  659|       |    /* no output */
  660|      0|    return 0;
  661|    606|}
inchi_ios_eprint:
  698|  4.22k|{
  699|  4.22k|    int ret = 0, ret2 = 0;
  700|  4.22k|    va_list argList;
  701|       |
  702|  4.22k|    if (!ios)
  ------------------
  |  Branch (702:9): [True: 4, False: 4.22k]
  ------------------
  703|      4|    {
  704|      4|        return -1;
  705|      4|    }
  706|       |
  707|  4.22k|    if (ios->type == INCHI_IOS_TYPE_STRING)
  ------------------
  |  | 1011|  4.22k|#define INCHI_IOS_TYPE_STRING 1
  ------------------
  |  Branch (707:9): [True: 4.22k, False: 0]
  ------------------
  708|       |        /* was #if ( defined(TARGET_API_LIB) || defined(INCHI_STANDALONE_EXE) ) */
  709|  4.22k|    {
  710|       |        /* output to string buffer */
  711|  4.22k|        int max_len, nAddLength = 0;
  712|  4.22k|        char *new_str = NULL;
  713|       |
  714|  4.22k|        my_va_start( argList, lpszFormat );
  ------------------
  |  |   50|  4.22k|#define my_va_start va_start
  ------------------
  715|  4.22k|        max_len = GetMaxPrintfLength( lpszFormat, argList );
  716|  4.22k|        va_end( argList );
  717|       |
  718|  4.22k|        if (max_len >= 0)
  ------------------
  |  Branch (718:13): [True: 4.22k, False: 0]
  ------------------
  719|  4.22k|        {
  720|  4.22k|            if (ios->s.nAllocatedLength - ios->s.nUsedLength <= max_len)
  ------------------
  |  Branch (720:17): [True: 454, False: 3.76k]
  ------------------
  721|    454|            {
  722|       |                /* enlarge output string */
  723|    454|                nAddLength = inchi_max( INCHI_ADD_STR_LEN, max_len );
  ------------------
  |  |  166|    454|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 454, False: 0]
  |  |  ------------------
  ------------------
  724|    454|                new_str = (char *) inchi_calloc( ios->s.nAllocatedLength + nAddLength, sizeof( new_str[0] ) );
  ------------------
  |  | 1133|    454|#define inchi_calloc   calloc
  ------------------
  725|    454|                if (new_str)
  ------------------
  |  Branch (725:21): [True: 454, False: 0]
  ------------------
  726|    454|                {
  727|    454|                    if (ios->s.pStr)
  ------------------
  |  Branch (727:25): [True: 0, False: 454]
  ------------------
  728|      0|                    {
  729|      0|                        if (ios->s.nUsedLength > 0)
  ------------------
  |  Branch (729:29): [True: 0, False: 0]
  ------------------
  730|      0|                        {
  731|      0|                            memcpy( new_str, ios->s.pStr, sizeof( new_str[0] )* ios->s.nUsedLength );
  732|      0|                        }
  733|      0|                        inchi_free( ios->s.pStr );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  734|      0|                    }
  735|    454|                    ios->s.pStr = new_str;
  736|    454|                    ios->s.nAllocatedLength += nAddLength;
  737|    454|                }
  738|      0|                else
  739|      0|                {
  740|      0|                    return -1; /* failed */
  741|      0|                }
  742|    454|            }
  743|       |
  744|       |            /* output */
  745|  4.22k|            my_va_start( argList, lpszFormat );
  ------------------
  |  |   50|  4.22k|#define my_va_start va_start
  ------------------
  746|  4.22k|            ret = vsprintf( ios->s.pStr + ios->s.nUsedLength, lpszFormat, argList );
  747|  4.22k|            va_end( argList );
  748|  4.22k|            if (ret >= 0)
  ------------------
  |  Branch (748:17): [True: 4.22k, False: 0]
  ------------------
  749|  4.22k|            {
  750|  4.22k|                ios->s.nUsedLength += ret;
  751|  4.22k|            }
  752|  4.22k|            return ret;
  753|  4.22k|        }
  754|      0|        return -1;
  755|  4.22k|    }
  756|       |
  757|      0|    else if (ios->type == INCHI_IOS_TYPE_FILE)
  ------------------
  |  | 1012|      0|#define INCHI_IOS_TYPE_FILE 2
  ------------------
  |  Branch (757:14): [True: 0, False: 0]
  ------------------
  758|      0|    {
  759|      0|        if (ios->f)
  ------------------
  |  Branch (759:13): [True: 0, False: 0]
  ------------------
  760|      0|        {
  761|       |            /* output to plain file */
  762|      0|            my_va_start( argList, lpszFormat );
  ------------------
  |  |   50|      0|#define my_va_start va_start
  ------------------
  763|      0|            ret = inchi_vfprintf( ios->f, lpszFormat, argList );
  764|      0|            va_end( argList );
  765|       |            /*  No output to stderr from within dll or GUI program */
  766|       |#if ( !defined(TARGET_API_LIB) && !defined(TARGET_LIB_FOR_WINCHI) )
  767|       |            if (ios->f != stderr)
  768|       |            {
  769|       |                my_va_start( argList, lpszFormat );
  770|       |                ret2 = vfprintf( stderr, lpszFormat, argList );
  771|       |                va_end( argList );
  772|       |            }
  773|       |#endif
  774|      0|            return ret ? ret : ret2;
  ------------------
  |  Branch (774:20): [True: 0, False: 0]
  ------------------
  775|      0|        }
  776|      0|    }
  777|       |
  778|       |    /* no output */
  779|      0|    return 0;
  780|  4.22k|}
GetMaxPrintfLength:
 1054|  68.3k|{
 1055|       |     /*ASSERT(AfxIsValidString(lpszFormat, FALSE));*/
 1056|  68.3k|    const char * lpsz;
 1057|  68.3k|    int nMaxLen, nWidth, nPrecision, nModifier, nItemLen;
 1058|       |
 1059|  68.3k|    nMaxLen = 0;
 1060|       |    /* make a guess at the maximum length of the resulting string */
 1061|  1.17M|    for (lpsz = lpszFormat; *lpsz; lpsz++)
  ------------------
  |  Branch (1061:29): [True: 1.10M, False: 68.3k]
  ------------------
 1062|  1.10M|    {
 1063|       |         /* handle '%' character, but watch out for '%%' */
 1064|  1.10M|        if (*lpsz != '%' || *( ++lpsz ) == '%')
  ------------------
  |  Branch (1064:13): [True: 1.03M, False: 66.2k]
  |  Branch (1064:29): [True: 0, False: 66.2k]
  ------------------
 1065|  1.03M|        {
 1066|  1.03M|            nMaxLen += 1;
 1067|  1.03M|            continue;
 1068|  1.03M|        }
 1069|       |
 1070|  66.2k|        nItemLen = 0;
 1071|       |
 1072|       |        /*  handle '%' character with format */
 1073|  66.2k|        nWidth = 0;
 1074|  66.3k|        for (; *lpsz; lpsz++)
  ------------------
  |  Branch (1074:16): [True: 66.3k, False: 0]
  ------------------
 1075|  66.3k|        {
 1076|       |             /* check for valid flags */
 1077|  66.3k|            if (*lpsz == '#')
  ------------------
  |  Branch (1077:17): [True: 0, False: 66.3k]
  ------------------
 1078|      0|            {
 1079|      0|                nMaxLen += 2;   /* for '0x' */
 1080|      0|            }
 1081|  66.3k|            else if (*lpsz == '*')
  ------------------
  |  Branch (1081:22): [True: 0, False: 66.3k]
  ------------------
 1082|      0|            {
 1083|      0|                nWidth = va_arg( argList, int );
 1084|      0|            }
 1085|  66.3k|            else if (*lpsz == '-' || *lpsz == '+' || *lpsz == '0'
  ------------------
  |  Branch (1085:22): [True: 142, False: 66.2k]
  |  Branch (1085:38): [True: 3, False: 66.2k]
  |  Branch (1085:54): [True: 0, False: 66.2k]
  ------------------
 1086|  66.3k|                     || *lpsz == ' ')
  ------------------
  |  Branch (1086:25): [True: 0, False: 66.2k]
  ------------------
 1087|    145|            {
 1088|    145|                ;
 1089|    145|            }
 1090|  66.2k|            else /* hit non-flag character */
 1091|  66.2k|            {
 1092|  66.2k|                break;
 1093|  66.2k|            }
 1094|  66.3k|        }
 1095|       |        /* get width and skip it */
 1096|  66.2k|        if (nWidth == 0)
  ------------------
  |  Branch (1096:13): [True: 66.2k, False: 0]
  ------------------
 1097|  66.2k|        {
 1098|       |             /* width indicated by */
 1099|  66.2k|            nWidth = atoi( lpsz );
 1100|  66.2k|            for (; *lpsz && isdigit( *lpsz ); lpsz++)
  ------------------
  |  Branch (1100:20): [True: 66.2k, False: 0]
  ------------------
 1101|      0|            {
 1102|      0|                ;
 1103|      0|            }
 1104|  66.2k|        }
 1105|       |        /*ASSERT(nWidth >= 0);*/
 1106|  66.2k|        if (nWidth < 0)
  ------------------
  |  Branch (1106:13): [True: 0, False: 66.2k]
  ------------------
 1107|      0|        {
 1108|      0|            goto exit_error; /* instead of exception */
 1109|      0|        }
 1110|       |
 1111|  66.2k|        nPrecision = 0;
 1112|  66.2k|        if (*lpsz == '.')
  ------------------
  |  Branch (1112:13): [True: 0, False: 66.2k]
  ------------------
 1113|      0|        {
 1114|       |             /* skip past '.' separator (width.precision)*/
 1115|      0|            lpsz++;
 1116|       |
 1117|       |            /* get precision and skip it*/
 1118|      0|            if (*lpsz == '*')
  ------------------
  |  Branch (1118:17): [True: 0, False: 0]
  ------------------
 1119|      0|            {
 1120|      0|                nPrecision = va_arg( argList, int );
 1121|      0|                lpsz++;
 1122|      0|            }
 1123|      0|            else
 1124|      0|            {
 1125|      0|                nPrecision = atoi( lpsz );
 1126|      0|                for (; *lpsz && isdigit( *lpsz ); lpsz++)
  ------------------
  |  Branch (1126:24): [True: 0, False: 0]
  ------------------
 1127|      0|                {
 1128|      0|                    ;
 1129|      0|                }
 1130|      0|            }
 1131|      0|            if (nPrecision < 0)
  ------------------
  |  Branch (1131:17): [True: 0, False: 0]
  ------------------
 1132|      0|            {
 1133|      0|                goto exit_error; /* instead of exception */
 1134|      0|            }
 1135|      0|        }
 1136|       |
 1137|       |        /* should be on type modifier or specifier */
 1138|  66.2k|        nModifier = 0;
 1139|  66.2k|        switch (*lpsz)
  ------------------
  |  Branch (1139:17): [True: 66.2k, False: 0]
  ------------------
 1140|  66.2k|        {
 1141|       |        /* modifiers that affect size */
 1142|      0|            case 'h':
  ------------------
  |  Branch (1142:13): [True: 0, False: 66.2k]
  ------------------
 1143|      0|                switch (lpsz[1])
 1144|      0|                {
 1145|      0|                    case 'd':
  ------------------
  |  Branch (1145:21): [True: 0, False: 0]
  ------------------
 1146|      0|                    case 'i':
  ------------------
  |  Branch (1146:21): [True: 0, False: 0]
  ------------------
 1147|      0|                    case 'o':
  ------------------
  |  Branch (1147:21): [True: 0, False: 0]
  ------------------
 1148|      0|                    case 'x':
  ------------------
  |  Branch (1148:21): [True: 0, False: 0]
  ------------------
 1149|      0|                    case 'X':
  ------------------
  |  Branch (1149:21): [True: 0, False: 0]
  ------------------
 1150|      0|                    case 'u':
  ------------------
  |  Branch (1150:21): [True: 0, False: 0]
  ------------------
 1151|       |                        /* short unsigned, short double, etc. -- added to the original MS example */
 1152|       |                        /* ignore the fact that these modifiers do affect size */
 1153|      0|                        lpsz++;
 1154|      0|                        break;
 1155|      0|                    default:
  ------------------
  |  Branch (1155:21): [True: 0, False: 0]
  ------------------
 1156|      0|                        nModifier = FORCE_ANSI;
  ------------------
  |  | 1047|      0|#define FORCE_ANSI      0x10000
  ------------------
 1157|      0|                        lpsz++;
 1158|      0|                        break;
 1159|      0|                }
 1160|      0|                break;
 1161|      0|            case 'l':
  ------------------
  |  Branch (1161:13): [True: 0, False: 66.2k]
  ------------------
 1162|      0|                switch (lpsz[1])
 1163|      0|                {
 1164|      0|                    case 'd':
  ------------------
  |  Branch (1164:21): [True: 0, False: 0]
  ------------------
 1165|      0|                    case 'i':
  ------------------
  |  Branch (1165:21): [True: 0, False: 0]
  ------------------
 1166|      0|                    case 'o':
  ------------------
  |  Branch (1166:21): [True: 0, False: 0]
  ------------------
 1167|      0|                    case 'x':
  ------------------
  |  Branch (1167:21): [True: 0, False: 0]
  ------------------
 1168|      0|                    case 'X':
  ------------------
  |  Branch (1168:21): [True: 0, False: 0]
  ------------------
 1169|      0|                    case 'u':
  ------------------
  |  Branch (1169:21): [True: 0, False: 0]
  ------------------
 1170|      0|                    case 'f': /* long float -- post ANSI C */
  ------------------
  |  Branch (1170:21): [True: 0, False: 0]
  ------------------
 1171|       |                        /* long unsigned, long double, etc. -- added to the original MS example */
 1172|       |                        /* ignore the fact that these modifiers do affect size */
 1173|      0|                        lpsz++;
 1174|      0|                        break;
 1175|      0|                    default:
  ------------------
  |  Branch (1175:21): [True: 0, False: 0]
  ------------------
 1176|       |                        /*
 1177|       |                        nModifier = FORCE_UNICODE;
 1178|       |                        lpsz ++;
 1179|       |                        break;
 1180|       |                        */
 1181|      0|                        goto exit_error;  /* no UNICODE, please */
 1182|      0|                }
 1183|      0|                break;
 1184|       |           /* modifiers that do not affect size */
 1185|      0|            case 'F':
  ------------------
  |  Branch (1185:13): [True: 0, False: 66.2k]
  ------------------
 1186|      0|            case 'N':
  ------------------
  |  Branch (1186:13): [True: 0, False: 66.2k]
  ------------------
 1187|      0|            case 'L':
  ------------------
  |  Branch (1187:13): [True: 0, False: 66.2k]
  ------------------
 1188|      0|                lpsz++;
 1189|      0|                break;
 1190|  66.2k|        }
 1191|       |
 1192|       |        /* now should be on specifier */
 1193|  66.2k|        switch (*lpsz | nModifier)
  ------------------
  |  Branch (1193:17): [True: 901, False: 65.3k]
  ------------------
 1194|  66.2k|        {
 1195|       |        /* single characters*/
 1196|      0|            case 'c':
  ------------------
  |  Branch (1196:13): [True: 0, False: 66.2k]
  ------------------
 1197|      0|            case 'C':
  ------------------
  |  Branch (1197:13): [True: 0, False: 66.2k]
  ------------------
 1198|      0|                nItemLen = 2;
 1199|      0|                va_arg( argList, int );
 1200|      0|                break;
 1201|      0|            case 'c' | FORCE_ANSI:
  ------------------
  |  | 1047|      0|#define FORCE_ANSI      0x10000
  ------------------
  |  Branch (1201:13): [True: 0, False: 66.2k]
  ------------------
 1202|      0|            case 'C' | FORCE_ANSI:
  ------------------
  |  | 1047|      0|#define FORCE_ANSI      0x10000
  ------------------
  |  Branch (1202:13): [True: 0, False: 66.2k]
  ------------------
 1203|      0|                nItemLen = 2;
 1204|      0|                va_arg( argList, int );
 1205|      0|                break;
 1206|      0|            case 'c' | FORCE_UNICODE:
  ------------------
  |  | 1048|      0|#define FORCE_UNICODE   0x20000
  ------------------
  |  Branch (1206:13): [True: 0, False: 66.2k]
  ------------------
 1207|      0|            case 'C' | FORCE_UNICODE:
  ------------------
  |  | 1048|      0|#define FORCE_UNICODE   0x20000
  ------------------
  |  Branch (1207:13): [True: 0, False: 66.2k]
  ------------------
 1208|      0|                goto exit_error;  /* no UNICODE, please */
 1209|       |                /*
 1210|       |                nItemLen = 2;
 1211|       |                va_arg(argList, wchar_t);
 1212|       |                break;
 1213|       |                */
 1214|       |
 1215|       |           /* strings*/
 1216|  65.3k|            case 's':
  ------------------
  |  Branch (1216:13): [True: 65.3k, False: 901]
  ------------------
 1217|  65.3k|            case 'S':
  ------------------
  |  Branch (1217:13): [True: 0, False: 66.2k]
  ------------------
 1218|  65.3k|                nItemLen = (int) strlen( va_arg( argList, char* ) );
 1219|  65.3k|                nItemLen = inchi_max( 1, nItemLen );
  ------------------
  |  |  166|  65.3k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 984, False: 64.3k]
  |  |  ------------------
  ------------------
 1220|  65.3k|                break;
 1221|      0|            case 's' | FORCE_ANSI:
  ------------------
  |  | 1047|      0|#define FORCE_ANSI      0x10000
  ------------------
  |  Branch (1221:13): [True: 0, False: 66.2k]
  ------------------
 1222|      0|            case 'S' | FORCE_ANSI:
  ------------------
  |  | 1047|      0|#define FORCE_ANSI      0x10000
  ------------------
  |  Branch (1222:13): [True: 0, False: 66.2k]
  ------------------
 1223|      0|                nItemLen = (int) strlen( va_arg( argList, char* ) );
 1224|      0|                nItemLen = inchi_max( 1, nItemLen );
  ------------------
  |  |  166|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1225|      0|                break;
 1226|       |
 1227|      0|            case 's' | FORCE_UNICODE:
  ------------------
  |  | 1048|      0|#define FORCE_UNICODE   0x20000
  ------------------
  |  Branch (1227:13): [True: 0, False: 66.2k]
  ------------------
 1228|      0|            case 'S' | FORCE_UNICODE:
  ------------------
  |  | 1048|      0|#define FORCE_UNICODE   0x20000
  ------------------
  |  Branch (1228:13): [True: 0, False: 66.2k]
  ------------------
 1229|      0|                goto exit_error;  /* no UNICODE, please */
 1230|       |                /*
 1231|       |                nItemLen = wcslen(va_arg(argList, wchar_t*));
 1232|       |                nItemLen = inchi_max(1, nItemLen);
 1233|       |                break;
 1234|       |                */
 1235|  66.2k|        }
 1236|       |
 1237|       |        /* adjust nItemLen for strings */
 1238|  66.2k|        if (nItemLen != 0)
  ------------------
  |  Branch (1238:13): [True: 65.3k, False: 901]
  ------------------
 1239|  65.3k|        {
 1240|  65.3k|            nItemLen = inchi_max( nItemLen, nWidth );
  ------------------
  |  |  166|  65.3k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 65.3k, False: 0]
  |  |  ------------------
  ------------------
 1241|  65.3k|            if (nPrecision != 0)
  ------------------
  |  Branch (1241:17): [True: 0, False: 65.3k]
  ------------------
 1242|      0|            {
 1243|      0|                nItemLen = inchi_min( nItemLen, nPrecision );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1244|      0|            }
 1245|  65.3k|        }
 1246|    901|        else
 1247|    901|        {
 1248|    901|            switch (*lpsz)
 1249|    901|            {
 1250|       |            /* integers */
 1251|    901|                case 'd':
  ------------------
  |  Branch (1251:17): [True: 901, False: 0]
  ------------------
 1252|    901|                case 'i':
  ------------------
  |  Branch (1252:17): [True: 0, False: 901]
  ------------------
 1253|    901|                case 'u':
  ------------------
  |  Branch (1253:17): [True: 0, False: 901]
  ------------------
 1254|    901|                case 'x':
  ------------------
  |  Branch (1254:17): [True: 0, False: 901]
  ------------------
 1255|    901|                case 'X':
  ------------------
  |  Branch (1255:17): [True: 0, False: 901]
  ------------------
 1256|    901|                case 'o':
  ------------------
  |  Branch (1256:17): [True: 0, False: 901]
  ------------------
 1257|    901|                    va_arg( argList, int );
 1258|    901|                    nItemLen = 32;
 1259|    901|                    nItemLen = inchi_max( nItemLen, nWidth + nPrecision );
  ------------------
  |  |  166|    901|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 901, False: 0]
  |  |  ------------------
  ------------------
 1260|    901|                    break;
 1261|       |
 1262|      0|                case 'e':
  ------------------
  |  Branch (1262:17): [True: 0, False: 901]
  ------------------
 1263|      0|                case 'f':
  ------------------
  |  Branch (1263:17): [True: 0, False: 901]
  ------------------
 1264|      0|                case 'g':
  ------------------
  |  Branch (1264:17): [True: 0, False: 901]
  ------------------
 1265|      0|                case 'G':
  ------------------
  |  Branch (1265:17): [True: 0, False: 901]
  ------------------
 1266|      0|                    va_arg( argList, double );
 1267|      0|                    nItemLen = 32;
 1268|      0|                    nItemLen = inchi_max( nItemLen, nWidth + nPrecision );
  ------------------
  |  |  166|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1269|      0|                    break;
 1270|       |
 1271|      0|                case 'p':
  ------------------
  |  Branch (1271:17): [True: 0, False: 901]
  ------------------
 1272|      0|                    va_arg( argList, void* );
 1273|      0|                    nItemLen = 32;
 1274|      0|                    nItemLen = inchi_max( nItemLen, nWidth + nPrecision );
  ------------------
  |  |  166|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1275|      0|                    break;
 1276|       |
 1277|       |               /* no output */
 1278|      0|                case 'n':
  ------------------
  |  Branch (1278:17): [True: 0, False: 901]
  ------------------
 1279|      0|                    va_arg( argList, int* );
 1280|      0|                    break;
 1281|       |
 1282|      0|                default:
  ------------------
  |  Branch (1282:17): [True: 0, False: 901]
  ------------------
 1283|       |                    /*ASSERT(FALSE);*/  /* unknown formatting option*/
 1284|      0|                    goto exit_error; /* instead of exception */
 1285|    901|            }
 1286|    901|        }
 1287|       |
 1288|       |        /* adjust nMaxLen for output nItemLen */
 1289|  66.2k|        nMaxLen += nItemLen;
 1290|  66.2k|    }
 1291|  68.3k|    return nMaxLen;
 1292|       |
 1293|      0|exit_error:
 1294|      0|    return -1; /* wrong format */
 1295|  68.3k|}
inchi_strbuf_init:
 1351|  54.6k|{
 1352|  54.6k|    char *new_str = NULL;
 1353|  54.6k|    memset( buf, 0, sizeof( *buf ) );
 1354|       |
 1355|  54.6k|    if (start_size <= 0)
  ------------------
  |  Branch (1355:9): [True: 0, False: 54.6k]
  ------------------
 1356|      0|    {
 1357|      0|        start_size = INCHI_STRBUF_INITIAL_SIZE;
  ------------------
  |  |   93|      0|#define INCHI_STRBUF_INITIAL_SIZE 262144
  ------------------
 1358|      0|    }
 1359|  54.6k|    if (incr_size <= 0)
  ------------------
  |  Branch (1359:9): [True: 0, False: 54.6k]
  ------------------
 1360|      0|    {
 1361|      0|        incr_size = INCHI_STRBUF_SIZE_INCREMENT;
  ------------------
  |  |   94|      0|#define INCHI_STRBUF_SIZE_INCREMENT 262144
  ------------------
 1362|      0|    }
 1363|       |
 1364|  54.6k|    new_str = (char *) inchi_calloc( start_size, sizeof( char ) );
  ------------------
  |  | 1133|  54.6k|#define inchi_calloc   calloc
  ------------------
 1365|       |
 1366|  54.6k|    if (!new_str)
  ------------------
  |  Branch (1366:9): [True: 0, False: 54.6k]
  ------------------
 1367|      0|    {
 1368|      0|        return -1;
 1369|      0|    }
 1370|       |
 1371|  54.6k|    buf->pStr = new_str;
 1372|  54.6k|    buf->nAllocatedLength = start_size;
 1373|  54.6k|    buf->nPtr = incr_size;
 1374|       |
 1375|  54.6k|    return start_size;
 1376|  54.6k|}
inchi_strbuf_reset:
 1384|    376|{
 1385|    376|    if (!buf)
  ------------------
  |  Branch (1385:9): [True: 0, False: 376]
  ------------------
 1386|      0|    {
 1387|      0|        return;
 1388|      0|    }
 1389|    376|    if (buf->pStr)
  ------------------
  |  Branch (1389:9): [True: 376, False: 0]
  ------------------
 1390|    376|    {
 1391|    376|        buf->pStr[0] = '\0';
 1392|    376|    }
 1393|       |
 1394|    376|    buf->nUsedLength = buf->nPtr = 0;
 1395|    376|}
inchi_strbuf_close:
 1403|  54.7k|{
 1404|  54.7k|    if (!buf)
  ------------------
  |  Branch (1404:9): [True: 0, False: 54.7k]
  ------------------
 1405|      0|    {
 1406|      0|        return;
 1407|      0|    }
 1408|  54.7k|    if (buf->pStr)
  ------------------
  |  Branch (1408:9): [True: 54.7k, False: 0]
  ------------------
 1409|  54.7k|    {
 1410|  54.7k|        inchi_free( buf->pStr );
  ------------------
  |  | 1136|  54.7k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 54.7k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1411|  54.7k|    }
 1412|       |
 1413|  54.7k|    memset( buf, 0, sizeof( *buf ) );
 1414|  54.7k|}
inchi_strbuf_update:
 1440|  63.6k|{
 1441|  63.6k|    int requsted_len;
 1442|       |
 1443|  63.6k|    if (!buf)
  ------------------
  |  Branch (1443:9): [True: 0, False: 63.6k]
  ------------------
 1444|      0|    {
 1445|      0|        return -1;
 1446|      0|    }
 1447|       |
 1448|  63.6k|    if (new_addition_size <= 0)
  ------------------
  |  Branch (1448:9): [True: 0, False: 63.6k]
  ------------------
 1449|      0|    {
 1450|      0|        return buf->nAllocatedLength;
 1451|      0|    }
 1452|       |
 1453|  63.6k|    requsted_len = buf->nUsedLength + new_addition_size;
 1454|       |
 1455|  63.6k|    if (requsted_len >= buf->nAllocatedLength)
  ------------------
  |  Branch (1455:9): [True: 0, False: 63.6k]
  ------------------
 1456|      0|    {
 1457|       |        /* Expand */
 1458|      0|        int  nAddLength = inchi_max( buf->nPtr, new_addition_size );
  ------------------
  |  |  166|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1459|       |                                    /* buf->nPtr stores size increment for this buffer */
 1460|      0|        char *new_str =
 1461|      0|            (char *) inchi_calloc( buf->nAllocatedLength + nAddLength,
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 1462|      0|                                   sizeof( new_str[0] ) );
 1463|      0|        if (!new_str)
  ------------------
  |  Branch (1463:13): [True: 0, False: 0]
  ------------------
 1464|      0|        {
 1465|      0|            return -1; /* failed */
 1466|      0|        }
 1467|      0|        if (buf->pStr)
  ------------------
  |  Branch (1467:13): [True: 0, False: 0]
  ------------------
 1468|      0|        {
 1469|      0|            if (buf->nUsedLength > 0)
  ------------------
  |  Branch (1469:17): [True: 0, False: 0]
  ------------------
 1470|      0|            {
 1471|      0|                memcpy( new_str, buf->pStr, sizeof( new_str[0] )* buf->nUsedLength );
 1472|      0|            }
 1473|      0|            inchi_free( buf->pStr );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1474|      0|        }
 1475|      0|        buf->pStr = new_str;
 1476|      0|        buf->nAllocatedLength += nAddLength;
 1477|      0|    }
 1478|       |
 1479|  63.6k|    return buf->nAllocatedLength;
 1480|  63.6k|}
inchi_strbuf_printf:
 1488|  63.4k|{
 1489|  63.4k|    int ret = 0, max_len;
 1490|  63.4k|    va_list argList;
 1491|       |
 1492|  63.4k|    if (!buf)
  ------------------
  |  Branch (1492:9): [True: 0, False: 63.4k]
  ------------------
 1493|      0|    {
 1494|      0|        return -1;
 1495|      0|    }
 1496|       |
 1497|  63.4k|    my_va_start( argList, lpszFormat );
  ------------------
  |  |   50|  63.4k|#define my_va_start va_start
  ------------------
 1498|  63.4k|    max_len = GetMaxPrintfLength( lpszFormat, argList );
 1499|  63.4k|    va_end( argList );
 1500|  63.4k|    if (max_len < 0)
  ------------------
  |  Branch (1500:9): [True: 0, False: 63.4k]
  ------------------
 1501|      0|    {
 1502|      0|        return 0;
 1503|      0|    }
 1504|       |
 1505|  63.4k|    inchi_strbuf_update( buf, max_len );
 1506|       |
 1507|  63.4k|    my_va_start( argList, lpszFormat );
  ------------------
  |  |   50|  63.4k|#define my_va_start va_start
  ------------------
 1508|  63.4k|    ret = vsprintf( buf->pStr + buf->nUsedLength, lpszFormat, argList );
 1509|  63.4k|    va_end( argList );
 1510|  63.4k|    if (ret >= 0)
  ------------------
  |  Branch (1510:9): [True: 63.4k, False: 0]
  ------------------
 1511|  63.4k|    {
 1512|  63.4k|        buf->nUsedLength += ret;
 1513|  63.4k|    }
 1514|       |
 1515|  63.4k|    return ret;
 1516|  63.4k|}

TranspositionCreate:
  687|   110k|{
  688|   110k|    p->nAtNumb = (AT_NUMB*) inchi_calloc( n, sizeof( p->nAtNumb[0] ) );
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
  689|   110k|    if (p->nAtNumb)
  ------------------
  |  Branch (689:9): [True: 110k, False: 0]
  ------------------
  690|   110k|    {
  691|   110k|        return 1;
  692|   110k|    }
  693|       |
  694|      0|    return 0;
  695|   110k|}
TranspositionFree:
  700|   110k|{
  701|   110k|    if (p && p->nAtNumb)
  ------------------
  |  Branch (701:9): [True: 110k, False: 0]
  |  Branch (701:14): [True: 110k, False: 0]
  ------------------
  702|   110k|    {
  703|   110k|        inchi_free( p->nAtNumb );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  704|   110k|        p->nAtNumb = NULL;
  705|   110k|    }
  706|   110k|}
NodeSetCreate:
  714|   330k|{
  715|   330k|    int i, len;
  716|       |
  717|   330k|    len = ( n + pCG->m_num_bit - 1 ) / pCG->m_num_bit;
  718|       |
  719|   330k|    pSet->bitword = (bitWord**) inchi_calloc( L, sizeof( pSet->bitword[0] ) );
  ------------------
  |  | 1133|   330k|#define inchi_calloc   calloc
  ------------------
  720|       |
  721|   330k|    if (!pSet->bitword)
  ------------------
  |  Branch (721:9): [True: 0, False: 330k]
  ------------------
  722|      0|    {
  723|      0|        return 0;
  724|      0|    }
  725|   330k|    pSet->bitword[0] = (bitWord*) inchi_calloc( len*L, sizeof( pSet->bitword[0][0] ) );
  ------------------
  |  | 1133|   330k|#define inchi_calloc   calloc
  ------------------
  726|   330k|    if (!pSet->bitword[0])
  ------------------
  |  Branch (726:9): [True: 0, False: 330k]
  ------------------
  727|      0|    {
  728|       |        /* Cleanup */
  729|      0|        inchi_free( pSet->bitword );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  730|      0|        pSet->bitword = NULL;
  731|      0|        return 0; /* failed */
  732|      0|    }
  733|   450M|    for (i = 1; i < L; i++)
  ------------------
  |  Branch (733:17): [True: 450M, False: 330k]
  ------------------
  734|   450M|    {
  735|   450M|        pSet->bitword[i] = pSet->bitword[i - 1] + len;
  736|   450M|    }
  737|       |
  738|   330k|    pSet->len_set = len;
  739|   330k|    pSet->num_set = L;
  740|       |
  741|   330k|    return 1;
  742|   330k|}
NodeSetFree:
  747|   330k|{
  748|   330k|    if (pSet && pSet->bitword)
  ------------------
  |  Branch (748:9): [True: 330k, False: 0]
  |  Branch (748:17): [True: 330k, False: 0]
  ------------------
  749|   330k|    {
  750|   330k|        if (pSet->bitword[0])
  ------------------
  |  Branch (750:13): [True: 330k, False: 0]
  ------------------
  751|   330k|        {
  752|   330k|            inchi_free( pSet->bitword[0] );
  ------------------
  |  | 1136|   330k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 330k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  753|   330k|        }
  754|   330k|        inchi_free( pSet->bitword );
  ------------------
  |  | 1136|   330k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 330k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  755|   330k|        pSet->bitword = NULL;
  756|   330k|    }
  757|   330k|}
CTableCreate:
  762|   440k|{
  763|   440k|    int maxlenCt = pCD->nMaxLenLinearCT + 1; /* add one element for CtPartINCHI_CANON_INFINITY() */
  764|   440k|    int maxlenNumH = pCD->NumH ? ( pCD->maxlenNumH + 1 ) : 0;
  ------------------
  |  Branch (764:22): [True: 110k, False: 330k]
  ------------------
  765|   440k|    int maxlenNumHfixed = pCD->NumHfixed ? ( pCD->maxlenNumHfixed + 1 ) : 0;
  ------------------
  |  Branch (765:27): [True: 11, False: 440k]
  ------------------
  766|   440k|    int maxlenIso = pCD->maxlen_iso_sort_key ? ( pCD->maxlen_iso_sort_key + 1 ) : 0;
  ------------------
  |  Branch (766:21): [True: 73, False: 440k]
  ------------------
  767|   440k|    int maxlenIsoExchg = pCD->iso_exchg_atnos ? ( pCD->maxlen_iso_exchg_atnos + 1 ) : 0;
  ------------------
  |  Branch (767:26): [True: 0, False: 440k]
  ------------------
  768|       |
  769|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
  770|       |    int maxlenIsoHfixed = pCD->maxlen_iso_sort_key_Hfixed ? ( pCD->maxlen_iso_sort_key_Hfixed + 1 ) : 0;
  771|       |#endif
  772|       |
  773|   440k|    memset( Ct, 0, sizeof( Ct[0] ) );
  774|       |
  775|   440k|    Ct->maxVert = n;
  776|       |
  777|   440k|    n++;
  778|       |
  779|   440k|    Ct->Ctbl = (AT_RANK*) inchi_calloc( maxlenCt, sizeof( Ct->Ctbl[0] ) );
  ------------------
  |  | 1133|   440k|#define inchi_calloc   calloc
  ------------------
  780|   440k|    Ct->nextCtblPos = (AT_NUMB*) inchi_calloc( n, sizeof( Ct->nextCtblPos[0] ) );
  ------------------
  |  | 1133|   440k|#define inchi_calloc   calloc
  ------------------
  781|   440k|    Ct->nextAtRank = (AT_RANK*) inchi_calloc( n, sizeof( Ct->nextAtRank[0] ) );
  ------------------
  |  | 1133|   440k|#define inchi_calloc   calloc
  ------------------
  782|   440k|    if (maxlenNumH)
  ------------------
  |  Branch (782:9): [True: 110k, False: 330k]
  ------------------
  783|   110k|    {
  784|   110k|        Ct->NumH = (NUM_H *) inchi_calloc( maxlenNumH, sizeof( Ct->NumH[0] ) );
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
  785|   110k|    }
  786|   440k|    if (maxlenNumHfixed)
  ------------------
  |  Branch (786:9): [True: 11, False: 440k]
  ------------------
  787|     11|    {
  788|     11|        Ct->NumHfixed = (NUM_H *) inchi_calloc( maxlenNumHfixed, sizeof( Ct->NumH[0] ) );
  ------------------
  |  | 1133|     11|#define inchi_calloc   calloc
  ------------------
  789|     11|    }
  790|   440k|    if (maxlenIso)
  ------------------
  |  Branch (790:9): [True: 73, False: 440k]
  ------------------
  791|     73|    {
  792|     73|        Ct->iso_sort_key = (AT_ISO_SORT_KEY *) inchi_calloc( maxlenIso, sizeof( Ct->iso_sort_key[0] ) );
  ------------------
  |  | 1133|     73|#define inchi_calloc   calloc
  ------------------
  793|     73|    }
  794|   440k|    if (maxlenIsoExchg)
  ------------------
  |  Branch (794:9): [True: 0, False: 440k]
  ------------------
  795|      0|    {
  796|      0|        Ct->iso_exchg_atnos = (S_CHAR *) inchi_calloc( maxlenIsoExchg, sizeof( Ct->iso_exchg_atnos[0] ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  797|      0|    }
  798|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
  799|       |    if (maxlenIsoHfixed)
  800|       |    {
  801|       |        Ct->iso_sort_key_Hfixed = (AT_ISO_SORT_KEY *) inchi_calloc( maxlenIsoHfixed, sizeof( Ct->iso_sort_key_Hfixed[0] ) );
  802|       |    }
  803|       |#endif
  804|       |#ifdef INCHI_CANON_USE_HASH
  805|       |    Ct->hash = (CtHash*) inchi_calloc( n, sizeof( Ct->hash[0] ) );
  806|       |#endif
  807|       |
  808|   440k|    Ct->lenCt = 0;
  809|   440k|    Ct->nLenCTAtOnly = pCD->nLenCTAtOnly;
  810|   440k|    Ct->maxlenCt = maxlenCt;
  811|   440k|    Ct->lenNumH = 0;
  812|   440k|    Ct->maxlenNumH = maxlenNumH;
  813|   440k|    Ct->len_iso_sort_key = 0;
  814|   440k|    Ct->maxlen_iso_sort_key = maxlenIso;
  815|   440k|    Ct->len_iso_exchg_atnos = 0;
  816|   440k|    Ct->maxlen_iso_exchg_atnos = maxlenIso;
  817|       |
  818|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
  819|       |    Ct->len_iso_sort_key_Hfixed = 0;
  820|       |    Ct->maxlen_iso_sort_key_Hfixed = maxlenIsoHfixed;
  821|       |#endif
  822|       |
  823|   440k|    Ct->maxPos = n;
  824|   440k|    Ct->lenPos = 0;
  825|   440k|    Ct->nextAtRank[0] = 0;
  826|   440k|    Ct->nextCtblPos[0] = 0;
  827|       |
  828|   440k|    if (Ct->Ctbl && Ct->nextCtblPos &&
  ------------------
  |  Branch (828:9): [True: 440k, False: 0]
  |  Branch (828:21): [True: 440k, False: 0]
  ------------------
  829|   440k|        ( !maxlenNumH || Ct->NumH ) &&
  ------------------
  |  Branch (829:11): [True: 330k, False: 110k]
  |  Branch (829:26): [True: 110k, False: 0]
  ------------------
  830|   440k|        ( !maxlenNumHfixed || Ct->NumHfixed ))
  ------------------
  |  Branch (830:11): [True: 440k, False: 11]
  |  Branch (830:31): [True: 11, False: 0]
  ------------------
  831|   440k|    {
  832|   440k|        return 1;
  833|   440k|    }
  834|       |
  835|      0|    return 0;
  836|   440k|}
CTableFree:
  841|   440k|{
  842|   440k|    if (Ct)
  ------------------
  |  Branch (842:9): [True: 440k, False: 0]
  ------------------
  843|   440k|    {
  844|   440k|        if (Ct->Ctbl)
  ------------------
  |  Branch (844:13): [True: 330k, False: 110k]
  ------------------
  845|   330k|        {
  846|   330k|            inchi_free( Ct->Ctbl );
  ------------------
  |  | 1136|   330k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 330k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  847|   330k|        }
  848|   440k|        if (Ct->nextCtblPos)
  ------------------
  |  Branch (848:13): [True: 440k, False: 0]
  ------------------
  849|   440k|        {
  850|   440k|            inchi_free( Ct->nextCtblPos );
  ------------------
  |  | 1136|   440k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 440k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  851|   440k|        }
  852|   440k|        if (Ct->nextAtRank)
  ------------------
  |  Branch (852:13): [True: 440k, False: 0]
  ------------------
  853|   440k|        {
  854|   440k|            inchi_free( Ct->nextAtRank );
  ------------------
  |  | 1136|   440k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 440k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  855|   440k|        }
  856|   440k|        if (Ct->NumH)
  ------------------
  |  Branch (856:13): [True: 94, False: 440k]
  ------------------
  857|     94|        {
  858|     94|            inchi_free( Ct->NumH );
  ------------------
  |  | 1136|     94|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 94, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  859|     94|        }
  860|   440k|        if (Ct->NumHfixed)
  ------------------
  |  Branch (860:13): [True: 8, False: 440k]
  ------------------
  861|      8|        {
  862|      8|            inchi_free( Ct->NumHfixed );
  ------------------
  |  | 1136|      8|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 8, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  863|      8|        }
  864|   440k|        if (Ct->iso_sort_key)
  ------------------
  |  Branch (864:13): [True: 26, False: 440k]
  ------------------
  865|     26|        {
  866|     26|            inchi_free( Ct->iso_sort_key );
  ------------------
  |  | 1136|     26|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 26, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  867|     26|        }
  868|   440k|        if (Ct->iso_exchg_atnos)
  ------------------
  |  Branch (868:13): [True: 0, False: 440k]
  ------------------
  869|      0|        {
  870|      0|            inchi_free( Ct->iso_exchg_atnos );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  871|      0|        }
  872|       |
  873|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
  874|       |        if (Ct->iso_sort_key_Hfixed)
  875|       |        {
  876|       |            inchi_free( Ct->iso_sort_key_Hfixed );
  877|       |        }
  878|       |#endif
  879|       |
  880|       |#ifdef INCHI_CANON_USE_HASH
  881|       |        if (Ct->hash)
  882|       |        {
  883|       |            inchi_free( Ct->hash );
  884|       |        }
  885|       |#endif
  886|       |
  887|   440k|        memset( Ct, 0, sizeof( Ct[0] ) );
  888|   440k|    }
  889|   440k|}
UnorderedPartitionCreate:
  894|   220k|{
  895|   220k|    p->equ2 = (AT_NUMB*) inchi_calloc( n, sizeof( p->equ2[0] ) );
  ------------------
  |  | 1133|   220k|#define inchi_calloc   calloc
  ------------------
  896|       |    /* p->next = (AT_NUMB*)inchi_calloc( n, sizeof(p->next[0])); */
  897|       |
  898|   220k|    if (p->equ2 /*&& p->next*/)
  ------------------
  |  Branch (898:9): [True: 220k, False: 0]
  ------------------
  899|   220k|    {
  900|   220k|        return 1;
  901|   220k|    }
  902|       |
  903|      0|    return 0;
  904|   220k|}
UnorderedPartitionFree:
  909|   220k|{
  910|   220k|    if (p->equ2)
  ------------------
  |  Branch (910:9): [True: 220k, False: 0]
  ------------------
  911|   220k|    {
  912|   220k|        inchi_free( p->equ2 );
  ------------------
  |  | 1136|   220k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 220k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  913|   220k|    }
  914|       |
  915|       |    /* if (p->next) inchi_free( p->next); */
  916|   220k|    p->equ2 = NULL;
  917|       |    /* p->next = NULL; */
  918|   220k|}
UnorderedPartitionMakeDiscrete:
  923|   110k|{
  924|   110k|    int i;
  925|   224k|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (925:17): [True: 114k, False: 110k]
  ------------------
  926|   114k|    {
  927|   114k|        p->equ2[i] = (AT_NUMB) i;
  928|       |        /* p->next[i] = INCHI_CANON_INFINITY; */
  929|   114k|    }
  930|   110k|    INCHI_HEAPCHK
  931|   110k|}
PartitionCreate:
  936|   220k|{
  937|   220k|    p->AtNumber = (AT_NUMB*) inchi_calloc( n, sizeof( p->AtNumber[0] ) );
  ------------------
  |  | 1133|   220k|#define inchi_calloc   calloc
  ------------------
  938|   220k|    p->Rank = (AT_RANK*) inchi_calloc( n, sizeof( p->Rank[0] ) );
  ------------------
  |  | 1133|   220k|#define inchi_calloc   calloc
  ------------------
  939|   220k|    if (p->AtNumber && p->Rank)
  ------------------
  |  Branch (939:9): [True: 220k, False: 0]
  |  Branch (939:24): [True: 220k, False: 0]
  ------------------
  940|   220k|    {
  941|   220k|        return 1;
  942|   220k|    }
  943|      0|    return 0;
  944|   220k|}
PartitionFree:
  949|   660k|{
  950|   660k|    if (p)
  ------------------
  |  Branch (950:9): [True: 660k, False: 0]
  ------------------
  951|   660k|    {
  952|   660k|        if (p->AtNumber)
  ------------------
  |  Branch (952:13): [True: 330k, False: 330k]
  ------------------
  953|   330k|        {
  954|   330k|            inchi_free( p->AtNumber );
  ------------------
  |  | 1136|   330k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 330k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  955|   330k|            p->AtNumber = NULL;
  956|   330k|        }
  957|   660k|        if (p->Rank)
  ------------------
  |  Branch (957:13): [True: 330k, False: 330k]
  ------------------
  958|   330k|        {
  959|   330k|            inchi_free( p->Rank );
  ------------------
  |  | 1136|   330k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 330k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  960|   330k|            p->Rank = NULL;
  961|   330k|        }
  962|   660k|    }
  963|   660k|}
PartitionIsDiscrete:
  968|   276k|{
  969|   276k|    int i;
  970|   276k|    AT_RANK r;
  971|  15.2M|    for (i = 0, r = 1; i < n; i++, r++)
  ------------------
  |  Branch (971:24): [True: 15.1M, False: 113k]
  ------------------
  972|  15.1M|    {
  973|  15.1M|        if (r != ( rank_mask_bit & p->Rank[p->AtNumber[i]] ))
  ------------------
  |  Branch (973:13): [True: 163k, False: 14.9M]
  ------------------
  974|   163k|        {
  975|   163k|            INCHI_HEAPCHK
  976|   163k|            return 0;
  977|   163k|        }
  978|  15.1M|    }
  979|       |
  980|       |    INCHI_HEAPCHK
  981|       |
  982|   113k|    return 1;
  983|   276k|}
PartitionGetFirstCell:
  988|   163k|{
  989|   163k|    int i;
  990|   163k|    AT_RANK r;
  991|   163k|    Cell *W = baseW + k - 1;
  992|       |
  993|   163k|    i = ( k > 1 ) ? baseW[k - 2].first + 1 : 0;
  ------------------
  |  Branch (993:9): [True: 162k, False: 204]
  ------------------
  994|       |
  995|   163k|    if (i < n)
  ------------------
  |  Branch (995:9): [True: 163k, False: 0]
  ------------------
  996|   163k|    {
  997|       |        /* bypass single vertex cells */
  998|   166k|        for (r = (AT_RANK) ( i + 1 ); i < n && r == ( rank_mask_bit & p->Rank[(int) p->AtNumber[i]] ); i++, r++)
  ------------------
  |  Branch (998:39): [True: 166k, False: 0]
  |  Branch (998:48): [True: 3.18k, False: 163k]
  ------------------
  999|  3.18k|        {
 1000|  3.18k|            ;
 1001|  3.18k|        }
 1002|   163k|    }
 1003|   163k|    if (i < n)
  ------------------
  |  Branch (1003:9): [True: 163k, False: 0]
  ------------------
 1004|   163k|    {
 1005|   163k|        W->first = i;
 1006|   163k|        for (r = ( rank_mask_bit & p->Rank[(int) p->AtNumber[i]] ), i++;
 1007|  6.75M|              i < n && r == ( rank_mask_bit & p->Rank[(int) p->AtNumber[i]] );
  ------------------
  |  Branch (1007:15): [True: 6.73M, False: 19.9k]
  |  Branch (1007:24): [True: 6.59M, False: 143k]
  ------------------
 1008|  6.59M|              i++)
 1009|  6.59M|        {
 1010|  6.59M|            ;
 1011|  6.59M|        }
 1012|   163k|        W->next = i;
 1013|       |
 1014|       |        INCHI_HEAPCHK
 1015|       |
 1016|   163k|        return ( W->next - W->first );
 1017|   163k|    }
 1018|       |
 1019|      0|    W->first = INCHI_CANON_INFINITY;
  ------------------
  |  |   58|      0|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
 1020|      0|    W->next = 0;
 1021|       |
 1022|       |    INCHI_HEAPCHK
 1023|       |
 1024|      0|    return 0;
 1025|   163k|}
CellMakeEmpty:
 1030|   163k|{
 1031|   163k|    k--;
 1032|   163k|    baseW[k].first = INCHI_CANON_INFINITY;
  ------------------
  |  |   58|   163k|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
 1033|   163k|    baseW[k].next = 0;
 1034|   163k|    baseW[k].prev = -1;
 1035|       |
 1036|   163k|    INCHI_HEAPCHK
 1037|   163k|}
PartitionGetTransposition:
 1278|  3.11k|{
 1279|  3.11k|    int i;
 1280|       |
 1281|   333k|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (1281:17): [True: 330k, False: 3.11k]
  ------------------
 1282|   330k|    {
 1283|   330k|        gamma->nAtNumb[(int) pFrom->AtNumber[i]] = pTo->AtNumber[i];
 1284|   330k|    }
 1285|       |
 1286|  3.11k|    INCHI_HEAPCHK
 1287|  3.11k|}
nGetMcr2:
 1295|   706k|{
 1296|   706k|    AT_RANK n1, n2, mcr; /*  recursive version is much shorter. */
 1297|       |
 1298|       |    INCHI_HEAPCHK
 1299|       |
 1300|   706k|    n1 = nEqArray[(int) n];
 1301|       |
 1302|   706k|    if (n == n1)
  ------------------
  |  Branch (1302:9): [True: 395k, False: 311k]
  ------------------
 1303|   395k|    {
 1304|   395k|        return n;
 1305|   395k|    }
 1306|       |
 1307|       |    /*  1st pass: find mcr */
 1308|   456k|    while (n1 != ( n2 = nEqArray[(int) n1] ))
  ------------------
  |  Branch (1308:12): [True: 144k, False: 311k]
  ------------------
 1309|   144k|    {
 1310|   144k|        n1 = n2;
 1311|   144k|    }
 1312|       |
 1313|       |    /*  2nd pass: copy mcr to each element of the set starting from nEqArray[n] */
 1314|   311k|    mcr = n1;
 1315|   311k|    n1 = n;
 1316|   456k|    while ( /*n1*/ mcr != ( n2 = nEqArray[(int) n1] ))
  ------------------
  |  Branch (1316:20): [True: 144k, False: 311k]
  ------------------
 1317|   144k|    {
 1318|   144k|        nEqArray[(int) n1] = mcr;
 1319|   144k|        n1 = n2;
 1320|   144k|    }
 1321|       |
 1322|       |    INCHI_HEAPCHK
 1323|       |
 1324|   311k|    return ( mcr );
 1325|   706k|}
nJoin2Mcrs2:
 1332|  3.11k|{
 1333|  3.11k|    n1 = nGetMcr2( nEqArray, n1 );
 1334|  3.11k|    n2 = nGetMcr2( nEqArray, n2 );
 1335|       |
 1336|  3.11k|    if (n1 < n2)
  ------------------
  |  Branch (1336:9): [True: 0, False: 3.11k]
  ------------------
 1337|      0|    {
 1338|      0|        nEqArray[n2] = n1;
 1339|       |
 1340|       |        INCHI_HEAPCHK
 1341|       |
 1342|      0|        return 1; /*  a change has been made */
 1343|      0|    }
 1344|       |
 1345|  3.11k|    if (n2 < n1)
  ------------------
  |  Branch (1345:9): [True: 3.11k, False: 0]
  ------------------
 1346|  3.11k|    {
 1347|  3.11k|        nEqArray[n1] = n2;
 1348|       |
 1349|       |        INCHI_HEAPCHK
 1350|       |
 1351|  3.11k|        return 1; /*  a change has been made */
 1352|  3.11k|    }
 1353|       |
 1354|       |    INCHI_HEAPCHK
 1355|       |
 1356|      0|    return 0; /*  no changes */
 1357|  3.11k|}
GetUnorderedPartitionMcrNode:
 1362|   700k|{
 1363|   700k|    Node ret = (Node) ( 1 + nGetMcr2( p1->equ2, (AT_RANK) ( v - 1 ) ) );
 1364|       |
 1365|       |    INCHI_HEAPCHK
 1366|       |
 1367|   700k|    return ret;
 1368|   700k|}
UnorderedPartitionJoin:
 1377|  3.11k|{
 1378|  3.11k|    int i, j;
 1379|  3.11k|    int nNumChanges = 0;
 1380|   333k|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (1380:17): [True: 330k, False: 3.11k]
  ------------------
 1381|   330k|    {
 1382|   330k|        if (( j = (int) p1->equ2[i] ) == i || p2->equ2[(int) i] == p2->equ2[(int) j])
  ------------------
  |  Branch (1382:13): [True: 326k, False: 3.11k]
  |  Branch (1382:47): [True: 0, False: 3.11k]
  ------------------
 1383|   326k|        {
 1384|   326k|            continue;
 1385|   326k|        }
 1386|  3.11k|        nNumChanges += nJoin2Mcrs2( p2->equ2, (AT_NUMB) i, (AT_NUMB) j );
 1387|  3.11k|    }
 1388|       |
 1389|       |    INCHI_HEAPCHK
 1390|       |
 1391|  3.11k|    return nNumChanges;
 1392|  3.11k|}
PartitionSatisfiesLemma_2_25:
 1397|  86.9k|{
 1398|  86.9k|    int nPartitionSize = 0;
 1399|  86.9k|    int nNumNonTrivialCells = 0;
 1400|  86.9k|    AT_RANK r;
 1401|  86.9k|    int i, num;
 1402|       |
 1403|  11.6M|    for (i = num = 0, r = 1; i < n; i++, r++)
  ------------------
  |  Branch (1403:30): [True: 11.5M, False: 86.9k]
  ------------------
 1404|  11.5M|    {
 1405|  11.5M|        if (( rank_mask_bit & p->Rank[(int) p->AtNumber[i]] ) == r)
  ------------------
  |  Branch (1405:13): [True: 7.73M, False: 3.84M]
  ------------------
 1406|  7.73M|        {
 1407|  7.73M|            nPartitionSize++;
 1408|  7.73M|            if (num)
  ------------------
  |  Branch (1408:17): [True: 134k, False: 7.60M]
  ------------------
 1409|   134k|            {
 1410|       |                /* num+1 = cell size > 1 */
 1411|   134k|                nNumNonTrivialCells++;
 1412|   134k|                num = 0;
 1413|   134k|            }
 1414|  7.73M|        }
 1415|  3.84M|        else
 1416|  3.84M|        {
 1417|  3.84M|            num++;
 1418|  3.84M|        }
 1419|  11.5M|    }
 1420|       |
 1421|       |    /* check Lemma_2_25 conditions */
 1422|  86.9k|    if (n <= nPartitionSize + 4 ||
  ------------------
  |  Branch (1422:9): [True: 6.94k, False: 80.0k]
  ------------------
 1423|  86.9k|         n == nPartitionSize + nNumNonTrivialCells ||
  ------------------
  |  Branch (1423:10): [True: 0, False: 80.0k]
  ------------------
 1424|  86.9k|         n == nPartitionSize + nNumNonTrivialCells + 1)
  ------------------
  |  Branch (1424:10): [True: 0, False: 80.0k]
  ------------------
 1425|  6.94k|    {
 1426|  6.94k|        return 1;
 1427|  6.94k|    }
 1428|       |
 1429|  80.0k|    return 0;
 1430|  86.9k|}
PartitionCopy:
 1435|   276k|{
 1436|   276k|    int i;
 1437|   276k|    memcpy( To->AtNumber, From->AtNumber, n * sizeof( To->AtNumber[0] ) );
 1438|   276k|    memcpy( To->Rank, From->Rank, n * sizeof( To->AtNumber[0] ) );
 1439|       |
 1440|  23.0M|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (1440:17): [True: 22.7M, False: 276k]
  ------------------
 1441|  22.7M|    {
 1442|  22.7M|        To->Rank[i] &= rank_mask_bit;
 1443|  22.7M|    }
 1444|       |
 1445|   276k|    INCHI_HEAPCHK
 1446|   276k|}
PartitionColorVertex:
 1462|   166k|{
 1463|   166k|    int     nNumNewRanks, i, j;
 1464|   166k|    long    lNumNeighListIter = 0;
 1465|   166k|    AT_RANK rv, r;
 1466|   166k|    AT_NUMB s, sv;
 1467|       |
 1468|   499k|    for (i = 1; i <= 2; i++)
  ------------------
  |  Branch (1468:17): [True: 333k, False: 166k]
  ------------------
 1469|   333k|    {
 1470|   333k|        if (!p[i].AtNumber)
  ------------------
  |  Branch (1470:13): [True: 2.14k, False: 330k]
  ------------------
 1471|  2.14k|        {
 1472|  2.14k|            p[i].AtNumber = (AT_NUMB *) inchi_malloc( n_max * sizeof( p[0].AtNumber[0] ) );
  ------------------
  |  | 1130|  2.14k|#define inchi_malloc   malloc
  ------------------
 1473|  2.14k|        }
 1474|   333k|        if (!p[i].Rank)
  ------------------
  |  Branch (1474:13): [True: 2.14k, False: 330k]
  ------------------
 1475|  2.14k|        {
 1476|  2.14k|            p[i].Rank = (AT_RANK *) inchi_malloc( n_max * sizeof( p[0].Rank[0] ) );
  ------------------
  |  | 1130|  2.14k|#define inchi_malloc   malloc
  ------------------
 1477|  2.14k|        }
 1478|   333k|        if (!p[i].AtNumber || !p[i].Rank)
  ------------------
  |  Branch (1478:13): [True: 0, False: 333k]
  |  Branch (1478:31): [True: 0, False: 333k]
  ------------------
 1479|      0|        {
 1480|       |
 1481|       |            INCHI_HEAPCHK
 1482|       |
 1483|      0|            return CT_OUT_OF_RAM;
  ------------------
  |  |   49|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1484|      0|        }
 1485|   333k|    }
 1486|       |
 1487|   166k|    PartitionCopy( p + 1, p, n_tg );
 1488|       |
 1489|   166k|    sv = v - 1;          /* atom number we are looking for */
 1490|   166k|    if (sv >= (AT_NUMB) n_tg)
  ------------------
  |  Branch (1490:9): [True: 0, False: 166k]
  ------------------
 1491|      0|    {
 1492|       |
 1493|       |        INCHI_HEAPCHK
 1494|       |
 1495|      0|        return CT_CANON_ERR; /* !!! severe program error: sv not found !!! */
  ------------------
  |  |   63|      0|#define CT_CANON_ERR         (CT_ERR_FIRST-16)  /*(-30016) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1496|      0|    }
 1497|       |
 1498|   166k|    rv = p[1].Rank[(int) sv];  /* rank of this atom */
 1499|       |
 1500|       |    /* second, locate sv among all vertices that have same rank as v */
 1501|   166k|    s = n_max + 1; /* always greater than sv; this initialization is needed only to keep the compiler happy */
 1502|  6.91M|    for (j = (int) rv - 1; 0 <= j && rv == ( r = p[1].Rank[(int) ( s = p[1].AtNumber[j] )] ) && s != sv; j--)
  ------------------
  |  Branch (1502:28): [True: 6.91M, False: 0]
  |  Branch (1502:38): [True: 6.91M, False: 0]
  |  Branch (1502:97): [True: 6.74M, False: 166k]
  ------------------
 1503|  6.74M|    {
 1504|  6.74M|        ;
 1505|  6.74M|    }
 1506|       |
 1507|   166k|    if (s != sv)
  ------------------
  |  Branch (1507:9): [True: 0, False: 166k]
  ------------------
 1508|      0|    {
 1509|      0|        INCHI_HEAPCHK
 1510|      0|        return CT_CANON_ERR; /* !!! severe program error: sv not found !!! */
  ------------------
  |  |   63|      0|#define CT_CANON_ERR         (CT_ERR_FIRST-16)  /*(-30016) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1511|      0|    }
 1512|       |
 1513|       |    /* shift preceding atom numbers to the right to fill the gap after removing sv */
 1514|   166k|    r = rv - 1; /* initialization only to keep compiler happy */
 1515|   181k|    for (i = j--; 0 <= j && rv == ( r = p[1].Rank[(int) ( s = p[1].AtNumber[j] )] ); i = j, j--)
  ------------------
  |  Branch (1515:19): [True: 181k, False: 327]
  |  Branch (1515:29): [True: 15.2k, False: 166k]
  ------------------
 1516|  15.2k|    {
 1517|  15.2k|        p[1].AtNumber[i] = s;
 1518|  15.2k|    }
 1519|       |
 1520|   166k|    r = ( i > 0 ) ? ( r + 1 ) : 1;  /* new reduced rank = (next lower rank)+1 or 1 */
  ------------------
  |  Branch (1520:9): [True: 166k, False: 327]
  ------------------
 1521|       |    /* insert sv and adjust its rank */
 1522|   166k|    p[1].AtNumber[i] = sv;
 1523|   166k|    p[1].Rank[(int) sv] = r;
 1524|       |
 1525|       |
 1526|       |    /* make equitable partition */
 1527|   166k|    if (bDigraph)
  ------------------
  |  Branch (1527:9): [True: 77.7k, False: 88.7k]
  ------------------
 1528|  77.7k|    {
 1529|       |        /*
 1530|       |        nNumNewRanks = DifferentiateRanks2( pCG, n_tg, G,
 1531|       |                                         nNumPrevRanks+1, p[1].Rank, p[2].Rank,
 1532|       |                                         p[1].AtNumber, &lNumNeighListIter, 1 );
 1533|       |        */
 1534|  77.7k|        nNumNewRanks = DifferentiateRanks4( pCG, n_tg, G,
 1535|  77.7k|                                         nNumPrevRanks + 1, p[1].Rank, p[2].Rank /* temp array */,
 1536|  77.7k|                                         p[1].AtNumber, (AT_RANK) n, &lNumNeighListIter );
 1537|  77.7k|    }
 1538|  88.7k|    else
 1539|  88.7k|    {
 1540|       |         /*
 1541|       |         nNumNewRanks = DifferentiateRanks2( pCG, n_tg, G,
 1542|       |                                          nNumPrevRanks+1, p[1].Rank, p[2].Rank,
 1543|       |                                          p[1].AtNumber, &lNumNeighListIter, 1 );
 1544|       |         */
 1545|  88.7k|        nNumNewRanks = DifferentiateRanks3( pCG, n_tg, G,
 1546|  88.7k|                                         nNumPrevRanks + 1, p[1].Rank, p[2].Rank /* temp array */,
 1547|  88.7k|                                         p[1].AtNumber, &lNumNeighListIter );
 1548|  88.7k|    }
 1549|   166k|    INCHI_HEAPCHK
 1550|       |
 1551|   166k|    return nNumNewRanks;
 1552|   166k|}
CellGetMinNode:
 1576|   323k|{
 1577|   323k|    AT_NUMB i;
 1578|   323k|    AT_NUMB uCurAtNumb, uMinAtNumb = INCHI_CANON_INFINITY;
  ------------------
  |  |   58|   323k|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
 1579|       |
 1580|       |    /* in case of emty cell:  (W->first=INCHI_CANON_INFINITY) > (W->next=0); returns INCHI_CANON_INFINITY */
 1581|   323k|    if (W->first > W->next)
  ------------------
  |  Branch (1581:9): [True: 0, False: 323k]
  ------------------
 1582|      0|    {
 1583|      0|        return INCHI_CANON_INFINITY;
  ------------------
  |  |   58|      0|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
 1584|      0|    }
 1585|       |
 1586|   323k|#if ( USE_AUX_RANKING == 1 )
 1587|   323k|    if (pCD && pCD->nAuxRank)
  ------------------
  |  Branch (1587:9): [True: 323k, False: 0]
  |  Branch (1587:16): [True: 152k, False: 171k]
  ------------------
 1588|   152k|    {
 1589|   152k|        AT_RANK uMinAuxRank, uCurAuxRank;
 1590|   152k|        int     nCurAtNumb;
 1591|       |
 1592|   152k|#if ( USE_AUX_RANKING_ALL == 1 )
 1593|   152k|        AT_RANK uInpAuxRank;
 1594|   152k|        int     nInpAtNumb, nMinAtNumb;
 1595|   152k|#endif
 1596|       |
 1597|   152k|        for (i = W->first; i < W->next; i++)
  ------------------
  |  Branch (1597:28): [True: 152k, False: 0]
  ------------------
 1598|   152k|        {
 1599|   152k|            uCurAtNumb = p->AtNumber[(int) i];
 1600|   152k|            if (!( p->Rank[(int) uCurAtNumb] & rank_mark_bit ))
  ------------------
  |  Branch (1600:17): [True: 152k, False: 0]
  ------------------
 1601|   152k|            {
 1602|   152k|                break; /* found the first unmarked yet node */
 1603|   152k|            }
 1604|   152k|        }
 1605|   152k|        if (i == W->next)
  ------------------
  |  Branch (1605:13): [True: 0, False: 152k]
  ------------------
 1606|      0|        {
 1607|      0|            return INCHI_CANON_INFINITY;
  ------------------
  |  |   58|      0|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
 1608|      0|        }
 1609|       |
 1610|   152k|#if ( USE_AUX_RANKING_ALL == 1 )
 1611|       |        /*==== vertex ordering definition ===
 1612|       |         * vertex v1 < v2 <=> (AuxRank(v1)==AuxRank(v2) && AtNumb(v1) < AtNumb(v2)) || (AuxRank(v1) < AuxRank(v2))
 1613|       |         * vertex v1 > v2 <=> (AuxRank(v1)==AuxRank(v2) && AtNumb(v1) > AtNumb(v2)) || (AuxRank(v1) > AuxRank(v2))
 1614|       |         * vertex v1 = v2 <=> (AuxRank(v1)==AuxRank(v2) && AtNumb(v1) == AtNumb(v2))
 1615|       |         */
 1616|       |
 1617|       |        /* set initial vMin so that vMin > any vertex */
 1618|   152k|        uMinAuxRank = INCHI_CANON_INFINITY;
  ------------------
  |  |   58|   152k|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
 1619|   152k|        nMinAtNumb = INCHI_CANON_INFINITY;
  ------------------
  |  |   58|   152k|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
 1620|       |        /* set vInp */
 1621|   152k|        if (v)
  ------------------
  |  Branch (1621:13): [True: 74.9k, False: 77.5k]
  ------------------
 1622|  74.9k|        {
 1623|  74.9k|            nInpAtNumb = (int) v - 1; /* previous vertex */
 1624|  74.9k|            uInpAuxRank = pCD->nAuxRank[nInpAtNumb];
 1625|  74.9k|        }
 1626|  77.5k|        else
 1627|  77.5k|        {
 1628|  77.5k|            nInpAtNumb = -1; /* less than any vertex */
 1629|  77.5k|            uInpAuxRank = 0;
 1630|  77.5k|        }
 1631|       |        /* find vMin = min { vCur : (vCur > vInp) && (vCur in W) } */
 1632|  10.1M|        for (; i < W->next; i++)
  ------------------
  |  Branch (1632:16): [True: 9.94M, False: 152k]
  ------------------
 1633|  9.94M|        {
 1634|  9.94M|            nCurAtNumb = (int) p->AtNumber[(int) i];
 1635|  9.94M|            if (!( p->Rank[nCurAtNumb] & rank_mark_bit ))
  ------------------
  |  Branch (1635:17): [True: 9.94M, False: 0]
  ------------------
 1636|  9.94M|            {
 1637|       |                /* vertex nCurAtNumb is not marked, find whether it fits the conditions */
 1638|  9.94M|                uCurAuxRank = pCD->nAuxRank[nCurAtNumb];
 1639|  9.94M|                if (uCurAuxRank == uInpAuxRank && nCurAtNumb > nInpAtNumb || uCurAuxRank > uInpAuxRank)
  ------------------
  |  Branch (1639:21): [True: 6.61M, False: 3.33M]
  |  Branch (1639:51): [True: 3.26M, False: 3.34M]
  |  Branch (1639:78): [True: 3.30M, False: 3.37M]
  ------------------
 1640|  6.57M|                {
 1641|       |                    /* here vCur > vInp */
 1642|  6.57M|                    if (uCurAuxRank == uMinAuxRank && nCurAtNumb < nMinAtNumb)
  ------------------
  |  Branch (1642:25): [True: 6.34M, False: 228k]
  |  Branch (1642:55): [True: 0, False: 6.34M]
  ------------------
 1643|      0|                    {
 1644|       |                        /* vCur < vMin (1) */
 1645|      0|                        nMinAtNumb = nCurAtNumb;
 1646|      0|                    }
 1647|  6.57M|                    else if (uCurAuxRank < uMinAuxRank)
  ------------------
  |  Branch (1647:30): [True: 156k, False: 6.41M]
  ------------------
 1648|   156k|                    {
 1649|       |                        /* vCur < vMin (2) */
 1650|   156k|                        uMinAuxRank = uCurAuxRank;
 1651|   156k|                        nMinAtNumb = nCurAtNumb;
 1652|   156k|                    }
 1653|  6.57M|                }
 1654|  9.94M|            }
 1655|  9.94M|        }
 1656|       |
 1657|   152k|        uMinAtNumb = ( nMinAtNumb == INCHI_CANON_INFINITY ) ? INCHI_CANON_INFINITY : (AT_NUMB) nMinAtNumb;
  ------------------
  |  |   58|   152k|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
                      uMinAtNumb = ( nMinAtNumb == INCHI_CANON_INFINITY ) ? INCHI_CANON_INFINITY : (AT_NUMB) nMinAtNumb;
  ------------------
  |  |   58|  1.23k|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
  |  Branch (1657:22): [True: 1.23k, False: 151k]
  ------------------
 1658|       |
 1659|       |#else
 1660|       |
 1661|       |        if (v)
 1662|       |        {
 1663|       |            nCurAtNumb = (int) v - 1;
 1664|       |            /* any valid found node must have nAuxRank == uMinAuxRank */
 1665|       |            uMinAuxRank = pCD->nAuxRank[nCurAtNumb];
 1666|       |        }
 1667|       |        else
 1668|       |        {
 1669|       |            /* any valid found node must have minimal uMinAuxRank from pCD->nAuxRank[] */
 1670|       |            uMinAuxRank = INCHI_CANON_INFINITY; /* undefined */
 1671|       |        }
 1672|       |
 1673|       |        for (; i < W->next; i++)
 1674|       |        {
 1675|       |            uCurAtNumb = p->AtNumber[(int) i];
 1676|       |            nCurAtNumb = (int) uCurAtNumb;
 1677|       |            if (uCurAtNumb >= v && !( p->Rank[nCurAtNumb] & rank_mark_bit ))
 1678|       |            {
 1679|       |                uCurAuxRank = pCD->nAuxRank[nCurAtNumb];
 1680|       |                if (v)
 1681|       |                {
 1682|       |                    /* get next node */
 1683|       |                    /* find node with smallest uCurAtNumb among nodes with aux. ranks equal to uMinAuxRank */
 1684|       |                    if (uCurAuxRank == uMinAuxRank && uCurAtNumb < uMinAtNumb)
 1685|       |                    {
 1686|       |                        uMinAtNumb = uCurAtNumb;
 1687|       |                    }
 1688|       |                }
 1689|       |                else
 1690|       |                {
 1691|       |                    /* get first node */
 1692|       |                    /* find node with smallest smallest uCurAtNumb among nodes with smallest aux. ranks */
 1693|       |                    if (uMinAuxRank > uCurAuxRank)
 1694|       |                    {
 1695|       |                        uMinAuxRank = uCurAuxRank;
 1696|       |                        uMinAtNumb = uCurAtNumb;
 1697|       |                    }
 1698|       |                    else
 1699|       |                    {
 1700|       |                        if (uMinAuxRank == uCurAuxRank && uCurAtNumb < uMinAtNumb)
 1701|       |                        {
 1702|       |                            uMinAtNumb = uCurAtNumb;
 1703|       |                        }
 1704|       |                    }
 1705|       |                }
 1706|       |            }
 1707|       |        }
 1708|       |#endif
 1709|   152k|    }
 1710|       |
 1711|   171k|    else
 1712|   171k|#endif /* } USE_AUX_RANKING */
 1713|       |
 1714|   171k|    {
 1715|  10.7M|        for (i = W->first; i < W->next; i++)
  ------------------
  |  Branch (1715:28): [True: 10.5M, False: 171k]
  ------------------
 1716|  10.5M|        {
 1717|  10.5M|            uCurAtNumb = p->AtNumber[(int) i];
 1718|  10.5M|            if (uCurAtNumb >= v && !( p->Rank[(int) uCurAtNumb] & rank_mark_bit ) && uCurAtNumb < uMinAtNumb)
  ------------------
  |  Branch (1718:17): [True: 7.07M, False: 3.51M]
  |  Branch (1718:36): [True: 7.07M, False: 0]
  |  Branch (1718:86): [True: 169k, False: 6.90M]
  ------------------
 1719|   169k|            {
 1720|   169k|                uMinAtNumb = uCurAtNumb;
 1721|   169k|            }
 1722|  10.5M|        }
 1723|   171k|    }
 1724|       |
 1725|   323k|    if (uMinAtNumb != INCHI_CANON_INFINITY)
  ------------------
  |  |   58|   323k|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
  |  Branch (1725:9): [True: 320k, False: 3.18k]
  ------------------
 1726|   320k|    {
 1727|   320k|        uMinAtNumb++;
 1728|   320k|    }
 1729|       |
 1730|       |    INCHI_HEAPCHK
 1731|       |
 1732|   323k|    return uMinAtNumb;
 1733|   323k|}
CellGetNumberOfNodes:
 1738|  2.34k|{
 1739|  2.34k|    int first = W->first;
 1740|  2.34k|    int next = W->next;
 1741|  2.34k|    int i, num;
 1742|   107k|    for (i = first, num = 0; i < next; i++)
  ------------------
  |  Branch (1742:30): [True: 105k, False: 2.34k]
  ------------------
 1743|   105k|    {
 1744|   105k|        if (!( rank_mark_bit & p->Rank[(int) p->AtNumber[i]] ))
  ------------------
  |  Branch (1744:13): [True: 105k, False: 0]
  ------------------
 1745|   105k|        {
 1746|   105k|            num++;
 1747|   105k|        }
 1748|   105k|    }
 1749|       |
 1750|       |    INCHI_HEAPCHK
 1751|       |
 1752|  2.34k|    return num;
 1753|  2.34k|}
CtPartClear:
 1788|    204|{
 1789|    204|    int start;
 1790|    204|    int len;
 1791|       |    /* connection table */
 1792|    204|    start = k > 1 ? Ct->nextCtblPos[k - 1] : 0;
  ------------------
  |  Branch (1792:13): [True: 0, False: 204]
  ------------------
 1793|    204|    len = Ct->lenCt - start;
 1794|    204|    if (len > 0)
  ------------------
  |  Branch (1794:9): [True: 0, False: 204]
  ------------------
 1795|      0|    {
 1796|      0|        memset( Ct->Ctbl + start, 0, ( Ct->lenCt - start ) * sizeof( Ct->Ctbl[0] ) );
 1797|      0|    }
 1798|    204|    Ct->lenCt = start;
 1799|    204|    Ct->lenPos = k;
 1800|       |
 1801|    204|    INCHI_HEAPCHK
 1802|    204|}
insertions_sort_NeighList_AT_NUMBERS2:
 1811|   284k|{
 1812|   284k|    AT_NUMB *i, *j, *pk, tmp, rj;
 1813|   284k|    int k, num = (int) *base++;
 1814|   284k|    for (k = 1, pk = base; k < num; k++, pk++)
  ------------------
  |  Branch (1814:28): [True: 48, False: 284k]
  ------------------
 1815|     48|    {
 1816|     48|        i = pk;
 1817|     48|        j = i + 1;
 1818|     48|        rj = ( rank_mask_bit & nRank[(int) *j] );
 1819|     48|        if (rj < max_rj)
  ------------------
  |  Branch (1819:13): [True: 16, False: 32]
  ------------------
 1820|     16|        {
 1821|     16|            while (j > base && rj < ( rank_mask_bit & nRank[(int) *i] ))
  ------------------
  |  Branch (1821:20): [True: 16, False: 0]
  |  Branch (1821:32): [True: 0, False: 16]
  ------------------
 1822|      0|            {
 1823|      0|                tmp = *i;
 1824|      0|                *i = *j;
 1825|      0|                *j = tmp;
 1826|      0|                j = i--;
 1827|      0|            }
 1828|     16|        }
 1829|     48|    }
 1830|       |
 1831|   284k|    INCHI_HEAPCHK
 1832|   284k|}
CtPartFill:
 1845|   276k|{
 1846|       |    /*  k = (new index in Ct->nextAtRank[] and Ct->nextCtblPos[]) + 1 */
 1847|       |
 1848|   276k|    int     startCtbl;
 1849|   276k|    int     startAtOrd;
 1850|   276k|    AT_RANK r, rj, nn, j, rj_prev;
 1851|   276k|    int     i, m;
 1852|       |
 1853|       |#ifdef INCHI_CANON_USE_HASH
 1854|       |    CtHash  hash = 0;
 1855|       |#endif
 1856|       |
 1857|   276k|    static int count; /* for debug only */
 1858|   276k|    count++;
 1859|       |
 1860|       |    INCHI_HEAPCHK
 1861|       |
 1862|   276k|    k--;
 1863|   276k|    if (k)
  ------------------
  |  Branch (1863:9): [True: 166k, False: 110k]
  ------------------
 1864|   166k|    {
 1865|   166k|        startCtbl = Ct->nextCtblPos[k - 1];
 1866|   166k|        startAtOrd = Ct->nextAtRank[k - 1] - 1;  /* here  p->Rank[p->AtNumber[r-1]] = r */
 1867|   166k|    }
 1868|   110k|    else
 1869|   110k|    {
 1870|   110k|        startCtbl = 0;
 1871|   110k|        startAtOrd = 0;
 1872|   110k|    }
 1873|       |
 1874|       |    /******* Well-defined (by fixed ranks) part of the connection table ************/
 1875|   276k|    r = ( rank_mask_bit & p->Rank[(int) p->AtNumber[startAtOrd]] );
 1876|       |
 1877|   560k|    for (i = startAtOrd; i < n_tg && r == ( rank_mask_bit&p->Rank[m = (int) p->AtNumber[i]] ); i++, r++)
  ------------------
  |  Branch (1877:26): [True: 447k, False: 113k]
  |  Branch (1877:38): [True: 284k, False: 163k]
  ------------------
 1878|   284k|    {
 1879|   284k|        Ct->Ctbl[startCtbl++] = r;
 1880|   284k|        insertions_sort_NeighList_AT_NUMBERS2( G[m], p->Rank, r );
 1881|   284k|        nn = G[m][0];   /* number of neighbors */
 1882|   284k|        rj_prev = 0;    /* debug only */
 1883|       |
 1884|       |#ifdef INCHI_CANON_USE_HASH
 1885|       |        hash = add2crc32( hash, (AT_NUMB) ( r + n ) );
 1886|       |#endif
 1887|       |
 1888|   284k|        for (j = 1; j <= nn && ( rj = ( rank_mask_bit&p->Rank[(int) G[m][j]] ) ) < r; j++)
  ------------------
  |  Branch (1888:21): [True: 96, False: 284k]
  |  Branch (1888:32): [True: 56, False: 40]
  ------------------
 1889|     56|        {
 1890|     56|            Ct->Ctbl[startCtbl++] = rj;
 1891|       |
 1892|       |#ifdef INCHI_CANON_USE_HASH
 1893|       |            hash = add2crc32( hash, rj );
 1894|       |#endif
 1895|       |
 1896|       |#if ( bRELEASE_VERSION != 1 && defined(_DEBUG) )
 1897|       |            /* debug only */
 1898|       |            if (rj < rj_prev)
 1899|       |            {
 1900|       |                int stop = 1;   /* <BRKPT> */
 1901|       |            }
 1902|       |#endif
 1903|       |
 1904|     56|            rj_prev = rj;
 1905|     56|        }
 1906|   284k|    }
 1907|       |
 1908|       |    INCHI_HEAPCHK
 1909|       |
 1910|       |    /****************** Well-defined part of base hydrogen atoms *******************/
 1911|   276k|    if (pCD->NumH && Ct->NumH)
  ------------------
  |  Branch (1911:9): [True: 77.7k, False: 198k]
  |  Branch (1911:22): [True: 77.7k, False: 0]
  ------------------
 1912|  77.7k|    {
 1913|  77.7k|        nn = inchi_min( n, i );
  ------------------
  |  |  167|  77.7k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 4, False: 77.7k]
  |  |  ------------------
  ------------------
 1914|   158k|        for (j = startAtOrd; j < nn; j++)
  ------------------
  |  Branch (1914:30): [True: 80.8k, False: 77.7k]
  ------------------
 1915|  80.8k|        {
 1916|       |            /* atoms */
 1917|  80.8k|            Ct->NumH[j] = pCD->NumH[p->AtNumber[j]];
 1918|  80.8k|        }
 1919|  77.7k|        for (; j < i; j++)
  ------------------
  |  Branch (1919:16): [True: 4, False: 77.7k]
  ------------------
 1920|      4|        {
 1921|       |            /* t-groups */
 1922|      4|            int data_pos = n + T_NUM_NO_ISOTOPIC * ( (int) p->AtNumber[j] - n );
  ------------------
  |  |   97|      4|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
 1923|     12|            for (m = 0; m < T_NUM_NO_ISOTOPIC; m++)
  ------------------
  |  |   97|     12|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
  |  Branch (1923:25): [True: 8, False: 4]
  ------------------
 1924|      8|            {
 1925|      8|                Ct->NumH[nn++] = pCD->NumH[data_pos++];
 1926|      8|            }
 1927|      4|        }
 1928|  77.7k|        Ct->lenNumH = nn;
 1929|  77.7k|    }
 1930|   198k|    else
 1931|   198k|    {
 1932|   198k|        Ct->lenNumH = 0;
 1933|   198k|    }
 1934|       |
 1935|       |    INCHI_HEAPCHK
 1936|       |
 1937|       |    /****************** Well-defined part of fixed hydrogen atoms *******************/
 1938|   276k|    if (pCD->NumHfixed && Ct->NumHfixed)
  ------------------
  |  Branch (1938:9): [True: 3, False: 276k]
  |  Branch (1938:27): [True: 3, False: 0]
  ------------------
 1939|      3|    {
 1940|      3|        nn = inchi_min( n, i );
  ------------------
  |  |  167|      3|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 3]
  |  |  ------------------
  ------------------
 1941|     14|        for (j = startAtOrd; j < nn; j++)
  ------------------
  |  Branch (1941:30): [True: 11, False: 3]
  ------------------
 1942|     11|        {
 1943|     11|            Ct->NumHfixed[j] = pCD->NumHfixed[p->AtNumber[j]];
 1944|       |
 1945|     11|            INCHI_HEAPCHK
 1946|     11|        }
 1947|       |        /* Ct->lenNumHfixed = nn; */
 1948|      3|    }
 1949|   276k|    else
 1950|   276k|    {
 1951|   276k|        ;/* Ct->lenNumHfixed = 0; */
 1952|   276k|    }
 1953|       |
 1954|       |    INCHI_HEAPCHK
 1955|       |
 1956|       |    /****************** Well-defined part of isotopic keys ***************************/
 1957|   276k|    if (pCD->iso_sort_key && Ct->iso_sort_key)
  ------------------
  |  Branch (1957:9): [True: 77.7k, False: 198k]
  |  Branch (1957:30): [True: 77.7k, False: 0]
  ------------------
 1958|  77.7k|    {
 1959|   158k|        for (j = startAtOrd; j < i; j++)
  ------------------
  |  Branch (1959:30): [True: 80.8k, False: 77.7k]
  ------------------
 1960|  80.8k|        {
 1961|  80.8k|            Ct->iso_sort_key[j] = pCD->iso_sort_key[p->AtNumber[j]];
 1962|  80.8k|        }
 1963|  77.7k|        Ct->len_iso_sort_key = i;
 1964|  77.7k|    }
 1965|   198k|    else
 1966|   198k|    {
 1967|   198k|        Ct->len_iso_sort_key = 0;
 1968|   198k|    }
 1969|       |
 1970|       |    INCHI_HEAPCHK
 1971|       |
 1972|       |    /****************** Well-defined part of isotopic iso_exchg_atnos ***************************/
 1973|   276k|    if (pCD->iso_exchg_atnos && Ct->iso_exchg_atnos)
  ------------------
  |  Branch (1973:9): [True: 0, False: 276k]
  |  Branch (1973:33): [True: 0, False: 0]
  ------------------
 1974|      0|    {
 1975|      0|        for (j = startAtOrd; j < i; j++)
  ------------------
  |  Branch (1975:30): [True: 0, False: 0]
  ------------------
 1976|      0|        {
 1977|      0|            Ct->iso_exchg_atnos[j] = pCD->iso_exchg_atnos[p->AtNumber[j]];
 1978|      0|        }
 1979|      0|        Ct->len_iso_exchg_atnos = i;
 1980|      0|    }
 1981|   276k|    else
 1982|   276k|    {
 1983|   276k|        Ct->len_iso_exchg_atnos = 0;
 1984|   276k|    }
 1985|       |
 1986|       |    INCHI_HEAPCHK
 1987|       |
 1988|       |    /******** Well-defined part of isotopic keys for fixed hydrogen atoms ************/
 1989|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 1990|       |    if (pCD->iso_sort_key_Hfixed && Ct->iso_sort_key_Hfixed)
 1991|       |    {
 1992|       |        nn = inchi_min( n, i );
 1993|       |        for (j = startAtOrd; j < nn; j++)
 1994|       |        {
 1995|       |            Ct->iso_sort_key_Hfixed[j] = pCD->iso_sort_key_Hfixed[p->AtNumber[j]];
 1996|       |        }
 1997|       |        Ct->len_iso_sort_key_Hfixed = nn;
 1998|       |    }
 1999|       |    else
 2000|       |    {
 2001|       |        Ct->len_iso_sort_key_Hfixed = 0;
 2002|       |    }
 2003|       |#endif
 2004|       |
 2005|       |    INCHI_HEAPCHK
 2006|       |
 2007|   276k|    Ct->lenCt = startCtbl; /* not aways increases */
 2008|   276k|    Ct->nextCtblPos[k] = startCtbl;
 2009|   276k|    Ct->nextAtRank[k] = r;
 2010|   276k|    Ct->lenPos = k + 1;
 2011|       |
 2012|       |    /* The rest of the CTable */
 2013|       |
 2014|       |#ifdef INCHI_CANON_USE_HASH
 2015|       |    while (i < n)
 2016|       |    {
 2017|       |        r = ( rank_mask_bit&p->Rank[m = (int) p->AtNumber[i]] );
 2018|       |        hash = add2crc32( hash, (AT_NUMB) ( r + n ) );
 2019|       |        r++;
 2020|       |        insertions_sort_NeighList_AT_NUMBERS2( G[m], p->Rank, r );
 2021|       |        nn = G[m][0];
 2022|       |        rj_prev = 0; /* debug only */
 2023|       |        for (j = 1; j <= nn && ( rj = ( rank_mask_bit&p->Rank[(int) G[m][j]] ) ) < r; j++)
 2024|       |        {
 2025|       |            hash = add2crc32( hash, rj );
 2026|       |        }
 2027|       |        i++;
 2028|       |    }
 2029|       |    Ct->hash[k] = hash;
 2030|       |#endif
 2031|       |
 2032|   276k|    INCHI_HEAPCHK
 2033|   276k|}
CtPartINCHI_CANON_INFINITY:
 2038|   110k|{
 2039|   110k|    int     startCtbl;
 2040|       |    /*int     startAtOrd;*/
 2041|   110k|    k--;
 2042|   110k|    if (k)
  ------------------
  |  Branch (2042:9): [True: 110k, False: 0]
  ------------------
 2043|   110k|    {
 2044|   110k|        startCtbl = Ct->nextCtblPos[k - 1];
 2045|       |        /*startAtOrd = Ct->nextAtRank[k-1]-1;*/  /* here  p->Rank[p->AtNumber[r-1]] = r */
 2046|   110k|        if (cmp)
  ------------------
  |  Branch (2046:13): [True: 0, False: 110k]
  ------------------
 2047|      0|        {
 2048|      0|            memset( cmp, 0, k * sizeof( cmp[0] ) );
 2049|      0|        }
 2050|   110k|    }
 2051|      0|    else
 2052|      0|    {
 2053|      0|        startCtbl = 0;
 2054|       |        /*startAtOrd = 0;*/
 2055|      0|    }
 2056|   110k|    if (!startCtbl || Ct->Ctbl[startCtbl - 1] != EMPTY_CT)
  ------------------
  |  |   62|   110k|#define EMPTY_CT       0
  ------------------
  |  Branch (2056:9): [True: 0, False: 110k]
  |  Branch (2056:23): [True: 110k, False: 0]
  ------------------
 2057|   110k|    {
 2058|   110k|        Ct->Ctbl[startCtbl] = EMPTY_CT;
  ------------------
  |  |   62|   110k|#define EMPTY_CT       0
  ------------------
 2059|   110k|    }
 2060|       |
 2061|   110k|    INCHI_HEAPCHK
 2062|   110k|}
CtPartCompare:
 2102|   404k|{
 2103|   404k|    int     startCt1, endCt1, startCt2, endCt2; /*endCt,*/
 2104|   404k|    int     startAt1, endAt1, startAt2, endAt2; /*endCt,*/
 2105|   404k|    int     midCt /* end of atoms only Ct */, midNumH = 0 /* end of atoms only NumH */, maxVert;
 2106|   404k|    int     diff, i, k1, k2, lenNumH, len_iso_sort_key, /*mid_iso_sort_key,*/ midAt;
 2107|   404k|    int     nLayer = 0;
 2108|       |
 2109|   404k|    k--;
 2110|   404k|    i = -1;
 2111|       |
 2112|       |    /* set kLeastForLayer[nLayer].k = (k+1) or -(k+1)
 2113|       |           kLeastForLayer[nLayer].i = iDiff
 2114|       |        if all the conditions are met:
 2115|       |        1) kLeastForLayer[nLayer].k = 0
 2116|       |        2) diff==0 for all layers < nLayer
 2117|       |
 2118|       |        sign:
 2119|       |        if the final diff < 0 then kLeastForLayer[nLayer].k = -(k+1) else
 2120|       |        if the final diff > 0 then kLeastForLayer[nLayer].k = +(k+1)
 2121|       |
 2122|       |        k+1 instead of k takes into account k--; statememt above)
 2123|       |
 2124|       |        meaning:
 2125|       |        ========
 2126|       |        abs(kLeastForLayer[nLayer].k) is the greatest level k at which
 2127|       |        difference at layer nLayer are zeroes of hidden by differences in smaller nLayer.
 2128|       |
 2129|       |        "Hidden by difference in smaller level" means that nLayer of comparison
 2130|       |        has not been reached because the difference was discovered at a previous layer.
 2131|       |
 2132|       |
 2133|       |        Lambda vs zf_zeta comparison
 2134|       |        =============================================
 2135|       |        accept only diff == 0
 2136|       |
 2137|       |        Lambda vs pzb_rho and pzb_rho_fix comparison
 2138|       |        =============================================
 2139|       |        Maintain kLeastForLayer[] and kLeastForLayerFix[]
 2140|       |
 2141|       |        The algorithm provides that pzb_rho(m-1) < pzb_rho(m) <= pzb_rho_fix
 2142|       |
 2143|       |        Definition: pzb_rho(m-1) < pzb_rho(m) means that
 2144|       |        -----------------------------------------------
 2145|       |        pzb_rho(m-1)[nLayerCurr] == pzb_rho(m)[nLayerCurr] for nLayerCurr = 0..nLayerDiff-1
 2146|       |        pzb_rho(m-1)[nLayerDiff] <  pzb_rho(m)[nLayerDiff]
 2147|       |
 2148|       |        Definition: pzb_rho(m-1)[nLayerDiff] <  pzb_rho(m)[nLayerDiff] means that
 2149|       |        -------------------------------------------------------------------------
 2150|       |        pzb_rho(m-1)[nLayerDiff][i]     == pzb_rho(m)[nLayerDiff][i] for i=0..iDdiff-1
 2151|       |        pzb_rho(m-1)[nLayerDiff][iDdiff] < pzb_rho(m)[nLayerDiff][iDdiff]
 2152|       |
 2153|       |        This defines nLayerDiff(pzb1, pzb2) where pszb1 = pzb_rho(a), pzb2=pzb_rho(b) (a<b) or pzb_rho_fix
 2154|       |               and   iDdiff    (pzb1, pzb2).
 2155|       |        In case pzb_rho(m)[nLayerCurr] == pzb_rho_fix[nLayerCurr] for all non-NULL nLayerCurr in pzb_rho_fix,
 2156|       |           nLayerDiff(pzb_rho(m), pzb_rho_fix) = the first layer in pzb_rho(m) not present in pzb_rho_fix
 2157|       |           iDdiff    (pzb_rho(m), pzb_rho_fix) = -1
 2158|       |        Case when such a layer does not exist means program error
 2159|       |
 2160|       |        Suppose L_rho = nLayerDiff(Lambda, pzb_rho(m))
 2161|       |                L_fix = nLayerDiff(Lambda, pzb_rho_fix)
 2162|       |                I_rho = iDdiff    (Lambda, pzb_rho(m))
 2163|       |                I_fix = iDdiff    (Lambda, pzb_rho_fix)
 2164|       |                kLeastForLayer determined from Lambda vs pzb_rho(m) comparison
 2165|       |        Then:
 2166|       |
 2167|       |        1. Comparison Lambda vs pzb_rho_fix before reaching discrete partition
 2168|       |        ----------------------------------------------------------------------
 2169|       |        a)    0 < abs(kLeastForLayerFix[L_fix].k) <= k-1 (* in this case I_fix >= 0 *)  &&
 2170|       |              ((L_fix < L_rho) || (L_fix == L_rho && I_fix < I_rho))
 2171|       |              =>
 2172|       |              qzb_rho_fix = kLeastForLayerFix[L_fix].k if prevoiusly qzb_rho_fix == 0
 2173|       |
 2174|       |        b)    otherwise do not change qzb_rho_fix, except the following:
 2175|       |
 2176|       |        c)    Special case L_rho == L_fix && I_rho == I_fix. Let L=L_rho, I = I_rho.
 2177|       |
 2178|       |              Compare 3 valirs: Lambda[L][I], pzb_rho(m)[L][I], pzb_rho_fix[L][I]
 2179|       |              The algorithm provides pzb_rho(m)[L][I] < pzb_rho_fix[L][I]
 2180|       |              (pzb_rho(m)[L][I]==pzb_rho_fix[L][I] <=> pzb_rho(m)[L][I]==pzb_rho_fix[L][I]
 2181|       |               is impossible by construction)
 2182|       |              There are 3 possibilities:
 2183|       |              c1) Lambda[L][I]     < pzb_rho(m)[L][I]  < pzb_rho_fix[L][I] <=>
 2184|       |                  kLeastForLayer[L].k  < 0 && kLeastForLayerFix[L].k < 0
 2185|       |                  => qzb_rho := kLeastForLayer[L].k, reject too small Lambda
 2186|       |              c2) pzb_rho(m)[L][I] < Lambda[L][I]      < pzb_rho_fix[L][I]
 2187|       |                  kLeastForLayer[L].k  > 0 && kLeastForLayerFix[L].k < 0
 2188|       |                  => qzb_rho := kLeastForLayer[L].k, accept Lambda, rho:=nu
 2189|       |              c3) pzb_rho(m)[L][I] < pzb_rho_fix[L][I] < Lambda[L][I]
 2190|       |                  kLeastForLayer[L].k  > 0 && kLeastForLayerFix[L].k > 0
 2191|       |                  => qzb_rho_fix := kLeastForLayerFix[L].k, reject too big Lambda
 2192|       |
 2193|       |              Case
 2194|       |                  kLeastForLayer[L].k  < 0 && kLeastForLayerFix[L].k > 0 is impossible
 2195|       |                  because it means
 2196|       |                  pzb_rho_fix < Lambda < pzb_rho(m) <=> pzb_rho_fix < pzb_rho(m)
 2197|       |
 2198|       |
 2199|       |            Case (c3) occurs in case of (a)
 2200|       |            Case (c1)
 2201|       |
 2202|       |        2. Comparison Lambda vs pzb_rho before reaching discrete partition
 2203|       |        ----------------------------------------------------------------------
 2204|       |        a) (L_rho < L_fix) || (L_rho == L_fix && I_rho < I_fix)  =>
 2205|       |
 2206|       |           Lambda differs from pzb_rho(m) in the part of pzb_rho(m) that will never change
 2207|       |           qzb_rho = kLeastForLayer[L_rho].k; reject Labmda or accept pzb_rho(m+1):=Labmda
 2208|       |
 2209|       |        b) (L_rho == L_fix && I_rho > I_fix) && kLeastForLayer[L_rho].k < 0
 2210|       |           Lambda < pzb_rho(m), therefore
 2211|       |           qzb_rho = kLeastForLayer[L_rho].k; reject Labmda
 2212|       |
 2213|       |        c) (L_rho > L_fix) =>
 2214|       |           qzb_rho := 0 because more significant difference may be discovered
 2215|       |           in layer < L_rho later. The final comparison may be needed at the
 2216|       |           level of discrete partition.
 2217|       |
 2218|       |
 2219|       |    */
 2220|       |
 2221|   404k|    if (cmp)
  ------------------
  |  Branch (2221:9): [True: 0, False: 404k]
  ------------------
 2222|      0|    {
 2223|      0|        for (i = 0; i <= k && !cmp[i]; i++)
  ------------------
  |  Branch (2223:21): [True: 0, False: 0]
  |  Branch (2223:31): [True: 0, False: 0]
  ------------------
 2224|      0|        {
 2225|      0|            ;
 2226|      0|        }
 2227|      0|        if (i < k)
  ------------------
  |  Branch (2227:13): [True: 0, False: 0]
  ------------------
 2228|      0|        {
 2229|      0|            cmp[k] = cmp[i];
 2230|      0|            return (int) cmp[i];
 2231|      0|        }
 2232|      0|    }
 2233|       |
 2234|   404k|    k1 = Ct1->lenPos - 1;
 2235|   404k|    k2 = Ct2->lenPos - 1;
 2236|       |
 2237|       |#if ( bRELEASE_VERSION != 1 && defined(_DEBUG) )
 2238|       |    if (k > k1 || k > k2)
 2239|       |    {
 2240|       |        int stop = 1;
 2241|       |    }
 2242|       |#endif
 2243|       |
 2244|   404k|    diff = 0;
 2245|       |
 2246|   404k|    if (k)
  ------------------
  |  Branch (2246:9): [True: 403k, False: 497]
  ------------------
 2247|   403k|    {
 2248|   403k|        startCt1 = Ct1->nextCtblPos[k - 1];
 2249|   403k|        startCt2 = Ct2->nextCtblPos[k - 1];
 2250|   403k|        startAt1 = Ct1->nextAtRank[k - 1] - 1;
 2251|   403k|        startAt2 = Ct2->nextAtRank[k - 1] - 1;
 2252|   403k|    }
 2253|    497|    else
 2254|    497|    {
 2255|    497|        startCt1 = startCt2 = 0;
 2256|    497|        startAt1 = startAt2 = 0;
 2257|    497|    }
 2258|       |
 2259|   404k|    endCt1 = Ct1->nextCtblPos[k];
 2260|   404k|    endCt2 = Ct2->nextCtblPos[k];
 2261|   404k|    endAt1 = (int) Ct1->nextAtRank[k] - 1;
 2262|   404k|    endAt2 = (int) Ct2->nextAtRank[k] - 1;
 2263|       |
 2264|   404k|    maxVert = inchi_min( Ct1->maxVert, Ct2->maxVert );
  ------------------
  |  |  167|   404k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 404k]
  |  |  ------------------
  ------------------
 2265|       |
 2266|       |#ifdef INCHI_CANON_USE_HASH
 2267|       |    if (!diff)
 2268|       |    {
 2269|       |        if (Ct1->hash[k] > Ct2->hash[k])
 2270|       |            diff = 1;
 2271|       |        else
 2272|       |            if (Ct1->hash[k] < Ct2->hash[k])
 2273|       |                diff = -1;
 2274|       |    }
 2275|       |    if (diff)
 2276|       |    {
 2277|       |        goto done;
 2278|       |    }
 2279|       |#endif
 2280|       |
 2281|       |    /************************** lengths **************************************************/
 2282|   404k|    if (diff = -( startCt1 - startCt2 ))
  ------------------
  |  Branch (2282:9): [True: 0, False: 404k]
  ------------------
 2283|      0|    {
 2284|       |        /* comparing two INCHI_CANON_INFINITY terminations */
 2285|      0|        if (bOnlyCommon &&
  ------------------
  |  Branch (2285:13): [True: 0, False: 0]
  ------------------
 2286|      0|             startCt1 >= Ct1->nLenCTAtOnly && startCt2 >= Ct2->nLenCTAtOnly &&
  ------------------
  |  Branch (2286:14): [True: 0, False: 0]
  |  Branch (2286:47): [True: 0, False: 0]
  ------------------
 2287|      0|             Ct1->Ctbl[startCt1] == EMPTY_CT && Ct2->Ctbl[startCt2] == EMPTY_CT)
  ------------------
  |  |   62|      0|#define EMPTY_CT       0
  ------------------
                           Ct1->Ctbl[startCt1] == EMPTY_CT && Ct2->Ctbl[startCt2] == EMPTY_CT)
  ------------------
  |  |   62|      0|#define EMPTY_CT       0
  ------------------
  |  Branch (2287:14): [True: 0, False: 0]
  |  Branch (2287:49): [True: 0, False: 0]
  ------------------
 2288|      0|        {
 2289|      0|            return 0;
 2290|      0|        }
 2291|      0|        if (bOnlyCommon)
  ------------------
  |  Branch (2291:13): [True: 0, False: 0]
  ------------------
 2292|      0|        {
 2293|      0|            startCt1 = startCt2 = inchi_min( startCt1, startCt2 );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2294|      0|            startAt1 = startAt2 = inchi_min( startAt1, startAt2 );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2295|      0|            if (Ct1->lenCt == Ct2->lenCt)
  ------------------
  |  Branch (2295:17): [True: 0, False: 0]
  ------------------
 2296|      0|            {
 2297|      0|                endCt1 = endCt2 = inchi_max( endCt1, endCt2 );
  ------------------
  |  |  166|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2298|      0|                endAt1 = endAt2 = inchi_max( endAt1, endAt2 );
  ------------------
  |  |  166|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2299|      0|            }
 2300|       |
 2301|       |#if ( bRELEASE_VERSION != 1 && defined(_DEBUG) )
 2302|       |            else
 2303|       |            {
 2304|       |                int stop = 1;
 2305|       |            }
 2306|       |#endif
 2307|      0|        }
 2308|      0|        else
 2309|       |        /* comparing (taut tail) vs INCHI_CANON_INFINITY termination -- ??? */
 2310|      0|            if (startCt1 > startCt2 &&
  ------------------
  |  Branch (2310:17): [True: 0, False: 0]
  ------------------
 2311|      0|                 Ct1->maxVert > Ct2->maxVert &&
  ------------------
  |  Branch (2311:18): [True: 0, False: 0]
  ------------------
 2312|      0|                 startAt2 == Ct2->maxVert)
  ------------------
  |  Branch (2312:18): [True: 0, False: 0]
  ------------------
 2313|      0|            {
 2314|      0|                return 0;
 2315|      0|            }
 2316|      0|            else
 2317|      0|            {
 2318|      0|                goto done;
 2319|      0|            }
 2320|      0|    }
 2321|       |
 2322|   404k|    lenNumH = Ct1->lenNumH;
 2323|   404k|    len_iso_sort_key = Ct1->len_iso_sort_key;
 2324|       |
 2325|   404k|    if (diff = -( endCt1 - endCt2 ))
  ------------------
  |  Branch (2325:9): [True: 0, False: 404k]
  ------------------
 2326|      0|    {
 2327|       |        /* negative sign reproduces results for NSC=28393 */
 2328|      0|        if (bOnlyCommon)
  ------------------
  |  Branch (2328:13): [True: 0, False: 0]
  ------------------
 2329|      0|        {
 2330|      0|            endCt1 = endCt2 = inchi_min( endCt1, endCt2 );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2331|      0|            endAt1 = endAt2 = inchi_min( endAt1, endAt2 );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2332|      0|            lenNumH = inchi_min( Ct1->lenNumH, Ct2->lenNumH );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2333|      0|            len_iso_sort_key = inchi_min( Ct1->len_iso_sort_key, Ct1->len_iso_sort_key );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2334|      0|        }
 2335|      0|        else
 2336|      0|        {
 2337|       |            /* take care of case when comparing tautomeric vs non-tautomeric:
 2338|       |            since (taut)->maxVert > (non-taut)->maxVert, --???
 2339|       |            (taut)->maxlenCt  > (non-taut)->maxlenCt     --!!!
 2340|       |            compare up to min out of the two, ignoring INCHI_CANON_INFINITY in the last position */
 2341|      0|            if (endCt1 > endCt2 && Ct1->maxlenCt > Ct2->maxlenCt)
  ------------------
  |  Branch (2341:17): [True: 0, False: 0]
  |  Branch (2341:36): [True: 0, False: 0]
  ------------------
 2342|      0|            {
 2343|      0|                if (endAt2 == Ct2->maxVert + 1)
  ------------------
  |  Branch (2343:21): [True: 0, False: 0]
  ------------------
 2344|      0|                {
 2345|       |                    /* remove INCHI_CANON_INFINITY termination of the shorter CT */
 2346|       |                    /* should never happen */
 2347|      0|                    endAt2--;
 2348|      0|                    len_iso_sort_key = lenNumH = endAt1 = endAt2;
 2349|      0|                    endCt2--;
 2350|      0|                    endCt1 = endCt2;
 2351|      0|                    diff = 0;
 2352|      0|                }
 2353|      0|                else if (endAt2 == Ct2->maxVert)
  ------------------
  |  Branch (2353:26): [True: 0, False: 0]
  ------------------
 2354|      0|                {
 2355|       |                    /* remove INCHI_CANON_INFINITY termination of CT */
 2356|      0|                    len_iso_sort_key = lenNumH = endAt1 = endAt2;
 2357|      0|                    endCt1 = endCt2;
 2358|      0|                    diff = 0;
 2359|      0|                }
 2360|      0|                else
 2361|      0|                {
 2362|      0|                    goto done;
 2363|      0|                }
 2364|      0|            }
 2365|      0|            else
 2366|      0|            {
 2367|      0|                goto done;
 2368|      0|            }
 2369|      0|        }
 2370|      0|    }
 2371|       |
 2372|   404k|    if (bSplitTautCompare)
  ------------------
  |  Branch (2372:9): [True: 230k, False: 173k]
  ------------------
 2373|   230k|    {
 2374|   230k|        midCt = inchi_min( Ct1->nLenCTAtOnly, Ct2->nLenCTAtOnly );
  ------------------
  |  |  167|   230k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 230k]
  |  |  ------------------
  ------------------
 2375|   230k|        if (midCt > endCt1)
  ------------------
  |  Branch (2375:13): [True: 227k, False: 3.50k]
  ------------------
 2376|   227k|        {
 2377|   227k|            midCt = endCt1;
 2378|   227k|        }
 2379|   230k|        midAt = inchi_min( maxVert, endAt1 );
  ------------------
  |  |  167|   230k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 230k]
  |  |  ------------------
  ------------------
 2380|   230k|    }
 2381|   173k|    else
 2382|   173k|    {
 2383|   173k|        midCt = endCt1;
 2384|   173k|        midAt = endAt1;
 2385|   173k|    }
 2386|       |
 2387|       |
 2388|       |    /*endCt   = min(endCt1, endCt2);*/
 2389|       |    /*************************************************************************/
 2390|       |    /************ layer 0: connection table without tautomeric groups ********/
 2391|       |    /*************************************************************************/
 2392|       |
 2393|   826k|    for (i = startCt1; i < midCt && Ct1->Ctbl[i] == Ct2->Ctbl[i]; i++)
  ------------------
  |  Branch (2393:24): [True: 421k, False: 404k]
  |  Branch (2393:37): [True: 421k, False: 0]
  ------------------
 2394|       |    /*for ( i = startCt1; i < endCt && !(diff = (int)Ct1->Ctbl[i] - (int)Ct2->Ctbl[i]); i ++ )*/
 2395|   421k|    {
 2396|   421k|        ;
 2397|   421k|    }
 2398|       |
 2399|   404k|    if (i < midCt)
  ------------------
  |  Branch (2399:9): [True: 0, False: 404k]
  ------------------
 2400|      0|    {
 2401|      0|        diff = (int) Ct1->Ctbl[i] - (int) Ct2->Ctbl[i];
 2402|      0|        goto done;
 2403|      0|    }
 2404|       |
 2405|       |    /*************************************************************************/
 2406|       |    /******** layer 1 NumH: H atoms without tautomeric H *********************/
 2407|       |    /*************************************************************************/
 2408|       |
 2409|   404k|    nLayer++;
 2410|       |
 2411|       |    /*============= check limits for consistency  ==========*/
 2412|   404k|    if (diff = -( startAt1 - startAt2 ))
  ------------------
  |  Branch (2412:9): [True: 0, False: 404k]
  ------------------
 2413|      0|    {
 2414|      0|        goto done;   /* should not happen */
 2415|      0|    }
 2416|   404k|    if (diff = -( endAt1 - endAt2 ))
  ------------------
  |  Branch (2416:9): [True: 0, False: 404k]
  ------------------
 2417|      0|    {
 2418|      0|        goto done;   /* should not happen */
 2419|      0|    }
 2420|       |
 2421|       |    /*============= comparison =============================*/
 2422|   404k|    if (Ct1->NumH && Ct2->NumH)
  ------------------
  |  Branch (2422:9): [True: 230k, False: 173k]
  |  Branch (2422:22): [True: 230k, False: 0]
  ------------------
 2423|   230k|    {
 2424|   230k|        if (endAt1 < maxVert)
  ------------------
  |  Branch (2424:13): [True: 227k, False: 3.50k]
  ------------------
 2425|   227k|        {
 2426|   227k|            midNumH = lenNumH = endAt1;
 2427|   227k|        }
 2428|  3.50k|        else if (bSplitTautCompare)
  ------------------
  |  Branch (2428:18): [True: 3.50k, False: 0]
  ------------------
 2429|  3.50k|        {
 2430|  3.50k|            midNumH = maxVert;
 2431|  3.50k|        }
 2432|      0|        else
 2433|      0|        {
 2434|      0|            midNumH = lenNumH;
 2435|      0|        }
 2436|       |
 2437|       |        /* lenNumH = (endAt2 >= maxVert)? lenNumH : endAt2; */
 2438|       |        /* endAt1 = (endAt2 == n)? lenNumH : endAt2; */
 2439|       |
 2440|   470k|        for (i = startAt1; i < midNumH && Ct1->NumH[i] == Ct2->NumH[i]; i++)
  ------------------
  |  Branch (2440:28): [True: 239k, False: 230k]
  |  Branch (2440:43): [True: 239k, False: 0]
  ------------------
 2441|   239k|        {
 2442|   239k|            ;
 2443|   239k|        }
 2444|   230k|        if (i < midNumH)
  ------------------
  |  Branch (2444:13): [True: 0, False: 230k]
  ------------------
 2445|      0|        {
 2446|      0|            diff = (int) Ct1->NumH[i] - (int) Ct2->NumH[i];
 2447|      0|            goto done;
 2448|      0|        }
 2449|   230k|    }
 2450|       |
 2451|       |
 2452|       |    /*************************************************************************/
 2453|       |    /************** layer 2: tautomeric part of CT and tautomeric H **********/
 2454|       |    /*************************************************************************/
 2455|   404k|    nLayer++;
 2456|   404k|    for (i = midCt; i < endCt1 && Ct1->Ctbl[i] == Ct2->Ctbl[i]; i++)
  ------------------
  |  Branch (2456:21): [True: 0, False: 404k]
  |  Branch (2456:35): [True: 0, False: 0]
  ------------------
 2457|      0|    {
 2458|      0|        ; /* compare tautomeric groups part of CT */
 2459|      0|    }
 2460|   404k|    if (i < endCt1)
  ------------------
  |  Branch (2460:9): [True: 0, False: 404k]
  ------------------
 2461|      0|    {
 2462|      0|        diff = (int) Ct1->Ctbl[i] - (int) Ct2->Ctbl[i];
 2463|      0|        goto done;
 2464|      0|    }
 2465|   404k|    if (Ct1->NumH && Ct2->NumH)
  ------------------
  |  Branch (2465:9): [True: 230k, False: 173k]
  |  Branch (2465:22): [True: 230k, False: 0]
  ------------------
 2466|   230k|    {
 2467|   230k|        for (i = midNumH; i < lenNumH && Ct1->NumH[i] == Ct2->NumH[i]; i++)
  ------------------
  |  Branch (2467:27): [True: 0, False: 230k]
  |  Branch (2467:42): [True: 0, False: 0]
  ------------------
 2468|      0|        {
 2469|      0|            ; /* compare tautomeric H */
 2470|      0|        }
 2471|   230k|        if (i < lenNumH)
  ------------------
  |  Branch (2471:13): [True: 0, False: 230k]
  ------------------
 2472|      0|        {
 2473|      0|            diff = (int) Ct1->NumH[i] - (int) Ct2->NumH[i];
 2474|      0|            i += endCt1 - midCt;
 2475|      0|            goto done;
 2476|      0|        }
 2477|   230k|    }
 2478|       |
 2479|       |
 2480|       |    /*************************************************************************/
 2481|       |    /************** layer 3: Fixed H atoms ***********************************/
 2482|       |    /*************************************************************************/
 2483|   404k|    nLayer++;
 2484|   404k|    if (Ct1->NumHfixed && Ct2->NumHfixed)
  ------------------
  |  Branch (2484:9): [True: 0, False: 404k]
  |  Branch (2484:27): [True: 0, False: 0]
  ------------------
 2485|      0|    {
 2486|      0|        for (i = startAt1; i < midAt && Ct1->NumHfixed[i] == Ct2->NumHfixed[i]; i++)
  ------------------
  |  Branch (2486:28): [True: 0, False: 0]
  |  Branch (2486:41): [True: 0, False: 0]
  ------------------
 2487|      0|        {
 2488|      0|            ;
 2489|      0|        }
 2490|      0|        if (i < midAt)
  ------------------
  |  Branch (2490:13): [True: 0, False: 0]
  ------------------
 2491|      0|        {
 2492|      0|            diff = (int) Ct1->NumHfixed[i] - (int) Ct2->NumHfixed[i];
 2493|      0|            goto done;
 2494|      0|        }
 2495|      0|    }
 2496|       |
 2497|       |
 2498|       |    /*************************************************************************/
 2499|       |    /************** layer 4: isotopic atoms H, incl. tautomeric **************/
 2500|       |    /*************************************************************************/
 2501|   404k|    nLayer++;
 2502|   404k|    if (Ct1->iso_sort_key && Ct2->iso_sort_key)
  ------------------
  |  Branch (2502:9): [True: 230k, False: 173k]
  |  Branch (2502:30): [True: 153k, False: 77.7k]
  ------------------
 2503|   153k|    {
 2504|   311k|        for (i = startAt1; i < endAt1 && Ct1->iso_sort_key[i] == Ct2->iso_sort_key[i]; i++)
  ------------------
  |  Branch (2504:28): [True: 159k, False: 152k]
  |  Branch (2504:42): [True: 158k, False: 566]
  ------------------
 2505|   158k|            ;
 2506|   153k|        if (i < endAt1)
  ------------------
  |  Branch (2506:13): [True: 566, False: 152k]
  ------------------
 2507|    566|        {
 2508|    566|            diff = Ct1->iso_sort_key[i] > Ct2->iso_sort_key[i] ? 1 : -1;
  ------------------
  |  Branch (2508:20): [True: 566, False: 0]
  ------------------
 2509|    566|            goto done;
 2510|    566|        }
 2511|   153k|    }
 2512|   403k|    if (Ct1->iso_exchg_atnos && Ct2->len_iso_exchg_atnos)
  ------------------
  |  Branch (2512:9): [True: 0, False: 403k]
  |  Branch (2512:33): [True: 0, False: 0]
  ------------------
 2513|      0|    {
 2514|      0|        for (i = startAt1; i < endAt1 && Ct1->iso_exchg_atnos[i] == Ct2->iso_exchg_atnos[i]; i++)
  ------------------
  |  Branch (2514:28): [True: 0, False: 0]
  |  Branch (2514:42): [True: 0, False: 0]
  ------------------
 2515|      0|        {
 2516|      0|            ;
 2517|      0|        }
 2518|      0|        if (i < endAt1)
  ------------------
  |  Branch (2518:13): [True: 0, False: 0]
  ------------------
 2519|      0|        {
 2520|      0|            diff = Ct1->iso_exchg_atnos[i] > Ct2->iso_exchg_atnos[i] ? 1 : -1;
  ------------------
  |  Branch (2520:20): [True: 0, False: 0]
  ------------------
 2521|      0|            goto done;
 2522|      0|        }
 2523|      0|    }
 2524|       |
 2525|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 2526|       |
 2527|       |    /*************************************************************************/
 2528|       |    /************** layer 6: Fixed isotopic H atoms **************************/
 2529|       |    /*************************************************************************/
 2530|       |    nLayer++;
 2531|       |    if (Ct1->iso_sort_key_Hfixed && Ct2->iso_sort_key_Hfixed)
 2532|       |    {
 2533|       |        for (i = startAt1; i < midAt && Ct1->iso_sort_key_Hfixed[i] == Ct2->iso_sort_key_Hfixed[i]; i++)
 2534|       |        {
 2535|       |            ;
 2536|       |        }
 2537|       |        if (i < midAt)
 2538|       |        {
 2539|       |            diff = Ct1->iso_sort_key_Hfixed[i] > Ct2->iso_sort_key_Hfixed[i] ? 1 : -1;
 2540|       |            goto done;
 2541|       |        }
 2542|       |    }
 2543|       |#endif
 2544|       |
 2545|       |
 2546|       |
 2547|   404k|done:
 2548|       |
 2549|   404k|#ifdef INCHI_CANON_MIN
 2550|   404k|    diff = -diff;
 2551|   404k|#endif
 2552|       |
 2553|   404k|    if (diff)
  ------------------
  |  Branch (2553:9): [True: 566, False: 403k]
  ------------------
 2554|    566|    {
 2555|    566|        diff = ( diff > 0 ) ? ( nLayer + 1 ) : -( nLayer + 1 ); /* return the discovered difference layer number >= 1 */
  ------------------
  |  Branch (2555:16): [True: 0, False: 566]
  ------------------
 2556|    566|        if (kLeastForLayer)
  ------------------
  |  Branch (2556:13): [True: 283, False: 283]
  ------------------
 2557|    283|        {
 2558|       |
 2559|       |#if ( bRELEASE_VERSION != 1 )
 2560|       |            if (abs( kLeastForLayer[nLayer].k ) > k + 1)
 2561|       |            { /* for debug only */
 2562|       |                int stop = 1; /* <BRKPT> */
 2563|       |            }
 2564|       |#endif
 2565|       |
 2566|    283|            if (!kLeastForLayer[nLayer].k)
  ------------------
  |  Branch (2566:17): [True: 283, False: 0]
  ------------------
 2567|    283|            {
 2568|    283|                kLeastForLayer[nLayer].k = ( diff > 0 ) ? ( k + 1 ) : -( k + 1 );
  ------------------
  |  Branch (2568:44): [True: 0, False: 283]
  ------------------
 2569|    283|                kLeastForLayer[nLayer].i = i;
 2570|    283|            }
 2571|    283|            if (nLayer /* && !bOnlyCommon */)
  ------------------
  |  Branch (2571:17): [True: 283, False: 0]
  ------------------
 2572|    283|            {
 2573|    283|                diff = 0;
 2574|    283|            }
 2575|    283|        }
 2576|    566|    }
 2577|       |
 2578|       |#if ( bRELEASE_VERSION != 1 && defined(_DEBUG) )
 2579|       |    else
 2580|       |    {
 2581|       |        int stop = 1;  /* for debug only */
 2582|       |    }
 2583|       |#endif
 2584|       |
 2585|   404k|    if (cmp)
  ------------------
  |  Branch (2585:9): [True: 0, False: 404k]
  ------------------
 2586|      0|    {
 2587|      0|        cmp[k] = ( diff > 0 ) ? 1 : ( diff < 0 ) ? -1 : 0;
  ------------------
  |  Branch (2587:18): [True: 0, False: 0]
  |  Branch (2587:37): [True: 0, False: 0]
  ------------------
 2588|      0|    }
 2589|       |
 2590|   404k|    return diff;
 2591|   403k|}
CtFullCompare:
 2599|  3.14k|{
 2600|  3.14k|    int     startCt1, endCt1, startCt2, endCt2; /*endCt,*/
 2601|  3.14k|    int     startAt1, endAt1, startAt2, endAt2; /*endCt,*/
 2602|  3.14k|    int     midCt   /* end of atoms only in Ctbl */,
 2603|  3.14k|        midNumH = 0 /* end of atoms only NumH */,
 2604|  3.14k|        midAt   /* end of atoms only */;
 2605|  3.14k|    int     diff, i, k1, k2, lenNumH1, lenNumH2, lenNumH, maxVert /* min num atoms */;
 2606|  3.14k|    int     len_iso_sort_key1, len_iso_sort_key2, len_iso_sort_key /*, mid_iso_sort_key*/;
 2607|  3.14k|    int     nLayer = 0;
 2608|       |
 2609|  3.14k|    k1 = Ct1->lenPos - 1;
 2610|  3.14k|    k2 = Ct2->lenPos - 1;
 2611|       |
 2612|  3.14k|    diff = 0;
 2613|       |
 2614|  3.14k|    startCt1 = startCt2 = 0;
 2615|  3.14k|    startAt1 = startAt2 = 0;
 2616|       |
 2617|  3.14k|    endCt1 = Ct1->nextCtblPos[k1];
 2618|  3.14k|    endCt2 = Ct2->nextCtblPos[k2];
 2619|  3.14k|    endAt1 = (int) Ct1->nextAtRank[k1] - 1;
 2620|  3.14k|    endAt2 = (int) Ct2->nextAtRank[k2] - 1;
 2621|       |
 2622|  3.14k|    maxVert = inchi_min( Ct1->maxVert, Ct2->maxVert );
  ------------------
  |  |  167|  3.14k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 3.14k]
  |  |  ------------------
  ------------------
 2623|       |
 2624|  3.14k|    if (bOnlyCommon)
  ------------------
  |  Branch (2624:9): [True: 34, False: 3.11k]
  ------------------
 2625|     34|    {
 2626|     34|        endCt1 = inchi_min( endCt1, endCt2 );
  ------------------
  |  |  167|     34|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 4, False: 30]
  |  |  ------------------
  ------------------
 2627|     34|        endCt1 = endCt2 = inchi_min( endCt1, Ct1->lenCt );
  ------------------
  |  |  167|     34|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 34]
  |  |  ------------------
  ------------------
 2628|     34|        endAt1 = endAt2 = inchi_min( endAt1, endAt2 );
  ------------------
  |  |  167|     34|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 4, False: 30]
  |  |  ------------------
  ------------------
 2629|       |
 2630|     34|        if (Ct1->Ctbl[endCt1] == EMPTY_CT || Ct1->Ctbl[endCt1] == 0 ||
  ------------------
  |  |   62|     68|#define EMPTY_CT       0
  ------------------
  |  Branch (2630:13): [True: 34, False: 0]
  |  Branch (2630:46): [True: 0, False: 0]
  ------------------
 2631|     34|             Ct2->Ctbl[endCt1] == EMPTY_CT || Ct2->Ctbl[endCt1] == 0)
  ------------------
  |  |   62|     34|#define EMPTY_CT       0
  ------------------
  |  Branch (2631:14): [True: 0, False: 0]
  |  Branch (2631:47): [True: 0, False: 0]
  ------------------
 2632|     34|        {
 2633|     34|            endCt1 = endCt2 = endCt1 - 1;
 2634|     34|        }
 2635|     34|        lenNumH =
 2636|     34|            lenNumH1 =
 2637|     34|            lenNumH2 = inchi_min( Ct1->lenNumH, Ct2->lenNumH );
  ------------------
  |  |  167|     34|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 4, False: 30]
  |  |  ------------------
  ------------------
 2638|       |
 2639|     34|        len_iso_sort_key =
 2640|     34|            len_iso_sort_key1 =
 2641|     34|            len_iso_sort_key2 = inchi_min( Ct1->len_iso_sort_key, Ct1->len_iso_sort_key );
  ------------------
  |  |  167|     34|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 34]
  |  |  ------------------
  ------------------
 2642|     34|    }
 2643|  3.11k|    else
 2644|  3.11k|    {
 2645|  3.11k|        if (Ct1->Ctbl[endCt1 - 1] == EMPTY_CT)
  ------------------
  |  |   62|  3.11k|#define EMPTY_CT       0
  ------------------
  |  Branch (2645:13): [True: 0, False: 3.11k]
  ------------------
 2646|      0|        {
 2647|      0|            endCt1--;
 2648|      0|        }
 2649|  3.11k|        if (Ct2->Ctbl[endCt2 - 1] == EMPTY_CT)
  ------------------
  |  |   62|  3.11k|#define EMPTY_CT       0
  ------------------
  |  Branch (2649:13): [True: 0, False: 3.11k]
  ------------------
 2650|      0|        {
 2651|      0|            endCt2--;
 2652|      0|        }
 2653|  3.11k|        lenNumH1 = Ct1->lenNumH;
 2654|  3.11k|        lenNumH2 = Ct2->lenNumH;
 2655|  3.11k|        lenNumH = inchi_min( lenNumH1, lenNumH2 );
  ------------------
  |  |  167|  3.11k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 3.11k]
  |  |  ------------------
  ------------------
 2656|       |
 2657|  3.11k|        len_iso_sort_key1 = Ct1->len_iso_sort_key;
 2658|  3.11k|        len_iso_sort_key2 = Ct2->len_iso_sort_key;
 2659|  3.11k|        len_iso_sort_key = inchi_min( len_iso_sort_key1, len_iso_sort_key2 );
  ------------------
  |  |  167|  3.11k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 3.11k]
  |  |  ------------------
  ------------------
 2660|  3.11k|    }
 2661|       |
 2662|  3.14k|    if (diff = -( endCt1 - endCt2 ))
  ------------------
  |  Branch (2662:9): [True: 0, False: 3.14k]
  ------------------
 2663|      0|    {
 2664|       |        /* negative sign reproduces results for NSC=28393 */
 2665|      0|        goto done;
 2666|      0|    }
 2667|       |
 2668|  3.14k|    if (bSplitTautCompare)
  ------------------
  |  Branch (2668:9): [True: 1.19k, False: 1.95k]
  ------------------
 2669|  1.19k|    {
 2670|  1.19k|        midCt = inchi_min( Ct1->nLenCTAtOnly, Ct2->nLenCTAtOnly );
  ------------------
  |  |  167|  1.19k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 1.19k]
  |  |  ------------------
  ------------------
 2671|  1.19k|        if (midCt > endCt1)
  ------------------
  |  Branch (2671:13): [True: 34, False: 1.16k]
  ------------------
 2672|     34|        {
 2673|     34|            midCt = endCt1;
 2674|     34|        }
 2675|  1.19k|        midAt = inchi_min( maxVert, endAt1 );
  ------------------
  |  |  167|  1.19k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 1.19k]
  |  |  ------------------
  ------------------
 2676|  1.19k|    }
 2677|  1.95k|    else
 2678|  1.95k|    {
 2679|  1.95k|        midCt = endCt1;
 2680|  1.95k|        midAt = endAt1;
 2681|  1.95k|    }
 2682|       |
 2683|       |
 2684|       |    /*************************************************************************/
 2685|       |    /************ layer 0: connection table without tautomeric groups ********/
 2686|       |    /*************************************************************************/
 2687|   335k|    for (i = startCt1; i < midCt && Ct1->Ctbl[i] == Ct2->Ctbl[i]; i++)
  ------------------
  |  Branch (2687:24): [True: 332k, False: 3.14k]
  |  Branch (2687:37): [True: 332k, False: 0]
  ------------------
 2688|   332k|    {
 2689|   332k|        ;
 2690|   332k|    }
 2691|  3.14k|    if (i < midCt)
  ------------------
  |  Branch (2691:9): [True: 0, False: 3.14k]
  ------------------
 2692|      0|    {
 2693|      0|        diff = (int) Ct1->Ctbl[i] - (int) Ct2->Ctbl[i];
 2694|      0|        goto done;
 2695|      0|    }
 2696|       |
 2697|       |
 2698|       |    /*************************************************************************/
 2699|       |    /************* layer 1: H atoms without tautomeric H *********************/
 2700|       |    /*************************************************************************/
 2701|  3.14k|    nLayer++;
 2702|  3.14k|    if (Ct1->NumH && Ct2->NumH)
  ------------------
  |  Branch (2702:9): [True: 1.19k, False: 1.95k]
  |  Branch (2702:22): [True: 1.19k, False: 0]
  ------------------
 2703|  1.19k|    {
 2704|  1.19k|        if (diff = -( lenNumH1 - lenNumH2 ))
  ------------------
  |  Branch (2704:13): [True: 0, False: 1.19k]
  ------------------
 2705|      0|        {
 2706|       |            /* negative sign reproduces results for NSC=28393 */
 2707|      0|            goto done;
 2708|      0|        }
 2709|  1.19k|        if (endAt1 < maxVert)
  ------------------
  |  Branch (2709:13): [True: 0, False: 1.19k]
  ------------------
 2710|      0|        {
 2711|      0|            midNumH = lenNumH1 = endAt1;
 2712|      0|        }
 2713|  1.19k|        else if (bSplitTautCompare)
  ------------------
  |  Branch (2713:18): [True: 1.19k, False: 0]
  ------------------
 2714|  1.19k|        {
 2715|  1.19k|            midNumH = maxVert;
 2716|  1.19k|        }
 2717|      0|        else
 2718|      0|        {
 2719|      0|            midNumH = lenNumH1;
 2720|      0|        }
 2721|       |
 2722|   157k|        for (i = startAt1; i < midNumH && Ct1->NumH[i] == Ct2->NumH[i]; i++)
  ------------------
  |  Branch (2722:28): [True: 156k, False: 1.19k]
  |  Branch (2722:43): [True: 156k, False: 0]
  ------------------
 2723|   156k|        {
 2724|   156k|            ;
 2725|   156k|        }
 2726|  1.19k|        if (i < midNumH)
  ------------------
  |  Branch (2726:13): [True: 0, False: 1.19k]
  ------------------
 2727|      0|        {
 2728|      0|            diff = (int) Ct1->NumH[i] - (int) Ct2->NumH[i];
 2729|      0|            goto done;
 2730|      0|        }
 2731|  1.19k|    }
 2732|       |
 2733|       |
 2734|       |    /*************************************************************************/
 2735|       |    /************** layer 2: tautomeric part of CT and tautomeric H **********/
 2736|       |    /*************************************************************************/
 2737|  3.14k|    nLayer++;
 2738|  3.14k|    for (i = midCt; i < endCt1 && Ct1->Ctbl[i] == Ct2->Ctbl[i]; i++)
  ------------------
  |  Branch (2738:21): [True: 0, False: 3.14k]
  |  Branch (2738:35): [True: 0, False: 0]
  ------------------
 2739|      0|    {
 2740|      0|        ; /* compare tautomeric groups part of CT */
 2741|      0|    }
 2742|  3.14k|    if (i < endCt1)
  ------------------
  |  Branch (2742:9): [True: 0, False: 3.14k]
  ------------------
 2743|      0|    {
 2744|      0|        diff = (int) Ct1->Ctbl[i] - (int) Ct2->Ctbl[i];
 2745|      0|        goto done;
 2746|      0|    }
 2747|  3.14k|    if (Ct1->NumH && Ct2->NumH)
  ------------------
  |  Branch (2747:9): [True: 1.19k, False: 1.95k]
  |  Branch (2747:22): [True: 1.19k, False: 0]
  ------------------
 2748|  1.19k|    {
 2749|  1.19k|        for (i = midNumH; i < lenNumH1 && Ct1->NumH[i] == Ct2->NumH[i]; i++)
  ------------------
  |  Branch (2749:27): [True: 0, False: 1.19k]
  |  Branch (2749:43): [True: 0, False: 0]
  ------------------
 2750|      0|        {
 2751|      0|            ; /* compare tautomeric H */
 2752|      0|        }
 2753|  1.19k|        if (i < lenNumH1)
  ------------------
  |  Branch (2753:13): [True: 0, False: 1.19k]
  ------------------
 2754|      0|        {
 2755|      0|            diff = (int) Ct1->NumH[i] - (int) Ct2->NumH[i];
 2756|      0|            goto done;
 2757|      0|        }
 2758|  1.19k|    }
 2759|       |
 2760|       |    /*************************************************************************/
 2761|       |    /************** layer 3: Fixed H atoms ***********************************/
 2762|       |    /*************************************************************************/
 2763|  3.14k|    nLayer++;
 2764|  3.14k|    if (Ct1->NumHfixed && Ct2->NumHfixed)
  ------------------
  |  Branch (2764:9): [True: 0, False: 3.14k]
  |  Branch (2764:27): [True: 0, False: 0]
  ------------------
 2765|      0|    {
 2766|      0|        for (i = startAt1; i < endAt1 && Ct1->NumHfixed[i] == Ct2->NumHfixed[i]; i++)
  ------------------
  |  Branch (2766:28): [True: 0, False: 0]
  |  Branch (2766:42): [True: 0, False: 0]
  ------------------
 2767|      0|        {
 2768|      0|            ;
 2769|      0|        }
 2770|      0|        if (i < endAt1)
  ------------------
  |  Branch (2770:13): [True: 0, False: 0]
  ------------------
 2771|      0|        {
 2772|      0|            diff = (int) Ct1->NumHfixed[i] - (int) Ct2->NumHfixed[i];
 2773|      0|            goto done;
 2774|      0|        }
 2775|      0|    }
 2776|       |
 2777|       |
 2778|       |    /*************************************************************************/
 2779|       |    /************** layer 4: isotopic atoms, H and isotopic taut H ***********/
 2780|       |    /*************************************************************************/
 2781|  3.14k|    nLayer++;
 2782|  3.14k|    if (Ct1->iso_sort_key && Ct2->iso_sort_key)
  ------------------
  |  Branch (2782:9): [True: 1.17k, False: 1.97k]
  |  Branch (2782:30): [True: 1.16k, False: 13]
  ------------------
 2783|  1.16k|    {
 2784|  1.16k|        if (diff = -( len_iso_sort_key1 - len_iso_sort_key2 ))
  ------------------
  |  Branch (2784:13): [True: 0, False: 1.16k]
  ------------------
 2785|      0|        {
 2786|       |            /* negative sign reproduces results for NSC=28393 */
 2787|      0|            goto done;
 2788|      0|        }
 2789|   155k|        for (i = startAt1; i < endAt1 && Ct1->iso_sort_key[i] == Ct2->iso_sort_key[i]; i++)
  ------------------
  |  Branch (2789:28): [True: 153k, False: 1.16k]
  |  Branch (2789:42): [True: 153k, False: 0]
  ------------------
 2790|   153k|        {
 2791|   153k|            ;
 2792|   153k|        }
 2793|  1.16k|        if (i < endAt1)
  ------------------
  |  Branch (2793:13): [True: 0, False: 1.16k]
  ------------------
 2794|      0|        {
 2795|      0|            diff = Ct1->iso_sort_key[i] > Ct2->iso_sort_key[i] ? 1 : -1;
  ------------------
  |  Branch (2795:20): [True: 0, False: 0]
  ------------------
 2796|      0|            goto done;
 2797|      0|        }
 2798|  1.16k|    }
 2799|       |
 2800|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 2801|       |
 2802|       |
 2803|       |    /*************************************************************************/
 2804|       |    /************** layer 6: Fixed isotopic H atoms **************************/
 2805|       |    /*************************************************************************/
 2806|       |    nLayer++;
 2807|       |    if (Ct1->iso_sort_key_Hfixed && Ct2->iso_sort_key_Hfixed)
 2808|       |    {
 2809|       |        for (i = startAt1; i < midAt && Ct1->iso_sort_key_Hfixed[i] == Ct2->iso_sort_key_Hfixed[i]; i++)
 2810|       |            ;
 2811|       |        if (i < midAt)
 2812|       |        {
 2813|       |            diff = Ct1->iso_sort_key_Hfixed[i] > Ct2->iso_sort_key_Hfixed[i] ? 1 : -1;
 2814|       |            goto done;
 2815|       |        }
 2816|       |    }
 2817|       |#endif
 2818|       |
 2819|       |
 2820|  3.14k|done:
 2821|       |
 2822|  3.14k|#ifdef INCHI_CANON_MIN
 2823|  3.14k|    diff = -diff;
 2824|  3.14k|#endif
 2825|       |
 2826|  3.14k|    if (diff)
  ------------------
  |  Branch (2826:9): [True: 0, False: 3.14k]
  ------------------
 2827|      0|    {
 2828|      0|        diff = ( diff > 0 ) ? ( nLayer + 1 ) : -( nLayer + 1 ); /* return the discovered difference layer number >= 1 */
  ------------------
  |  Branch (2828:16): [True: 0, False: 0]
  ------------------
 2829|      0|    }
 2830|       |
 2831|  3.14k|    return diff;
 2832|  3.14k|}
CtCompareLayersGetFirstDiff:
 2858|   239k|{
 2859|   239k|    int iLayer;
 2860|   239k|    if (kLeast_rho)
  ------------------
  |  Branch (2860:9): [True: 239k, False: 0]
  ------------------
 2861|   239k|    {
 2862|  24.2M|        for (iLayer = 0; iLayer < MAX_LAYERS; iLayer++)
  ------------------
  |  |   54|  24.2M|#define MAX_LAYERS   100
  ------------------
  |  Branch (2862:26): [True: 23.9M, False: 239k]
  ------------------
 2863|  23.9M|        {
 2864|  23.9M|            if (kLeast_rho[iLayer].k)
  ------------------
  |  Branch (2864:17): [True: 283, False: 23.9M]
  ------------------
 2865|    283|            {
 2866|    283|                *L_rho = iLayer;
 2867|    283|                *I_rho = kLeast_rho[iLayer].i;
 2868|    283|                *k_rho = kLeast_rho[iLayer].k;
 2869|    283|                break;
 2870|    283|            }
 2871|  23.9M|        }
 2872|   239k|        if (iLayer == MAX_LAYERS)
  ------------------
  |  |   54|   239k|#define MAX_LAYERS   100
  ------------------
  |  Branch (2872:13): [True: 239k, False: 283]
  ------------------
 2873|   239k|        {
 2874|   239k|            if (nOneAdditionalLayer)
  ------------------
  |  Branch (2874:17): [True: 76.5k, False: 163k]
  ------------------
 2875|  76.5k|            {
 2876|  76.5k|                *L_rho = nOneAdditionalLayer;  /* ??? subtract 1 ??? */
 2877|  76.5k|                *I_rho = -1;
 2878|  76.5k|                *k_rho = 0;
 2879|  76.5k|                return 0; /* difference may be in the first additional layer */
 2880|  76.5k|            }
 2881|   163k|            else
 2882|   163k|            {
 2883|   163k|                *L_rho = INCHI_CANON_INFINITY;
  ------------------
  |  |   58|   163k|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
 2884|   163k|                *I_rho = -1;
 2885|   163k|                *k_rho = 0;
 2886|   163k|                return 0; /* no difference found */
 2887|   163k|            }
 2888|   239k|        }
 2889|    283|        else
 2890|    283|        {
 2891|    283|            return 1; /* difference in a real layer */
 2892|    283|        }
 2893|   239k|    }
 2894|      0|    else
 2895|      0|    {
 2896|      0|        return -1; /* no input, should not happen */
 2897|      0|    }
 2898|   239k|}
CtPartCompareLayers:
 2905|   239k|{
 2906|   239k|    int L_rho, I_rho, k_rho;
 2907|   239k|    if (0 < CtCompareLayersGetFirstDiff( kLeast_rho, nOneAdditionalLayer, &L_rho, &I_rho, &k_rho ) &&
  ------------------
  |  Branch (2907:9): [True: 283, False: 239k]
  ------------------
 2908|       |         /* differences has been found in a real layer or all real layers are identical */
 2909|   239k|         L_rho <= L_rho_fix_prev)
  ------------------
  |  Branch (2909:10): [True: 283, False: 0]
  ------------------
 2910|    283|    {
 2911|       |        /* in this layer pzb_rho == pzb_rho_fix or in the previous real layer */
 2912|    283|        return k_rho > 0 ? ( L_rho + 1 ) : -( L_rho + 1 );
  ------------------
  |  Branch (2912:16): [True: 0, False: 283]
  ------------------
 2913|    283|    }
 2914|       |
 2915|   239k|    return 0;
 2916|   239k|}
UpdateCompareLayers:
 2921|  4.84k|{
 2922|  4.84k|    int i;
 2923|  4.84k|    if (kLeastForLayer)
  ------------------
  |  Branch (2923:9): [True: 4.84k, False: 0]
  ------------------
 2924|  4.84k|    {
 2925|   489k|        for (i = 0; i < MAX_LAYERS; i++)
  ------------------
  |  |   54|   489k|#define MAX_LAYERS   100
  ------------------
  |  Branch (2925:21): [True: 484k, False: 4.84k]
  ------------------
 2926|   484k|        {
 2927|   484k|            if (abs( kLeastForLayer[i].k ) >= hzz)
  ------------------
  |  Branch (2927:17): [True: 273, False: 484k]
  ------------------
 2928|    273|            {
 2929|    273|                kLeastForLayer[i].k = 0;
 2930|    273|                kLeastForLayer[i].i = 0;
 2931|    273|            }
 2932|   484k|        }
 2933|  4.84k|    }
 2934|  4.84k|}
CtPartCopy:
 2941|   118k|{
 2942|   118k|    int     startCt1, startCt2, endCt1, endCt2;
 2943|   118k|    int     len2, len2H, len2Hfixed, len2iso_sort_key, len2iso_exchg_atnos, i;
 2944|   118k|    int     startAt1, endAt1, startAt2, endAt2; /*endCt,*/
 2945|       |
 2946|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 2947|       |    int     len2iso_sort_key_Hfixed;
 2948|       |#endif
 2949|       |
 2950|   118k|    k--;
 2951|       |
 2952|   118k|    if (k)
  ------------------
  |  Branch (2952:9): [True: 7.71k, False: 110k]
  ------------------
 2953|  7.71k|    {
 2954|  7.71k|        startCt1 = Ct1->nextCtblPos[k - 1];
 2955|  7.71k|        startCt2 = Ct2->nextCtblPos[k - 1];
 2956|  7.71k|        startAt1 = Ct1->nextAtRank[k - 1] - 1;
 2957|  7.71k|        startAt2 = Ct2->nextAtRank[k - 1] - 1;
 2958|  7.71k|    }
 2959|   110k|    else
 2960|   110k|    {
 2961|   110k|        startCt1 = startCt2 = 0;
 2962|   110k|        startAt1 = startAt2 = 0;
 2963|   110k|    }
 2964|       |
 2965|   118k|    endCt1 = Ct1->nextCtblPos[k];
 2966|   118k|    endCt2 = Ct2->nextCtblPos[k];
 2967|   118k|    endAt1 = (int) Ct1->nextAtRank[k] - 1;
 2968|   118k|    endAt2 = (int) Ct2->nextAtRank[k] - 1;
 2969|       |
 2970|   118k|    len2 = endCt2 - startCt2;
 2971|       |    /* len    = min(len1, len2); */
 2972|       |
 2973|       |#if ( bRELEASE_VERSION != 1 && defined(_DEBUG) )
 2974|       |    if (startCt1 != startCt2 || startAt1 != startAt2)
 2975|       |    {
 2976|       |        int stop = 1;
 2977|       |    }
 2978|       |#endif
 2979|       |
 2980|       |    /* copy connection table: Ctbl */
 2981|   238k|    for (i = 0; i < len2; i++)
  ------------------
  |  Branch (2981:17): [True: 120k, False: 118k]
  ------------------
 2982|   120k|    {
 2983|   120k|        Ct1->Ctbl[startCt1 + i] = Ct2->Ctbl[startCt2 + i];
 2984|   120k|    }
 2985|       |
 2986|       |    /* copy number of H: NumH */
 2987|   118k|    len2H = 0;
 2988|   118k|    if (Ct1->NumH && Ct2->NumH)
  ------------------
  |  Branch (2988:9): [True: 114k, False: 3.90k]
  |  Branch (2988:22): [True: 2.50k, False: 111k]
  ------------------
 2989|  2.50k|    {
 2990|  2.50k|        len2H = endAt2 - startAt2;
 2991|  2.50k|        if (endAt2 > Ct2->maxVert)
  ------------------
  |  Branch (2991:13): [True: 2, False: 2.49k]
  ------------------
 2992|      2|        {
 2993|      2|            len2H = Ct2->lenNumH - startAt2;
 2994|      2|        }
 2995|  5.09k|        for (i = 0; i < len2H; i++)
  ------------------
  |  Branch (2995:21): [True: 2.59k, False: 2.50k]
  ------------------
 2996|  2.59k|        {
 2997|  2.59k|            Ct1->NumH[startAt1 + i] = Ct2->NumH[startAt2 + i];
 2998|  2.59k|        }
 2999|  2.50k|    }
 3000|       |
 3001|       |    /* copy number of fixed H */
 3002|   118k|    len2Hfixed = 0;
 3003|   118k|    if (Ct1->NumHfixed && Ct2->NumHfixed)
  ------------------
  |  Branch (3003:9): [True: 2, False: 118k]
  |  Branch (3003:27): [True: 2, False: 0]
  ------------------
 3004|      2|    {
 3005|      2|        len2Hfixed = endAt2 - startAt2;
 3006|     12|        for (i = 0; i < len2Hfixed; i++)
  ------------------
  |  Branch (3006:21): [True: 10, False: 2]
  ------------------
 3007|     10|        {
 3008|     10|            Ct1->NumHfixed[startAt1 + i] = Ct2->NumHfixed[startAt2 + i];
 3009|     10|        }
 3010|      2|    }
 3011|       |
 3012|       |    /* copy isotopic keys */
 3013|   118k|    len2iso_sort_key = 0;
 3014|   118k|    if (Ct1->iso_sort_key && Ct2->iso_sort_key)
  ------------------
  |  Branch (3014:9): [True: 2.50k, False: 115k]
  |  Branch (3014:30): [True: 2.46k, False: 34]
  ------------------
 3015|  2.46k|    {
 3016|  2.46k|        len2iso_sort_key = endAt2 - startAt2;
 3017|  4.99k|        for (i = 0; i < len2iso_sort_key; i++)
  ------------------
  |  Branch (3017:21): [True: 2.53k, False: 2.46k]
  ------------------
 3018|  2.53k|        {
 3019|  2.53k|            Ct1->iso_sort_key[startAt1 + i] = Ct2->iso_sort_key[startAt2 + i];
 3020|  2.53k|        }
 3021|  2.46k|    }
 3022|       |
 3023|   118k|    len2iso_exchg_atnos = 0;
 3024|   118k|    if (Ct1->iso_exchg_atnos && Ct2->iso_exchg_atnos)
  ------------------
  |  Branch (3024:9): [True: 0, False: 118k]
  |  Branch (3024:33): [True: 0, False: 0]
  ------------------
 3025|      0|    {
 3026|      0|        len2iso_exchg_atnos = endAt2 - startAt2;
 3027|      0|        for (i = 0; i < len2iso_exchg_atnos; i++)
  ------------------
  |  Branch (3027:21): [True: 0, False: 0]
  ------------------
 3028|      0|        {
 3029|      0|            Ct1->iso_exchg_atnos[startAt1 + i] = Ct2->iso_exchg_atnos[startAt2 + i];
 3030|      0|        }
 3031|      0|    }
 3032|       |
 3033|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 3034|       |    len2iso_sort_key_Hfixed = 0;
 3035|       |    if (Ct1->iso_sort_key_Hfixed && Ct2->iso_sort_key_Hfixed)
 3036|       |    {
 3037|       |        len2iso_sort_key_Hfixed = endAt2 - startAt2;
 3038|       |        for (i = 0; i < len2iso_sort_key; i++)
 3039|       |        {
 3040|       |            Ct1->iso_sort_key_Hfixed[startAt1 + i] = Ct2->iso_sort_key_Hfixed[startAt2 + i];
 3041|       |        }
 3042|       |    }
 3043|       |#endif
 3044|       |
 3045|   118k|    Ct1->lenCt = startCt1 + len2;
 3046|   118k|    Ct1->nextCtblPos[k] = startCt1 + len2;
 3047|   118k|    Ct1->nextAtRank[k] = Ct2->nextAtRank[k];
 3048|   118k|    if (len2H)
  ------------------
  |  Branch (3048:9): [True: 2.50k, False: 115k]
  ------------------
 3049|  2.50k|    {
 3050|  2.50k|        Ct1->lenNumH = startAt1 + len2H;
 3051|  2.50k|    }
 3052|       |
 3053|       |    /*
 3054|       |    if ( len2Hfixed )
 3055|       |    {
 3056|       |        Ct1->lenNumHfixed   = startAt1 + len2Hfixed;
 3057|       |    }
 3058|       |    */
 3059|       |
 3060|   118k|    if (len2iso_sort_key)
  ------------------
  |  Branch (3060:9): [True: 2.46k, False: 115k]
  ------------------
 3061|  2.46k|    {
 3062|  2.46k|        Ct1->len_iso_sort_key = startAt1 + len2iso_sort_key;
 3063|  2.46k|    }
 3064|   118k|    if (len2iso_exchg_atnos)
  ------------------
  |  Branch (3064:9): [True: 0, False: 118k]
  ------------------
 3065|      0|    {
 3066|      0|        Ct1->len_iso_exchg_atnos = startAt1 + len2iso_exchg_atnos;
 3067|      0|    }
 3068|       |
 3069|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 3070|       |    if (len2iso_sort_key_Hfixed)
 3071|       |    {
 3072|       |        Ct1->len_iso_sort_key_Hfixed = startAt1 + len2iso_sort_key_Hfixed;
 3073|       |    }
 3074|       |#endif
 3075|       |
 3076|       |#ifdef INCHI_CANON_USE_HASH
 3077|       |    Ct1->hash[k] = Ct2->hash[k];
 3078|       |#endif
 3079|       |
 3080|   118k|    Ct1->lenPos = k + 1;
 3081|   118k|    INCHI_HEAPCHK
 3082|   118k|}
CtFullCopy:
 3087|   110k|{
 3088|       |    /* Ct1 does not have INCHI_CANON_INFINITY termination */
 3089|   110k|    int k;
 3090|   221k|    for (k = 0; k < Ct2->lenPos; k++)
  ------------------
  |  Branch (3090:17): [True: 111k, False: 110k]
  ------------------
 3091|   111k|    {
 3092|   111k|        CtPartCopy( Ct1 /* to */, Ct2 /* from */, k + 1 );
 3093|   111k|    }
 3094|   110k|}
TranspositionGetMcrAndFixSetAndUnorderedPartition:
 3105|  3.11k|{
 3106|  3.11k|    int i, j, k, mcr, num;
 3107|  3.11k|    AT_RANK next;
 3108|  3.11k|    bitWord *McrBits = McrSet->bitword[l - 1];
 3109|  3.11k|    bitWord *FixBits = FixSet->bitword[l - 1];
 3110|  3.11k|    int     len = McrSet->len_set * sizeof( bitWord );
 3111|       |
 3112|  3.11k|    memset( McrBits, 0, len );
 3113|  3.11k|    memset( FixBits, 0, len );
 3114|   333k|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (3114:17): [True: 330k, False: 3.11k]
  ------------------
 3115|   330k|    {
 3116|   330k|        p->equ2[i] = INCHI_CANON_INFINITY; /* for debug only */
  ------------------
  |  |   58|   330k|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
 3117|   330k|    }
 3118|       |
 3119|   333k|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (3119:17): [True: 330k, False: 3.11k]
  ------------------
 3120|   330k|    {
 3121|   330k|        j = (int) ( next = gamma->nAtNumb[i] );
 3122|       |
 3123|   330k|        if (j == i)
  ------------------
  |  Branch (3123:13): [True: 323k, False: 6.22k]
  ------------------
 3124|   323k|        {
 3125|   323k|            FixBits[i / pCG->m_num_bit] |= pCG->m_bBit[i % pCG->m_num_bit];
 3126|   323k|            McrBits[i / pCG->m_num_bit] |= pCG->m_bBit[i % pCG->m_num_bit];
 3127|       |            /* p->next[i] = INCHI_CANON_INFINITY; */ /* no link to same orbit points */
 3128|   323k|            p->equ2[i] = next;  /* fixed point */
 3129|   323k|        }
 3130|  6.22k|        else if (!( rank_mark_bit & next ))
  ------------------
  |  Branch (3130:18): [True: 3.11k, False: 3.11k]
  ------------------
 3131|  3.11k|        {
 3132|  3.11k|            gamma->nAtNumb[i] |= rank_mark_bit;
 3133|  3.11k|            mcr = inchi_min( j, i );
  ------------------
  |  |  167|  3.11k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 3.11k]
  |  |  ------------------
  ------------------
 3134|  3.11k|            num = 0;
 3135|       |            /* mark all nodes in the cycle to ignore later; find mcr */
 3136|  6.22k|            while (!( rank_mark_bit & ( next = gamma->nAtNumb[j] ) ))
  ------------------
  |  Branch (3136:20): [True: 3.11k, False: 3.11k]
  ------------------
 3137|  3.11k|            {
 3138|  3.11k|                gamma->nAtNumb[j] |= rank_mark_bit;
 3139|  3.11k|                j = (int) next;
 3140|  3.11k|                if (mcr > j)
  ------------------
  |  Branch (3140:21): [True: 0, False: 3.11k]
  ------------------
 3141|      0|                {
 3142|      0|                    mcr = j;
 3143|      0|                }
 3144|  3.11k|                num++;
 3145|  3.11k|            }
 3146|  3.11k|            McrBits[mcr / pCG->m_num_bit] |= pCG->m_bBit[mcr % pCG->m_num_bit]; /* save mcr */
 3147|       |            /* fill out the unordered partition, the mcr first, other in the cycle after that */
 3148|  3.11k|            p->equ2[mcr] = mcr;
 3149|  6.22k|            for (k = mcr; mcr != ( j = (int) ( rank_mask_bit & gamma->nAtNumb[k] ) ); k = j)
  ------------------
  |  Branch (3149:27): [True: 3.11k, False: 3.11k]
  ------------------
 3150|  3.11k|            {
 3151|  3.11k|                p->equ2[j] = mcr;
 3152|  3.11k|            }
 3153|  3.11k|        }
 3154|   330k|    }
 3155|       |
 3156|       |#if ( bRELEASE_VERSION != 1 && defined(_DEBUG) )
 3157|       |    /* for debug only */
 3158|       |    for (i = 0; i < n; i++)
 3159|       |    {
 3160|       |        if (p->equ2[i] >= n)
 3161|       |        {
 3162|       |            int stop = 1;
 3163|       |        }
 3164|       |    }
 3165|       |#endif
 3166|       |
 3167|       |    /* remove the marks */
 3168|   333k|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (3168:17): [True: 330k, False: 3.11k]
  ------------------
 3169|   330k|    {
 3170|   330k|        gamma->nAtNumb[i] &= rank_mask_bit;
 3171|   330k|    }
 3172|       |
 3173|  3.11k|    INCHI_HEAPCHK
 3174|  3.11k|}
SetBitCreate:
 3179|   110k|{
 3180|   110k|    bitWord  b1, b2;
 3181|   110k|    AT_NUMB n1, n2;
 3182|       |#ifdef INCHI_CANON_USE_HASH
 3183|       |    CtHash  h1, h2;
 3184|       |#endif
 3185|   110k|    int    i;
 3186|       |
 3187|   110k|    if (pCG->m_bBitInitialized)
  ------------------
  |  Branch (3187:9): [True: 109k, False: 49]
  ------------------
 3188|   109k|    {
 3189|   109k|        INCHI_HEAPCHK
 3190|   109k|        return 0; /* already created */
 3191|   109k|    }
 3192|       |
 3193|     49|    b1 = 1;
 3194|     49|    pCG->m_num_bit = 1;
 3195|    784|    for (b1 = 1, pCG->m_num_bit = 1; b1 < ( b2 = (bitWord) ( ( b1 << 1 )& BIT_WORD_MASK ) ); b1 = b2, pCG->m_num_bit++)
  ------------------
  |  |  352|    784|#define BIT_WORD_MASK  ((bitWord)~0)
  ------------------
  |  Branch (3195:38): [True: 735, False: 49]
  ------------------
 3196|    735|    {
 3197|    735|        ;
 3198|    735|    }
 3199|     49|    pCG->m_bBit = (bitWord*) inchi_calloc( pCG->m_num_bit, sizeof( bitWord ) );
  ------------------
  |  | 1133|     49|#define inchi_calloc   calloc
  ------------------
 3200|     49|    if (!pCG->m_bBit)
  ------------------
  |  Branch (3200:9): [True: 0, False: 49]
  ------------------
 3201|      0|    {
 3202|      0|        INCHI_HEAPCHK
 3203|      0|            return -1; /* failed */
 3204|      0|    }
 3205|    833|    for (i = 0, b1 = 1; i < pCG->m_num_bit; i++, b1 <<= 1)
  ------------------
  |  Branch (3205:25): [True: 784, False: 49]
  ------------------
 3206|    784|    {
 3207|    784|        pCG->m_bBit[i] = b1;
 3208|    784|    }
 3209|       |
 3210|    784|    for (n1 = 1; n1 < ( n2 = (AT_RANK) ( ( n1 << 1 )& AT_RANK_MASK ) ); n1 = n2)
  ------------------
  |  |   40|    784|#define AT_RANK_MASK   ((AT_RANK)~0)
  ------------------
  |  Branch (3210:18): [True: 735, False: 49]
  ------------------
 3211|    735|    {
 3212|    735|        ;
 3213|    735|    }
 3214|     49|    rank_mark_bit = n1;
 3215|     49|    rank_mask_bit = ~n1;
 3216|       |
 3217|       |#ifdef INCHI_CANON_USE_HASH
 3218|       |    for (h1 = 1; h1 < ( h2 = ( h1 << 1 ) ); h1 = h2)
 3219|       |    {
 3220|       |        ;
 3221|       |    }
 3222|       |    hash_mark_bit = h1;
 3223|       |#endif
 3224|     49|    pCG->m_bBitInitialized = 1;
 3225|     49|    INCHI_HEAPCHK
 3226|       |
 3227|     49|    return 1;
 3228|     49|}
SetBitFree:
 3233|    576|{
 3234|    576|    if (pCG->m_bBit)
  ------------------
  |  Branch (3234:9): [True: 49, False: 527]
  ------------------
 3235|     49|    {
 3236|     49|        inchi_free( pCG->m_bBit );
  ------------------
  |  | 1136|     49|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 49, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3237|     49|        pCG->m_bBit = NULL;
 3238|     49|        INCHI_HEAPCHK
 3239|     49|        return 1; /* success */
 3240|     49|    }
 3241|       |
 3242|       |    INCHI_HEAPCHK
 3243|       |
 3244|    527|    return 0; /* already destroyed */
 3245|    576|}
GetOneAdditionalLayer:
 3540|   110k|{
 3541|   110k|    int nLastLayer = -1, nNumLast = 0, nLayer = 0;
 3542|       |
 3543|   110k|    if (!pCD || !pzb_rho_fix)
  ------------------
  |  Branch (3543:9): [True: 0, False: 110k]
  |  Branch (3543:17): [True: 110k, False: 21]
  ------------------
 3544|   110k|    {
 3545|   110k|        return 0;
 3546|   110k|    }
 3547|       |
 3548|     21|    nLayer++; /* 1 */
 3549|     21|    if (pCD->NumH && !pzb_rho_fix->NumH)
  ------------------
  |  Branch (3549:9): [True: 21, False: 0]
  |  Branch (3549:22): [True: 0, False: 21]
  ------------------
 3550|      0|    {
 3551|      0|        nLastLayer = nLayer;
 3552|      0|        nNumLast++;
 3553|      0|    }
 3554|       |
 3555|     21|    nLayer++; /* 2 */
 3556|     21|    if (pCD->nLenCTAtOnly < pCD->nLenLinearCT && pzb_rho_fix->nLenCTAtOnly == pzb_rho_fix->lenCt)
  ------------------
  |  Branch (3556:9): [True: 4, False: 17]
  |  Branch (3556:50): [True: 4, False: 0]
  ------------------
 3557|      4|    {
 3558|      4|        nLastLayer = nLayer;
 3559|      4|        nNumLast++;
 3560|      4|    }
 3561|       |
 3562|     21|    nLayer++; /* 3 */
 3563|     21|    if (pCD->NumHfixed && !pzb_rho_fix->NumHfixed)
  ------------------
  |  Branch (3563:9): [True: 3, False: 18]
  |  Branch (3563:27): [True: 3, False: 0]
  ------------------
 3564|      3|    {
 3565|      3|        nLastLayer = nLayer;
 3566|      3|        nNumLast++;
 3567|      3|    }
 3568|       |
 3569|     21|    nLayer++; /* 4 */
 3570|     21|    if (pCD->iso_sort_key && !pzb_rho_fix->iso_sort_key)
  ------------------
  |  Branch (3570:9): [True: 13, False: 8]
  |  Branch (3570:30): [True: 13, False: 0]
  ------------------
 3571|     13|    {
 3572|     13|        nLastLayer = nLayer;
 3573|     13|        nNumLast++;
 3574|     13|    }
 3575|       |
 3576|       |    /*
 3577|       |    nLayer ++; // 5
 3578|       |    if ( pCD->nLenCTAtOnly < pCD->nLenLinearCT && pCD->iso_sort_key &&
 3579|       |        (pzb_rho_fix->nLenCTAtOnly == pzb_rho_fix->lenCt || !pzb_rho_fix->iso_sort_key ) )
 3580|       |        {
 3581|       |        nLastLayer = nLayer;
 3582|       |        nNumLast ++;
 3583|       |    }
 3584|       |    */
 3585|       |
 3586|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 3587|       |
 3588|       |    nLayer++; /* 6 */
 3589|       |    if (pCD->iso_sort_key_Hfixed && !pzb_rho_fix->iso_sort_key_Hfixed)
 3590|       |    {
 3591|       |        nLastLayer = nLayer;
 3592|       |        nNumLast++;
 3593|       |    }
 3594|       |#endif
 3595|     21|    if (1 == nNumLast)
  ------------------
  |  Branch (3595:9): [True: 20, False: 1]
  ------------------
 3596|     20|    {
 3597|     20|        return nLastLayer;
 3598|     20|    }
 3599|       |
 3600|      1|    return 0;
 3601|     21|}
CanonGraph:
 3651|   110k|{
 3652|       |
 3653|       |    /* bDigraph != 0
 3654|       |       means consider edges from atoms to t-groups
 3655|       |       as directed, that is, do not include
 3656|       |       t-group ranks in comparing neighbors
 3657|       |       when refining partition
 3658|       |    */
 3659|       |
 3660|       |    /* Always set
 3661|       |       lab = true
 3662|       |       dig = true
 3663|       |    */
 3664|       |
 3665|       |    /* in the comments:
 3666|       |        m = |zeta|
 3667|       |        r = |rho|
 3668|       |
 3669|       |        m < n or r < n in case pi[k] in P (i.e. satisfies Lemma 2.25)
 3670|       |
 3671|       |        Just after passing point B:
 3672|       |        ===========================
 3673|       |        K = k-1
 3674|       |        wi = v[i], i = 1..K
 3675|       |        Gamma(0) = Gamma = Aut(G)pi
 3676|       |        Gamma(i) = Gamma(w1,w2,...,wi) pointwise stabilizer for i=1..K
 3677|       |        zeta is a terminal node =>
 3678|       |          the coarsest equitable partition that fixes w1,...,wK is discrete =>
 3679|       |            Gamma(K)=1
 3680|       |        At point A only:
 3681|       |            index = |Gamma(k-1)|/|Gamma(k)|
 3682|       |        At points A and B:
 3683|       |            size  = |Gamma(k-1)|
 3684|       |            theta = theta(Gamma(k-1));
 3685|       |            Gamma(k-1) = <Y>, where Y is the set of all automprhisms output up
 3686|       |              to the present stage (in Step 10 = L10 )
 3687|       |            |Y| <= n - |theta|
 3688|       |    */
 3689|       |
 3690|   110k|    AT_RANK    *pCt = pCD->LinearCT;
 3691|       |    /*int         nMaxLenCt        =  pCD->nMaxLenLinearCT;*/
 3692|   110k|    int        *nLenCt = &pCD->nLenLinearCT;
 3693|   110k|    CANON_DATA *pCD1 = pCD;
 3694|       |
 3695|   110k|    int i, k, k2, index, l, ok, ret = 0, res;
 3696|   110k|    int t_Lemma;   /* hh: if pi[k-1] satisfies Lemma 2-25 then
 3697|       |                          t_Lemma = min{i| i=1..k && pi[i-1] satisfies Lemma 2-25}*/
 3698|       |                   /* otherwise t_Lemma = k --> here this is always the case */
 3699|   110k|    int t_eq_zeta; /* ht: min{i|i=1..m && all terminal modes descended from or equal
 3700|       |                      to zeta(i) have been shown to be equivalent}. */
 3701|   110k|    int h_zeta;    /* h: the longest common ancestor of zeta and nu is nu(h_zeta) */
 3702|   110k|    int h_rho;     /* hb: the longest common ancestor of rho and nu is nu(h_rho) */
 3703|   110k|    int hz_rho;    /* hzb: max{i|i=1..min(k,r) && Lambda(G,pi,nu(i)) == Lambda(G,pi,rho(i))} */
 3704|   110k|    int hz_zeta;   /* hzf: max{i|i=1..min(k,m) && Lambda(G,pi,nu(i)) == Lambda(G,pi,zeta(i))} */
 3705|   110k|    int qzb_rho;   /* Ct(Lambda[k]) - Ct(rho[k]) */
 3706|   110k|    double size;   /* |Aut(G)| */
 3707|       |
 3708|       |
 3709|   110k|    int  nNumLayers = ( NULL != pCD->NumH ) + ( NULL != pCD->NumHfixed ) +
 3710|       |                      /* (bDigraph && pCD->nLenLinearCT > pCD->nLenCTAtOnly)*/ /* ??? tautomeric */
 3711|   110k|                      ( NULL != pCD->iso_sort_key )
 3712|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 3713|       |                    + ( NULL != pCD->iso_sort_key_Hfixed )
 3714|       |#endif
 3715|   110k|                    ;
 3716|       |
 3717|       |
 3718|   110k|    int  dig = ( bDigraph || nNumLayers );
  ------------------
  |  Branch (3718:18): [True: 18, False: 110k]
  |  Branch (3718:30): [True: 3, False: 110k]
  ------------------
 3719|   110k|    int  bSplitTautCompare = ( bDigraph || nNumLayers ); /* compare taut. H and tgroups connections after H */
  ------------------
  |  Branch (3719:32): [True: 18, False: 110k]
  |  Branch (3719:44): [True: 3, False: 110k]
  ------------------
 3720|       |                        /* digraph: 1=>do not use Lemma 2.25, 0 => use */
 3721|   110k|    int  lab = 1;       /* label: 1=>find canonical numbering;
 3722|       |                            0=>do not find canonical numbering, do not use rho */
 3723|   110k|    int  r;             /* |rho| */
 3724|   110k|    int  bZetaEqRho = lab;
 3725|   110k|    int  bZetaIsomorph;
 3726|       |
 3727|   110k|    long lNumEqlZeta;
 3728|       |
 3729|       |    /*const int L = MAX_SET_SIZE;*/
 3730|   110k|    int L_curr_max_set_size = MAX_SET_SIZE;
  ------------------
  |  |   52|   110k|#define MAX_SET_SIZE 32766 /*16384*/
  ------------------
 3731|       |
 3732|   110k|    UnorderedPartition theta, theta_from_gamma;
 3733|       |
 3734|   110k|    Cell *W;  /* W[i] is the first non-trivial cell of pi[i+1] */
 3735|   110k|    Node *v;  /* v[i] is in W[i] to create T(G,pi,nu[i+1]) */
 3736|   110k|    Node tvc, tvh;
 3737|   110k|    S_CHAR *e, *qzb = NULL;   /* qzb = NULL always */
 3738|       |
 3739|       |    /* current node CT */
 3740|   110k|    ConTable Lambda;
 3741|       |    /* first leaf CT */
 3742|   110k|    ConTable zf_zeta; /* Ct for zeta,  the first discovered terminal node */
 3743|       |    /* best leaf/node CT: find the greatest pzb_rho possibly subject to pzb_rho[k] <= pzb_rho_fix[k] condition */
 3744|   110k|    ConTable *pzb_rho = NULL;  /* Ct for rho,   the best discovered terminal node */
 3745|       |    /* fixed input CT: for all k pzb_rho[k] <= pzb_rho_fix[k]; at the end pzb_rho == pzb_rho_fix */
 3746|   110k|    ConTable *pzb_rho_fix = ( pp_zb_rho_inp && *pp_zb_rho_inp ) ? *pp_zb_rho_inp : NULL;
  ------------------
  |  Branch (3746:31): [True: 21, False: 110k]
  |  Branch (3746:48): [True: 21, False: 0]
  ------------------
 3747|       |
 3748|   110k|    NodeSet Omega; /* MAX_SET_SIZE */
 3749|   110k|    NodeSet Phi;   /* MAX_SET_SIZE */
 3750|   110k|    NodeSet cur_nodes;   /* 1 each */
 3751|       |
 3752|   110k|    Transposition gamma;
 3753|       |
 3754|   110k|    Partition zeta;      /* the first discovered terminal node */
 3755|   110k|    Partition rho;       /* the best discovered terminal node */
 3756|       |
 3757|   110k|    int nNumFoundGenerators = 0;
 3758|   110k|    int qzb_rho_fix = 0;
 3759|   110k|    int hzb_rho_fix = 0;
 3760|   110k|    int bRhoIsDiscrete = 1;
 3761|   110k|    kLeast kLeast_rho[MAX_LAYERS];
 3762|   110k|    kLeast kLeast_rho_fix[MAX_LAYERS];
 3763|   110k|    int nOneAdditionalLayer;
 3764|   110k|    int pzb_rho_fix_reached = 0;
 3765|   110k|    int L_rho_fix_prev = 0, I_rho_fix_prev = -1, k_rho_fix_prev = 0;
 3766|       |
 3767|   110k|    if (!LargeMolecules)
  ------------------
  |  Branch (3767:9): [True: 110k, False: 0]
  ------------------
 3768|   110k|    {
 3769|   110k|        L_curr_max_set_size = NORMALLY_ALLOWED_MAX_SET_SIZE;
  ------------------
  |  |   53|   110k|#define NORMALLY_ALLOWED_MAX_SET_SIZE 2048
  ------------------
 3770|   110k|    }
 3771|       |
 3772|       |
 3773|       |    /* Note: Layered comparison should be consistent, especially in layer numbers.
 3774|       |             Layered comparison is implemented in:
 3775|       |                     CtFullCompare()
 3776|       |                     CtPartCompare()
 3777|       |                     GetOneAdditionalLayer()
 3778|       |
 3779|       |             The partial comparison results in kLeast[] are used in
 3780|       |                     CtFullCompareLayers()
 3781|       |                     CtPartCompareLayers()
 3782|       |                     CtCompareLayersGetFirstDiff()
 3783|       |                     UpdateCompareLayers()
 3784|       |     */
 3785|       |
 3786|       |
 3787|   110k|    nOneAdditionalLayer = GetOneAdditionalLayer( pCD1, pzb_rho_fix );
 3788|       |
 3789|       |
 3790|       |    /* next 2 lines for debug only */
 3791|       |    /* num_g++;  */
 3792|       |    /* WriteGraph( G, n_tg, num_g, "V:\\IChI_v10\\Gordon-Graphs\\hard\\k06g08v312-alt.dre", "a+" ); */
 3793|       |
 3794|       |    /* memory allocation */
 3795|       |
 3796|   110k|    if (0 > SetBitCreate( pCG ))
  ------------------
  |  Branch (3796:9): [True: 0, False: 110k]
  ------------------
 3797|      0|    {
 3798|      0|        return -1;
 3799|      0|    }
 3800|   110k|    if (pzb_rho_fix && pzb_rho_fix->nLenCTAtOnly != pCD->nLenCTAtOnly)
  ------------------
  |  Branch (3800:9): [True: 21, False: 110k]
  |  Branch (3800:24): [True: 0, False: 21]
  ------------------
 3801|      0|    {
 3802|       |        /* consistency check */
 3803|      0|        return -2;
 3804|      0|    }
 3805|   110k|    ok = 1;
 3806|       |
 3807|       |
 3808|   110k|    ok &= UnorderedPartitionCreate( &theta, n_tg );
 3809|   110k|    ok &= UnorderedPartitionCreate( &theta_from_gamma, n_tg );
 3810|       |
 3811|   110k|    ok &= ( NULL != ( W = (Cell*) inchi_calloc( n_tg, sizeof( W[0] ) ) ) );
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
 3812|   110k|    ok &= ( NULL != ( v = (Node*) inchi_calloc( n_tg, sizeof( v[0] ) ) ) );
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
 3813|   110k|    ok &= ( NULL != ( e = (S_CHAR*) inchi_calloc( n_tg, sizeof( e[0] ) ) ) );
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
 3814|       |
 3815|       |    /*
 3816|       |    ok &= (NULL != (v   = (Node*)inchi_calloc( n_tg, sizeof(W[0]))));
 3817|       |    ok &= (NULL != (e   = (S_CHAR*)inchi_calloc( n_tg, sizeof(W[0]))));
 3818|       |    */
 3819|       |
 3820|       |    /*    ok &= (NULL != (qzb = (S_CHAR*)inchi_calloc( n_tg, sizeof(W[0])))); */
 3821|   110k|    ok &= CTableCreate( &Lambda, n, pCD );
 3822|   110k|    ok &= CTableCreate( &zf_zeta, n, pCD );
 3823|   110k|    ok &= ( ( pzb_rho = (ConTable *) inchi_calloc( 1, sizeof( *pzb_rho ) ) ) &&
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
  |  Branch (3823:13): [True: 110k, False: 0]
  ------------------
 3824|   110k|            CTableCreate( pzb_rho, n, pCD ) );
  ------------------
  |  Branch (3824:13): [True: 110k, False: 0]
  ------------------
 3825|       |
 3826|   110k|    ok &= NodeSetCreate( pCG, &Omega, n_tg, L_curr_max_set_size );
 3827|   110k|    ok &= NodeSetCreate( pCG, &Phi, n_tg, L_curr_max_set_size );
 3828|   110k|    ok &= NodeSetCreate( pCG, &cur_nodes, n_tg, 1 );
 3829|       |
 3830|   110k|    ok &= PartitionCreate( &zeta, n_tg );
 3831|   110k|    ok &= PartitionCreate( &rho, n_tg );
 3832|   110k|    ok &= TranspositionCreate( &gamma, n_tg );
 3833|       |
 3834|       |    INCHI_HEAPCHK
 3835|       |
 3836|       |/*L1:*/
 3837|   110k|k = 1;
 3838|   110k|    size = 1.0;
 3839|   110k|    h_zeta = hz_rho = index = l = 0;
 3840|       |
 3841|   110k|    if (!ok)
  ------------------
  |  Branch (3841:9): [True: 0, False: 110k]
  ------------------
 3842|      0|    {
 3843|      0|        goto exit_function; /* initialization failed */
 3844|      0|    }
 3845|       |
 3846|   110k|    UnorderedPartitionMakeDiscrete( &theta, n_tg );
 3847|   110k|    t_Lemma = 2;
 3848|       |
 3849|   110k|    pCC->lNumBreakTies = 0;
 3850|   110k|    pCC->lNumDecreasedCT = 0;
 3851|   110k|    pCC->lNumRejectedCT = 0;
 3852|   110k|    pCC->lNumEqualCT = 1;
 3853|   110k|    pCC->lNumTotCT = 0;
 3854|   110k|    lNumEqlZeta = 1;
 3855|       |
 3856|   110k|    hzb_rho_fix = 1;
 3857|       |
 3858|   110k|    memset( kLeast_rho, 0, sizeof( kLeast_rho ) );
 3859|   110k|    memset( kLeast_rho_fix, 0, sizeof( kLeast_rho_fix ) );
 3860|       |
 3861|   110k|    if (PartitionIsDiscrete( &pi[k - 1], n_tg ))
  ------------------
  |  Branch (3861:9): [True: 109k, False: 204]
  ------------------
 3862|   109k|    {
 3863|       |        /* added the following 3 lines to the original to create Ct */
 3864|   109k|        PartitionCopy( &rho, &pi[k - 1], n_tg );
 3865|   109k|        CtPartFill( G, pCD, &pi[k - 1], pzb_rho, 1, n, n_tg );
 3866|   109k|        CtPartINCHI_CANON_INFINITY( pzb_rho, qzb, 2 );
 3867|   109k|        pCC->lNumTotCT++;
 3868|   109k|        r = k;
 3869|       |        /* goto L18; */
 3870|   109k|        goto exit_function;
 3871|   109k|    }
 3872|       |
 3873|    204|    if (!dig && PartitionSatisfiesLemma_2_25( &pi[0], n ))
  ------------------
  |  Branch (3873:9): [True: 191, False: 13]
  |  Branch (3873:17): [True: 124, False: 67]
  ------------------
 3874|    124|    {
 3875|    124|        t_Lemma = 1;
 3876|    124|    }
 3877|       |
 3878|       |    /*
 3879|       |    PartitionGetFirstCell( &pi[k-1], &W[k-1], k, n );
 3880|       |    v[k-1] = CellGetMinNode( &pi[k-1], &W[k-1], 0, pCD1 );
 3881|       |    CtPartClear( &Lambda, 1 );
 3882|       |    e[k-1] = 0;
 3883|       |    */
 3884|    204|    CtPartClear( &Lambda, 1 );
 3885|    204|    INCHI_HEAPCHK
 3886|       |
 3887|       |/* L2: reach the first leaf and save it in zeta and rho */
 3888|  3.18k|while (k)
  ------------------
  |  Branch (3888:8): [True: 3.18k, False: 0]
  ------------------
 3889|  3.18k|{
 3890|       |    /* the two next lines intentionally switched */
 3891|       |    /* Create equitable partition in pi[k]  */
 3892|  3.18k|    PartitionGetFirstCell( &pi[k - 1], W, k, n );
 3893|  3.18k|    v[k - 1] = CellGetMinNode( &pi[k - 1], &W[k - 1], 0, pCD1 );
 3894|  3.18k|    e[k - 1] = 0;
 3895|  3.18k|    if (dig || !PartitionSatisfiesLemma_2_25( &pi[k - 1], n ))
  ------------------
  |  Branch (3895:9): [True: 1.23k, False: 1.95k]
  |  Branch (3895:16): [True: 1.40k, False: 546]
  ------------------
 3896|  2.63k|    {
 3897|  2.63k|        t_Lemma = k + 1;
 3898|  2.63k|    }
 3899|       |    /* e[k-1] = 0; */
 3900|  3.18k|    {
 3901|  3.18k|        Node vv = v[k - 1];
 3902|  3.18k|        if (0 > ( ret = PartitionColorVertex( pCG, G, &pi[k - 1], vv /*v[k-1]*/, n, n_tg, n_max, bDigraph, 0 ) ))
  ------------------
  |  Branch (3902:13): [True: 0, False: 3.18k]
  ------------------
 3903|      0|        {
 3904|      0|            goto exit_error;
 3905|      0|        }
 3906|  3.18k|    }
 3907|  3.18k|    pCC->lNumBreakTies++;
 3908|  3.18k|    k++;
 3909|       |
 3910|  3.18k|    CtPartFill( G, pCD, &pi[k - 1], &Lambda, k - 1, n, n_tg );
 3911|       |
 3912|       |    /* return -1; *//* debug only */
 3913|       |    /* if(h_zeta==0)goto L5; L5: */
 3914|       |    /* the first terminal node has not been reached yet */
 3915|       |    /* search for the predefined numbering */
 3916|  3.18k|    if (pzb_rho_fix && QZFIX_OK( qzb_rho_fix ))
  ------------------
  |  | 3535|  1.23k|#define QZFIX_OK(X) ((X)<=0)
  |  |  ------------------
  |  |  |  Branch (3535:21): [True: 1.23k, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (3916:9): [True: 1.23k, False: 1.95k]
  ------------------
 3917|  1.23k|    {
 3918|  1.23k|        qzb_rho_fix = CtPartCompare( &Lambda, pzb_rho_fix, qzb, kLeast_rho_fix, k - 1, 1, bSplitTautCompare );
 3919|  1.23k|        if (QZFIX_OK( qzb_rho_fix ))
  ------------------
  |  | 3535|  1.23k|#define QZFIX_OK(X) ((X)<=0)
  |  |  ------------------
  |  |  |  Branch (3535:21): [True: 1.23k, False: 0]
  |  |  ------------------
  ------------------
 3920|  1.23k|        {
 3921|  1.23k|            hzb_rho_fix = k;
 3922|  1.23k|        }
 3923|  1.23k|    }
 3924|       |
 3925|  3.18k|    if (lab && QZFIX_OK( qzb_rho_fix ))  /* DCh */
  ------------------
  |  | 3535|  3.18k|#define QZFIX_OK(X) ((X)<=0)
  |  |  ------------------
  |  |  |  Branch (3535:21): [True: 3.18k, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (3925:9): [True: 3.18k, False: 0]
  ------------------
 3926|  3.18k|        CtPartCopy( pzb_rho, &Lambda, k - 1 );
 3927|  3.18k|    CtPartCopy( &zf_zeta, &Lambda, k - 1 );
 3928|       |    /*goto L4; L4:*/
 3929|  3.18k|    if (PartitionIsDiscrete( &pi[k - 1], n ))
  ------------------
  |  Branch (3929:9): [True: 204, False: 2.97k]
  ------------------
 3930|    204|    {
 3931|    204|        break;  /* goto L7; */
 3932|    204|    }
 3933|       |    /* goto L2; */
 3934|  3.18k|}
 3935|       |
 3936|    204|    pCC->lNumTotCT++;
 3937|       |
 3938|       |    /* L7; L7: */
 3939|       |    /* if ( h_zeta == 0 ) goto L18; L18:*/
 3940|    204|    h_zeta = t_eq_zeta = hz_zeta = k;
 3941|    204|    CtPartINCHI_CANON_INFINITY( &zf_zeta, NULL, k );
 3942|       |    /******************** <<<===== B **************************/
 3943|    204|    PartitionCopy( &zeta, &pi[k - 1], n_tg );
 3944|    204|    if (lab)
  ------------------
  |  Branch (3944:9): [True: 204, False: 0]
  ------------------
 3945|    204|    {
 3946|    204|        if (pzb_rho_fix)
  ------------------
  |  Branch (3946:13): [True: 13, False: 191]
  ------------------
 3947|     13|        {
 3948|     13|            if (0 == qzb_rho_fix)
  ------------------
  |  Branch (3948:17): [True: 13, False: 0]
  ------------------
 3949|     13|            {
 3950|     13|                qzb_rho_fix = CtFullCompare( &Lambda, pzb_rho_fix, 1, bSplitTautCompare );
 3951|     13|                if (qzb_rho_fix > 0)
  ------------------
  |  Branch (3951:21): [True: 0, False: 13]
  ------------------
 3952|      0|                {
 3953|      0|                    hzb_rho_fix = 1;
 3954|      0|                }
 3955|     13|            }
 3956|     13|            if (hzb_rho_fix > 1)
  ------------------
  |  Branch (3956:17): [True: 13, False: 0]
  ------------------
 3957|     13|            {
 3958|     13|                PartitionCopy( &rho, &pi[hzb_rho_fix - 1], n_tg );
 3959|       |                /*CtPartINCHI_CANON_INFINITY( pzb_rho, qzb, k );*/
 3960|     13|            }
 3961|     13|            hz_rho = h_rho = hzb_rho_fix;
 3962|     13|            bRhoIsDiscrete = ( hzb_rho_fix == k );
 3963|     13|            if (bRhoIsDiscrete)
  ------------------
  |  Branch (3963:17): [True: 13, False: 0]
  ------------------
 3964|     13|            {
 3965|     13|                CtPartINCHI_CANON_INFINITY( pzb_rho, qzb, k );
 3966|     13|                pzb_rho_fix_reached = !qzb_rho_fix;
 3967|     13|                CtCompareLayersGetFirstDiff( kLeast_rho_fix, nOneAdditionalLayer,
 3968|     13|                                 &L_rho_fix_prev, &I_rho_fix_prev, &k_rho_fix_prev );
 3969|     13|            }
 3970|       |
 3971|       |#if ( bRELEASE_VERSION != 1 && defined(_DEBUG) )
 3972|       |            else
 3973|       |            {
 3974|       |                int stop = 1;
 3975|       |            }
 3976|       |#endif
 3977|     13|        }
 3978|    191|        else
 3979|    191|        {
 3980|    191|            PartitionCopy( &rho, &pi[k - 1], n_tg );
 3981|    191|            hz_rho = h_rho = k;
 3982|    191|            CtPartINCHI_CANON_INFINITY( pzb_rho, qzb, k );
 3983|    191|        }
 3984|    204|        qzb_rho = 0;
 3985|    204|    }
 3986|       |
 3987|    204|    r = k;
 3988|    204|    v[k - 1] = INCHI_CANON_INFINITY;     /* DCh */
  ------------------
  |  |   58|    204|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
 3989|    204|    CellMakeEmpty( W, k ); /* DCh */
 3990|    204|    k--;
 3991|    204|    goto L13;
 3992|       |
 3993|       |
 3994|   163k|L2:
 3995|       |    /* the two next lines intentionally switched */
 3996|       |    /* Create equitable partition in pi[k]  */
 3997|   163k|    if (0 > ( ret = PartitionColorVertex( pCG, G, &pi[k - 1], v[k - 1],
  ------------------
  |  Branch (3997:9): [True: 0, False: 163k]
  ------------------
 3998|   163k|        n, n_tg, n_max, bDigraph, 0 ) ))
 3999|      0|    {
 4000|      0|        goto exit_error;
 4001|      0|    }
 4002|   163k|    pCC->lNumBreakTies++;
 4003|   163k|    k++;
 4004|   163k|    CtPartFill( G, pCD, &pi[k - 1], &Lambda, k - 1, n, n_tg );
 4005|   163k|    e[k - 1] = 0;         /* moved  */
 4006|   163k|    v[k - 1] = INCHI_CANON_INFINITY;  /* added by DCh. */
  ------------------
  |  |   58|   163k|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
 4007|   163k|    CellMakeEmpty( W, k ); /* DCh */
 4008|       |
 4009|   163k|    if (hz_zeta == k - 1 &&
  ------------------
  |  Branch (4009:9): [True: 163k, False: 0]
  ------------------
 4010|   163k|         0 == CtPartCompare( &Lambda, &zf_zeta, NULL, NULL, k - 1, 0, bSplitTautCompare ))
  ------------------
  |  Branch (4010:10): [True: 163k, False: 283]
  ------------------
 4011|   163k|    {
 4012|   163k|        hz_zeta = k; /* max{k|Lambda(G,pi,nu(k))==Lambda(G,pi,zeta) }  */
 4013|   163k|    } /* added */
 4014|       |
 4015|       |
 4016|       |    /* -- old code ---
 4017|       |    if ( pzb_rho_fix && QZFIX_OK(qzb_rho_fix) ) {
 4018|       |        qzb_rho_fix = CtPartCompare( &Lambda, pzb_rho_fix, qzb, kLeast_rho_fix, k-1, 1, bSplitTautCompare );
 4019|       |        if ( QZFIX_OK(qzb_rho_fix) ) {
 4020|       |            hzb_rho_fix = k;
 4021|       |        } else {
 4022|       |            pCC->lNumRejectedCT ++;
 4023|       |        }
 4024|       |    }
 4025|       |    */
 4026|       |
 4027|       |    /* --- new code ---*/
 4028|   163k|    if (pzb_rho_fix && !qzb_rho_fix)
  ------------------
  |  Branch (4028:9): [True: 76.5k, False: 86.7k]
  |  Branch (4028:24): [True: 76.5k, False: 0]
  ------------------
 4029|  76.5k|    {
 4030|  76.5k|        qzb_rho_fix = CtPartCompare( &Lambda, pzb_rho_fix, qzb, kLeast_rho_fix, k - 1, 1, bSplitTautCompare );
 4031|  76.5k|        if (!qzb_rho_fix && bRhoIsDiscrete)
  ------------------
  |  Branch (4031:13): [True: 76.5k, False: 0]
  |  Branch (4031:29): [True: 76.5k, False: 0]
  ------------------
 4032|  76.5k|        {
 4033|  76.5k|            qzb_rho_fix = CtPartCompareLayers( kLeast_rho_fix, L_rho_fix_prev, nOneAdditionalLayer );
 4034|       |
 4035|  76.5k|#if ( FIX_ChCh_CONSTIT_CANON_BUG == 1 )
 4036|  76.5k|            if (qzb_rho_fix)
  ------------------
  |  Branch (4036:17): [True: 0, False: 76.5k]
  ------------------
 4037|      0|            {
 4038|      0|                int L_rho_fix_diff = abs( qzb_rho_fix ) - 1;
 4039|      0|                if (L_rho_fix_diff < L_rho_fix_prev ||
  ------------------
  |  Branch (4039:21): [True: 0, False: 0]
  ------------------
 4040|      0|                     L_rho_fix_diff == L_rho_fix_prev && kLeast_rho_fix[L_rho_fix_diff].i < I_rho_fix_prev)
  ------------------
  |  Branch (4040:22): [True: 0, False: 0]
  |  Branch (4040:58): [True: 0, False: 0]
  ------------------
 4041|      0|                {
 4042|      0|                    qzb_rho_fix = L_rho_fix_diff + 1; /* positive difference will be rejected */
 4043|      0|                }
 4044|      0|            }
 4045|  76.5k|#endif
 4046|       |
 4047|       |#if ( bRELEASE_VERSION != 1 && defined(_DEBUG) )
 4048|       |            if (qzb_rho_fix)
 4049|       |            {
 4050|       |                int stop = 1; /* debug only */
 4051|       |            }
 4052|       |#endif
 4053|  76.5k|        }
 4054|  76.5k|        if (!QZFIX_OK( qzb_rho_fix ))
  ------------------
  |  | 3535|  76.5k|#define QZFIX_OK(X) ((X)<=0)
  ------------------
  |  Branch (4054:13): [True: 0, False: 76.5k]
  ------------------
 4055|      0|        {
 4056|      0|            pCC->lNumRejectedCT++;
 4057|      0|        }
 4058|  76.5k|    }
 4059|   163k|    if (pzb_rho_fix && QZFIX_OK( qzb_rho_fix ))
  ------------------
  |  | 3535|  76.5k|#define QZFIX_OK(X) ((X)<=0)
  |  |  ------------------
  |  |  |  Branch (3535:21): [True: 76.5k, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (4059:9): [True: 76.5k, False: 86.7k]
  ------------------
 4060|  76.5k|    {
 4061|  76.5k|        hzb_rho_fix = k;
 4062|  76.5k|    }
 4063|       |    /* if (!lab) goto L3; */
 4064|   163k|    if (lab && QZFIX_OK( qzb_rho_fix ))
  ------------------
  |  | 3535|   163k|#define QZFIX_OK(X) ((X)<=0)
  |  |  ------------------
  |  |  |  Branch (3535:21): [True: 163k, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (4064:9): [True: 163k, False: 0]
  ------------------
 4065|   163k|    {
 4066|       |        /* once the difference has been found it is meaningful as long as k increments */
 4067|       |        /* cur_qzb2 = CtPartCompare( &Lambda, pzb_rho, qzb, k-1 ); */ /* rho compare */
 4068|   163k|        if (hz_rho == k - 1 && !qzb_rho && bRhoIsDiscrete)
  ------------------
  |  Branch (4068:13): [True: 163k, False: 0]
  |  Branch (4068:32): [True: 163k, False: 0]
  |  Branch (4068:44): [True: 163k, False: 0]
  ------------------
 4069|   163k|        {
 4070|   163k|            int qzb_rho_temp = 0;
 4071|   163k|            qzb_rho = CtPartCompare( &Lambda, pzb_rho, qzb, kLeast_rho, k - 1, 0, bSplitTautCompare );
 4072|       |            /* old code */
 4073|   163k|            if (!qzb_rho && pzb_rho_fix_reached &&
  ------------------
  |  Branch (4073:17): [True: 163k, False: 0]
  |  Branch (4073:29): [True: 76.5k, False: 86.7k]
  ------------------
 4074|   163k|                  nOneAdditionalLayer && 0 > kLeast_rho[nOneAdditionalLayer].k)
  ------------------
  |  Branch (4074:19): [True: 76.5k, False: 0]
  |  Branch (4074:42): [True: 283, False: 76.2k]
  ------------------
 4075|    283|            {
 4076|    283|                qzb_rho_temp = -( nOneAdditionalLayer + 1 );
 4077|       |                /* qzb_rho = -(nOneAdditionalLayer+1); *//* early rejection */
 4078|    283|            }
 4079|       |            /* new code */
 4080|   163k|            if (!qzb_rho && bRhoIsDiscrete)
  ------------------
  |  Branch (4080:17): [True: 163k, False: 0]
  |  Branch (4080:29): [True: 163k, False: 0]
  ------------------
 4081|   163k|            {
 4082|   163k|                qzb_rho = CtPartCompareLayers( kLeast_rho, L_rho_fix_prev, 0 );
 4083|   163k|#if ( FIX_ChCh_CONSTIT_CANON_BUG == 1 )
 4084|   163k|                if (qzb_rho)
  ------------------
  |  Branch (4084:21): [True: 283, False: 163k]
  ------------------
 4085|    283|                {
 4086|    283|                    int L_rho_diff = abs( qzb_rho ) - 1;
 4087|    283|                    if (L_rho_diff < L_rho_fix_prev ||
  ------------------
  |  Branch (4087:25): [True: 0, False: 283]
  ------------------
 4088|    283|                         L_rho_diff == L_rho_fix_prev && kLeast_rho[L_rho_diff].i < I_rho_fix_prev)
  ------------------
  |  Branch (4088:26): [True: 283, False: 0]
  |  Branch (4088:58): [True: 0, False: 283]
  ------------------
 4089|      0|                    {
 4090|      0|                        qzb_rho = -( L_rho_diff + 1 ); /* negative difference will be rejected */
 4091|      0|                    }
 4092|    283|                }
 4093|   163k|#endif
 4094|   163k|            }
 4095|       |            /* compare old results to new */
 4096|       |#if ( bRELEASE_VERSION != 1 && defined(_DEBUG) )
 4097|       |            if (qzb_rho_temp && qzb_rho_temp != qzb_rho)
 4098|       |            {
 4099|       |                int stop = 1; /* <BRKPT> */
 4100|       |            }
 4101|       |#endif
 4102|   163k|            if (!qzb_rho)
  ------------------
  |  Branch (4102:17): [True: 163k, False: 283]
  ------------------
 4103|   163k|            {
 4104|   163k|                hz_rho = k;
 4105|   163k|            }
 4106|    283|            else
 4107|    283|            {
 4108|    283|                if (qzb_rho < 0)
  ------------------
  |  Branch (4108:21): [True: 283, False: 0]
  ------------------
 4109|    283|                {
 4110|    283|                    pCC->lNumRejectedCT++;
 4111|    283|                }
 4112|    283|            }
 4113|   163k|        }
 4114|   163k|        if (qzb_rho > 0 || !qzb_rho && !bRhoIsDiscrete)
  ------------------
  |  Branch (4114:13): [True: 0, False: 163k]
  |  Branch (4114:28): [True: 163k, False: 283]
  |  Branch (4114:40): [True: 0, False: 163k]
  ------------------
 4115|      0|        {
 4116|       |            /* found better rho */
 4117|      0|            if (!nNumLayers)
  ------------------
  |  Branch (4117:17): [True: 0, False: 0]
  ------------------
 4118|      0|            {
 4119|      0|                CtPartCopy( pzb_rho, &Lambda, k - 1 );
 4120|      0|            }
 4121|      0|        }
 4122|   163k|    }
 4123|       |
 4124|       |
 4125|       |/*L3:*/
 4126|       |    /*if ( hz_rho == k || (lab && qzb_rho >= 0 ) )*/
 4127|       |    /*if ( hz_zeta == k || hz_rho == k || (lab && qzb_rho >= 0 ) ) goto L4; else goto L6;*/
 4128|   163k|    if (hz_zeta == k || hz_rho == k ||
  ------------------
  |  Branch (4128:9): [True: 163k, False: 283]
  |  Branch (4128:25): [True: 0, False: 283]
  ------------------
 4129|   163k|        ( lab && qzb_rho >= 0 && QZFIX_OK( qzb_rho_fix ) ))
  ------------------
  |  | 3535|      0|#define QZFIX_OK(X) ((X)<=0)
  |  |  ------------------
  |  |  |  Branch (3535:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (4129:11): [True: 283, False: 0]
  |  Branch (4129:18): [True: 0, False: 283]
  ------------------
 4130|   163k|    {
 4131|       |        /*L4: check for possible isomorphism or found a better rho */
 4132|   163k|        if (PartitionIsDiscrete( &pi[k - 1], n ))
  ------------------
  |  Branch (4132:13): [True: 3.11k, False: 159k]
  ------------------
 4133|  3.11k|        {
 4134|  3.11k|            pCC->lNumTotCT++;
 4135|  3.11k|            goto L7;
 4136|  3.11k|        }
 4137|   159k|        PartitionGetFirstCell( &pi[k - 1], W, k, n );
 4138|   159k|        v[k - 1] = CellGetMinNode( &pi[k - 1], &W[k - 1], 0, pCD1 );
 4139|   159k|        if (!dig && PartitionSatisfiesLemma_2_25( &pi[k - 1], n ))
  ------------------
  |  Branch (4139:13): [True: 84.8k, False: 75.1k]
  |  Branch (4139:21): [True: 6.27k, False: 78.5k]
  ------------------
 4140|  6.27k|        {
 4141|  6.27k|            ; /* found additional isomprphism */
 4142|  6.27k|        }
 4143|   153k|        else
 4144|   153k|        {
 4145|   153k|            t_Lemma = k + 1;
 4146|   153k|        }
 4147|   159k|        e[k - 1] = 0;  /* created new cell W[k-1] */
 4148|   159k|        goto L2;
 4149|   163k|    }
 4150|       |
 4151|       |
 4152|    283|L6:
 4153|       |    /* a better rho or no good node was found at this level; return to smaller k */
 4154|    283|    k2 = k;
 4155|    283|    k = inchi_min( t_Lemma - 1, inchi_max( t_eq_zeta - 1, hz_rho ) );
  ------------------
  |  |  167|    566|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 270, False: 13]
  |  |  |  Branch (167:32): [True: 270, False: 13]
  |  |  |  Branch (167:41): [True: 0, False: 13]
  |  |  ------------------
  ------------------
 4156|    283|    if (k2 == t_Lemma)
  ------------------
  |  Branch (4156:9): [True: 283, False: 0]
  ------------------
 4157|    283|    {
 4158|    283|        goto L13;
 4159|    283|    }
 4160|       |
 4161|       |    /* store isomorphism found from Lemma 2.25. should be dig=0 !!! */
 4162|      0|    if (dig)
  ------------------
  |  Branch (4162:9): [True: 0, False: 0]
  ------------------
 4163|      0|    {
 4164|       |#if ( bRELEASE_VERSION != 1 && defined(_DEBUG) )
 4165|       |        int stop = 1;
 4166|       |#endif
 4167|      0|        goto L13;
 4168|      0|    }
 4169|       |
 4170|      0|    l = inchi_min( l + 1, L_curr_max_set_size );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4171|      0|    PartitionGetMcrAndFixSet( pCG, &pi[t_Lemma - 1], &Omega, &Phi, n_tg, l );
 4172|      0|    goto L12;
 4173|       |
 4174|       |
 4175|       |
 4176|  3.11k|L7:
 4177|       |    /* from L4: pi[k-1] is discrete */
 4178|  3.11k|    if (h_zeta == 0)
  ------------------
  |  Branch (4178:9): [True: 0, False: 3.11k]
  ------------------
 4179|      0|    {
 4180|       |        /*goto L18;*/  /* error. the first T(nu) leaf was found */
 4181|      0|        ret = CT_CANON_ERR;
  ------------------
  |  |   63|      0|#define CT_CANON_ERR         (CT_ERR_FIRST-16)  /*(-30016) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 4182|      0|        goto exit_error;
 4183|      0|    }
 4184|  3.11k|    if (k != hz_zeta)
  ------------------
  |  Branch (4184:9): [True: 0, False: 3.11k]
  ------------------
 4185|      0|    {
 4186|      0|        goto L8;
 4187|      0|    }
 4188|       |    /*  here zeta^gamma == nu */
 4189|       |    /*  if ( G^gamma == G ) goto L10; */
 4190|  3.11k|    if (0 == ( res = CtFullCompare( &Lambda, &zf_zeta, 0, bSplitTautCompare ) ))
  ------------------
  |  Branch (4190:9): [True: 3.11k, False: 0]
  ------------------
 4191|  3.11k|    {
 4192|  3.11k|        PartitionGetTransposition( &zeta, &pi[k - 1], n_tg, &gamma );
 4193|  3.11k|        bZetaIsomorph = 1; /* for testing only */
 4194|  3.11k|        lNumEqlZeta++;
 4195|  3.11k|        goto L10;
 4196|  3.11k|    }
 4197|      0|    else
 4198|       |#if ( bRELEASE_VERSION != 1 && defined(_DEBUG) )
 4199|       |    {
 4200|       |        int stop = 1;
 4201|       |    }
 4202|       |#endif
 4203|       |    /* !!! we should never come here !!! */
 4204|      0|    if (!nNumLayers)
  ------------------
  |  Branch (4204:9): [True: 0, False: 0]
  ------------------
 4205|      0|    {
 4206|      0|        ret = -2;
 4207|      0|        goto exit_error;
 4208|      0|    }
 4209|       |
 4210|       |
 4211|      0|L8: /* here nu is discrete: check rho for being a bettere leaf or isomorphism */
 4212|       |    /*if ( !lab || qzb_rho < 0 || !QZFIX_OK(qzb_rho_fix) )*/
 4213|      0|    if (!lab || qzb_rho < 0 && ( !pzb_rho_fix || qzb_rho_fix > 0 ))
  ------------------
  |  Branch (4213:9): [True: 0, False: 0]
  |  Branch (4213:17): [True: 0, False: 0]
  |  Branch (4213:34): [True: 0, False: 0]
  |  Branch (4213:50): [True: 0, False: 0]
  ------------------
 4214|      0|    {
 4215|      0|        goto L6;
 4216|      0|    }
 4217|      0|    if (pzb_rho_fix && kLeast_rho_fix && 0 == qzb_rho_fix)
  ------------------
  |  Branch (4217:9): [True: 0, False: 0]
  |  Branch (4217:24): [True: 0, False: 0]
  |  Branch (4217:42): [True: 0, False: 0]
  ------------------
 4218|      0|    {
 4219|       |        /* check for the rejection condition: Lambda > zb_rho_fix */
 4220|      0|        if (kLeast_rho_fix)
  ------------------
  |  Branch (4220:13): [True: 0, False: 0]
  ------------------
 4221|      0|        {
 4222|      0|            int qzb_rho_fix_alt;
 4223|      0|            qzb_rho_fix = CtFullCompareLayers( kLeast_rho_fix );
 4224|       |            /* for debug only */
 4225|      0|            qzb_rho_fix_alt = CtFullCompare( &Lambda, pzb_rho_fix, 1, bSplitTautCompare );
 4226|      0|            if (qzb_rho_fix != qzb_rho_fix_alt)
  ------------------
  |  Branch (4226:17): [True: 0, False: 0]
  ------------------
 4227|      0|            {
 4228|       |#if ( bRELEASE_VERSION != 1 && defined(_DEBUG) )
 4229|       |                int stop = 1;
 4230|       |#endif
 4231|      0|                qzb_rho_fix = qzb_rho_fix_alt;
 4232|      0|            }
 4233|       |            /* end debug */
 4234|      0|        }
 4235|      0|        else
 4236|      0|        {
 4237|      0|            qzb_rho_fix = CtFullCompare( &Lambda, pzb_rho_fix, 1, bSplitTautCompare );
 4238|      0|        }
 4239|      0|        if (!pzb_rho_fix_reached)
  ------------------
  |  Branch (4239:13): [True: 0, False: 0]
  ------------------
 4240|      0|        {
 4241|      0|            pzb_rho_fix_reached = !qzb_rho_fix;
 4242|      0|        }
 4243|      0|        if (0 < qzb_rho_fix)
  ------------------
  |  Branch (4243:13): [True: 0, False: 0]
  ------------------
 4244|      0|        {
 4245|       |            /* Lambda > pzb_rho_fix, ignore this node */
 4246|       |            /* hzb_rho_fix = min( hzb_rho_fix, hz_rho ); */ /* ??? */
 4247|      0|            qzb_rho_fix = 0;
 4248|      0|            goto L6;
 4249|      0|        }
 4250|      0|        qzb_rho_fix = 0;
 4251|      0|    }
 4252|       |
 4253|      0|    if (qzb_rho < 0)
  ------------------
  |  Branch (4253:9): [True: 0, False: 0]
  ------------------
 4254|      0|    {
 4255|      0|        goto L6;
 4256|      0|    }
 4257|      0|    if (qzb_rho > 0 || !bRhoIsDiscrete)
  ------------------
  |  Branch (4257:9): [True: 0, False: 0]
  |  Branch (4257:24): [True: 0, False: 0]
  ------------------
 4258|      0|    {
 4259|      0|        goto L9; /* note: p67 says k > PartitionSize( &rho, n ) */
 4260|      0|    }
 4261|      0|    if (k < r)
  ------------------
  |  Branch (4261:9): [True: 0, False: 0]
  ------------------
 4262|      0|    {
 4263|      0|        goto L9; /* cannot understand it... */
 4264|      0|    }
 4265|       |
 4266|       |    /* !!! we should never come here if G(nu) != G(rho): CtPartCompare must be enough !!! */
 4267|       |
 4268|       |    /* if ( G(nu) > G(rho) ) goto L9; */
 4269|      0|    if (kLeast_rho)
  ------------------
  |  Branch (4269:9): [True: 0, False: 0]
  ------------------
 4270|      0|    {
 4271|      0|        int cur_qzb_alt;
 4272|      0|        qzb_rho = CtFullCompareLayers( kLeast_rho );
 4273|       |        /* for debug only */
 4274|      0|        cur_qzb_alt = CtFullCompare( &Lambda, pzb_rho, 0, bSplitTautCompare );
 4275|      0|        if (qzb_rho != cur_qzb_alt)
  ------------------
  |  Branch (4275:13): [True: 0, False: 0]
  ------------------
 4276|      0|        {
 4277|       |#if ( bRELEASE_VERSION != 1 && defined(_DEBUG) )
 4278|       |            int stop = 1;
 4279|       |#endif
 4280|      0|            qzb_rho = cur_qzb_alt;
 4281|      0|        }
 4282|       |        /* end debug */
 4283|      0|    }
 4284|      0|    else
 4285|      0|    {
 4286|      0|        qzb_rho = CtFullCompare( &Lambda, pzb_rho, 0, bSplitTautCompare );
 4287|      0|    }
 4288|       |    /* qzb_rho difference can be due to layers 1..MAX_LAYERS-1 only */
 4289|      0|    if (0 < qzb_rho)
  ------------------
  |  Branch (4289:9): [True: 0, False: 0]
  ------------------
 4290|      0|    {
 4291|       |        /* CtFullCompare( &Lambda, pzb_rho, 0, bSplitTautCompare ); */
 4292|      0|        qzb_rho = 0;
 4293|      0|        goto L9;
 4294|      0|    }
 4295|       |    /* if ( G(nu) < G(rho) ) goto L6; */
 4296|      0|    if (0 > qzb_rho)
  ------------------
  |  Branch (4296:9): [True: 0, False: 0]
  ------------------
 4297|      0|    {
 4298|      0|        qzb_rho = 0;
 4299|      0|        goto L6;
 4300|      0|    }
 4301|       |    /* nu^gamma == rho */
 4302|      0|    if (r != k)
  ------------------
  |  Branch (4302:9): [True: 0, False: 0]
  ------------------
 4303|      0|    {  /* if() is for debug only */
 4304|      0|        r = k;
 4305|      0|    }
 4306|       |
 4307|      0|    PartitionGetTransposition( &pi[k - 1], &rho, n_tg, &gamma );
 4308|      0|    bZetaIsomorph = 0; /* DCh */
 4309|      0|    pCC->lNumEqualCT++;
 4310|      0|    goto L10;
 4311|       |
 4312|      0|L9:
 4313|       |    /* rho := nu; */
 4314|      0|    PartitionCopy( &rho, &pi[k - 1], n_tg );
 4315|      0|    if (nNumLayers)
  ------------------
  |  Branch (4315:9): [True: 0, False: 0]
  ------------------
 4316|      0|    {
 4317|      0|        CtFullCopy( pzb_rho, &Lambda );
 4318|      0|    }
 4319|      0|    bZetaEqRho = 0;
 4320|      0|    qzb_rho = 0;
 4321|      0|    CtCompareLayersGetFirstDiff( kLeast_rho_fix, nOneAdditionalLayer,
 4322|      0|                                 &L_rho_fix_prev, &I_rho_fix_prev,
 4323|      0|                                 &k_rho_fix_prev );
 4324|      0|    memset( kLeast_rho, 0, sizeof( kLeast_rho ) );
 4325|      0|    h_rho = hz_rho = k;
 4326|      0|    CtPartINCHI_CANON_INFINITY( pzb_rho, qzb, k );
 4327|      0|    pCC->lNumDecreasedCT++;
 4328|      0|    pCC->lNumEqualCT = 1;
 4329|      0|    bRhoIsDiscrete = 1;
 4330|      0|    goto L6;
 4331|       |
 4332|  3.11k|L10: /* discrete pi[k-1] && G^gamma == G */
 4333|  3.11k|    pCC->lNumEqualCT += bZetaEqRho || !( bZetaIsomorph || qzb_rho );
  ------------------
  |  Branch (4333:25): [True: 3.11k, False: 0]
  |  Branch (4333:42): [True: 0, False: 0]
  |  Branch (4333:59): [True: 0, False: 0]
  ------------------
 4334|  3.11k|    l = inchi_min( l + 1, L_curr_max_set_size );
  ------------------
  |  |  167|  3.11k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 3.11k, False: 0]
  |  |  ------------------
  ------------------
 4335|       |    /* Omega[l] := mcr(gamma);
 4336|       |       Phi[l]   := fix(gamma);
 4337|       |    */
 4338|       |
 4339|  3.11k|    TranspositionGetMcrAndFixSetAndUnorderedPartition( pCG, &gamma, &Omega, &Phi,
 4340|  3.11k|                                                       n_tg, l, &theta_from_gamma );
 4341|       |    /*
 4342|       |    if ( theta(gamma) <= theta ) goto L11;
 4343|       |    theta := theta v theta(gamma);
 4344|       |    UnorderedPartitionJoin() returns 0 if theta_from_gamma is finer than theta,
 4345|       |    which means no changes in theta: theta_from_gamma ^ theta == theta.
 4346|       |    */
 4347|  3.11k|    if (!UnorderedPartitionJoin( &theta_from_gamma, &theta, n_tg ))
  ------------------
  |  Branch (4347:9): [True: 0, False: 3.11k]
  ------------------
 4348|      0|    {
 4349|      0|        goto L11; /* no new isomorphism found */
 4350|      0|    }
 4351|       |
 4352|       |    /*  Output gamma (it is the Aut(G) generator) -- omitted -- */
 4353|  3.11k|    nNumFoundGenerators++;
 4354|       |    /* if ( tvc in mcr(theta) ) goto L11; */
 4355|  3.11k|    if (tvc == GetUnorderedPartitionMcrNode( &theta, tvc ))
  ------------------
  |  Branch (4355:9): [True: 3.11k, False: 0]
  ------------------
 4356|  3.11k|    {
 4357|  3.11k|        goto L11;
 4358|  3.11k|    }
 4359|      0|    k = h_zeta;
 4360|      0|    goto L13;
 4361|       |
 4362|  3.11k|L11:
 4363|  3.11k|    k = lab ? h_rho : h_zeta; /***Changed*** originally was k = h_rho; */
  ------------------
  |  Branch (4363:9): [True: 3.11k, False: 0]
  ------------------
 4364|       |
 4365|  3.11k|L12:
 4366|       |    /* if ( e[k-1] == 1 ) */
 4367|       |#if ( bRELEASE_VERSION != 1 && defined(_DEBUG) )
 4368|       |    if (e[k - 1] == 1 && v[k - 1] == INCHI_CANON_INFINITY)
 4369|       |    {
 4370|       |        int stop = 1;          /* <BRKPT> testing only */
 4371|       |    }
 4372|       |#endif
 4373|  3.11k|    if (e[k - 1] == 1 && v[k - 1] != INCHI_CANON_INFINITY)
  ------------------
  |  |   58|      0|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
  |  Branch (4373:9): [True: 0, False: 3.11k]
  |  Branch (4373:26): [True: 0, False: 0]
  ------------------
 4374|      0|    {
 4375|       |        /* INCHI_CANON_INFINITY for testing only */
 4376|      0|        CellIntersectWithSet( pCG, &pi[k - 1], &W[k - 1], &Omega, l );
 4377|      0|    }
 4378|       |
 4379|  6.78k|L13:
 4380|       |
 4381|  6.78k|    if (UserAction && USER_ACTION_QUIT == ( *UserAction )( ) ||
  ------------------
  |  |  152|      0|#define USER_ACTION_QUIT   1
  ------------------
  |  Branch (4381:9): [True: 0, False: 6.78k]
  |  Branch (4381:23): [True: 0, False: 0]
  ------------------
 4382|  6.78k|         ConsoleQuit && ( *ConsoleQuit )( ))
  ------------------
  |  Branch (4382:10): [True: 0, False: 6.78k]
  |  Branch (4382:25): [True: 0, False: 0]
  ------------------
 4383|      0|    {
 4384|      0|        ret = CT_USER_QUIT_ERR;
  ------------------
  |  |   60|      0|#define CT_USER_QUIT_ERR     (CT_ERR_FIRST-13)  /*(-30013) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 4385|      0|        goto exit_error;
 4386|      0|    }
 4387|       |
 4388|  6.78k|    if (bInchiTimeIsOver( ic, pCD->ulTimeOutTime ))
  ------------------
  |  Branch (4388:9): [True: 0, False: 6.78k]
  ------------------
 4389|      0|    {
 4390|      0|        ret = CT_TIMEOUT_ERR;
  ------------------
  |  |   55|      0|#define CT_TIMEOUT_ERR       (CT_ERR_FIRST- 8)  /*(-30008) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 4391|      0|        goto exit_error;
 4392|      0|    }
 4393|       |
 4394|  6.78k|    if (k == 0)
  ------------------
  |  Branch (4394:9): [True: 204, False: 6.58k]
  ------------------
 4395|    204|    {
 4396|    204|        goto exit_function; /* stop */
 4397|    204|    }
 4398|       |
 4399|  6.58k|    if (lab && k < h_rho)
  ------------------
  |  Branch (4399:9): [True: 6.58k, False: 0]
  |  Branch (4399:16): [True: 3.18k, False: 3.39k]
  ------------------
 4400|  3.18k|    {
 4401|       |        /***Added***/
 4402|  3.18k|        h_rho = k;
 4403|  3.18k|    }
 4404|       |
 4405|  6.58k|    if (k > h_zeta)
  ------------------
  |  Branch (4405:9): [True: 0, False: 6.58k]
  ------------------
 4406|      0|    {
 4407|      0|        if (v[k - 1] == INCHI_CANON_INFINITY)
  ------------------
  |  |   58|      0|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
  |  Branch (4407:13): [True: 0, False: 0]
  ------------------
 4408|      0|        {
 4409|       |            /*** Added by DCh for testing only ****/
 4410|      0|            k--;
 4411|      0|            goto L13;
 4412|      0|        }
 4413|      0|        goto L17;
 4414|      0|    }
 4415|  6.58k|    if (k == h_zeta)
  ------------------
  |  Branch (4415:9): [True: 3.39k, False: 3.18k]
  ------------------
 4416|  3.39k|    {
 4417|  3.39k|        goto L14;
 4418|  3.39k|    }
 4419|  3.18k|    h_zeta = k;
 4420|  3.18k|    tvc = tvh = CellGetMinNode( &pi[k - 1], &W[k - 1], 0, pCD1 );
 4421|       |
 4422|   157k|L14:
 4423|       |    /* if v[k] and tvh are in the same cell of theta then index ++ */
 4424|   157k|    if (GetUnorderedPartitionMcrNode( &theta, v[k - 1] ) ==
  ------------------
  |  Branch (4424:9): [True: 151k, False: 6.25k]
  ------------------
 4425|   157k|         GetUnorderedPartitionMcrNode( &theta, tvh ))
 4426|   151k|    {
 4427|   151k|        index++;
 4428|   151k|    }
 4429|   157k|    v[k - 1] = CellGetMinNode( &pi[k - 1], &W[k - 1], v[k - 1], pCD1 );
 4430|       |
 4431|   157k|    if (v[k - 1] == INCHI_CANON_INFINITY)
  ------------------
  |  |   58|   157k|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
  |  Branch (4431:9): [True: 3.18k, False: 154k]
  ------------------
 4432|  3.18k|    {
 4433|  3.18k|        goto L16;
 4434|  3.18k|    }
 4435|   154k|    if (v[k - 1] != GetUnorderedPartitionMcrNode( &theta, v[k - 1] ))
  ------------------
  |  Branch (4435:9): [True: 150k, False: 3.39k]
  ------------------
 4436|   150k|    {
 4437|   150k|        goto L14;
 4438|   150k|    }
 4439|       |
 4440|  3.39k|L15:
 4441|  3.39k|    t_Lemma = inchi_min( t_Lemma, k + 1 );
  ------------------
  |  |  167|  3.39k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 546, False: 2.85k]
  |  |  ------------------
  ------------------
 4442|  3.39k|    hz_zeta = inchi_min( hz_zeta, k );
  ------------------
  |  |  167|  3.39k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 3.39k]
  |  |  ------------------
  ------------------
 4443|       |    /*
 4444|       |    if ( lab && hz_rho >= k ) {
 4445|       |        hz_rho = k;
 4446|       |        qzb_rho = 0;
 4447|       |    }
 4448|       |    */
 4449|  3.39k|    if (lab)
  ------------------
  |  Branch (4449:9): [True: 3.39k, False: 0]
  ------------------
 4450|  3.39k|    {
 4451|  3.39k|        if (hz_rho >= k /*-1*/)
  ------------------
  |  Branch (4451:13): [True: 3.39k, False: 0]
  ------------------
 4452|  3.39k|        {
 4453|  3.39k|            qzb_rho = 0;
 4454|  3.39k|        }
 4455|  3.39k|        if (hz_rho > k)
  ------------------
  |  Branch (4455:13): [True: 3.21k, False: 179]
  ------------------
 4456|  3.21k|        {
 4457|  3.21k|            hz_rho = k;
 4458|  3.21k|        }
 4459|  3.39k|        UpdateCompareLayers( kLeast_rho, hz_rho );
 4460|  3.39k|    }
 4461|  3.39k|    if (pzb_rho_fix)
  ------------------
  |  Branch (4461:9): [True: 1.44k, False: 1.95k]
  ------------------
 4462|  1.44k|    {
 4463|  1.44k|        if (hzb_rho_fix >= k /*-1*/)
  ------------------
  |  Branch (4463:13): [True: 1.44k, False: 0]
  ------------------
 4464|  1.44k|        {
 4465|  1.44k|            qzb_rho_fix = 0;
 4466|  1.44k|        }
 4467|  1.44k|        if (hzb_rho_fix > k)
  ------------------
  |  Branch (4467:13): [True: 1.44k, False: 0]
  ------------------
 4468|  1.44k|        {
 4469|  1.44k|            hzb_rho_fix = k;
 4470|  1.44k|        }
 4471|  1.44k|        UpdateCompareLayers( kLeast_rho_fix, hzb_rho_fix );
 4472|  1.44k|    }
 4473|       |
 4474|  3.39k|    goto L2;
 4475|       |
 4476|  3.18k|L16:
 4477|  3.18k|    if (t_eq_zeta == k + 1 && index == CellGetNumberOfNodes( &pi[k - 1], &W[k - 1] ))
  ------------------
  |  Branch (4477:9): [True: 2.34k, False: 834]
  |  Branch (4477:31): [True: 2.33k, False: 13]
  ------------------
 4478|  2.33k|    {
 4479|  2.33k|        t_eq_zeta = k;
 4480|  2.33k|    }
 4481|       |
 4482|  3.18k|    size *= (double) index;
 4483|       |    /******************** <<<===== A **************************/
 4484|       |    /* passed K times after passing point A. At these passes
 4485|       |       k = K, K-1, ..., 1 in this order
 4486|       |    */
 4487|  3.18k|    index = 0;
 4488|  3.18k|    k--;
 4489|  3.18k|    goto L13;
 4490|       |
 4491|      0|L17:
 4492|       |    /* if ( e[k-1] == 0 ) */
 4493|       |#if ( bRELEASE_VERSION != 1 && defined(_DEBUG) )
 4494|       |    if (e[k - 1] == 0 && v[k - 1] == INCHI_CANON_INFINITY)
 4495|       |    {
 4496|       |        /* testing only */
 4497|       |        int stop = 1;  /* <BRKPT> */
 4498|       |    }
 4499|       |#endif
 4500|       |    /*
 4501|       |    if ( e[k] == 0 set W[k] = Intersection(W[k], Omega[i]) for each i = 1..l,
 4502|       |         such that {v[1]..v[k-1]} in Phi[i]
 4503|       |    */
 4504|      0|    if (e[k - 1] == 0 && v[k - 1] != INCHI_CANON_INFINITY) /* Added v[k-1]!=... DCh */
  ------------------
  |  |   58|      0|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
  |  Branch (4504:9): [True: 0, False: 0]
  |  Branch (4504:26): [True: 0, False: 0]
  ------------------
 4505|      0|    {
 4506|      0|        NodeSetFromVertices( pCG, &cur_nodes, 1, v, k - 1 );
 4507|      0|        for (i = 1; i <= l; i++)
  ------------------
  |  Branch (4507:21): [True: 0, False: 0]
  ------------------
 4508|      0|        {
 4509|      0|            if (AllNodesAreInSet( &cur_nodes, 1, &Phi, i ))
  ------------------
  |  Branch (4509:17): [True: 0, False: 0]
  ------------------
 4510|      0|            {
 4511|      0|                CellIntersectWithSet( pCG, &pi[k - 1], &W[k - 1], &Omega, i );
 4512|      0|            }
 4513|      0|        }
 4514|      0|    }
 4515|       |
 4516|      0|    e[k - 1] = 1;
 4517|      0|    v[k - 1] = CellGetMinNode( &pi[k - 1], &W[k - 1], v[k - 1], pCD1 );
 4518|      0|    if (v[k - 1] != INCHI_CANON_INFINITY)
  ------------------
  |  |   58|      0|#define INCHI_CANON_INFINITY       0x7FFF
  ------------------
  |  Branch (4518:9): [True: 0, False: 0]
  ------------------
 4519|      0|    {
 4520|      0|        goto L15;
 4521|      0|    }
 4522|      0|    k--;
 4523|      0|    goto L13;
 4524|       |/* L18: see above */
 4525|       |
 4526|   110k|exit_function:
 4527|       |    /* CtPartFill( G, pCD, &rho, pzb_rho, 1, n, n_tg ); */
 4528|   110k|    if (!bRhoIsDiscrete)
  ------------------
  |  Branch (4528:9): [True: 0, False: 110k]
  ------------------
 4529|      0|    {
 4530|      0|        ret = CT_CANON_ERR;
  ------------------
  |  |   63|      0|#define CT_CANON_ERR         (CT_ERR_FIRST-16)  /*(-30016) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 4531|      0|        goto exit_error;
 4532|      0|    }
 4533|       |
 4534|   110k|    if (pzb_rho_fix)
  ------------------
  |  Branch (4534:9): [True: 21, False: 110k]
  ------------------
 4535|     21|    {
 4536|     21|        qzb_rho_fix = CtFullCompare( pzb_rho_fix, pzb_rho, 1, bSplitTautCompare );
 4537|     21|        if (qzb_rho_fix)
  ------------------
  |  Branch (4537:13): [True: 0, False: 21]
  ------------------
 4538|      0|        {
 4539|      0|            ret = CT_CANON_ERR;
  ------------------
  |  |   63|      0|#define CT_CANON_ERR         (CT_ERR_FIRST-16)  /*(-30016) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 4540|      0|            goto exit_error;
 4541|      0|        }
 4542|     21|    }
 4543|       |
 4544|       |    /* SymmRank */
 4545|   110k|    memset( nSymmRank, 0, n_tg * sizeof( nSymmRank[0] ) );
 4546|   224k|    for (i = 0; i < n_tg; i++)
  ------------------
  |  Branch (4546:17): [True: 114k, False: 110k]
  ------------------
 4547|   114k|    {
 4548|   114k|        k = rho.AtNumber[i];
 4549|   114k|        k2 = (int) GetUnorderedPartitionMcrNode( &theta, (AT_NUMB) ( k + 1 ) ) - 1;
 4550|   114k|        if (!nSymmRank[k2] || nSymmRank[k2] > rho.Rank[k])
  ------------------
  |  Branch (4550:13): [True: 111k, False: 3.11k]
  |  Branch (4550:31): [True: 0, False: 3.11k]
  ------------------
 4551|   111k|        {
 4552|   111k|            nSymmRank[k2] = rho.Rank[k];
 4553|   111k|        }
 4554|   114k|    }
 4555|   224k|    for (i = 0; i < n_tg; i++)
  ------------------
  |  Branch (4555:17): [True: 114k, False: 110k]
  ------------------
 4556|   114k|    {
 4557|   114k|        k = rho.AtNumber[i];
 4558|   114k|        k2 = (int) GetUnorderedPartitionMcrNode( &theta, (AT_NUMB) ( k + 1 ) ) - 1;
 4559|   114k|        nSymmRank[k] = nSymmRank[k2];
 4560|   114k|    }
 4561|       |    /* CanonRank, nAtomNumberCanon */
 4562|   110k|    memcpy( nCanonRank, rho.Rank, n_tg * sizeof( nCanonRank[0] ) );
 4563|   110k|    memcpy( nAtomNumberCanon, rho.AtNumber, n_tg * sizeof( nAtomNumberCanon[0] ) );
 4564|       |    /* LinearCT */
 4565|   110k|    *nLenCt = pzb_rho->lenCt - 1;
 4566|   110k|    if (pCt)
  ------------------
  |  Branch (4566:9): [True: 0, False: 110k]
  ------------------
 4567|      0|    {
 4568|      0|        memcpy( pCt, pzb_rho->Ctbl, *nLenCt * sizeof( pCt[0] ) );
 4569|      0|    }
 4570|   110k|    pCC->lNumTotCT = pCC->lNumDecreasedCT + pCC->lNumRejectedCT + pCC->lNumEqualCT;
 4571|   110k|    pCC->dGroupSize = size;
 4572|   110k|    pCC->lNumGenerators = nNumFoundGenerators;
 4573|   110k|    pCC->lNumStoredIsomorphisms = l;
 4574|       |    /* Note: check nNumFoundGenerators */
 4575|       |
 4576|   110k|    if (pp_zb_rho_out && !*pp_zb_rho_out)
  ------------------
  |  Branch (4576:9): [True: 110k, False: 0]
  |  Branch (4576:26): [True: 110k, False: 0]
  ------------------
 4577|   110k|    {
 4578|   110k|        *pp_zb_rho_out = pzb_rho;
 4579|   110k|        pzb_rho = NULL;
 4580|   110k|    }
 4581|       |
 4582|       |
 4583|       |
 4584|   110k|exit_error:
 4585|   110k|    INCHI_HEAPCHK
 4586|       |
 4587|   110k|        UnorderedPartitionFree( &theta );
 4588|   110k|    UnorderedPartitionFree( &theta_from_gamma );
 4589|   110k|    if (W)
  ------------------
  |  Branch (4589:9): [True: 110k, False: 0]
  ------------------
 4590|   110k|    {
 4591|   110k|        inchi_free( W );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4592|   110k|    }
 4593|   110k|    if (v)
  ------------------
  |  Branch (4593:9): [True: 110k, False: 0]
  ------------------
 4594|   110k|    {
 4595|   110k|        inchi_free( v );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4596|   110k|    }
 4597|   110k|    if (e)
  ------------------
  |  Branch (4597:9): [True: 110k, False: 0]
  ------------------
 4598|   110k|    {
 4599|   110k|        inchi_free( e );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4600|   110k|    }
 4601|   110k|    if (qzb)
  ------------------
  |  Branch (4601:9): [True: 0, False: 110k]
  ------------------
 4602|      0|    {
 4603|      0|        inchi_free( qzb );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4604|      0|    }
 4605|   110k|    CTableFree( &Lambda );
 4606|   110k|    CTableFree( &zf_zeta );
 4607|   110k|    if (pzb_rho)
  ------------------
  |  Branch (4607:9): [True: 0, False: 110k]
  ------------------
 4608|      0|    {
 4609|      0|        CTableFree( pzb_rho );
 4610|      0|        inchi_free( pzb_rho );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4611|      0|        pzb_rho = NULL;
 4612|      0|    }
 4613|       |    /* CTableFree( &zf_zeta2 ); */
 4614|   110k|    NodeSetFree( pCG, &Omega );
 4615|   110k|    NodeSetFree( pCG, &Phi );
 4616|       |    /* NodeSetFree( &mcr_theta, n, 1 ); */
 4617|   110k|    NodeSetFree( pCG, &cur_nodes );
 4618|   110k|    PartitionFree( &zeta );
 4619|       |    /* PartitionFree( &zeta2 ); */
 4620|   110k|    PartitionFree( &rho );
 4621|   110k|    TranspositionFree( &gamma );
 4622|       |
 4623|   110k|    return ret;
 4624|   110k|}
SetInitialRanks2:
 4641|   110k|{
 4642|   110k|    int i, nNumDiffRanks;
 4643|   110k|    AT_RANK nCurrentRank;
 4644|       |
 4645|   224k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (4645:17): [True: 114k, False: 110k]
  ------------------
 4646|   114k|    {
 4647|   114k|        nAtomNumber[i] = (AT_RANK) i;
 4648|   114k|    }
 4649|       |
 4650|       |    /* global for qsort */
 4651|   110k|    pCG->m_pAtomInvariant2ForSort = pAtomInvariant2;
 4652|       |
 4653|   110k|    inchi_qsort( pCG, nAtomNumber, num_atoms, sizeof( nAtomNumber[0] ), CompAtomInvariants2 );
 4654|       |
 4655|       |    /* nNewRank[i]: non-decreading order; do not increment nCurrentRank */
 4656|       |    /*           if consecutive sorted atom invariants are identical */
 4657|       |
 4658|   114k|    for (i = num_atoms - 1, nCurrentRank = nNewRank[nAtomNumber[i]] = (AT_RANK) num_atoms, nNumDiffRanks = 1; 0 < i; i--)
  ------------------
  |  Branch (4658:111): [True: 4.17k, False: 110k]
  ------------------
 4659|  4.17k|    {
 4660|       |        /* Note: CompAtomInvariants2Only() in following line implicitly reads pAtomInvariant2 pointed by pAtomInvariant2ForSort */
 4661|  4.17k|        if (CompAtomInvariants2Only( &nAtomNumber[i - 1], &nAtomNumber[i], pCG ))
  ------------------
  |  Branch (4661:13): [True: 1.05k, False: 3.11k]
  ------------------
 4662|  1.05k|        {
 4663|  1.05k|            nNumDiffRanks++;
 4664|  1.05k|            nCurrentRank = (AT_RANK) i;
 4665|  1.05k|        }
 4666|  4.17k|        nNewRank[nAtomNumber[i - 1]] = nCurrentRank;
 4667|  4.17k|    }
 4668|       |
 4669|   110k|    return nNumDiffRanks;
 4670|   110k|}
FillOutAtomInvariant2:
 4684|   110k|{
 4685|   110k|    int i, k, j, i_t_group;
 4686|       |    /* tautomers */
 4687|   110k|    T_GROUP          *t_group = NULL;
 4688|   110k|    int               num_t_groups = 0;
 4689|   110k|    int               num_tautomer_iso = 0;
 4690|   110k|#define ELEM_NAME_LEN  2
 4691|   110k|    char ChemElements[ELEM_NAME_LEN*NUM_CHEM_ELEMENTS + ELEM_NAME_LEN];
 4692|   110k|    char CurElement[ELEM_NAME_LEN + ELEM_NAME_LEN], *pCurElem;
 4693|   110k|    int  nNumChemElements = 0;
 4694|   110k|    int  nNumHydrogenAtoms = 0;
 4695|   110k|    int  nNumCarbonAtoms = 0;
 4696|   110k|    memset( ChemElements, 0, sizeof( ChemElements ) );
 4697|   110k|    memset( CurElement, 0, sizeof( CurElement ) );
 4698|   110k|    nNumChemElements = 0;
 4699|       |
 4700|   110k|    if (num_at_tg > num_atoms && t_group_info)
  ------------------
  |  Branch (4700:9): [True: 4, False: 110k]
  |  Branch (4700:34): [True: 4, False: 0]
  ------------------
 4701|      4|    {
 4702|      4|        t_group = t_group_info->t_group;
 4703|      4|        num_t_groups = t_group_info->num_t_groups;
 4704|      4|        num_tautomer_iso = t_group_info->bIgnoreIsotopic ? 0 : T_NUM_ISOTOPIC;
  ------------------
  |  |   98|      0|#define           T_NUM_ISOTOPIC    NUM_H_ISOTOPES /* was 2, now 3 */
  |  |  ------------------
  |  |  |  |   53|      4|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  |  |  ------------------
  ------------------
  |  Branch (4704:28): [True: 4, False: 0]
  ------------------
 4705|      4|    }
 4706|       |
 4707|   110k|    if (!bTautGroupsOnly)
  ------------------
  |  Branch (4707:9): [True: 110k, False: 5]
  ------------------
 4708|   110k|    {
 4709|       |
 4710|   222k|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (4710:21): [True: 112k, False: 110k]
  ------------------
 4711|   112k|        {
 4712|   112k|            if (!strcmp( at[i].elname, "C" ))
  ------------------
  |  Branch (4712:17): [True: 58, False: 112k]
  ------------------
 4713|     58|            {
 4714|     58|                nNumCarbonAtoms++;
 4715|     58|            }
 4716|   112k|            else if (!strcmp( at[i].elname, "H" ) ||
  ------------------
  |  Branch (4716:22): [True: 1, False: 112k]
  ------------------
 4717|   112k|                 !strcmp( at[i].elname, "D" ) ||
  ------------------
  |  Branch (4717:18): [True: 0, False: 112k]
  ------------------
 4718|   112k|                 !strcmp( at[i].elname, "T" ))
  ------------------
  |  Branch (4718:18): [True: 0, False: 112k]
  ------------------
 4719|      1|            {
 4720|      1|                nNumHydrogenAtoms++;
 4721|      1|            }
 4722|   112k|            else
 4723|   112k|            {
 4724|   112k|                CurElement[0] = at[i].elname[0];
 4725|   112k|                CurElement[1] = at[i].elname[1] ? at[i].elname[1] : ' ';
  ------------------
  |  Branch (4725:33): [True: 108k, False: 3.86k]
  ------------------
 4726|   112k|                if (!( pCurElem = strstr( ChemElements, CurElement ) ))
  ------------------
  |  Branch (4726:21): [True: 110k, False: 1.95k]
  ------------------
 4727|   110k|                {
 4728|   110k|                    strcat( ChemElements, CurElement );
 4729|   110k|                    nNumChemElements++;
 4730|   110k|                }
 4731|   112k|            }
 4732|   112k|        }
 4733|   110k|        if (nNumChemElements > 1)
  ------------------
  |  Branch (4733:13): [True: 732, False: 109k]
  ------------------
 4734|    732|        {
 4735|    732|            qsort( ChemElements, nNumChemElements, ELEM_NAME_LEN, CompChemElemLex );
  ------------------
  |  | 4690|    732|#define ELEM_NAME_LEN  2
  ------------------
 4736|    732|        }
 4737|   110k|        if (nNumCarbonAtoms)
  ------------------
  |  Branch (4737:13): [True: 56, False: 109k]
  ------------------
 4738|     56|        {
 4739|     56|            if (nNumChemElements)
  ------------------
  |  Branch (4739:17): [True: 28, False: 28]
  ------------------
 4740|     28|            {
 4741|     28|                memmove( ChemElements + ELEM_NAME_LEN, ChemElements, ELEM_NAME_LEN*nNumChemElements );
  ------------------
  |  | 4690|     28|#define ELEM_NAME_LEN  2
  ------------------
                              memmove( ChemElements + ELEM_NAME_LEN, ChemElements, ELEM_NAME_LEN*nNumChemElements );
  ------------------
  |  | 4690|     28|#define ELEM_NAME_LEN  2
  ------------------
 4742|     28|            }
 4743|     56|            ChemElements[0] = 'C';
 4744|     56|            ChemElements[1] = ' ';
 4745|     56|            nNumChemElements++;
 4746|     56|        }
 4747|   110k|        if (nNumHydrogenAtoms)
  ------------------
  |  Branch (4747:13): [True: 1, False: 110k]
  ------------------
 4748|      1|        {
 4749|      1|            ChemElements[ELEM_NAME_LEN*nNumChemElements] = 'H';
  ------------------
  |  | 4690|      1|#define ELEM_NAME_LEN  2
  ------------------
 4750|      1|            ChemElements[ELEM_NAME_LEN*nNumChemElements + 1] = ' ';
  ------------------
  |  | 4690|      1|#define ELEM_NAME_LEN  2
  ------------------
 4751|      1|            nNumChemElements++;
 4752|      1|        }
 4753|       |
 4754|       |        /* general */
 4755|   222k|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (4755:21): [True: 112k, False: 110k]
  ------------------
 4756|   112k|        {
 4757|   112k|            memset( &pAtomInvariant[i], 0, sizeof( pAtomInvariant[0] ) );
 4758|   112k|            CurElement[0] = at[i].elname[0];
 4759|   112k|            CurElement[1] = at[i].elname[1] ? at[i].elname[1] : ' ';
  ------------------
  |  Branch (4759:29): [True: 108k, False: 3.92k]
  ------------------
 4760|   112k|            pCurElem = strstr( ChemElements, CurElement );
 4761|   112k|            if (pCurElem)
  ------------------
  |  Branch (4761:17): [True: 112k, False: 0]
  ------------------
 4762|   112k|            {
 4763|   112k|                j = (int) ( pCurElem - ChemElements ) / ELEM_NAME_LEN + 1;
  ------------------
  |  | 4690|   112k|#define ELEM_NAME_LEN  2
  ------------------
 4764|   112k|            }
 4765|      0|            else
 4766|      0|            {
 4767|      0|                j = nNumChemElements; /* must be D or T */
 4768|      0|            }
 4769|       |            /* at[i].hill_type = (U_CHAR) j; */
 4770|   112k|            pAtomInvariant[i].val[AT_INV_HILL_ORDER] = j;
 4771|       |
 4772|   112k|            pAtomInvariant[i].val[AT_INV_NUM_CONNECTIONS] = at[i].valence;
 4773|   112k|            if (bHydrogensInRanks)
  ------------------
  |  Branch (4773:17): [True: 0, False: 112k]
  ------------------
 4774|      0|            {
 4775|      0|                pAtomInvariant[i].val[AT_INV_NUM_H] = ( ( t_group && at[i].endpoint > 0 ) ? 0 : at[i].num_H );
  ------------------
  |  Branch (4775:59): [True: 0, False: 0]
  |  Branch (4775:70): [True: 0, False: 0]
  ------------------
 4776|      0|            }
 4777|   112k|            if (bHydrogensFixedInRanks)
  ------------------
  |  Branch (4777:17): [True: 0, False: 112k]
  ------------------
 4778|      0|            {
 4779|      0|                pAtomInvariant[i].val[AT_INV_NUM_H_FIX] = ( ( t_group && at[i].endpoint > 0 ) ? at[i].num_H : 0 );
  ------------------
  |  Branch (4779:63): [True: 0, False: 0]
  |  Branch (4779:74): [True: 0, False: 0]
  ------------------
 4780|      0|            }
 4781|   112k|            if (!bDigraph &&  t_group && ( i_t_group = (int) at[i].endpoint - 1 ) >= 0 && i_t_group < num_t_groups)
  ------------------
  |  Branch (4781:17): [True: 112k, False: 0]
  |  Branch (4781:31): [True: 0, False: 112k]
  |  Branch (4781:42): [True: 0, False: 0]
  |  Branch (4781:91): [True: 0, False: 0]
  ------------------
 4782|      0|            {
 4783|      0|                pAtomInvariant[i].val[AT_INV_NUM_TG_ENDPOINTS] = t_group[i_t_group].nNumEndpoints;
 4784|      0|                for (j = 0; j < T_NUM_NO_ISOTOPIC; j++)
  ------------------
  |  |   97|      0|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
  |  Branch (4784:29): [True: 0, False: 0]
  ------------------
 4785|      0|                {
 4786|      0|                    pAtomInvariant[i].val[AT_INV_TG_NUMBERS + j] = t_group[i_t_group].num[j];
 4787|      0|                }
 4788|      0|                for (j = 0; j < num_tautomer_iso; j++)
  ------------------
  |  Branch (4788:29): [True: 0, False: 0]
  ------------------
 4789|      0|                {
 4790|      0|                    pAtomInvariant[i].val[AT_INV_TAUT_ISO + j] = t_group[i_t_group].num[j + T_NUM_NO_ISOTOPIC];
  ------------------
  |  |   97|      0|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
 4791|      0|                }
 4792|      0|            }
 4793|   112k|            pAtomInvariant[i].iso_sort_key = bIgnoreIsotopic ? 0 : at[i].iso_sort_key;
  ------------------
  |  Branch (4793:46): [True: 112k, False: 0]
  ------------------
 4794|   112k|        }
 4795|   110k|    }
 4796|      5|    else
 4797|      5|    {
 4798|       |        /* fill tautomeric groups only */
 4799|      5|        memset( pAtomInvariant, 0, num_at_tg * sizeof( pAtomInvariant[0] ) );
 4800|      5|    }
 4801|       |
 4802|       |    /**************************************/
 4803|       |    /*          tautomeric groups         */
 4804|       |    /**************************************/
 4805|   110k|    for (i = num_atoms; i < num_at_tg; i++)
  ------------------
  |  Branch (4805:25): [True: 4, False: 110k]
  ------------------
 4806|      4|    {
 4807|       |
 4808|      4|        k = i - num_atoms;
 4809|      4|        memset( &pAtomInvariant[i], 0, sizeof( pAtomInvariant[0] ) );
 4810|      4|        if (!t_group)
  ------------------
  |  Branch (4810:13): [True: 0, False: 4]
  ------------------
 4811|      0|            continue;
 4812|       |        /* make sure ranks of t-groups are larger than that of any atom */
 4813|       |         /* greater than for any real atom */
 4814|      4|        pAtomInvariant[i].val[AT_INV_HILL_ORDER] = bTautGroupsOnly ? num_at_tg : nNumChemElements + 1;
  ------------------
  |  Branch (4814:52): [True: 4, False: 0]
  ------------------
 4815|       |        /* greater than for any real atom */
 4816|      4|        pAtomInvariant[i].val[AT_INV_NUM_CONNECTIONS] = MAXVAL + 1;
  ------------------
  |  |   88|      4|#define MAXVAL 20       /* maximum valence */
  ------------------
 4817|      4|        if (k < num_t_groups)
  ------------------
  |  Branch (4817:13): [True: 4, False: 0]
  ------------------
 4818|      4|        {
 4819|      4|            pAtomInvariant[i].val[AT_INV_NUM_TG_ENDPOINTS] = t_group[k].nNumEndpoints;
 4820|     12|            for (j = 0; j < T_NUM_NO_ISOTOPIC; j++)
  ------------------
  |  |   97|     12|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
  |  Branch (4820:25): [True: 8, False: 4]
  ------------------
 4821|      8|            {
 4822|      8|                pAtomInvariant[i].val[AT_INV_TAUT_ISO + j] = t_group[k].num[j];
 4823|      8|            }
 4824|      4|            for (j = 0; j < num_tautomer_iso; j++)
  ------------------
  |  Branch (4824:25): [True: 0, False: 4]
  ------------------
 4825|      0|            {
 4826|      0|                pAtomInvariant[i].val[AT_INV_TAUT_ISO + j] = t_group[k].num[j + T_NUM_NO_ISOTOPIC];
  ------------------
  |  |   97|      0|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
 4827|      0|            }
 4828|      4|        }
 4829|      4|    }
 4830|   110k|}
CleanNumH:
 4835|   440k|{
 4836|   440k|    int i;
 4837|   440k|    if (NumH)
  ------------------
  |  Branch (4837:9): [True: 220k, False: 220k]
  ------------------
 4838|   220k|    {
 4839|   665k|        for (i = 0; i < len; i++)
  ------------------
  |  Branch (4839:21): [True: 445k, False: 220k]
  ------------------
 4840|   445k|        {
 4841|   445k|            if (NumH[i] == EMPTY_H_NUMBER)
  ------------------
  |  |   63|   445k|#define EMPTY_H_NUMBER (INCHI_CANON_INFINITY-1)
  |  |  ------------------
  |  |  |  |   58|   445k|#define INCHI_CANON_INFINITY       0x7FFF
  |  |  ------------------
  ------------------
  |  Branch (4841:17): [True: 225k, False: 220k]
  ------------------
 4842|   225k|            {
 4843|   225k|                NumH[i] = 0;
 4844|   225k|            }
 4845|   220k|            else
 4846|   220k|            {
 4847|   220k|                NumH[i] -= BASE_H_NUMBER;
  ------------------
  |  |   64|   220k|#define BASE_H_NUMBER  ((INCHI_CANON_INFINITY-1)/2)
  |  |  ------------------
  |  |  |  |   58|   220k|#define INCHI_CANON_INFINITY       0x7FFF
  |  |  ------------------
  ------------------
 4848|   220k|            }
 4849|   445k|        }
 4850|   220k|    }
 4851|   440k|}
CleanCt:
 4856|   110k|{
 4857|   110k|    if (Ct && Ct[len] == EMPTY_CT)
  ------------------
  |  |   62|   110k|#define EMPTY_CT       0
  ------------------
  |  Branch (4857:9): [True: 110k, False: 0]
  |  Branch (4857:15): [True: 110k, False: 0]
  ------------------
 4858|   110k|    {
 4859|   110k|        Ct[len] = 0;
 4860|   110k|        return 1;
 4861|   110k|    }
 4862|       |
 4863|      0|    return 0;
 4864|   110k|}
CleanIsoSortKeys:
 4869|     94|{
 4870|     94|    int i;
 4871|     94|    if (isk)
  ------------------
  |  Branch (4871:9): [True: 94, False: 0]
  ------------------
 4872|     94|    {
 4873|  2.74k|        for (i = 0; i < len; i++)
  ------------------
  |  Branch (4873:21): [True: 2.65k, False: 94]
  ------------------
 4874|  2.65k|        {
 4875|  2.65k|            if (isk[i] == EMPTY_ISO_SORT_KEY)
  ------------------
  |  |   65|  2.65k|#define EMPTY_ISO_SORT_KEY LONG_MAX
  ------------------
  |  Branch (4875:17): [True: 2.37k, False: 282]
  ------------------
 4876|  2.37k|            {
 4877|  2.37k|                isk[i] = 0;
 4878|  2.37k|            }
 4879|  2.65k|        }
 4880|     94|    }
 4881|     94|}
DeAllocBCN:
 4914|   110k|{
 4915|   110k|    int    i, k;
 4916|   110k|    FTCN  *ftcn;
 4917|   110k|    if (!pBCN)
  ------------------
  |  Branch (4917:9): [True: 0, False: 110k]
  ------------------
 4918|      0|    {
 4919|      0|        return;
 4920|      0|    }
 4921|   110k|    if (pBCN->pRankStack)
  ------------------
  |  Branch (4921:9): [True: 110k, False: 0]
  ------------------
 4922|   110k|    {
 4923|   994k|        for (i = 0; i < pBCN->nMaxLenRankStack; i++)
  ------------------
  |  Branch (4923:21): [True: 884k, False: 110k]
  ------------------
 4924|   884k|        {
 4925|   884k|            FREE_ARRAY( pBCN->pRankStack[i] )
  ------------------
  |  | 4909|   884k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|  4.28k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 4.28k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (4909:28): [True: 4.28k, False: 879k]
  |  |  ------------------
  ------------------
 4926|   884k|        }
 4927|   110k|        FREE_ARRAY( pBCN->pRankStack )
  ------------------
  |  | 4909|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (4909:28): [True: 110k, False: 0]
  |  |  ------------------
  ------------------
 4928|   110k|    }
 4929|   330k|    for (k = 0; k < TAUT_NUM; k++)
  ------------------
  |  |  578|   330k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (4929:17): [True: 220k, False: 110k]
  ------------------
 4930|   220k|    {
 4931|   220k|        ftcn = pBCN->ftcn + k;
 4932|   220k|        FreeNeighList( ftcn->NeighList );
 4933|       |
 4934|   220k|        FREE_ARRAY( ftcn->LinearCt )
  ------------------
  |  | 4909|   220k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (4909:28): [True: 110k, False: 110k]
  |  |  ------------------
  ------------------
 4935|       |
 4936|   220k|        PartitionFree( &ftcn->PartitionCt );
 4937|       |
 4938|   220k|        FREE_ARRAY( ftcn->nSymmRankCt )
  ------------------
  |  | 4909|   220k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (4909:28): [True: 110k, False: 110k]
  |  |  ------------------
  ------------------
 4939|   220k|        FREE_ARRAY( ftcn->nNumHOrig )
  ------------------
  |  | 4909|   220k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (4909:28): [True: 110k, False: 110k]
  |  |  ------------------
  ------------------
 4940|   220k|        FREE_ARRAY( ftcn->nNumH )
  ------------------
  |  | 4909|   220k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (4909:28): [True: 110k, False: 110k]
  |  |  ------------------
  ------------------
 4941|   220k|        FREE_ARRAY( ftcn->nNumHOrigFixH )
  ------------------
  |  | 4909|   220k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|      3|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 3, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (4909:28): [True: 3, False: 220k]
  |  |  ------------------
  ------------------
 4942|   220k|        FREE_ARRAY( ftcn->nNumHFixH )
  ------------------
  |  | 4909|   220k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|      3|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 3, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (4909:28): [True: 3, False: 220k]
  |  |  ------------------
  ------------------
 4943|       |
 4944|   220k|        PartitionFree( &ftcn->PartitionCtIso );
 4945|       |
 4946|   220k|        FREE_ARRAY( ftcn->nSymmRankCtIso )
  ------------------
  |  | 4909|   220k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|     47|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 47, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (4909:28): [True: 47, False: 219k]
  |  |  ------------------
  ------------------
 4947|   220k|        FREE_ARRAY( ftcn->iso_sort_keys )
  ------------------
  |  | 4909|   220k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|     47|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 47, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (4909:28): [True: 47, False: 219k]
  |  |  ------------------
  ------------------
 4948|   220k|        FREE_ARRAY( ftcn->iso_sort_keysOrig )
  ------------------
  |  | 4909|   220k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|     47|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 47, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (4909:28): [True: 47, False: 219k]
  |  |  ------------------
  ------------------
 4949|   220k|        FREE_ARRAY( ftcn->iso_exchg_atnos )
  ------------------
  |  | 4909|   220k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (4909:28): [True: 0, False: 220k]
  |  |  ------------------
  ------------------
 4950|   220k|        FREE_ARRAY( ftcn->iso_exchg_atnosOrig )
  ------------------
  |  | 4909|   220k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (4909:28): [True: 0, False: 220k]
  |  |  ------------------
  ------------------
 4951|   220k|    }
 4952|   110k|}
GetBaseCanonRanking:
 5069|   110k|{
 5070|   110k|    int ret = 0;
 5071|   110k|    int iBase;                   /* base structure index, always valid; = TAUT_YES except special fully non-taut mode */
 5072|   110k|    int iOther;                  /* other than basic structure index, usually non-taut; may be = iBase */
 5073|   110k|    int bReqNonTaut;             /* 1 => requested non-tautomeric results */
 5074|   110k|    int bReqTaut;                /* 1 => requested tautomeric results and the base structure is tautomeric */
 5075|   110k|    int bChanged;
 5076|       |
 5077|   110k|    sp_ATOM *at_base = NULL;
 5078|   110k|    sp_ATOM *at_other = NULL;
 5079|       |
 5080|   110k|    int bTautIgnoreIsotopic = 0;
 5081|       |    /*int bIgnoreIsotopic     = 0;*/
 5082|   110k|    int nNumCurrRanks = 0;
 5083|   110k|    int nMaxLenRankStack = 0;
 5084|   110k|    int num_max = num_at_tg;
 5085|   110k|    long lCount;
 5086|       |
 5087|       |    /* local allocations */
 5088|   110k|    ATOM_INVARIANT2 *pAtomInvariant = NULL;
 5089|   110k|    NEIGH_LIST     *NeighList[TAUT_NUM];
 5090|   110k|    ConTable *Ct_Temp = NULL;
 5091|       |
 5092|       |    /* initial partition for canonicalization */
 5093|   110k|    AT_RANK *nRank = NULL;
 5094|   110k|    AT_NUMB *nAtomNumber = NULL;
 5095|       |
 5096|       |    /* canonicalization output */
 5097|       |
 5098|   110k|    ConTable *Ct_NoH = NULL;
 5099|   110k|    AT_RANK *nCanonRankNoH = NULL;
 5100|   110k|    AT_NUMB *nAtomNumberCanonNoH = NULL;
 5101|   110k|    AT_RANK *nSymmRankNoH = NULL;
 5102|       |
 5103|   110k|    ConTable *Ct_NoTautH = NULL;
 5104|   110k|    AT_RANK *nSymmRankNoTautH = NULL;
 5105|   110k|    AT_RANK *nCanonRankNoTautH = NULL;
 5106|   110k|    AT_NUMB *nAtomNumberCanonNoTautH = NULL;
 5107|   110k|    NUM_H   *numHNoTautH = NULL;
 5108|   110k|    int      lenNumHNoTautH;
 5109|   110k|    int      maxlenNumHNoTautH;
 5110|       |
 5111|   110k|    ConTable *Ct_Base = NULL;
 5112|   110k|    AT_RANK *nSymmRankBase = NULL;
 5113|   110k|    AT_RANK *nCanonRankBase = NULL;
 5114|   110k|    AT_NUMB *nAtomNumberCanonBase = NULL;
 5115|   110k|    NUM_H   *numH = NULL;
 5116|   110k|    int      lenNumH;
 5117|   110k|    int      maxlenNumH = 0;
 5118|       |
 5119|   110k|#if ( USE_AUX_RANKING == 1 )
 5120|   110k|    AT_RANK *nRankAux = NULL;
 5121|   110k|    AT_NUMB *nAtomNumberAux = NULL;
 5122|   110k|    ATOM_INVARIANT2 *pAtomInvariantAux = NULL;
 5123|   110k|#endif
 5124|       |
 5125|   110k|    ConTable *Ct_FixH = NULL;
 5126|   110k|    AT_RANK *nSymmRankFixH = NULL;
 5127|   110k|    AT_RANK *nCanonRankFixH = NULL;
 5128|   110k|    AT_NUMB *nAtomNumberCanonFixH = NULL;
 5129|   110k|    NUM_H   *NumHfixed = NULL;
 5130|   110k|    int      maxlenNumHfixed;
 5131|       |
 5132|       |    /* isotopic canonicalization */
 5133|       |
 5134|   110k|    ConTable *Ct_NoTautHIso = NULL;
 5135|   110k|    AT_RANK *nSymmRankNoTautHIso = NULL;
 5136|   110k|    AT_RANK *nCanonRankNoTautHIso = NULL;
 5137|   110k|    AT_NUMB *nAtomNumberCanonNoTautHIso = NULL;
 5138|   110k|    AT_ISO_SORT_KEY *iso_sort_key_NoTautH = NULL;
 5139|   110k|    int              maxlen_iso_sort_key_NoTautH;
 5140|   110k|    int              len_iso_sort_key_NoTautH;
 5141|   110k|    int num_iso_NoTautH, num_iso_NoAuxBase;
 5142|       |
 5143|   110k|    ConTable *Ct_BaseIso = NULL;
 5144|   110k|    AT_RANK *nSymmRankBaseIso = NULL;
 5145|   110k|    AT_RANK *nCanonRankBaseIso = NULL;
 5146|   110k|    AT_NUMB *nAtomNumberCanonBaseIso = NULL;
 5147|       |
 5148|   110k|    AT_ISO_SORT_KEY *iso_sort_keyBase = NULL;
 5149|   110k|    int              maxlen_iso_sort_keyBase;
 5150|   110k|    int              len_iso_sort_keyBase;
 5151|       |
 5152|   110k|    int              bUseIsoAuxBase[TAUT_NUM];
 5153|   110k|    S_CHAR          *iso_exchg_atnos = NULL;
 5154|   110k|    int              len_iso_exchg_atnos;
 5155|   110k|    int              maxlen_iso_exchg_atnos;
 5156|   110k|    int num_iso_Base;
 5157|       |
 5158|   110k|    AT_ISO_SORT_KEY  iso_sort_key;
 5159|       |
 5160|   110k|    ConTable *Ct_FixHIso = NULL;
 5161|   110k|    AT_RANK *nSymmRankFixHIso = NULL;
 5162|   110k|    AT_RANK *nCanonRankFixHIso = NULL;
 5163|   110k|    AT_NUMB *nAtomNumberCanonFixHIso = NULL;
 5164|       |
 5165|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 5166|       |    AT_ISO_SORT_KEY  iso_sort_key2;
 5167|       |    AT_ISO_SORT_KEY *iso_sort_key_Hfixed = NULL;
 5168|       |    int              maxlen_iso_sort_key_Hfixed;
 5169|       |    int              len_iso_sort_key_Hfixed;
 5170|       |    int num_iso_Hfixed;
 5171|       |#endif
 5172|       |
 5173|   110k|    AT_RANK *nTempRank = NULL;
 5174|       |
 5175|   110k|    CANON_DATA    pCD[3]; /* = &CanonData; */
 5176|   110k|    CANON_COUNTS  CanonCounts;
 5177|   110k|    CANON_COUNTS *pCC = &CanonCounts;
 5178|       |
 5179|   110k|    int i, j, k, m;
 5180|   110k|    int nCanonFlags[2];
 5181|       |
 5182|       |    /* */
 5183|   110k|    int iflag;
 5184|       |
 5185|   110k|    memset( pCD, 0, sizeof( pCD ) );
 5186|   110k|    memset( pCC, 0, sizeof( pCC[0] ) );
 5187|   110k|    memset( bUseIsoAuxBase, 0, sizeof( bUseIsoAuxBase ) );
 5188|   110k|    memset( nCanonFlags, 0, sizeof( nCanonFlags ) );
 5189|   110k|    NeighList[TAUT_NON] = NULL;
  ------------------
  |  |  579|   110k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 5190|   110k|    NeighList[TAUT_YES] = NULL;
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5191|       |
 5192|       |    /* select base structure, find whether it is tautomeric or not */
 5193|       |
 5194|   110k|    if (at[TAUT_YES] && s[TAUT_YES].nLenCT &&
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  if (at[TAUT_YES] && s[TAUT_YES].nLenCT &&
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (5194:9): [True: 110k, False: 0]
  |  Branch (5194:25): [True: 110k, False: 0]
  ------------------
 5195|   110k|         t_group_info && ( s[TAUT_YES].nLenLinearCTTautomer > 0 && /* ordinary tautomerism */
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (5195:10): [True: 110k, False: 0]
  |  Branch (5195:28): [True: 5, False: 110k]
  ------------------
 5196|   110k|             t_group_info->t_group && t_group_info->num_t_groups > 0 ||
  ------------------
  |  Branch (5196:14): [True: 5, False: 0]
  |  Branch (5196:39): [True: 4, False: 1]
  ------------------
 5197|       |             /* protons have been moved */
 5198|   110k|             ( t_group_info->tni.bNormalizationFlags & FLAG_NORM_CONSIDER_TAUT ) ||
  ------------------
  |  |  184|   110k|#define FLAG_NORM_CONSIDER_TAUT      ( FLAG_PROTON_NPO_SIMPLE_REMOVED | \
  |  |  ------------------
  |  |  |  |  174|   110k|#define FLAG_PROTON_NPO_SIMPLE_REMOVED 0x0001
  |  |  ------------------
  |  |  185|   110k|                                       FLAG_PROTON_NP_HARD_REMOVED    | \
  |  |  ------------------
  |  |  |  |  175|   110k|#define FLAG_PROTON_NP_HARD_REMOVED    0x0002
  |  |  ------------------
  |  |  186|   110k|                                       FLAG_PROTON_AC_SIMPLE_ADDED    | \
  |  |  ------------------
  |  |  |  |  176|   110k|#define FLAG_PROTON_AC_SIMPLE_ADDED    0x0004
  |  |  ------------------
  |  |  187|   110k|                                       FLAG_PROTON_AC_SIMPLE_REMOVED  | \
  |  |  ------------------
  |  |  |  |  177|   110k|#define FLAG_PROTON_AC_SIMPLE_REMOVED  0x0008
  |  |  ------------------
  |  |  188|   110k|                                       FLAG_PROTON_AC_HARD_REMOVED    | \
  |  |  ------------------
  |  |  |  |  178|   110k|#define FLAG_PROTON_AC_HARD_REMOVED    0x0010
  |  |  ------------------
  |  |  189|   110k|                                       FLAG_PROTON_AC_HARD_ADDED      | \
  |  |  ------------------
  |  |  |  |  179|   110k|#define FLAG_PROTON_AC_HARD_ADDED      0x0020
  |  |  ------------------
  |  |  190|   110k|                                       FLAG_PROTON_SINGLE_REMOVED     | \
  |  |  ------------------
  |  |  |  |  181|   110k|#define FLAG_PROTON_SINGLE_REMOVED     0x0080
  |  |  ------------------
  |  |  191|   110k|                                       FLAG_PROTON_CHARGE_CANCEL    )
  |  |  ------------------
  |  |  |  |  180|   110k|#define FLAG_PROTON_CHARGE_CANCEL      0x0040
  |  |  ------------------
  ------------------
  |  Branch (5198:14): [True: 1, False: 110k]
  ------------------
 5199|       |             /* tautomerism due to possible isotopic proton exchange */
 5200|   110k|             t_group_info->nNumIsotopicEndpoints > 1 &&
  ------------------
  |  Branch (5200:14): [True: 0, False: 110k]
  ------------------
 5201|   110k|             ( t_group_info->bTautFlagsDone & ( TG_FLAG_FOUND_ISOTOPIC_H_DONE | TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE ) ) ))
  ------------------
  |  |  978|      0|#define TG_FLAG_FOUND_ISOTOPIC_H_DONE    0x00004000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
                           ( t_group_info->bTautFlagsDone & ( TG_FLAG_FOUND_ISOTOPIC_H_DONE | TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE ) ) ))
  ------------------
  |  |  979|      0|#define TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE 0x00008000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
  |  Branch (5201:14): [True: 0, False: 0]
  ------------------
 5202|      5|    {
 5203|       |        /* tautomeric: (1) has tautomeric atoms OR
 5204|       |                       (2) H-atoms have been rearranged due to proton addition/removal OR
 5205|       |                       (3) Found isotopic H-atoms on tautomeric or hetero atoms
 5206|       |         */
 5207|      5|        iBase = TAUT_YES;
  ------------------
  |  |  580|      5|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5208|      5|        bReqTaut = 1;
 5209|      5|        bUseIsoAuxBase[iBase] = ( s[iBase].nLenIsotopicEndpoints > 1 ) &&
  ------------------
  |  Branch (5209:33): [True: 0, False: 5]
  ------------------
 5210|      5|            ( t_group_info->bTautFlagsDone & ( TG_FLAG_FOUND_ISOTOPIC_H_DONE | TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE ) );
  ------------------
  |  |  978|      0|#define TG_FLAG_FOUND_ISOTOPIC_H_DONE    0x00004000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
                          ( t_group_info->bTautFlagsDone & ( TG_FLAG_FOUND_ISOTOPIC_H_DONE | TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE ) );
  ------------------
  |  |  979|      0|#define TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE 0x00008000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
  |  Branch (5210:13): [True: 0, False: 0]
  ------------------
 5211|      5|        if (at[TAUT_NON] && s[TAUT_NON].nLenCT)
  ------------------
  |  |  579|      5|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                      if (at[TAUT_NON] && s[TAUT_NON].nLenCT)
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (5211:13): [True: 3, False: 2]
  |  Branch (5211:29): [True: 3, False: 0]
  ------------------
 5212|      3|        {
 5213|      3|            iOther = TAUT_NON; /* tautomeric and non-tautomeric */
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 5214|      3|            bReqNonTaut = 1;
 5215|      3|        }
 5216|      2|        else
 5217|      2|        {
 5218|      2|            iOther = iBase; /* tautomeric only */
 5219|      2|            bReqNonTaut = 0;
 5220|      2|        }
 5221|      5|    }
 5222|       |
 5223|   110k|    else if (at[TAUT_NON] && s[TAUT_NON].nLenCT)
  ------------------
  |  |  579|   110k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                  else if (at[TAUT_NON] && s[TAUT_NON].nLenCT)
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (5223:14): [True: 0, False: 110k]
  |  Branch (5223:30): [True: 0, False: 0]
  ------------------
 5224|      0|    {
 5225|       |        /* force pure non-tautomeric processing; happens for testing only */
 5226|      0|        iBase = TAUT_NON;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 5227|      0|        bReqTaut = 0;
 5228|      0|        iOther = iBase;
 5229|      0|        bReqNonTaut = 1;
 5230|      0|        num_at_tg = num_atoms;
 5231|      0|    }
 5232|       |
 5233|   110k|    else if (at[TAUT_YES] && s[TAUT_YES].nLenCT)
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  else if (at[TAUT_YES] && s[TAUT_YES].nLenCT)
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (5233:14): [True: 110k, False: 0]
  |  Branch (5233:30): [True: 110k, False: 0]
  ------------------
 5234|   110k|    {
 5235|       |        /* although the user requested tautomeric processing, tautomerism has not been found */
 5236|       |        /* however, the results should be saved in the TAUT_YES elements of the arrays */
 5237|   110k|        iBase = TAUT_YES;
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5238|   110k|        bReqTaut = 0;
 5239|   110k|        bUseIsoAuxBase[iBase] = ( s[iBase].nLenIsotopicEndpoints > 1 );
 5240|   110k|        iOther = iBase;
 5241|   110k|        bReqNonTaut = 1;
 5242|   110k|        num_at_tg = num_atoms;
 5243|   110k|    }
 5244|      0|    else
 5245|      0|    {
 5246|      0|        ret = CT_UNKNOWN_ERR;
  ------------------
  |  |   66|      0|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 5247|      0|        goto exit_error;
 5248|      0|    }
 5249|       |
 5250|       |
 5251|   110k|    if (bReqTaut)
  ------------------
  |  Branch (5251:9): [True: 5, False: 110k]
  ------------------
 5252|      5|    {
 5253|       |        /* save "process isotopic" mark; temporarily set it to NO */
 5254|      5|        bTautIgnoreIsotopic = t_group_info->bIgnoreIsotopic;
 5255|      5|        t_group_info->bIgnoreIsotopic = 1;
 5256|      5|    }
 5257|   110k|    lenNumH = num_atoms;
 5258|       |
 5259|       |    /* isotopic canonicalization */
 5260|   110k|    num_iso_NoTautH = 0;
 5261|   110k|    len_iso_sort_key_NoTautH = 0;
 5262|   110k|    maxlen_iso_sort_key_NoTautH = 0;
 5263|   110k|    num_iso_Base = 0;
 5264|   110k|    len_iso_sort_keyBase = 0;
 5265|   110k|    maxlen_iso_sort_keyBase = 0;
 5266|   110k|    len_iso_exchg_atnos = 0;
 5267|   110k|    maxlen_iso_exchg_atnos = 0;
 5268|   110k|    len_iso_exchg_atnos = 0;
 5269|   110k|    maxlen_iso_exchg_atnos = 0;
 5270|       |
 5271|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 5272|       |    num_iso_Hfixed =
 5273|       |        len_iso_sort_key_Hfixed =
 5274|       |        maxlen_iso_sort_key_Hfixed = 0;
 5275|       |#endif
 5276|       |
 5277|       |    /* prepare initial data */
 5278|   110k|    at_base = at[iBase];
 5279|   110k|    at_other = at[iOther];
 5280|   110k|    pAtomInvariant = (ATOM_INVARIANT2 *) inchi_calloc( num_max, sizeof( pAtomInvariant[0] ) );
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
 5281|   110k|    nSymmRankNoH = (AT_RANK *) inchi_calloc( num_max, sizeof( nSymmRankNoH[0] ) );
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
 5282|   110k|    nCanonRankNoH = (AT_RANK *) inchi_calloc( num_max, sizeof( nCanonRankNoH[0] ) );
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
 5283|   110k|    nAtomNumberCanonNoH = (AT_NUMB *) inchi_calloc( num_max, sizeof( nAtomNumberCanonNoH[0] ) );
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
 5284|   110k|    nRank = (AT_RANK *) inchi_calloc( num_max, sizeof( nRank[0] ) );
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
 5285|   110k|    nAtomNumber = (AT_NUMB *) inchi_calloc( num_max, sizeof( nAtomNumber[0] ) );
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
 5286|   110k|    nTempRank = (AT_RANK *) inchi_calloc( num_max, sizeof( nTempRank[0] ) );
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
 5287|       |
 5288|   110k|    if (!pAtomInvariant ||
  ------------------
  |  Branch (5288:9): [True: 0, False: 110k]
  ------------------
 5289|   110k|         !nSymmRankNoH || !nCanonRankNoH || !nAtomNumberCanonNoH ||
  ------------------
  |  Branch (5289:10): [True: 0, False: 110k]
  |  Branch (5289:27): [True: 0, False: 110k]
  |  Branch (5289:45): [True: 0, False: 110k]
  ------------------
 5290|   110k|         !nRank || !nAtomNumber || !nTempRank)
  ------------------
  |  Branch (5290:10): [True: 0, False: 110k]
  |  Branch (5290:20): [True: 0, False: 110k]
  |  Branch (5290:36): [True: 0, False: 110k]
  ------------------
 5291|      0|    {
 5292|      0|        goto exit_error_alloc;
 5293|      0|    }
 5294|       |
 5295|   110k|#if ( USE_AUX_RANKING == 1 )
 5296|   110k|    nRankAux = (AT_RANK *) inchi_calloc( num_max, sizeof( nRankAux[0] ) );
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
 5297|   110k|    nAtomNumberAux = (AT_NUMB *) inchi_calloc( num_max, sizeof( nAtomNumberAux[0] ) );
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
 5298|   110k|    pAtomInvariantAux = (ATOM_INVARIANT2 *) inchi_malloc( num_max * sizeof( pAtomInvariantAux[0] ) );
  ------------------
  |  | 1130|   110k|#define inchi_malloc   malloc
  ------------------
 5299|   110k|    if (!nRankAux || !nAtomNumberAux || !pAtomInvariantAux)
  ------------------
  |  Branch (5299:9): [True: 0, False: 110k]
  |  Branch (5299:22): [True: 0, False: 110k]
  |  Branch (5299:41): [True: 0, False: 110k]
  ------------------
 5300|      0|    {
 5301|      0|        goto exit_error_alloc;
 5302|      0|    }
 5303|   110k|#endif
 5304|       |
 5305|   110k|    if (bReqTaut)
  ------------------
  |  Branch (5305:9): [True: 5, False: 110k]
  ------------------
 5306|      5|    {
 5307|      5|        if (!( NeighList[TAUT_YES] =
  ------------------
  |  |  580|      5|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (5307:13): [True: 0, False: 5]
  ------------------
 5308|      5|               CreateNeighList( num_atoms, num_at_tg, at_base, 0, t_group_info ) ))
 5309|      0|        {
 5310|      0|            goto exit_error_alloc;
 5311|      0|        }
 5312|       |        /* needed for the hydrogenless structure */
 5313|      5|        if (!( NeighList[TAUT_NON] =
  ------------------
  |  |  579|      5|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (5313:13): [True: 0, False: 5]
  ------------------
 5314|      5|               CreateNeighList( num_atoms, num_atoms, at_base, 0, NULL ) ))
 5315|      0|        {
 5316|      0|            goto exit_error_alloc;
 5317|      0|        }
 5318|      5|    }
 5319|   110k|    else
 5320|   110k|    {
 5321|   110k|        if (!( NeighList[TAUT_NON] =
  ------------------
  |  |  579|   110k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (5321:13): [True: 0, False: 110k]
  ------------------
 5322|   110k|               CreateNeighList( num_atoms, num_atoms, at_base, 0, NULL ) ))
 5323|      0|        {
 5324|      0|            goto exit_error_alloc;
 5325|      0|        }
 5326|   110k|        NeighList[TAUT_YES] = NULL;
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5327|       |
 5328|   110k|        INCHI_HEAPCHK
 5329|   110k|    }
 5330|       |
 5331|       |
 5332|       |    /* avoid memory leaks in case of error */
 5333|       |    /*
 5334|       |    pBCN->ftcn[TAUT_NON].NeighList          = NeighList[TAUT_NON];
 5335|       |    pBCN->ftcn[TAUT_YES].NeighList          = NeighList[TAUT_YES];
 5336|       |    */
 5337|   110k|    pBCN->nMaxLenRankStack = 0;
 5338|   110k|    pBCN->num_max = num_max;        /* allocated nRank[] arrays lengths in pRankStack */
 5339|   110k|    pBCN->num_at_tg = num_at_tg;  /* all of the following arrays have this length */
 5340|   110k|    pBCN->num_atoms = num_atoms;
 5341|   110k|    pBCN->ulTimeOutTime = ulTimeOutTime;
 5342|       |
 5343|       |    /* initial partitioning of a hydrogenless skeleton: fill out the inveriant */
 5344|   110k|    FillOutAtomInvariant2( at_base,
 5345|   110k|                           num_atoms,
 5346|   110k|                           num_atoms,
 5347|   110k|                           pAtomInvariant,
 5348|   110k|                           1 /*bIgnoreIsotopic*/,
 5349|   110k|                           0 /*bHydrogensInRanks*/,
 5350|   110k|                           0 /*bHydrogensFixedInRanks*/,
 5351|   110k|                           0 /*bTaut=bDigraph*/,
 5352|   110k|                           0 /* bTautGroupsOnly */,
 5353|   110k|                           NULL /*t_group_info*/ );
 5354|       |
 5355|       |    /* initial partitioning of a hydrogenless skeleton: create equitable partition (assign initial ranks) */
 5356|   110k|    nNumCurrRanks = SetInitialRanks2( num_atoms, pAtomInvariant, nRank, nAtomNumber, pCG );
 5357|       |
 5358|   110k|    lCount = 0;
 5359|       |
 5360|       |    /* make equitable partition in pBCN->pRankStack[0,1] */
 5361|   110k|    nNumCurrRanks = DifferentiateRanks2( pCG,
 5362|   110k|                                         num_atoms,
 5363|   110k|                                         NeighList[TAUT_NON],
  ------------------
  |  |  579|   110k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 5364|   110k|                                         nNumCurrRanks, nRank,
 5365|   110k|                                         nTempRank,
 5366|   110k|                                         nAtomNumber,
 5367|   110k|                                         &lCount,
 5368|   110k|                                         0 /* 0 means use qsort */ );
 5369|       |
 5370|       |    /* allocate partition stack */
 5371|   110k|    nMaxLenRankStack = 2 * ( num_at_tg - nNumCurrRanks ) + 8;  /* was 2*(...) + 6 */
 5372|   110k|    pBCN->pRankStack = (AT_RANK **) inchi_calloc( nMaxLenRankStack, sizeof( pBCN->pRankStack[0] ) );
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
 5373|   110k|    if (!pBCN->pRankStack)
  ------------------
  |  Branch (5373:9): [True: 0, False: 110k]
  ------------------
 5374|      0|    {
 5375|      0|        pBCN->nMaxLenRankStack = 0; /* avoid memory leaks in case of error */
 5376|      0|        goto exit_error_alloc;
 5377|      0|    }
 5378|   110k|    pBCN->nMaxLenRankStack = nMaxLenRankStack; /* avoid memory leaks in case of error */
 5379|       |    /* init partition stack */
 5380|   110k|    pBCN->pRankStack[0] = nRank;
 5381|   110k|    pBCN->pRankStack[1] = nAtomNumber;
 5382|       |
 5383|       |    /********************************************************************************************/
 5384|       |    /* get NoH/no taut groups  canonical numbering, connection table, and equivalence partition */
 5385|       |    /********************************************************************************************/
 5386|       |
 5387|       |    /* pointers */
 5388|   110k|    pCD[iOther].LinearCT = NULL;
 5389|   110k|    pCD[iOther].NumH = NULL;
 5390|   110k|    pCD[iOther].NumHfixed = NULL;
 5391|   110k|    pCD[iOther].iso_sort_key = NULL;
 5392|   110k|    pCD[iOther].iso_exchg_atnos = NULL;
 5393|       |
 5394|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 5395|       |    pCD[iOther].iso_sort_key_Hfixed = NULL;
 5396|       |#endif
 5397|       |
 5398|       |    /* variables - unchanged */
 5399|   110k|    pCD[iOther].ulTimeOutTime = pBCN->ulTimeOutTime;
 5400|   110k|    pCD[iOther].nMaxLenLinearCT = s[iOther].nLenCTAtOnly + 1;
 5401|       |    /* return values & input/output */
 5402|   110k|    pCD[iOther].nLenLinearCT = s[iOther].nLenCTAtOnly;
 5403|   110k|    pCD[iOther].nLenCTAtOnly = s[iOther].nLenCTAtOnly;
 5404|   110k|    pCD[iOther].lenNumH = 0;
 5405|   110k|    pCD[iOther].lenNumHfixed = 0;
 5406|   110k|    pCD[iOther].len_iso_sort_key = 0;
 5407|   110k|    pCD[iOther].maxlen_iso_sort_key = 0;
 5408|   110k|    pCD[iOther].len_iso_exchg_atnos = 0;
 5409|   110k|    pCD[iOther].maxlen_iso_exchg_atnos = 0;
 5410|       |
 5411|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 5412|       |    pCD[iOther].len_iso_sort_key_Hfixed = 0;
 5413|       |    pCD[iOther].maxlen_iso_sort_key_Hfixed = 0;
 5414|       |#endif
 5415|       |
 5416|   110k|    ret = CanonGraph01( ic, pCG, num_atoms, num_atoms, num_max, 0,
  ------------------
  |  |  625|   110k|#define CanonGraph01 CanonGraph
  ------------------
 5417|   110k|                        NeighList[TAUT_NON], (Partition *) pBCN->pRankStack,
  ------------------
  |  |  579|   110k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 5418|   110k|                        nSymmRankNoH, nCanonRankNoH, nAtomNumberCanonNoH,
 5419|   110k|                        pCD + iOther, pCC, NULL, &Ct_NoH, LargeMolecules );
 5420|       |
 5421|   110k|    if (ret < 0)
  ------------------
  |  Branch (5421:9): [True: 0, False: 110k]
  ------------------
 5422|      0|    {
 5423|      0|        goto exit_error;
 5424|      0|    }
 5425|       |
 5426|       |    /* update initial partitioning */
 5427|   110k|    nNumCurrRanks = FixCanonEquivalenceInfo( pCG, num_atoms, nSymmRankNoH, nRank, nTempRank, nAtomNumber, &bChanged );
 5428|       |
 5429|       |    /* repartition if necessary */
 5430|   110k|    if (bChanged & 3)
  ------------------
  |  Branch (5430:9): [True: 0, False: 110k]
  ------------------
 5431|      0|    {
 5432|      0|        if (Ct_NoH)
  ------------------
  |  Branch (5432:13): [True: 0, False: 0]
  ------------------
 5433|      0|        {
 5434|      0|            CTableFree( Ct_NoH );
 5435|      0|            inchi_free( Ct_NoH );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 5436|      0|            Ct_NoH = NULL;
 5437|      0|        }
 5438|      0|        pCD[iOther].nCanonFlags |= CANON_FLAG_NO_H_RECANON;
  ------------------
  |  |  234|      0|#define CANON_FLAG_NO_H_RECANON           0x0001  /* iOther: second canonicalization of the no H structure */
  ------------------
 5439|       |
 5440|      0|        ret = CanonGraph02( ic, pCG, num_atoms, num_atoms, num_max, 0,
  ------------------
  |  |  626|      0|#define CanonGraph02 CanonGraph
  ------------------
 5441|      0|                            NeighList[TAUT_NON], (Partition *) pBCN->pRankStack,
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 5442|      0|                            nSymmRankNoH, nCanonRankNoH, nAtomNumberCanonNoH,
 5443|      0|                            pCD + iOther, pCC, NULL, &Ct_NoH, LargeMolecules );
 5444|       |
 5445|      0|        if (ret < 0)
  ------------------
  |  Branch (5445:13): [True: 0, False: 0]
  ------------------
 5446|      0|        {
 5447|      0|            goto exit_error;
 5448|      0|        }
 5449|      0|    }
 5450|       |
 5451|       |
 5452|       |    /********************************************************************************/
 5453|       |    /* get NoTautH canonical numbering, connection table, and equivalence partition */
 5454|       |    /********************************************************************************/
 5455|   110k|    maxlenNumHNoTautH = num_atoms + 1;
 5456|   110k|    nSymmRankNoTautH = (AT_RANK *) inchi_calloc( num_max, sizeof( nSymmRankNoTautH[0] ) );
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
 5457|   110k|    nCanonRankNoTautH = (AT_RANK *) inchi_calloc( num_max, sizeof( nCanonRankNoTautH[0] ) );
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
 5458|   110k|    nAtomNumberCanonNoTautH = (AT_NUMB *) inchi_calloc( num_max, sizeof( nAtomNumberCanonNoTautH[0] ) );
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
 5459|   110k|    numHNoTautH = (NUM_H *) inchi_calloc( maxlenNumHNoTautH, sizeof( numHNoTautH[0] ) );
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
 5460|   110k|    if (!numHNoTautH || !nSymmRankNoTautH || !nCanonRankNoTautH || !nAtomNumberCanonNoTautH)
  ------------------
  |  Branch (5460:9): [True: 0, False: 110k]
  |  Branch (5460:25): [True: 0, False: 110k]
  |  Branch (5460:46): [True: 0, False: 110k]
  |  Branch (5460:68): [True: 0, False: 110k]
  ------------------
 5461|      0|    {
 5462|      0|        goto exit_error_alloc;
 5463|      0|    }
 5464|       |
 5465|       |    /* find number of H atoms attached to not-a-tautomeric-endpoint atoms */
 5466|   222k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5466:17): [True: 112k, False: 110k]
  ------------------
 5467|   112k|    {
 5468|   112k|        numHNoTautH[i] = ( !at_base[i].endpoint && at_base[i].num_H ) ? at_base[i].num_H + BASE_H_NUMBER : EMPTY_H_NUMBER;
  ------------------
  |  |   64|      0|#define BASE_H_NUMBER  ((INCHI_CANON_INFINITY-1)/2)
  |  |  ------------------
  |  |  |  |   58|      0|#define INCHI_CANON_INFINITY       0x7FFF
  |  |  ------------------
  ------------------
                      numHNoTautH[i] = ( !at_base[i].endpoint && at_base[i].num_H ) ? at_base[i].num_H + BASE_H_NUMBER : EMPTY_H_NUMBER;
  ------------------
  |  |   63|   225k|#define EMPTY_H_NUMBER (INCHI_CANON_INFINITY-1)
  |  |  ------------------
  |  |  |  |   58|   112k|#define INCHI_CANON_INFINITY       0x7FFF
  |  |  ------------------
  ------------------
  |  Branch (5468:28): [True: 112k, False: 8]
  |  Branch (5468:52): [True: 0, False: 112k]
  ------------------
 5469|   112k|    }
 5470|       |
 5471|       |    /* pointers */
 5472|   110k|    pCD[iOther].LinearCT = NULL;
 5473|   110k|    pCD[iOther].NumH = numHNoTautH;
 5474|   110k|    pCD[iOther].NumHfixed = NULL;
 5475|   110k|    pCD[iOther].iso_sort_key = NULL;
 5476|   110k|    pCD[iOther].iso_exchg_atnos = NULL;
 5477|       |
 5478|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 5479|       |    pCD[iOther].iso_sort_key_Hfixed = NULL;
 5480|       |#endif
 5481|       |
 5482|       |    /* variables - unchanged */
 5483|   110k|    pCD[iOther].ulTimeOutTime = pBCN->ulTimeOutTime;
 5484|   110k|    pCD[iOther].nMaxLenLinearCT = s[iOther].nLenCTAtOnly + 1;
 5485|   110k|    pCD[iOther].maxlenNumH = maxlenNumHNoTautH;
 5486|       |    /* return values & input/output */
 5487|   110k|    pCD[iOther].nLenLinearCT = s[iOther].nLenCTAtOnly;
 5488|   110k|    pCD[iOther].nLenCTAtOnly = s[iOther].nLenCTAtOnly;
 5489|   110k|    pCD[iOther].lenNumH = lenNumHNoTautH = num_atoms;
 5490|   110k|    pCD[iOther].lenNumHfixed = 0;
 5491|   110k|    pCD[iOther].len_iso_sort_key = 0;
 5492|   110k|    pCD[iOther].maxlen_iso_sort_key = 0;
 5493|   110k|    pCD[iOther].len_iso_exchg_atnos = 0;
 5494|   110k|    pCD[iOther].maxlen_iso_exchg_atnos = 0;
 5495|       |
 5496|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 5497|       |    pCD[iOther].len_iso_sort_key_Hfixed = 0;
 5498|       |    pCD[iOther].maxlen_iso_sort_key_Hfixed = 0;
 5499|       |#endif
 5500|       |
 5501|   110k|    pCD[iOther].nAuxRank = NULL;
 5502|       |
 5503|       |    /* check whether we need NoTautH cononicalization */
 5504|   110k|    memset( nTempRank, 0, num_max * sizeof( nTempRank[0] ) );
 5505|   222k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5505:17): [True: 112k, False: 110k]
  ------------------
 5506|   112k|    {
 5507|   112k|        if (nTempRank[nSymmRankNoH[i] - 1] < i)
  ------------------
  |  Branch (5507:13): [True: 2.87k, False: 110k]
  ------------------
 5508|  2.87k|        {
 5509|  2.87k|            nTempRank[nSymmRankNoH[i] - 1] = i; /* greatest class representative */
 5510|  2.87k|        }
 5511|   112k|    }
 5512|   222k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5512:17): [True: 112k, False: 110k]
  ------------------
 5513|   112k|    {
 5514|   112k|        if (numHNoTautH[i] != numHNoTautH[nTempRank[nSymmRankNoH[i] - 1]])
  ------------------
  |  Branch (5514:13): [True: 0, False: 112k]
  ------------------
 5515|      0|        {
 5516|      0|            pCD[iOther].nCanonFlags |= CANON_FLAG_NO_TAUT_H_DIFF;
  ------------------
  |  |  235|      0|#define CANON_FLAG_NO_TAUT_H_DIFF         0x0002  /* iOther: NoTautH eq. partition differs from NoH */
  ------------------
 5517|      0|            break; /* atoms so far found to be equivalent have different number of H; the canonicalization is needed */
 5518|      0|        }
 5519|   112k|    }
 5520|       |
 5521|       |    /* i = 0; *//* debug: force to call the canonicalization */
 5522|   110k|    if (i < num_atoms)
  ------------------
  |  Branch (5522:9): [True: 0, False: 110k]
  ------------------
 5523|      0|    {
 5524|       |        /* needs canonicalization */
 5525|       |        /* get aux canonical ranking of the structure with attached H */
 5526|       |
 5527|      0|#if ( USE_AUX_RANKING == 1 )
 5528|       |        /* refine no-H partition according to not-a-taut-H distribution */
 5529|      0|        memset( pAtomInvariantAux, 0, num_max * sizeof( pAtomInvariantAux[0] ) );
 5530|      0|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5530:21): [True: 0, False: 0]
  ------------------
 5531|      0|        {
 5532|      0|            pAtomInvariantAux[i].val[0] = nSymmRankNoH[i];
 5533|      0|            pAtomInvariantAux[i].val[1] = numHNoTautH[i]; /* additional differentiation: not-a-taut-H distribution */
 5534|      0|        }
 5535|       |
 5536|       |        /* initial partitioning */
 5537|      0|        nNumCurrRanks = SetInitialRanks2( num_atoms, pAtomInvariantAux, nRankAux, nAtomNumberAux, pCG );
 5538|       |
 5539|       |        /* make equitable partition */
 5540|      0|        nNumCurrRanks = DifferentiateRanks2( pCG, num_atoms, NeighList[TAUT_NON],
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 5541|      0|                                            nNumCurrRanks, nRankAux,
 5542|      0|                                            nTempRank, nAtomNumberAux, &lCount, 0 /* 0 means use qsort */ );
 5543|       |
 5544|       |        /* to accelerate do not call CanonGraph() to find really equivalent atoms */
 5545|      0|        pCD[iOther].nAuxRank = nRankAux;
 5546|      0|#endif
 5547|       |
 5548|      0|        ret = CanonGraph03( ic, pCG, num_atoms, num_atoms, num_max, 1 /* digraph?? was 0 */,
  ------------------
  |  |  627|      0|#define CanonGraph03 CanonGraph
  ------------------
 5549|      0|                            NeighList[TAUT_NON], (Partition *) pBCN->pRankStack,
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 5550|      0|                            nSymmRankNoTautH, nCanonRankNoTautH, nAtomNumberCanonNoTautH,
 5551|      0|                            pCD + iOther, pCC, &Ct_NoH, &Ct_NoTautH, LargeMolecules );
 5552|       |
 5553|      0|        if (ret < 0)
  ------------------
  |  Branch (5553:13): [True: 0, False: 0]
  ------------------
 5554|      0|        {
 5555|      0|            goto exit_error;
 5556|      0|        }
 5557|       |
 5558|       |        /* in case of non-tautomeric structure the final results are in:
 5559|       |
 5560|       |                   nSymmRankNoTautH
 5561|       |                   nCanonRankNoTautH
 5562|       |                   nAtomNumberCanonNoTautH
 5563|       |                   Ct_NoTautH
 5564|       |                   numHNoTautH (original H positions)
 5565|       |        */
 5566|      0|    } /* if ( i < num_atoms )  */
 5567|       |
 5568|   110k|    else
 5569|       |
 5570|   110k|    {
 5571|       |
 5572|       |        /* copy the results of the previous (no H) canonicalization */
 5573|       |        /* in this case numHNoTautH[] is not needed for the next canonicalization(s) */
 5574|   110k|        if (( Ct_Temp = (ConTable *) inchi_calloc( 1, sizeof( *Ct_Temp ) ) ) &&
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
  |  Branch (5574:13): [True: 110k, False: 0]
  ------------------
 5575|   110k|             CTableCreate( Ct_Temp, num_atoms, pCD + iOther ))
  ------------------
  |  Branch (5575:14): [True: 110k, False: 0]
  ------------------
 5576|   110k|        {
 5577|   110k|            CtFullCopy( Ct_Temp, Ct_NoH );
 5578|       |            /* since Ct_NoH does not have Ct_NoH->NumH we have to fill out Ct_Temp->NumH separately */
 5579|   222k|            for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5579:25): [True: 112k, False: 110k]
  ------------------
 5580|   112k|            {
 5581|   112k|                Ct_Temp->NumH[nCanonRankNoH[i] - 1] = numHNoTautH[i];
 5582|       |                /*Ct_Temp->NumH[i] = numHNoTautH[nAtomNumberCanonNoH[i]]; -- alternative */
 5583|   112k|            }
 5584|   110k|            Ct_Temp->lenNumH = num_atoms;
 5585|   110k|        }
 5586|      0|        else
 5587|      0|        {
 5588|      0|            goto exit_error_alloc;
 5589|      0|        }
 5590|       |
 5591|   110k|        Ct_NoTautH = Ct_Temp;
 5592|   110k|        Ct_Temp = NULL;
 5593|   110k|        memcpy( nSymmRankNoTautH, nSymmRankNoH, num_atoms * sizeof( nSymmRankNoTautH[0] ) );
 5594|   110k|        memcpy( nCanonRankNoTautH, nCanonRankNoH, num_atoms * sizeof( nCanonRankNoTautH[0] ) );
 5595|   110k|        memcpy( nAtomNumberCanonNoTautH, nAtomNumberCanonNoH, num_atoms * sizeof( nAtomNumberCanonNoTautH[0] ) );
 5596|   110k|    }
 5597|       |
 5598|       |    /* in case of non-tautomeric component this is the final result */
 5599|       |    /* i = CtFullCompare( Ct_NoTautH, Ct_Temp, num_atoms, 0, 0 );*/
 5600|       |
 5601|       |    /*******************************************************************************************/
 5602|       |    /* If only Isotopic atoms and isotopic H, tautomerism has not been found:                  */
 5603|       |    /* get isotopic canonical numbering, connection table, and equivalence partition           */
 5604|       |    /*******************************************************************************************/
 5605|       |
 5606|   110k|    if (s[iOther].num_isotopic_atoms && !s[iOther].bIgnoreIsotopic && !bReqTaut && bReqNonTaut)
  ------------------
  |  Branch (5606:9): [True: 45, False: 109k]
  |  Branch (5606:41): [True: 45, False: 0]
  |  Branch (5606:71): [True: 43, False: 2]
  |  Branch (5606:84): [True: 43, False: 0]
  ------------------
 5607|     43|    {
 5608|       |
 5609|     43|        maxlen_iso_sort_key_NoTautH = num_atoms + 1;
 5610|     43|        nSymmRankNoTautHIso = (AT_RANK *) inchi_calloc( num_max, sizeof( nSymmRankNoTautHIso[0] ) );
  ------------------
  |  | 1133|     43|#define inchi_calloc   calloc
  ------------------
 5611|     43|        nCanonRankNoTautHIso = (AT_RANK *) inchi_calloc( num_max, sizeof( nCanonRankNoTautHIso[0] ) );
  ------------------
  |  | 1133|     43|#define inchi_calloc   calloc
  ------------------
 5612|     43|        nAtomNumberCanonNoTautHIso = (AT_NUMB *) inchi_calloc( num_max, sizeof( nAtomNumberCanonNoTautHIso[0] ) );
  ------------------
  |  | 1133|     43|#define inchi_calloc   calloc
  ------------------
 5613|     43|        iso_sort_key_NoTautH = (AT_ISO_SORT_KEY *) inchi_calloc( maxlen_iso_sort_key_NoTautH, sizeof( iso_sort_key_NoTautH[0] ) );
  ------------------
  |  | 1133|     43|#define inchi_calloc   calloc
  ------------------
 5614|       |
 5615|     43|        if (!nSymmRankNoTautHIso || !nCanonRankNoTautHIso || !nAtomNumberCanonNoTautHIso || !iso_sort_key_NoTautH)
  ------------------
  |  Branch (5615:13): [True: 0, False: 43]
  |  Branch (5615:37): [True: 0, False: 43]
  |  Branch (5615:62): [True: 0, False: 43]
  |  Branch (5615:93): [True: 0, False: 43]
  ------------------
 5616|      0|        {
 5617|      0|            goto exit_error_alloc;
 5618|      0|        }
 5619|       |
 5620|       |        /* fill out isotopic non-tautomeric keys */
 5621|     43|        num_iso_NoTautH = 0;
 5622|  1.34k|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5622:21): [True: 1.30k, False: 43]
  ------------------
 5623|  1.30k|        {
 5624|  1.30k|            if (at_base[i].endpoint)
  ------------------
  |  Branch (5624:17): [True: 0, False: 1.30k]
  ------------------
 5625|      0|            {
 5626|       |                /* should not happen */
 5627|      0|                iso_sort_key = make_iso_sort_key( at_base[i].iso_atw_diff, 0, 0, 0 );
 5628|      0|            }
 5629|  1.30k|            else
 5630|  1.30k|            {
 5631|  1.30k|                iso_sort_key = make_iso_sort_key( at_base[i].iso_atw_diff, at_base[i].num_iso_H[0], at_base[i].num_iso_H[1], at_base[i].num_iso_H[2] );
 5632|  1.30k|            }
 5633|  1.30k|            if (iso_sort_key)
  ------------------
  |  Branch (5633:17): [True: 137, False: 1.16k]
  ------------------
 5634|    137|            {
 5635|    137|                iso_sort_key_NoTautH[i] = iso_sort_key;
 5636|    137|                num_iso_NoTautH++;
 5637|    137|            }
 5638|  1.16k|            else
 5639|  1.16k|            {
 5640|  1.16k|                iso_sort_key_NoTautH[i] = EMPTY_ISO_SORT_KEY;
  ------------------
  |  |   65|  1.16k|#define EMPTY_ISO_SORT_KEY LONG_MAX
  ------------------
 5641|  1.16k|            }
 5642|  1.30k|        }
 5643|       |
 5644|       |        /* pointers */
 5645|     43|        pCD[iOther].LinearCT = NULL; /* LinearCT; */
 5646|     43|        pCD[iOther].NumH = numHNoTautH;
 5647|     43|        pCD[iOther].NumHfixed = NULL;
 5648|     43|        pCD[iOther].iso_sort_key = iso_sort_key_NoTautH;
 5649|     43|        pCD[iOther].iso_exchg_atnos = NULL;
 5650|       |
 5651|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 5652|       |        pCD[iOther].iso_sort_key_Hfixed = NULL;
 5653|       |#endif
 5654|       |
 5655|       |        /* variables - unchanged */
 5656|     43|        pCD[iOther].ulTimeOutTime = pBCN->ulTimeOutTime;
 5657|     43|        pCD[iOther].nMaxLenLinearCT = s[iOther].nLenCTAtOnly + 1;
 5658|     43|        pCD[iOther].maxlenNumH = maxlenNumHNoTautH;
 5659|       |        /* return values & input/output */
 5660|     43|        pCD[iOther].nLenLinearCT = s[iOther].nLenCTAtOnly;
 5661|     43|        pCD[iOther].nLenCTAtOnly = s[iOther].nLenCTAtOnly;
 5662|     43|        pCD[iOther].lenNumH = lenNumHNoTautH /*= num_atoms*/;
 5663|     43|        pCD[iOther].lenNumHfixed = 0;
 5664|     43|        pCD[iOther].len_iso_sort_key = len_iso_sort_key_NoTautH = num_atoms;
 5665|     43|        pCD[iOther].maxlen_iso_sort_key = maxlen_iso_sort_key_NoTautH;
 5666|     43|        pCD[iOther].len_iso_exchg_atnos = 0;
 5667|     43|        pCD[iOther].maxlen_iso_exchg_atnos = 0;
 5668|       |
 5669|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 5670|       |        pCD[iOther].len_iso_sort_key_Hfixed = 0;
 5671|       |        pCD[iOther].maxlen_iso_sort_key_Hfixed = 0;
 5672|       |#endif
 5673|       |
 5674|     43|        pCD[iOther].nAuxRank = NULL;
 5675|       |
 5676|     43|        if (num_iso_NoTautH)
  ------------------
  |  Branch (5676:13): [True: 43, False: 0]
  ------------------
 5677|     43|        {
 5678|       |            /* check whether we need NoTautH cononicalization */
 5679|     43|            memset( nTempRank, 0, num_max * sizeof( nTempRank[0] ) );
 5680|  1.34k|            for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5680:25): [True: 1.30k, False: 43]
  ------------------
 5681|  1.30k|            {
 5682|  1.30k|                if (nTempRank[nSymmRankNoTautH[i] - 1] < i)
  ------------------
  |  Branch (5682:21): [True: 1.26k, False: 43]
  ------------------
 5683|  1.26k|                {
 5684|  1.26k|                    nTempRank[nSymmRankNoTautH[i] - 1] = i; /* greatest class representative */
 5685|  1.26k|                }
 5686|  1.30k|            }
 5687|     89|            for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5687:25): [True: 59, False: 30]
  ------------------
 5688|     59|            {
 5689|     59|                if (iso_sort_key_NoTautH[i] != iso_sort_key_NoTautH[nTempRank[nSymmRankNoTautH[i] - 1]])
  ------------------
  |  Branch (5689:21): [True: 13, False: 46]
  ------------------
 5690|     13|                {
 5691|     13|                    pCD[iOther].nCanonFlags |= CANON_FLAG_ISO_ONLY_NON_TAUT_DIFF;
  ------------------
  |  |  236|     13|#define CANON_FLAG_ISO_ONLY_NON_TAUT_DIFF 0x0004  /* iOther: eq. partition in isotopic only non-taut differs from non-isotopic */
  ------------------
 5692|     13|                    break; /* atoms so far found to be equivalent differ in isotopes; the canonicalization is needed */
 5693|     13|                }
 5694|     59|            }
 5695|     43|        }
 5696|      0|        else
 5697|      0|        {
 5698|      0|            i = num_atoms;
 5699|      0|        }
 5700|       |        /* i = 0; *//* debug: force to call the canonicalization */
 5701|     43|        if (i < num_atoms)
  ------------------
  |  Branch (5701:13): [True: 13, False: 30]
  ------------------
 5702|     13|        {
 5703|       |            /* we need canonicalization */
 5704|       |            /* get aux canonical ranking of the structure with isotopic non-tautomeric H */
 5705|       |
 5706|     13|#if ( USE_AUX_RANKING == 1 )
 5707|       |            /* refine no-taut-H partition according to non-taut H isotopic distribution */
 5708|     13|            memset( pAtomInvariantAux, 0, num_max * sizeof( pAtomInvariantAux[0] ) );
 5709|  1.27k|            for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5709:25): [True: 1.26k, False: 13]
  ------------------
 5710|  1.26k|            {
 5711|  1.26k|                pAtomInvariantAux[i].val[0] = nSymmRankNoTautH[i];
 5712|  1.26k|                pAtomInvariantAux[i].iso_sort_key = iso_sort_key_NoTautH[i]; /* additional differentiation */
 5713|  1.26k|            }
 5714|       |            /* initial ranks for non-taut H isotopic distribution */
 5715|     13|            nNumCurrRanks = SetInitialRanks2( num_atoms, pAtomInvariantAux, nRankAux, nAtomNumberAux, pCG );
 5716|       |            /* make equitable */
 5717|     13|            nNumCurrRanks = DifferentiateRanks2( pCG, num_atoms, NeighList[TAUT_NON],
  ------------------
  |  |  579|     13|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 5718|     13|                                                nNumCurrRanks, nRankAux,
 5719|     13|                                                nTempRank, nAtomNumberAux, &lCount, 0 /* 0 means use qsort */ );
 5720|       |            /* to accelerate do not call CanonGraph() to find really equivalent atoms */
 5721|     13|            pCD[iOther].nAuxRank = nRankAux;
 5722|     13|#endif
 5723|       |
 5724|     13|            ret = CanonGraph04( ic, pCG,
  ------------------
  |  |  628|     13|#define CanonGraph04 CanonGraph
  ------------------
 5725|     13|                                num_atoms, num_atoms, num_max, 1 /* digraph?? was 0 */,
 5726|     13|                                NeighList[TAUT_NON], (Partition *) pBCN->pRankStack,
  ------------------
  |  |  579|     13|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 5727|     13|                                nSymmRankNoTautHIso, nCanonRankNoTautHIso, nAtomNumberCanonNoTautHIso,
 5728|     13|                                pCD + iOther, pCC, &Ct_NoTautH, &Ct_NoTautHIso, LargeMolecules );
 5729|     13|            if (ret < 0)
  ------------------
  |  Branch (5729:17): [True: 0, False: 13]
  ------------------
 5730|      0|            {
 5731|      0|                goto exit_error;
 5732|      0|            }
 5733|       |
 5734|       |            /* in case of non-tautomeric structure the final results are in:
 5735|       |
 5736|       |                       nSymmRankNoTautHIso
 5737|       |                       nCanonRankNoTautHIso
 5738|       |                       nAtomNumberCanonNoTautHIso
 5739|       |                       Ct_NoTautHIso
 5740|       |                       iso_sort_key_NoTautH (original isotopic atom positions)
 5741|       |            */
 5742|     13|        }
 5743|     30|        else
 5744|     30|        {
 5745|       |            /* copy the results of the previous (no taut H) canonicalization */
 5746|       |            /* in this case numHNoTautH[] is not needed for the next canonicalization(s) */
 5747|     30|            if (( Ct_Temp = (ConTable *) inchi_calloc( 1, sizeof( *Ct_Temp ) ) ) &&
  ------------------
  |  | 1133|     30|#define inchi_calloc   calloc
  ------------------
  |  Branch (5747:17): [True: 30, False: 0]
  ------------------
 5748|     30|                 CTableCreate( Ct_Temp, num_atoms, pCD + iOther ))
  ------------------
  |  Branch (5748:18): [True: 30, False: 0]
  ------------------
 5749|     30|            {
 5750|     30|                CtFullCopy( Ct_Temp, Ct_NoTautH );
 5751|       |                /* since Ct_NoTautH does not have Ct_NoTautH->iso_sort_key we have to fill out Ct_Temp->iso_sort_key separately */
 5752|     69|                for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5752:29): [True: 39, False: 30]
  ------------------
 5753|     39|                {
 5754|     39|                    Ct_Temp->iso_sort_key[nCanonRankNoTautH[i] - 1] = iso_sort_key_NoTautH[i];
 5755|     39|                }
 5756|     30|                Ct_Temp->len_iso_sort_key = num_atoms;
 5757|     30|            }
 5758|      0|            else
 5759|      0|            {
 5760|      0|                goto exit_error_alloc;
 5761|      0|            }
 5762|     30|            Ct_NoTautHIso = Ct_Temp;
 5763|     30|            Ct_Temp = NULL;
 5764|     30|            memcpy( nSymmRankNoTautHIso, nSymmRankNoTautH, num_atoms * sizeof( nSymmRankNoTautHIso[0] ) );
 5765|     30|            memcpy( nCanonRankNoTautHIso, nCanonRankNoTautH, num_atoms * sizeof( nCanonRankNoTautHIso[0] ) );
 5766|     30|            memcpy( nAtomNumberCanonNoTautHIso, nAtomNumberCanonNoTautH, num_atoms * sizeof( nAtomNumberCanonNoTautHIso[0] ) );
 5767|     30|        }
 5768|       |        /* in case of non-tautomeric component this is the final result */
 5769|       |        /* i = CtFullCompare( Ct_NoTautHIso, Ct_Temp, num_atoms, 0, 0 );*/
 5770|     43|    }
 5771|       |
 5772|       |
 5773|   110k|    if (bReqTaut)
  ------------------
  |  Branch (5773:9): [True: 5, False: 110k]
  ------------------
 5774|      5|    {
 5775|       |        /*****************************************************************************/
 5776|       |        /* Tautomeric Structure Canonicalizaton:                                     */
 5777|       |        /* get base canonical numbering, connection table, and equivalence partition */
 5778|       |        /*****************************************************************************/
 5779|       |        /* find H atoms attached to non-tautomeric-endpoints and to tautomeric endpoints */
 5780|      5|        maxlenNumH = num_atoms + T_NUM_NO_ISOTOPIC*( num_at_tg - num_atoms ) + 1; /* including negative charges */
  ------------------
  |  |   97|      5|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
 5781|      5|        nSymmRankBase = (AT_RANK *) inchi_calloc( num_max, sizeof( nSymmRankBase[0] ) );
  ------------------
  |  | 1133|      5|#define inchi_calloc   calloc
  ------------------
 5782|      5|        nCanonRankBase = (AT_RANK *) inchi_calloc( num_max, sizeof( nCanonRankBase[0] ) );
  ------------------
  |  | 1133|      5|#define inchi_calloc   calloc
  ------------------
 5783|      5|        nAtomNumberCanonBase = (AT_NUMB *) inchi_calloc( num_max, sizeof( nAtomNumberCanonBase[0] ) );
  ------------------
  |  | 1133|      5|#define inchi_calloc   calloc
  ------------------
 5784|      5|        numH = (NUM_H *) inchi_calloc( maxlenNumH, sizeof( numH[0] ) );
  ------------------
  |  | 1133|      5|#define inchi_calloc   calloc
  ------------------
 5785|       |
 5786|      5|        if (!numH || !nSymmRankBase || !nCanonRankBase || !nAtomNumberCanonBase)
  ------------------
  |  Branch (5786:13): [True: 0, False: 5]
  |  Branch (5786:22): [True: 0, False: 5]
  |  Branch (5786:40): [True: 0, False: 5]
  |  Branch (5786:59): [True: 0, False: 5]
  ------------------
 5787|      0|        {
 5788|      0|            goto exit_error_alloc;
 5789|      0|        }
 5790|       |
 5791|       |        /* non-tautomeric H counts */
 5792|     26|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5792:21): [True: 21, False: 5]
  ------------------
 5793|     21|        {
 5794|     21|            numH[i] = ( !at_base[i].endpoint && at_base[i].num_H ) ? at_base[i].num_H + BASE_H_NUMBER : EMPTY_H_NUMBER;
  ------------------
  |  |   64|      0|#define BASE_H_NUMBER  ((INCHI_CANON_INFINITY-1)/2)
  |  |  ------------------
  |  |  |  |   58|      0|#define INCHI_CANON_INFINITY       0x7FFF
  |  |  ------------------
  ------------------
                          numH[i] = ( !at_base[i].endpoint && at_base[i].num_H ) ? at_base[i].num_H + BASE_H_NUMBER : EMPTY_H_NUMBER;
  ------------------
  |  |   63|     42|#define EMPTY_H_NUMBER (INCHI_CANON_INFINITY-1)
  |  |  ------------------
  |  |  |  |   58|     21|#define INCHI_CANON_INFINITY       0x7FFF
  |  |  ------------------
  ------------------
  |  Branch (5794:25): [True: 13, False: 8]
  |  Branch (5794:49): [True: 0, False: 13]
  ------------------
 5795|     21|        }
 5796|       |
 5797|       |        /* tautomeric H and negative charge counts */
 5798|      9|        for (i = k = num_atoms; i < num_at_tg; i++)
  ------------------
  |  Branch (5798:33): [True: 4, False: 5]
  ------------------
 5799|      4|        {
 5800|      4|            m = i - num_atoms;
 5801|     12|            for (j = 0; j < T_NUM_NO_ISOTOPIC; j++)
  ------------------
  |  |   97|     12|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
  |  Branch (5801:25): [True: 8, False: 4]
  ------------------
 5802|      8|            {
 5803|       |                /* non-zeroes for j=1 are negative charge counts; T_NUM_NO_ISOTOPIC=2 entry per t-group */
 5804|      8|                numH[k++] = t_group_info->t_group[m].num[j] ? t_group_info->t_group[m].num[j] + BASE_H_NUMBER : EMPTY_H_NUMBER;
  ------------------
  |  |   64|      8|#define BASE_H_NUMBER  ((INCHI_CANON_INFINITY-1)/2)
  |  |  ------------------
  |  |  |  |   58|      8|#define INCHI_CANON_INFINITY       0x7FFF
  |  |  ------------------
  ------------------
                              numH[k++] = t_group_info->t_group[m].num[j] ? t_group_info->t_group[m].num[j] + BASE_H_NUMBER : EMPTY_H_NUMBER;
  ------------------
  |  |   63|      8|#define EMPTY_H_NUMBER (INCHI_CANON_INFINITY-1)
  |  |  ------------------
  |  |  |  |   58|      0|#define INCHI_CANON_INFINITY       0x7FFF
  |  |  ------------------
  ------------------
  |  Branch (5804:29): [True: 8, False: 0]
  ------------------
 5805|      8|            }
 5806|      4|        }
 5807|       |
 5808|       |        /* pointers */
 5809|      5|        pCD[iBase].LinearCT = NULL;
 5810|      5|        pCD[iBase].NumH = numH; /* num_atoms non-tautomeric H; num_tg pairs of H and (-) in t-groups */
 5811|      5|        pCD[iBase].NumHfixed = NULL;
 5812|      5|        pCD[iBase].iso_sort_key = NULL;
 5813|      5|        pCD[iBase].iso_exchg_atnos = NULL;
 5814|       |
 5815|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 5816|       |        pCD[iBase].iso_sort_key_Hfixed = NULL;
 5817|       |#endif
 5818|       |
 5819|       |        /* variables - unchanged */
 5820|      5|        pCD[iBase].ulTimeOutTime = pBCN->ulTimeOutTime;
 5821|      5|        pCD[iBase].nMaxLenLinearCT = s[iBase].nLenCT + 1;
 5822|      5|        pCD[iBase].maxlenNumH = maxlenNumH;
 5823|       |        /* return values & input/output */
 5824|      5|        pCD[iBase].nLenLinearCT = s[iBase].nLenCT;
 5825|      5|        pCD[iBase].nLenCTAtOnly = s[iBase].nLenCTAtOnly;
 5826|      5|        pCD[iBase].lenNumH = lenNumH = k;
 5827|      5|        pCD[iBase].lenNumHfixed = 0;
 5828|      5|        pCD[iBase].len_iso_sort_key = 0;
 5829|      5|        pCD[iBase].maxlen_iso_sort_key = 0;
 5830|      5|        pCD[iBase].len_iso_exchg_atnos = 0;
 5831|      5|        pCD[iBase].maxlen_iso_exchg_atnos = 0;
 5832|       |
 5833|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 5834|       |        pCD[iBase].len_iso_sort_key_Hfixed = 0;
 5835|       |        pCD[iBase].maxlen_iso_sort_key_Hfixed = 0;
 5836|       |#endif
 5837|       |
 5838|      5|        pCD[iBase].nAuxRank = NULL;
 5839|       |
 5840|       |        /* make sure the initial partition is equitable (at this point t-groups do not have ranks yet) */
 5841|      5|        FillOutAtomInvariant2( at_base,
 5842|      5|                               num_atoms,
 5843|      5|                               num_at_tg,
 5844|      5|                               pAtomInvariant,
 5845|      5|                               1 /*bIgnoreIsotopic*/,
 5846|      5|                               0 /*bHydrogensInRanks*/,
 5847|      5|                               0 /*bHydrogensFixedInRanks*/,
 5848|      5|                               1 /*bTaut=bDigraph*/,
 5849|      5|                               1 /* bTautGroupsOnly */,
 5850|      5|                               t_group_info );
 5851|       |
 5852|     26|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5852:21): [True: 21, False: 5]
  ------------------
 5853|     21|        {
 5854|     21|            pAtomInvariant[i].val[0] = pBCN->pRankStack[0][i];
 5855|     21|        }
 5856|       |
 5857|       |        /* initial ranks for t-group(s) only */
 5858|      5|        nNumCurrRanks = SetInitialRanks2( num_at_tg, pAtomInvariant, nRank, nAtomNumber, pCG );
 5859|       |
 5860|       |        /* make equitable, call digraph procedure;
 5861|       |           pBCN->pRankStack[0] is nRank, pBCN->pRankStack[1] is nAtomNumber
 5862|       |           This should only split ranks of tautomeric groups */
 5863|      5|        nNumCurrRanks = DifferentiateRanks4( pCG, num_at_tg, NeighList[TAUT_YES],
  ------------------
  |  |  580|      5|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5864|      5|                                         nNumCurrRanks, pBCN->pRankStack[0], nTempRank /* temp array */,
 5865|      5|                                         pBCN->pRankStack[1], (AT_RANK) num_atoms, &lCount );
 5866|       |
 5867|      5|#if ( USE_AUX_RANKING == 1 )
 5868|       |        /* refine no-H partition according to non-taut H distribution */
 5869|      5|        memset( pAtomInvariantAux, 0, num_max * sizeof( pAtomInvariantAux[0] ) );
 5870|     26|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5870:21): [True: 21, False: 5]
  ------------------
 5871|     21|        {
 5872|     21|            pAtomInvariantAux[i].val[0] = nSymmRankNoTautH[i];
 5873|     21|            pAtomInvariantAux[i].val[1] = numH[i]; /* additional differentiation */
 5874|     21|        }
 5875|      9|        for (j = i; i < num_at_tg; i++)
  ------------------
  |  Branch (5875:21): [True: 4, False: 5]
  ------------------
 5876|      4|        {
 5877|      4|            pAtomInvariantAux[i].val[0] = nRank[i];
 5878|      4|        }
 5879|       |        /* initial ranks for t-group(s) */
 5880|      5|        nNumCurrRanks = SetInitialRanks2( num_at_tg, pAtomInvariantAux, nRankAux, nAtomNumberAux, pCG );
 5881|       |        /* make equitable, call digraph procedure */
 5882|      5|        nNumCurrRanks = DifferentiateRanks4( pCG, num_at_tg, NeighList[TAUT_YES],
  ------------------
  |  |  580|      5|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5883|      5|                                         nNumCurrRanks, nRankAux, nTempRank /* temp array */,
 5884|      5|                                         nAtomNumberAux, (AT_RANK) num_atoms, &lCount );
 5885|       |        /* to accelerate do not call CanonGraph() to find really equivalent atoms */
 5886|      5|        pCD[iBase].nAuxRank = nRankAux;
 5887|      5|#endif
 5888|       |
 5889|      5|        ret = CanonGraph05( ic, pCG, num_atoms, num_at_tg, num_max, 1 /* digraph*/,
  ------------------
  |  |  629|      5|#define CanonGraph05 CanonGraph
  ------------------
 5890|      5|                            NeighList[TAUT_YES], (Partition *) pBCN->pRankStack,
  ------------------
  |  |  580|      5|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5891|      5|                            nSymmRankBase, nCanonRankBase, nAtomNumberCanonBase,
 5892|      5|                            pCD + iBase, pCC, &Ct_NoTautH, &Ct_Base, LargeMolecules );
 5893|      5|        if (ret < 0)
  ------------------
  |  Branch (5893:13): [True: 0, False: 5]
  ------------------
 5894|      0|        {
 5895|      0|            goto exit_error;
 5896|      0|        }
 5897|       |
 5898|       |        /* tautomeric isotopic structure */
 5899|       |        /**************************************************************************************/
 5900|       |        /* Isotopic atoms and isotopic H atoms and isotopic tautomeric groups                 */
 5901|       |        /* get isotopic canonical numbering, connection table, and equivalence partition      */
 5902|       |        /**************************************************************************************/
 5903|      5|        if (s[iBase].num_isotopic_atoms && !s[iBase].bIgnoreIsotopic ||
  ------------------
  |  Branch (5903:13): [True: 2, False: 3]
  |  Branch (5903:44): [True: 2, False: 0]
  ------------------
 5904|      5|             s[iBase].bHasIsotopicTautGroups && !bTautIgnoreIsotopic ||
  ------------------
  |  Branch (5904:14): [True: 0, False: 3]
  |  Branch (5904:49): [True: 0, False: 0]
  ------------------
 5905|      5|             bUseIsoAuxBase[iBase] && !bTautIgnoreIsotopic)
  ------------------
  |  Branch (5905:14): [True: 0, False: 3]
  |  Branch (5905:39): [True: 0, False: 0]
  ------------------
 5906|      2|        {
 5907|       |
 5908|      2|            t_group_info->bIgnoreIsotopic = bTautIgnoreIsotopic;
 5909|       |
 5910|      2|            nSymmRankBaseIso = (AT_RANK *) inchi_calloc( num_max, sizeof( nSymmRankBaseIso[0] ) );
  ------------------
  |  | 1133|      2|#define inchi_calloc   calloc
  ------------------
 5911|      2|            nCanonRankBaseIso = (AT_RANK *) inchi_calloc( num_max, sizeof( nCanonRankBaseIso[0] ) );
  ------------------
  |  | 1133|      2|#define inchi_calloc   calloc
  ------------------
 5912|      2|            nAtomNumberCanonBaseIso = (AT_NUMB *) inchi_calloc( num_max, sizeof( nAtomNumberCanonBaseIso[0] ) );
  ------------------
  |  | 1133|      2|#define inchi_calloc   calloc
  ------------------
 5913|      2|            if (bUseIsoAuxBase[iBase])
  ------------------
  |  Branch (5913:17): [True: 0, False: 2]
  ------------------
 5914|      0|            {
 5915|      0|                maxlen_iso_exchg_atnos = num_max + 1;
 5916|      0|                iso_exchg_atnos = (S_CHAR  *) inchi_calloc( maxlen_iso_exchg_atnos, sizeof( iso_exchg_atnos[0] ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 5917|      0|            }
 5918|      2|            maxlen_iso_sort_keyBase = num_max + 1; /* num_at_tg+1;*/
 5919|      2|            iso_sort_keyBase = (AT_ISO_SORT_KEY *) inchi_calloc( maxlen_iso_sort_keyBase, sizeof( iso_sort_keyBase[0] ) );
  ------------------
  |  | 1133|      2|#define inchi_calloc   calloc
  ------------------
 5920|      2|            if (!nSymmRankBaseIso || !nCanonRankBaseIso || !nAtomNumberCanonBaseIso ||
  ------------------
  |  Branch (5920:17): [True: 0, False: 2]
  |  Branch (5920:38): [True: 0, False: 2]
  |  Branch (5920:60): [True: 0, False: 2]
  ------------------
 5921|      2|                 !iso_sort_keyBase ||
  ------------------
  |  Branch (5921:18): [True: 0, False: 2]
  ------------------
 5922|      2|                 maxlen_iso_exchg_atnos && !iso_exchg_atnos)
  ------------------
  |  Branch (5922:18): [True: 0, False: 2]
  |  Branch (5922:44): [True: 0, False: 0]
  ------------------
 5923|      0|            {
 5924|      0|                goto exit_error_alloc;
 5925|      0|            }
 5926|       |            /* atoms */
 5927|      2|            num_iso_NoTautH = 0;
 5928|      2|            num_iso_NoAuxBase = 0;
 5929|      2|            if (iso_exchg_atnos)
  ------------------
  |  Branch (5929:17): [True: 0, False: 2]
  ------------------
 5930|      0|            {
 5931|      0|                len_iso_exchg_atnos = num_at_tg;
 5932|      0|            }
 5933|     12|            for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5933:25): [True: 10, False: 2]
  ------------------
 5934|     10|            {
 5935|     10|                if (at_base[i].endpoint || iso_exchg_atnos && ( at_base[i].cFlags & AT_FLAG_ISO_H_POINT ))
  ------------------
  |  |   82|      0|#define AT_FLAG_ISO_H_POINT 0x01  /* may have isotopic H */
  ------------------
  |  Branch (5935:21): [True: 4, False: 6]
  |  Branch (5935:44): [True: 0, False: 6]
  |  Branch (5935:63): [True: 0, False: 0]
  ------------------
 5936|      4|                {
 5937|       |                    /* tautomeric or may have exchangeable isotopic H */
 5938|      4|                    iso_sort_key = make_iso_sort_key( at_base[i].iso_atw_diff, 0, 0, 0 );
 5939|      4|                    if (iso_exchg_atnos)
  ------------------
  |  Branch (5939:25): [True: 0, False: 4]
  ------------------
 5940|      0|                    {
 5941|      0|                        num_iso_NoAuxBase += !at_base[i].endpoint; /* these non-taut atom may exchange isotopic H as tautomeric atoms do */
 5942|      0|                    }
 5943|      4|                }
 5944|      6|                else
 5945|      6|                {
 5946|       |                    /* non-mobile H */
 5947|      6|                    iso_sort_key = make_iso_sort_key( at_base[i].iso_atw_diff, at_base[i].num_iso_H[0], at_base[i].num_iso_H[1], at_base[i].num_iso_H[2] );
 5948|      6|                    if (iso_exchg_atnos)
  ------------------
  |  Branch (5948:25): [True: 0, False: 6]
  ------------------
 5949|      0|                    {
 5950|      0|                        iso_exchg_atnos[i] = 1; /* atom cannot have exchangable isotopic H atom(s) */
 5951|      0|                    }
 5952|      6|                }
 5953|     10|                if (iso_sort_key)
  ------------------
  |  Branch (5953:21): [True: 2, False: 8]
  ------------------
 5954|      2|                {
 5955|      2|                    num_iso_NoTautH++;
 5956|      2|                    iso_sort_keyBase[i] = iso_sort_key;
 5957|      2|                }
 5958|      8|                else
 5959|      8|                {
 5960|      8|                    iso_sort_keyBase[i] = EMPTY_ISO_SORT_KEY;
  ------------------
  |  |   65|      8|#define EMPTY_ISO_SORT_KEY LONG_MAX
  ------------------
 5961|      8|                }
 5962|     10|            }
 5963|       |
 5964|       |            /* check marking and count of non-taut atoms that may exchange isotopic H -- debug only */
 5965|      2|            if (iso_exchg_atnos)
  ------------------
  |  Branch (5965:17): [True: 0, False: 2]
  ------------------
 5966|      0|            {
 5967|      0|                if (num_iso_NoAuxBase != t_group_info->nIsotopicEndpointAtomNumber[0])
  ------------------
  |  Branch (5967:21): [True: 0, False: 0]
  ------------------
 5968|      0|                {
 5969|      0|                    ret = CT_ISOCOUNT_ERR;
  ------------------
  |  |   51|      0|#define CT_ISOCOUNT_ERR      (CT_ERR_FIRST- 4)  /*(-30004) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 5970|      0|                    goto exit_error;
 5971|      0|                }
 5972|      0|                for (i = 1; i <= num_iso_NoAuxBase; i++)
  ------------------
  |  Branch (5972:29): [True: 0, False: 0]
  ------------------
 5973|      0|                {
 5974|      0|                    j = t_group_info->nIsotopicEndpointAtomNumber[i];
 5975|      0|                    if (at_base[j].endpoint || !( at_base[j].cFlags & AT_FLAG_ISO_H_POINT ))
  ------------------
  |  |   82|      0|#define AT_FLAG_ISO_H_POINT 0x01  /* may have isotopic H */
  ------------------
  |  Branch (5975:25): [True: 0, False: 0]
  |  Branch (5975:48): [True: 0, False: 0]
  ------------------
 5976|      0|                    {
 5977|      0|                        ret = CT_ISOCOUNT_ERR;
  ------------------
  |  |   51|      0|#define CT_ISOCOUNT_ERR      (CT_ERR_FIRST- 4)  /*(-30004) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 5978|      0|                        goto exit_error;
 5979|      0|                    }
 5980|      0|                }
 5981|      0|            }
 5982|       |
 5983|       |            /* t-groups */
 5984|      2|            num_iso_Base = 0;
 5985|      2|            if (iso_exchg_atnos)
  ------------------
  |  Branch (5985:17): [True: 0, False: 2]
  ------------------
 5986|      0|            {
 5987|      0|                for (i = num_atoms; i < num_at_tg; i++)
  ------------------
  |  Branch (5987:37): [True: 0, False: 0]
  ------------------
 5988|      0|                {
 5989|      0|                    iso_sort_keyBase[i] = EMPTY_ISO_SORT_KEY; /* new mode: do not provide info about isotopic tautomeric H */
  ------------------
  |  |   65|      0|#define EMPTY_ISO_SORT_KEY LONG_MAX
  ------------------
 5990|      0|                }
 5991|      0|            }
 5992|      2|            else
 5993|      2|            {
 5994|      4|                for (i = num_atoms; i < num_at_tg; i++)
  ------------------
  |  Branch (5994:37): [True: 2, False: 2]
  ------------------
 5995|      2|                {
 5996|       |                    /* should not happen anymore */
 5997|      2|                    m = i - num_atoms;
 5998|      2|                    if (iso_sort_key = t_group_info->t_group[m].iWeight)
  ------------------
  |  Branch (5998:25): [True: 0, False: 2]
  ------------------
 5999|      0|                    {
 6000|       |                        /* old approach: each t-group has its own isotopic "weight" */
 6001|      0|                        num_iso_Base++;
 6002|      0|                        iso_sort_keyBase[i] = iso_sort_key;
 6003|      0|                    }
 6004|      2|                    else
 6005|      2|                    {
 6006|      2|                        iso_sort_keyBase[i] = EMPTY_ISO_SORT_KEY;
  ------------------
  |  |   65|      2|#define EMPTY_ISO_SORT_KEY LONG_MAX
  ------------------
 6007|      2|                    }
 6008|      2|                }
 6009|      2|            }
 6010|       |
 6011|      2|            if (!num_iso_NoAuxBase && iso_exchg_atnos)
  ------------------
  |  Branch (6011:17): [True: 2, False: 0]
  |  Branch (6011:39): [True: 0, False: 2]
  ------------------
 6012|      0|            {
 6013|       |                /* all atoms that may exchange isotopic H are either tautomeric or not present */
 6014|      0|                inchi_free( iso_exchg_atnos );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 6015|      0|                iso_exchg_atnos = NULL;
 6016|      0|                len_iso_exchg_atnos = 0;
 6017|      0|                maxlen_iso_exchg_atnos = 0;
 6018|      0|            }
 6019|       |
 6020|      2|            if (!num_iso_NoTautH && !num_iso_Base && iso_sort_keyBase)
  ------------------
  |  Branch (6020:17): [True: 0, False: 2]
  |  Branch (6020:37): [True: 0, False: 0]
  |  Branch (6020:54): [True: 0, False: 0]
  ------------------
 6021|      0|            {
 6022|       |                /* no isotopic atoms present */
 6023|      0|                inchi_free( iso_sort_keyBase );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 6024|      0|                iso_sort_keyBase = NULL;
 6025|      0|                maxlen_iso_sort_keyBase = 0;
 6026|      0|            }
 6027|      2|            else
 6028|      2|            {
 6029|      2|                len_iso_sort_keyBase = num_at_tg;
 6030|      2|            }
 6031|       |
 6032|      2|            if (!iso_exchg_atnos && !iso_sort_keyBase)
  ------------------
  |  Branch (6032:17): [True: 2, False: 0]
  |  Branch (6032:37): [True: 0, False: 2]
  ------------------
 6033|      0|            {
 6034|       |                /* no isotopic part at all or only tautomeric groups */
 6035|      0|                inchi_free( nSymmRankBaseIso );        nSymmRankBaseIso = NULL;
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 6036|      0|                inchi_free( nCanonRankBaseIso );       nCanonRankBaseIso = NULL;
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 6037|      0|                inchi_free( nAtomNumberCanonBaseIso ); nAtomNumberCanonBaseIso = NULL;
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 6038|      0|            }
 6039|      2|            else
 6040|      2|            {
 6041|       |                /* proceed with tautomeric isotopic canonicalization */
 6042|       |                /* pointers */
 6043|      2|                pCD[iBase].LinearCT = NULL;
 6044|      2|                pCD[iBase].NumH = numH; /* num_atoms non-tautomeric H; num_tg pairs of H and (-) in t-groups */
 6045|      2|                pCD[iBase].NumHfixed = NULL;
 6046|      2|                pCD[iBase].iso_sort_key = iso_sort_keyBase;
 6047|      2|                pCD[iBase].iso_exchg_atnos = iso_exchg_atnos;
 6048|       |
 6049|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6050|       |                pCD[iBase].iso_sort_key_Hfixed = NULL;
 6051|       |#endif
 6052|       |
 6053|       |                /* variables - unchanged */
 6054|      2|                pCD[iBase].ulTimeOutTime = pBCN->ulTimeOutTime;
 6055|      2|                pCD[iBase].nMaxLenLinearCT = s[iBase].nLenCT + 1;
 6056|      2|                pCD[iBase].maxlenNumH = maxlenNumH;
 6057|       |                /* return values & input/output */
 6058|      2|                pCD[iBase].nLenLinearCT = s[iBase].nLenCT;
 6059|      2|                pCD[iBase].nLenCTAtOnly = s[iBase].nLenCTAtOnly;
 6060|      2|                pCD[iBase].lenNumH = lenNumH /* = k */;
 6061|      2|                pCD[iBase].lenNumHfixed = 0;
 6062|      2|                pCD[iBase].len_iso_sort_key = len_iso_sort_keyBase;
 6063|      2|                pCD[iBase].maxlen_iso_sort_key = maxlen_iso_sort_keyBase;
 6064|      2|                pCD[iBase].len_iso_exchg_atnos = len_iso_exchg_atnos;
 6065|      2|                pCD[iBase].maxlen_iso_exchg_atnos = maxlen_iso_exchg_atnos;
 6066|       |
 6067|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6068|       |                pCD[iBase].len_iso_sort_key_Hfixed = 0;
 6069|       |                pCD[iBase].maxlen_iso_sort_key_Hfixed = 0;
 6070|       |#endif
 6071|       |
 6072|      2|                pCD[iBase].nAuxRank = NULL;
 6073|       |
 6074|      2|                if (num_iso_NoTautH || num_iso_Base || num_iso_NoAuxBase)
  ------------------
  |  Branch (6074:21): [True: 2, False: 0]
  |  Branch (6074:40): [True: 0, False: 0]
  |  Branch (6074:56): [True: 0, False: 0]
  ------------------
 6075|      2|                {
 6076|       |                    /* check whether we need actual canonicalization */
 6077|      2|                    memset( nTempRank, 0, num_max * sizeof( nTempRank[0] ) );
 6078|     14|                    for (i = 0; i < num_at_tg; i++)
  ------------------
  |  Branch (6078:33): [True: 12, False: 2]
  ------------------
 6079|     12|                    {
 6080|     12|                        if (nTempRank[nSymmRankBase[i] - 1] < i)
  ------------------
  |  Branch (6080:29): [True: 10, False: 2]
  ------------------
 6081|     10|                        {
 6082|     10|                            nTempRank[nSymmRankBase[i] - 1] = i; /* greatest class representative */
 6083|     10|                        }
 6084|     12|                    }
 6085|     14|                    for (i = 0; i < num_at_tg; i++)
  ------------------
  |  Branch (6085:33): [True: 12, False: 2]
  ------------------
 6086|     12|                    {
 6087|     12|                        if (( iso_sort_keyBase ? ( iso_sort_keyBase[i] != iso_sort_keyBase[nTempRank[nSymmRankBase[i] - 1]] ) : 0 ) ||
  ------------------
  |  Branch (6087:29): [True: 0, False: 12]
  |  Branch (6087:31): [True: 12, False: 0]
  ------------------
 6088|     12|                            ( iso_exchg_atnos ? ( iso_exchg_atnos[i] != iso_exchg_atnos[nTempRank[nSymmRankBase[i] - 1]] ) : 0 ))
  ------------------
  |  Branch (6088:29): [True: 0, False: 12]
  |  Branch (6088:31): [True: 0, False: 12]
  ------------------
 6089|      0|                        {
 6090|      0|                            pCD[iBase].nCanonFlags |= CANON_FLAG_ISO_TAUT_DIFF;
  ------------------
  |  |  237|      0|#define CANON_FLAG_ISO_TAUT_DIFF          0x0008  /* iBase:  isotopic eq. partition in isotopic taut differs from non-isotopic taut */
  ------------------
 6091|      0|                            break; /* atoms so far found to be equivalent have different number of H; the canonicalization is needed */
 6092|      0|                        }
 6093|     12|                    }
 6094|      2|                }
 6095|      0|                else
 6096|      0|                {
 6097|      0|                    i = num_at_tg; /* should not happen */
 6098|      0|                }
 6099|       |
 6100|       |                /* i = 0; *//* debug: force to call the canonicalization */
 6101|       |
 6102|      2|                if (i < num_at_tg)
  ------------------
  |  Branch (6102:21): [True: 0, False: 2]
  ------------------
 6103|      0|                {
 6104|       |                    /* we need canonicalization */
 6105|       |                    /* get aux canonical ranking of the structure with isotopic non-tautomeric H */
 6106|       |
 6107|      0|#if ( USE_AUX_RANKING == 1 )
 6108|       |                /* refine no-taut-H partition according to non-taut H + t-groups isotopic distribution */
 6109|      0|                    memset( pAtomInvariantAux, 0, num_max * sizeof( pAtomInvariantAux[0] ) );
 6110|      0|                    for (i = 0; i < num_at_tg; i++)
  ------------------
  |  Branch (6110:33): [True: 0, False: 0]
  ------------------
 6111|      0|                    {
 6112|      0|                        pAtomInvariantAux[i].val[0] = nSymmRankBase[i];
 6113|      0|                        pAtomInvariantAux[i].iso_sort_key = iso_sort_keyBase ? iso_sort_keyBase[i] : 0; /* additional differentiation */
  ------------------
  |  Branch (6113:61): [True: 0, False: 0]
  ------------------
 6114|      0|                        pAtomInvariantAux[i].iso_aux_key = iso_exchg_atnos ? iso_exchg_atnos[i] : 0;
  ------------------
  |  Branch (6114:60): [True: 0, False: 0]
  ------------------
 6115|      0|                    }
 6116|       |                    /* initial ranks for non-taut H isotopic distribution */
 6117|      0|                    nNumCurrRanks = SetInitialRanks2( num_at_tg, pAtomInvariantAux, nRankAux, nAtomNumberAux, pCG );
 6118|       |                    /* make equitable, not a digraph procedure */
 6119|      0|                    nNumCurrRanks = DifferentiateRanks2( pCG, num_at_tg, NeighList[TAUT_YES],
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6120|      0|                                                        nNumCurrRanks, nRankAux,
 6121|      0|                                                        nTempRank, nAtomNumberAux, &lCount, 0 /* 0 means first use qsort */ );
 6122|       |                    /* to accelerate do not call CanonGraph() to find really equivalent atoms */
 6123|      0|                    pCD[iBase].nAuxRank = nRankAux;
 6124|      0|#endif
 6125|       |
 6126|      0|                    ret = CanonGraph06( ic, pCG, num_atoms, num_at_tg, num_max, 1 /* digraph */,
  ------------------
  |  |  630|      0|#define CanonGraph06 CanonGraph
  ------------------
 6127|      0|                                        NeighList[TAUT_YES], (Partition *) pBCN->pRankStack,
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6128|      0|                                        nSymmRankBaseIso, nCanonRankBaseIso, nAtomNumberCanonBaseIso,
 6129|      0|                                        pCD + iBase, pCC, &Ct_Base, &Ct_BaseIso, LargeMolecules );
 6130|      0|                    if (ret < 0)
  ------------------
  |  Branch (6130:25): [True: 0, False: 0]
  ------------------
 6131|      0|                    {
 6132|      0|                        goto exit_error;
 6133|      0|                    }
 6134|       |                    /* in case of a tautomeric structure the final results are in:
 6135|       |
 6136|       |                               nSymmRankBaseIso
 6137|       |                               nCanonRankBaseIso
 6138|       |                               nAtomNumberCanonBaseIso
 6139|       |                               Ct_BaseIso
 6140|       |                               iso_sort_keyBase (original isotopic atom & t-group positions)
 6141|       |                               Ct_BaseIso->iso_exchg_atnos: 0=>can exchange isotopic H, including tautomeric atoms
 6142|       |                               iso_exchg_atnos            : same, in order of t_group_info->nIsotopicEndpointAtomNumber[]
 6143|       |                    */
 6144|      0|                }
 6145|      2|                else
 6146|      2|                {
 6147|       |                    /* copy the results of the previous (no taut H) canonicalization */
 6148|       |                    /* in this case numHNoTautH[] is not needed for the next canonicalization(s) */
 6149|      2|                    if (( Ct_Temp = (ConTable *) inchi_calloc( 1, sizeof( *Ct_Temp ) ) ) &&
  ------------------
  |  | 1133|      2|#define inchi_calloc   calloc
  ------------------
  |  Branch (6149:25): [True: 2, False: 0]
  ------------------
 6150|      2|                         CTableCreate( Ct_Temp, num_atoms, pCD + iBase ))
  ------------------
  |  Branch (6150:26): [True: 2, False: 0]
  ------------------
 6151|      2|                    {
 6152|      2|                        CtFullCopy( Ct_Temp, Ct_Base );
 6153|       |                        /* since Ct_Base does not have Ct_Base->iso_sort_key we
 6154|       |                           have to fill out Ct_Temp->iso_sort_key separately */
 6155|      2|                        if (iso_sort_keyBase)
  ------------------
  |  Branch (6155:29): [True: 2, False: 0]
  ------------------
 6156|      2|                        {
 6157|     14|                            for (i = 0; i < num_at_tg; i++)
  ------------------
  |  Branch (6157:41): [True: 12, False: 2]
  ------------------
 6158|     12|                            {
 6159|     12|                                Ct_Temp->iso_sort_key[nCanonRankBase[i] - 1] = iso_sort_keyBase[i];
 6160|     12|                            }
 6161|      2|                            Ct_Temp->len_iso_sort_key = num_at_tg;
 6162|      2|                        }
 6163|      0|                        else
 6164|      0|                        {
 6165|      0|                            Ct_Temp->len_iso_sort_key = 0;
 6166|      0|                        }
 6167|      2|                        if (iso_exchg_atnos)
  ------------------
  |  Branch (6167:29): [True: 0, False: 2]
  ------------------
 6168|      0|                        {
 6169|      0|                            for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (6169:41): [True: 0, False: 0]
  ------------------
 6170|      0|                            {
 6171|      0|                                Ct_Temp->iso_exchg_atnos[nCanonRankBase[i] - 1] = iso_exchg_atnos[i];
 6172|      0|                            }
 6173|      0|                            Ct_Temp->len_iso_exchg_atnos = num_at_tg;
 6174|      0|                        }
 6175|      2|                        else
 6176|      2|                        {
 6177|      2|                            Ct_Temp->len_iso_exchg_atnos = 0;
 6178|      2|                        }
 6179|      2|                    }
 6180|      0|                    else
 6181|      0|                    {
 6182|      0|                        goto exit_error_alloc;
 6183|      0|                    }
 6184|      2|                    Ct_BaseIso = Ct_Temp;
 6185|      2|                    Ct_Temp = NULL;
 6186|      2|                    memcpy( nSymmRankBaseIso, nSymmRankBase, num_at_tg * sizeof( nSymmRankBaseIso[0] ) );
 6187|      2|                    memcpy( nCanonRankBaseIso, nCanonRankBase, num_at_tg * sizeof( nCanonRankBaseIso[0] ) );
 6188|      2|                    memcpy( nAtomNumberCanonBaseIso, nAtomNumberCanonBase, num_at_tg * sizeof( nAtomNumberCanonBaseIso[0] ) );
 6189|      2|                }
 6190|       |                /* in case of non-tautomeric component this is the final result */
 6191|       |                /* i = CtFullCompare( Ct_BaseIso, Ct_Temp, num_at_tg, 0, 0 );*/
 6192|       |
 6193|      2|                t_group_info->bIgnoreIsotopic = 1;
 6194|      2|            }
 6195|      2|        }
 6196|      5|    }
 6197|       |
 6198|       |    /**********************************************************************************/
 6199|       |    /* get "fixed H" canonical numbering, connection table, and equivalence partition */
 6200|       |    /**********************************************************************************/
 6201|       |
 6202|   110k|    if (bReqTaut && bReqNonTaut)
  ------------------
  |  Branch (6202:9): [True: 5, False: 110k]
  |  Branch (6202:21): [True: 3, False: 2]
  ------------------
 6203|      3|    {
 6204|      3|        maxlenNumHfixed = num_atoms + 1;
 6205|      3|        nSymmRankFixH = (AT_RANK *) inchi_calloc( num_max, sizeof( nSymmRankFixH[0] ) );
  ------------------
  |  | 1133|      3|#define inchi_calloc   calloc
  ------------------
 6206|      3|        nCanonRankFixH = (AT_RANK *) inchi_calloc( num_max, sizeof( nCanonRankFixH[0] ) );
  ------------------
  |  | 1133|      3|#define inchi_calloc   calloc
  ------------------
 6207|      3|        nAtomNumberCanonFixH = (AT_NUMB *) inchi_calloc( num_max, sizeof( nAtomNumberCanonFixH[0] ) );
  ------------------
  |  | 1133|      3|#define inchi_calloc   calloc
  ------------------
 6208|      3|        NumHfixed = (NUM_H *) inchi_calloc( maxlenNumHfixed, sizeof( NumHfixed[0] ) );
  ------------------
  |  | 1133|      3|#define inchi_calloc   calloc
  ------------------
 6209|      3|        if (!NumHfixed || !nSymmRankFixH || !nCanonRankFixH || !nAtomNumberCanonFixH)
  ------------------
  |  Branch (6209:13): [True: 0, False: 3]
  |  Branch (6209:27): [True: 0, False: 3]
  |  Branch (6209:45): [True: 0, False: 3]
  |  Branch (6209:64): [True: 0, False: 3]
  ------------------
 6210|      0|        {
 6211|      0|            goto exit_error_alloc;
 6212|      0|        }
 6213|     14|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (6213:21): [True: 11, False: 3]
  ------------------
 6214|     11|        {
 6215|       |            /* fixed and non-tautomeric H different in taut and non-taut structures */
 6216|       |
 6217|     11|            if (at_base[i].endpoint)
  ------------------
  |  Branch (6217:17): [True: 4, False: 7]
  ------------------
 6218|      4|            {
 6219|      4|                NumHfixed[i] = at_other[i].num_H ? at_other[i].num_H + BASE_H_NUMBER : EMPTY_H_NUMBER;
  ------------------
  |  |   64|      0|#define BASE_H_NUMBER  ((INCHI_CANON_INFINITY-1)/2)
  |  |  ------------------
  |  |  |  |   58|      0|#define INCHI_CANON_INFINITY       0x7FFF
  |  |  ------------------
  ------------------
                              NumHfixed[i] = at_other[i].num_H ? at_other[i].num_H + BASE_H_NUMBER : EMPTY_H_NUMBER;
  ------------------
  |  |   63|      8|#define EMPTY_H_NUMBER (INCHI_CANON_INFINITY-1)
  |  |  ------------------
  |  |  |  |   58|      4|#define INCHI_CANON_INFINITY       0x7FFF
  |  |  ------------------
  ------------------
  |  Branch (6219:32): [True: 0, False: 4]
  ------------------
 6220|      4|            }
 6221|      7|            else if (at_other[i].num_H != at_base[i].num_H)
  ------------------
  |  Branch (6221:22): [True: 0, False: 7]
  ------------------
 6222|      0|            {
 6223|      0|                NumHfixed[i] = (NUM_H) at_other[i].num_H - (NUM_H) at_base[i].num_H + BASE_H_NUMBER;
  ------------------
  |  |   64|      0|#define BASE_H_NUMBER  ((INCHI_CANON_INFINITY-1)/2)
  |  |  ------------------
  |  |  |  |   58|      0|#define INCHI_CANON_INFINITY       0x7FFF
  |  |  ------------------
  ------------------
 6224|      0|            }
 6225|      7|            else
 6226|      7|            {
 6227|      7|                NumHfixed[i] = EMPTY_H_NUMBER;
  ------------------
  |  |   63|      7|#define EMPTY_H_NUMBER (INCHI_CANON_INFINITY-1)
  |  |  ------------------
  |  |  |  |   58|      7|#define INCHI_CANON_INFINITY       0x7FFF
  |  |  ------------------
  ------------------
 6228|      7|            }
 6229|     11|        }
 6230|       |
 6231|       |        /* pointers */
 6232|      3|        pCD[iOther].LinearCT = NULL; /* LinearCT; */
 6233|      3|        pCD[iOther].NumH = numHNoTautH;
 6234|      3|        pCD[iOther].NumHfixed = NumHfixed;/* variables - unchanged */
 6235|      3|        pCD[iOther].iso_sort_key = NULL;
 6236|      3|        pCD[iOther].iso_exchg_atnos = NULL;
 6237|       |
 6238|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6239|       |        pCD[iOther].iso_sort_key_Hfixed = NULL;
 6240|       |#endif
 6241|       |
 6242|      3|        pCD[iOther].ulTimeOutTime = pBCN->ulTimeOutTime;
 6243|      3|        pCD[iOther].nMaxLenLinearCT = s[iOther].nLenCTAtOnly + 1;
 6244|      3|        pCD[iOther].maxlenNumH = maxlenNumHNoTautH;
 6245|      3|        pCD[iOther].maxlenNumHfixed = maxlenNumHfixed;
 6246|       |        /* return values & input/output */
 6247|      3|        pCD[iOther].nLenLinearCT = s[iOther].nLenCTAtOnly;
 6248|      3|        pCD[iOther].nLenCTAtOnly = s[iOther].nLenCTAtOnly;
 6249|      3|        pCD[iOther].lenNumH = lenNumHNoTautH = num_atoms;
 6250|      3|        pCD[iOther].lenNumHfixed = num_atoms;
 6251|      3|        pCD[iOther].len_iso_sort_key = 0;
 6252|      3|        pCD[iOther].maxlen_iso_sort_key = 0;
 6253|      3|        pCD[iOther].len_iso_exchg_atnos = 0;
 6254|      3|        pCD[iOther].maxlen_iso_exchg_atnos = 0;
 6255|       |
 6256|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6257|       |        pCD[iOther].len_iso_sort_key_Hfixed = 0;
 6258|       |        pCD[iOther].maxlen_iso_sort_key_Hfixed = 0;
 6259|       |#endif
 6260|       |
 6261|      3|        pCD[iOther].nAuxRank = NULL;
 6262|       |
 6263|      3|#if ( USE_AUX_RANKING == 1 )
 6264|      3|        if (!nRankAux)
  ------------------
  |  Branch (6264:13): [True: 0, False: 3]
  ------------------
 6265|      0|        {
 6266|      0|            nRankAux = (AT_RANK *) inchi_calloc( num_max, sizeof( nRankAux[0] ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 6267|      0|        }
 6268|      3|        if (!nAtomNumberAux)
  ------------------
  |  Branch (6268:13): [True: 0, False: 3]
  ------------------
 6269|      0|        {
 6270|      0|            nAtomNumberAux = (AT_NUMB *) inchi_calloc( num_max, sizeof( nAtomNumberAux[0] ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 6271|      0|        }
 6272|      3|        if (!pAtomInvariantAux)
  ------------------
  |  Branch (6272:13): [True: 0, False: 3]
  ------------------
 6273|      0|        {
 6274|      0|            pAtomInvariantAux = (ATOM_INVARIANT2 *) inchi_malloc( num_max * sizeof( pAtomInvariantAux[0] ) );
  ------------------
  |  | 1130|      0|#define inchi_malloc   malloc
  ------------------
 6275|      0|        }
 6276|      3|        if (!nRankAux || !nAtomNumberAux || !pAtomInvariantAux)
  ------------------
  |  Branch (6276:13): [True: 0, False: 3]
  |  Branch (6276:26): [True: 0, False: 3]
  |  Branch (6276:45): [True: 0, False: 3]
  ------------------
 6277|      0|        {
 6278|      0|            goto exit_error_alloc;
 6279|      0|        }
 6280|       |
 6281|       |        /* refine no-H partition according to non-taut H distribution */
 6282|      3|        memset( pAtomInvariantAux, 0, num_max * sizeof( pAtomInvariantAux[0] ) );
 6283|     14|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (6283:21): [True: 11, False: 3]
  ------------------
 6284|     11|        {
 6285|     11|            pAtomInvariantAux[i].val[0] = nSymmRankBase[i];
 6286|     11|            pAtomInvariantAux[i].val[1] = NumHfixed[i]; /* additional differentiation */
 6287|     11|        }
 6288|       |
 6289|       |        /* initial ranks for t-group(s) */
 6290|      3|        nNumCurrRanks = SetInitialRanks2( num_atoms, pAtomInvariantAux, nRankAux, nAtomNumberAux, pCG );
 6291|       |
 6292|       |        /* make equitable, digraph procedure */
 6293|      3|        nNumCurrRanks = DifferentiateRanks2( pCG, num_atoms, NeighList[TAUT_NON],
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 6294|      3|                                            nNumCurrRanks, nRankAux,
 6295|      3|                                            nTempRank, nAtomNumberAux, &lCount, 0 /* 0 means use qsort */ );
 6296|       |        /* to accelerate do not call CanonGraph() to find really equivalent atoms */
 6297|      3|        pCD[iOther].nAuxRank = nRankAux;
 6298|      3|#endif
 6299|       |
 6300|      3|        ret = CanonGraph07( ic, pCG, num_atoms, num_atoms, num_max, 0,
  ------------------
  |  |  631|      3|#define CanonGraph07 CanonGraph
  ------------------
 6301|      3|                            NeighList[TAUT_NON], (Partition *) pBCN->pRankStack,
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 6302|      3|                            nSymmRankFixH, nCanonRankFixH, nAtomNumberCanonFixH,
 6303|      3|                            pCD + iOther, pCC, &Ct_NoTautH, &Ct_FixH, LargeMolecules );
 6304|      3|        if (ret < 0)
  ------------------
  |  Branch (6304:13): [True: 0, False: 3]
  ------------------
 6305|      0|        {
 6306|      0|            goto exit_error;
 6307|      0|        }
 6308|       |
 6309|       |        /*******************************************************************************************/
 6310|       |        /* get "fixed H" isotopic canonical numbering, connection table, and equivalence partition */
 6311|       |        /*******************************************************************************************/
 6312|      3|        iflag = s[iBase].num_isotopic_atoms && !s[iBase].bIgnoreIsotopic ||
  ------------------
  |  Branch (6312:17): [True: 2, False: 1]
  |  Branch (6312:48): [True: 2, False: 0]
  ------------------
 6313|      3|            s[iBase].bHasIsotopicTautGroups && !bTautIgnoreIsotopic;
  ------------------
  |  Branch (6313:13): [True: 0, False: 1]
  |  Branch (6313:48): [True: 0, False: 0]
  ------------------
 6314|      3|        if (bFixIsoFixedH) /* #if ( FIX_ISO_FIXEDH_BUG == 1 )  */
  ------------------
  |  Branch (6314:13): [True: 3, False: 0]
  ------------------
 6315|       |             /* fix bug when iso H was removed as a proton and fixed-H isotopic layer is missing -  2008-09-24 DT*/
 6316|      3|        {
 6317|      3|            iflag = iflag || s[iOther].num_isotopic_atoms && !s[iOther].bIgnoreIsotopic;
  ------------------
  |  Branch (6317:21): [True: 2, False: 1]
  |  Branch (6317:30): [True: 0, False: 1]
  |  Branch (6317:62): [True: 0, False: 0]
  ------------------
 6318|      3|        }
 6319|      3|        if (iflag)
  ------------------
  |  Branch (6319:13): [True: 2, False: 1]
  ------------------
 6320|      2|        {
 6321|       |
 6322|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6323|       |            maxlen_iso_sort_key_Hfixed =
 6324|       |#endif
 6325|      2|            maxlen_iso_sort_key_NoTautH = num_atoms + 1;
 6326|      2|            nSymmRankFixHIso = (AT_RANK *) inchi_calloc( num_max, sizeof( nSymmRankFixHIso[0] ) );
  ------------------
  |  | 1133|      2|#define inchi_calloc   calloc
  ------------------
 6327|      2|            nCanonRankFixHIso = (AT_RANK *) inchi_calloc( num_max, sizeof( nCanonRankFixHIso[0] ) );
  ------------------
  |  | 1133|      2|#define inchi_calloc   calloc
  ------------------
 6328|      2|            nAtomNumberCanonFixHIso = (AT_NUMB *) inchi_calloc( num_max, sizeof( nAtomNumberCanonFixHIso[0] ) );
  ------------------
  |  | 1133|      2|#define inchi_calloc   calloc
  ------------------
 6329|       |
 6330|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6331|       |            iso_sort_key_Hfixed = (AT_ISO_SORT_KEY *) inchi_calloc( maxlen_iso_sort_key_Hfixed, sizeof( iso_sort_key_Hfixed[0] ) );
 6332|       |#endif
 6333|       |
 6334|      2|            iso_sort_key_NoTautH = (AT_ISO_SORT_KEY *) inchi_calloc( maxlen_iso_sort_key_NoTautH, sizeof( iso_sort_key_NoTautH[0] ) );
  ------------------
  |  | 1133|      2|#define inchi_calloc   calloc
  ------------------
 6335|       |
 6336|      2|            if (!nSymmRankFixHIso || !nCanonRankFixHIso || !nAtomNumberCanonFixHIso ||
  ------------------
  |  Branch (6336:17): [True: 0, False: 2]
  |  Branch (6336:38): [True: 0, False: 2]
  |  Branch (6336:60): [True: 0, False: 2]
  ------------------
 6337|       |
 6338|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6339|       |                 !iso_sort_key_Hfixed ||
 6340|       |#endif
 6341|       |
 6342|      2|                 !iso_sort_key_NoTautH)
  ------------------
  |  Branch (6342:18): [True: 0, False: 2]
  ------------------
 6343|      0|            {
 6344|      0|                goto exit_error_alloc;
 6345|      0|            }
 6346|       |
 6347|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6348|       |            /* fill out isotopic non-tautomeric keys */
 6349|       |            for (i = 0; i < num_atoms; i++)
 6350|       |            {
 6351|       |                if (at_base[i].endpoint)
 6352|       |                {
 6353|       |                    iso_sort_key = make_iso_sort_key( at_base[i].iso_atw_diff, 0, 0, 0 );
 6354|       |                    iso_sort_key2 = make_iso_sort_key( 0, at_base[i].num_iso_H[0], at_base[i].num_iso_H[1], at_base[i].num_iso_H[2] );
 6355|       |                }
 6356|       |                else
 6357|       |                {
 6358|       |                    iso_sort_key = make_iso_sort_key( at_base[i].iso_atw_diff, at_base[i].num_iso_H[0], at_base[i].num_iso_H[1], at_base[i].num_iso_H[2] );
 6359|       |                    iso_sort_key2 = 0;
 6360|       |                }
 6361|       |                if (iso_sort_key)
 6362|       |                {
 6363|       |                    iso_sort_key_NoTautH[i] = iso_sort_key;
 6364|       |                    num_iso_NoTautH++;
 6365|       |                }
 6366|       |                else
 6367|       |                {
 6368|       |                    iso_sort_key_NoTautH[i] = EMPTY_ISO_SORT_KEY;
 6369|       |                }
 6370|       |                if (iso_sort_key2)
 6371|       |                {
 6372|       |                    num_iso_Hfixed++;
 6373|       |                    iso_sort_key_Hfixed[i] = iso_sort_key2;
 6374|       |                }
 6375|       |                else
 6376|       |                {
 6377|       |                    iso_sort_key_Hfixed[i] = EMPTY_ISO_SORT_KEY;
 6378|       |                }
 6379|       |            }
 6380|       |#else
 6381|       |            /* fill out isotopic non-tautomeric keys */
 6382|     12|            for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (6382:25): [True: 10, False: 2]
  ------------------
 6383|     10|            {
 6384|       |
 6385|     10|                if (bFixIsoFixedH) /* #if ( FIX_ISO_FIXEDH_BUG == 1 )  */
  ------------------
  |  Branch (6385:21): [True: 10, False: 0]
  ------------------
 6386|     10|                {
 6387|       |                    /* fix bug when iso H was removed as a proton and fixed-H isotopic layer is missing -  2008-09-24 DT*/
 6388|     10|                    if (at_other)
  ------------------
  |  Branch (6388:25): [True: 10, False: 0]
  ------------------
 6389|     10|                    {
 6390|     10|                        iso_sort_key = make_iso_sort_key( at_other[i].iso_atw_diff, at_other[i].num_iso_H[0], at_other[i].num_iso_H[1], at_other[i].num_iso_H[2] );
 6391|     10|                    }
 6392|      0|                    else
 6393|      0|                    {
 6394|      0|                        iso_sort_key = make_iso_sort_key( at_base[i].iso_atw_diff, at_base[i].num_iso_H[0], at_base[i].num_iso_H[1], at_base[i].num_iso_H[2] );
 6395|      0|                    }
 6396|     10|                }
 6397|      0|                else
 6398|      0|                    iso_sort_key = make_iso_sort_key( at_base[i].iso_atw_diff, at_base[i].num_iso_H[0], at_base[i].num_iso_H[1], at_base[i].num_iso_H[2] );
 6399|       |
 6400|     10|                if (iso_sort_key)
  ------------------
  |  Branch (6400:21): [True: 2, False: 8]
  ------------------
 6401|      2|                {
 6402|      2|                    iso_sort_key_NoTautH[i] = iso_sort_key;
 6403|      2|                    num_iso_NoTautH++;
 6404|      2|                }
 6405|      8|                else
 6406|      8|                {
 6407|      8|                    iso_sort_key_NoTautH[i] = EMPTY_ISO_SORT_KEY;
  ------------------
  |  |   65|      8|#define EMPTY_ISO_SORT_KEY LONG_MAX
  ------------------
 6408|      8|                }
 6409|     10|            }
 6410|      2|#endif
 6411|       |
 6412|       |            /* pointers */
 6413|      2|            pCD[iOther].LinearCT = NULL; /* LinearCT; */
 6414|      2|            pCD[iOther].NumH = numHNoTautH;
 6415|      2|            pCD[iOther].NumHfixed = NumHfixed;/* variables - unchanged */
 6416|      2|            pCD[iOther].iso_sort_key = iso_sort_key_NoTautH;
 6417|      2|            pCD[iOther].iso_exchg_atnos = NULL;
 6418|       |
 6419|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6420|       |            pCD[iOther].iso_sort_key_Hfixed = iso_sort_key_Hfixed;
 6421|       |#endif
 6422|       |
 6423|      2|            pCD[iOther].ulTimeOutTime = pBCN->ulTimeOutTime;
 6424|      2|            pCD[iOther].nMaxLenLinearCT = s[iOther].nLenCTAtOnly + 1;
 6425|      2|            pCD[iOther].maxlenNumH = maxlenNumHNoTautH;
 6426|      2|            pCD[iOther].maxlenNumHfixed = maxlenNumHfixed;
 6427|       |            /* return values & input/output */
 6428|      2|            pCD[iOther].nLenLinearCT = s[iOther].nLenCTAtOnly;
 6429|      2|            pCD[iOther].nLenCTAtOnly = s[iOther].nLenCTAtOnly;
 6430|      2|            pCD[iOther].lenNumH = lenNumHNoTautH = num_atoms;
 6431|      2|            pCD[iOther].lenNumHfixed = num_atoms;
 6432|      2|            pCD[iOther].len_iso_sort_key = len_iso_sort_key_NoTautH = num_atoms;
 6433|      2|            pCD[iOther].maxlen_iso_sort_key = maxlen_iso_sort_key_NoTautH;
 6434|      2|            pCD[iOther].len_iso_exchg_atnos = 0;
 6435|      2|            pCD[iOther].maxlen_iso_exchg_atnos = 0;
 6436|       |
 6437|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6438|       |            pCD[iOther].len_iso_sort_key_Hfixed = len_iso_sort_key_Hfixed = num_atoms;
 6439|       |            pCD[iOther].maxlen_iso_sort_key_Hfixed = maxlen_iso_sort_key_Hfixed;
 6440|       |#endif
 6441|       |
 6442|      2|            pCD[iOther].nAuxRank = NULL;
 6443|       |
 6444|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6445|       |            if (num_iso_Hfixed || num_iso_NoTautH)
 6446|       |#else
 6447|      2|            if (num_iso_NoTautH)
  ------------------
  |  Branch (6447:17): [True: 2, False: 0]
  ------------------
 6448|      2|#endif
 6449|       |
 6450|      2|            {
 6451|       |                /* check whether we need NoTautH cononicalization */
 6452|      2|                memset( nTempRank, 0, num_max * sizeof( nTempRank[0] ) );
 6453|     12|                for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (6453:29): [True: 10, False: 2]
  ------------------
 6454|     10|                {
 6455|     10|                    if (nTempRank[nSymmRankFixH[i] - 1] < i)
  ------------------
  |  Branch (6455:25): [True: 8, False: 2]
  ------------------
 6456|      8|                    {
 6457|      8|                        nTempRank[nSymmRankFixH[i] - 1] = i; /* greatest class representative */
 6458|      8|                    }
 6459|     10|                }
 6460|     12|                for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (6460:29): [True: 10, False: 2]
  ------------------
 6461|     10|                {
 6462|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6463|       |                    if (iso_sort_key_Hfixed[i] != iso_sort_key_Hfixed[nTempRank[nSymmRankFixH[i] - 1]])
 6464|       |                        break;
 6465|       |#endif
 6466|     10|                    if (iso_sort_key_NoTautH[i] != iso_sort_key_NoTautH[nTempRank[nSymmRankFixH[i] - 1]])
  ------------------
  |  Branch (6466:25): [True: 0, False: 10]
  ------------------
 6467|      0|                        break; /* atoms so far found to be equivalent have different isotopic shifts; the canonicalization is needed */
 6468|     10|                }
 6469|      2|            }
 6470|      0|            else
 6471|      0|            {
 6472|      0|                i = num_atoms; /* should not happen */
 6473|      0|            }
 6474|       |
 6475|       |            /* i = 0; *//* debug: force to call the canonicalization */
 6476|       |
 6477|      2|            if (i < num_atoms)
  ------------------
  |  Branch (6477:17): [True: 0, False: 2]
  ------------------
 6478|      0|            {
 6479|      0|                pCD[iOther].nCanonFlags |= CANON_FLAG_ISO_FIXED_H_DIFF;
  ------------------
  |  |  238|      0|#define CANON_FLAG_ISO_FIXED_H_DIFF       0x0010  /* iOther: isotopic eq. partition in fixed H non-taut differs from non-isotopic fixed H */
  ------------------
 6480|       |                /* we need canonicalization */
 6481|       |                /* get aux canonical ranking of the structure with isotopic non-tautomeric H */
 6482|       |
 6483|      0|#if ( USE_AUX_RANKING == 1 )
 6484|       |                /* refine fixed-taut-H partition according to the isotopic distribution */
 6485|      0|                memset( pAtomInvariantAux, 0, num_max * sizeof( pAtomInvariantAux[0] ) );
 6486|      0|                for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (6486:29): [True: 0, False: 0]
  ------------------
 6487|      0|                {
 6488|      0|                    pAtomInvariantAux[i].val[0] = nSymmRankFixH[i];
 6489|       |
 6490|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6491|       |                    iso_sort_key = 0;
 6492|       |                    if (iso_sort_key_NoTautH[i] != EMPTY_ISO_SORT_KEY)
 6493|       |                        iso_sort_key |= iso_sort_key_NoTautH[i];
 6494|       |                    if (iso_sort_key_Hfixed[i] != EMPTY_ISO_SORT_KEY)
 6495|       |                        iso_sort_key |= iso_sort_key_Hfixed[i];
 6496|       |                    if (!iso_sort_key)
 6497|       |                        iso_sort_key = EMPTY_ISO_SORT_KEY;
 6498|       |#else
 6499|      0|                    iso_sort_key = iso_sort_key_NoTautH[i];
 6500|      0|#endif
 6501|       |
 6502|      0|                    pAtomInvariantAux[i].iso_sort_key = iso_sort_key; /* additional differentiation */
 6503|      0|                }
 6504|       |
 6505|       |                /* initial ranks for non-taut H isotopic distribution */
 6506|      0|                nNumCurrRanks = SetInitialRanks2( num_atoms, pAtomInvariantAux, nRankAux, nAtomNumberAux, pCG );
 6507|       |                /* make equitable, digraph procedure */
 6508|      0|                nNumCurrRanks = DifferentiateRanks2( pCG, num_atoms, NeighList[TAUT_NON],
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 6509|      0|                                                    nNumCurrRanks, nRankAux,
 6510|      0|                                                    nTempRank, nAtomNumberAux, &lCount, 0 /* 0 means use qsort */ );
 6511|       |
 6512|       |                /* to accelerate do not call CanonGraph() to find really equivalent atoms */
 6513|      0|                pCD[iOther].nAuxRank = nRankAux;
 6514|      0|#endif
 6515|       |
 6516|      0|                ret = CanonGraph08( ic, pCG, num_atoms, num_atoms, num_max, 1 /* digraph?? was 0 */,
  ------------------
  |  |  632|      0|#define CanonGraph08 CanonGraph
  ------------------
 6517|      0|                                    NeighList[TAUT_NON], (Partition *) pBCN->pRankStack,
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 6518|      0|                                    nSymmRankFixHIso, nCanonRankFixHIso, nAtomNumberCanonFixHIso,
 6519|      0|                                    pCD + iOther, pCC, &Ct_FixH, &Ct_FixHIso, LargeMolecules );
 6520|      0|                if (ret < 0)
  ------------------
  |  Branch (6520:21): [True: 0, False: 0]
  ------------------
 6521|      0|                {
 6522|      0|                    goto exit_error;
 6523|      0|                }
 6524|       |                /* in case of non-tautomeric structure the final results are in:
 6525|       |
 6526|       |                           nSymmRankFixHIso
 6527|       |                           nCanonRankFixHIso
 6528|       |                           nAtomNumberCanonFixHIso
 6529|       |                           Ct_FixHIso
 6530|       |                           iso_sort_keyBase     ([0..num_atoms] original isotopic atom positions)
 6531|       |                           iso_sort_key_Hfixed  (original fixed tautomeric H distribution)
 6532|       |                */
 6533|      0|            }
 6534|      2|            else
 6535|      2|            {
 6536|       |                /* copy the results of the previous (no taut H) canonicalization */
 6537|       |                /* in this case numHNoTautH[] is not needed for the next canonicalization(s) */
 6538|      2|                if (( Ct_Temp = (ConTable *) inchi_calloc( 1, sizeof( *Ct_Temp ) ) ) &&
  ------------------
  |  | 1133|      2|#define inchi_calloc   calloc
  ------------------
  |  Branch (6538:21): [True: 2, False: 0]
  ------------------
 6539|      2|                     CTableCreate( Ct_Temp, num_atoms, pCD + iOther ))
  ------------------
  |  Branch (6539:22): [True: 2, False: 0]
  ------------------
 6540|      2|                {
 6541|      2|                    CtFullCopy( Ct_Temp, Ct_FixH );
 6542|       |                    /* since Ct_FixH does not have Ct_FixH->iso_sort_key and Ct_FixH->iso_sort_key_Hfixed we
 6543|       |                       have to fill out Ct_Temp->iso_sort_key and Ct_Temp->iso_sort_key_Hfixed separately */
 6544|     12|                    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (6544:33): [True: 10, False: 2]
  ------------------
 6545|     10|                    {
 6546|     10|                        Ct_Temp->iso_sort_key[nCanonRankFixH[i] - 1] = iso_sort_key_NoTautH[i];
 6547|       |
 6548|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6549|       |                        Ct_Temp->iso_sort_key_Hfixed[nCanonRankFixH[i] - 1] = iso_sort_key_Hfixed[i];
 6550|       |#endif
 6551|     10|                    }
 6552|      2|                    Ct_Temp->len_iso_sort_key = num_atoms;
 6553|       |
 6554|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6555|       |                    Ct_Temp->len_iso_sort_key_Hfixed = num_atoms;
 6556|       |#endif
 6557|       |
 6558|       |                    /*Ct_Temp->lenNumH = num_atoms;*/
 6559|      2|                }
 6560|      0|                else
 6561|      0|                {
 6562|      0|                    goto exit_error_alloc;
 6563|      0|                }
 6564|      2|                Ct_FixHIso = Ct_Temp;
 6565|      2|                Ct_Temp = NULL;
 6566|      2|                memcpy( nSymmRankFixHIso, nSymmRankFixH, num_atoms * sizeof( nSymmRankFixHIso[0] ) );
 6567|      2|                memcpy( nCanonRankFixHIso, nCanonRankFixH, num_atoms * sizeof( nCanonRankFixHIso[0] ) );
 6568|      2|                memcpy( nAtomNumberCanonFixHIso, nAtomNumberCanonFixH, num_atoms * sizeof( nAtomNumberCanonFixHIso[0] ) );
 6569|      2|            }
 6570|       |            /* in case of non-tautomeric component this is the final result */
 6571|       |            /* i = CtFullCompare( Ct_NoTautHIso, Ct_Temp, num_atoms, 0, 0 );*/
 6572|      2|        }
 6573|      3|    } /* "fixed H" canonical numbering */
 6574|       |
 6575|       |
 6576|       |    /* consistency check: compare canonical connection tables, H-atoms, isotopic H & taut groups */
 6577|   110k|    ret = 0;
 6578|   110k|    ret |= ( Ct_NoH->lenCt != Ct_NoTautH->lenCt ) || memcmp( Ct_NoH->Ctbl, Ct_NoTautH->Ctbl, Ct_NoH->lenCt * sizeof( Ct_NoH->Ctbl[0] ) );
  ------------------
  |  Branch (6578:12): [True: 0, False: 110k]
  |  Branch (6578:54): [True: 0, False: 110k]
  ------------------
 6579|   110k|    if (bReqTaut)
  ------------------
  |  Branch (6579:9): [True: 5, False: 110k]
  ------------------
 6580|      5|    {
 6581|      5|        if (Ct_FixH)
  ------------------
  |  Branch (6581:13): [True: 3, False: 2]
  ------------------
 6582|      3|        {
 6583|      3|            ret |= ( Ct_NoTautH->lenCt != Ct_FixH->lenCt ) || memcmp( Ct_NoTautH->Ctbl, Ct_FixH->Ctbl, Ct_NoTautH->lenCt * sizeof( Ct_NoTautH->Ctbl[0] ) );
  ------------------
  |  Branch (6583:20): [True: 0, False: 3]
  |  Branch (6583:63): [True: 0, False: 3]
  ------------------
 6584|      3|            ret |= ( Ct_NoTautH->lenNumH != Ct_FixH->lenNumH ) || memcmp( Ct_NoTautH->NumH, Ct_FixH->NumH, Ct_NoTautH->lenNumH * sizeof( Ct_Base->NumH[0] ) );
  ------------------
  |  Branch (6584:20): [True: 0, False: 3]
  |  Branch (6584:67): [True: 0, False: 3]
  ------------------
 6585|      3|        }
 6586|      5|        ret |= ( Ct_NoTautH->lenCt > Ct_Base->lenCt ) || memcmp( Ct_NoTautH->Ctbl, Ct_Base->Ctbl, Ct_NoTautH->lenCt * sizeof( Ct_NoTautH->Ctbl[0] ) );
  ------------------
  |  Branch (6586:16): [True: 0, False: 5]
  |  Branch (6586:58): [True: 0, False: 5]
  ------------------
 6587|      5|        ret |= ( Ct_NoTautH->lenNumH > Ct_Base->lenNumH ) || memcmp( Ct_NoTautH->NumH, Ct_Base->NumH, Ct_NoTautH->lenNumH * sizeof( Ct_Base->NumH[0] ) );
  ------------------
  |  Branch (6587:16): [True: 0, False: 5]
  |  Branch (6587:62): [True: 0, False: 5]
  ------------------
 6588|      5|    }
 6589|       |
 6590|       |    /* isotopic canonicalization */
 6591|   110k|    if (Ct_NoTautHIso)
  ------------------
  |  Branch (6591:9): [True: 43, False: 109k]
  ------------------
 6592|     43|    {
 6593|     43|        ret |= ( Ct_NoH->lenCt != Ct_NoTautHIso->lenCt ) || memcmp( Ct_NoH->Ctbl, Ct_NoTautHIso->Ctbl, Ct_NoH->lenCt * sizeof( Ct_NoH->Ctbl[0] ) );
  ------------------
  |  Branch (6593:16): [True: 0, False: 43]
  |  Branch (6593:61): [True: 0, False: 43]
  ------------------
 6594|     43|        ret |= ( Ct_NoTautH->lenNumH != Ct_NoTautHIso->lenNumH ) || memcmp( Ct_NoTautH->NumH, Ct_NoTautHIso->NumH, Ct_NoTautH->lenNumH * sizeof( Ct_Base->NumH[0] ) );
  ------------------
  |  Branch (6594:16): [True: 0, False: 43]
  |  Branch (6594:69): [True: 0, False: 43]
  ------------------
 6595|     43|    }
 6596|   109k|    else if (Ct_BaseIso)
  ------------------
  |  Branch (6596:14): [True: 2, False: 109k]
  ------------------
 6597|      2|    {
 6598|      2|        ret |= ( Ct_BaseIso->lenCt != Ct_Base->lenCt ) || memcmp( Ct_BaseIso->Ctbl, Ct_Base->Ctbl, Ct_BaseIso->lenCt * sizeof( Ct_BaseIso->Ctbl[0] ) );
  ------------------
  |  Branch (6598:16): [True: 0, False: 2]
  |  Branch (6598:59): [True: 0, False: 2]
  ------------------
 6599|      2|        ret |= ( Ct_BaseIso->lenNumH != Ct_Base->lenNumH ) || memcmp( Ct_BaseIso->NumH, Ct_Base->NumH, Ct_BaseIso->lenNumH * sizeof( Ct_BaseIso->NumH[0] ) );
  ------------------
  |  Branch (6599:16): [True: 0, False: 2]
  |  Branch (6599:63): [True: 0, False: 2]
  ------------------
 6600|      2|        if (Ct_FixHIso)
  ------------------
  |  Branch (6600:13): [True: 2, False: 0]
  ------------------
 6601|      2|        {
 6602|      2|            ret |= ( Ct_FixHIso->lenCt > Ct_BaseIso->lenCt ) || memcmp( Ct_FixHIso->Ctbl, Ct_BaseIso->Ctbl, Ct_FixHIso->lenCt * sizeof( Ct_FixHIso->Ctbl[0] ) );
  ------------------
  |  Branch (6602:20): [True: 0, False: 2]
  |  Branch (6602:65): [True: 0, False: 2]
  ------------------
 6603|      2|            ret |= ( Ct_FixHIso->lenNumH > Ct_BaseIso->lenNumH ) || memcmp( Ct_FixHIso->NumH, Ct_BaseIso->NumH, Ct_FixHIso->lenNumH * sizeof( Ct_BaseIso->NumH[0] ) );
  ------------------
  |  Branch (6603:20): [True: 0, False: 2]
  |  Branch (6603:69): [True: 0, False: 2]
  ------------------
 6604|      2|        }
 6605|      2|    }
 6606|       |
 6607|   110k|    if (ret)
  ------------------
  |  Branch (6607:9): [True: 0, False: 110k]
  ------------------
 6608|      0|    {
 6609|      0|        goto exit_error;
 6610|      0|    }
 6611|       |
 6612|   110k|    if (bReqTaut)
  ------------------
  |  Branch (6612:9): [True: 5, False: 110k]
  ------------------
 6613|      5|    {
 6614|       |        /* restore save "process isotopic" mark; temporarily set it to NO */
 6615|      5|        t_group_info->bIgnoreIsotopic = bTautIgnoreIsotopic;
 6616|      5|    }
 6617|       |
 6618|       |
 6619|       |    /* output the canonicalization results */
 6620|   110k|    pBCN->num_max = num_max;
 6621|   110k|    pBCN->num_at_tg = num_at_tg;
 6622|   110k|    pBCN->num_atoms = num_atoms;
 6623|       |
 6624|   110k|    pBCN->ftcn[TAUT_NON].NeighList = NeighList[TAUT_NON]; NeighList[TAUT_NON] = NULL;
  ------------------
  |  |  579|   110k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                  pBCN->ftcn[TAUT_NON].NeighList = NeighList[TAUT_NON]; NeighList[TAUT_NON] = NULL;
  ------------------
  |  |  579|   110k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                  pBCN->ftcn[TAUT_NON].NeighList = NeighList[TAUT_NON]; NeighList[TAUT_NON] = NULL;
  ------------------
  |  |  579|   110k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 6625|   110k|    pBCN->ftcn[TAUT_YES].NeighList = NeighList[TAUT_YES]; NeighList[TAUT_YES] = NULL;
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  pBCN->ftcn[TAUT_YES].NeighList = NeighList[TAUT_YES]; NeighList[TAUT_YES] = NULL;
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  pBCN->ftcn[TAUT_YES].NeighList = NeighList[TAUT_YES]; NeighList[TAUT_YES] = NULL;
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6626|       |
 6627|   110k|    if (bReqTaut)
  ------------------
  |  Branch (6627:9): [True: 5, False: 110k]
  ------------------
 6628|      5|    {
 6629|       |        /* tautomeric results */
 6630|       |
 6631|       |        /* base tautomeric structure, iBase = TAUT_YES */
 6632|       |
 6633|      5|        pBCN->ftcn[TAUT_YES].num_at_tg = num_at_tg;
  ------------------
  |  |  580|      5|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6634|      5|        pBCN->ftcn[TAUT_YES].num_atoms = num_atoms;
  ------------------
  |  |  580|      5|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6635|       |
 6636|      5|        pBCN->ftcn[TAUT_YES].LinearCt = Ct_Base->Ctbl;            Ct_Base->Ctbl = NULL;
  ------------------
  |  |  580|      5|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6637|      5|        pBCN->ftcn[TAUT_YES].nLenLinearCtAtOnly = s[iBase].nLenCTAtOnly;
  ------------------
  |  |  580|      5|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6638|      5|        pBCN->ftcn[TAUT_YES].nMaxLenLinearCt = s[iBase].nLenCT + 1;
  ------------------
  |  |  580|      5|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6639|      5|        pBCN->ftcn[TAUT_YES].nLenLinearCt = s[iBase].nLenCT;
  ------------------
  |  |  580|      5|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6640|       |
 6641|      5|        pBCN->ftcn[TAUT_YES].PartitionCt.Rank = nCanonRankBase;        nCanonRankBase = NULL;
  ------------------
  |  |  580|      5|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6642|      5|        pBCN->ftcn[TAUT_YES].PartitionCt.AtNumber = nAtomNumberCanonBase;  nAtomNumberCanonBase = NULL;
  ------------------
  |  |  580|      5|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6643|      5|        pBCN->ftcn[TAUT_YES].nSymmRankCt = nSymmRankBase;         nSymmRankBase = NULL;
  ------------------
  |  |  580|      5|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6644|       |
 6645|      5|        pBCN->ftcn[TAUT_YES].nNumHOrig = numH;                 numH = NULL;
  ------------------
  |  |  580|      5|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6646|      5|        pBCN->ftcn[TAUT_YES].nNumH = Ct_Base->NumH;        Ct_Base->NumH = NULL;
  ------------------
  |  |  580|      5|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6647|      5|        pBCN->ftcn[TAUT_YES].nLenNumH = inchi_min( maxlenNumH, Ct_Base->maxlenNumH );
  ------------------
  |  |  580|      5|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                      pBCN->ftcn[TAUT_YES].nLenNumH = inchi_min( maxlenNumH, Ct_Base->maxlenNumH );
  ------------------
  |  |  167|      5|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 5, False: 0]
  |  |  ------------------
  ------------------
 6648|       |
 6649|       |        /* fixed H structure: exists only if the structure is tautomeric */
 6650|      5|        pBCN->ftcn[TAUT_YES].nNumHOrigFixH = NULL;
  ------------------
  |  |  580|      5|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6651|      5|        pBCN->ftcn[TAUT_YES].nNumHFixH = NULL;
  ------------------
  |  |  580|      5|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6652|      5|        pBCN->ftcn[TAUT_YES].nLenNumHFixH = 0;
  ------------------
  |  |  580|      5|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6653|      5|        pBCN->ftcn[TAUT_YES].nCanonFlags |= pCD[iBase].nCanonFlags;
  ------------------
  |  |  580|      5|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6654|       |
 6655|      5|        CleanNumH( pBCN->ftcn[TAUT_YES].nNumHOrig, pBCN->ftcn[TAUT_YES].nLenNumH );
  ------------------
  |  |  580|      5|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                      CleanNumH( pBCN->ftcn[TAUT_YES].nNumHOrig, pBCN->ftcn[TAUT_YES].nLenNumH );
  ------------------
  |  |  580|      5|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6656|      5|        CleanNumH( pBCN->ftcn[TAUT_YES].nNumH, pBCN->ftcn[TAUT_YES].nLenNumH );
  ------------------
  |  |  580|      5|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                      CleanNumH( pBCN->ftcn[TAUT_YES].nNumH, pBCN->ftcn[TAUT_YES].nLenNumH );
  ------------------
  |  |  580|      5|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6657|      5|        CleanCt( pBCN->ftcn[TAUT_YES].LinearCt, pBCN->ftcn[TAUT_YES].nLenLinearCt );
  ------------------
  |  |  580|      5|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                      CleanCt( pBCN->ftcn[TAUT_YES].LinearCt, pBCN->ftcn[TAUT_YES].nLenLinearCt );
  ------------------
  |  |  580|      5|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6658|       |
 6659|       |        /* isotopic canonicalization */
 6660|      5|        if (Ct_BaseIso)
  ------------------
  |  Branch (6660:13): [True: 2, False: 3]
  ------------------
 6661|      2|        {
 6662|      2|            pBCN->ftcn[TAUT_YES].PartitionCtIso.Rank = nCanonRankBaseIso;           nCanonRankBaseIso = NULL;
  ------------------
  |  |  580|      2|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6663|      2|            pBCN->ftcn[TAUT_YES].PartitionCtIso.AtNumber = nAtomNumberCanonBaseIso;     nAtomNumberCanonBaseIso = NULL;
  ------------------
  |  |  580|      2|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6664|      2|            pBCN->ftcn[TAUT_YES].nSymmRankCtIso = nSymmRankBaseIso;            nSymmRankBaseIso = NULL;
  ------------------
  |  |  580|      2|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6665|      2|            pBCN->ftcn[TAUT_YES].iso_sort_keys = Ct_BaseIso->iso_sort_key;    Ct_BaseIso->iso_sort_key = NULL;
  ------------------
  |  |  580|      2|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6666|      2|            pBCN->ftcn[TAUT_YES].iso_sort_keysOrig = iso_sort_keyBase;            iso_sort_keyBase = NULL;
  ------------------
  |  |  580|      2|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6667|      2|            pBCN->ftcn[TAUT_YES].len_iso_sort_keys = len_iso_sort_keyBase;
  ------------------
  |  |  580|      2|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6668|      2|            pBCN->ftcn[TAUT_YES].iso_exchg_atnos = Ct_BaseIso->iso_exchg_atnos; Ct_BaseIso->iso_exchg_atnos = NULL;
  ------------------
  |  |  580|      2|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6669|      2|            pBCN->ftcn[TAUT_YES].iso_exchg_atnosOrig = iso_exchg_atnos;             iso_exchg_atnos = NULL;
  ------------------
  |  |  580|      2|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6670|       |
 6671|      2|            CleanIsoSortKeys( pBCN->ftcn[TAUT_YES].iso_sort_keys, pBCN->ftcn[TAUT_YES].len_iso_sort_keys );
  ------------------
  |  |  580|      2|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                          CleanIsoSortKeys( pBCN->ftcn[TAUT_YES].iso_sort_keys, pBCN->ftcn[TAUT_YES].len_iso_sort_keys );
  ------------------
  |  |  580|      2|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6672|      2|            CleanIsoSortKeys( pBCN->ftcn[TAUT_YES].iso_sort_keysOrig, pBCN->ftcn[TAUT_YES].len_iso_sort_keys );
  ------------------
  |  |  580|      2|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                          CleanIsoSortKeys( pBCN->ftcn[TAUT_YES].iso_sort_keysOrig, pBCN->ftcn[TAUT_YES].len_iso_sort_keys );
  ------------------
  |  |  580|      2|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6673|      2|        }
 6674|      5|    } /* tautomeric results */
 6675|       |
 6676|       |
 6677|   110k|    if (bReqNonTaut)
  ------------------
  |  Branch (6677:9): [True: 110k, False: 2]
  ------------------
 6678|   110k|    {
 6679|       |        /* non-tautomeric results */
 6680|       |
 6681|       |        /* TAUT_NON if tautomeric + non-tautomeric or special non-taut request
 6682|       |           TAUT_YES if the structure happened to be non-tautomeric while user requested tautomeric processing
 6683|       |           In both cases the correct index is iOther. TAUT_NON replaced with iOther 4-2-2004 */
 6684|       |
 6685|   110k|        if (!bReqTaut)
  ------------------
  |  Branch (6685:13): [True: 110k, False: 3]
  ------------------
 6686|   110k|        {
 6687|       |            /* rearrange the results for a non-tautomeric structure */
 6688|   110k|            nSymmRankFixH = nSymmRankNoTautH;           nSymmRankNoTautH = NULL;
 6689|   110k|            nCanonRankFixH = nCanonRankNoTautH;          nCanonRankNoTautH = NULL;
 6690|   110k|            nAtomNumberCanonFixH = nAtomNumberCanonNoTautH;    nAtomNumberCanonNoTautH = NULL;
 6691|   110k|            Ct_FixH = Ct_NoTautH;                 Ct_NoTautH = NULL;
 6692|       |            /* isotopic canonicalization */
 6693|   110k|            nSymmRankFixHIso = nSymmRankNoTautHIso;        nSymmRankNoTautHIso = NULL;
 6694|   110k|            nCanonRankFixHIso = nCanonRankNoTautHIso;       nCanonRankNoTautHIso = NULL;
 6695|   110k|            nAtomNumberCanonFixHIso = nAtomNumberCanonNoTautHIso; nAtomNumberCanonNoTautHIso = NULL;
 6696|   110k|            Ct_FixHIso = Ct_NoTautHIso;              Ct_NoTautHIso = NULL;
 6697|       |
 6698|   110k|            if (iOther == TAUT_YES && pBCN->ftcn[TAUT_NON].NeighList && !pBCN->ftcn[TAUT_YES].NeighList)
  ------------------
  |  |  580|   220k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                          if (iOther == TAUT_YES && pBCN->ftcn[TAUT_NON].NeighList && !pBCN->ftcn[TAUT_YES].NeighList)
  ------------------
  |  |  579|   110k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                          if (iOther == TAUT_YES && pBCN->ftcn[TAUT_NON].NeighList && !pBCN->ftcn[TAUT_YES].NeighList)
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (6698:17): [True: 110k, False: 0]
  |  Branch (6698:39): [True: 110k, False: 0]
  |  Branch (6698:73): [True: 110k, False: 0]
  ------------------
 6699|   110k|            {
 6700|       |                /* here only non-taut results go to pBCN->ftcn[TAUT_YES]
 6701|       |                   Since non-taut NeighList is always in pBCN->ftcn[TAUT_NON].NeighList, move it to
 6702|       |                   pBCN->ftcn[TAUT_YES].NeighList. 2004-04-02.
 6703|       |                */
 6704|   110k|                pBCN->ftcn[TAUT_YES].NeighList = pBCN->ftcn[TAUT_NON].NeighList;
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                              pBCN->ftcn[TAUT_YES].NeighList = pBCN->ftcn[TAUT_NON].NeighList;
  ------------------
  |  |  579|   110k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 6705|   110k|                pBCN->ftcn[TAUT_NON].NeighList = NULL;
  ------------------
  |  |  579|   110k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 6706|   110k|            }
 6707|   110k|        }
 6708|       |
 6709|   110k|        pBCN->ftcn[iOther].num_at_tg = num_atoms;
 6710|   110k|        pBCN->ftcn[iOther].num_atoms = num_atoms;
 6711|       |
 6712|   110k|        pBCN->ftcn[iOther].LinearCt = Ct_FixH->Ctbl;
 6713|   110k|        Ct_FixH->Ctbl = NULL;
 6714|   110k|        pBCN->ftcn[iOther].nLenLinearCtAtOnly = s[iOther].nLenCTAtOnly;
 6715|   110k|        pBCN->ftcn[iOther].nMaxLenLinearCt = s[iOther].nLenCTAtOnly + 1;
 6716|   110k|        pBCN->ftcn[iOther].nLenLinearCt = s[iOther].nLenCTAtOnly;
 6717|       |
 6718|   110k|        pBCN->ftcn[iOther].PartitionCt.Rank = nCanonRankFixH;
 6719|   110k|        nCanonRankFixH = NULL;
 6720|   110k|        pBCN->ftcn[iOther].PartitionCt.AtNumber = nAtomNumberCanonFixH;
 6721|   110k|        nAtomNumberCanonFixH = NULL;
 6722|   110k|        pBCN->ftcn[iOther].nSymmRankCt = nSymmRankFixH;
 6723|   110k|        nSymmRankFixH = NULL;
 6724|       |
 6725|   110k|        pBCN->ftcn[iOther].nNumHOrig = numHNoTautH;
 6726|   110k|        numHNoTautH = NULL;
 6727|   110k|        pBCN->ftcn[iOther].nNumH = Ct_FixH->NumH;
 6728|   110k|        Ct_FixH->NumH = NULL;
 6729|   110k|        pBCN->ftcn[iOther].nLenNumH = inchi_min( maxlenNumHNoTautH, Ct_FixH->maxlenNumH );
  ------------------
  |  |  167|   110k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 110k, False: 0]
  |  |  ------------------
  ------------------
 6730|       |
 6731|       |        /* fixed H structure: exists only if the structure is tautomeric */
 6732|   110k|        pBCN->ftcn[iOther].nNumHOrigFixH = NumHfixed;
 6733|   110k|        NumHfixed = NULL;
 6734|   110k|        pBCN->ftcn[iOther].nNumHFixH = Ct_FixH->NumHfixed;
 6735|   110k|        Ct_FixH->NumHfixed = NULL;
 6736|   110k|        pBCN->ftcn[iOther].nLenNumHFixH = num_atoms;
 6737|   110k|        pBCN->ftcn[iOther].nCanonFlags |= pCD[iOther].nCanonFlags;
 6738|       |
 6739|       |        /* original H */
 6740|   110k|        CleanNumH( pBCN->ftcn[iOther].nNumHOrig, pBCN->ftcn[iOther].nLenNumH );
 6741|   110k|        CleanNumH( pBCN->ftcn[iOther].nNumHOrigFixH, pBCN->ftcn[iOther].nLenNumH );
 6742|       |        /* canonical H positions */
 6743|   110k|        CleanNumH( pBCN->ftcn[iOther].nNumH, pBCN->ftcn[iOther].nLenNumH );
 6744|   110k|        CleanNumH( pBCN->ftcn[iOther].nNumHFixH, pBCN->ftcn[iOther].nLenNumH );
 6745|       |
 6746|       |        /* connection table */
 6747|   110k|        CleanCt( pBCN->ftcn[iOther].LinearCt, pBCN->ftcn[iOther].nLenLinearCt );
 6748|       |
 6749|       |       /* isotopic canonicalization */
 6750|   110k|        if (Ct_FixHIso)
  ------------------
  |  Branch (6750:13): [True: 45, False: 109k]
  ------------------
 6751|     45|        {
 6752|     45|            pBCN->ftcn[iOther].PartitionCtIso.Rank = nCanonRankFixHIso;        nCanonRankFixHIso = NULL;
 6753|     45|            pBCN->ftcn[iOther].PartitionCtIso.AtNumber = nAtomNumberCanonFixHIso;  nAtomNumberCanonFixHIso = NULL;
 6754|     45|            pBCN->ftcn[iOther].nSymmRankCtIso = nSymmRankFixHIso;         nSymmRankFixHIso = NULL;
 6755|     45|            pBCN->ftcn[iOther].iso_sort_keys = Ct_FixHIso->iso_sort_key; Ct_FixHIso->iso_sort_key = NULL;
 6756|     45|            pBCN->ftcn[iOther].iso_sort_keysOrig = iso_sort_key_NoTautH;     iso_sort_key_NoTautH = NULL;
 6757|     45|            pBCN->ftcn[iOther].len_iso_sort_keys = len_iso_sort_key_NoTautH;
 6758|       |
 6759|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6760|       |            MergeCleanIsoSortKeys( pBCN->ftcn[iOther].iso_sort_keys, Ct_FixHIso->iso_sort_key_Hfixed, pBCN->ftcn[iOther].len_iso_sort_keys );
 6761|       |            MergeCleanIsoSortKeys( pBCN->ftcn[iOther].iso_sort_keysOrig, iso_sort_key_Hfixed, pBCN->ftcn[iOther].len_iso_sort_keys );
 6762|       |#else
 6763|     45|            CleanIsoSortKeys( pBCN->ftcn[iOther].iso_sort_keys, pBCN->ftcn[iOther].len_iso_sort_keys );
 6764|     45|            CleanIsoSortKeys( pBCN->ftcn[iOther].iso_sort_keysOrig, pBCN->ftcn[iOther].len_iso_sort_keys );
 6765|     45|#endif
 6766|     45|        }
 6767|   110k|    }  /* non-tautomeric results */
 6768|       |
 6769|   110k|    goto exit_function;
 6770|       |
 6771|       |
 6772|      0|exit_error_alloc:
 6773|      0|    ret = CT_OUT_OF_RAM;
  ------------------
  |  |   49|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 6774|      0|    goto exit_function;
 6775|       |
 6776|      0|exit_error:
 6777|      0|    if (!RETURNED_ERROR( ret ))
  ------------------
  |  |   72|      0|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   68|      0|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   66|      0|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   69|      0|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (72:31): [True: 0, False: 0]
  |  |  |  Branch (72:53): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 6778|      0|    {
 6779|      0|        ret = CT_CANON_ERR;
  ------------------
  |  |   63|      0|#define CT_CANON_ERR         (CT_ERR_FIRST-16)  /*(-30016) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 6780|      0|    }
 6781|      0|    goto exit_function;
 6782|       |
 6783|       |
 6784|   110k|exit_function:
 6785|       |
 6786|   110k|#define FREE_CONTABLE( X) if (X) {CTableFree( X);inchi_free( X);}
 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
 6788|       |
 6789|   110k|    FreeNeighList( NeighList[TAUT_NON] );
  ------------------
  |  |  579|   110k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 6790|   110k|    FreeNeighList( NeighList[TAUT_YES] );
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6791|       |
 6792|   110k|    FREE_CONTABLE( Ct_NoH )
  ------------------
  |  | 6786|   110k|#define FREE_CONTABLE( X) if (X) {CTableFree( X);inchi_free( X);}
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6786:31): [True: 110k, False: 0]
  |  |  ------------------
  ------------------
 6793|   110k|        FREE_CONTABLE( Ct_NoTautH )
  ------------------
  |  | 6786|   110k|#define FREE_CONTABLE( X) if (X) {CTableFree( X);inchi_free( X);}
  |  |  ------------------
  |  |  |  | 1136|      5|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 5, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6786:31): [True: 5, False: 110k]
  |  |  ------------------
  ------------------
 6794|   110k|        FREE_CONTABLE( Ct_Base )
  ------------------
  |  | 6786|   110k|#define FREE_CONTABLE( X) if (X) {CTableFree( X);inchi_free( X);}
  |  |  ------------------
  |  |  |  | 1136|      5|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 5, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6786:31): [True: 5, False: 110k]
  |  |  ------------------
  ------------------
 6795|   110k|        FREE_CONTABLE( Ct_FixH )
  ------------------
  |  | 6786|   110k|#define FREE_CONTABLE( X) if (X) {CTableFree( X);inchi_free( X);}
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6786:31): [True: 110k, False: 2]
  |  |  ------------------
  ------------------
 6796|   110k|        FREE_CONTABLE( Ct_Temp )
  ------------------
  |  | 6786|   110k|#define FREE_CONTABLE( X) if (X) {CTableFree( X);inchi_free( X);}
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6786:31): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
 6797|       |        /* isotopic canonicalization */
 6798|   110k|        FREE_CONTABLE( Ct_NoTautHIso )
  ------------------
  |  | 6786|   110k|#define FREE_CONTABLE( X) if (X) {CTableFree( X);inchi_free( X);}
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6786:31): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
 6799|   110k|        FREE_CONTABLE( Ct_BaseIso )
  ------------------
  |  | 6786|   110k|#define FREE_CONTABLE( X) if (X) {CTableFree( X);inchi_free( X);}
  |  |  ------------------
  |  |  |  | 1136|      2|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 2, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6786:31): [True: 2, False: 110k]
  |  |  ------------------
  ------------------
 6800|   110k|        FREE_CONTABLE( Ct_FixHIso )
  ------------------
  |  | 6786|   110k|#define FREE_CONTABLE( X) if (X) {CTableFree( X);inchi_free( X);}
  |  |  ------------------
  |  |  |  | 1136|     45|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 45, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6786:31): [True: 45, False: 109k]
  |  |  ------------------
  ------------------
 6801|       |
 6802|       |        /* free the first two pointers from pBCN->pRankStack */
 6803|   110k|        FREE_ARRAY( nRank )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 110k, False: 0]
  |  |  ------------------
  ------------------
 6804|   110k|        FREE_ARRAY( nAtomNumber )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 110k, False: 0]
  |  |  ------------------
  ------------------
 6805|       |
 6806|   110k|        if (pBCN->pRankStack)
  ------------------
  |  Branch (6806:13): [True: 110k, False: 0]
  ------------------
 6807|   110k|        {
 6808|   110k|            pBCN->pRankStack[0] =
 6809|   110k|                pBCN->pRankStack[1] = NULL;
 6810|   110k|        }
 6811|       |
 6812|   110k|#if ( USE_AUX_RANKING == 1 )
 6813|   110k|    FREE_ARRAY( nRankAux )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 110k, False: 0]
  |  |  ------------------
  ------------------
 6814|   110k|        FREE_ARRAY( nAtomNumberAux )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 110k, False: 0]
  |  |  ------------------
  ------------------
 6815|   110k|        FREE_ARRAY( pAtomInvariantAux )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 110k, False: 0]
  |  |  ------------------
  ------------------
 6816|   110k|#endif
 6817|       |
 6818|   110k|        FREE_ARRAY( pAtomInvariant )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 110k, False: 0]
  |  |  ------------------
  ------------------
 6819|       |
 6820|   110k|        FREE_ARRAY( nCanonRankNoH )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 110k, False: 0]
  |  |  ------------------
  ------------------
 6821|   110k|        FREE_ARRAY( nAtomNumberCanonNoH )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 110k, False: 0]
  |  |  ------------------
  ------------------
 6822|   110k|        FREE_ARRAY( nSymmRankNoH )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 110k, False: 0]
  |  |  ------------------
  ------------------
 6823|       |
 6824|   110k|        FREE_ARRAY( nSymmRankNoTautH )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|      5|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 5, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 5, False: 110k]
  |  |  ------------------
  ------------------
 6825|   110k|        FREE_ARRAY( nCanonRankNoTautH )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|      5|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 5, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 5, False: 110k]
  |  |  ------------------
  ------------------
 6826|   110k|        FREE_ARRAY( nAtomNumberCanonNoTautH )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|      5|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 5, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 5, False: 110k]
  |  |  ------------------
  ------------------
 6827|   110k|        FREE_ARRAY( numHNoTautH )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|      2|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 2, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 2, False: 110k]
  |  |  ------------------
  ------------------
 6828|       |
 6829|   110k|        FREE_ARRAY( nSymmRankBase )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
 6830|   110k|        FREE_ARRAY( nCanonRankBase )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
 6831|   110k|        FREE_ARRAY( nAtomNumberCanonBase )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
 6832|   110k|        FREE_ARRAY( numH )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
 6833|       |
 6834|   110k|        FREE_ARRAY( nSymmRankFixH )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
 6835|   110k|        FREE_ARRAY( nCanonRankFixH )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
 6836|   110k|        FREE_ARRAY( nAtomNumberCanonFixH )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
 6837|   110k|        FREE_ARRAY( NumHfixed )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
 6838|       |
 6839|       |        /* isotopic canonicalization */
 6840|       |
 6841|   110k|        FREE_ARRAY( nSymmRankNoTautHIso )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
 6842|   110k|        FREE_ARRAY( nCanonRankNoTautHIso )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
 6843|   110k|        FREE_ARRAY( nAtomNumberCanonNoTautHIso )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
 6844|   110k|        FREE_ARRAY( iso_sort_key_NoTautH )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
 6845|       |
 6846|   110k|        FREE_ARRAY( nSymmRankBaseIso )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
 6847|   110k|        FREE_ARRAY( nCanonRankBaseIso )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
 6848|   110k|        FREE_ARRAY( nAtomNumberCanonBaseIso )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
 6849|   110k|        FREE_ARRAY( iso_sort_keyBase )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
 6850|   110k|        FREE_ARRAY( iso_exchg_atnos )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
 6851|       |
 6852|   110k|        FREE_ARRAY( nSymmRankFixHIso )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
 6853|   110k|        FREE_ARRAY( nCanonRankFixHIso )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
 6854|   110k|        FREE_ARRAY( nAtomNumberCanonFixHIso )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
 6855|       |
 6856|       |#if ( USE_ISO_SORT_KEY_HFIXED == 1 )
 6857|       |        FREE_ARRAY( iso_sort_key_Hfixed )
 6858|       |#endif
 6859|       |
 6860|   110k|        FREE_ARRAY( nTempRank )
  ------------------
  |  | 6787|   110k|#define FREE_ARRAY( X) if (X) inchi_free( X);
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (6787:28): [True: 110k, False: 0]
  |  |  ------------------
  ------------------
 6861|       |
 6862|   110k|#undef FREE_CONTABLE
 6863|   110k|#undef FREE_ARRAY
 6864|       |
 6865|   110k|        return ret;
 6866|   110k|}

InchiTimeGet:
  140|   659k|{
  141|   659k|    TickEnd->clockTime = InchiClock( );
  142|   659k|}
InchiTimeMsecDiff:
  145|   329k|{
  146|   329k|    if (FullMaxClock > 0)
  ------------------
  |  Branch (146:9): [Folded - Ignored]
  ------------------
  147|      0|    {
  148|      0|        clock_t delta;
  149|      0|        if (!TickEnd || !TickStart)
  ------------------
  |  Branch (149:13): [True: 0, False: 0]
  |  Branch (149:25): [True: 0, False: 0]
  ------------------
  150|      0|            return 0;
  151|       |        /* clock_t is unsigned */
  152|      0|        if (TickEnd->clockTime > TickStart->clockTime)
  ------------------
  |  Branch (152:13): [True: 0, False: 0]
  ------------------
  153|      0|        {
  154|      0|            if (TickEnd->clockTime > HalfMaxClock &&
  ------------------
  |  Branch (154:17): [True: 0, False: 0]
  ------------------
  155|      0|                 TickEnd->clockTime - TickStart->clockTime > HalfMaxClock)
  ------------------
  |  Branch (155:18): [True: 0, False: 0]
  ------------------
  156|      0|            {
  157|       |                /* overflow in TickStart->clockTime, actually TickStart->clockTime was later */
  158|      0|                delta = ( FullMaxClock - TickEnd->clockTime ) + TickStart->clockTime;
  159|      0|                return -INCHI_MSEC( delta );
  ------------------
  |  |  115|      0|#define INCHI_MSEC(X)    (long)((1000.0/(double)CLOCKS_PER_SEC)*(X))
  ------------------
  160|      0|            }
  161|      0|            delta = TickEnd->clockTime - TickStart->clockTime;
  162|      0|            return INCHI_MSEC( delta );
  ------------------
  |  |  115|      0|#define INCHI_MSEC(X)    (long)((1000.0/(double)CLOCKS_PER_SEC)*(X))
  ------------------
  163|      0|        }
  164|      0|        else if (TickEnd->clockTime < TickStart->clockTime)
  ------------------
  |  Branch (164:18): [True: 0, False: 0]
  ------------------
  165|      0|        {
  166|      0|            if (TickStart->clockTime > HalfMaxClock &&
  ------------------
  |  Branch (166:17): [True: 0, False: 0]
  ------------------
  167|      0|                 TickStart->clockTime - TickEnd->clockTime > HalfMaxClock)
  ------------------
  |  Branch (167:18): [True: 0, False: 0]
  ------------------
  168|      0|            {
  169|       |                /* overflow in TickEnd->clockTime, actually TickEnd->clockTime was later */
  170|      0|                delta = ( FullMaxClock - TickStart->clockTime ) + TickEnd->clockTime;
  171|      0|                return INCHI_MSEC( delta );
  ------------------
  |  |  115|      0|#define INCHI_MSEC(X)    (long)((1000.0/(double)CLOCKS_PER_SEC)*(X))
  ------------------
  172|      0|            }
  173|      0|            delta = TickStart->clockTime - TickEnd->clockTime;
  174|      0|            return -INCHI_MSEC( delta );
  ------------------
  |  |  115|      0|#define INCHI_MSEC(X)    (long)((1000.0/(double)CLOCKS_PER_SEC)*(X))
  ------------------
  175|      0|        }
  176|      0|        return 0; /* TickEnd->clockTime == TickStart->clockTime */
  177|      0|    }
  178|   329k|    else
  179|   329k|    {
  180|       |        /* may happen under Win32 only where clock_t is SIGNED long */
  181|   329k|        clock_t delta;
  182|   329k|        FillMaxMinClock( ic );
  183|   329k|        if (!TickEnd || !TickStart)
  ------------------
  |  Branch (183:13): [True: 0, False: 329k]
  |  Branch (183:25): [True: 0, False: 329k]
  ------------------
  184|      0|            return 0;
  185|   329k|        if (TickEnd->clockTime >= 0 && TickStart->clockTime >= 0 ||
  ------------------
  |  Branch (185:13): [True: 329k, False: 0]
  |  Branch (185:40): [True: 329k, False: 0]
  ------------------
  186|   329k|             TickEnd->clockTime <= 0 && TickStart->clockTime <= 0)
  ------------------
  |  Branch (186:14): [True: 0, False: 0]
  |  Branch (186:41): [True: 0, False: 0]
  ------------------
  187|   329k|        {
  188|   329k|            delta = TickEnd->clockTime - TickStart->clockTime;
  189|   329k|        }
  190|      0|        else
  191|      0|            if (TickEnd->clockTime >= ic->m_HalfMaxPositiveClock &&
  ------------------
  |  Branch (191:17): [True: 0, False: 0]
  ------------------
  192|      0|                 TickStart->clockTime <= ic->m_HalfMinNegativeClock)
  ------------------
  |  Branch (192:18): [True: 0, False: 0]
  ------------------
  193|      0|            {
  194|       |/* end is earlier than start */
  195|      0|                delta = ( ic->m_MaxPositiveClock - TickEnd->clockTime ) + ( TickStart->clockTime - ic->m_MinNegativeClock );
  196|      0|                delta = -delta;
  197|      0|            }
  198|      0|            else
  199|      0|                if (TickEnd->clockTime <= ic->m_HalfMinNegativeClock &&
  ------------------
  |  Branch (199:21): [True: 0, False: 0]
  ------------------
  200|      0|                     TickStart->clockTime >= ic->m_HalfMaxPositiveClock)
  ------------------
  |  Branch (200:22): [True: 0, False: 0]
  ------------------
  201|      0|                {
  202|       |/* start was earlier than end */
  203|      0|                    delta = ( ic->m_MaxPositiveClock - TickStart->clockTime ) + ( TickEnd->clockTime - ic->m_MinNegativeClock );
  204|      0|                }
  205|      0|                else
  206|      0|                {
  207|       |                     /* there was no overflow, clock passed zero */
  208|      0|                    delta = TickEnd->clockTime - TickStart->clockTime;
  209|      0|                }
  210|   329k|        return INCHI_MSEC( delta );
  ------------------
  |  |  115|   329k|#define INCHI_MSEC(X)    (long)((1000.0/(double)CLOCKS_PER_SEC)*(X))
  ------------------
  211|   329k|    }
  212|   329k|}
InchiTimeElapsed:
  217|   219k|{
  218|   219k|    inchiTime TickEnd;
  219|   219k|    if (!TickStart)
  ------------------
  |  Branch (219:9): [True: 0, False: 219k]
  ------------------
  220|      0|        return 0;
  221|   219k|    InchiTimeGet( &TickEnd );
  222|   219k|    return InchiTimeMsecDiff( ic, &TickEnd, TickStart );
  223|   219k|}
bInchiTimeIsOver:
  251|   117k|{
  252|   117k|    if (FullMaxClock > 0)
  ------------------
  |  Branch (252:9): [Folded - Ignored]
  ------------------
  253|      0|    {
  254|      0|        clock_t clockCurrTime;
  255|      0|        if (!TickStart)
  ------------------
  |  Branch (255:13): [True: 0, False: 0]
  ------------------
  256|      0|            return 0;
  257|      0|        clockCurrTime = InchiClock( );
  258|       |        /* clock_t is unsigned */
  259|      0|        if (TickStart->clockTime > clockCurrTime)
  ------------------
  |  Branch (259:13): [True: 0, False: 0]
  ------------------
  260|      0|        {
  261|      0|            if (TickStart->clockTime > HalfMaxClock &&
  ------------------
  |  Branch (261:17): [True: 0, False: 0]
  ------------------
  262|      0|                 TickStart->clockTime - clockCurrTime > HalfMaxClock)
  ------------------
  |  Branch (262:18): [True: 0, False: 0]
  ------------------
  263|      0|            {
  264|       |                /* overflow in clockCurrTime, actually clockCurrTime was later */
  265|      0|                return 1;
  266|      0|            }
  267|      0|            return 0;
  268|      0|        }
  269|      0|        else if (TickStart->clockTime < clockCurrTime)
  ------------------
  |  Branch (269:18): [True: 0, False: 0]
  ------------------
  270|      0|        {
  271|      0|            if (clockCurrTime > HalfMaxClock &&
  ------------------
  |  Branch (271:17): [True: 0, False: 0]
  ------------------
  272|      0|                 clockCurrTime - TickStart->clockTime > HalfMaxClock)
  ------------------
  |  Branch (272:18): [True: 0, False: 0]
  ------------------
  273|      0|            {
  274|       |                /* overflow in TickStart->clockTime, actually TickStart->clockTime was later */
  275|      0|                return 0;
  276|      0|            }
  277|      0|            return 1;
  278|      0|        }
  279|      0|        return 0; /* TickStart->clockTime == clockCurrTime */
  280|      0|    }
  281|   117k|    else
  282|   117k|    {
  283|       |        /* may happen under Win32 only where clock_t is SIGNED long */
  284|   117k|        clock_t clockCurrTime;
  285|   117k|        FillMaxMinClock( ic );
  286|   117k|        if (!TickStart)
  ------------------
  |  Branch (286:13): [True: 117k, False: 0]
  ------------------
  287|   117k|            return 0;
  288|      0|        clockCurrTime = InchiClock( );
  289|      0|        if (clockCurrTime >= 0 && TickStart->clockTime >= 0 ||
  ------------------
  |  Branch (289:13): [True: 0, False: 0]
  |  Branch (289:35): [True: 0, False: 0]
  ------------------
  290|      0|             clockCurrTime <= 0 && TickStart->clockTime <= 0)
  ------------------
  |  Branch (290:14): [True: 0, False: 0]
  |  Branch (290:36): [True: 0, False: 0]
  ------------------
  291|      0|        {
  292|      0|            return ( clockCurrTime > TickStart->clockTime );
  293|      0|        }
  294|      0|        else
  295|      0|            if (clockCurrTime >= ic->m_HalfMaxPositiveClock &&
  ------------------
  |  Branch (295:17): [True: 0, False: 0]
  ------------------
  296|      0|                 TickStart->clockTime <= ic->m_HalfMinNegativeClock)
  ------------------
  |  Branch (296:18): [True: 0, False: 0]
  ------------------
  297|      0|            {
  298|       |/* curr is earlier than start */
  299|      0|                return 0;
  300|      0|            }
  301|      0|            else
  302|      0|                if (clockCurrTime <= ic->m_HalfMinNegativeClock &&
  ------------------
  |  Branch (302:21): [True: 0, False: 0]
  ------------------
  303|      0|                     TickStart->clockTime >= ic->m_HalfMaxPositiveClock)
  ------------------
  |  Branch (303:22): [True: 0, False: 0]
  ------------------
  304|      0|                {
  305|       |/* start was earlier than curr */
  306|      0|                    return 1;
  307|      0|                }
  308|      0|                else
  309|      0|                {
  310|       |                     /* there was no overflow, clock passed zero */
  311|      0|                    return ( clockCurrTime > TickStart->clockTime );
  312|      0|                }
  313|      0|    }
  314|   117k|}
GetCanonLengths:
  415|   110k|{
  416|       |    /* include taut. groups as additional "atoms" to the connection table 07-22-2002 */
  417|       |
  418|   110k|    int  i, nNumCT, nNumBonds, nNumTBonds = 0, nNumDblBondsStereo = 0, nNumAsymCarbStereo = 0, nNumIsotopic = 0;
  419|   110k|    T_GROUP *t_group = ( s->nLenLinearCTTautomer && t_group_info ) ? t_group_info->t_group : NULL;
  ------------------
  |  Branch (419:26): [True: 5, False: 110k]
  |  Branch (419:53): [True: 5, False: 0]
  ------------------
  420|       |
  421|   222k|    for (nNumBonds = 0, i = 0; i < num_at; i++)
  ------------------
  |  Branch (421:32): [True: 112k, False: 110k]
  ------------------
  422|   112k|    {
  423|   112k|        nNumBonds += at[i].valence;
  424|   112k|        if (at[i].iso_sort_key)
  ------------------
  |  Branch (424:13): [True: 141, False: 112k]
  ------------------
  425|    141|        {
  426|    141|            nNumIsotopic++;  /* not including tautomeric endpoints that are isotopic only due to mobile atoms */
  427|    141|        }
  428|       |
  429|   112k|        if (at[i].parity > 0)
  ------------------
  |  Branch (429:13): [True: 0, False: 112k]
  ------------------
  430|      0|        {
  431|       |            /* ignore hydrogen isotope parities in at[i].parity2 */
  432|      0|            int j = 0, nStereoBondsToAtom = 0;  /* number of stereo double bonds at this atom */
  433|      0|            int k;
  434|      0|            for (; j < MAX_NUM_STEREO_BONDS && ( k = at[i].stereo_bond_neighbor[j] ); j++)
  ------------------
  |  |  876|      0|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (434:20): [True: 0, False: 0]
  |  Branch (434:48): [True: 0, False: 0]
  ------------------
  435|      0|            {
  436|      0|                nStereoBondsToAtom += ( at[k - 1].parity > 0 );
  437|      0|            }
  438|      0|            nNumDblBondsStereo += nStereoBondsToAtom;
  439|      0|            nNumAsymCarbStereo += !j;
  440|      0|        }
  441|   112k|    }
  442|       |
  443|   110k|    nNumDblBondsStereo /= 2;
  444|   110k|    nNumBonds /= 2;
  445|       |
  446|   110k|    s->nLenBonds = inchi_max( s->nLenBonds, nNumBonds );
  ------------------
  |  |  166|   110k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
  447|   110k|    nNumCT = nNumBonds; /* total number of neighbors in the CT */
  448|       |
  449|   110k|#if ( CT_ATOMID != CT_ATOMID_DONTINCLUDE )
  450|   110k|    nNumCT += num_at;
  451|   110k|#endif
  452|       |
  453|   110k|    s->nLenCTAtOnly = inchi_max( s->nLenCTAtOnly, nNumCT );
  ------------------
  |  |  166|   110k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
  454|       |
  455|   110k|    if (t_group)
  ------------------
  |  Branch (455:9): [True: 5, False: 110k]
  ------------------
  456|      5|    {
  457|      9|        for (i = 0; i < t_group_info->num_t_groups; i++)
  ------------------
  |  Branch (457:21): [True: 4, False: 5]
  ------------------
  458|      4|        {
  459|      4|            nNumTBonds += t_group[i].nNumEndpoints;
  460|      4|        }
  461|      5|        nNumCT += nNumTBonds;
  462|       |
  463|      5|#if ( CT_ATOMID != CT_ATOMID_DONTINCLUDE )
  464|      5|        nNumCT += t_group_info->num_t_groups;
  465|      5|#endif
  466|      5|    }
  467|       |
  468|   110k|    nNumCT = inchi_max( 1, nNumCT ); /* keep GetBaseCanonRanking() happy */
  ------------------
  |  |  166|   110k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
  469|   110k|    s->nLenCT = inchi_max( s->nLenCT, nNumCT );
  ------------------
  |  |  166|   110k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
  470|   110k|    s->nLenIsotopic = inchi_max( s->nLenIsotopic, nNumIsotopic );
  ------------------
  |  |  166|   110k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
  471|   110k|    s->nLenLinearCTStereoDble = inchi_max( s->nLenLinearCTStereoDble, nNumDblBondsStereo );
  ------------------
  |  |  166|   110k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
  472|   110k|    s->nLenLinearCTStereoCarb = inchi_max( s->nLenLinearCTStereoCarb, nNumAsymCarbStereo );
  ------------------
  |  |  166|   110k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
  473|       |
  474|   110k|    if (t_group_info)
  ------------------
  |  Branch (474:9): [True: 110k, False: 3]
  ------------------
  475|   110k|    {
  476|   110k|        s->nLenIsotopicEndpoints = inchi_max( s->nLenIsotopicEndpoints, t_group_info->nNumIsotopicEndpoints );
  ------------------
  |  |  166|   110k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
  477|   110k|    }
  478|       |
  479|   110k|    return 0;
  480|   110k|}
DeAllocateCS:
  485|   110k|{
  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  487|       |
  488|       |    /* connection table */
  489|   110k|    LOCAL_FREE( pCS->LinearCT );
  ------------------
  |  |  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (486:30): [True: 110k, False: 0]
  |  |  |  Branch (486:64): [Folded - Ignored]
  |  |  ------------------
  ------------------
  490|   110k|    LOCAL_FREE( pCS->nCanonOrd );
  ------------------
  |  |  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (486:30): [True: 110k, False: 0]
  |  |  |  Branch (486:64): [Folded - Ignored]
  |  |  ------------------
  ------------------
  491|   110k|    LOCAL_FREE( pCS->nSymmRank );
  ------------------
  |  |  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (486:30): [True: 110k, False: 0]
  |  |  |  Branch (486:64): [Folded - Ignored]
  |  |  ------------------
  ------------------
  492|   110k|    LOCAL_FREE( pCS->nNum_H );
  ------------------
  |  |  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (486:30): [True: 110k, False: 0]
  |  |  |  Branch (486:64): [Folded - Ignored]
  |  |  ------------------
  ------------------
  493|   110k|    LOCAL_FREE( pCS->nNum_H_fixed );
  ------------------
  |  |  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (486:30): [True: 110k, False: 0]
  |  |  |  Branch (486:64): [Folded - Ignored]
  |  |  ------------------
  ------------------
  494|   110k|    LOCAL_FREE( pCS->nExchgIsoH );
  ------------------
  |  |  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (486:30): [True: 110k, False: 0]
  |  |  |  Branch (486:64): [Folded - Ignored]
  |  |  ------------------
  ------------------
  495|       |    /* isotopic */
  496|   110k|    LOCAL_FREE( pCS->LinearCTIsotopic );
  ------------------
  |  |  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|     47|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 47, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (486:30): [True: 47, False: 109k]
  |  |  |  Branch (486:64): [Folded - Ignored]
  |  |  ------------------
  ------------------
  497|   110k|    LOCAL_FREE( pCS->nSymmRankIsotopic );
  ------------------
  |  |  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|     47|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 47, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (486:30): [True: 47, False: 109k]
  |  |  |  Branch (486:64): [Folded - Ignored]
  |  |  ------------------
  ------------------
  498|   110k|    LOCAL_FREE( pCS->nCanonOrdIsotopic );
  ------------------
  |  |  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|     47|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 47, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (486:30): [True: 47, False: 109k]
  |  |  |  Branch (486:64): [Folded - Ignored]
  |  |  ------------------
  ------------------
  499|       |    /* isotopic tautomeric */
  500|   110k|    LOCAL_FREE( pCS->LinearCTIsotopicTautomer );
  ------------------
  |  |  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (486:30): [True: 0, False: 110k]
  |  |  |  Branch (486:64): [Folded - Ignored]
  |  |  ------------------
  ------------------
  501|   110k|    LOCAL_FREE( pCS->nCanonOrdIsotopicTaut );
  ------------------
  |  |  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      2|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 2, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (486:30): [True: 2, False: 110k]
  |  |  |  Branch (486:64): [Folded - Ignored]
  |  |  ------------------
  ------------------
  502|   110k|    LOCAL_FREE( pCS->nSymmRankIsotopicTaut );
  ------------------
  |  |  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      2|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 2, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (486:30): [True: 2, False: 110k]
  |  |  |  Branch (486:64): [Folded - Ignored]
  |  |  ------------------
  ------------------
  503|       |    /* stereo */
  504|   110k|    LOCAL_FREE( pCS->LinearCTStereoDble );
  ------------------
  |  |  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (486:30): [True: 0, False: 110k]
  |  |  |  Branch (486:64): [Folded - Ignored]
  |  |  ------------------
  ------------------
  505|   110k|    LOCAL_FREE( pCS->LinearCTStereoCarb );
  ------------------
  |  |  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (486:30): [True: 0, False: 110k]
  |  |  |  Branch (486:64): [Folded - Ignored]
  |  |  ------------------
  ------------------
  506|   110k|    LOCAL_FREE( pCS->LinearCTStereoDbleInv );
  ------------------
  |  |  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (486:30): [True: 0, False: 110k]
  |  |  |  Branch (486:64): [Folded - Ignored]
  |  |  ------------------
  ------------------
  507|   110k|    LOCAL_FREE( pCS->LinearCTStereoCarbInv );
  ------------------
  |  |  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (486:30): [True: 0, False: 110k]
  |  |  |  Branch (486:64): [Folded - Ignored]
  |  |  ------------------
  ------------------
  508|   110k|    LOCAL_FREE( pCS->nCanonOrdStereo );
  ------------------
  |  |  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (486:30): [True: 0, False: 110k]
  |  |  |  Branch (486:64): [Folded - Ignored]
  |  |  ------------------
  ------------------
  509|   110k|    LOCAL_FREE( pCS->nCanonOrdStereoInv );
  ------------------
  |  |  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (486:30): [True: 0, False: 110k]
  |  |  |  Branch (486:64): [Folded - Ignored]
  |  |  ------------------
  ------------------
  510|   110k|    LOCAL_FREE( pCS->nCanonOrdStereoTaut );
  ------------------
  |  |  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (486:30): [True: 0, False: 110k]
  |  |  |  Branch (486:64): [Folded - Ignored]
  |  |  ------------------
  ------------------
  511|       |    /* isotopic stereo */
  512|   110k|    LOCAL_FREE( pCS->LinearCTIsotopicStereoDble );
  ------------------
  |  |  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (486:30): [True: 0, False: 110k]
  |  |  |  Branch (486:64): [Folded - Ignored]
  |  |  ------------------
  ------------------
  513|   110k|    LOCAL_FREE( pCS->LinearCTIsotopicStereoCarb );
  ------------------
  |  |  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (486:30): [True: 0, False: 110k]
  |  |  |  Branch (486:64): [Folded - Ignored]
  |  |  ------------------
  ------------------
  514|   110k|    LOCAL_FREE( pCS->LinearCTIsotopicStereoDbleInv );
  ------------------
  |  |  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (486:30): [True: 0, False: 110k]
  |  |  |  Branch (486:64): [Folded - Ignored]
  |  |  ------------------
  ------------------
  515|   110k|    LOCAL_FREE( pCS->LinearCTIsotopicStereoCarbInv );
  ------------------
  |  |  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (486:30): [True: 0, False: 110k]
  |  |  |  Branch (486:64): [Folded - Ignored]
  |  |  ------------------
  ------------------
  516|   110k|    LOCAL_FREE( pCS->bRankUsedForStereo );
  ------------------
  |  |  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (486:30): [True: 0, False: 110k]
  |  |  |  Branch (486:64): [Folded - Ignored]
  |  |  ------------------
  ------------------
  517|   110k|    LOCAL_FREE( pCS->bAtomUsedForStereo );
  ------------------
  |  |  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (486:30): [True: 0, False: 110k]
  |  |  |  Branch (486:64): [Folded - Ignored]
  |  |  ------------------
  ------------------
  518|       |
  519|   110k|    LOCAL_FREE( pCS->nCanonOrdIsotopicStereo );
  ------------------
  |  |  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (486:30): [True: 0, False: 110k]
  |  |  |  Branch (486:64): [Folded - Ignored]
  |  |  ------------------
  ------------------
  520|   110k|    LOCAL_FREE( pCS->nCanonOrdIsotopicStereoInv );
  ------------------
  |  |  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (486:30): [True: 0, False: 110k]
  |  |  |  Branch (486:64): [Folded - Ignored]
  |  |  ------------------
  ------------------
  521|   110k|    LOCAL_FREE( pCS->nCanonOrdIsotopicStereoTaut );
  ------------------
  |  |  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (486:30): [True: 0, False: 110k]
  |  |  |  Branch (486:64): [Folded - Ignored]
  |  |  ------------------
  ------------------
  522|       |    /* tautomeric part of the connection table */
  523|   110k|    LOCAL_FREE( pCS->LinearCTTautomer );
  ------------------
  |  |  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      5|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 5, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (486:30): [True: 5, False: 110k]
  |  |  |  Branch (486:64): [Folded - Ignored]
  |  |  ------------------
  ------------------
  524|   110k|    LOCAL_FREE( pCS->nCanonOrdTaut );
  ------------------
  |  |  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      4|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 4, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (486:30): [True: 4, False: 110k]
  |  |  |  Branch (486:64): [Folded - Ignored]
  |  |  ------------------
  ------------------
  525|   110k|    LOCAL_FREE( pCS->nSymmRankTaut );
  ------------------
  |  |  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      4|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 4, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (486:30): [True: 4, False: 110k]
  |  |  |  Branch (486:64): [Folded - Ignored]
  |  |  ------------------
  ------------------
  526|       |
  527|   110k|    LOCAL_FREE( pCS->LinearCT2 );
  ------------------
  |  |  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (486:30): [True: 110k, False: 0]
  |  |  |  Branch (486:64): [Folded - Ignored]
  |  |  ------------------
  ------------------
  528|       |
  529|       |    /* for establishing constitutional equivalence */
  530|   110k|    LOCAL_FREE( pCS->nPrevAtomNumber );
  ------------------
  |  |  486|   110k|#define LOCAL_FREE( X) do{if(X){inchi_free( X); X=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (486:30): [True: 110k, False: 0]
  |  |  |  Branch (486:64): [Folded - Ignored]
  |  |  ------------------
  ------------------
  531|       |
  532|   110k|    FreeNeighList( pCS->NeighList );
  533|   110k|    pCS->NeighList = NULL;
  534|       |
  535|       |    /* set zero lengths */
  536|   110k|    pCS->nMaxLenLinearCTStereoDble = 0;
  537|   110k|    pCS->nLenLinearCTStereoDble = 0;
  538|   110k|    pCS->nMaxLenLinearCTStereoCarb = 0;
  539|   110k|    pCS->nLenLinearCTStereoCarb = 0;
  540|   110k|    pCS->nMaxLenLinearCTIsotopicStereoDble = 0;
  541|   110k|    pCS->nLenLinearCTIsotopicStereoDble = 0;
  542|   110k|    pCS->nMaxLenLinearCTIsotopicStereoCarb = 0;
  543|   110k|    pCS->nLenLinearCTIsotopicStereoCarb = 0;
  544|   110k|    pCS->nMaxLenLinearCTTautomer = 0;
  545|   110k|    pCS->nLenLinearCTTautomer = 0;
  546|   110k|    pCS->nMaxLenLinearCTIsotopic = 0;
  547|   110k|    pCS->nLenLinearCTIsotopic = 0;
  548|   110k|    pCS->nMaxLenLinearCTIsotopicTautomer = 0;
  549|   110k|    pCS->nLenLinearCTIsotopicTautomer = 0;
  550|       |
  551|       |    /* set canon numbering lengths to zero */
  552|   110k|    pCS->nLenCanonOrd = 0;
  553|   110k|    pCS->nLenCanonOrdIsotopic = 0;
  554|   110k|    pCS->nLenCanonOrdIsotopicTaut = 0;
  555|   110k|    pCS->nLenCanonOrdStereo = 0;
  556|   110k|    pCS->nLenCanonOrdStereoTaut = 0;
  557|   110k|    pCS->nLenCanonOrdIsotopicStereo = 0;
  558|   110k|    pCS->nLenCanonOrdIsotopicStereoTaut = 0;
  559|   110k|    pCS->nLenCanonOrdTaut = 0;
  560|       |
  561|   110k|    return 0;
  562|       |
  563|   110k|#undef LOCAL_FREE
  564|   110k|}
AllocateCS:
  582|   110k|{
  583|   110k|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  584|       |
  585|   110k|    int num_err = 0;
  586|   110k|    int num_t_groups = num_at_tg - num_at;
  587|       |
  588|   110k|    pCS->nMode = nMode;
  589|       |
  590|       |    /* connection table */
  591|   110k|    if (( nMode & CMODE_CT ) && nLenCT > 0)
  ------------------
  |  |  772|   110k|#define CMODE_CT                 0x000001
  ------------------
  |  Branch (591:9): [True: 110k, False: 0]
  |  Branch (591:33): [True: 110k, False: 0]
  ------------------
  592|   110k|    {
  593|   110k|        num_err += !pCS_CALLOC( LinearCT, AT_NUMB, nLenCT );
  ------------------
  |  |  583|   110k|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  |  |  ------------------
  |  |  |  | 1133|   110k|#define inchi_calloc   calloc
  |  |  ------------------
  ------------------
  594|   110k|        pCS->nMaxLenLinearCT =
  595|   110k|            pCS->nLenLinearCT = nLenCT;
  596|   110k|        pCS->nLenLinearCTAtOnly = nLenCTAtOnly;
  597|   110k|        num_err += !pCS_CALLOC( nCanonOrd, AT_RANK, num_at_tg );
  ------------------
  |  |  583|   110k|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  |  |  ------------------
  |  |  |  | 1133|   110k|#define inchi_calloc   calloc
  |  |  ------------------
  ------------------
  598|   110k|        num_err += !pCS_CALLOC( nSymmRank, AT_RANK, num_at_tg );
  ------------------
  |  |  583|   110k|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  |  |  ------------------
  |  |  |  | 1133|   110k|#define inchi_calloc   calloc
  |  |  ------------------
  ------------------
  599|   110k|        if (pBCN)
  ------------------
  |  Branch (599:13): [True: 110k, False: 0]
  ------------------
  600|   110k|        {
  601|   110k|            num_err += !pCS_CALLOC( nNum_H, S_CHAR, num_at );
  ------------------
  |  |  583|   110k|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  |  |  ------------------
  |  |  |  | 1133|   110k|#define inchi_calloc   calloc
  |  |  ------------------
  ------------------
  602|   110k|            num_err += !pCS_CALLOC( nNum_H_fixed, S_CHAR, num_at );
  ------------------
  |  |  583|   110k|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  |  |  ------------------
  |  |  |  | 1133|   110k|#define inchi_calloc   calloc
  |  |  ------------------
  ------------------
  603|   110k|            num_err += !pCS_CALLOC( nExchgIsoH, S_CHAR, num_at );
  ------------------
  |  |  583|   110k|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  |  |  ------------------
  |  |  |  | 1133|   110k|#define inchi_calloc   calloc
  |  |  ------------------
  ------------------
  604|   110k|        }
  605|   110k|    }
  606|       |
  607|       |    /* isotopic */
  608|   110k|    if (( nMode & CMODE_ISO ) && nLenIsotopic > 0)
  ------------------
  |  |  773|   110k|#define CMODE_ISO                0x000002
  ------------------
  |  Branch (608:9): [True: 47, False: 109k]
  |  Branch (608:34): [True: 47, False: 0]
  ------------------
  609|     47|    {
  610|     47|        num_err += !pCS_CALLOC( LinearCTIsotopic, AT_ISOTOPIC, nLenIsotopic );
  ------------------
  |  |  583|     47|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  |  |  ------------------
  |  |  |  | 1133|     47|#define inchi_calloc   calloc
  |  |  ------------------
  ------------------
  611|     47|        pCS->nMaxLenLinearCTIsotopic =
  612|     47|            pCS->nLenLinearCTIsotopic = nLenIsotopic;
  613|     47|    }
  614|       |
  615|       |    /* isotopic tautomeric */
  616|   110k|    if (( nMode & CMODE_ISO ) && CANON_MODE_TAUT == ( nMode & CANON_MODE_TAUT ))
  ------------------
  |  |  773|   110k|#define CMODE_ISO                0x000002
  ------------------
                  if (( nMode & CMODE_ISO ) && CANON_MODE_TAUT == ( nMode & CANON_MODE_TAUT ))
  ------------------
  |  |  790|     47|#define CANON_MODE_TAUT       (CMODE_CT|CMODE_TAUT)
  |  |  ------------------
  |  |  |  |  772|     47|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_TAUT       (CMODE_CT|CMODE_TAUT)
  |  |  ------------------
  |  |  |  |  777|     47|#define CMODE_TAUT               0x000020
  |  |  ------------------
  ------------------
                  if (( nMode & CMODE_ISO ) && CANON_MODE_TAUT == ( nMode & CANON_MODE_TAUT ))
  ------------------
  |  |  790|     47|#define CANON_MODE_TAUT       (CMODE_CT|CMODE_TAUT)
  |  |  ------------------
  |  |  |  |  772|     47|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_TAUT       (CMODE_CT|CMODE_TAUT)
  |  |  ------------------
  |  |  |  |  777|     47|#define CMODE_TAUT               0x000020
  |  |  ------------------
  ------------------
  |  Branch (616:9): [True: 47, False: 109k]
  |  Branch (616:34): [True: 2, False: 45]
  ------------------
  617|      2|    {
  618|      2|        if (nLenLinearCTIsotopicTautomer > 0)
  ------------------
  |  Branch (618:13): [True: 0, False: 2]
  ------------------
  619|      0|        {
  620|      0|            num_err += !pCS_CALLOC( LinearCTIsotopicTautomer, AT_ISO_TGROUP, nLenLinearCTIsotopicTautomer );
  ------------------
  |  |  583|      0|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  |  |  ------------------
  |  |  |  | 1133|      0|#define inchi_calloc   calloc
  |  |  ------------------
  ------------------
  621|      0|            pCS->nMaxLenLinearCTIsotopicTautomer =
  622|      0|                pCS->nLenLinearCTIsotopicTautomer = nLenLinearCTIsotopicTautomer;
  623|      0|        }
  624|      2|        if (num_t_groups > 0)
  ------------------
  |  Branch (624:13): [True: 2, False: 0]
  ------------------
  625|      2|        {
  626|      2|            num_err += !pCS_CALLOC( nCanonOrdIsotopicTaut, AT_RANK, num_t_groups );
  ------------------
  |  |  583|      2|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  |  |  ------------------
  |  |  |  | 1133|      2|#define inchi_calloc   calloc
  |  |  ------------------
  ------------------
  627|      2|            num_err += !pCS_CALLOC( nSymmRankIsotopicTaut, AT_RANK, num_t_groups );
  ------------------
  |  |  583|      2|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  |  |  ------------------
  |  |  |  | 1133|      2|#define inchi_calloc   calloc
  |  |  ------------------
  ------------------
  628|      2|        }
  629|      2|    }
  630|       |    /* isotopic atoms & t-groups */
  631|   110k|    if (( nMode & CMODE_ISO ) /*&& nLenIsotopic > 0*/ ||
  ------------------
  |  |  773|   110k|#define CMODE_ISO                0x000002
  ------------------
  |  Branch (631:9): [True: 47, False: 109k]
  ------------------
  632|   110k|        ( nMode & CMODE_ISO ) && CANON_MODE_TAUT == ( nMode & CANON_MODE_TAUT ) && nLenLinearCTIsotopicTautomer > 0
  ------------------
  |  |  773|   109k|#define CMODE_ISO                0x000002
  ------------------
                      ( nMode & CMODE_ISO ) && CANON_MODE_TAUT == ( nMode & CANON_MODE_TAUT ) && nLenLinearCTIsotopicTautomer > 0
  ------------------
  |  |  790|      0|#define CANON_MODE_TAUT       (CMODE_CT|CMODE_TAUT)
  |  |  ------------------
  |  |  |  |  772|      0|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_TAUT       (CMODE_CT|CMODE_TAUT)
  |  |  ------------------
  |  |  |  |  777|      0|#define CMODE_TAUT               0x000020
  |  |  ------------------
  ------------------
                      ( nMode & CMODE_ISO ) && CANON_MODE_TAUT == ( nMode & CANON_MODE_TAUT ) && nLenLinearCTIsotopicTautomer > 0
  ------------------
  |  |  790|      0|#define CANON_MODE_TAUT       (CMODE_CT|CMODE_TAUT)
  |  |  ------------------
  |  |  |  |  772|      0|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_TAUT       (CMODE_CT|CMODE_TAUT)
  |  |  ------------------
  |  |  |  |  777|      0|#define CMODE_TAUT               0x000020
  |  |  ------------------
  ------------------
  |  Branch (632:9): [True: 0, False: 109k]
  |  Branch (632:34): [True: 0, False: 0]
  |  Branch (632:84): [True: 0, False: 0]
  ------------------
  633|   110k|        )
  634|     47|    {
  635|     47|        num_err += !pCS_CALLOC( nSymmRankIsotopic, AT_RANK, num_at_tg );
  ------------------
  |  |  583|     47|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  |  |  ------------------
  |  |  |  | 1133|     47|#define inchi_calloc   calloc
  |  |  ------------------
  ------------------
  636|     47|        num_err += !pCS_CALLOC( nCanonOrdIsotopic, AT_RANK, num_at_tg );
  ------------------
  |  |  583|     47|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  |  |  ------------------
  |  |  |  | 1133|     47|#define inchi_calloc   calloc
  |  |  ------------------
  ------------------
  637|     47|    }
  638|       |    /* stereo */
  639|   110k|    if (( nMode & CMODE_STEREO ) && nLenLinearCTStereoDble > 0)
  ------------------
  |  |  775|   110k|#define CMODE_STEREO             0x000008
  ------------------
  |  Branch (639:9): [True: 0, False: 110k]
  |  Branch (639:37): [True: 0, False: 0]
  ------------------
  640|      0|    {
  641|      0|        num_err += !pCS_CALLOC( LinearCTStereoDble, AT_STEREO_DBLE, nLenLinearCTStereoDble );
  ------------------
  |  |  583|      0|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  |  |  ------------------
  |  |  |  | 1133|      0|#define inchi_calloc   calloc
  |  |  ------------------
  ------------------
  642|      0|        num_err += !pCS_CALLOC( LinearCTStereoDbleInv, AT_STEREO_DBLE, nLenLinearCTStereoDble );
  ------------------
  |  |  583|      0|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  |  |  ------------------
  |  |  |  | 1133|      0|#define inchi_calloc   calloc
  |  |  ------------------
  ------------------
  643|      0|        pCS->nLenLinearCTStereoDbleInv =
  644|      0|            pCS->nMaxLenLinearCTStereoDble =
  645|      0|            pCS->nLenLinearCTStereoDble = nLenLinearCTStereoDble;
  646|      0|    }
  647|   110k|    if (( nMode & CMODE_STEREO ) && nLenLinearCTStereoCarb > 0)
  ------------------
  |  |  775|   110k|#define CMODE_STEREO             0x000008
  ------------------
  |  Branch (647:9): [True: 0, False: 110k]
  |  Branch (647:37): [True: 0, False: 0]
  ------------------
  648|      0|    {
  649|      0|        num_err += !pCS_CALLOC( LinearCTStereoCarb, AT_STEREO_CARB, nLenLinearCTStereoCarb );
  ------------------
  |  |  583|      0|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  |  |  ------------------
  |  |  |  | 1133|      0|#define inchi_calloc   calloc
  |  |  ------------------
  ------------------
  650|      0|        num_err += !pCS_CALLOC( LinearCTStereoCarbInv, AT_STEREO_CARB, nLenLinearCTStereoCarb );
  ------------------
  |  |  583|      0|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  |  |  ------------------
  |  |  |  | 1133|      0|#define inchi_calloc   calloc
  |  |  ------------------
  ------------------
  651|      0|        pCS->nLenLinearCTStereoCarbInv =
  652|      0|            pCS->nMaxLenLinearCTStereoCarb =
  653|      0|            pCS->nLenLinearCTStereoCarb = nLenLinearCTStereoCarb;
  654|      0|    }
  655|   110k|    if (( nMode & CMODE_STEREO ) && ( nLenLinearCTStereoDble > 0 || nLenLinearCTStereoCarb > 0 ))
  ------------------
  |  |  775|   110k|#define CMODE_STEREO             0x000008
  ------------------
  |  Branch (655:9): [True: 0, False: 110k]
  |  Branch (655:39): [True: 0, False: 0]
  |  Branch (655:69): [True: 0, False: 0]
  ------------------
  656|      0|    {
  657|      0|        num_err += !pCS_CALLOC( nCanonOrdStereo, AT_RANK, num_at_tg );
  ------------------
  |  |  583|      0|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  |  |  ------------------
  |  |  |  | 1133|      0|#define inchi_calloc   calloc
  |  |  ------------------
  ------------------
  658|      0|        num_err += !pCS_CALLOC( nCanonOrdStereoInv, AT_RANK, num_at_tg );
  ------------------
  |  |  583|      0|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  |  |  ------------------
  |  |  |  | 1133|      0|#define inchi_calloc   calloc
  |  |  ------------------
  ------------------
  659|      0|        if (( nMode & CMODE_TAUT ) && nLenLinearCTTautomer > 0 && num_t_groups > 0)
  ------------------
  |  |  777|      0|#define CMODE_TAUT               0x000020
  ------------------
  |  Branch (659:13): [True: 0, False: 0]
  |  Branch (659:39): [True: 0, False: 0]
  |  Branch (659:67): [True: 0, False: 0]
  ------------------
  660|      0|        {
  661|      0|            num_err += !pCS_CALLOC( nCanonOrdStereoTaut, AT_RANK, num_t_groups );
  ------------------
  |  |  583|      0|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  |  |  ------------------
  |  |  |  | 1133|      0|#define inchi_calloc   calloc
  |  |  ------------------
  ------------------
  662|      0|        }
  663|      0|    }
  664|       |    /* isotopic stereo */
  665|   110k|    if (( nMode & CMODE_ISO_STEREO ) && nLenLinearCTIsotopicStereoDble > 0)
  ------------------
  |  |  776|   110k|#define CMODE_ISO_STEREO         0x000010
  ------------------
  |  Branch (665:9): [True: 0, False: 110k]
  |  Branch (665:41): [True: 0, False: 0]
  ------------------
  666|      0|    {
  667|      0|        num_err += !pCS_CALLOC( LinearCTIsotopicStereoDble, AT_STEREO_DBLE, nLenLinearCTIsotopicStereoDble );
  ------------------
  |  |  583|      0|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  |  |  ------------------
  |  |  |  | 1133|      0|#define inchi_calloc   calloc
  |  |  ------------------
  ------------------
  668|      0|        num_err += !pCS_CALLOC( LinearCTIsotopicStereoDbleInv, AT_STEREO_DBLE, nLenLinearCTIsotopicStereoDble );
  ------------------
  |  |  583|      0|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  |  |  ------------------
  |  |  |  | 1133|      0|#define inchi_calloc   calloc
  |  |  ------------------
  ------------------
  669|      0|        pCS->nLenLinearCTIsotopicStereoDbleInv =
  670|      0|            pCS->nMaxLenLinearCTIsotopicStereoDble =
  671|      0|            pCS->nLenLinearCTIsotopicStereoDble = nLenLinearCTIsotopicStereoDble;
  672|      0|    }
  673|   110k|    if (( nMode & CMODE_ISO_STEREO ) && nLenLinearCTIsotopicStereoCarb > 0)
  ------------------
  |  |  776|   110k|#define CMODE_ISO_STEREO         0x000010
  ------------------
  |  Branch (673:9): [True: 0, False: 110k]
  |  Branch (673:41): [True: 0, False: 0]
  ------------------
  674|      0|    {
  675|      0|        num_err += !pCS_CALLOC( LinearCTIsotopicStereoCarb, AT_STEREO_CARB, nLenLinearCTIsotopicStereoCarb );
  ------------------
  |  |  583|      0|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  |  |  ------------------
  |  |  |  | 1133|      0|#define inchi_calloc   calloc
  |  |  ------------------
  ------------------
  676|      0|        num_err += !pCS_CALLOC( LinearCTIsotopicStereoCarbInv, AT_STEREO_CARB, nLenLinearCTIsotopicStereoCarb );
  ------------------
  |  |  583|      0|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  |  |  ------------------
  |  |  |  | 1133|      0|#define inchi_calloc   calloc
  |  |  ------------------
  ------------------
  677|      0|        pCS->nLenLinearCTIsotopicStereoCarbInv =
  678|      0|            pCS->nMaxLenLinearCTIsotopicStereoCarb =
  679|      0|            pCS->nLenLinearCTIsotopicStereoCarb = nLenLinearCTIsotopicStereoCarb;
  680|      0|    }
  681|   110k|    if (( nMode & CMODE_ISO_STEREO ) && ( nLenLinearCTIsotopicStereoDble > 0 || nLenLinearCTIsotopicStereoCarb > 0 ))
  ------------------
  |  |  776|   110k|#define CMODE_ISO_STEREO         0x000010
  ------------------
  |  Branch (681:9): [True: 0, False: 110k]
  |  Branch (681:43): [True: 0, False: 0]
  |  Branch (681:81): [True: 0, False: 0]
  ------------------
  682|      0|    {
  683|      0|        num_err += !pCS_CALLOC( nCanonOrdIsotopicStereo, AT_RANK, num_at_tg );
  ------------------
  |  |  583|      0|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  |  |  ------------------
  |  |  |  | 1133|      0|#define inchi_calloc   calloc
  |  |  ------------------
  ------------------
  684|      0|        num_err += !pCS_CALLOC( nCanonOrdIsotopicStereoInv, AT_RANK, num_at_tg );
  ------------------
  |  |  583|      0|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  |  |  ------------------
  |  |  |  | 1133|      0|#define inchi_calloc   calloc
  |  |  ------------------
  ------------------
  685|      0|        if (( nMode & CMODE_TAUT ) && nLenLinearCTTautomer > 0 && num_t_groups > 0)
  ------------------
  |  |  777|      0|#define CMODE_TAUT               0x000020
  ------------------
  |  Branch (685:13): [True: 0, False: 0]
  |  Branch (685:39): [True: 0, False: 0]
  |  Branch (685:67): [True: 0, False: 0]
  ------------------
  686|      0|        {
  687|      0|            num_err += !pCS_CALLOC( nCanonOrdIsotopicStereoTaut, AT_RANK, num_t_groups );
  ------------------
  |  |  583|      0|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  |  |  ------------------
  |  |  |  | 1133|      0|#define inchi_calloc   calloc
  |  |  ------------------
  ------------------
  688|      0|        }
  689|      0|    }
  690|   110k|    if (( nMode & CMODE_STEREO ) && ( nLenLinearCTStereoDble > 0 || nLenLinearCTStereoCarb > 0 ) ||
  ------------------
  |  |  775|   110k|#define CMODE_STEREO             0x000008
  ------------------
  |  Branch (690:9): [True: 0, False: 110k]
  |  Branch (690:39): [True: 0, False: 0]
  |  Branch (690:69): [True: 0, False: 0]
  ------------------
  691|   110k|        ( nMode & CMODE_ISO_STEREO ) && ( nLenLinearCTIsotopicStereoDble > 0 || nLenLinearCTIsotopicStereoCarb > 0 ))
  ------------------
  |  |  776|   110k|#define CMODE_ISO_STEREO         0x000010
  ------------------
  |  Branch (691:9): [True: 0, False: 110k]
  |  Branch (691:43): [True: 0, False: 0]
  |  Branch (691:81): [True: 0, False: 0]
  ------------------
  692|      0|    {
  693|      0|        num_err += !pCS_CALLOC( bRankUsedForStereo, S_CHAR, num_at );
  ------------------
  |  |  583|      0|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  |  |  ------------------
  |  |  |  | 1133|      0|#define inchi_calloc   calloc
  |  |  ------------------
  ------------------
  694|      0|        num_err += !pCS_CALLOC( bAtomUsedForStereo, S_CHAR, num_at );
  ------------------
  |  |  583|      0|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  |  |  ------------------
  |  |  |  | 1133|      0|#define inchi_calloc   calloc
  |  |  ------------------
  ------------------
  695|      0|    }
  696|       |    /* tautomeric part of the connection table */
  697|   110k|    if (( nMode & CMODE_CT ) && ( nMode & CMODE_TAUT ) && nLenLinearCTTautomer > 0)
  ------------------
  |  |  772|   110k|#define CMODE_CT                 0x000001
  ------------------
                  if (( nMode & CMODE_CT ) && ( nMode & CMODE_TAUT ) && nLenLinearCTTautomer > 0)
  ------------------
  |  |  777|   110k|#define CMODE_TAUT               0x000020
  ------------------
  |  Branch (697:9): [True: 110k, False: 0]
  |  Branch (697:33): [True: 5, False: 110k]
  |  Branch (697:59): [True: 5, False: 0]
  ------------------
  698|      5|    {
  699|      5|        num_err += !pCS_CALLOC( LinearCTTautomer, AT_TAUTOMER, nLenLinearCTTautomer );
  ------------------
  |  |  583|      5|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  |  |  ------------------
  |  |  |  | 1133|      5|#define inchi_calloc   calloc
  |  |  ------------------
  ------------------
  700|      5|        pCS->nMaxLenLinearCTTautomer =
  701|      5|            pCS->nLenLinearCTTautomer = nLenLinearCTTautomer;
  702|      5|        if (num_t_groups > 0)
  ------------------
  |  Branch (702:13): [True: 4, False: 1]
  ------------------
  703|      4|        {
  704|      4|            num_err += !pCS_CALLOC( nCanonOrdTaut, AT_RANK, num_t_groups );
  ------------------
  |  |  583|      4|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  |  |  ------------------
  |  |  |  | 1133|      4|#define inchi_calloc   calloc
  |  |  ------------------
  ------------------
  705|      4|            num_err += !pCS_CALLOC( nSymmRankTaut, AT_RANK, num_t_groups );
  ------------------
  |  |  583|      4|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  |  |  ------------------
  |  |  |  | 1133|      4|#define inchi_calloc   calloc
  |  |  ------------------
  ------------------
  706|      4|        }
  707|      5|    }
  708|       |
  709|   110k|    if (nMode & CMODE_CT)
  ------------------
  |  |  772|   110k|#define CMODE_CT                 0x000001
  ------------------
  |  Branch (709:9): [True: 110k, False: 0]
  ------------------
  710|   110k|    {
  711|   110k|        num_err += !pCS_CALLOC( LinearCT2, AT_NUMB, nLenCT );
  ------------------
  |  |  583|   110k|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  |  |  ------------------
  |  |  |  | 1133|   110k|#define inchi_calloc   calloc
  |  |  ------------------
  ------------------
  712|   110k|    }
  713|       |
  714|       |        /* for establishing constitutional equivalence */
  715|   110k|    num_err += !pCS_CALLOC( nPrevAtomNumber, AT_RANK, num_at_tg );
  ------------------
  |  |  583|   110k|#define pCS_CALLOC( PTR,TYPE,LEN) (pCS->PTR=(TYPE*)inchi_calloc( (size_t)(LEN),sizeof(*pCS->PTR)))
  |  |  ------------------
  |  |  |  | 1133|   110k|#define inchi_calloc   calloc
  |  |  ------------------
  ------------------
  716|       |
  717|       |    /* set canon numbering lengths to zero */
  718|   110k|    pCS->nLenCanonOrd = 0;
  719|   110k|    pCS->nLenCanonOrdIsotopic = 0;
  720|   110k|    pCS->nLenCanonOrdIsotopicTaut = 0;
  721|   110k|    pCS->nLenCanonOrdStereo = 0;
  722|   110k|    pCS->nLenCanonOrdStereoTaut = 0;
  723|   110k|    pCS->nLenCanonOrdIsotopicStereo = 0;
  724|   110k|    pCS->nLenCanonOrdIsotopicStereoTaut = 0;
  725|   110k|    pCS->nLenCanonOrdTaut = 0;
  726|       |
  727|       |
  728|   110k|    if (num_err)
  ------------------
  |  Branch (728:9): [True: 0, False: 110k]
  ------------------
  729|      0|    {
  730|      0|        DeAllocateCS( pCS );
  731|      0|        return CT_OUT_OF_RAM;  /*  <BRKPT> */
  ------------------
  |  |   49|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  732|      0|    }
  733|   110k|    return 0;
  734|       |
  735|   110k|#undef pCS_CALLOC
  736|   110k|}
FillIsotopicAtLinearCT:
  779|     47|{
  780|       |    /* at[i].init_rank = initial ranks before canonizing */
  781|       |    /* nRank[i]  = new ordering number for atoms: nRank=1,2,.. */
  782|       |    /* nAtomNumber[r] = orig. atom number= 0,1,...  for r = nRank-1  */
  783|       |    /* nRank[nAtomNumber[r]] = r; r = 0,1,... */
  784|       |    /* nAtomNumber[nRank[i]-1] = i; */
  785|       |
  786|     47|    int  i, k, rank;
  787|     47|    int  nLinearCTIsotopicLen = 0;
  788|       |
  789|       |    /* the following parts of the "name" should be compared */
  790|       |    /* after the connection table comparison is done */
  791|       |    /* to avoid wrong difference sign. So, these parts */
  792|       |    /* go to a separate buffers. */
  793|     47|    if (LinearCTIsotopic && nMaxLenLinearCTIsotopic > 0)
  ------------------
  |  Branch (793:9): [True: 47, False: 0]
  |  Branch (793:29): [True: 47, False: 0]
  ------------------
  794|     47|    {
  795|     47|        memset( LinearCTIsotopic, 0, nMaxLenLinearCTIsotopic * sizeof( LinearCTIsotopic[0] ) );
  796|     47|    }
  797|      0|    else
  798|      0|    {
  799|      0|        return 0;
  800|      0|    }
  801|       |
  802|       |    /* rank = nRank[nAtomNumber[rank-1]] -- proposed atoms canon. numbers */
  803|  1.37k|    for (rank = 1; rank <= num_atoms; rank++)
  ------------------
  |  Branch (803:20): [True: 1.32k, False: 47]
  ------------------
  804|  1.32k|    {
  805|       |
  806|  1.32k|        i = (int) nAtomNumber[rank - 1];  /* current atom */
  807|       |
  808|       |        /****************************************************
  809|       |             add isotopic atom info to LinearCTIsotopic
  810|       |        *****************************************************/
  811|       |
  812|       |        /* if the atom itself is not isotopic then add it only if */
  813|       |        /* the atom is not an endpoint AND has attached T or D or 1H.  */
  814|  1.32k|        k = ( !at[i].endpoint && !( at[i].cFlags & AT_FLAG_ISO_H_POINT ) && ( at[i].num_iso_H[0] || at[i].num_iso_H[1] || at[i].num_iso_H[2] ) );
  ------------------
  |  |   82|  1.32k|#define AT_FLAG_ISO_H_POINT 0x01  /* may have isotopic H */
  ------------------
  |  Branch (814:15): [True: 1.32k, False: 4]
  |  Branch (814:34): [True: 1.32k, False: 0]
  |  Branch (814:79): [True: 1, False: 1.31k]
  |  Branch (814:101): [True: 29, False: 1.29k]
  |  Branch (814:123): [True: 25, False: 1.26k]
  ------------------
  815|  1.32k|        if (at[i].iso_atw_diff || k)
  ------------------
  |  Branch (815:13): [True: 91, False: 1.23k]
  |  Branch (815:35): [True: 50, False: 1.18k]
  ------------------
  816|    141|        {
  817|    141|            if (CHECK_OVERFLOW( nLinearCTIsotopicLen, nMaxLenLinearCTIsotopic ))
  ------------------
  |  |   71|    141|#define CHECK_OVERFLOW(Len, Maxlen) ( (Len) >= (Maxlen) )
  |  |  ------------------
  |  |  |  Branch (71:37): [True: 0, False: 141]
  |  |  ------------------
  ------------------
  818|      0|            {
  819|      0|                return CT_OVERFLOW;  /*  <BRKPT> */
  ------------------
  |  |   47|      0|#define CT_OVERFLOW          (CT_ERR_FIRST- 0)  /*(-30000) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  820|      0|            }
  821|    141|            LinearCTIsotopic[nLinearCTIsotopicLen].at_num = (AT_RANK) rank;
  822|    141|            LinearCTIsotopic[nLinearCTIsotopicLen].iso_atw_diff = at[i].iso_atw_diff;
  823|    141|            LinearCTIsotopic[nLinearCTIsotopicLen].num_1H = (NUM_H) ( k ? at[i].num_iso_H[0] : 0 );
  ------------------
  |  Branch (823:71): [True: 55, False: 86]
  ------------------
  824|    141|            LinearCTIsotopic[nLinearCTIsotopicLen].num_D = (NUM_H) ( k ? at[i].num_iso_H[1] : 0 );
  ------------------
  |  Branch (824:70): [True: 55, False: 86]
  ------------------
  825|    141|            LinearCTIsotopic[nLinearCTIsotopicLen].num_T = (NUM_H) ( k ? at[i].num_iso_H[2] : 0 );
  ------------------
  |  Branch (825:70): [True: 55, False: 86]
  ------------------
  826|    141|            nLinearCTIsotopicLen++;
  827|    141|        }
  828|  1.32k|    } /* end of cycle over all atoms. */
  829|       |
  830|     47|    if (LinearCTIsotopic)
  ------------------
  |  Branch (830:9): [True: 47, False: 0]
  ------------------
  831|     47|    {
  832|     47|        if (*pnLenLinearCTIsotopic)
  ------------------
  |  Branch (832:13): [True: 47, False: 0]
  ------------------
  833|     47|        {
  834|     47|            if (*pnLenLinearCTIsotopic != nLinearCTIsotopicLen)
  ------------------
  |  Branch (834:17): [True: 0, False: 47]
  ------------------
  835|      0|            {
  836|      0|                return CT_LEN_MISMATCH;  /*  <BRKPT> */
  ------------------
  |  |   48|      0|#define CT_LEN_MISMATCH      (CT_ERR_FIRST- 1)  /*(-30001) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  837|      0|            }
  838|     47|        }
  839|      0|        else
  840|      0|        {
  841|      0|            *pnLenLinearCTIsotopic = nLinearCTIsotopicLen;
  842|      0|        }
  843|     47|    }
  844|       |
  845|       |    /* Return value: >0 => OK */
  846|     47|    return nLinearCTIsotopicLen;
  847|     47|}
FillTautLinearCT2:
  868|      4|{
  869|       |    /* nRank[i]  = Canonical numbers of atoms,.. */
  870|       |    /* nAtomNumber[r] = orig. atom number= 0,1,...  for r = nRank-1  */
  871|       |    /* nRank[nAtomNumber[r]] = r; r = 0,1,... */
  872|       |    /* nAtomNumber[nRank[i]-1] = i; */
  873|       |
  874|      4|    T_GROUP *t_group;
  875|       |
  876|      4|    int      i, j, len = 0, g, num_num, offset, max_len = 0, len_iso = 0;
  877|      4|    const static int max_num_num = sizeof( t_group->num ) / sizeof( t_group->num[0] );
  878|      4|    const static int max_num_iso = sizeof( LinearCTIsotopicTautomer->num ) / sizeof( LinearCTIsotopicTautomer->num[0] ) + T_NUM_NO_ISOTOPIC;
  ------------------
  |  |   97|      4|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
  879|       |
  880|       |    /****************************************************************************
  881|       |
  882|       |                   Tautomeric groups 07-22-2002, modified 12-2003
  883|       |
  884|       |    ****************************************************************************/
  885|       |
  886|      4|    if (num_at_tg > num_atoms && t_group_info && t_group_info->num_t_groups)
  ------------------
  |  Branch (886:9): [True: 4, False: 0]
  |  Branch (886:34): [True: 4, False: 0]
  |  Branch (886:50): [True: 4, False: 0]
  ------------------
  887|      4|    {
  888|      4|        int        num_t_groups = t_group_info->num_t_groups;
  889|      4|        AT_NUMB   *tGroupNumber = t_group_info->tGroupNumber;
  890|      4|        AT_NUMB   *tSymmRank = tGroupNumber + TGSO_SYMM_RANK*num_t_groups;  /*  equivalence */
  ------------------
  |  |  166|      4|#define TGSO_SYMM_RANK   1  /* tSymmRank:     symmetry ranks (no isotopes) = min. ordering number > 0. */
  ------------------
  891|      4|        AT_NUMB   *tiSymmRank = tGroupNumber + TGSO_SYMM_IRANK*num_t_groups;
  ------------------
  |  |  168|      4|#define TGSO_SYMM_IRANK  3  /* tiSymmRank:    isotopic symmetry ranks */
  ------------------
  892|      4|        AT_NUMB   *tiGroupNumber = tGroupNumber + TGSO_SYMM_IORDER*num_t_groups;
  ------------------
  |  |  167|      4|#define TGSO_SYMM_IORDER 2  /* tiGroupNumber: isotopic symmetry rank sorting order */
  ------------------
  893|      4|        AT_RANK    nOffset = (AT_RANK) num_atoms;
  894|       |
  895|       |        /*  Fill Canonical ranks and Symmetry Ranks */
  896|       |        /* memcpy( tPrevGroupNumber, tGroupNumber, num_t_groups*sizeof(tPrevGroupNumber[0])); */
  897|      8|        for (i = num_atoms, j = 0; i < num_at_tg; i++, j++)
  ------------------
  |  Branch (897:36): [True: 4, False: 4]
  ------------------
  898|      4|        {
  899|       |            /* tPrevGroupNumber[j] = */
  900|      4|            tGroupNumber[j] = nAtomNumber[i] - nOffset;
  901|      4|            tSymmRank[j] = nSymmRank[i] - nOffset;
  902|      4|            if (bIsoTaut)
  ------------------
  |  Branch (902:17): [True: 2, False: 2]
  ------------------
  903|      2|            {
  904|      2|                tiGroupNumber[j] = nAtomNumberIso[i] - nOffset;
  905|      2|                tiSymmRank[j] = nSymmRankIso[i] - nOffset;
  906|      2|            }
  907|      4|        }
  908|       |
  909|       |        /*  Sort enpoints within each tautomeric group according to the canonical ranks */
  910|      4|        pCG->m_pn_RankForSort = nRank;
  911|      8|        for (i = 0; i < num_t_groups; i++)
  ------------------
  |  Branch (911:21): [True: 4, False: 4]
  ------------------
  912|      4|        {
  913|      4|            inchi_qsort( pCG,
  914|      4|                         t_group_info->nEndpointAtomNumber + (int) t_group_info->t_group[i].nFirstEndpointAtNoPos,
  915|      4|                         t_group_info->t_group[i].nNumEndpoints,
  916|      4|                         sizeof( t_group_info->nEndpointAtomNumber[0] ),
  917|      4|                         CompRank );
  918|      4|        }
  919|       |        /* fill out LinearCTTautomer */
  920|      4|        if (nMaxLenLinearCTTautomer)
  ------------------
  |  Branch (920:13): [True: 4, False: 0]
  ------------------
  921|      4|        {
  922|      4|            max_len = T_GROUP_HDR_LEN * t_group_info->num_t_groups + t_group_info->nNumEndpoints + 1;
  ------------------
  |  |  100|      4|#define           T_GROUP_HDR_LEN   (1+T_NUM_NO_ISOTOPIC /*+T_NUM_ISOTOPIC*/) /* LinearCTTautomer */
  |  |  ------------------
  |  |  |  |   97|      4|#define           T_NUM_NO_ISOTOPIC 2
  |  |  ------------------
  ------------------
  923|      4|            if (max_len > nMaxLenLinearCTTautomer)
  ------------------
  |  Branch (923:17): [True: 0, False: 4]
  ------------------
  924|      0|            {
  925|      0|                return CT_OVERFLOW;  /*   <BRKPT> */
  ------------------
  |  |   47|      0|#define CT_OVERFLOW          (CT_ERR_FIRST- 0)  /*(-30000) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  926|      0|            }
  927|      4|        }
  928|       |
  929|       |        /****************************************************************
  930|       |         * tautomer group format (#: is an offset)
  931|       |         ****************************************************************
  932|       |         *             HEADER (T_GROUP_HDR_LEN=3+3iso)
  933|       |         * 0:       N = number of endpoints   ( t_group->nNumEndpoints )
  934|       |         * 1:       number of mobile groups   ( t_group->num[0] )
  935|       |         * 2:       number of neg. charges    ( t_group->num[1] )  {note: T_NUM_NO_ISOTOPIC=2}
  936|       |         *             ENDPOINT RANKS
  937|       |         * 3..N+2:  sorted tautomer group endpoint ranks; the sorting order is in
  938|       |         *          t_group_info->nEndpointAtomNumber[t_group->nFirstEndpointAtNoPos+j], j=0..N-1
  939|       |         *
  940|       |         * End mark : N==0
  941|       |         ****************************************************************/
  942|       |        /* num_num = t_group_info->bIgnoreIsotopic? T_NUM_NO_ISOTOPIC : max_num_num; */
  943|      4|        num_num = max_num_num; /*  always include isotopic info; ignore it at the CT comparison step. */
  944|      8|        for (i = 0; i < t_group_info->num_t_groups; i++)
  ------------------
  |  Branch (944:21): [True: 4, False: 4]
  ------------------
  945|      4|        {
  946|      4|            g = tGroupNumber[i]; /*  ith tautomeric group number in canonical order */
  947|      4|            t_group = t_group_info->t_group + g;
  948|       |            /*******************************************************
  949|       |             * Tautomer non-isotopic part: LinearCTTautomer
  950|       |             *******************************************************/
  951|       |            /*  check length */
  952|      4|            if (CHECK_OVERFLOW( len + T_GROUP_HDR_LEN + t_group->nNumEndpoints, max_len ))
  ------------------
  |  |   71|      4|#define CHECK_OVERFLOW(Len, Maxlen) ( (Len) >= (Maxlen) )
  |  |  ------------------
  |  |  |  Branch (71:37): [True: 0, False: 4]
  |  |  ------------------
  ------------------
  953|      0|            {
  954|      0|                return CT_OVERFLOW;  /*   <BRKPT> */
  ------------------
  |  |   47|      0|#define CT_OVERFLOW          (CT_ERR_FIRST- 0)  /*(-30000) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  955|      0|            }
  956|       |
  957|       |            /*  t_group header: number of endpoints */
  958|      4|            LinearCTTautomer[len++] = t_group->nNumEndpoints;
  959|       |            /*  t_group header: */
  960|       |            /*  (a) number of mobile groups in the t_group (number of H + number of (-) ) and */
  961|       |            /*  (b) number of mobile negative charges (-) in the t_group */
  962|     12|            for (j = 0; j < T_NUM_NO_ISOTOPIC; j++)
  ------------------
  |  |   97|     12|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
  |  Branch (962:25): [True: 8, False: 4]
  ------------------
  963|      8|            {
  964|      8|                LinearCTTautomer[len++] = t_group->num[j];
  965|      8|            }
  966|       |            /*  t_group endpoint ranks link the group to the tautomeric endpoint atoms in the structure */
  967|       |            /*  according to their ranks */
  968|     12|            for (j = 0, offset = t_group->nFirstEndpointAtNoPos; j < t_group->nNumEndpoints; j++)
  ------------------
  |  Branch (968:66): [True: 8, False: 4]
  ------------------
  969|      8|            {
  970|      8|                LinearCTTautomer[len++] = nRank[(int) t_group_info->nEndpointAtomNumber[offset + j]];
  971|      8|            }
  972|      4|        }
  973|      4|        if (nMaxLenLinearCTTautomer)
  ------------------
  |  Branch (973:13): [True: 4, False: 0]
  ------------------
  974|      4|        {
  975|      4|            LinearCTTautomer[len++] = 0; /*  or CT_INITVALUE ??? */
  976|      4|            if (len != max_len)
  ------------------
  |  Branch (976:17): [True: 0, False: 4]
  ------------------
  977|      0|            {
  978|      0|                len = -len; /*  program error */ /*   <BRKPT> */
  979|      0|            }
  980|      4|            else if (*pnLenLinearCTTautomer && *pnLenLinearCTTautomer != len)
  ------------------
  |  Branch (980:22): [True: 4, False: 0]
  |  Branch (980:48): [True: 0, False: 4]
  ------------------
  981|      0|            {
  982|      0|                return CT_LEN_MISMATCH;
  ------------------
  |  |   48|      0|#define CT_LEN_MISMATCH      (CT_ERR_FIRST- 1)  /*(-30001) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  983|      0|            }
  984|      4|            else
  985|      4|            {
  986|      4|                *pnLenLinearCTTautomer = len;
  987|      4|            }
  988|      4|        }
  989|      0|        else
  990|      0|        {
  991|      0|            *pnLenLinearCTTautomer = 0;
  992|      0|        }
  993|       |
  994|       |        /******************************************************************
  995|       |         * Isotopic Tautomeric mobile groups part: LinearCTIsotopicTautomer
  996|       |         ******************************************************************/
  997|      4|        if (nMaxLenLinearCTIsotopicTautomer && !t_group_info->nNumIsotopicEndpoints)
  ------------------
  |  Branch (997:13): [True: 0, False: 4]
  |  Branch (997:48): [True: 0, False: 0]
  ------------------
  998|      0|        {
  999|      0|            for (i = 0; i < t_group_info->num_t_groups; i++)
  ------------------
  |  Branch (999:25): [True: 0, False: 0]
  ------------------
 1000|      0|            {
 1001|      0|                g = tiGroupNumber[i]; /*  ith tautomeric group number in canonical order */
 1002|      0|                t_group = t_group_info->t_group + g;
 1003|       |                /*  find if mobile hydrogens are isotopic */
 1004|      0|                if (!t_group->iWeight)
  ------------------
  |  Branch (1004:21): [True: 0, False: 0]
  ------------------
 1005|      0|                {
 1006|      0|                    continue; /* no isotopic H */
 1007|      0|                }
 1008|      0|                if (CHECK_OVERFLOW( len_iso, nMaxLenLinearCTIsotopicTautomer ))
  ------------------
  |  |   71|      0|#define CHECK_OVERFLOW(Len, Maxlen) ( (Len) >= (Maxlen) )
  |  |  ------------------
  |  |  |  Branch (71:37): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1009|      0|                {
 1010|      0|                    return CT_OVERFLOW;  /*   <BRKPT> */
  ------------------
  |  |   47|      0|#define CT_OVERFLOW          (CT_ERR_FIRST- 0)  /*(-30000) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1011|      0|                }
 1012|      0|                for (j = T_NUM_NO_ISOTOPIC; j < max_num_num && j < max_num_iso; j++)
  ------------------
  |  |   97|      0|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
  |  Branch (1012:45): [True: 0, False: 0]
  |  Branch (1012:64): [True: 0, False: 0]
  ------------------
 1013|      0|                {
 1014|       |                     /*  num_T, num_D, num_1H */
 1015|      0|                    LinearCTIsotopicTautomer[len_iso].num[j - T_NUM_NO_ISOTOPIC] = t_group->num[j];
  ------------------
  |  |   97|      0|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
 1016|      0|                }
 1017|       |                /*  link to tautomer group LinearCTTautomer[i]:  */
 1018|      0|                LinearCTIsotopicTautomer[len_iso++].tgroup_num = (AT_NUMB) ( i + 1 ); /*  t_group isotopic rank */
 1019|      0|            }
 1020|      0|        }
 1021|      4|        if (nMaxLenLinearCTIsotopicTautomer)
  ------------------
  |  Branch (1021:13): [True: 0, False: 4]
  ------------------
 1022|      0|        {
 1023|      0|            if (*pnLenLinearCTIsotopicTautomer && *pnLenLinearCTIsotopicTautomer != len_iso)
  ------------------
  |  Branch (1023:17): [True: 0, False: 0]
  |  Branch (1023:51): [True: 0, False: 0]
  ------------------
 1024|      0|            {
 1025|      0|                return CT_LEN_MISMATCH;
  ------------------
  |  |   48|      0|#define CT_LEN_MISMATCH      (CT_ERR_FIRST- 1)  /*(-30001) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1026|      0|            }
 1027|      0|            *pnLenLinearCTIsotopicTautomer = len_iso;
 1028|      0|        }
 1029|      4|        else
 1030|      4|        {
 1031|      4|            *pnLenLinearCTIsotopicTautomer = 0;
 1032|      4|        }
 1033|      4|    }
 1034|       |
 1035|      4|    return len;
 1036|      4|}
UpdateFullLinearCT:
 1051|   110k|{
 1052|       |    /* at[i].init_rank = initial ranks before canonizing */
 1053|       |    /* nRank[i]  = new ordering number for atoms: nRank=1,2,.. */
 1054|       |    /* nAtomNumber[r] = orig. atom number= 0,1,...  for r = nRank-1  */
 1055|       |    /* nRank[nAtomNumber[r]] = r; r = 0,1,... */
 1056|       |    /* nAtomNumber[nRank[i]-1] = i; */
 1057|       |
 1058|   110k|    AT_NUMB nNeighborNumber[MAXVAL];
 1059|   110k|    int  i, j, k, num_neigh, rank, bCompare; /*, nRetVal; */
 1060|       |
 1061|   110k|    T_GROUP_INFO *t_group_info = NULL;
 1062|   110k|    T_GROUP      *t_group = NULL;
 1063|   110k|    AT_NUMB      *nEndpointAtomNumber = NULL;
 1064|       |
 1065|   110k|    int  nCTLen = 0, nCTLenAtOnly = 0;
 1066|       |
 1067|   110k|    AT_NUMB         r_neigh;
 1068|   110k|    AT_NUMB        *LinearCT = pCS->LinearCT;
 1069|       |
 1070|       |    /* the following parts of the "name" should be compared */
 1071|       |    /* after the connection table comparison is done */
 1072|       |    /* to avoid wrong difference sign. So, these parts */
 1073|       |    /* go to a separate buffers. */
 1074|       |    /* -- currently not used at all at all -- */
 1075|       |
 1076|   110k|#if CT_ATOMID != CT_ATOMID_DONTINCLUDE
 1077|   110k|    AT_NUMB          r0_at_type;
 1078|   110k|#endif
 1079|       |
 1080|   110k|    bCompare = bFirstTime ? 0 : 1;
  ------------------
  |  Branch (1080:16): [True: 0, False: 110k]
  ------------------
 1081|       |
 1082|   110k|    if (num_at_tg > num_atoms)
  ------------------
  |  Branch (1082:9): [True: 6, False: 110k]
  ------------------
 1083|      6|    {
 1084|      6|        t_group_info = pCS->t_group_info;
 1085|      6|        t_group = t_group_info->t_group;
 1086|      6|    }
 1087|   110k|    else
 1088|   110k|    {
 1089|   110k|        t_group_info = NULL;
 1090|   110k|        t_group = NULL;
 1091|   110k|    }
 1092|       |
 1093|       |    /**********************************************************************/
 1094|       |    /*                                                                    */
 1095|       |    /*    CYCLE 1: FILL OUT  CONNECTION TABLE(S) FOR ALL ATOMS            */
 1096|       |    /*      ** NOT INCLUDING ISOTOPIC ATOMS AND 1H, 2H(D), 3H(T) **       */
 1097|       |    /*                                                                    */
 1098|       |    /* rank = nRank[nAtomNumber[rank-1]] -- proposed atoms canon. numbers */
 1099|       |    /**********************************************************************/
 1100|   224k|    for (rank = 1; rank <= num_atoms; rank++)
  ------------------
  |  Branch (1100:20): [True: 114k, False: 110k]
  ------------------
 1101|   114k|    {
 1102|   114k|        i = (int) nAtomNumber[rank - 1];  /* current atom */
 1103|       |
 1104|   114k|#if ( CT_ATOMID == CT_ATOMID_IS_CURRANK )
 1105|   114k|        r0_at_type = (AT_NUMB) rank; /* current Rank */
 1106|       |#else
 1107|       |#if ( CT_ATOMID == CT_ATOMID_IS_INITRANK )
 1108|       |        r0_at_type = (AT_NUMB) at[i].init_rank; /* chemical + neighborhood ID */
 1109|       |#else
 1110|       |#if ( CT_ATOMID == CT_ATOMID_DONTINCLUDE )
 1111|       |#else
 1112|       |#error Undefined or wrong definition of CT_ATOMID
 1113|       |#endif
 1114|       |#endif
 1115|       |#endif
 1116|       |
 1117|       |        /* add atom to the CT */
 1118|   114k|#if ( CT_ATOMID != CT_ATOMID_DONTINCLUDE )
 1119|   114k|        if (CHECK_OVERFLOW( nCTLen, pCS->nMaxLenLinearCT ))
  ------------------
  |  |   71|   114k|#define CHECK_OVERFLOW(Len, Maxlen) ( (Len) >= (Maxlen) )
  |  |  ------------------
  |  |  |  Branch (71:37): [True: 0, False: 114k]
  |  |  ------------------
  ------------------
 1120|      0|        {
 1121|      0|            return CT_OVERFLOW;  /*  <BRKPT> */
  ------------------
  |  |   47|      0|#define CT_OVERFLOW          (CT_ERR_FIRST- 0)  /*(-30000) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1122|      0|        }
 1123|   228k|        COMPARE_WITH_CT( LinearCT, nCTLen, r0_at_type, bCompare );
  ------------------
  |  |  743|   114k|    if ( CONDITION ) { \
  |  |  ------------------
  |  |  |  Branch (743:10): [True: 114k, False: 0]
  |  |  ------------------
  |  |  744|   114k|        if ( (VALUE) CT_GREATER_THAN (CT)[CTLEN] ) \
  |  |  ------------------
  |  |  |  Branch (744:14): [True: 0, False: 114k]
  |  |  ------------------
  |  |  745|   114k|            return 1; /* not a minimal CT */ \
  |  |  746|   114k|        (CONDITION) = (VALUE) == (CT)[CTLEN]; \
  |  |  747|   114k|    } \
  |  |  748|   114k|    (CT)[CTLEN] = VALUE; \
  |  |  749|   114k|    (CTLEN)++
  ------------------
 1124|   228k|#endif
 1125|       |
 1126|       |        /*******************************************************
 1127|       |             add neighbors and (if required) bonds to CT
 1128|       |        ********************************************************/
 1129|       |
 1130|       |        /* sort neighbors */
 1131|   228k|        num_neigh = at[i].valence;
 1132|   228k|        for (k = 0; k < num_neigh; k++)
  ------------------
  |  Branch (1132:21): [True: 112, False: 114k]
  ------------------
 1133|    112|        {
 1134|    112|            nNeighborNumber[k] = (AT_NUMB) k;
 1135|    112|        }
 1136|   228k|        pCG->m_pNeighborsForSort = at[i].neighbor;
 1137|   228k|        pCG->m_pn_RankForSort = nRank;
 1138|   228k|        insertions_sort( pCG, nNeighborNumber, (size_t) num_neigh, sizeof( nNeighborNumber[0] ), CompNeighborsAT_NUMBER );
 1139|       |
 1140|   228k|        for (k = 0; k < num_neigh; k++)
  ------------------
  |  Branch (1140:21): [True: 112, False: 114k]
  ------------------
 1141|    112|        {
 1142|       |            /* rank = (new current atom Rank) */
 1143|    112|            if ((int) ( r_neigh = (AT_NUMB) nRank[(int) at[i].neighbor[(int) nNeighborNumber[k]]] )
  ------------------
  |  Branch (1143:17): [True: 56, False: 56]
  ------------------
 1144|    112|                                                              CT_NEIGH_SMALLER_THAN rank)
 1145|     56|            {
 1146|     56|                if (CHECK_OVERFLOW( nCTLen, pCS->nMaxLenLinearCT ))
  ------------------
  |  |   71|     56|#define CHECK_OVERFLOW(Len, Maxlen) ( (Len) >= (Maxlen) )
  |  |  ------------------
  |  |  |  Branch (71:37): [True: 0, False: 56]
  |  |  ------------------
  ------------------
 1147|      0|                {
 1148|      0|                    return CT_OVERFLOW;  /*  <BRKPT> */
  ------------------
  |  |   47|      0|#define CT_OVERFLOW          (CT_ERR_FIRST- 0)  /*(-30000) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1149|      0|                }
 1150|    112|                COMPARE_WITH_CT( LinearCT, nCTLen, r_neigh, bCompare );
  ------------------
  |  |  743|     56|    if ( CONDITION ) { \
  |  |  ------------------
  |  |  |  Branch (743:10): [True: 56, False: 0]
  |  |  ------------------
  |  |  744|     56|        if ( (VALUE) CT_GREATER_THAN (CT)[CTLEN] ) \
  |  |  ------------------
  |  |  |  Branch (744:14): [True: 0, False: 56]
  |  |  ------------------
  |  |  745|     56|            return 1; /* not a minimal CT */ \
  |  |  746|     56|        (CONDITION) = (VALUE) == (CT)[CTLEN]; \
  |  |  747|     56|    } \
  |  |  748|     56|    (CT)[CTLEN] = VALUE; \
  |  |  749|     56|    (CTLEN)++
  ------------------
 1151|    112|            }
 1152|    112|        }
 1153|       |
 1154|       |        /* add CT row delimiter */
 1155|   228k|    } /* end of cycle over all atoms. */
 1156|       |
 1157|   110k|    nCTLenAtOnly = nCTLen;
 1158|       |
 1159|       |    /**************************************************************
 1160|       |
 1161|       |                Tautomeric groups 07-22-2002
 1162|       |
 1163|       |    ***************************************************************/
 1164|       |
 1165|   110k|    for (rank = num_atoms + 1; rank <= num_at_tg; rank++)
  ------------------
  |  Branch (1165:32): [True: 6, False: 110k]
  ------------------
 1166|      6|    {
 1167|      6|        j = (int) nAtomNumber[rank - 1];  /* current "atom" */
 1168|      6|        i = j - num_atoms;             /* current t-group */
 1169|       |
 1170|      6|#if ( CT_ATOMID == CT_ATOMID_IS_CURRANK )
 1171|      6|        r0_at_type = (AT_NUMB) rank; /* current Rank */
 1172|       |#else
 1173|       |#if ( CT_ATOMID == CT_ATOMID_IS_INITRANK )
 1174|       |        r0_at_type = (AT_NUMB) rank; /* current Rank or  (AT_NUMB)at[i].init_rank; ==> chemical + neighborhood ID */
 1175|       |#else
 1176|       |#if ( CT_ATOMID == CT_ATOMID_DONTINCLUDE )
 1177|       |#else
 1178|       |#error Undefined or wrong definition of CT_ATOMID
 1179|       |#endif
 1180|       |#endif
 1181|       |#endif
 1182|       |
 1183|       |        /* add atom to the CT */
 1184|      6|#if ( CT_ATOMID != CT_ATOMID_DONTINCLUDE )
 1185|      6|        if (CHECK_OVERFLOW( nCTLen, pCS->nMaxLenLinearCT ))
  ------------------
  |  |   71|      6|#define CHECK_OVERFLOW(Len, Maxlen) ( (Len) >= (Maxlen) )
  |  |  ------------------
  |  |  |  Branch (71:37): [True: 0, False: 6]
  |  |  ------------------
  ------------------
 1186|      0|            return CT_OVERFLOW;  /*  <BRKPT> */
  ------------------
  |  |   47|      0|#define CT_OVERFLOW          (CT_ERR_FIRST- 0)  /*(-30000) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1187|     12|        COMPARE_WITH_CT( LinearCT, nCTLen, r0_at_type, bCompare );
  ------------------
  |  |  743|      6|    if ( CONDITION ) { \
  |  |  ------------------
  |  |  |  Branch (743:10): [True: 6, False: 0]
  |  |  ------------------
  |  |  744|      6|        if ( (VALUE) CT_GREATER_THAN (CT)[CTLEN] ) \
  |  |  ------------------
  |  |  |  Branch (744:14): [True: 0, False: 6]
  |  |  ------------------
  |  |  745|      6|            return 1; /* not a minimal CT */ \
  |  |  746|      6|        (CONDITION) = (VALUE) == (CT)[CTLEN]; \
  |  |  747|      6|    } \
  |  |  748|      6|    (CT)[CTLEN] = VALUE; \
  |  |  749|      6|    (CTLEN)++
  ------------------
 1188|     12|#endif
 1189|       |
 1190|       |        /*******************************************************
 1191|       |              add neighbors and (if required) bonds to CT
 1192|       |        ********************************************************/
 1193|       |
 1194|       |        /* sort endpoints */
 1195|     12|        nEndpointAtomNumber = t_group_info->nEndpointAtomNumber + (int) t_group[i].nFirstEndpointAtNoPos;
 1196|     12|        pCG->m_pn_RankForSort = nRank;
 1197|     12|        num_neigh = (int) t_group[i].nNumEndpoints;
 1198|     12|        insertions_sort( pCG, nEndpointAtomNumber, (size_t) num_neigh, sizeof( nEndpointAtomNumber[0] ), CompRank );
 1199|       |
 1200|     18|        for (k = 0; k < num_neigh; k++)
  ------------------
  |  Branch (1200:21): [True: 12, False: 6]
  ------------------
 1201|     12|        {
 1202|       |            /* rank = (new current atom Rank) */
 1203|     12|            if ((int) ( r_neigh = (AT_NUMB) nRank[(int) nEndpointAtomNumber[k]] )
  ------------------
  |  Branch (1203:17): [True: 12, False: 0]
  ------------------
 1204|     12|                                                              CT_NEIGH_SMALLER_THAN rank)
 1205|     12|            {
 1206|     12|                if (CHECK_OVERFLOW( nCTLen, pCS->nMaxLenLinearCT ))
  ------------------
  |  |   71|     12|#define CHECK_OVERFLOW(Len, Maxlen) ( (Len) >= (Maxlen) )
  |  |  ------------------
  |  |  |  Branch (71:37): [True: 0, False: 12]
  |  |  ------------------
  ------------------
 1207|      0|                {
 1208|      0|                    return CT_OVERFLOW;  /*  <BRKPT> */
  ------------------
  |  |   47|      0|#define CT_OVERFLOW          (CT_ERR_FIRST- 0)  /*(-30000) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1209|      0|                }
 1210|     24|                COMPARE_WITH_CT( LinearCT, nCTLen, r_neigh, bCompare );
  ------------------
  |  |  743|     12|    if ( CONDITION ) { \
  |  |  ------------------
  |  |  |  Branch (743:10): [True: 12, False: 0]
  |  |  ------------------
  |  |  744|     12|        if ( (VALUE) CT_GREATER_THAN (CT)[CTLEN] ) \
  |  |  ------------------
  |  |  |  Branch (744:14): [True: 0, False: 12]
  |  |  ------------------
  |  |  745|     12|            return 1; /* not a minimal CT */ \
  |  |  746|     12|        (CONDITION) = (VALUE) == (CT)[CTLEN]; \
  |  |  747|     12|    } \
  |  |  748|     12|    (CT)[CTLEN] = VALUE; \
  |  |  749|     12|    (CTLEN)++
  ------------------
 1211|     24|            }
 1212|     12|        }
 1213|     12|    } /* end of cycle over all tautomeric groups. */
 1214|       |
 1215|       |    /* compare bonds types */
 1216|       |    /* compare elements */
 1217|       |
 1218|   110k|    if (LinearCT)
  ------------------
  |  Branch (1218:9): [True: 110k, False: 0]
  ------------------
 1219|   110k|    {
 1220|       |
 1221|   110k|        if (pCS->nLenLinearCT)
  ------------------
  |  Branch (1221:13): [True: 110k, False: 0]
  ------------------
 1222|   110k|        {
 1223|   110k|            if (pCS->nLenLinearCT != nCTLen)
  ------------------
  |  Branch (1223:17): [True: 0, False: 110k]
  ------------------
 1224|      0|            {
 1225|      0|                return CT_LEN_MISMATCH;  /*  <BRKPT> */
  ------------------
  |  |   48|      0|#define CT_LEN_MISMATCH      (CT_ERR_FIRST- 1)  /*(-30001) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1226|      0|            }
 1227|   110k|        }
 1228|      0|        else
 1229|      0|        {
 1230|      0|            pCS->nLenLinearCT = nCTLen;
 1231|      0|        }
 1232|       |
 1233|   110k|        if (pCS->nLenLinearCT)
  ------------------
  |  Branch (1233:13): [True: 110k, False: 0]
  ------------------
 1234|   110k|        {
 1235|   110k|            if (pCS->nLenLinearCTAtOnly != nCTLenAtOnly)
  ------------------
  |  Branch (1235:17): [True: 0, False: 110k]
  ------------------
 1236|      0|            {
 1237|      0|                return CT_LEN_MISMATCH;  /*  <BRKPT> */
  ------------------
  |  |   48|      0|#define CT_LEN_MISMATCH      (CT_ERR_FIRST- 1)  /*(-30001) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1238|      0|            }
 1239|   110k|        }
 1240|      0|        else
 1241|      0|        {
 1242|      0|            pCS->nLenLinearCTAtOnly = nCTLenAtOnly;
 1243|      0|        }
 1244|   110k|    }
 1245|       |
 1246|       |    /* Return: 0=> identical CT; -1=> new CT is smaller than the previous one */
 1247|   110k|    return ( bCompare - 1 );
 1248|   110k|}
FixCanonEquivalenceInfo:
 1271|   110k|{
 1272|   110k|    int nNumDiffRanks, bChangeSymmRank, bChangeCurrRank = 0;
 1273|       |    /* sort equivalence information */
 1274|       |    /*
 1275|       |    int i;
 1276|       |    for ( i = 0; i < num_at_tg; i ++ )
 1277|       |    {
 1278|       |        nAtomNumber[i] = i;
 1279|       |    }
 1280|       |    */
 1281|       |
 1282|   110k|    pCG->m_pn_RankForSort = nSymmRank; /* minimal class representatives: min ranks for equiv. atoms */
 1283|   110k|    inchi_qsort( pCG, nAtomNumber, num_at_tg, sizeof( nAtomNumber[0] ), CompRanksOrd );
 1284|       |
 1285|       |    /* convert equivalence information nSymmRank[] into ranks array nTempRank[] */
 1286|       |    /* eq. info contains min. possible ranks for eq. atoms; nCurrRank contains max. possible ranks */
 1287|   110k|    nNumDiffRanks = SortedEquInfoToRanks( nSymmRank/*inp*/, nTempRank/*out*/, nAtomNumber, num_at_tg, &bChangeSymmRank );
 1288|       |
 1289|       |    /* check whether nCurrRank is same as new initial ranks calculated from nSymmRank[] */
 1290|   110k|    bChangeCurrRank = memcmp( nCurrRank, nTempRank, num_at_tg * sizeof( nTempRank[0] ) );
 1291|       |
 1292|       |    /*-----------------------------------------------------------------------
 1293|       |    if ( bChangeSymmRank || bChangeCurrRank ) {
 1294|       |         This is the case when the initial equitable partitioning does not produce
 1295|       |         constitutionally equivalent classes of atoms.
 1296|       |         Rebuild nSymmRank[] according to the new nCurrRank[] := nTempRank[]
 1297|       |         For such structures the found canonical numbers of the constitutionally equivalent atoms
 1298|       |         are not contiguous (see nCanonRank and nSymmRank examples below). Here arrays
 1299|       |         nCurrRank, nAtomNumber, and nSymmRank are changed so that later the
 1300|       |         contiguous canonical numbers for equivalent atoms can be obtained
 1301|       |         (see GetCanonRanking under
 1302|       |         "III. Get final canonical numbering (no stereo, no isotopic)".
 1303|       |
 1304|       |         Example: for CAS=37520-11-9 (ID=21247: Ethane, 1,2-dicyclopropyl-),
 1305|       |
 1306|       |                     the numbers are the "final canon. numbers, nCanonRank"
 1307|       |          1
 1308|       |
 1309|       |          HC   7    5         3
 1310|       |           | \
 1311|       |           |  >CH--CH2        CH
 1312|       |           | /       \      / |
 1313|       |          HC        H2C--CH<  |
 1314|       |                            \ |
 1315|       |          2          6    8   CH
 1316|       |
 1317|       |                              4
 1318|       |
 1319|       |         the arrays (arranged according to ordering in nAtomNumberTemp) are:
 1320|       |                                 before SortedEquInfoToRanks  after SortedRanksToEquInfo
 1321|       |         orig. atom nos.,nAtomNumberTemp:  {4 5 6 7 0 1 2 3}   {4 5 6 7 0 1 2 3}
 1322|       |         order numbers for sorted  ranks:  {0 1 2 3 4 5 6 7}   {0 1 2 3 4 5 6 7}
 1323|       |         canonical numbering, nCanonRank:  {1 2 5 6 3 4 7 8}   {1 2 5 6 3 4 7 8}
 1324|       |         constit. equivalence, nSymmRank:  {1 1 1 1 3 3 7 7}   {1 1 1 1 5 5 7 7} used later
 1325|       |         initial equivalence,  nCurrRank:  {6 6 6 6 6 6 8 8}   {4 4 4 4 6 6 8 8} used later
 1326|       |         initial numbering,  nAtomNumber:  {2 3 4 7 0 1 6 7}   {0 1 2 3 4 5 6 7} used later
 1327|       |         final, no stereo, no isotopic, after  III. GetCanonRanking:
 1328|       |         final canon. numbers, nCanonRank:                     {1 2 3 4 5 6 7 8} final
 1329|       |    }
 1330|       |    ----------------------------------------------------------------------------------*/
 1331|   110k|    if (bChangeCurrRank)
  ------------------
  |  Branch (1331:9): [True: 0, False: 110k]
  ------------------
 1332|      0|    {
 1333|      0|        memcpy( nCurrRank, nTempRank, num_at_tg * sizeof( nCurrRank[0] ) );
 1334|      0|    }
 1335|   110k|    if (bChangeSymmRank)
  ------------------
  |  Branch (1335:9): [True: 0, False: 110k]
  ------------------
 1336|      0|    {
 1337|      0|        SortedRanksToEquInfo( nSymmRank/*out*/, nTempRank/*inp*/, nAtomNumber, num_at_tg );
 1338|      0|    }
 1339|   110k|    if (bChanged)
  ------------------
  |  Branch (1339:9): [True: 110k, False: 0]
  ------------------
 1340|   110k|    {
 1341|   110k|        *bChanged = ( 0 != bChangeSymmRank ) | 2 * ( 0 != bChangeCurrRank );
 1342|   110k|    }
 1343|       |
 1344|   110k|    return nNumDiffRanks;
 1345|   110k|}
Canon_INChI3:
 1364|   110k|{
 1365|       |
 1366|       |/****************************************************************
 1367|       |
 1368|       |0.    Initiation, Prepare initial ranks for GetCanonRanking()
 1369|       |
 1370|       |I.    Find constitutionally equivalent atoms and possibly canonical numbering
 1371|       |I.1      Set tautomer=On, stereo=isotopic=Off
 1372|       |I.2      GetCanonRanking(): Find constitutionally equivalent atoms and possibly canonical numbering
 1373|       |1.3      Fix canonical equivalence info if needed (if the fix is needed then the numbering is not canonical)
 1374|       |
 1375|       |II.   Get final non-isotopic canonical numbering. Simultaneously obtain non-minimal isotopic and stereo CTs
 1376|       |         GetCanonRanking() with pCS->bKeepSymmRank = 1
 1377|       |         FillOutStereoParities() (create initial stereo descriptors)
 1378|       |         save non-isotopic canonicalization final results
 1379|       |         hide isotopic and tautomeric results (for historical reasons only)
 1380|       |
 1381|       |
 1382|       |III.  Find constitutionally equivalent isotopic atoms (for isotopic stereo canonicalization)
 1383|       |III.1    Allocate more memory
 1384|       |III.2    fill allocated memory with the initial data
 1385|       |III.3    duplicate, save old and add isotopic info to the new pCS->t_group_info
 1386|       |III.4    Prepare initial isotopic ranks for GetCanonRanking()
 1387|       |III.5    GetCanonRanking() to Find constitutionally equivalent ISOTOPIC atoms and tautomer groups
 1388|       |III.6    Fix canonical isotopic equivalence information and derive ranks out of it
 1389|       |
 1390|       |IV.      Prepare a second Rank/AtomNumber Stack for mapping.
 1391|       |
 1392|       |V.    Optimize isotopic part (optimized)
 1393|       |         map_isotopic_atoms2()
 1394|       |         save isotopic canonical numbering
 1395|       |
 1396|       |VI.   Optimize stereo descriptors (optimized)
 1397|       |         map_stereo_bonds4()
 1398|       |
 1399|       |
 1400|       |VII. Optimize isotopic stereo descriptors (optimized)
 1401|       |         SwitchAtomStereoAndIsotopicStereo()
 1402|       |         SetCtToIsotopicStereo()
 1403|       |         FillOutStereoParities()
 1404|       |         SetUseAtomForStereo()
 1405|       |         map_stereo_bonds4()
 1406|       |
 1407|       |         SwitchAtomStereoAndIsotopicStereo()
 1408|       |         SetCtToNonIsotopicStereo()
 1409|       |
 1410|       |
 1411|       |
 1412|       |
 1413|       |*****************************************************************/
 1414|       |
 1415|   110k|    int     nRet = 0, i, n;
 1416|       |
 1417|       |
 1418|       |    /********************************************************
 1419|       |              input non-stereo canonical info
 1420|       |     ********************************************************/
 1421|   110k|    BCN            *pBCN = pCS->pBCN;
 1422|   110k|    FTCN           *ftcn = pBCN->ftcn + bTautFtcn;
 1423|       |
 1424|       |    /********************************************************
 1425|       |              set mode flags
 1426|       |     ********************************************************/
 1427|       |
 1428|       |    /* tautomeric structure */
 1429|   110k|    int bTaut = ( num_at_tg > num_atoms ) && pCS->t_group_info && pCS->t_group_info->num_t_groups && pCS->t_group_info->t_group;
  ------------------
  |  Branch (1429:17): [True: 4, False: 110k]
  |  Branch (1429:46): [True: 4, False: 0]
  |  Branch (1429:67): [True: 4, False: 0]
  |  Branch (1429:102): [True: 4, False: 0]
  ------------------
 1430|       |
 1431|       |    /* special case: induced by exchangable isotopic H inequivalence of atoms in formally non-tautomeric structure */
 1432|   110k|    int bIsoXchgH = pCS->t_group_info && pCS->t_group_info->nNumIsotopicEndpoints > 1 &&
  ------------------
  |  Branch (1432:21): [True: 110k, False: 3]
  |  Branch (1432:42): [True: 0, False: 110k]
  ------------------
 1433|   110k|        pCS->t_group_info->nIsotopicEndpointAtomNumber && pCS->t_group_info->nIsotopicEndpointAtomNumber[0] &&
  ------------------
  |  Branch (1433:9): [True: 0, False: 0]
  |  Branch (1433:59): [True: 0, False: 0]
  ------------------
 1434|   110k|        ( pCS->t_group_info->bTautFlagsDone & ( TG_FLAG_FOUND_ISOTOPIC_H_DONE | TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE ) )
  ------------------
  |  |  978|      0|#define TG_FLAG_FOUND_ISOTOPIC_H_DONE    0x00004000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
                      ( pCS->t_group_info->bTautFlagsDone & ( TG_FLAG_FOUND_ISOTOPIC_H_DONE | TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE ) )
  ------------------
  |  |  979|      0|#define TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE 0x00008000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
  |  Branch (1434:9): [True: 0, False: 0]
  ------------------
 1435|   110k|        /* && (ftcn->nCanonFlags & CANON_FLAG_ISO_TAUT_DIFF)*/;
 1436|   110k|    int bHasIsotopicCanonData = ( ftcn->PartitionCtIso.AtNumber && ftcn->PartitionCtIso.Rank && ftcn->nSymmRankCtIso );
  ------------------
  |  Branch (1436:35): [True: 47, False: 109k]
  |  Branch (1436:68): [True: 47, False: 0]
  |  Branch (1436:97): [True: 47, False: 0]
  ------------------
 1437|       |
 1438|       |    /* bHasIsotopicCanonData==0 means
 1439|       |     *       (1) No isotopic atoms in the component OR
 1440|       |     *       (2) the component has only exchangable isotopic H that do not change canonical numbering and equivalence.
 1441|       |     */
 1442|   110k|    T_GROUP_INFO *t_group_info1 = bTaut ? pCS->t_group_info : NULL;
  ------------------
  |  Branch (1442:35): [True: 4, False: 110k]
  ------------------
 1443|       |
 1444|       |    /*int bIsoXchgH = t_group_info1 && t_group_info1->nNumIsotopicEndpoints && t_group_info1->nIsotopicEndpointAtomNumber;*/
 1445|       |    /* isotopic canonicalization */
 1446|   110k|    int bCanonIsotopic = bHasIsotopicCanonData && ( nMode & CMODE_ISO ) && ( pCS->LinearCTIsotopic || pCS->LinearCTIsotopicTautomer || bIsoXchgH );
  ------------------
  |  |  773|     47|#define CMODE_ISO                0x000002
  ------------------
  |  Branch (1446:26): [True: 47, False: 109k]
  |  Branch (1446:51): [True: 47, False: 0]
  |  Branch (1446:78): [True: 47, False: 0]
  |  Branch (1446:103): [True: 0, False: 0]
  |  Branch (1446:136): [True: 0, False: 0]
  ------------------
 1447|       |
 1448|       |    /* stereo canonicalization */
 1449|   110k|    int bCanonStereo = ( nMode & CMODE_STEREO ) && ( pCS->LinearCTStereoDble || pCS->LinearCTStereoCarb );
  ------------------
  |  |  775|   110k|#define CMODE_STEREO             0x000008
  ------------------
  |  Branch (1449:24): [True: 0, False: 110k]
  |  Branch (1449:54): [True: 0, False: 0]
  |  Branch (1449:81): [True: 0, False: 0]
  ------------------
 1450|       |
 1451|       |    /* stereo isotopic canonicalization */
 1452|   110k|    int bCanonIsoStereo = bHasIsotopicCanonData && ( nMode & CMODE_ISO_STEREO ) && ( pCS->LinearCTIsotopicStereoDble || pCS->LinearCTIsotopicStereoCarb ) && bCanonIsotopic;
  ------------------
  |  |  776|     47|#define CMODE_ISO_STEREO         0x000010
  ------------------
  |  Branch (1452:27): [True: 47, False: 109k]
  |  Branch (1452:52): [True: 0, False: 47]
  |  Branch (1452:86): [True: 0, False: 0]
  |  Branch (1452:121): [True: 0, False: 0]
  |  Branch (1452:158): [True: 0, False: 0]
  ------------------
 1453|   110k|    int bIsoTaut = ( bTaut && bCanonIsotopic );
  ------------------
  |  Branch (1453:22): [True: 4, False: 110k]
  |  Branch (1453:31): [True: 2, False: 2]
  ------------------
 1454|       |
 1455|   110k|    int            bIgnoreIsotopicInputGroups;
 1456|   110k|    int            bIgnoreIsotopicInputAtoms;
 1457|       |
 1458|   110k|    AT_RANK       **pRankStack1 = pBCN->pRankStack;
 1459|   110k|    int             nRankStackLen = pBCN->nMaxLenRankStack;
 1460|   110k|    int             num_max = pBCN->num_max;     /* allocation lengths in *pRankStack1[] */
 1461|   110k|    NEIGH_LIST     *NeighList = ftcn->NeighList;
 1462|       |
 1463|   110k|    int             nNumCurrRanks = 0;
 1464|   110k|    AT_RANK        *nTempRank = NULL;
 1465|       |
 1466|   110k|    AT_RANK        *nSymmRank = NULL;
 1467|       |
 1468|   110k|    AT_RANK        *nAtomNumber = NULL;
 1469|   110k|    AT_RANK        *nRank = NULL;
 1470|       |
 1471|   110k|    AT_RANK       **pRankStack2 = NULL;
 1472|   110k|    AT_RANK        *nCanonRankStereo = NULL;
 1473|   110k|    AT_RANK        *nCanonRankStereoInv = NULL;
 1474|   110k|    AT_RANK        *nSymmStereo = NULL;
 1475|       |
 1476|   110k|    AT_RANK        *nCanonRankIsotopicStereo = NULL;
 1477|   110k|    AT_RANK        *nCanonRankIsotopicStereoInv = NULL;
 1478|       |
 1479|   110k|    CUR_TREE *cur_tree = NULL;
 1480|   110k|    CUR_TREE CurrentTree;
 1481|       |
 1482|       |
 1483|       |    /*AT_ISO_TGROUP  *LinearCTIsotopicTautomer  = NULL; */
 1484|       |
 1485|       |
 1486|   110k|    CANON_STAT   CS2;
 1487|   110k|    CANON_STAT* pCS2 = &CS2;
 1488|       |
 1489|   110k|    inchiTime   ulStartTime, ulEndTime;
 1490|       |    /*=========== Mode Bits (low 8 bits, bit 0 is Least Significant Bit) ===========
 1491|       |
 1492|       |      Mode      Bits       Description
 1493|       |       '0' c    0          Only one connection table canonicalization
 1494|       |       '1' C    1          Recalculate CT using fixed nSymmRank
 1495|       |       '2' i    1|2        Isotopic canonicalization (internal)
 1496|       |       '3' I    1|2|4      Isotopic canonicalization (output)
 1497|       |       '4' s    1|8        Stereo canonicalization
 1498|       |       '5' S    1|2|4|16   Stereo isotopic canonicalization
 1499|       |       '6' A    1|2|4|8|16 Output All
 1500|       |
 1501|       |      --- high 8 bits ----
 1502|       |      --- obsolete, only historical interest. ------
 1503|       |      1-2 : 0 => at[i].init_rank from Morgan+NeighList
 1504|       |            1 => at[i].init_rank from Atom Invariants
 1505|       |            2 => at[i].init_rank from nSymmRank[]
 1506|       |                 (at[i].init_rank is included in LinearCT
 1507|       |                       depending on CT_ATOMID definition)
 1508|       |      3   : 1 => Get Stereo canonical info
 1509|       |      4   : 1 => Get Isotopic canonical info
 1510|       |      5   : 1 => Get Charge/Radical canonical info
 1511|       |    ==================================================================*/
 1512|       |    /*int             nOutputMode = 0;*/ /* obsolete */
 1513|       |
 1514|       |
 1515|   110k|    int bSwitchedAtomToIsotopic = 0;
 1516|       |
 1517|       |
 1518|       |    /* vABParityUnknown holds actual value of an internal constant signifying       */
 1519|       |    /* unknown parity: either the same as for undefined parity (default==standard)  */
 1520|       |    /*  or a specific one (non-std; requested by SLUUD switch).                     */
 1521|   110k|    int vABParityUnknown = AB_PARITY_UNDF;
  ------------------
  |  |  250|   110k|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 1522|   110k|    if (0 != ( nMode & REQ_MODE_DIFF_UU_STEREO ))
  ------------------
  |  |   68|   110k|#define REQ_MODE_DIFF_UU_STEREO     0x004000    /* SLUUD Make labels for unknown and undefined stereo different */
  ------------------
  |  Branch (1522:9): [True: 0, False: 110k]
  ------------------
 1523|      0|    {
 1524|       |        /* Make labels for unknown and undefined stereo different */
 1525|      0|        vABParityUnknown = AB_PARITY_UNKN;
  ------------------
  |  |  249|      0|#define AB_PARITY_UNKN   3  /* 3 => user marked as unknown parity */
  ------------------
 1526|      0|    }
 1527|       |
 1528|   110k|    InchiTimeGet( &ulStartTime );
 1529|       |
 1530|   110k|    *pCS2 = *pCS;  /* save input information and pointers to allocated memory */
 1531|       |
 1532|       |    /* Set "ignore isotopic differences in tautomer groups" true */
 1533|   110k|    if (bTaut)
  ------------------
  |  Branch (1533:9): [True: 4, False: 110k]
  ------------------
 1534|      4|    {
 1535|       |        /* save request for isotopic tautomeric groups */
 1536|      4|        bIgnoreIsotopicInputGroups = pCS->t_group_info->bIgnoreIsotopic;
 1537|      4|        pCS->t_group_info->bIgnoreIsotopic = 1;
 1538|      4|    }
 1539|   110k|    else
 1540|   110k|    {
 1541|   110k|        bIgnoreIsotopicInputGroups = 1;
 1542|   110k|    }
 1543|       |    /* Save request for isotopic name */
 1544|   110k|    bIgnoreIsotopicInputAtoms = pCS->bIgnoreIsotopic;
 1545|       |    /* set "ignore isotopic differences in atoms" true */
 1546|   110k|    pCS->bIgnoreIsotopic = 1;
 1547|       |
 1548|       |
 1549|       |    /* Save non-isotopic and isotopic canonicalization results */
 1550|   110k|    pCS->nCanonFlags = ftcn->nCanonFlags;
 1551|       |    /* 1. non-isotopic */
 1552|       |
 1553|       |    /* linear CT, H */
 1554|   110k|    memcpy( pCS->LinearCT, ftcn->LinearCt, ftcn->nLenLinearCt * sizeof( pCS->LinearCT[0] ) );
 1555|   110k|    if (pCS->nNum_H && ftcn->nNumH)
  ------------------
  |  Branch (1555:9): [True: 110k, False: 0]
  |  Branch (1555:24): [True: 110k, False: 0]
  ------------------
 1556|   110k|    {
 1557|   222k|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1557:21): [True: 112k, False: 110k]
  ------------------
 1558|   112k|        {
 1559|   112k|            pCS->nNum_H[i] = /*(S_CHAR)*/( CHAR_MASK & ftcn->nNumH[i] );
  ------------------
  |  |   47|   112k|#define CHAR_MASK  0xFF
  ------------------
 1560|   112k|        }
 1561|   110k|    }
 1562|   110k|    if (pCS->nNum_H_fixed && ftcn->nNumHFixH)
  ------------------
  |  Branch (1562:9): [True: 110k, False: 0]
  |  Branch (1562:30): [True: 3, False: 110k]
  ------------------
 1563|      3|    {
 1564|     14|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1564:21): [True: 11, False: 3]
  ------------------
 1565|     11|        {
 1566|     11|            pCS->nNum_H_fixed[i] = /*(S_CHAR)*/( CHAR_MASK & ftcn->nNumHFixH[i] );
  ------------------
  |  |   47|     11|#define CHAR_MASK  0xFF
  ------------------
 1567|     11|        }
 1568|      3|    }
 1569|   110k|    pCS->nLenLinearCT = ftcn->nLenLinearCt;
 1570|   110k|    pCS->nLenLinearCTAtOnly = ftcn->nLenLinearCtAtOnly;
 1571|       |
 1572|       |    /* save non-isotopic atoms equivalence and numbering */
 1573|   110k|    if (pCS->nSymmRank)
  ------------------
  |  Branch (1573:9): [True: 110k, False: 0]
  ------------------
 1574|   110k|    {
 1575|   110k|        memcpy( pCS->nSymmRank, ftcn->nSymmRankCt, num_at_tg * sizeof( pCS->nSymmRank[0] ) );
 1576|   110k|    }
 1577|   110k|    if (pCS->nCanonOrd)
  ------------------
  |  Branch (1577:9): [True: 110k, False: 0]
  ------------------
 1578|   110k|    {
 1579|   110k|        memcpy( pCS->nCanonOrd, ftcn->PartitionCt.AtNumber, num_at_tg * sizeof( pCS->nCanonOrd[0] ) );
 1580|   110k|        pCS->nLenCanonOrd = num_atoms;
 1581|   110k|    }
 1582|   110k|    if (ftcn->iso_exchg_atnos && pCS->nExchgIsoH)
  ------------------
  |  Branch (1582:9): [True: 0, False: 110k]
  |  Branch (1582:34): [True: 0, False: 0]
  ------------------
 1583|      0|    {
 1584|      0|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1584:21): [True: 0, False: 0]
  ------------------
 1585|      0|        {
 1586|      0|            pCS->nExchgIsoH[i] = !ftcn->iso_exchg_atnos[i]; /* (pCS->nExchgIsoH[i]==1) => tautomeric or hetero atoms that may exchange isotopic H */
 1587|      0|        }
 1588|      0|    }
 1589|       |    /* 2. isotopic */
 1590|       |
 1591|   110k|    if (bCanonIsotopic)
  ------------------
  |  Branch (1591:9): [True: 47, False: 109k]
  ------------------
 1592|     47|    {
 1593|       |        /* linear CT, num_H are same as non-isotopic */
 1594|       |        /* save atoms equivalence and numbering */
 1595|     47|        if (pCS->nSymmRankIsotopic)
  ------------------
  |  Branch (1595:13): [True: 47, False: 0]
  ------------------
 1596|     47|        {
 1597|     47|            memcpy( pCS->nSymmRankIsotopic, ftcn->nSymmRankCtIso, num_at_tg * sizeof( pCS->nSymmRankIsotopic[0] ) );
 1598|     47|        }
 1599|     47|        if (pCS->nCanonOrdIsotopic)
  ------------------
  |  Branch (1599:13): [True: 47, False: 0]
  ------------------
 1600|     47|        {
 1601|     47|            memcpy( pCS->nCanonOrdIsotopic, ftcn->PartitionCtIso.AtNumber, num_at_tg * sizeof( pCS->nCanonOrdIsotopic[0] ) );
 1602|     47|            pCS->nLenCanonOrdIsotopic = num_at_tg;
 1603|     47|        }
 1604|       |
 1605|     47|        nRet = FillIsotopicAtLinearCT( num_atoms, at,
 1606|     47|                                       ftcn->PartitionCtIso.AtNumber,
 1607|     47|                                       pCS->LinearCTIsotopic,
 1608|     47|                                       pCS->nMaxLenLinearCTIsotopic,
 1609|     47|                                       &pCS->nLenLinearCTIsotopic );
 1610|       |
 1611|     47|        if (RETURNED_ERROR( nRet ))
  ------------------
  |  |   72|     47|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   68|     47|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   66|     47|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|     47|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   69|     47|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   46|     47|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (72:31): [True: 47, False: 0]
  |  |  |  Branch (72:53): [True: 0, False: 47]
  |  |  ------------------
  ------------------
 1612|      0|        {
 1613|      0|            goto exit_function;
 1614|      0|        }
 1615|     47|        if (nRet < 0)
  ------------------
  |  Branch (1615:13): [True: 0, False: 47]
  ------------------
 1616|      0|        {
 1617|      0|            nRet = CT_TAUCOUNT_ERR;
  ------------------
  |  |   52|      0|#define CT_TAUCOUNT_ERR      (CT_ERR_FIRST- 5)  /*(-30005) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1618|      0|            goto exit_function;
 1619|      0|        }
 1620|     47|    }
 1621|   109k|    else
 1622|   109k|    {
 1623|   109k|        pCS->nMaxLenLinearCTIsotopic = 0;
 1624|   109k|        pCS->nMaxLenLinearCTIsotopicTautomer = 0;
 1625|   109k|    }
 1626|       |
 1627|       |    /* fill out tautomeric groups, isotopic and non-isotopic tautomeric CT and t_group_info1->tGroupNumber */
 1628|   110k|    if (bTaut)
  ------------------
  |  Branch (1628:9): [True: 4, False: 110k]
  ------------------
 1629|      4|    {
 1630|      4|        bIsoTaut = bIsoTaut && ftcn->PartitionCtIso.Rank &&
  ------------------
  |  Branch (1630:20): [True: 2, False: 2]
  |  Branch (1630:32): [True: 2, False: 0]
  ------------------
 1631|      4|            ftcn->PartitionCtIso.AtNumber && ftcn->nSymmRankCtIso;
  ------------------
  |  Branch (1631:13): [True: 2, False: 0]
  |  Branch (1631:46): [True: 2, False: 0]
  ------------------
 1632|       |
 1633|      4|        nRet = FillTautLinearCT2( pCG, num_atoms, num_at_tg, bIsoTaut,
 1634|      4|                ftcn->PartitionCt.Rank, ftcn->PartitionCt.AtNumber, ftcn->nSymmRankCt,
 1635|      4|                ftcn->PartitionCtIso.Rank, ftcn->PartitionCtIso.AtNumber, ftcn->nSymmRankCtIso,
 1636|      4|                pCS->LinearCTTautomer, pCS->nMaxLenLinearCTTautomer, &pCS->nLenLinearCTTautomer,
 1637|      4|                pCS->LinearCTIsotopicTautomer, pCS->nMaxLenLinearCTIsotopicTautomer, &pCS->nLenLinearCTIsotopicTautomer,
 1638|      4|                t_group_info1 );
 1639|       |
 1640|      4|        if (RETURNED_ERROR( nRet ))
  ------------------
  |  |   72|      4|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   68|      4|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   66|      4|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|      4|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   69|      4|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   46|      4|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (72:31): [True: 4, False: 0]
  |  |  |  Branch (72:53): [True: 0, False: 4]
  |  |  ------------------
  ------------------
 1641|      0|        {
 1642|      0|            goto exit_function;
 1643|      0|        }
 1644|      4|        if (nRet <= 0)
  ------------------
  |  Branch (1644:13): [True: 0, False: 4]
  ------------------
 1645|      0|        {
 1646|      0|            nRet = CT_TAUCOUNT_ERR;
  ------------------
  |  |   52|      0|#define CT_TAUCOUNT_ERR      (CT_ERR_FIRST- 5)  /*(-30005) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1647|      0|            goto exit_function;
 1648|      0|        }
 1649|      4|        else
 1650|      4|        {
 1651|       |            /* tautomeric groups: save non-isotopic symmetry & t_group order */
 1652|      4|            int num_t_groups = t_group_info1->num_t_groups;
 1653|      4|            AT_NUMB *tGroupNumber = t_group_info1->tGroupNumber;
 1654|      4|            AT_NUMB *tSymmRank = tGroupNumber + TGSO_SYMM_RANK*num_t_groups;
  ------------------
  |  |  166|      4|#define TGSO_SYMM_RANK   1  /* tSymmRank:     symmetry ranks (no isotopes) = min. ordering number > 0. */
  ------------------
 1655|      4|            if (pCS->nSymmRankTaut)
  ------------------
  |  Branch (1655:17): [True: 4, False: 0]
  ------------------
 1656|      4|            {
 1657|      4|                memcpy( pCS->nSymmRankTaut, tSymmRank, num_t_groups * sizeof( pCS->nSymmRank[0] ) ); /* fixed 5-23-02 */
 1658|      4|            }
 1659|      4|            if (pCS->nCanonOrdTaut)
  ------------------
  |  Branch (1659:17): [True: 4, False: 0]
  ------------------
 1660|      4|            {
 1661|      4|                memcpy( pCS->nCanonOrdTaut, tGroupNumber, num_t_groups * sizeof( pCS->nCanonOrdTaut[0] ) );
 1662|      4|                pCS->nLenCanonOrdTaut = num_t_groups;
 1663|      4|            }
 1664|      4|            if (bCanonIsotopic /*&& pCS->nLenLinearCTIsotopicTautomer*/)
  ------------------
  |  Branch (1664:17): [True: 2, False: 2]
  ------------------
 1665|      2|            {
 1666|       |                /* tautomeric groups: save isotopic symmetry & t_group order */
 1667|       |                /*AT_NUMB ntRankOffset       = (AT_RANK)num_atoms;*/
 1668|      2|                AT_NUMB *tiSymmRank = tGroupNumber + TGSO_SYMM_IRANK*num_t_groups;
  ------------------
  |  |  168|      2|#define TGSO_SYMM_IRANK  3  /* tiSymmRank:    isotopic symmetry ranks */
  ------------------
 1669|      2|                AT_NUMB *tiGroupNumber = tGroupNumber + TGSO_SYMM_IORDER*num_t_groups;
  ------------------
  |  |  167|      2|#define TGSO_SYMM_IORDER 2  /* tiGroupNumber: isotopic symmetry rank sorting order */
  ------------------
 1670|      2|                if (pCS->nSymmRankIsotopicTaut)
  ------------------
  |  Branch (1670:21): [True: 2, False: 0]
  ------------------
 1671|      2|                {
 1672|      2|                    memcpy( pCS->nSymmRankIsotopicTaut, tiSymmRank, num_t_groups * sizeof( pCS->nSymmRankIsotopicTaut[0] ) );
 1673|      2|                }
 1674|      2|                memcpy( pCS->nCanonOrdIsotopicTaut, tiGroupNumber, num_t_groups * sizeof( pCS->nCanonOrdIsotopicTaut[0] ) );
 1675|      2|                pCS->nLenCanonOrdIsotopicTaut = num_t_groups;
 1676|      2|            }
 1677|      4|        }
 1678|      4|    }
 1679|       |    /* save connection table if requested */
 1680|   110k|    if (pCS->LinearCT2)
  ------------------
  |  Branch (1680:9): [True: 110k, False: 0]
  ------------------
 1681|   110k|    {
 1682|   110k|        memcpy( pCS->LinearCT2, pCS->LinearCT, sizeof( pCS->LinearCT2[0] )*pCS->nLenLinearCT );
 1683|   110k|        pCS->nLenLinearCT2 = pCS->nLenLinearCT;
 1684|   110k|        pCS->nLenLinearCTAtOnly2 = pCS->nLenLinearCTAtOnly;
 1685|   110k|    }
 1686|       |
 1687|   110k|    if (num_atoms <= 1)
  ------------------
  |  Branch (1687:9): [True: 109k, False: 806]
  ------------------
 1688|   109k|    {
 1689|   109k|        bCanonStereo = 0;  /* a sinle atom + possibly terminal hydrogen atoms */
 1690|   109k|        if (num_atoms < 1 || !at[0].parity2)
  ------------------
  |  Branch (1690:13): [True: 0, False: 109k]
  |  Branch (1690:30): [True: 109k, False: 0]
  ------------------
 1691|   109k|        {
 1692|   109k|            bCanonIsoStereo = 0;  /*  structure; for example Cl- or CH4 */
 1693|   109k|        }
 1694|   109k|    }
 1695|       |
 1696|   110k|    if (!bCanonStereo && !( bCanonIsotopic && bCanonIsoStereo ))
  ------------------
  |  Branch (1696:9): [True: 110k, False: 0]
  |  Branch (1696:29): [True: 47, False: 109k]
  |  Branch (1696:47): [True: 0, False: 47]
  ------------------
 1697|   110k|    {
 1698|   110k|        goto exit_function; /* skip stereo canonicalization */
 1699|   110k|    }
 1700|       |
 1701|       |
 1702|       |
 1703|       |    /**********************************************************
 1704|       |                     Mode
 1705|       |    ***********************************************************/
 1706|      0|    nMode = nMode & CANON_MODE_MASK;
  ------------------
  |  |  795|      0|#define CANON_MODE_MASK       0x00FF  /* used to determine canonicalization mode */
  ------------------
 1707|       |
 1708|       |    /* memory allocation */
 1709|       |
 1710|      0|    nAtomNumber = (AT_RANK *) qmalloc( num_max * sizeof( *nAtomNumber ) );
  ------------------
  |  | 1148|      0|#define qmalloc(X) inchi_malloc(X)
  |  |  ------------------
  |  |  |  | 1130|      0|#define inchi_malloc   malloc
  |  |  ------------------
  ------------------
 1711|      0|    nRank = (AT_RANK *) qmalloc( num_max * sizeof( *nRank ) );
  ------------------
  |  | 1148|      0|#define qmalloc(X) inchi_malloc(X)
  |  |  ------------------
  |  |  |  | 1130|      0|#define inchi_malloc   malloc
  |  |  ------------------
  ------------------
 1712|      0|    nTempRank = (AT_RANK *) qmalloc( num_max * sizeof( *nTempRank ) );
  ------------------
  |  | 1148|      0|#define qmalloc(X) inchi_malloc(X)
  |  |  ------------------
  |  |  |  | 1130|      0|#define inchi_malloc   malloc
  |  |  ------------------
  ------------------
 1713|      0|    nSymmRank = (AT_RANK *) qmalloc( num_max * sizeof( *nSymmRank ) );
  ------------------
  |  | 1148|      0|#define qmalloc(X) inchi_malloc(X)
  |  |  ------------------
  |  |  |  | 1130|      0|#define inchi_malloc   malloc
  |  |  ------------------
  ------------------
 1714|       |
 1715|       |    /***********************************************
 1716|       |                0.1 Initialization
 1717|       |    ************************************************/
 1718|       |
 1719|       |
 1720|      0|    if (!NeighList || !nAtomNumber || !nTempRank ||
  ------------------
  |  Branch (1720:9): [True: 0, False: 0]
  |  Branch (1720:23): [True: 0, False: 0]
  |  Branch (1720:39): [True: 0, False: 0]
  ------------------
 1721|      0|         !nRank || !pCS->LinearCT)
  ------------------
  |  Branch (1721:10): [True: 0, False: 0]
  |  Branch (1721:20): [True: 0, False: 0]
  ------------------
 1722|      0|    {
 1723|      0|        nRet = CT_OUT_OF_RAM;  /* program error */  /*  <BRKPT> */
  ------------------
  |  |   49|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1724|      0|        goto exit_function;
 1725|      0|    }
 1726|       |
 1727|      0|    pCS->NeighList = NeighList;
 1728|       |
 1729|      0|    *pCS2 = *pCS;  /* save input information and pointers to allocated memory */
 1730|       |
 1731|      0|    if (!( nMode & CMODE_NOEQ_STEREO ) && ( bCanonStereo || bCanonIsoStereo ))
  ------------------
  |  |  778|      0|#define CMODE_NOEQ_STEREO        0x000040 /* 5-24-2002: do not use stereo equivalence to accelerate */
  ------------------
  |  Branch (1731:9): [True: 0, False: 0]
  |  Branch (1731:45): [True: 0, False: 0]
  |  Branch (1731:61): [True: 0, False: 0]
  ------------------
 1732|      0|    {
 1733|       |        /* will be used to discover vertex equivalences in stereo canonicalization */
 1734|      0|        memset( &CurrentTree, 0, sizeof( CurrentTree ) );
 1735|      0|        cur_tree = &CurrentTree;
 1736|      0|    }
 1737|       |
 1738|       |
 1739|      0|    pCS->bCmpStereo = 0;
 1740|      0|    pCS->bCmpIsotopicStereo = 0;
 1741|       |
 1742|       |
 1743|      0|    if (bCanonStereo || bCanonIsoStereo)
  ------------------
  |  Branch (1743:9): [True: 0, False: 0]
  |  Branch (1743:25): [True: 0, False: 0]
  ------------------
 1744|      0|    {
 1745|      0|        int ii, nn;
 1746|       |
 1747|       |        /* stereo or isotopic canonicalization: we need a second set of ranks for mapping */
 1748|       |        /* (isotopic atoms or stereo can only increase nNumCurrRanks) */
 1749|      0|        pRankStack2 = (AT_RANK **) inchi_calloc( nRankStackLen, sizeof( AT_RANK * ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 1750|      0|        if (pRankStack2)
  ------------------
  |  Branch (1750:13): [True: 0, False: 0]
  ------------------
 1751|      0|        {
 1752|       |            /* prepare for ranks reuse */
 1753|      0|            for (nn = 2; nn < nRankStackLen && pRankStack1[nn]; nn++)
  ------------------
  |  Branch (1753:26): [True: 0, False: 0]
  |  Branch (1753:48): [True: 0, False: 0]
  ------------------
 1754|      0|            {
 1755|      0|                pRankStack1[nn][0] = 0; /* means ranks have to be calculated */
 1756|      0|            }
 1757|       |            /* reuse memory to reduce number of allocations: */
 1758|       |            /* move last half of pointers from pRankStack1 to pRankStack2 */
 1759|       |            /* The first 2 elements will be assigned separately */
 1760|      0|            if (( nn = ( nn - 2 ) / 2 ) > 0)
  ------------------
  |  Branch (1760:17): [True: 0, False: 0]
  ------------------
 1761|      0|            {
 1762|      0|                for (ii = 2 + nn; ii < nRankStackLen && pRankStack1[ii]; ii++)
  ------------------
  |  Branch (1762:35): [True: 0, False: 0]
  |  Branch (1762:57): [True: 0, False: 0]
  ------------------
 1763|      0|                {
 1764|      0|                    pRankStack2[ii - nn] = pRankStack1[ii];
 1765|      0|                    pRankStack1[ii] = NULL;
 1766|      0|                }
 1767|      0|            }
 1768|      0|        }
 1769|      0|        else
 1770|      0|        {
 1771|      0|            nRet = CT_OUT_OF_RAM;  /*  <BRKPT> */
  ------------------
  |  |   49|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1772|      0|            goto exit_function; /* program error */
 1773|      0|        }
 1774|      0|    }
 1775|       |
 1776|      0|    if (bCanonStereo)
  ------------------
  |  Branch (1776:9): [True: 0, False: 0]
  ------------------
 1777|      0|    {
 1778|       |
 1779|       |       /* *pCS2 = *pCS; */ /* save input information and pointers to allocated memory */
 1780|       |
 1781|       |        /* initial ranking for non-isotopic mapping */
 1782|      0|        memcpy( nAtomNumber, ftcn->PartitionCt.AtNumber, num_at_tg * sizeof( nAtomNumber[0] ) );
 1783|      0|        memcpy( nRank, ftcn->PartitionCt.Rank, num_at_tg * sizeof( nRank[0] ) );
 1784|      0|        memcpy( nSymmRank, ftcn->nSymmRankCt, num_at_tg * sizeof( nSymmRank[0] ) );
 1785|       |
 1786|       |        /* nSymmRank changes if canonical numbers of constitutionally equivalent atoms are not contiguous */
 1787|      0|        nNumCurrRanks = FixCanonEquivalenceInfo( pCG, num_at_tg,
 1788|      0|                                                 nSymmRank /* in&out*/,
 1789|      0|                                                 nRank, nTempRank /* out */,
 1790|      0|                                                 nAtomNumber /* in&out */,
 1791|      0|                                                 NULL );
 1792|       |        /* atom numbers in canonical order */
 1793|      0|        memcpy( pCS->nPrevAtomNumber, ftcn->PartitionCt.AtNumber, num_at_tg * sizeof( nAtomNumber[0] ) );
 1794|       |
 1795|       |        /* fill stereo part of the connection table with initial (not optimized) parities */
 1796|       |        /* input
 1797|       |        pCS->LinearCTStereoDble
 1798|       |        pCS->LinearCTStereoCarb
 1799|       |        pCS->nMaxLenLinearCTStereoCarb
 1800|       |        pCS->nMaxLenLinearCTStereoDble
 1801|       |        */
 1802|       |
 1803|      0|        nRet = FillOutStereoParities( at, num_atoms, ftcn->PartitionCt.Rank, ftcn->PartitionCt.AtNumber,
 1804|      0|                                      nRank, nAtomNumber, pCS, pCG, 0 /* bIsotopic */ );
 1805|       |
 1806|       |        /* output
 1807|       |        pCS->LinearCTStereoDble
 1808|       |        pCS->LinearCTStereoCarb
 1809|       |        pCS2->nLenLinearCTStereoCarb
 1810|       |        pCS2->nLenLinearCTStereoDble
 1811|       |        */
 1812|       |
 1813|      0|        if (RETURNED_ERROR( nRet ))
  ------------------
  |  |   72|      0|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   68|      0|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   66|      0|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   69|      0|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (72:31): [True: 0, False: 0]
  |  |  |  Branch (72:53): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1814|      0|        {
 1815|      0|            goto exit_function;
 1816|      0|        }
 1817|      0|        if (nRet < 0)
  ------------------
  |  Branch (1817:13): [True: 0, False: 0]
  ------------------
 1818|      0|        {
 1819|      0|            nRet = CT_STEREOCOUNT_ERR;
  ------------------
  |  |   57|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1820|      0|            goto exit_function;
 1821|      0|        }
 1822|       |
 1823|       |        /***************************************************************
 1824|       |         *
 1825|       |         *  VI. Optimize non-isotopic stereo descriptors (optimized)
 1826|       |         *
 1827|       |         ***************************************************************/
 1828|       |
 1829|       |        /* allocate memory for stereo canonicalization */
 1830|       |
 1831|      0|        if (!nCanonRankStereo)
  ------------------
  |  Branch (1831:13): [True: 0, False: 0]
  ------------------
 1832|      0|        {
 1833|      0|            nCanonRankStereo = (AT_RANK *) qmalloc( num_max * sizeof( *nCanonRankStereo ) );
  ------------------
  |  | 1148|      0|#define qmalloc(X) inchi_malloc(X)
  |  |  ------------------
  |  |  |  | 1130|      0|#define inchi_malloc   malloc
  |  |  ------------------
  ------------------
 1834|      0|        }
 1835|      0|        if (!nSymmStereo && !( nMode & CMODE_NOEQ_STEREO ))
  ------------------
  |  |  778|      0|#define CMODE_NOEQ_STEREO        0x000040 /* 5-24-2002: do not use stereo equivalence to accelerate */
  ------------------
  |  Branch (1835:13): [True: 0, False: 0]
  |  Branch (1835:29): [True: 0, False: 0]
  ------------------
 1836|      0|        {
 1837|      0|            nSymmStereo = (AT_RANK *) qmalloc( ( num_max + 1 ) * sizeof( *nSymmStereo ) );
  ------------------
  |  | 1148|      0|#define qmalloc(X) inchi_malloc(X)
  |  |  ------------------
  |  |  |  | 1130|      0|#define inchi_malloc   malloc
  |  |  ------------------
  ------------------
 1838|      0|        }
 1839|       |
 1840|      0|        if (!( nMode & CMODE_NOEQ_STEREO ) && 0 > CurTreeAlloc( cur_tree, num_at_tg ))
  ------------------
  |  |  778|      0|#define CMODE_NOEQ_STEREO        0x000040 /* 5-24-2002: do not use stereo equivalence to accelerate */
  ------------------
  |  Branch (1840:13): [True: 0, False: 0]
  |  Branch (1840:47): [True: 0, False: 0]
  ------------------
 1841|      0|        {
 1842|      0|            nRet = CT_OUT_OF_RAM;  /*  <BRKPT> */
  ------------------
  |  |   49|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1843|      0|            goto exit_function;
 1844|      0|        }
 1845|       |        /* check allocations and assign first 2 elements of pRankStack2 */
 1846|      0|        if (pRankStack1 && pRankStack2 &&
  ------------------
  |  Branch (1846:13): [True: 0, False: 0]
  |  Branch (1846:28): [True: 0, False: 0]
  ------------------
 1847|      0|             nCanonRankStereo &&
  ------------------
  |  Branch (1847:14): [True: 0, False: 0]
  ------------------
 1848|       |             /* nCurrRankStereo  && nAtomNumberCurrStereo &&*/
 1849|      0|             ( nSymmStereo || ( nMode & CMODE_NOEQ_STEREO ) ))
  ------------------
  |  |  778|      0|#define CMODE_NOEQ_STEREO        0x000040 /* 5-24-2002: do not use stereo equivalence to accelerate */
  ------------------
  |  Branch (1849:16): [True: 0, False: 0]
  |  Branch (1849:31): [True: 0, False: 0]
  ------------------
 1850|      0|        {
 1851|      0|            pRankStack1[0] = pRankStack2[0] = nRank;
 1852|      0|            pRankStack1[1] = pRankStack2[1] = nAtomNumber;
 1853|      0|        }
 1854|      0|        else
 1855|      0|        {
 1856|      0|            nRet = CT_OUT_OF_RAM;  /*  <BRKPT> */
  ------------------
  |  |   49|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1857|      0|            goto exit_function;
 1858|      0|        }
 1859|       |
 1860|       |        /****************************************************************
 1861|       |         *
 1862|       |         *  VI-A. Optimize non-isotopic non-inverted stereo descriptors
 1863|       |         *
 1864|       |         ****************************************************************/
 1865|       |
 1866|       |        /* set the 1st ranks in the rest of the stack to zero: prepare for ranks reuse */
 1867|      0|        for (n = 2; n < nRankStackLen && pRankStack1[n]; n++)
  ------------------
  |  Branch (1867:21): [True: 0, False: 0]
  |  Branch (1867:42): [True: 0, False: 0]
  ------------------
 1868|      0|        {
 1869|      0|            pRankStack1[n][0] = 0; /* means ranks have to be recalculated */
 1870|      0|        }
 1871|       |        /* set the 1st ranks to zero: prepare for ranks reuse */
 1872|      0|        for (n = 2; n < nRankStackLen && pRankStack2[n]; n++)
  ------------------
  |  Branch (1872:21): [True: 0, False: 0]
  |  Branch (1872:42): [True: 0, False: 0]
  ------------------
 1873|      0|        {
 1874|      0|            pRankStack2[n][0] = 0; /* means ranks have to be recalculated */
 1875|      0|        }
 1876|       |
 1877|       |        /* for debugging or statistics */
 1878|      0|        pCS->lNumBreakTies =
 1879|      0|            pCS->lNumNeighListIter =
 1880|      0|            pCS->lNumTotCT =
 1881|      0|            pCS->lNumDecreasedCT =
 1882|      0|            pCS->lNumRejectedCT =
 1883|      0|            pCS->lNumEqualCT = 0;
 1884|      0|        pCS->bKeepSymmRank = 0;
 1885|      0|        pCS->bFirstCT = 1; /* To fill out nCanonRankStereo[] in map_stero_atoms2() */
 1886|       |
 1887|       |        /******************************************************************************
 1888|       |             nCanonRank contains input canonical numbering
 1889|       |             nCanonRankStereo will be filled with a transposition of canonical numbering
 1890|       |               which (1) keeps connection table unchanged and
 1891|       |                     (2) provides minimal stereo descriptors in
 1892|       |                         pCS->LinearCTStereoDble (length=pCS->nLenLinearCTStereoDble)
 1893|       |                         pCS->LinearCTStereoCarb (length=pCS->nLenLinearCTStereoCarb)
 1894|       |         */
 1895|       |
 1896|      0|        nRet = map_stereo_bonds4( ic, pCG, at, num_atoms, num_at_tg, num_max, 0,
 1897|      0|                                   ftcn->PartitionCt.Rank, ftcn->PartitionCt.AtNumber,
 1898|      0|                                   nCanonRankStereo, nSymmRank,
 1899|      0|                                   pRankStack1, pRankStack2,
 1900|      0|                                   nTempRank, nNumCurrRanks,nSymmStereo,
 1901|      0|                                   NeighList, pCS, cur_tree, 0 /* nNumMappedBonds */,
 1902|      0|                                   vABParityUnknown );
 1903|       |
 1904|      0|        if (RETURNED_ERROR( nRet ))
  ------------------
  |  |   72|      0|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   68|      0|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   66|      0|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   69|      0|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (72:31): [True: 0, False: 0]
  |  |  |  Branch (72:53): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1905|      0|        {
 1906|      0|            if (nRet == CT_TIMEOUT_ERR)
  ------------------
  |  |   55|      0|#define CT_TIMEOUT_ERR       (CT_ERR_FIRST- 8)  /*(-30008) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (1906:17): [True: 0, False: 0]
  ------------------
 1907|      0|            {
 1908|      0|                goto exit_function;
 1909|      0|            }
 1910|      0|            else
 1911|      0|            {
 1912|      0|                goto exit_function; /* program error */
 1913|      0|            }
 1914|      0|        }
 1915|      0|        else
 1916|      0|        {
 1917|      0|            int bFailed = 0;
 1918|      0|            if (!nRet)
  ------------------
  |  Branch (1918:17): [True: 0, False: 0]
  ------------------
 1919|      0|            {
 1920|      0|                bFailed = 1; /* progrm error */
 1921|      0|                pCS2->nLenLinearCTStereoCarb =
 1922|      0|                    pCS->nLenLinearCTStereoCarb = -abs( pCS->nLenLinearCTStereoCarb );
 1923|      0|                pCS2->nLenLinearCTStereoDble =
 1924|      0|                    pCS->nLenLinearCTStereoDble = -abs( pCS->nLenLinearCTStereoDble );
 1925|      0|                nRet = CT_STEREOCOUNT_ERR;  /*  <BRKPT> */
  ------------------
  |  |   57|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1926|      0|                goto exit_function; /* program error */
 1927|      0|            }
 1928|      0|            else
 1929|      0|            {
 1930|       |                /* save non-isotopic lengths */
 1931|      0|                pCS2->nLenLinearCTStereoDble = pCS->nLenLinearCTStereoDble;
 1932|      0|                pCS2->nLenLinearCTStereoCarb = pCS->nLenLinearCTStereoCarb;
 1933|      0|                nRet = 0;
 1934|      0|            }
 1935|       |
 1936|       |            /* save stereo canonical numbering */
 1937|      0|            if (pCS->nCanonOrdStereo)
  ------------------
  |  Branch (1937:17): [True: 0, False: 0]
  ------------------
 1938|      0|            {
 1939|      0|                for (i = n = 0; i < num_at_tg; i++)
  ------------------
  |  Branch (1939:33): [True: 0, False: 0]
  ------------------
 1940|      0|                {
 1941|      0|                    if (nCanonRankStereo[i] && (int) nCanonRankStereo[i] <= num_at_tg)
  ------------------
  |  Branch (1941:25): [True: 0, False: 0]
  |  Branch (1941:48): [True: 0, False: 0]
  ------------------
 1942|      0|                    {
 1943|      0|                        pCS->nCanonOrdStereo[(int) nCanonRankStereo[i] - 1] = (AT_NUMB) i;
 1944|      0|                    }
 1945|      0|                    else
 1946|      0|                    {
 1947|      0|                        bFailed++;
 1948|      0|                    }
 1949|      0|                }
 1950|      0|                pCS->nLenCanonOrdStereo = ( bFailed ) ? -num_atoms : num_atoms;
  ------------------
  |  Branch (1950:43): [True: 0, False: 0]
  ------------------
 1951|      0|            }
 1952|       |
 1953|       |            /* save stereo tautomer groups numbering */
 1954|      0|            if (bTaut && pCS->nCanonOrdStereoTaut)
  ------------------
  |  Branch (1954:17): [True: 0, False: 0]
  |  Branch (1954:26): [True: 0, False: 0]
  ------------------
 1955|      0|            {
 1956|      0|                if (0 < ( nRet = SortTautomerGroupsAndEndpoints( pCG, t_group_info1, num_atoms, num_at_tg, nCanonRankStereo ) ))
  ------------------
  |  Branch (1956:21): [True: 0, False: 0]
  ------------------
 1957|      0|                {
 1958|       |                    /*non-isotopic contains symmetry ranks */
 1959|      0|                    int num_t_groups = t_group_info1->num_t_groups;
 1960|      0|                    AT_NUMB *tGroupNumber = t_group_info1->tGroupNumber;
 1961|       |                    /*AT_NUMB *tiSymmRank        = tGroupNumber + TGSO_SYMM_IRANK*num_t_groups; */
 1962|      0|                    memcpy( pCS->nCanonOrdStereoTaut, tGroupNumber, num_t_groups * sizeof( pCS->nCanonOrdStereoTaut[0] ) );
 1963|      0|                    pCS->nLenCanonOrdStereoTaut = ( bFailed ) ? -num_t_groups
  ------------------
  |  Branch (1963:51): [True: 0, False: 0]
  ------------------
 1964|      0|                        : num_t_groups;
 1965|      0|                }
 1966|      0|                else if (RETURNED_ERROR( nRet ))
  ------------------
  |  |   72|      0|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   68|      0|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   66|      0|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   69|      0|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (72:31): [True: 0, False: 0]
  |  |  |  Branch (72:53): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1967|      0|                {
 1968|      0|                    goto exit_function;
 1969|      0|                }
 1970|      0|                else
 1971|      0|                {
 1972|      0|                    nRet = 0;
 1973|      0|                }
 1974|       |                /*SortTautomerGroupsAndEndpoints( t_group_info1, nCanonRank ); */ /* ??? return to non-isotopic canonical numbering */
 1975|      0|            }
 1976|      0|        }
 1977|       |
 1978|       |
 1979|       |        /****************************************************
 1980|       |         *
 1981|       |         *  VI-B. Optimize INVERTED stereo descriptors
 1982|       |         *
 1983|       |         ****************************************************/
 1984|      0|        if (!nCanonRankStereoInv)
  ------------------
  |  Branch (1984:13): [True: 0, False: 0]
  ------------------
 1985|      0|        {
 1986|      0|            nCanonRankStereoInv = (AT_RANK *) qmalloc( num_max * sizeof( *nCanonRankStereoInv ) );
  ------------------
  |  | 1148|      0|#define qmalloc(X) inchi_malloc(X)
  |  |  ------------------
  |  |  |  | 1130|      0|#define inchi_malloc   malloc
  |  |  ------------------
  ------------------
 1987|      0|        }
 1988|      0|        if (!nCanonRankStereoInv)
  ------------------
  |  Branch (1988:13): [True: 0, False: 0]
  ------------------
 1989|      0|        {
 1990|      0|            nRet = CT_OUT_OF_RAM;  /*  <BRKPT> */
  ------------------
  |  |   49|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1991|      0|            goto exit_function;
 1992|      0|        }
 1993|       |
 1994|       |        /* copy previous non-isotopic stereo canonicalization results to Inv initial data */
 1995|       |        /* assign pointers */
 1996|      0|        pCS->LinearCTStereoDble = pCS2->LinearCTStereoDbleInv;
 1997|      0|        pCS->LinearCTStereoCarb = pCS2->LinearCTStereoCarbInv;
 1998|       |
 1999|       |        /* copy the lengths */
 2000|      0|        pCS2->nLenLinearCTStereoDbleInv =
 2001|      0|            pCS->nLenLinearCTStereoDbleInv =
 2002|      0|            pCS->nLenLinearCTStereoDble = pCS2->nLenLinearCTStereoDble;
 2003|       |
 2004|      0|        pCS2->nLenLinearCTStereoCarbInv =
 2005|      0|            pCS->nLenLinearCTStereoCarbInv =
 2006|      0|            pCS->nLenLinearCTStereoCarb = pCS2->nLenLinearCTStereoCarb;
 2007|       |
 2008|      0|        if (pCS->nLenLinearCTStereoDble > 0 || pCS->nLenLinearCTStereoCarb > 0)
  ------------------
  |  Branch (2008:13): [True: 0, False: 0]
  |  Branch (2008:48): [True: 0, False: 0]
  ------------------
 2009|      0|        {
 2010|       |            /* copy previous results, the canonical stereo CT */
 2011|      0|            memcpy( pCS->LinearCTStereoDble, pCS2->LinearCTStereoDble, pCS->nLenLinearCTStereoDble * sizeof( pCS->LinearCTStereoDble[0] ) );
 2012|      0|            memcpy( pCS->LinearCTStereoCarb, pCS2->LinearCTStereoCarb, pCS->nLenLinearCTStereoCarb * sizeof( pCS->LinearCTStereoCarb[0] ) );
 2013|      0|        }
 2014|      0|        memcpy( nCanonRankStereoInv, nCanonRankStereo, num_max * sizeof( nCanonRankStereoInv[0] ) );
 2015|      0|        if (pCS->nCanonOrdStereoInv && pCS->nCanonOrdStereo)
  ------------------
  |  Branch (2015:13): [True: 0, False: 0]
  |  Branch (2015:40): [True: 0, False: 0]
  ------------------
 2016|      0|        {
 2017|       |            /* in case there is nothing to invert */
 2018|      0|            memcpy( pCS->nCanonOrdStereoInv, pCS->nCanonOrdStereo, num_at_tg * sizeof( pCS->nCanonOrdStereoInv[0] ) );
 2019|      0|        }
 2020|       |
 2021|       |        /******************************
 2022|       |         *
 2023|       |         * Invert stereo
 2024|       |         *
 2025|       |         ******************************/
 2026|       |
 2027|       |        /*********************************************************************************
 2028|       |         * Create initial approximation for the minimization of the stereo descriptors:
 2029|       |         *  invert stereogenic atom parities, one parity in each allene, all parities in
 2030|       |         *  pCS->LinearCTStereoCarb and allene parities in pCS->nLenLinearCTStereoDble
 2031|       |         */
 2032|      0|        nRet = InvertStereo( at, num_at_tg, nCanonRankStereo, nTempRank, pCS, 1 /* bInvertLinearCTStereo */ );
 2033|      0|        if (RETURNED_ERROR( nRet ))
  ------------------
  |  |   72|      0|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   68|      0|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   66|      0|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   69|      0|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (72:31): [True: 0, False: 0]
  |  |  |  Branch (72:53): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2034|      0|        {
 2035|      0|            goto exit_function;
 2036|      0|        }
 2037|      0|        else if (nRet > 0)
  ------------------
  |  Branch (2037:18): [True: 0, False: 0]
  ------------------
 2038|      0|        {
 2039|       |            /* InvertStereo() has done some changes */
 2040|      0|            nRet = 0;
 2041|       |            /* FillOutStereoParities() has already been called to fill out these 2 LinearCTs */
 2042|       |
 2043|       |            /* set the 1st ranks in the rest of the stack to zero: prepare for ranks reuse */
 2044|      0|            for (n = 2; n < nRankStackLen && pRankStack1[n]; n++)
  ------------------
  |  Branch (2044:25): [True: 0, False: 0]
  |  Branch (2044:46): [True: 0, False: 0]
  ------------------
 2045|      0|            {
 2046|      0|                pRankStack1[n][0] = 0; /* means ranks have to be recalculated */
 2047|      0|            }
 2048|       |            /* set the 1st ranks to zero: prepare for ranks reuse */
 2049|      0|            for (n = 2; n < nRankStackLen && pRankStack2[n]; n++)
  ------------------
  |  Branch (2049:25): [True: 0, False: 0]
  |  Branch (2049:46): [True: 0, False: 0]
  ------------------
 2050|      0|            {
 2051|      0|                pRankStack2[n][0] = 0; /* means ranks have to be recalculated */
 2052|      0|            }
 2053|       |
 2054|       |            /* for debugging or statistics */
 2055|      0|            pCS->lNumBreakTies =
 2056|      0|                pCS->lNumNeighListIter =
 2057|      0|                pCS->lNumTotCT =
 2058|      0|                pCS->lNumDecreasedCT =
 2059|      0|                pCS->lNumRejectedCT =
 2060|      0|                pCS->lNumEqualCT = 0;
 2061|      0|            pCS->bKeepSymmRank = 0;
 2062|      0|            pCS->bFirstCT = 1; /* To fill out nCanonRankStereo[] in map_stero_atoms2() */
 2063|       |
 2064|      0|#ifdef FIX_STEREOCOUNT_ERR
 2065|      0|            CurTreeSetPos( cur_tree, 0 );
 2066|      0|#endif
 2067|       |
 2068|       |            /******************************************************************************
 2069|       |                 ftcn->PartitionCt.Rank contains input canonical numbering
 2070|       |                 nCanonRankStereoInv will be filled with a transposition of canonical numbering
 2071|       |                   which (1) keeps connection table unchanged and
 2072|       |                         (2) provides minimal stereo descriptors in
 2073|       |                             pCS->LinearCTStereoDble (length=pCS->nLenLinearCTStereoDble)
 2074|       |                             pCS->LinearCTStereoCarb (length=pCS->nLenLinearCTStereoCarb)
 2075|       |             ******************************************************************************/
 2076|       |
 2077|      0|            nRet = map_stereo_bonds4( ic,pCG, at, num_atoms, num_at_tg, num_max, 0,
 2078|      0|                                      ftcn->PartitionCt.Rank,
 2079|      0|                                      ftcn->PartitionCt.AtNumber,
 2080|      0|                                      nCanonRankStereoInv,
 2081|      0|                                      nSymmRank, pRankStack1, pRankStack2,
 2082|      0|                                      nTempRank, nNumCurrRanks, nSymmStereo,
 2083|      0|                                      NeighList, pCS, cur_tree, 0,
 2084|      0|                                      vABParityUnknown );
 2085|       |
 2086|      0|            if (RETURNED_ERROR( nRet ))
  ------------------
  |  |   72|      0|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   68|      0|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   66|      0|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   69|      0|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (72:31): [True: 0, False: 0]
  |  |  |  Branch (72:53): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2087|      0|            {
 2088|      0|                if (nRet == CT_TIMEOUT_ERR)
  ------------------
  |  |   55|      0|#define CT_TIMEOUT_ERR       (CT_ERR_FIRST- 8)  /*(-30008) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (2088:21): [True: 0, False: 0]
  ------------------
 2089|      0|                {
 2090|      0|                    goto exit_function;
 2091|      0|                }
 2092|      0|                else
 2093|      0|                {
 2094|      0|                    goto exit_function; /* program error */
 2095|      0|                }
 2096|      0|            }
 2097|      0|            else
 2098|      0|            {
 2099|      0|                int bFailed = 0;
 2100|      0|                if (!nRet)
  ------------------
  |  Branch (2100:21): [True: 0, False: 0]
  ------------------
 2101|      0|                {
 2102|      0|                    bFailed = 1; /* progrm error */
 2103|      0|                    pCS2->nLenLinearCTStereoCarb =
 2104|      0|                        pCS->nLenLinearCTStereoCarb = -abs( pCS->nLenLinearCTStereoCarb );
 2105|      0|                    pCS2->nLenLinearCTStereoDble =
 2106|      0|                        pCS->nLenLinearCTStereoDble = -abs( pCS->nLenLinearCTStereoDble );
 2107|      0|                    nRet = CT_STEREOCOUNT_ERR;  /*  <BRKPT> */
  ------------------
  |  |   57|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 2108|      0|                    goto exit_function; /* program error */
 2109|      0|                }
 2110|       |
 2111|       |                /* save non-isotopic pointers & lengths for INVERTED stereo */
 2112|      0|                pCS->nLenLinearCTStereoDbleInv =
 2113|      0|                    pCS2->nLenLinearCTStereoDbleInv = pCS->nLenLinearCTStereoDble;
 2114|      0|                pCS->nLenLinearCTStereoCarbInv =
 2115|      0|                    pCS2->nLenLinearCTStereoCarbInv = pCS->nLenLinearCTStereoCarb;
 2116|       |
 2117|       |                    /* restore pointers and lengths to non-inverted stereo    */
 2118|       |                    /*  -- this is needed for InvertStereo() back, see below  */
 2119|      0|                pCS->LinearCTStereoDble = pCS2->LinearCTStereoDble;
 2120|      0|                pCS->LinearCTStereoCarb = pCS2->LinearCTStereoCarb;
 2121|      0|                pCS->nLenLinearCTStereoDble = pCS2->nLenLinearCTStereoDble;
 2122|      0|                pCS->nLenLinearCTStereoCarb = pCS2->nLenLinearCTStereoCarb;
 2123|       |                /* consistency check */
 2124|      0|                if (pCS->nLenLinearCTStereoDbleInv != pCS->nLenLinearCTStereoDble ||
  ------------------
  |  Branch (2124:21): [True: 0, False: 0]
  ------------------
 2125|      0|                     pCS->nLenLinearCTStereoCarbInv != pCS->nLenLinearCTStereoCarb)
  ------------------
  |  Branch (2125:22): [True: 0, False: 0]
  ------------------
 2126|      0|                {
 2127|      0|                    nRet = CT_CALC_STEREO_ERR;
  ------------------
  |  |   62|      0|#define CT_CALC_STEREO_ERR   (CT_ERR_FIRST-15)  /*(-30015) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 2128|      0|                    goto exit_function; /* program error */
 2129|      0|                }
 2130|       |
 2131|       |                /******************************
 2132|       |                 *
 2133|       |                 * Invert stereo back
 2134|       |                 *
 2135|       |                 ******************************
 2136|       |                 *  (make sure that pointers
 2137|       |                 *  pCS->LinearCTStereoCarb,
 2138|       |                 *  pCS->LinearCTStereoDble
 2139|       |                 *  and corresponding lengths
 2140|       |                 *  have been restored)
 2141|       |                 ******************************/
 2142|       |            /*********************************************************************************
 2143|       |             *  invert only stereogenic atom parities and one parity in each allene, DO NOT
 2144|       |             *  change parities in pCS->LinearCTStereoCarb and pCS->nLenLinearCTStereoDble
 2145|       |             */
 2146|      0|                nRet = InvertStereo( at,
 2147|      0|                                     num_at_tg,
 2148|      0|                                     nCanonRankStereo,
 2149|      0|                                     nTempRank,
 2150|      0|                                     pCS,
 2151|      0|                                     0 );
 2152|       |
 2153|      0|                if (RETURNED_ERROR( nRet ))
  ------------------
  |  |   72|      0|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   68|      0|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   66|      0|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   69|      0|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (72:31): [True: 0, False: 0]
  |  |  |  Branch (72:53): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2154|      0|                {
 2155|      0|                    goto exit_function;
 2156|      0|                }
 2157|      0|                nRet = 0;
 2158|       |
 2159|       |
 2160|       |                /* save stereo canonical numbering */
 2161|      0|                if (pCS->nCanonOrdStereoInv)
  ------------------
  |  Branch (2161:21): [True: 0, False: 0]
  ------------------
 2162|      0|                {
 2163|      0|                    for (i = n = 0; i < num_at_tg; i++)
  ------------------
  |  Branch (2163:37): [True: 0, False: 0]
  ------------------
 2164|      0|                    {
 2165|      0|                        if (nCanonRankStereoInv[i] && (int) nCanonRankStereoInv[i] <= num_at_tg)
  ------------------
  |  Branch (2165:29): [True: 0, False: 0]
  |  Branch (2165:55): [True: 0, False: 0]
  ------------------
 2166|      0|                        {
 2167|      0|                            pCS->nCanonOrdStereoInv[(int) nCanonRankStereoInv[i] - 1] = (AT_NUMB) i;
 2168|      0|                        }
 2169|      0|                        else
 2170|      0|                        {
 2171|      0|                            bFailed++;
 2172|      0|                        }
 2173|      0|                    }
 2174|      0|                    pCS->nLenCanonOrdStereo = ( bFailed ) ? -num_atoms : num_atoms;
  ------------------
  |  Branch (2174:47): [True: 0, False: 0]
  ------------------
 2175|      0|                }
 2176|       |
 2177|       |                /* compare inverted and non-inverted stereo */
 2178|      0|                pCS->bCmpStereo = 2 + CompareLinCtStereo(
 2179|      0|                                         pCS->LinearCTStereoDbleInv, pCS->nLenLinearCTStereoDbleInv,
 2180|      0|                                         pCS->LinearCTStereoCarbInv, pCS->nLenLinearCTStereoCarbInv,
 2181|      0|                                         pCS->LinearCTStereoDble, pCS->nLenLinearCTStereoDble,
 2182|      0|                                         pCS->LinearCTStereoCarb, pCS->nLenLinearCTStereoCarb
 2183|      0|                );
 2184|      0|            }
 2185|      0|        }
 2186|      0|        else if (0 == nRet)
  ------------------
  |  Branch (2186:18): [True: 0, False: 0]
  ------------------
 2187|      0|        {
 2188|       |            /* nothing has been done, restore pointers and lengths for stereo */
 2189|      0|            pCS->LinearCTStereoDble = pCS2->LinearCTStereoDble;
 2190|      0|            pCS->LinearCTStereoCarb = pCS2->LinearCTStereoCarb;
 2191|      0|            pCS->nLenLinearCTStereoDble = pCS2->nLenLinearCTStereoDble;
 2192|      0|            pCS->nLenLinearCTStereoCarb = pCS2->nLenLinearCTStereoCarb;
 2193|      0|        }
 2194|      0|    }
 2195|       |
 2196|       |    /* restore "ignore isotopic differences in tautomer groups" */
 2197|      0|    if (bTaut)
  ------------------
  |  Branch (2197:9): [True: 0, False: 0]
  ------------------
 2198|      0|    {
 2199|       |        /* save request for isotopic tautomeric groups */
 2200|      0|        pCS->t_group_info->bIgnoreIsotopic = bIgnoreIsotopicInputGroups;
 2201|      0|    }
 2202|       |
 2203|       |    /* restore request for isotopic name */
 2204|      0|    pCS->bIgnoreIsotopic = bIgnoreIsotopicInputAtoms;
 2205|       |
 2206|      0|    if (bCanonIsoStereo && bCanonIsotopic)
  ------------------
  |  Branch (2206:9): [True: 0, False: 0]
  |  Branch (2206:28): [True: 0, False: 0]
  ------------------
 2207|      0|    {
 2208|       |
 2209|       |        /****************************************************************
 2210|       |         *
 2211|       |         *   VII. Optimize isotopic stereo descriptors (optimized)
 2212|       |         *
 2213|       |         ****************************************************************/
 2214|       |        /*
 2215|       |        pCS->LinearCTIsotopic     = NULL;
 2216|       |        */
 2217|       |
 2218|       |        /* Initial ranking for isotopic mapping */
 2219|      0|        memcpy( nAtomNumber, ftcn->PartitionCtIso.AtNumber, num_at_tg * sizeof( nAtomNumber[0] ) );
 2220|      0|        memcpy( nRank, ftcn->PartitionCtIso.Rank, num_at_tg * sizeof( nRank[0] ) );
 2221|      0|        memcpy( nSymmRank, ftcn->nSymmRankCtIso, num_at_tg * sizeof( nSymmRank[0] ) );
 2222|       |
 2223|       |        /* nSymmRank will change if canonical numbers of of constitutionally equivalent atoms are not contiguous */
 2224|      0|        nNumCurrRanks = FixCanonEquivalenceInfo( pCG, num_at_tg, nSymmRank /* in&out*/,
 2225|      0|                                           nRank, nTempRank /* out */, nAtomNumber /* in&out */, NULL );
 2226|       |
 2227|      0|        memcpy( pCS->nPrevAtomNumber, ftcn->PartitionCtIso.AtNumber, num_at_tg * sizeof( nAtomNumber[0] ) );
 2228|       |
 2229|       |        /* Allocate memory for optimized stereo canonicalization */
 2230|       |        /* for stereo canonical numbering to be found. */
 2231|      0|        if (!nCanonRankIsotopicStereo)
  ------------------
  |  Branch (2231:13): [True: 0, False: 0]
  ------------------
 2232|      0|        {
 2233|      0|            nCanonRankIsotopicStereo = (AT_RANK *) qmalloc( num_max * sizeof( *nCanonRankIsotopicStereo ) );
  ------------------
  |  | 1148|      0|#define qmalloc(X) inchi_malloc(X)
  |  |  ------------------
  |  |  |  | 1130|      0|#define inchi_malloc   malloc
  |  |  ------------------
  ------------------
 2234|      0|        }
 2235|      0|        if (!nSymmStereo && !( nMode & CMODE_NOEQ_STEREO ))
  ------------------
  |  |  778|      0|#define CMODE_NOEQ_STEREO        0x000040 /* 5-24-2002: do not use stereo equivalence to accelerate */
  ------------------
  |  Branch (2235:13): [True: 0, False: 0]
  |  Branch (2235:29): [True: 0, False: 0]
  ------------------
 2236|      0|        {
 2237|      0|            nSymmStereo = (AT_RANK *) qmalloc( ( num_max + 1 ) * sizeof( *nSymmStereo ) );
  ------------------
  |  | 1148|      0|#define qmalloc(X) inchi_malloc(X)
  |  |  ------------------
  |  |  |  | 1130|      0|#define inchi_malloc   malloc
  |  |  ------------------
  ------------------
 2238|      0|        }
 2239|      0|        if (!( nMode & CMODE_NOEQ_STEREO ) && CurTreeAlloc( cur_tree, num_at_tg ))
  ------------------
  |  |  778|      0|#define CMODE_NOEQ_STEREO        0x000040 /* 5-24-2002: do not use stereo equivalence to accelerate */
  ------------------
  |  Branch (2239:13): [True: 0, False: 0]
  |  Branch (2239:47): [True: 0, False: 0]
  ------------------
 2240|      0|        {
 2241|      0|            nRet = CT_OUT_OF_RAM;  /*  <BRKPT> */
  ------------------
  |  |   49|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 2242|      0|            goto exit_function;
 2243|      0|        }
 2244|       |
 2245|       |        /* Check allocations and assign first 2 elements of pRankStack2 */
 2246|      0|        if (pRankStack1 && pRankStack2 &&
  ------------------
  |  Branch (2246:13): [True: 0, False: 0]
  |  Branch (2246:28): [True: 0, False: 0]
  ------------------
 2247|      0|             nCanonRankIsotopicStereo &&
  ------------------
  |  Branch (2247:14): [True: 0, False: 0]
  ------------------
 2248|      0|             ( nSymmStereo || ( nMode & CMODE_NOEQ_STEREO ) ))
  ------------------
  |  |  778|      0|#define CMODE_NOEQ_STEREO        0x000040 /* 5-24-2002: do not use stereo equivalence to accelerate */
  ------------------
  |  Branch (2248:16): [True: 0, False: 0]
  |  Branch (2248:31): [True: 0, False: 0]
  ------------------
 2249|      0|        {
 2250|       |
 2251|      0|            pRankStack1[0] = pRankStack2[0] = nRank; /* pRankStack1[0,1] shall be unchanged */
 2252|      0|            pRankStack1[1] = pRankStack2[1] = nAtomNumber;
 2253|      0|        }
 2254|      0|        else
 2255|      0|        {
 2256|      0|            nRet = CT_OUT_OF_RAM;  /*  <BRKPT> */
  ------------------
  |  |   49|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 2257|      0|            goto exit_function;
 2258|      0|        }
 2259|       |
 2260|       |        /******************************************************************
 2261|       |           Important: fill out a list of stereo atoms and bonds including
 2262|       |           those which are stereo due to isotopic atoms only and create
 2263|       |           LinearCT stereo descriptors for the canonical numbering
 2264|       |         ******************************************************************/
 2265|       |
 2266|       |
 2267|       |        /* at[] has certain members for non-isotopic and isotopic stereo; switch them */
 2268|      0|        SwitchAtomStereoAndIsotopicStereo( at, num_atoms, &bSwitchedAtomToIsotopic );
 2269|       |
 2270|       |        /* Prepare stereo connection tables' pointers */
 2271|      0|        SetCtToIsotopicStereo( pCS, pCS2 );
 2272|       |
 2273|      0|        nRet = FillOutStereoParities( at, num_atoms,
 2274|      0|                                      ftcn->PartitionCtIso.Rank,
 2275|      0|                                      ftcn->PartitionCtIso.AtNumber,
 2276|      0|                                      nRank, nAtomNumber,
 2277|      0|                                      pCS, pCG, 1 /* bIsotopic */ );
 2278|       |
 2279|       |
 2280|      0|        if (RETURNED_ERROR( nRet ))
  ------------------
  |  |   72|      0|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   68|      0|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   66|      0|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   69|      0|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (72:31): [True: 0, False: 0]
  |  |  |  Branch (72:53): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2281|      0|        {
 2282|      0|            goto exit_function;  /* program error */
 2283|      0|        }
 2284|      0|        else if (!nRet)
  ------------------
  |  Branch (2284:18): [True: 0, False: 0]
  ------------------
 2285|      0|        {
 2286|       |            /* no isotopic stereo */
 2287|      0|            pCS2->nLenLinearCTIsotopicStereoDble = pCS->nLenLinearCTIsotopicStereoDble = 0;
 2288|      0|            pCS2->nLenLinearCTIsotopicStereoCarb = pCS->nLenLinearCTIsotopicStereoCarb = 0;
 2289|      0|            pCS->nLenCanonOrdIsotopicStereo = 0;
 2290|      0|            pCS->nLenCanonOrdIsotopicStereoTaut = 0;
 2291|      0|            pCS2->nLenLinearCTIsotopicStereoDbleInv = pCS->nLenLinearCTIsotopicStereoDbleInv = 0;
 2292|      0|            pCS2->nLenLinearCTIsotopicStereoCarbInv = pCS->nLenLinearCTIsotopicStereoCarbInv = 0;
 2293|      0|            goto bypass_isotopic_stereo;
 2294|      0|        }
 2295|      0|        else
 2296|      0|        {
 2297|      0|            nRet = 0; /* not an error */
 2298|      0|        }
 2299|       |
 2300|       |
 2301|       |        /*************************************************************
 2302|       |         *
 2303|       |         *  VII-A. Optimize non-inverted isotopic stereo descriptors
 2304|       |         *
 2305|       |         *************************************************************/
 2306|       |
 2307|       |        /* set the 1st ranks in the rest of the stack to zero: prepare for ranks reuse */
 2308|      0|        for (n = 2; n < nRankStackLen && pRankStack1[n]; n++)
  ------------------
  |  Branch (2308:21): [True: 0, False: 0]
  |  Branch (2308:42): [True: 0, False: 0]
  ------------------
 2309|      0|        {
 2310|      0|            pRankStack1[n][0] = 0; /* means ranks have to be recalculated */
 2311|      0|        }
 2312|       |        /* set the 1st ranks to zero: prepare for ranks reuse */
 2313|      0|        for (n = 2; n < nRankStackLen && pRankStack2[n]; n++)
  ------------------
  |  Branch (2313:21): [True: 0, False: 0]
  |  Branch (2313:42): [True: 0, False: 0]
  ------------------
 2314|      0|        {
 2315|      0|            pRankStack2[n][0] = 0; /* means ranks have to be recalculated */
 2316|      0|        }
 2317|       |
 2318|       |        /* for debugging or statistics */
 2319|      0|        pCS->lNumBreakTies =
 2320|      0|            pCS->lNumNeighListIter =
 2321|      0|            pCS->lNumTotCT =
 2322|      0|            pCS->lNumDecreasedCT =
 2323|      0|            pCS->lNumRejectedCT =
 2324|      0|            pCS->lNumEqualCT = 0;
 2325|      0|        pCS->bKeepSymmRank = 0;
 2326|      0|        pCS->bFirstCT = 1; /* To fill out nCanonRankStereo[] in map_stero_atoms2() */
 2327|       |
 2328|       |        /**************************************************************************************
 2329|       |          nCanonRankIsotopic contains input canonical numbering
 2330|       |          nCanonRankIsotopicStereo will be filled with a transposition of canonical numbering
 2331|       |            that  (1) keeps connection table unchanged and
 2332|       |                  (2) provides minimal stereo descriptors in
 2333|       |                      pCS->LinearCTStereoDble (length=pCS->nLenLinearCTStereoDble)
 2334|       |                      pCS->LinearCTStereoCarb (length=pCS->nLenLinearCTStereoCarb)
 2335|       |        ***************************************************************************************/
 2336|       |
 2337|      0|        nRet = map_stereo_bonds4( ic, pCG,at, num_atoms, num_at_tg, num_max, 0,
 2338|      0|                                  ftcn->PartitionCtIso.Rank,
 2339|      0|                                  ftcn->PartitionCtIso.AtNumber,
 2340|      0|                                  nCanonRankIsotopicStereo,
 2341|      0|                                  nSymmRank, pRankStack1, pRankStack2,
 2342|      0|                                  nTempRank, nNumCurrRanks, nSymmStereo,
 2343|      0|                                  NeighList, pCS, cur_tree,
 2344|      0|                                  0, vABParityUnknown );
 2345|       |
 2346|      0|        if (RETURNED_ERROR( nRet ))
  ------------------
  |  |   72|      0|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   68|      0|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   66|      0|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   69|      0|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (72:31): [True: 0, False: 0]
  |  |  |  Branch (72:53): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2347|      0|        {
 2348|      0|            goto exit_function;
 2349|      0|        }
 2350|      0|        else
 2351|      0|        {
 2352|      0|            int bFailed = 0;
 2353|       |
 2354|      0|            if (!nRet)
  ------------------
  |  Branch (2354:17): [True: 0, False: 0]
  ------------------
 2355|      0|            {
 2356|      0|                bFailed = 1; /* program error */
 2357|      0|                pCS2->nLenLinearCTIsotopicStereoDble =
 2358|      0|                    pCS->nLenLinearCTIsotopicStereoDble = -abs( pCS->nLenLinearCTStereoDble );
 2359|      0|                pCS2->nLenLinearCTIsotopicStereoCarb =
 2360|      0|                    pCS->nLenLinearCTIsotopicStereoCarb = -abs( pCS->nLenLinearCTStereoCarb );
 2361|      0|                nRet = CT_STEREOCOUNT_ERR;  /*  <BRKPT> */
  ------------------
  |  |   57|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 2362|      0|                goto exit_function; /* program error */
 2363|      0|            }
 2364|      0|            else
 2365|      0|            {
 2366|       |                /* save isotopic lengths */
 2367|      0|                pCS->nLenLinearCTIsotopicStereoDble =
 2368|      0|                    pCS2->nLenLinearCTIsotopicStereoDble = pCS->nLenLinearCTStereoDble;
 2369|      0|                pCS->nLenLinearCTIsotopicStereoCarb =
 2370|      0|                    pCS2->nLenLinearCTIsotopicStereoCarb = pCS->nLenLinearCTStereoCarb;
 2371|       |
 2372|       |                    /* save stereo canonical numbering */
 2373|      0|                if (pCS->nCanonOrdIsotopicStereo)
  ------------------
  |  Branch (2373:21): [True: 0, False: 0]
  ------------------
 2374|      0|                {
 2375|      0|                    for (i = n = 0; i < num_at_tg; i++)
  ------------------
  |  Branch (2375:37): [True: 0, False: 0]
  ------------------
 2376|      0|                    {
 2377|      0|                        if (nCanonRankIsotopicStereo[i] && (int) nCanonRankIsotopicStereo[i] <= num_at_tg)
  ------------------
  |  Branch (2377:29): [True: 0, False: 0]
  |  Branch (2377:60): [True: 0, False: 0]
  ------------------
 2378|      0|                        {
 2379|      0|                            pCS->nCanonOrdIsotopicStereo[(int) nCanonRankIsotopicStereo[i] - 1] = (AT_NUMB) i;
 2380|      0|                        }
 2381|      0|                        else
 2382|      0|                        {
 2383|      0|                            bFailed++;
 2384|      0|                        }
 2385|      0|                    }
 2386|      0|                    pCS->nLenCanonOrdIsotopicStereo = bFailed ? -num_atoms : num_atoms;
  ------------------
  |  Branch (2386:55): [True: 0, False: 0]
  ------------------
 2387|      0|                }
 2388|       |
 2389|       |                /* save stereo tautomer groups numbering */
 2390|      0|                if (pCS->nCanonOrdIsotopicStereoTaut)
  ------------------
  |  Branch (2390:21): [True: 0, False: 0]
  ------------------
 2391|      0|                {
 2392|      0|                    if (0 < ( nRet = SortTautomerGroupsAndEndpoints( pCG, t_group_info1, num_atoms, num_at_tg, nCanonRankIsotopicStereo ) ))
  ------------------
  |  Branch (2392:25): [True: 0, False: 0]
  ------------------
 2393|      0|                    {
 2394|       |                        /*non-isotopic contains symmetry ranks */
 2395|      0|                        int num_t_groups = t_group_info1->num_t_groups;
 2396|      0|                        AT_NUMB *tGroupNumber = t_group_info1->tGroupNumber;
 2397|       |                        /*AT_NUMB *tiSymmRank        = tGroupNumber + TGSO_SYMM_IRANK*num_t_groups; */
 2398|      0|                        memcpy( pCS->nCanonOrdIsotopicStereoTaut, tGroupNumber, num_t_groups * sizeof( pCS->nCanonOrdIsotopicStereoTaut[0] ) );
 2399|      0|                        pCS->nLenCanonOrdIsotopicStereoTaut = bFailed ? -num_t_groups : num_t_groups;
  ------------------
  |  Branch (2399:63): [True: 0, False: 0]
  ------------------
 2400|       |
 2401|       |                        /*SortTautomerGroupsAndEndpoints( t_group_info1, nCanonRank ); */ /* ??? return to non-isotopic canonical numbering */
 2402|      0|                    }
 2403|      0|                    else if (RETURNED_ERROR( nRet ))
  ------------------
  |  |   72|      0|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   68|      0|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   66|      0|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   69|      0|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (72:31): [True: 0, False: 0]
  |  |  |  Branch (72:53): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2404|      0|                    {
 2405|      0|                        goto exit_function;
 2406|      0|                    }
 2407|      0|                    else
 2408|      0|                    {
 2409|      0|                        nRet = 0;
 2410|      0|                    }
 2411|      0|                }
 2412|      0|            }
 2413|      0|        }
 2414|       |
 2415|       |        /**********************************************************
 2416|       |         *
 2417|       |         *  VII-B. Optimize INVERTED isotopic stereo descriptors
 2418|       |         *
 2419|       |         **********************************************************/
 2420|      0|        if (!nCanonRankIsotopicStereoInv)
  ------------------
  |  Branch (2420:13): [True: 0, False: 0]
  ------------------
 2421|      0|            nCanonRankIsotopicStereoInv = (AT_RANK *) qmalloc( num_max * sizeof( *nCanonRankIsotopicStereoInv ) );
  ------------------
  |  | 1148|      0|#define qmalloc(X) inchi_malloc(X)
  |  |  ------------------
  |  |  |  | 1130|      0|#define inchi_malloc   malloc
  |  |  ------------------
  ------------------
 2422|      0|        if (!nCanonRankIsotopicStereoInv)
  ------------------
  |  Branch (2422:13): [True: 0, False: 0]
  ------------------
 2423|      0|        {
 2424|      0|            nRet = CT_OUT_OF_RAM;  /*  <BRKPT> */
  ------------------
  |  |   49|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 2425|      0|            goto exit_function;
 2426|      0|        }
 2427|       |
 2428|       |        /* copy previous isotopic stereo canonicalization results to Inv initial data */
 2429|       |        /* assign pointers */
 2430|      0|        pCS->LinearCTStereoDble = pCS2->LinearCTIsotopicStereoDbleInv; /*  enable stereo */
 2431|      0|        pCS->LinearCTStereoCarb = pCS2->LinearCTIsotopicStereoCarbInv;
 2432|       |
 2433|       |        /* copy the lengths */
 2434|      0|        pCS2->nLenLinearCTIsotopicStereoDbleInv =
 2435|      0|            pCS->nLenLinearCTStereoDbleInv =
 2436|      0|            pCS->nLenLinearCTStereoDble = pCS2->nLenLinearCTIsotopicStereoDble;
 2437|       |
 2438|      0|        pCS2->nLenLinearCTIsotopicStereoCarbInv =
 2439|      0|            pCS->nLenLinearCTStereoCarbInv =
 2440|      0|            pCS->nLenLinearCTStereoCarb = pCS2->nLenLinearCTIsotopicStereoCarb;
 2441|       |
 2442|      0|        if (pCS->nLenLinearCTStereoDble > 0 || pCS->nLenLinearCTStereoCarb > 0)
  ------------------
  |  Branch (2442:13): [True: 0, False: 0]
  |  Branch (2442:48): [True: 0, False: 0]
  ------------------
 2443|      0|        {
 2444|       |            /* copy previous results, the canonical stereo CT */
 2445|      0|            memcpy( pCS->LinearCTStereoDble, pCS2->LinearCTIsotopicStereoDble, pCS->nLenLinearCTStereoDble * sizeof( pCS->LinearCTStereoDble[0] ) );
 2446|      0|            memcpy( pCS->LinearCTStereoCarb, pCS2->LinearCTIsotopicStereoCarb, pCS->nLenLinearCTStereoCarb * sizeof( pCS->LinearCTStereoCarb[0] ) );
 2447|      0|        }
 2448|      0|        memcpy( nCanonRankIsotopicStereoInv, nCanonRankIsotopicStereo, num_max * sizeof( nCanonRankIsotopicStereoInv[0] ) );
 2449|      0|        if (pCS->nCanonOrdIsotopicStereoInv && pCS->nCanonOrdIsotopicStereo)
  ------------------
  |  Branch (2449:13): [True: 0, False: 0]
  |  Branch (2449:48): [True: 0, False: 0]
  ------------------
 2450|      0|        {
 2451|       |            /* in case there is nothing to invert */
 2452|      0|            memcpy( pCS->nCanonOrdIsotopicStereoInv, pCS->nCanonOrdIsotopicStereo, num_at_tg * sizeof( pCS->nCanonOrdIsotopicStereoInv[0] ) );
 2453|      0|        }
 2454|       |
 2455|       |        /******************************
 2456|       |         *
 2457|       |         * Invert isotopic stereo
 2458|       |         *
 2459|       |         ******************************/
 2460|       |
 2461|       |        /*********************************************************************************
 2462|       |         * Create initial approximation for the minimization of the stereo descriptors:
 2463|       |         *  invert stereogenic atom parities, one parity in each allene, all parities in
 2464|       |         *  pCS->LinearCTStereoCarb and allene parities in pCS->nLenLinearCTStereoDble
 2465|       |         */
 2466|       |
 2467|      0|        nRet = InvertStereo( at,
 2468|      0|                             num_at_tg,
 2469|      0|                             nCanonRankIsotopicStereo,
 2470|      0|                             nTempRank,
 2471|      0|                             pCS,
 2472|      0|                             1 );
 2473|       |
 2474|      0|        if (RETURNED_ERROR( nRet ))
  ------------------
  |  |   72|      0|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   68|      0|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   66|      0|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   69|      0|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (72:31): [True: 0, False: 0]
  |  |  |  Branch (72:53): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2475|      0|        {
 2476|      0|            goto exit_function;
 2477|      0|        }
 2478|      0|        else if (nRet > 0)
  ------------------
  |  Branch (2478:18): [True: 0, False: 0]
  ------------------
 2479|      0|        {
 2480|       |            /* InvertStereo() has done some changes */
 2481|      0|            nRet = 0;
 2482|       |            /* FillOutStereoParities() has already been called to fill out these 2 LinearCTs */
 2483|       |
 2484|       |            /* set the 1st ranks in the rest of the stack to zero: prepare for ranks reuse */
 2485|      0|            for (n = 2; n < nRankStackLen && pRankStack1[n]; n++)
  ------------------
  |  Branch (2485:25): [True: 0, False: 0]
  |  Branch (2485:46): [True: 0, False: 0]
  ------------------
 2486|      0|            {
 2487|      0|                pRankStack1[n][0] = 0; /* means ranks have to be recalculated */
 2488|      0|            }
 2489|       |            /* set the 1st ranks to zero: prepare for ranks reuse */
 2490|      0|            for (n = 2; n < nRankStackLen && pRankStack2[n]; n++)
  ------------------
  |  Branch (2490:25): [True: 0, False: 0]
  |  Branch (2490:46): [True: 0, False: 0]
  ------------------
 2491|      0|            {
 2492|      0|                pRankStack2[n][0] = 0; /* means ranks have to be recalculated */
 2493|      0|            }
 2494|       |            /* for debugging or statistics */
 2495|      0|            pCS->lNumBreakTies =
 2496|      0|                pCS->lNumNeighListIter =
 2497|      0|                pCS->lNumTotCT =
 2498|      0|                pCS->lNumDecreasedCT =
 2499|      0|                pCS->lNumRejectedCT =
 2500|      0|                pCS->lNumEqualCT = 0;
 2501|      0|            pCS->bKeepSymmRank = 0;
 2502|      0|            pCS->bFirstCT = 1; /* To fill out nCanonRankStereo[] in map_stero_atoms2() */
 2503|       |
 2504|       |            /**************************************************************************************
 2505|       |              nCanonRankIsotopic contains input canonical numbering
 2506|       |              nCanonRankIsotopicStereo will be filled with a transposition of canonical numbering
 2507|       |                that  (1) keeps connection table unchanged and
 2508|       |                      (2) provides minimal stereo descriptors in
 2509|       |                          pCS->LinearCTStereoDble (length=pCS->nLenLinearCTStereoDble)
 2510|       |                          pCS->LinearCTStereoCarb (length=pCS->nLenLinearCTStereoCarb)
 2511|       |            */
 2512|      0|            nRet = map_stereo_bonds4( ic, pCG,
 2513|      0|                                      at,
 2514|      0|                                      num_atoms,
 2515|      0|                                      num_at_tg,
 2516|      0|                                      num_max,
 2517|      0|                                      0,
 2518|      0|                                      ftcn->PartitionCtIso.Rank,
 2519|      0|                                      ftcn->PartitionCtIso.AtNumber,
 2520|      0|                                      nCanonRankIsotopicStereoInv,
 2521|      0|                                      nSymmRank,
 2522|      0|                                      pRankStack1,
 2523|      0|                                      pRankStack2,
 2524|      0|                                      nTempRank,
 2525|      0|                                      nNumCurrRanks,
 2526|      0|                                      nSymmStereo,
 2527|      0|                                      NeighList,
 2528|      0|                                      pCS,
 2529|      0|                                      cur_tree,
 2530|      0|                                      0,
 2531|      0|                                      vABParityUnknown );
 2532|       |
 2533|      0|            if (RETURNED_ERROR( nRet ))
  ------------------
  |  |   72|      0|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   68|      0|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   66|      0|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   69|      0|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (72:31): [True: 0, False: 0]
  |  |  |  Branch (72:53): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2534|      0|            {
 2535|      0|                if (nRet == CT_TIMEOUT_ERR)
  ------------------
  |  |   55|      0|#define CT_TIMEOUT_ERR       (CT_ERR_FIRST- 8)  /*(-30008) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (2535:21): [True: 0, False: 0]
  ------------------
 2536|      0|                    goto exit_function;
 2537|      0|                else
 2538|      0|                    goto exit_function; /* program error */
 2539|      0|            }
 2540|      0|            else
 2541|      0|            {
 2542|      0|                int bFailed = 0;
 2543|       |
 2544|      0|                if (!nRet)
  ------------------
  |  Branch (2544:21): [True: 0, False: 0]
  ------------------
 2545|      0|                {
 2546|      0|                    bFailed = 1; /* program error */
 2547|      0|                    pCS2->nLenLinearCTIsotopicStereoDble =
 2548|      0|                        pCS->nLenLinearCTIsotopicStereoDble = -abs( pCS->nLenLinearCTStereoDble );
 2549|      0|                    pCS2->nLenLinearCTIsotopicStereoCarb =
 2550|      0|                        pCS->nLenLinearCTIsotopicStereoCarb = -abs( pCS->nLenLinearCTStereoCarb );
 2551|      0|                    nRet = CT_STEREOCOUNT_ERR;  /*  <BRKPT> */
  ------------------
  |  |   57|      0|#define CT_STEREOCOUNT_ERR   (CT_ERR_FIRST-10)  /*(-30010) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 2552|      0|                    goto exit_function; /* program error */
 2553|      0|                }
 2554|       |
 2555|       |                /* save isotopic pointers & lengths for INVERTED stereo */
 2556|       |
 2557|       |                /* save isotopic lengths */
 2558|      0|                pCS->nLenLinearCTIsotopicStereoDbleInv =
 2559|      0|                    pCS2->nLenLinearCTIsotopicStereoDbleInv = pCS->nLenLinearCTStereoDble;
 2560|      0|                pCS->nLenLinearCTIsotopicStereoCarbInv =
 2561|      0|                    pCS2->nLenLinearCTIsotopicStereoCarbInv = pCS->nLenLinearCTStereoCarb;
 2562|       |
 2563|       |                    /* restore pointers and lengths to non-inverted isotopic stereo */
 2564|       |                    /*  -- this is needed for InvertStereo() back, see below        */
 2565|      0|                pCS->LinearCTStereoDble = pCS2->LinearCTIsotopicStereoDble;
 2566|      0|                pCS->LinearCTStereoCarb = pCS2->LinearCTIsotopicStereoCarb;
 2567|      0|                pCS->nLenLinearCTStereoDble = pCS2->nLenLinearCTIsotopicStereoDble;
 2568|      0|                pCS->nLenLinearCTStereoCarb = pCS2->nLenLinearCTIsotopicStereoCarb;
 2569|       |
 2570|       |                /* consistency check */
 2571|      0|                if (pCS->nLenLinearCTIsotopicStereoDbleInv != pCS->nLenLinearCTIsotopicStereoDble ||
  ------------------
  |  Branch (2571:21): [True: 0, False: 0]
  ------------------
 2572|      0|                     pCS->nLenLinearCTIsotopicStereoCarbInv != pCS->nLenLinearCTIsotopicStereoCarb)
  ------------------
  |  Branch (2572:22): [True: 0, False: 0]
  ------------------
 2573|      0|                {
 2574|      0|                    nRet = CT_CALC_STEREO_ERR;
  ------------------
  |  |   62|      0|#define CT_CALC_STEREO_ERR   (CT_ERR_FIRST-15)  /*(-30015) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 2575|      0|                    goto exit_function; /* program error */
 2576|      0|                }
 2577|       |
 2578|       |                /******************************
 2579|       |                 *
 2580|       |                 * Invert stereo back
 2581|       |                 *
 2582|       |                 ******************************
 2583|       |                 *  (make sure that pointers
 2584|       |                 *  pCS->LinearCTStereoCarb,
 2585|       |                 *  pCS->LinearCTStereoDble
 2586|       |                 *  and corresponding lengths
 2587|       |                 *  have been restored)
 2588|       |                 ******************************/
 2589|       |
 2590|      0|                nRet = InvertStereo( at, num_at_tg, nCanonRankIsotopicStereo,
 2591|      0|                                     nTempRank, pCS, 0 );
 2592|       |
 2593|      0|                if (RETURNED_ERROR( nRet ))
  ------------------
  |  |   72|      0|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   68|      0|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   66|      0|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   69|      0|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (72:31): [True: 0, False: 0]
  |  |  |  Branch (72:53): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2594|      0|                {
 2595|      0|                    goto exit_function;
 2596|      0|                }
 2597|      0|                nRet = 0;
 2598|       |
 2599|       |                /* save stereo canonical numbering */
 2600|      0|                if (pCS->nCanonOrdIsotopicStereoInv)
  ------------------
  |  Branch (2600:21): [True: 0, False: 0]
  ------------------
 2601|      0|                {
 2602|      0|                    for (i = n = 0; i < num_at_tg; i++)
  ------------------
  |  Branch (2602:37): [True: 0, False: 0]
  ------------------
 2603|      0|                    {
 2604|      0|                        if (nCanonRankIsotopicStereoInv[i] && (int) nCanonRankIsotopicStereoInv[i] <= num_at_tg)
  ------------------
  |  Branch (2604:29): [True: 0, False: 0]
  |  Branch (2604:63): [True: 0, False: 0]
  ------------------
 2605|      0|                        {
 2606|      0|                            pCS->nCanonOrdIsotopicStereoInv[(int) nCanonRankIsotopicStereoInv[i] - 1] = (AT_NUMB) i;
 2607|      0|                        }
 2608|      0|                        else
 2609|      0|                        {
 2610|      0|                            bFailed++;
 2611|      0|                        }
 2612|      0|                    }
 2613|      0|                    pCS->nLenCanonOrdIsotopicStereo = bFailed ? -num_atoms : num_atoms;
  ------------------
  |  Branch (2613:55): [True: 0, False: 0]
  ------------------
 2614|      0|                }
 2615|       |
 2616|       |                /* compare inverted and non-inverted isotopic stereo */
 2617|      0|                pCS->bCmpIsotopicStereo = 2 + CompareLinCtStereo(
 2618|      0|                                         pCS->LinearCTIsotopicStereoDbleInv, pCS->nLenLinearCTIsotopicStereoDbleInv,
 2619|      0|                                         pCS->LinearCTIsotopicStereoCarbInv, pCS->nLenLinearCTIsotopicStereoCarbInv,
 2620|      0|                                         pCS->LinearCTIsotopicStereoDble, pCS->nLenLinearCTIsotopicStereoDble,
 2621|      0|                                         pCS->LinearCTIsotopicStereoCarb, pCS->nLenLinearCTIsotopicStereoCarb
 2622|      0|                );
 2623|      0|            }
 2624|      0|        }
 2625|      0|        else if (0 == nRet)
  ------------------
  |  Branch (2625:18): [True: 0, False: 0]
  ------------------
 2626|      0|        {
 2627|       |            /* nothing has been done, restore pointers and lengths for stereo */
 2628|      0|            pCS->LinearCTStereoDble = pCS2->LinearCTIsotopicStereoDble;
 2629|      0|            pCS->LinearCTStereoCarb = pCS2->LinearCTIsotopicStereoCarb;
 2630|      0|            pCS->nLenLinearCTStereoDble = pCS2->nLenLinearCTIsotopicStereoDble;
 2631|      0|            pCS->nLenLinearCTStereoCarb = pCS2->nLenLinearCTIsotopicStereoCarb;
 2632|      0|        }
 2633|       |
 2634|       |
 2635|      0|    bypass_isotopic_stereo:;  /* ???       */
 2636|       |
 2637|      0|        pCS->LinearCTIsotopic = pCS2->LinearCTIsotopic;
 2638|      0|    }
 2639|       |
 2640|       |
 2641|       |
 2642|   110k|exit_function:
 2643|       |
 2644|   110k|    if (bSwitchedAtomToIsotopic)
  ------------------
  |  Branch (2644:9): [True: 0, False: 110k]
  ------------------
 2645|      0|    {
 2646|      0|        SwitchAtomStereoAndIsotopicStereo( at, num_atoms, &bSwitchedAtomToIsotopic );
 2647|      0|        SetCtToNonIsotopicStereo( pCS, pCS2 ); /* ??? */
 2648|      0|    }
 2649|       |
 2650|       |    /* restore non-isotopic connection table */
 2651|   110k|    if (pCS->LinearCT2)
  ------------------
  |  Branch (2651:9): [True: 110k, False: 0]
  ------------------
 2652|   110k|    {
 2653|   110k|        inchi_swap( (char*) &pCS->LinearCT, (char*) &pCS->LinearCT2, sizeof( pCS->LinearCT ) );
 2654|   110k|        inchi_swap( (char*) &pCS->nLenLinearCT, (char*) &pCS->nLenLinearCT2, sizeof( pCS->nLenLinearCT ) );
 2655|   110k|        inchi_swap( (char*) &pCS->nLenLinearCTAtOnly, (char*) &pCS->nLenLinearCTAtOnly2, sizeof( pCS->nLenLinearCTAtOnly ) );
 2656|   110k|    }
 2657|       |
 2658|       |    /* free memory */
 2659|   110k|    i = 2;
 2660|   110k|    if (pRankStack1)
  ------------------
  |  Branch (2660:9): [True: 110k, False: 0]
  ------------------
 2661|   110k|    {
 2662|   110k|        pRankStack1[0] =
 2663|   110k|            pRankStack1[1] = NULL; /* deallocated separately */
 2664|   114k|        for (; i < nRankStackLen && pRankStack1[i]; i++)
  ------------------
  |  Branch (2664:16): [True: 114k, False: 0]
  |  Branch (2664:37): [True: 4.28k, False: 110k]
  ------------------
 2665|  4.28k|        {
 2666|  4.28k|            ;
 2667|  4.28k|        }
 2668|   110k|    }
 2669|   110k|    if (pRankStack1 && pRankStack2)
  ------------------
  |  Branch (2669:9): [True: 110k, False: 0]
  |  Branch (2669:24): [True: 0, False: 110k]
  ------------------
 2670|      0|    {
 2671|      0|        for (n = 2; n < nRankStackLen && pRankStack2[n]; n++)
  ------------------
  |  Branch (2671:21): [True: 0, False: 0]
  |  Branch (2671:42): [True: 0, False: 0]
  ------------------
 2672|      0|        {
 2673|      0|            if (i < nRankStackLen - 1)
  ------------------
  |  Branch (2673:17): [True: 0, False: 0]
  ------------------
 2674|      0|            {
 2675|      0|                pRankStack1[i++] = pRankStack2[n];
 2676|      0|            }
 2677|      0|            else
 2678|      0|            {
 2679|      0|                inchi_free( pRankStack2[n] );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2680|      0|            }
 2681|      0|        }
 2682|      0|        inchi_free( pRankStack2 );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2683|      0|    }
 2684|       |
 2685|   110k|    pCS->NeighList = NULL; /* keep the pointer in pBCN->ftcn[bTaut].NeighList for further deallocation */
 2686|   110k|    qfree( nAtomNumber );
  ------------------
  |  | 1149|   110k|#define qfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1149:26): [True: 0, False: 110k]
  |  |  |  Branch (1149:60): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2687|   110k|    qfree( nTempRank );
  ------------------
  |  | 1149|   110k|#define qfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1149:26): [True: 0, False: 110k]
  |  |  |  Branch (1149:60): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2688|   110k|    qfree( nRank );
  ------------------
  |  | 1149|   110k|#define qfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1149:26): [True: 0, False: 110k]
  |  |  |  Branch (1149:60): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2689|   110k|    qfree( nSymmRank );
  ------------------
  |  | 1149|   110k|#define qfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1149:26): [True: 0, False: 110k]
  |  |  |  Branch (1149:60): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2690|       |
 2691|   110k|    qfree( nSymmStereo );
  ------------------
  |  | 1149|   110k|#define qfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1149:26): [True: 0, False: 110k]
  |  |  |  Branch (1149:60): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2692|   110k|    CurTreeFree( cur_tree );
 2693|       |    /* memory leak fix */
 2694|       |    /*
 2695|       |    qfree ( nCurrRankIsotopicStereo );
 2696|       |    qfree ( nAtomNumberCurrIsotopicStereo);
 2697|       |    */
 2698|   110k|    qfree( nCanonRankIsotopicStereo );
  ------------------
  |  | 1149|   110k|#define qfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1149:26): [True: 0, False: 110k]
  |  |  |  Branch (1149:60): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2699|   110k|    qfree( nCanonRankIsotopicStereoInv );
  ------------------
  |  | 1149|   110k|#define qfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1149:26): [True: 0, False: 110k]
  |  |  |  Branch (1149:60): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2700|       |
 2701|   110k|    qfree( nCanonRankStereo );
  ------------------
  |  | 1149|   110k|#define qfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1149:26): [True: 0, False: 110k]
  |  |  |  Branch (1149:60): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2702|   110k|    qfree( nCanonRankStereoInv );
  ------------------
  |  | 1149|   110k|#define qfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1149:26): [True: 0, False: 110k]
  |  |  |  Branch (1149:60): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2703|       |
 2704|   110k|    InchiTimeGet( &ulEndTime );
 2705|       |
 2706|   110k|    pCS->lTotalTime = InchiTimeMsecDiff( ic, &ulEndTime, &ulStartTime );
 2707|       |
 2708|   110k|    return ( nRet >= -1 ) ? num_atoms : nRet;
  ------------------
  |  Branch (2708:12): [True: 110k, False: 0]
  ------------------
 2709|       |        /* cannot easily get number of ranks for now */
 2710|      0|}
Canon_INChI:
 2722|   110k|{
 2723|   110k|    if (pCS->pBCN && !pCS->NeighList)
  ------------------
  |  Branch (2723:9): [True: 110k, False: 0]
  |  Branch (2723:22): [True: 110k, False: 0]
  ------------------
 2724|   110k|    {
 2725|   110k|        return Canon_INChI3( ic, num_atoms, num_at_tg, at, pCS, pCG, nMode, bTautFtcn );
 2726|   110k|    }
 2727|       |
 2728|      0|    return CT_CANON_ERR;
  ------------------
  |  |   63|      0|#define CT_CANON_ERR         (CT_ERR_FIRST-16)  /*(-30016) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 2729|   110k|}
ichicano.c:InchiClock:
  105|   659k|{
  106|   659k|    clock_t c = clock( );
  107|   659k|    if (c != (clock_t) -1)
  ------------------
  |  Branch (107:9): [True: 659k, False: 0]
  ------------------
  108|   659k|    {
  109|   659k|        return c;
  110|   659k|    }
  111|      0|    return 0;
  112|   659k|}
ichicano.c:FillMaxMinClock:
  122|   447k|{
  123|   447k|    if (!ic->m_MaxPositiveClock)
  ------------------
  |  Branch (123:9): [True: 454, False: 446k]
  ------------------
  124|    454|    {
  125|    454|        clock_t valPos = 0, val1 = 1;
  126|  28.6k|        while (0 < ( ( val1 <<= 1 ), ( val1 |= 1 ) ))
  ------------------
  |  Branch (126:16): [True: 28.1k, False: 454]
  ------------------
  127|  28.1k|        {
  128|  28.1k|            valPos = val1;
  129|  28.1k|        }
  130|    454|        ic->m_MaxPositiveClock = valPos;
  131|    454|        ic->m_MinNegativeClock = -valPos;
  132|    454|        ic->m_HalfMaxPositiveClock = ic->m_MaxPositiveClock / 2;
  133|    454|        ic->m_HalfMinNegativeClock = ic->m_MinNegativeClock / 2;
  134|    454|    }
  135|   447k|}

AddErrorMessage:
  101|      9|{
  102|      9|    int len_all, len;
  103|       |
  104|      9|    if (!all_messages)
  ------------------
  |  Branch (104:9): [True: 0, False: 9]
  ------------------
  105|      0|    {
  106|      0|        return 0;
  107|      0|    }
  108|      9|    if (!new_message)
  ------------------
  |  Branch (108:9): [True: 0, False: 9]
  ------------------
  109|      0|    {
  110|      0|        return 0;
  111|      0|    }
  112|      9|    if (!new_message[0])
  ------------------
  |  Branch (112:9): [True: 0, False: 9]
  ------------------
  113|      0|    {
  114|      0|        return 0;
  115|      0|    }
  116|      9|    if (already_have_this_message( all_messages, new_message ))
  ------------------
  |  Branch (116:9): [True: 0, False: 9]
  ------------------
  117|      0|    {
  118|      0|        return 1;
  119|      0|    }
  120|       |
  121|      9|    len_all = (int) strlen( all_messages );
  122|      9|    len = (int) strlen( new_message );
  123|       |
  124|      9|    if (len_all + len + 2 * ( len_all > 0 ) < STR_ERR_LEN)
  ------------------
  |  |  154|      9|#define STR_ERR_LEN 256
  ------------------
  |  Branch (124:9): [True: 9, False: 0]
  ------------------
  125|      9|    {
  126|       |        /* enough room... add message and return */
  127|      9|        if (len_all > 0)
  ------------------
  |  Branch (127:13): [True: 3, False: 6]
  ------------------
  128|      3|        {
  129|      3|            if (all_messages[len_all - 1] != ':')
  ------------------
  |  Branch (129:17): [True: 1, False: 2]
  ------------------
  130|      1|            {
  131|      1|                strcat( all_messages, ";" );
  132|      1|            }
  133|      3|            strcat( all_messages, " " );
  134|      3|        }
  135|      9|        strcat( all_messages, new_message );
  136|      9|        return 1;
  137|      9|    }
  138|       |
  139|       |    /*  not enough room... add no-room marker if not yet added */
  140|      0|    if (strstr( all_messages, "..." ))
  ------------------
  |  Branch (140:9): [True: 0, False: 0]
  ------------------
  141|      0|    {
  142|      0|        return 0;
  143|      0|    }
  144|      0|    if (len_all + 3 < STR_ERR_LEN)
  ------------------
  |  |  154|      0|#define STR_ERR_LEN 256
  ------------------
  |  Branch (144:9): [True: 0, False: 0]
  ------------------
  145|      0|    {
  146|      0|        strcat( all_messages, "..." );
  147|      0|    }
  148|       |
  149|      0|    return 0;
  150|      0|}
ichierr.c:already_have_this_message:
  155|      9|{
  156|      9|    int have = 0;
  157|       |
  158|      9|    char *p = strstr( prev_messages, new_message );
  159|       |
  160|      9|    if (p)
  ------------------
  |  Branch (160:9): [True: 0, False: 9]
  ------------------
  161|      0|    {
  162|      0|        have = ( p == prev_messages || *( p - 1 ) == ' ' && ( *( p - 2 ) == ';' || *( p - 2 ) == ':' ) );
  ------------------
  |  Branch (162:18): [True: 0, False: 0]
  |  Branch (162:40): [True: 0, False: 0]
  |  Branch (162:63): [True: 0, False: 0]
  |  Branch (162:84): [True: 0, False: 0]
  ------------------
  163|      0|        if (have)
  ------------------
  |  Branch (163:13): [True: 0, False: 0]
  ------------------
  164|      0|        {
  165|      0|            int len_prev = (int) strlen( prev_messages );
  166|      0|            int len = (int) strlen( new_message );
  167|      0|            have = ( p + len == prev_messages + len_prev || p[len] == ';' && p[len + 1] == ' ' || p[len - 1] == ':' && p[len] == ' ' );
  ------------------
  |  Branch (167:22): [True: 0, False: 0]
  |  Branch (167:61): [True: 0, False: 0]
  |  Branch (167:78): [True: 0, False: 0]
  |  Branch (167:99): [True: 0, False: 0]
  |  Branch (167:120): [True: 0, False: 0]
  ------------------
  168|      0|        }
  169|      0|    }
  170|       |
  171|      9|    return have;
  172|      9|}

make_iso_sort_key:
   40|   114k|{
   41|   114k|    AT_ISO_SORT_KEY iso_sort_key = 0, mult = 1;
   42|       |
   43|   114k|    iso_sort_key += mult * num_1H;
   44|   114k|    mult *= AT_ISO_SORT_KEY_MULT;
  ------------------
  |  |   58|   114k|#define         AT_ISO_SORT_KEY_MULT  32    /* up to 32 identical hydrogen isotopes         */
  ------------------
   45|   114k|    iso_sort_key += mult * num_2H;
   46|   114k|    mult *= AT_ISO_SORT_KEY_MULT;
  ------------------
  |  |   58|   114k|#define         AT_ISO_SORT_KEY_MULT  32    /* up to 32 identical hydrogen isotopes         */
  ------------------
   47|   114k|    iso_sort_key += mult * num_3H;
   48|   114k|    mult *= AT_ISO_SORT_KEY_MULT;
  ------------------
  |  |   58|   114k|#define         AT_ISO_SORT_KEY_MULT  32    /* up to 32 identical hydrogen isotopes         */
  ------------------
   49|   114k|    iso_sort_key += mult * iso_atw_diff;
   50|       |
   51|   114k|    return iso_sort_key;
   52|   114k|}
set_atom_iso_sort_keys:
   63|   110k|{
   64|   110k|    int             i, num_isotopic = 0, bMergedTgroup;
   65|   110k|    AT_ISO_SORT_KEY iso_sort_key;
   66|   110k|    T_GROUP        *t_group =
   67|   110k|        ( t_group_info &&
  ------------------
  |  Branch (67:11): [True: 110k, False: 3]
  ------------------
   68|   110k|         t_group_info->t_group &&
  ------------------
  |  Branch (68:10): [True: 110k, False: 0]
  ------------------
   69|   110k|         t_group_info->num_t_groups > 0 ) ? t_group_info->t_group : NULL;
  ------------------
  |  Branch (69:10): [True: 4, False: 110k]
  ------------------
   70|       |
   71|   110k|    if (bHasIsotopicInTautomerGroups)
  ------------------
  |  Branch (71:9): [True: 110k, False: 3]
  ------------------
   72|   110k|    {
   73|   110k|        *bHasIsotopicInTautomerGroups = 0;
   74|   110k|    }
   75|   222k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (75:17): [True: 112k, False: 110k]
  ------------------
   76|   112k|    {
   77|   112k|        bMergedTgroup = ( t_group_info && t_group_info->nIsotopicEndpointAtomNumber && ( at[i].cFlags & AT_FLAG_ISO_H_POINT ) );
  ------------------
  |  |   82|     10|#define AT_FLAG_ISO_H_POINT 0x01  /* may have isotopic H */
  ------------------
  |  Branch (77:27): [True: 112k, False: 11]
  |  Branch (77:43): [True: 10, False: 112k]
  |  Branch (77:88): [True: 4, False: 6]
  ------------------
   78|   112k|        if (( !at[i].endpoint || !t_group ) && !bMergedTgroup)
  ------------------
  |  Branch (78:15): [True: 112k, False: 8]
  |  Branch (78:34): [True: 0, False: 8]
  |  Branch (78:48): [True: 112k, False: 0]
  ------------------
   79|   112k|        {
   80|   112k|            iso_sort_key = make_iso_sort_key( at[i].iso_atw_diff, at[i].num_iso_H[0], at[i].num_iso_H[1], at[i].num_iso_H[2] );
   81|   112k|        }
   82|      8|        else
   83|      8|        {
   84|       |             /*  H isotopes go to the tautomer part of the CT (name) */
   85|       |             /*  if (at[i].endpoint && t_group) ... */
   86|      8|            iso_sort_key = make_iso_sort_key( at[i].iso_atw_diff, 0, 0, 0 );
   87|      8|            if (bHasIsotopicInTautomerGroups)
  ------------------
  |  Branch (87:17): [True: 8, False: 0]
  ------------------
   88|      8|            {
   89|      8|                *bHasIsotopicInTautomerGroups += ( at[i].num_iso_H[0] || at[i].num_iso_H[1] || at[i].num_iso_H[2] || bMergedTgroup );
  ------------------
  |  Branch (89:52): [True: 0, False: 8]
  |  Branch (89:74): [True: 0, False: 8]
  |  Branch (89:96): [True: 0, False: 8]
  |  Branch (89:118): [True: 4, False: 4]
  ------------------
   90|      8|            }
   91|      8|        }
   92|   112k|        at[i].iso_sort_key = iso_sort_key;
   93|   112k|        num_isotopic += ( iso_sort_key != 0 );
   94|   112k|    }
   95|       |
   96|   110k|    return num_isotopic;
   97|   110k|}

MakeHillFormulaString:
  113|    168|{
  114|    168|    int nUsedLength0 = strbuf->nUsedLength;
  115|    168|    if (szHillFormula && !*bOverflow)
  ------------------
  |  Branch (115:9): [True: 168, False: 0]
  |  Branch (115:26): [True: 168, False: 0]
  ------------------
  116|    168|    {
  117|    168|        if (-1 == inchi_strbuf_printf( strbuf, "%s", szHillFormula ))
  ------------------
  |  Branch (117:13): [True: 0, False: 168]
  ------------------
  118|      0|        {
  119|      0|            *bOverflow |= 1;
  120|      0|            return  nUsedLength0 + 1;
  121|      0|        }
  122|    168|    }
  123|    168|    return ( strbuf->nUsedLength - nUsedLength0 );
  124|    168|}
GetHillFormulaIndexLength:
  134|   113k|{
  135|   113k|    char szCount[16];
  136|   113k|    if (count > 1)
  ------------------
  |  Branch (136:9): [True: 470, False: 112k]
  ------------------
  137|    470|    {
  138|    470|        return sprintf( szCount, "%d", count );
  139|    470|    }
  140|       |
  141|   112k|    return 0;
  142|   113k|}
GetHillFormulaCounts:
  157|   111k|{
  158|   111k|    char szElement[4];
  159|   111k|    U_CHAR nPrevAtom = (U_CHAR) -2;
  160|   111k|    int  bCarbon, bHydrogen, nElemLen, nFormLen, nNumNonHAtoms;
  161|   111k|    int  mult, i, num_H, num_C;
  162|       |
  163|   111k|    num_H = 0;
  164|   111k|    num_C = 0;
  165|   111k|    bCarbon = 0;
  166|   111k|    bHydrogen = 0;
  167|   111k|    nElemLen = 0;
  168|   111k|    nFormLen = 0;
  169|   111k|    mult = 0;
  170|   111k|    nNumNonHAtoms = num_atoms;
  171|       |
  172|   877k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (172:17): [True: 766k, False: 111k]
  ------------------
  173|   766k|    {
  174|   766k|        if (nPrevAtom != nAtom[i])
  ------------------
  |  Branch (174:13): [True: 113k, False: 653k]
  ------------------
  175|   113k|        {
  176|   113k|            if (mult)
  ------------------
  |  Branch (176:17): [True: 1.84k, False: 111k]
  ------------------
  177|  1.84k|            {
  178|  1.84k|                if (bHydrogen)
  ------------------
  |  Branch (178:21): [True: 0, False: 1.84k]
  ------------------
  179|      0|                {
  180|      0|                    num_H += mult;
  181|      0|                }
  182|  1.84k|                else if (bCarbon)
  ------------------
  |  Branch (182:26): [True: 55, False: 1.78k]
  ------------------
  183|     55|                {
  184|     55|                    num_C += mult;
  185|     55|                }
  186|  1.78k|                else
  187|  1.78k|                {
  188|  1.78k|                    nFormLen += nElemLen;
  189|  1.78k|                    nFormLen += GetHillFormulaIndexLength( mult );
  190|  1.78k|                }
  191|  1.84k|            }
  192|       |            /*if (-1 == get_element_chemical_symbol( (int) nAtom[i], szElement ))*/
  193|   113k|            if (-1 == get_element_or_pseudoelement_symbol( (int) nAtom[i], szElement ))
  ------------------
  |  Branch (193:17): [True: 0, False: 113k]
  ------------------
  194|      0|            {
  195|      0|                return -1;
  196|      0|            }
  197|   113k|            mult = 1;
  198|   113k|            nElemLen = (int) strlen( szElement );
  199|   113k|            nPrevAtom = nAtom[i];
  200|   113k|            bCarbon = !strcmp( szElement, "C" );
  201|   113k|            bHydrogen = !strcmp( szElement, "H" );
  202|   113k|            if (bHydrogen)
  ------------------
  |  Branch (202:17): [True: 2, False: 113k]
  ------------------
  203|      2|            {
  204|      2|                nNumNonHAtoms = i;
  205|      2|            }
  206|   113k|        }
  207|   653k|        else
  208|   653k|        {
  209|   653k|            mult++;
  210|   653k|        }
  211|       |
  212|   766k|        num_H += nNum_H[i];
  213|   766k|    }
  214|       |
  215|       |    /* NumGroups; ((NumAt+1, NumH, At1..AtNumAt),...) */
  216|       |
  217|   111k|    if (nTautomer && lenTautomer > 0)
  ------------------
  |  Branch (217:9): [True: 110k, False: 1.17k]
  |  Branch (217:22): [True: 44, False: 110k]
  ------------------
  218|     44|    {
  219|     44|        int num_groups = nTautomer[0];
  220|       |
  221|  1.46k|        for (i = 1; i < lenTautomer && num_groups > 0; i += nTautomer[i] + 1, num_groups--)
  ------------------
  |  Branch (221:21): [True: 1.41k, False: 44]
  |  Branch (221:40): [True: 1.41k, False: 0]
  ------------------
  222|  1.41k|        {
  223|  1.41k|            num_H += nTautomer[i + 1];
  224|  1.41k|        }
  225|     44|    }
  226|       |
  227|   111k|    if (mult)
  ------------------
  |  Branch (227:9): [True: 111k, False: 0]
  ------------------
  228|   111k|    {
  229|   111k|        if (bHydrogen)
  ------------------
  |  Branch (229:13): [True: 2, False: 111k]
  ------------------
  230|      2|        {
  231|      2|            num_H += mult;
  232|      2|        }
  233|   111k|        else if (bCarbon)
  ------------------
  |  Branch (233:18): [True: 42, False: 111k]
  ------------------
  234|     42|        {
  235|     42|            num_C += mult;
  236|     42|        }
  237|   111k|        else
  238|   111k|        {
  239|   111k|            nFormLen += nElemLen;
  240|   111k|            nFormLen += GetHillFormulaIndexLength( mult );
  241|   111k|        }
  242|   111k|    }
  243|       |
  244|   111k|    if (num_C)
  ------------------
  |  Branch (244:9): [True: 97, False: 111k]
  ------------------
  245|     97|    {
  246|     97|        nFormLen += (int) strlen( "C" );
  247|     97|        nFormLen += GetHillFormulaIndexLength( num_C );
  248|     97|    }
  249|       |
  250|   111k|    if (num_H)
  ------------------
  |  Branch (250:9): [True: 6, False: 111k]
  ------------------
  251|      6|    {
  252|      6|        nFormLen += (int) strlen( "H" );
  253|      6|        nFormLen += GetHillFormulaIndexLength( num_H );
  254|      6|    }
  255|       |
  256|   111k|    *pnum_C = num_C;
  257|   111k|    *pnum_H = num_H;
  258|   111k|    *pnLen = nFormLen;
  259|   111k|    *pnNumNonHAtoms = nNumNonHAtoms;
  260|       |
  261|   111k|    return 0;
  262|   111k|}
AddElementAndCount:
  269|   113k|{
  270|   113k|    char szMult[16];
  271|   113k|    int len1, len2;
  272|   113k|    if (mult > 0 && !*bOverflow && 0 < ( len1 = strlen( szElement ) ))
  ------------------
  |  Branch (272:9): [True: 113k, False: 0]
  |  Branch (272:21): [True: 113k, False: 0]
  |  Branch (272:36): [True: 113k, False: 0]
  ------------------
  273|   113k|    {
  274|   113k|        if (mult > 1)
  ------------------
  |  Branch (274:13): [True: 470, False: 112k]
  ------------------
  275|    470|        {
  276|    470|            len2 = sprintf( szMult, "%d", mult );
  277|    470|        }
  278|   112k|        else
  279|   112k|        {
  280|   112k|            len2 = 0;
  281|   112k|            szMult[0] = '\0';
  282|   112k|        }
  283|   113k|        if (len1 + len2 < nLenLinearCT)
  ------------------
  |  Branch (283:13): [True: 113k, False: 0]
  ------------------
  284|   113k|        {
  285|   113k|            memcpy( szLinearCT, szElement, len1 );
  286|   113k|            memcpy( szLinearCT + len1, szMult, len2 + 1 ); /*  adding zero termination */
  287|   113k|            return len1 + len2;
  288|   113k|        }
  289|      0|        else
  290|      0|        {
  291|      0|            ( *bOverflow )++;
  292|      0|        }
  293|   113k|    }
  294|       |
  295|      0|    return 0;
  296|   113k|}
MakeHillFormula:
  312|   111k|{
  313|   111k|    char szElement[4];
  314|   111k|    int  mult, compare2H;
  315|   111k|    int  i, nLen, bOvfl;
  316|   111k|    U_CHAR nPrevAtom;
  317|       |
  318|   111k|    nLen = 0;
  319|   111k|    mult = 0;
  320|   111k|    bOvfl = 0;
  321|   111k|    nPrevAtom = (U_CHAR) -2; /*  non-existent number */
  322|       |
  323|   111k|    if (num_C)
  ------------------
  |  Branch (323:9): [True: 97, False: 111k]
  ------------------
  324|     97|    {
  325|     97|        nLen += AddElementAndCount( "C", num_C, szLinearCT + nLen, nLen_szLinearCT - nLen, &bOvfl );
  326|     97|        if (num_H)
  ------------------
  |  Branch (326:13): [True: 4, False: 93]
  ------------------
  327|      4|        {
  328|      4|            nLen += AddElementAndCount( "H", num_H, szLinearCT + nLen, nLen_szLinearCT - nLen, &bOvfl );
  329|      4|            num_H = 0;
  330|      4|        }
  331|     97|    }
  332|       |
  333|   877k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (333:17): [True: 766k, False: 111k]
  ------------------
  334|   766k|    {
  335|       |
  336|   766k|        if (nPrevAtom != nAtom[i])
  ------------------
  |  Branch (336:13): [True: 112k, False: 653k]
  ------------------
  337|   112k|        {
  338|   112k|            if (mult)
  ------------------
  |  Branch (338:17): [True: 1.78k, False: 111k]
  ------------------
  339|  1.78k|            {
  340|  1.78k|                nLen += AddElementAndCount( szElement, mult, szLinearCT + nLen, nLen_szLinearCT - nLen, &bOvfl );
  341|  1.78k|            }
  342|   112k|            mult = 1;
  343|       |            /*if (-1 == get_element_chemical_symbol( (int) nAtom[i], szElement ))*/
  344|   112k|            if (-1 == get_element_or_pseudoelement_symbol( (int) nAtom[i], szElement ))
  ------------------
  |  Branch (344:17): [True: 0, False: 112k]
  ------------------
  345|      0|            {
  346|      0|                return -1; /*  wrong element */
  347|      0|            }
  348|       |
  349|   112k|            nPrevAtom = nAtom[i];
  350|   112k|            if (!strcmp( "C", szElement ))
  ------------------
  |  Branch (350:17): [True: 0, False: 112k]
  ------------------
  351|      0|            {
  352|      0|                return -1;
  353|      0|            }
  354|   112k|            compare2H = strcmp( "H", szElement );
  355|   112k|            if (!compare2H)
  ------------------
  |  Branch (355:17): [True: 0, False: 112k]
  ------------------
  356|      0|            {
  357|      0|                return -1;
  358|      0|            }
  359|   112k|            if (compare2H < 0 && num_H)
  ------------------
  |  Branch (359:17): [True: 112k, False: 474]
  |  Branch (359:34): [True: 0, False: 112k]
  ------------------
  360|      0|            {
  361|       |                /*   H-atom should be located in front of szElement */
  362|      0|                nLen += AddElementAndCount( "H", num_H, szLinearCT + nLen, nLen_szLinearCT - nLen, &bOvfl );
  363|      0|                num_H = 0;
  364|      0|            }
  365|   112k|        }
  366|   653k|        else
  367|   653k|        {
  368|   653k|            mult++;
  369|   653k|        }
  370|   766k|    }
  371|   111k|    if (mult)
  ------------------
  |  Branch (371:9): [True: 111k, False: 44]
  ------------------
  372|   111k|    {
  373|       |        /*  the last element if any */
  374|   111k|        nLen += AddElementAndCount( szElement, mult, szLinearCT + nLen, nLen_szLinearCT - nLen, &bOvfl );
  375|   111k|    }
  376|   111k|    if (num_H)
  ------------------
  |  Branch (376:9): [True: 2, False: 111k]
  ------------------
  377|      2|    {
  378|       |        /*  if H has not been output... */
  379|      2|        nLen += AddElementAndCount( "H", num_H, szLinearCT + nLen, nLen_szLinearCT - nLen, &bOvfl );
  380|      2|    }
  381|   111k|    *bOverflow |= ( 0 != bOvfl );
  382|       |
  383|   111k|    return bOvfl ? nLen_szLinearCT + 1 : nLen;
  ------------------
  |  Branch (383:12): [True: 0, False: 111k]
  ------------------
  384|   111k|}
AllocateAndFillHillFormula:
  391|   111k|{
  392|   111k|    int num_C, num_H, nLen, nNumNonHAtoms, ret, bOverflow;
  393|   111k|    char *pHillFormula = NULL;
  394|       |
  395|   111k|    bOverflow = 0;
  396|       |
  397|   111k|    if (!GetHillFormulaCounts( pINChI->nAtom,
  ------------------
  |  Branch (397:9): [True: 111k, False: 0]
  ------------------
  398|   111k|        pINChI->nNum_H,
  399|   111k|        pINChI->nNumberOfAtoms,
  400|   111k|        pINChI->nTautomer,
  401|   111k|        pINChI->lenTautomer,
  402|   111k|        &num_C, &num_H,
  403|   111k|        &nLen,
  404|   111k|        &nNumNonHAtoms ))
  405|   111k|    {
  406|       |
  407|   111k|#if ( FIX_GAF_2019_2==1 )
  408|   111k|        pHillFormula = (char*)inchi_calloc(nLen + 1, sizeof(char));
  ------------------
  |  | 1133|   111k|#define inchi_calloc   calloc
  ------------------
  409|       |#else
  410|       |        pHillFormula = (char*)inchi_malloc(nLen + 1);
  411|       |#endif
  412|       |
  413|   111k|        if (pHillFormula)
  ------------------
  |  Branch (413:13): [True: 111k, False: 0]
  ------------------
  414|   111k|        {
  415|       |
  416|   111k|            ret = MakeHillFormula( pINChI->nAtom + num_C,
  417|   111k|                                   nNumNonHAtoms - num_C,
  418|   111k|                                   pHillFormula,
  419|   111k|                                   nLen + 1,
  420|   111k|                                   num_C, num_H,
  421|   111k|                                   &bOverflow );
  422|       |
  423|   111k|            if (ret != nLen || bOverflow)
  ------------------
  |  Branch (423:17): [True: 0, False: 111k]
  |  Branch (423:32): [True: 0, False: 111k]
  ------------------
  424|      0|            {
  425|      0|                inchi_free( pHillFormula );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  426|      0|                pHillFormula = NULL;
  427|      0|            }
  428|   111k|        }
  429|   111k|    }
  430|       |
  431|   111k|    return pHillFormula;
  432|   111k|}
MarkAmbiguousStereo:
  696|   110k|{
  697|   110k|    int n, i, j1, j2, num, mark_atom, mark_bond;
  698|       |
  699|   110k|    if (!pCanonOrd)
  ------------------
  |  Branch (699:9): [True: 0, False: 110k]
  ------------------
  700|      0|    {
  701|      0|        return -1;
  702|      0|    }
  703|       |
  704|   110k|    num = 0;
  705|       |
  706|   110k|    n = nLenLinearCTStereoCarb;
  707|       |
  708|   110k|    mark_atom = bIsotopic ? AMBIGUOUS_STEREO_ATOM_ISO : AMBIGUOUS_STEREO_ATOM;
  ------------------
  |  |  276|     47|#define AMBIGUOUS_STEREO_ATOM_ISO  8
  ------------------
                  mark_atom = bIsotopic ? AMBIGUOUS_STEREO_ATOM_ISO : AMBIGUOUS_STEREO_ATOM;
  ------------------
  |  |  274|   220k|#define AMBIGUOUS_STEREO_ATOM      2
  ------------------
  |  Branch (708:17): [True: 47, False: 110k]
  ------------------
  709|       |
  710|   110k|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (710:17): [True: 0, False: 110k]
  ------------------
  711|      0|    {
  712|       |        /*  Mark ambiguous stereo centers (for displaying and "Ambiguous stereo" message) */
  713|      0|        if (ATOM_PARITY_NOT_UNKN( LinearCTStereoCarb[i].parity ) &&
  ------------------
  |  |  288|      0|#define ATOM_PARITY_NOT_UNKN(X)     (ATOM_PARITY_KNOWN(X) && (X) != AB_PARITY_UNKN)
  |  |  ------------------
  |  |  |  |  286|      0|#define ATOM_PARITY_KNOWN(X)        (AB_MIN_KNOWN_PARITY <= (X) && (X) <= AB_MAX_KNOWN_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  259|      0|#define AB_MIN_KNOWN_PARITY        1
  |  |  |  |  ------------------
  |  |  |  |               #define ATOM_PARITY_KNOWN(X)        (AB_MIN_KNOWN_PARITY <= (X) && (X) <= AB_MAX_KNOWN_PARITY)
  |  |  |  |  ------------------
  |  |  |  |  |  |  258|      0|#define AB_MAX_KNOWN_PARITY        4 /* precalculated from const. equivalence parities */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (286:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (286:68): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define ATOM_PARITY_NOT_UNKN(X)     (ATOM_PARITY_KNOWN(X) && (X) != AB_PARITY_UNKN)
  |  |  ------------------
  |  |  |  |  249|      0|#define AB_PARITY_UNKN   3  /* 3 => user marked as unknown parity */
  |  |  ------------------
  |  |  |  Branch (288:62): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  714|      0|             at[j1 = pCanonOrd[(int) LinearCTStereoCarb[i].at_num - 1]].bAmbiguousStereo)
  ------------------
  |  Branch (714:14): [True: 0, False: 0]
  ------------------
  715|      0|        {
  716|      0|            at[j1].bAmbiguousStereo |= mark_atom;
  717|      0|            norm_at[j1].bAmbiguousStereo |= mark_atom;
  718|      0|            num++;
  719|      0|        }
  720|      0|    }
  721|       |
  722|   110k|    n = nLenLinearCTStereoDble;
  723|       |
  724|   110k|    mark_bond = bIsotopic ? AMBIGUOUS_STEREO_BOND_ISO : AMBIGUOUS_STEREO_BOND;
  ------------------
  |  |  277|     47|#define AMBIGUOUS_STEREO_BOND_ISO  16
  ------------------
                  mark_bond = bIsotopic ? AMBIGUOUS_STEREO_BOND_ISO : AMBIGUOUS_STEREO_BOND;
  ------------------
  |  |  275|   220k|#define AMBIGUOUS_STEREO_BOND      4
  ------------------
  |  Branch (724:17): [True: 47, False: 110k]
  ------------------
  725|       |
  726|   110k|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (726:17): [True: 0, False: 110k]
  ------------------
  727|      0|    {
  728|       |        /*  Mark ambiguous stereo bonds or allenes (for displaying and "Ambiguous stereo" message) */
  729|       |
  730|      0|        if (ATOM_PARITY_WELL_DEF( LinearCTStereoDble[i].parity ))
  ------------------
  |  |  287|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  265|      0|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  264|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (287:38): [True: 0, False: 0]
  |  |  |  Branch (287:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  731|      0|        {
  732|      0|            j1 = pCanonOrd[(int) LinearCTStereoDble[i].at_num1 - 1];
  733|      0|            j2 = pCanonOrd[(int) LinearCTStereoDble[i].at_num2 - 1];
  734|       |
  735|      0|            if (at[j1].bAmbiguousStereo || at[j2].bAmbiguousStereo)
  ------------------
  |  Branch (735:17): [True: 0, False: 0]
  |  Branch (735:44): [True: 0, False: 0]
  ------------------
  736|      0|            {
  737|       |                /* If it is an allene then mark the central atom only
  738|       |                   because the bonds should not be marked to avoid misleading
  739|       |                   message "Ambiguous stereo: bond(s)": Allene makes a stereocenter
  740|       |                */
  741|       |
  742|      0|                int j1_parity = bIsotopic ? at[j1].stereo_bond_parity2[0] : at[j1].stereo_bond_parity[0];
  ------------------
  |  Branch (742:33): [True: 0, False: 0]
  ------------------
  743|       |
  744|      0|                int cumulene_len = BOND_CHAIN_LEN( j1_parity ); /* 0 => double bond, 1 => allene, 2 => cumulene,..*/
  ------------------
  |  |  242|      0|#define BOND_CHAIN_LEN(X)           (GET_BITS_CUMULENE_LEN(X)/MULT_STEREOBOND) /* 0 => double bond, 1 => allene, 2 => cumulene,..*/
  |  |  ------------------
  |  |  |  |  241|      0|#define GET_BITS_CUMULENE_LEN(X)    ((X)&MASK_CUMULENE_LEN)
  |  |  |  |  ------------------
  |  |  |  |  |  |  233|      0|#define MASK_CUMULENE_LEN  0x38  /* mask to retrieve (cumulene chain length - 1)*MULT_STEREOBOND    */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BOND_CHAIN_LEN(X)           (GET_BITS_CUMULENE_LEN(X)/MULT_STEREOBOND) /* 0 => double bond, 1 => allene, 2 => cumulene,..*/
  |  |  ------------------
  |  |  |  |  237|      0|#define MULT_STEREOBOND    0x08  /* multiplier for cumulene chain length
  |  |  ------------------
  ------------------
  745|       |
  746|      0|                if (cumulene_len % 2 && ( 1 >= MAX_NUM_STEREO_BONDS ||
  ------------------
  |  |  876|      0|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (746:21): [True: 0, False: 0]
  |  Branch (746:43): [Folded - Ignored]
  ------------------
  747|      0|                    !( bIsotopic ? at[j1].stereo_bond_neighbor2[1] : at[j1].stereo_bond_neighbor[1] ) )
  ------------------
  |  Branch (747:21): [True: 0, False: 0]
  |  Branch (747:24): [True: 0, False: 0]
  ------------------
  748|      0|                    )
  749|      0|                {
  750|       |                    /*  found an allene; locate its central atom */
  751|       |
  752|      0|                    int next_j, next_neigh;
  753|      0|                    int j = j1;
  754|       |
  755|      0|                    next_j = at[j].neighbor[bIsotopic ? at[j].stereo_bond_ord2[0] : at[j].stereo_bond_ord[0]];
  ------------------
  |  Branch (755:45): [True: 0, False: 0]
  ------------------
  756|       |
  757|      0|                    for (cumulene_len = ( cumulene_len - 1 ) / 2;
  758|      0|                         cumulene_len && 2 == at[next_j].valence;
  ------------------
  |  Branch (758:26): [True: 0, False: 0]
  |  Branch (758:42): [True: 0, False: 0]
  ------------------
  759|      0|                         cumulene_len--)
  760|      0|                    {
  761|      0|                        next_neigh = ( j == at[next_j].neighbor[0] );
  762|      0|                        j = next_j;
  763|      0|                        next_j = at[next_j].neighbor[next_neigh];
  764|      0|                    }
  765|       |                    /* next_j is the central atom */
  766|      0|                    if (2 == at[next_j].valence)
  ------------------
  |  Branch (766:25): [True: 0, False: 0]
  ------------------
  767|      0|                    {
  768|      0|                        at[next_j].bAmbiguousStereo |= mark_atom;
  769|      0|                        norm_at[next_j].bAmbiguousStereo |= mark_atom;
  770|      0|                        num++;
  771|      0|                        continue; /* do not mark the cumulene "bond" endpoints */
  772|      0|                    }
  773|      0|                }
  774|       |
  775|       |                /* Not an allene, mark double bond or cumulene end atoms */
  776|      0|                if (at[j1].bAmbiguousStereo)
  ------------------
  |  Branch (776:21): [True: 0, False: 0]
  ------------------
  777|      0|                {
  778|      0|                    at[j1].bAmbiguousStereo |= mark_bond; /*  ??? */
  779|      0|                    norm_at[j1].bAmbiguousStereo |= mark_bond;
  780|      0|                    num++;
  781|      0|                }
  782|       |
  783|      0|                if (at[j2].bAmbiguousStereo)
  ------------------
  |  Branch (783:21): [True: 0, False: 0]
  ------------------
  784|      0|                {
  785|      0|                    at[j2].bAmbiguousStereo |= mark_bond; /*  ??? */
  786|      0|                    norm_at[j2].bAmbiguousStereo |= mark_bond;
  787|      0|                    num++;
  788|      0|                }
  789|      0|            }
  790|      0|        }
  791|      0|    }
  792|       |
  793|   110k|    return num;
  794|   110k|}
UnmarkAllUndefinedUnknownStereo:
  800|   110k|{
  801|   110k|    INCHI_MODE nRet = 0;
  802|   110k|    int   i, n;
  803|       |
  804|   110k|    if (!Stereo || Stereo && !Stereo->nNumberOfStereoCenters && !Stereo->nNumberOfStereoBonds)
  ------------------
  |  Branch (804:9): [True: 0, False: 110k]
  |  Branch (804:20): [True: 110k, False: 0]
  |  Branch (804:30): [True: 110k, False: 0]
  |  Branch (804:65): [True: 110k, False: 0]
  ------------------
  805|   110k|    {
  806|   110k|        return nRet;
  807|   110k|    }
  808|       |
  809|       |    /* Stereocenters */
  810|      0|    if (!Stereo->nCompInv2Abs &&
  ------------------
  |  Branch (810:9): [True: 0, False: 0]
  ------------------
  811|      0|        ( n = Stereo->nNumberOfStereoCenters ) > 0 && ( nUserMode & REQ_MODE_SC_IGN_ALL_UU ))
  ------------------
  |  |   58|      0|#define REQ_MODE_SC_IGN_ALL_UU      0x000800    /* IAUSC Ignore stereocenters if All Undef/Unknown */
  ------------------
  |  Branch (811:9): [True: 0, False: 0]
  |  Branch (811:55): [True: 0, False: 0]
  ------------------
  812|      0|    {
  813|       |
  814|      0|        for (i = 0; i < n && !ATOM_PARITY_WELL_DEF( Stereo->t_parity[i] ); i++)
  ------------------
  |  |  287|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  265|      0|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  264|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (287:38): [True: 0, False: 0]
  |  |  |  Branch (287:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (814:21): [True: 0, False: 0]
  ------------------
  815|      0|        {
  816|      0|            ;
  817|      0|        }
  818|       |
  819|      0|        if (i == n)
  ------------------
  |  Branch (819:13): [True: 0, False: 0]
  ------------------
  820|      0|        {
  821|      0|            Stereo->nNumberOfStereoCenters = 0;
  822|       |
  823|      0|            for (i = 0; i < n; i++)
  ------------------
  |  Branch (823:25): [True: 0, False: 0]
  ------------------
  824|      0|            {
  825|      0|                Stereo->t_parity[i] = 0;
  826|      0|                Stereo->nNumber[i] = 0;
  827|      0|                Stereo->t_parityInv[i] = 0;
  828|      0|                Stereo->nNumberInv[i] = 0;
  829|      0|            }
  830|       |
  831|      0|            nRet |= REQ_MODE_SC_IGN_ALL_UU;
  ------------------
  |  |   58|      0|#define REQ_MODE_SC_IGN_ALL_UU      0x000800    /* IAUSC Ignore stereocenters if All Undef/Unknown */
  ------------------
  832|      0|        }
  833|      0|    }
  834|       |
  835|       |    /* Stereobonds */
  836|       |
  837|      0|    if (( n = Stereo->nNumberOfStereoBonds ) > 0 && ( nUserMode & REQ_MODE_SB_IGN_ALL_UU ))
  ------------------
  |  |   60|      0|#define REQ_MODE_SB_IGN_ALL_UU      0x001000    /* IAUSC Ignore stereobonds if All Undef/Unknown */
  ------------------
  |  Branch (837:9): [True: 0, False: 0]
  |  Branch (837:53): [True: 0, False: 0]
  ------------------
  838|      0|    {
  839|      0|        for (i = 0; i < n && !ATOM_PARITY_WELL_DEF( Stereo->b_parity[i] ); i++)
  ------------------
  |  |  287|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  265|      0|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  264|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (287:38): [True: 0, False: 0]
  |  |  |  Branch (287:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (839:21): [True: 0, False: 0]
  ------------------
  840|      0|        {
  841|      0|            ;
  842|      0|        }
  843|       |
  844|      0|        if (i == n)
  ------------------
  |  Branch (844:13): [True: 0, False: 0]
  ------------------
  845|      0|        {
  846|      0|            Stereo->nNumberOfStereoBonds = 0;
  847|      0|            for (i = 0; i < n; i++)
  ------------------
  |  Branch (847:25): [True: 0, False: 0]
  ------------------
  848|      0|            {
  849|      0|                Stereo->b_parity[i] = 0;
  850|      0|                Stereo->nBondAtom1[i] = 0;
  851|      0|                Stereo->nBondAtom2[i] = 0;
  852|      0|            }
  853|      0|            nRet |= REQ_MODE_SB_IGN_ALL_UU;
  ------------------
  |  |   60|      0|#define REQ_MODE_SB_IGN_ALL_UU      0x001000    /* IAUSC Ignore stereobonds if All Undef/Unknown */
  ------------------
  854|      0|        }
  855|      0|    }
  856|       |
  857|      0|    return nRet;
  858|   110k|}
FillOutINChI:
  988|   110k|{
  989|   110k|    int i, j, m, n, g, len, ii, ret = 0;
  990|       |
  991|   110k|    AT_NUMB   *pSymmRank, *pOrigNosInCanonOrd, *pConstitEquNumb, *pCanonOrd = NULL, *pCanonOrdInv = NULL, *pCanonOrdTaut;
  992|   110k|    T_GROUP_INFO     *t_group_info = pCS->t_group_info;
  993|   110k|    T_GROUP *t_group;
  994|       |
  995|   110k|    int nErrorCode = 0;
  996|   110k|    AT_NUMB *pCanonRank, *pCanonRankInv; /* canonical ranks of the atoms or tautomeric groups */
  997|   110k|    AT_NUMB *pCanonRankAtoms = NULL, *pSortOrd = NULL;
  998|   110k|    AT_RANK nMinOrd;
  999|       |
 1000|   110k|    INChI_Stereo *Stereo;
 1001|   110k|    int          bUseNumberingInv = 0, bUseIsotopicNumberingInv = 0;
 1002|       |
 1003|   110k|    INCHI_MODE    nStereoUnmarkMode;
 1004|       |
 1005|       |    /*AT_NUMB  *pCanonOrdNonIso = NULL, *pCanonOrdIso = NULL;*/
 1006|       |    /*AT_NUMB  *nOrigAtNosInCanonOrdNonIso = NULL, *nOrigAtNosInCanonOrdIso = NULL;*/
 1007|       |
 1008|       |
 1009|       |    /*  Check for warnings */
 1010|   110k|    if (pCS->nLenLinearCTStereoCarb < 0 || pCS->nLenLinearCTStereoDble < 0 ||
  ------------------
  |  Branch (1010:9): [True: 0, False: 110k]
  |  Branch (1010:44): [True: 0, False: 110k]
  ------------------
 1011|   110k|         pCS->nLenCanonOrdStereo < 0 || pCS->nLenCanonOrdStereoTaut < 0)
  ------------------
  |  Branch (1011:10): [True: 0, False: 110k]
  |  Branch (1011:41): [True: 0, False: 110k]
  ------------------
 1012|      0|    {
 1013|      0|        nErrorCode |= WARN_FAILED_STEREO;
  ------------------
  |  |   76|      0|#define WARN_FAILED_STEREO          0x0001
  ------------------
 1014|      0|    }
 1015|   110k|    if (pCS->nLenLinearCTIsotopic < 0 || pCS->nLenLinearCTIsotopicTautomer < 0 ||
  ------------------
  |  Branch (1015:9): [True: 0, False: 110k]
  |  Branch (1015:42): [True: 0, False: 110k]
  ------------------
 1016|   110k|         pCS->nLenCanonOrdIsotopic < 0 || pCS->nLenCanonOrdIsotopicTaut < 0)
  ------------------
  |  Branch (1016:10): [True: 0, False: 110k]
  |  Branch (1016:43): [True: 0, False: 110k]
  ------------------
 1017|      0|    {
 1018|      0|        nErrorCode |= WARN_FAILED_ISOTOPIC;
  ------------------
  |  |   77|      0|#define WARN_FAILED_ISOTOPIC        0x0002
  ------------------
 1019|      0|    }
 1020|   110k|    if (pCS->nLenLinearCTIsotopicStereoCarb < 0 || pCS->nLenLinearCTIsotopicStereoDble < 0 ||
  ------------------
  |  Branch (1020:9): [True: 0, False: 110k]
  |  Branch (1020:52): [True: 0, False: 110k]
  ------------------
 1021|   110k|         pCS->nLenCanonOrdIsotopicStereo < 0 || pCS->nLenCanonOrdIsotopicStereoTaut < 0)
  ------------------
  |  Branch (1021:10): [True: 0, False: 110k]
  |  Branch (1021:49): [True: 0, False: 110k]
  ------------------
 1022|      0|    {
 1023|      0|        nErrorCode |= WARN_FAILED_ISOTOPIC_STEREO;
  ------------------
  |  |   78|      0|#define WARN_FAILED_ISOTOPIC_STEREO 0x0004
  ------------------
 1024|      0|    }
 1025|       |
 1026|   110k|    pCanonRankAtoms = (AT_NUMB *) inchi_calloc( num_at_tg + 1, sizeof( pCanonRankAtoms[0] ) );
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
 1027|       |
 1028|   110k|    pSortOrd = (AT_NUMB *) inchi_calloc( num_at_tg + 1, sizeof( pSortOrd[0] ) ); /*  must have more than num_atoms */
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
 1029|       |
 1030|   110k|    if (!pCanonRankAtoms || !pSortOrd)
  ------------------
  |  Branch (1030:9): [True: 0, False: 110k]
  |  Branch (1030:29): [True: 0, False: 110k]
  ------------------
 1031|      0|    {
 1032|      0|        nErrorCode = 0;
 1033|      0|        ret = CT_OUT_OF_RAM;  /*   <BRKPT> */
  ------------------
  |  |   49|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1034|      0|        pINChI->nErrorCode = pINChI_Aux->nErrorCode = CT_OUT_OF_RAM;
  ------------------
  |  |   49|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1035|      0|        goto exit_function;
 1036|      0|    }
 1037|       |
 1038|       |    /*  Total charge */
 1039|   222k|    for (i = 0, n = 0; i < num_atoms + num_removed_H; i++)
  ------------------
  |  Branch (1039:24): [True: 112k, False: 110k]
  ------------------
 1040|   112k|    {
 1041|   112k|        n += at[i].charge;
 1042|   112k|    }
 1043|   110k|    pINChI->nTotalCharge = n;
 1044|       |
 1045|       |    /*  Number of atoms */
 1046|   110k|    pINChI->nNumberOfAtoms = num_atoms;
 1047|   110k|    pINChI_Aux->nNumberOfAtoms = num_atoms;
 1048|       |
 1049|       |    /* Removed protons and detachable isotopic H */
 1050|   110k|    if (bTautomeric && t_group_info)
  ------------------
  |  Branch (1050:9): [True: 110k, False: 3]
  |  Branch (1050:24): [True: 110k, False: 0]
  ------------------
 1051|   110k|    {
 1052|   110k|        pINChI_Aux->nNumRemovedProtons = t_group_info->tni.nNumRemovedProtons;
 1053|       |
 1054|   440k|        for (i = 0; i < NUM_H_ISOTOPES; i++)
  ------------------
  |  |   53|   440k|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (1054:21): [True: 330k, False: 110k]
  ------------------
 1055|   330k|        {
 1056|   330k|            pINChI_Aux->nNumRemovedIsotopicH[i] = t_group_info->num_iso_H[i]
 1057|   330k|                + t_group_info->tni.nNumRemovedProtonsIsotopic[i];
 1058|   330k|        }
 1059|       |
 1060|   110k|        if (pINChI_Aux->bNormalizationFlags & FLAG_FORCE_SALT_TAUT)
  ------------------
  |  |  200|   110k|#define FLAG_FORCE_SALT_TAUT         ( FLAG_PROTON_NP_HARD_REMOVED  | \
  |  |  ------------------
  |  |  |  |  175|   110k|#define FLAG_PROTON_NP_HARD_REMOVED    0x0002
  |  |  ------------------
  |  |  201|   110k|                                       FLAG_PROTON_AC_HARD_REMOVED  | \
  |  |  ------------------
  |  |  |  |  178|   110k|#define FLAG_PROTON_AC_HARD_REMOVED    0x0010
  |  |  ------------------
  |  |  202|   110k|                                       FLAG_PROTON_AC_HARD_ADDED    )
  |  |  ------------------
  |  |  |  |  179|   110k|#define FLAG_PROTON_AC_HARD_ADDED      0x0020
  |  |  ------------------
  ------------------
  |  Branch (1060:13): [True: 0, False: 110k]
  ------------------
 1061|      0|        {
 1062|      0|            pINChI->nFlags |= INCHI_FLAG_HARD_ADD_REM_PROTON;
  ------------------
  |  |  155|      0|#define INCHI_FLAG_HARD_ADD_REM_PROTON  0x0080   /* in normalization a proton has been added or removed along alt path */
  ------------------
 1063|      0|        }
 1064|   110k|        if (pINChI_Aux->bNormalizationFlags & ( FLAG_NORM_CONSIDER_TAUT &~FLAG_PROTON_CHARGE_CANCEL ))
  ------------------
  |  |  184|   110k|#define FLAG_NORM_CONSIDER_TAUT      ( FLAG_PROTON_NPO_SIMPLE_REMOVED | \
  |  |  ------------------
  |  |  |  |  174|   110k|#define FLAG_PROTON_NPO_SIMPLE_REMOVED 0x0001
  |  |  ------------------
  |  |  185|   110k|                                       FLAG_PROTON_NP_HARD_REMOVED    | \
  |  |  ------------------
  |  |  |  |  175|   110k|#define FLAG_PROTON_NP_HARD_REMOVED    0x0002
  |  |  ------------------
  |  |  186|   110k|                                       FLAG_PROTON_AC_SIMPLE_ADDED    | \
  |  |  ------------------
  |  |  |  |  176|   110k|#define FLAG_PROTON_AC_SIMPLE_ADDED    0x0004
  |  |  ------------------
  |  |  187|   110k|                                       FLAG_PROTON_AC_SIMPLE_REMOVED  | \
  |  |  ------------------
  |  |  |  |  177|   110k|#define FLAG_PROTON_AC_SIMPLE_REMOVED  0x0008
  |  |  ------------------
  |  |  188|   110k|                                       FLAG_PROTON_AC_HARD_REMOVED    | \
  |  |  ------------------
  |  |  |  |  178|   110k|#define FLAG_PROTON_AC_HARD_REMOVED    0x0010
  |  |  ------------------
  |  |  189|   110k|                                       FLAG_PROTON_AC_HARD_ADDED      | \
  |  |  ------------------
  |  |  |  |  179|   110k|#define FLAG_PROTON_AC_HARD_ADDED      0x0020
  |  |  ------------------
  |  |  190|   110k|                                       FLAG_PROTON_SINGLE_REMOVED     | \
  |  |  ------------------
  |  |  |  |  181|   110k|#define FLAG_PROTON_SINGLE_REMOVED     0x0080
  |  |  ------------------
  |  |  191|   110k|                                       FLAG_PROTON_CHARGE_CANCEL    )
  |  |  ------------------
  |  |  |  |  180|   110k|#define FLAG_PROTON_CHARGE_CANCEL      0x0040
  |  |  ------------------
  ------------------
                      if (pINChI_Aux->bNormalizationFlags & ( FLAG_NORM_CONSIDER_TAUT &~FLAG_PROTON_CHARGE_CANCEL ))
  ------------------
  |  |  180|   110k|#define FLAG_PROTON_CHARGE_CANCEL      0x0040
  ------------------
  |  Branch (1064:13): [True: 5, False: 110k]
  ------------------
 1065|      5|        {
 1066|      5|            if (!bNoWarnings)
  ------------------
  |  Branch (1066:17): [True: 5, False: 0]
  ------------------
 1067|      5|            {
 1068|      5|                WarningMessage( pStrErrStruct, "Proton(s) added/removed" );
  ------------------
  |  |  160|      5|#define WarningMessage AddErrorMessage
  ------------------
 1069|      5|            }
 1070|      5|        }
 1071|   110k|        if (pINChI_Aux->bNormalizationFlags & FLAG_PROTON_CHARGE_CANCEL)
  ------------------
  |  |  180|   110k|#define FLAG_PROTON_CHARGE_CANCEL      0x0040
  ------------------
  |  Branch (1071:13): [True: 0, False: 110k]
  ------------------
 1072|      0|        {
 1073|      0|            if (!bNoWarnings)
  ------------------
  |  Branch (1073:17): [True: 0, False: 0]
  ------------------
 1074|      0|            {
 1075|      0|                WarningMessage( pStrErrStruct, "Charges neutralized" );
  ------------------
  |  |  160|      0|#define WarningMessage AddErrorMessage
  ------------------
 1076|      0|            }
 1077|      0|        }
 1078|   110k|    }
 1079|       |
 1080|       |    /* Abs or rel stereo may establish one of two canonical numberings */
 1081|   110k|    if (( pCS->nLenLinearCTStereoCarb > 0 || pCS->nLenLinearCTStereoDble > 0 ) &&
  ------------------
  |  Branch (1081:11): [True: 0, False: 110k]
  |  Branch (1081:46): [True: 0, False: 110k]
  ------------------
 1082|   110k|          pCS->nLenCanonOrdStereo > 0 &&
  ------------------
  |  Branch (1082:11): [True: 0, False: 0]
  ------------------
 1083|   110k|          ( pCS->LinearCTStereoCarb && pCS->LinearCTStereoCarbInv ||
  ------------------
  |  Branch (1083:13): [True: 0, False: 0]
  |  Branch (1083:40): [True: 0, False: 0]
  ------------------
 1084|      0|              pCS->LinearCTStereoDble && pCS->LinearCTStereoDbleInv ) &&
  ------------------
  |  Branch (1084:15): [True: 0, False: 0]
  |  Branch (1084:42): [True: 0, False: 0]
  ------------------
 1085|   110k|          pCS->nCanonOrdStereo    && pCS->nCanonOrdStereoInv
  ------------------
  |  Branch (1085:11): [True: 0, False: 0]
  |  Branch (1085:38): [True: 0, False: 0]
  ------------------
 1086|   110k|       )
 1087|      0|    {
 1088|      0|        pCanonRank = pCanonRankAtoms;
 1089|      0|        pCanonOrd = pCS->nCanonOrdStereo;
 1090|      0|        pCanonRankInv = pSortOrd;
 1091|      0|        pCanonOrdInv = pCS->nCanonOrdStereoInv;
 1092|      0|        Stereo = pINChI->Stereo;
 1093|       |
 1094|      0|        for (i = 0; i < num_at_tg; i++)
  ------------------
  |  Branch (1094:21): [True: 0, False: 0]
  ------------------
 1095|      0|        {
 1096|      0|            pCanonRankInv[pCanonOrdInv[i]] =
 1097|      0|                pCanonRank[pCanonOrd[i]] = (AT_NUMB) ( i + 1 );
 1098|      0|        }
 1099|       |
 1100|       |        /********************************************************************/
 1101|       |        /* Copy stereo bonds and stereo centers; compare Inv and Abs stereo */
 1102|       |        /********************************************************************/
 1103|       |
 1104|      0|        nErrorCode = CopyLinearCTStereoToINChIStereo( Stereo,
 1105|      0|                                                      pCS->LinearCTStereoCarb,
 1106|      0|                                                      pCS->nLenLinearCTStereoCarb,
 1107|      0|                                                      pCS->LinearCTStereoDble,
 1108|      0|                                                      pCS->nLenLinearCTStereoDble,
 1109|      0|                                                      pCanonOrd, pCanonRank,
 1110|      0|                                                      at, 0 /* non-isotopic */,
 1111|      0|                                                      pCS->LinearCTStereoCarbInv,
 1112|      0|                                                      pCS->LinearCTStereoDbleInv,
 1113|      0|                                                      pCanonOrdInv, pCanonRankInv );
 1114|       |
 1115|      0|        if (Stereo->t_parityInv && Stereo->nNumberInv)
  ------------------
  |  Branch (1115:13): [True: 0, False: 0]
  |  Branch (1115:36): [True: 0, False: 0]
  ------------------
 1116|      0|        {
 1117|      0|            if (nUserMode & REQ_MODE_RELATIVE_STEREO)
  ------------------
  |  |   54|      0|#define REQ_MODE_RELATIVE_STEREO    0x000200    /* REL All Relative Stereo */
  ------------------
  |  Branch (1117:17): [True: 0, False: 0]
  ------------------
 1118|      0|            {
 1119|      0|                pINChI->nFlags |= INCHI_FLAG_REL_STEREO;
  ------------------
  |  |  149|      0|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
 1120|      0|            }
 1121|      0|            if (nUserMode & REQ_MODE_RACEMIC_STEREO)
  ------------------
  |  |   56|      0|#define REQ_MODE_RACEMIC_STEREO     0x000400    /* RAC All Racemic Stereo */
  ------------------
  |  Branch (1121:17): [True: 0, False: 0]
  ------------------
 1122|      0|            {
 1123|      0|                pINChI->nFlags |= INCHI_FLAG_RAC_STEREO;
  ------------------
  |  |  150|      0|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
 1124|      0|            }
 1125|      0|            if (Stereo->nCompInv2Abs)
  ------------------
  |  Branch (1125:17): [True: 0, False: 0]
  ------------------
 1126|      0|            {
 1127|      0|                if (Stereo->nCompInv2Abs == -1)
  ------------------
  |  Branch (1127:21): [True: 0, False: 0]
  ------------------
 1128|      0|                {
 1129|       |                    /* switch pointers in Stereo so that the stereo becomes the smallest (relative)  */
 1130|       |                    /* flag Stereo->nCompInv2Abs == -1 will keep track of this exchange */
 1131|      0|                    AT_NUMB    *nNumberInv = Stereo->nNumberInv;
 1132|      0|                    S_CHAR     *t_parityInv = Stereo->t_parityInv;
 1133|      0|                    Stereo->nNumberInv = Stereo->nNumber;
 1134|      0|                    Stereo->t_parityInv = Stereo->t_parity;
 1135|      0|                    Stereo->nNumber = nNumberInv;
 1136|      0|                    Stereo->t_parity = t_parityInv;
 1137|       |                    /* switch pointers to set rel. stereo to pINChI_Aux->nOrigAtNosInCanonOrd
 1138|       |                                       and inv. stereo to pINChI_Aux->nOrigAtNosInCanonOrdInv */
 1139|      0|                    switch_ptrs( &pCanonRank, &pCanonRankInv );
 1140|      0|                    switch_ptrs( &pCanonOrd, &pCanonOrdInv );
 1141|      0|                    bUseNumberingInv = 1; /* use inverted stereo numbering instead of normal */
 1142|      0|                }
 1143|      0|            }
 1144|      0|        }
 1145|       |
 1146|      0|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1146:21): [True: 0, False: 0]
  ------------------
 1147|      0|        {
 1148|      0|            pINChI_Aux->nOrigAtNosInCanonOrdInv[i] = at[pCanonOrdInv[i]].orig_at_number;
 1149|      0|            pINChI_Aux->nOrigAtNosInCanonOrd[i] = at[pCanonOrd[i]].orig_at_number;
 1150|      0|        }
 1151|       |
 1152|      0|        if (bUseNumberingInv)
  ------------------
  |  Branch (1152:13): [True: 0, False: 0]
  ------------------
 1153|      0|        {
 1154|       |            /* switch ptrs back to avoid confusion */
 1155|      0|            switch_ptrs( &pCanonRank, &pCanonRankInv );
 1156|      0|            switch_ptrs( &pCanonOrd, &pCanonOrdInv );
 1157|       |            /* save inverted stereo ranks & order because it represents the smallest (relative) */
 1158|      0|            memcpy( pCanonRank, pCanonRankInv, num_at_tg * sizeof( pCanonRank[0] ) );
 1159|       |            /* change pCS->nCanonOrdStereo[] to inverted: */
 1160|      0|            memcpy( pCanonOrd, pCanonOrdInv, num_at_tg * sizeof( pCanonOrd[0] ) );
 1161|      0|        }
 1162|       |
 1163|      0|        pCanonRankInv = NULL;
 1164|      0|        pCanonOrdInv = NULL;
 1165|      0|        pOrigNosInCanonOrd = NULL;
 1166|      0|    }
 1167|   110k|    else
 1168|   110k|    {
 1169|       |        /*------------------------------ no stereo */
 1170|   110k|        pCanonOrd = pCS->nLenCanonOrdStereo > 0 ? pCS->nCanonOrdStereo
  ------------------
  |  Branch (1170:21): [True: 0, False: 110k]
  ------------------
 1171|   110k|                                                : pCS->nLenCanonOrd > 0  ? pCS->nCanonOrd
  ------------------
  |  Branch (1171:51): [True: 110k, False: 0]
  ------------------
 1172|   110k|                                                                         : NULL;
 1173|   110k|        pCanonRank = pCanonRankAtoms;
 1174|   110k|        pOrigNosInCanonOrd = pINChI_Aux->nOrigAtNosInCanonOrd;
 1175|       |
 1176|   110k|        if (pCanonOrd && pCanonRank)
  ------------------
  |  Branch (1176:13): [True: 110k, False: 0]
  |  Branch (1176:26): [True: 110k, False: 0]
  ------------------
 1177|   110k|        {
 1178|   222k|            for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1178:25): [True: 112k, False: 110k]
  ------------------
 1179|   112k|            {
 1180|   112k|                pCanonRank[pCanonOrd[i]] = (AT_NUMB) ( i + 1 );
 1181|   112k|                pOrigNosInCanonOrd[i] = at[pCanonOrd[i]].orig_at_number;
 1182|   112k|            }
 1183|   110k|            for (; i < num_at_tg; i++)
  ------------------
  |  Branch (1183:20): [True: 4, False: 110k]
  ------------------
 1184|      4|            {
 1185|      4|                pCanonRank[pCanonOrd[i]] = (AT_NUMB) ( i + 1 );
 1186|      4|            }
 1187|   110k|        }
 1188|   110k|    }
 1189|       |    /*pCanonOrdNonIso = pCanonOrd;*/  /* save for aux info */
 1190|       |
 1191|       |
 1192|   110k|    if (pINChI_Aux->OrigInfo)
  ------------------
  |  Branch (1192:9): [True: 110k, False: 0]
  ------------------
 1193|   110k|    {
 1194|       |        /* charges, radicals, valences */
 1195|   222k|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1195:21): [True: 112k, False: 110k]
  ------------------
 1196|   112k|        {
 1197|   112k|            ii = pCanonOrd[i];
 1198|       |
 1199|   112k|            if (norm_at[ii].valence || norm_at[ii].num_H)
  ------------------
  |  Branch (1199:17): [True: 40, False: 112k]
  |  Branch (1199:40): [True: 0, False: 112k]
  ------------------
 1200|     40|            {
 1201|     40|                pINChI_Aux->OrigInfo[i].cCharge = norm_at[ii].charge;
 1202|       |
 1203|     40|                pINChI_Aux->OrigInfo[i].cRadical = ( norm_at[ii].radical == RADICAL_SINGLET ) ? 0 :
  ------------------
  |  |  103|     40|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (1203:52): [True: 0, False: 40]
  ------------------
 1204|     40|                    ( norm_at[ii].radical == RADICAL_DOUBLET ) ? 1 :
  ------------------
  |  |  104|     40|#define RADICAL_DOUBLET 2
  ------------------
  |  Branch (1204:21): [True: 8, False: 32]
  ------------------
 1205|     40|                    ( norm_at[ii].radical == RADICAL_TRIPLET ) ? 2 :
  ------------------
  |  |  105|     32|#define RADICAL_TRIPLET 3
  ------------------
  |  Branch (1205:21): [True: 0, False: 32]
  ------------------
 1206|     32|                    norm_at[ii].radical ? 3 : 0;
  ------------------
  |  Branch (1206:21): [True: 0, False: 32]
  ------------------
 1207|       |
 1208|     40|                pINChI_Aux->OrigInfo[i].cUnusualValence =
 1209|     40|                    get_unusual_el_valence( norm_at[ii].el_number, norm_at[ii].charge, norm_at[ii].radical,
 1210|     40|                                            norm_at[ii].chem_bonds_valence, norm_at[ii].num_H, norm_at[ii].valence );
 1211|     40|            }
 1212|   112k|            else
 1213|   112k|            {
 1214|       |                /* charge of a single atom component is in the INChI; valence = 0 is standard */
 1215|   112k|                pINChI_Aux->OrigInfo[i].cRadical = ( norm_at[ii].radical == RADICAL_SINGLET ) ? 0 :
  ------------------
  |  |  103|   112k|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (1215:52): [True: 0, False: 112k]
  ------------------
 1216|   112k|                    ( norm_at[ii].radical == RADICAL_DOUBLET ) ? 1 :
  ------------------
  |  |  104|   112k|#define RADICAL_DOUBLET 2
  ------------------
  |  Branch (1216:21): [True: 0, False: 112k]
  ------------------
 1217|   112k|                    ( norm_at[ii].radical == RADICAL_TRIPLET ) ? 2 :
  ------------------
  |  |  105|   112k|#define RADICAL_TRIPLET 3
  ------------------
  |  Branch (1217:21): [True: 0, False: 112k]
  ------------------
 1218|   112k|                    norm_at[ii].radical ? 3 : 0;
  ------------------
  |  Branch (1218:21): [True: 0, False: 112k]
  ------------------
 1219|   112k|            }
 1220|   112k|        }
 1221|   110k|    }
 1222|       |
 1223|       |    /* Non-isotopic canonical numbers and equivalence of atoms (Aux) */
 1224|   110k|    pConstitEquNumb = pINChI_Aux->nConstitEquNumbers;  /*  contitutional equivalence */
 1225|   110k|    pSymmRank = pCS->nSymmRank;
 1226|       |
 1227|   110k|    if (pCanonOrd && pCanonRank && pSymmRank && pConstitEquNumb)
  ------------------
  |  Branch (1227:9): [True: 110k, False: 0]
  |  Branch (1227:22): [True: 110k, False: 0]
  |  Branch (1227:36): [True: 110k, False: 0]
  |  Branch (1227:49): [True: 110k, False: 0]
  ------------------
 1228|   110k|    {
 1229|   222k|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1229:21): [True: 112k, False: 110k]
  ------------------
 1230|   112k|        {
 1231|   112k|            pConstitEquNumb[i] = pSymmRank[pCanonOrd[i]]; /*  constit. equ. ranks in order of canonical numbers */
 1232|   112k|            pSortOrd[i] = i;
 1233|   112k|        }
 1234|   110k|        for (; i < num_at_tg; i++)
  ------------------
  |  Branch (1234:16): [True: 4, False: 110k]
  ------------------
 1235|      4|        {
 1236|      4|            pSortOrd[i] = MAX_ATOMS; /* for debugging only */
  ------------------
  |  |   43|      4|#define MAX_ATOMS  32766
  ------------------
 1237|      4|        }
 1238|       |
 1239|   110k|        pCG->m_pn_RankForSort = pConstitEquNumb;
 1240|   110k|        inchi_qsort( pCG, pSortOrd, num_atoms, sizeof( pSortOrd[0] ), CompRanksOrd );
 1241|       |
 1242|   222k|        for (i = 0, nMinOrd = pSortOrd[0], j = 1; j <= num_atoms; j++)
  ------------------
  |  Branch (1242:51): [True: 112k, False: 110k]
  ------------------
 1243|   112k|        {
 1244|   112k|            if (j == num_atoms || pConstitEquNumb[pSortOrd[i]] != pConstitEquNumb[pSortOrd[j]])
  ------------------
  |  Branch (1244:17): [True: 110k, False: 2.87k]
  |  Branch (1244:35): [True: 928, False: 1.95k]
  ------------------
 1245|   110k|            {
 1246|   110k|                nMinOrd++;
 1247|   110k|                if (j - i > 1)
  ------------------
  |  Branch (1247:21): [True: 218, False: 110k]
  ------------------
 1248|    218|                {
 1249|       |                    /*  found a sequence of equivalent atoms: i..j-1 */
 1250|  2.38k|                    while (i < j)
  ------------------
  |  Branch (1250:28): [True: 2.16k, False: 218]
  ------------------
 1251|  2.16k|                    {
 1252|  2.16k|                        pConstitEquNumb[pSortOrd[i++]] = nMinOrd; /*  = min. canon. rank in the group of equ. atoms */
 1253|  2.16k|                    }
 1254|       |                    /*  at this point j == i */
 1255|    218|                }
 1256|   110k|                else
 1257|   110k|                {
 1258|   110k|                    pConstitEquNumb[pSortOrd[i++]] = 0; /*  means the atom is not equivalent to any other */
 1259|   110k|                }
 1260|   110k|                nMinOrd = pSortOrd[j]; /*  at the end j = num_atoms */
 1261|   110k|            }
 1262|   112k|        }
 1263|   110k|    }
 1264|       |
 1265|      0|    else
 1266|      0|    {
 1267|      0|        nErrorCode |= ERR_NO_CANON_RESULTS;
  ------------------
  |  |   79|      0|#define ERR_NO_CANON_RESULTS        0x0008
  ------------------
 1268|      0|        ret = -1;  /*  program error; no breakpoint here */
 1269|      0|        goto exit_function;
 1270|      0|    }
 1271|       |
 1272|       |
 1273|       |    /*  Atomic numbers from the Periodic Table */
 1274|   222k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1274:17): [True: 112k, False: 110k]
  ------------------
 1275|   112k|    {
 1276|   112k|        pINChI->nAtom[i] = (int) at[pCanonOrd[i]].el_number;
 1277|   112k|    }
 1278|       |
 1279|       |
 1280|       |    /*  Connection table: atoms only (before 7-29-2003 pCS->LinearCT2 contained non-isotopic CT) */
 1281|   110k|    if (pCS->nLenLinearCTAtOnly <= 0 || !pCS->LinearCT || !pINChI->nConnTable)
  ------------------
  |  Branch (1281:9): [True: 0, False: 110k]
  |  Branch (1281:41): [True: 0, False: 110k]
  |  Branch (1281:59): [True: 0, False: 110k]
  ------------------
 1282|      0|    {
 1283|      0|        nErrorCode |= ERR_NO_CANON_RESULTS;
  ------------------
  |  |   79|      0|#define ERR_NO_CANON_RESULTS        0x0008
  ------------------
 1284|      0|        ret = -2;
 1285|      0|        goto exit_function;
 1286|      0|    }
 1287|       |
 1288|   110k|    memcpy( pINChI->nConnTable, pCS->LinearCT, sizeof( pINChI->nConnTable[0] )*pCS->nLenLinearCTAtOnly );
 1289|       |
 1290|   110k|    pINChI->lenConnTable = pCS->nLenLinearCTAtOnly;
 1291|       |
 1292|       |    /*  Tautomeric group(s) canonical representation */
 1293|   110k|    len = 0;
 1294|   110k|    if (bTautomeric && 0 < ( n = SortTautomerGroupsAndEndpoints(
  ------------------
  |  Branch (1294:9): [True: 110k, False: 3]
  |  Branch (1294:24): [True: 4, False: 110k]
  ------------------
 1295|   110k|        pCG, t_group_info,
 1296|   110k|        num_atoms, num_at_tg, pCanonRank ) ))
 1297|      4|    {
 1298|       |        /* SortTautomerGroupsAndEndpoints() produces canonically ordered t-groups */
 1299|      4|        pINChI->nFlags |=
 1300|      4|            ( t_group_info->bTautFlagsDone & TG_FLAG_ALL_SALT_DONE ) ? INCHI_FLAG_ACID_TAUT
  ------------------
  |  |  968|      4|#define TG_FLAG_ALL_SALT_DONE          (TG_FLAG_TEST_TAUT__SALTS_DONE | \
  |  |  ------------------
  |  |  |  |  962|      4|#define TG_FLAG_TEST_TAUT__SALTS_DONE    0x00000008   /* multiple H tautomerism */
  |  |  ------------------
  |  |  969|      4|                                        TG_FLAG_TEST_TAUT2_SALTS_DONE | \
  |  |  ------------------
  |  |  |  |  964|      4|#define TG_FLAG_TEST_TAUT2_SALTS_DONE    0x00000020   /* merged t-groups */
  |  |  ------------------
  |  |  970|      4|                                        TG_FLAG_MERGE_TAUT_SALTS_DONE )
  |  |  ------------------
  |  |  |  |  966|      4|#define TG_FLAG_MERGE_TAUT_SALTS_DONE    0x00000080   /* added non-taut O to taut groups */
  |  |  ------------------
  ------------------
                          ( t_group_info->bTautFlagsDone & TG_FLAG_ALL_SALT_DONE ) ? INCHI_FLAG_ACID_TAUT
  ------------------
  |  |  148|      4|#define INCHI_FLAG_ACID_TAUT            0x0001   /* tautomerism of dissociated acid invoked */
  ------------------
  |  Branch (1300:13): [True: 4, False: 0]
  ------------------
 1301|      4|            : 0;
 1302|       |
 1303|       |        /*  number of tautomeric groups */
 1304|      4|        pINChI->nTautomer[len++] = (AT_NUMB) n;
 1305|       |
 1306|       |        /* store each tautomeric group, one by one */
 1307|      8|        for (i = 0; i < n; i++)
  ------------------
  |  Branch (1307:21): [True: 4, False: 4]
  ------------------
 1308|      4|        {
 1309|      4|            g = (int) t_group_info->tGroupNumber[i]; /* original group numbers in sorted order */
 1310|      4|            t_group = t_group_info->t_group + g;    /* pointer to the tautomeric group */
 1311|       |
 1312|       |            /*  NumAt+INCHI_T_NUM_MOVABLE (group length excluding this number) */
 1313|       |
 1314|      4|            pINChI->nTautomer[len++] = t_group->nNumEndpoints + INCHI_T_NUM_MOVABLE;
  ------------------
  |  |  752|      4|#define INCHI_T_NUM_MOVABLE  2
  ------------------
 1315|       |
 1316|       |            /*  Num(H), Num(-) */
 1317|       |
 1318|     12|            for (j = 0; j < INCHI_T_NUM_MOVABLE && j < T_NUM_NO_ISOTOPIC; j++)
  ------------------
  |  |  752|     24|#define INCHI_T_NUM_MOVABLE  2
  ------------------
                          for (j = 0; j < INCHI_T_NUM_MOVABLE && j < T_NUM_NO_ISOTOPIC; j++)
  ------------------
  |  |   97|      8|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
  |  Branch (1318:25): [True: 8, False: 4]
  |  Branch (1318:52): [True: 8, False: 0]
  ------------------
 1319|      8|            {
 1320|      8|                pINChI->nTautomer[len++] = t_group->num[j];
 1321|      8|            }
 1322|      4|            for (j = T_NUM_NO_ISOTOPIC; j < INCHI_T_NUM_MOVABLE; j++)
  ------------------
  |  |   97|      4|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
                          for (j = T_NUM_NO_ISOTOPIC; j < INCHI_T_NUM_MOVABLE; j++)
  ------------------
  |  |  752|      4|#define INCHI_T_NUM_MOVABLE  2
  ------------------
  |  Branch (1322:41): [True: 0, False: 4]
  ------------------
 1323|      0|            {
 1324|      0|                pINChI->nTautomer[len++] = 0; /* should not happen */
 1325|      0|            }
 1326|       |
 1327|       |            /* tautomeric group endpoint canonical numbers, pre-sorted in ascending order */
 1328|       |
 1329|      4|            for (j = (int) t_group->nFirstEndpointAtNoPos,
 1330|     12|                  m = j + (int) t_group->nNumEndpoints; j < m; j++)
  ------------------
  |  Branch (1330:57): [True: 8, False: 4]
  ------------------
 1331|      8|            {
 1332|      8|                pINChI->nTautomer[len++] = pCanonRank[(int) t_group_info->nEndpointAtomNumber[j]]; /*  At[j] */
 1333|      8|            }
 1334|      4|        }
 1335|       |
 1336|      4|        pINChI->lenTautomer = len;
 1337|      4|        pINChI_Aux->nNumberOfTGroups = n;
 1338|      4|    }
 1339|   110k|    else
 1340|   110k|    {
 1341|   110k|        pINChI->lenTautomer = 0;
 1342|   110k|        pINChI_Aux->nNumberOfTGroups = 0;
 1343|       |
 1344|   110k|        if (t_group_info && ( ( t_group_info->tni.bNormalizationFlags & FLAG_NORM_CONSIDER_TAUT ) ||
  ------------------
  |  |  184|   110k|#define FLAG_NORM_CONSIDER_TAUT      ( FLAG_PROTON_NPO_SIMPLE_REMOVED | \
  |  |  ------------------
  |  |  |  |  174|   110k|#define FLAG_PROTON_NPO_SIMPLE_REMOVED 0x0001
  |  |  ------------------
  |  |  185|   110k|                                       FLAG_PROTON_NP_HARD_REMOVED    | \
  |  |  ------------------
  |  |  |  |  175|   110k|#define FLAG_PROTON_NP_HARD_REMOVED    0x0002
  |  |  ------------------
  |  |  186|   110k|                                       FLAG_PROTON_AC_SIMPLE_ADDED    | \
  |  |  ------------------
  |  |  |  |  176|   110k|#define FLAG_PROTON_AC_SIMPLE_ADDED    0x0004
  |  |  ------------------
  |  |  187|   110k|                                       FLAG_PROTON_AC_SIMPLE_REMOVED  | \
  |  |  ------------------
  |  |  |  |  177|   110k|#define FLAG_PROTON_AC_SIMPLE_REMOVED  0x0008
  |  |  ------------------
  |  |  188|   110k|                                       FLAG_PROTON_AC_HARD_REMOVED    | \
  |  |  ------------------
  |  |  |  |  178|   110k|#define FLAG_PROTON_AC_HARD_REMOVED    0x0010
  |  |  ------------------
  |  |  189|   110k|                                       FLAG_PROTON_AC_HARD_ADDED      | \
  |  |  ------------------
  |  |  |  |  179|   110k|#define FLAG_PROTON_AC_HARD_ADDED      0x0020
  |  |  ------------------
  |  |  190|   110k|                                       FLAG_PROTON_SINGLE_REMOVED     | \
  |  |  ------------------
  |  |  |  |  181|   110k|#define FLAG_PROTON_SINGLE_REMOVED     0x0080
  |  |  ------------------
  |  |  191|   110k|                                       FLAG_PROTON_CHARGE_CANCEL    )
  |  |  ------------------
  |  |  |  |  180|   110k|#define FLAG_PROTON_CHARGE_CANCEL      0x0040
  |  |  ------------------
  ------------------
  |  Branch (1344:13): [True: 110k, False: 3]
  |  Branch (1344:31): [True: 1, False: 110k]
  ------------------
 1345|   110k|            t_group_info->nNumIsotopicEndpoints > 1 &&
  ------------------
  |  Branch (1345:13): [True: 0, False: 110k]
  ------------------
 1346|   110k|            ( t_group_info->bTautFlagsDone & ( TG_FLAG_FOUND_ISOTOPIC_H_DONE | TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE ) ) )
  ------------------
  |  |  978|      0|#define TG_FLAG_FOUND_ISOTOPIC_H_DONE    0x00004000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
                          ( t_group_info->bTautFlagsDone & ( TG_FLAG_FOUND_ISOTOPIC_H_DONE | TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE ) ) )
  ------------------
  |  |  979|      0|#define TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE 0x00008000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
  |  Branch (1346:13): [True: 0, False: 0]
  ------------------
 1347|   110k|           )
 1348|      1|        {
 1349|       |            /* only protons (re)moved or added */
 1350|      1|            pINChI->lenTautomer = 1;
 1351|      1|            pINChI->nTautomer[0] = 0;
 1352|      1|        }
 1353|   110k|    }
 1354|       |
 1355|       |    /*  Number of H (excluding tautomeric) */
 1356|   110k|    if (pCS->nNum_H)
  ------------------
  |  Branch (1356:9): [True: 110k, False: 0]
  ------------------
 1357|   110k|    {
 1358|   222k|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1358:21): [True: 112k, False: 110k]
  ------------------
 1359|   112k|        {
 1360|   112k|            pINChI->nNum_H[i] = pCS->nNum_H[i];
 1361|   112k|        }
 1362|   110k|    }
 1363|       |
 1364|       |
 1365|       |    /*  Number of fixed H (tautomeric H in non-tautomeric representation) */
 1366|   110k|    if (pCS->nNum_H_fixed && !pINChI->lenTautomer)
  ------------------
  |  Branch (1366:9): [True: 110k, False: 0]
  |  Branch (1366:30): [True: 110k, False: 5]
  ------------------
 1367|   110k|    {
 1368|   222k|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1368:21): [True: 112k, False: 110k]
  ------------------
 1369|   112k|        {
 1370|   112k|            pINChI->nNum_H_fixed[i] = pCS->nNum_H_fixed[i];
 1371|   112k|            pINChI->nNum_H[i] += pCS->nNum_H_fixed[i];
 1372|   112k|        }
 1373|   110k|    }
 1374|       |
 1375|       |
 1376|       |    /***********************************************************
 1377|       |     *  Tautomeric group(s) numbering and symmetry;
 1378|       |     *  should not depend on switching to rel. stereo numbering
 1379|       |     */
 1380|   110k|    if (pINChI->lenTautomer && ( n = pINChI_Aux->nNumberOfTGroups ))
  ------------------
  |  Branch (1380:9): [True: 5, False: 110k]
  |  Branch (1380:32): [True: 4, False: 1]
  ------------------
 1381|      4|    {
 1382|      4|        pCanonOrdTaut = pCS->nLenCanonOrdStereoTaut > 0 ? pCS->nCanonOrdStereoTaut :
  ------------------
  |  Branch (1382:25): [True: 0, False: 4]
  ------------------
 1383|      4|            pCS->nLenCanonOrdTaut > 0 ? pCS->nCanonOrdTaut : NULL;
  ------------------
  |  Branch (1383:13): [True: 4, False: 0]
  ------------------
 1384|      4|        pConstitEquNumb = pINChI_Aux->nConstitEquTGroupNumbers;
 1385|      4|        pSymmRank = pCS->nSymmRankTaut;
 1386|       |
 1387|      4|        if (pCanonOrdTaut && pSymmRank && pConstitEquNumb)
  ------------------
  |  Branch (1387:13): [True: 4, False: 0]
  |  Branch (1387:30): [True: 4, False: 0]
  |  Branch (1387:43): [True: 4, False: 0]
  ------------------
 1388|      4|        {
 1389|      8|            for (i = 0; i < n; i++)
  ------------------
  |  Branch (1389:25): [True: 4, False: 4]
  ------------------
 1390|      4|            {
 1391|      4|                pConstitEquNumb[i] = pSymmRank[pCanonOrdTaut[i]];
 1392|      4|                pSortOrd[i] = i;
 1393|      4|            }
 1394|      4|            pCG->m_pn_RankForSort = pConstitEquNumb;
 1395|      4|            inchi_qsort( pCG, pSortOrd, n, sizeof( pSortOrd[0] ), CompRanksOrd );
 1396|      8|            for (i = 0, nMinOrd = pSortOrd[0], j = 1; j <= n; j++)
  ------------------
  |  Branch (1396:55): [True: 4, False: 4]
  ------------------
 1397|      4|            {
 1398|      4|                if (j == n || pConstitEquNumb[pSortOrd[i]] != pConstitEquNumb[pSortOrd[j]])
  ------------------
  |  Branch (1398:21): [True: 4, False: 0]
  |  Branch (1398:31): [True: 0, False: 0]
  ------------------
 1399|      4|                {
 1400|      4|                    nMinOrd++; /* make is start from 1, not from zero */
 1401|      4|                    if (j - i > 1)
  ------------------
  |  Branch (1401:25): [True: 0, False: 4]
  ------------------
 1402|      0|                    {
 1403|       |                        /*  found a sequence of more than one equivalent t-groups: i..j-1 */
 1404|      0|                        while (i < j)
  ------------------
  |  Branch (1404:32): [True: 0, False: 0]
  ------------------
 1405|      0|                        {
 1406|      0|                            pConstitEquNumb[pSortOrd[i++]] = nMinOrd;
 1407|      0|                        }
 1408|      0|                    }
 1409|      4|                    else
 1410|      4|                    {
 1411|      4|                        pConstitEquNumb[pSortOrd[i++]] = 0;
 1412|      4|                    }
 1413|      4|                    nMinOrd = pSortOrd[j]; /*  at the end j == n */
 1414|      4|                }
 1415|      4|            }
 1416|      4|        }
 1417|      4|    }
 1418|       |
 1419|       |
 1420|       |    /*  Allocate and fill Hill formula */
 1421|       |
 1422|   110k|    pINChI->szHillFormula = AllocateAndFillHillFormula( pINChI );
 1423|       |
 1424|   110k|    if (!pINChI->szHillFormula)
  ------------------
  |  Branch (1424:9): [True: 0, False: 110k]
  ------------------
 1425|      0|    {
 1426|      0|        nErrorCode = 0;
 1427|      0|        ret = CT_WRONG_FORMULA; /* CT_OUT_OF_RAM;*/  /*   <BRKPT> */
  ------------------
  |  |   65|      0|#define CT_WRONG_FORMULA     (CT_ERR_FIRST-18)  /*(-30017) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 1428|      0|        pINChI->nErrorCode = pINChI_Aux->nErrorCode = ret;
 1429|      0|        goto exit_function;
 1430|      0|    }
 1431|       |
 1432|   110k|    nStereoUnmarkMode = UnmarkAllUndefinedUnknownStereo( pINChI->Stereo, nUserMode );
 1433|       |
 1434|   110k|    if (nStereoUnmarkMode)
  ------------------
  |  Branch (1434:9): [True: 0, False: 110k]
  ------------------
 1435|      0|    {
 1436|      0|        pINChI->nFlags |=
 1437|      0|            ( nStereoUnmarkMode & REQ_MODE_SC_IGN_ALL_UU ) ? INCHI_FLAG_SC_IGN_ALL_UU
  ------------------
  |  |   58|      0|#define REQ_MODE_SC_IGN_ALL_UU      0x000800    /* IAUSC Ignore stereocenters if All Undef/Unknown */
  ------------------
                          ( nStereoUnmarkMode & REQ_MODE_SC_IGN_ALL_UU ) ? INCHI_FLAG_SC_IGN_ALL_UU
  ------------------
  |  |  151|      0|#define INCHI_FLAG_SC_IGN_ALL_UU        0x0008   /* ignored all undefined/unknown stereocenters, non-isotopic */
  ------------------
  |  Branch (1437:13): [True: 0, False: 0]
  ------------------
 1438|      0|            : 0;
 1439|      0|        pINChI->nFlags |=
 1440|      0|            ( nStereoUnmarkMode & REQ_MODE_SB_IGN_ALL_UU ) ? INCHI_FLAG_SB_IGN_ALL_UU
  ------------------
  |  |   60|      0|#define REQ_MODE_SB_IGN_ALL_UU      0x001000    /* IAUSC Ignore stereobonds if All Undef/Unknown */
  ------------------
                          ( nStereoUnmarkMode & REQ_MODE_SB_IGN_ALL_UU ) ? INCHI_FLAG_SB_IGN_ALL_UU
  ------------------
  |  |  152|      0|#define INCHI_FLAG_SB_IGN_ALL_UU        0x0010   /* ignored all undefined/unknown stereocenters, non-isotopic */
  ------------------
  |  Branch (1440:13): [True: 0, False: 0]
  ------------------
 1441|      0|            : 0;
 1442|       |
 1443|      0|        if (( nStereoUnmarkMode & REQ_MODE_SC_IGN_ALL_UU ) ||
  ------------------
  |  |   58|      0|#define REQ_MODE_SC_IGN_ALL_UU      0x000800    /* IAUSC Ignore stereocenters if All Undef/Unknown */
  ------------------
  |  Branch (1443:13): [True: 0, False: 0]
  ------------------
 1444|      0|            ( nStereoUnmarkMode & REQ_MODE_SB_IGN_ALL_UU ))
  ------------------
  |  |   60|      0|#define REQ_MODE_SB_IGN_ALL_UU      0x001000    /* IAUSC Ignore stereobonds if All Undef/Unknown */
  ------------------
  |  Branch (1444:13): [True: 0, False: 0]
  ------------------
 1445|      0|        {
 1446|      0|            if (!bNoWarnings)
  ------------------
  |  Branch (1446:17): [True: 0, False: 0]
  ------------------
 1447|      0|            {
 1448|      0|                WarningMessage( pStrErrStruct, "Omitted undefined stereo" );
  ------------------
  |  |  160|      0|#define WarningMessage AddErrorMessage
  ------------------
 1449|      0|            }
 1450|      0|        }
 1451|      0|    }
 1452|       |
 1453|       |    /*************************/
 1454|       |    /* Mark ambiguous stereo */
 1455|       |    /*************************/
 1456|       |
 1457|   110k|    MarkAmbiguousStereo( at, norm_at, 0 /* non-isotopic */, pCanonOrd,
 1458|   110k|                         pCS->LinearCTStereoCarb, pCS->nLenLinearCTStereoCarb,
 1459|   110k|                         pCS->LinearCTStereoDble, pCS->nLenLinearCTStereoDble );
 1460|       |
 1461|       |
 1462|       |    /************************************************************************
 1463|       |     *
 1464|       |     *  Isotopic part
 1465|       |     */
 1466|       |
 1467|       |    /* abs or rel stereo may establish one of two canonical numberings */
 1468|       |
 1469|   110k|    if (( pCS->nLenLinearCTIsotopicStereoCarb > 0 || pCS->nLenLinearCTIsotopicStereoDble > 0 ) &&
  ------------------
  |  Branch (1469:11): [True: 0, False: 110k]
  |  Branch (1469:54): [True: 0, False: 110k]
  ------------------
 1470|   110k|          pCS->nLenCanonOrdIsotopicStereo > 0 &&
  ------------------
  |  Branch (1470:11): [True: 0, False: 0]
  ------------------
 1471|   110k|          ( pCS->LinearCTIsotopicStereoCarb && pCS->LinearCTIsotopicStereoCarbInv ||
  ------------------
  |  Branch (1471:13): [True: 0, False: 0]
  |  Branch (1471:48): [True: 0, False: 0]
  ------------------
 1472|      0|              pCS->LinearCTIsotopicStereoDble && pCS->LinearCTIsotopicStereoDbleInv ) &&
  ------------------
  |  Branch (1472:15): [True: 0, False: 0]
  |  Branch (1472:50): [True: 0, False: 0]
  ------------------
 1473|   110k|          pCS->nCanonOrdIsotopicStereo    && pCS->nCanonOrdIsotopicStereoInv
  ------------------
  |  Branch (1473:11): [True: 0, False: 0]
  |  Branch (1473:46): [True: 0, False: 0]
  ------------------
 1474|   110k|          )
 1475|      0|    {
 1476|       |        /* found isotopic stereo */
 1477|       |
 1478|      0|        pCanonRank = pCanonRankAtoms;
 1479|      0|        pCanonOrd = pCS->nCanonOrdIsotopicStereo;
 1480|      0|        pCanonRankInv = pSortOrd;
 1481|      0|        pCanonOrdInv = pCS->nCanonOrdIsotopicStereoInv;
 1482|      0|        Stereo = pINChI->StereoIsotopic;
 1483|       |
 1484|      0|        for (i = 0; i < num_at_tg; i++)
  ------------------
  |  Branch (1484:21): [True: 0, False: 0]
  ------------------
 1485|      0|        {
 1486|      0|            pCanonRankInv[pCanonOrdInv[i]] =
 1487|      0|                pCanonRank[pCanonOrd[i]] = (AT_NUMB) ( i + 1 );
 1488|      0|        }
 1489|       |
 1490|       |
 1491|       |        /********************************************************************/
 1492|       |        /* copy stereo bonds and stereo centers; compare Inv and Abs stereo */
 1493|       |        /********************************************************************/
 1494|       |
 1495|      0|        nErrorCode = CopyLinearCTStereoToINChIStereo( Stereo,
 1496|      0|                                                      pCS->LinearCTIsotopicStereoCarb,
 1497|      0|                                                      pCS->nLenLinearCTIsotopicStereoCarb,
 1498|      0|                                                      pCS->LinearCTIsotopicStereoDble,
 1499|      0|                                                      pCS->nLenLinearCTIsotopicStereoDble,
 1500|      0|                                                      pCanonOrd, pCanonRank, at, 1 /* isotopic */,
 1501|      0|                                                      pCS->LinearCTIsotopicStereoCarbInv,
 1502|      0|                                                      pCS->LinearCTIsotopicStereoDbleInv,
 1503|      0|                                                      pCanonOrdInv, pCanonRankInv );
 1504|       |
 1505|      0|        if (Stereo->t_parityInv && Stereo->nNumberInv)
  ------------------
  |  Branch (1505:13): [True: 0, False: 0]
  |  Branch (1505:36): [True: 0, False: 0]
  ------------------
 1506|      0|        {
 1507|      0|            if (nUserMode & REQ_MODE_RELATIVE_STEREO)
  ------------------
  |  |   54|      0|#define REQ_MODE_RELATIVE_STEREO    0x000200    /* REL All Relative Stereo */
  ------------------
  |  Branch (1507:17): [True: 0, False: 0]
  ------------------
 1508|      0|            {
 1509|      0|                pINChI->nFlags |= INCHI_FLAG_REL_STEREO;
  ------------------
  |  |  149|      0|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
 1510|      0|            }
 1511|       |
 1512|      0|            if (nUserMode & REQ_MODE_RACEMIC_STEREO)
  ------------------
  |  |   56|      0|#define REQ_MODE_RACEMIC_STEREO     0x000400    /* RAC All Racemic Stereo */
  ------------------
  |  Branch (1512:17): [True: 0, False: 0]
  ------------------
 1513|      0|            {
 1514|      0|                pINChI->nFlags |= INCHI_FLAG_RAC_STEREO;
  ------------------
  |  |  150|      0|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
 1515|      0|            }
 1516|       |
 1517|      0|            if (Stereo->nCompInv2Abs)
  ------------------
  |  Branch (1517:17): [True: 0, False: 0]
  ------------------
 1518|      0|            {
 1519|      0|                if (Stereo->nCompInv2Abs == -1)
  ------------------
  |  Branch (1519:21): [True: 0, False: 0]
  ------------------
 1520|      0|                {
 1521|       |                    /* switch pointers so that the stereo becomes the smallest (relative)  */
 1522|       |                    /* flag Stereo->nCompInv2Abs == -1 will keep track of this exchange */
 1523|      0|                    AT_NUMB    *nNumberInv = Stereo->nNumberInv;
 1524|      0|                    S_CHAR     *t_parityInv = Stereo->t_parityInv;
 1525|      0|                    Stereo->nNumberInv = Stereo->nNumber;
 1526|      0|                    Stereo->t_parityInv = Stereo->t_parity;
 1527|      0|                    Stereo->nNumber = nNumberInv;
 1528|      0|                    Stereo->t_parity = t_parityInv;
 1529|      0|                    switch_ptrs( &pCanonRank, &pCanonRankInv );
 1530|      0|                    switch_ptrs( &pCanonOrd, &pCanonOrdInv );
 1531|      0|                    bUseIsotopicNumberingInv = 1;
 1532|      0|                }
 1533|      0|            }
 1534|      0|        }
 1535|       |
 1536|      0|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1536:21): [True: 0, False: 0]
  ------------------
 1537|      0|        {
 1538|      0|            pINChI_Aux->nIsotopicOrigAtNosInCanonOrdInv[i] = at[pCanonOrdInv[i]].orig_at_number;
 1539|      0|            pINChI_Aux->nIsotopicOrigAtNosInCanonOrd[i] = at[pCanonOrd[i]].orig_at_number;
 1540|      0|        }
 1541|       |
 1542|      0|        if (bUseIsotopicNumberingInv)
  ------------------
  |  Branch (1542:13): [True: 0, False: 0]
  ------------------
 1543|      0|        {
 1544|      0|            switch_ptrs( &pCanonRank, &pCanonRankInv );
 1545|      0|            switch_ptrs( &pCanonOrd, &pCanonOrdInv );
 1546|      0|            memcpy( pCanonRank, pCanonRankInv, num_at_tg * sizeof( pCanonRank[0] ) );
 1547|      0|            memcpy( pCanonOrd, pCanonOrdInv, num_at_tg * sizeof( pCanonOrd[0] ) );
 1548|      0|        }
 1549|       |
 1550|      0|        pCanonRankInv = NULL;
 1551|      0|        pCanonOrdInv = NULL;
 1552|      0|        pOrigNosInCanonOrd = NULL;
 1553|      0|    }
 1554|   110k|    else
 1555|   110k|    {
 1556|       |        /* no isotopic stereo */
 1557|       |
 1558|   110k|        pCanonOrd = pCS->nLenCanonOrdIsotopicStereo > 0 ? pCS->nCanonOrdIsotopicStereo
  ------------------
  |  Branch (1558:21): [True: 0, False: 110k]
  ------------------
 1559|   110k|            : pCS->nLenCanonOrdIsotopic > 0 ? pCS->nCanonOrdIsotopic
  ------------------
  |  Branch (1559:15): [True: 47, False: 109k]
  ------------------
 1560|   110k|            : NULL;
 1561|   110k|        pCanonRank = pCanonRankAtoms;
 1562|   110k|        pOrigNosInCanonOrd = pINChI_Aux->nIsotopicOrigAtNosInCanonOrd;
 1563|       |
 1564|   110k|        if (pCanonOrd && pCanonRank)
  ------------------
  |  Branch (1564:13): [True: 47, False: 109k]
  |  Branch (1564:26): [True: 47, False: 0]
  ------------------
 1565|     47|        {
 1566|  1.37k|            for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1566:25): [True: 1.32k, False: 47]
  ------------------
 1567|  1.32k|            {
 1568|       |                /* Fix13 -- out of bounds */
 1569|  1.32k|                pCanonRank[pCanonOrd[i]] = (AT_NUMB) ( i + 1 );
 1570|  1.32k|                pOrigNosInCanonOrd[i] = at[pCanonOrd[i]].orig_at_number;
 1571|  1.32k|            }
 1572|     49|            for (; i < num_at_tg; i++)
  ------------------
  |  Branch (1572:20): [True: 2, False: 47]
  ------------------
 1573|      2|            {
 1574|       |                /* Fix13 -- out of bounds */
 1575|      2|                pCanonRank[pCanonOrd[i]] = (AT_NUMB) ( i + 1 );
 1576|      2|            }
 1577|     47|        }
 1578|   110k|    }
 1579|       |    /*pCanonOrdIso = pCanonOrd;*/
 1580|       |
 1581|       |
 1582|   110k|    pConstitEquNumb = pINChI_Aux->nConstitEquIsotopicNumbers;
 1583|   110k|    pSymmRank = pCS->nSymmRankIsotopic;
 1584|       |
 1585|   110k|    if (pCanonOrd && pCanonRank && pConstitEquNumb && pSymmRank)
  ------------------
  |  Branch (1585:9): [True: 47, False: 109k]
  |  Branch (1585:22): [True: 47, False: 0]
  |  Branch (1585:36): [True: 47, False: 0]
  |  Branch (1585:55): [True: 47, False: 0]
  ------------------
 1586|     47|    {
 1587|  1.37k|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1587:21): [True: 1.32k, False: 47]
  ------------------
 1588|  1.32k|        {
 1589|  1.32k|            pConstitEquNumb[i] = pSymmRank[pCanonOrd[i]];
 1590|  1.32k|            pSortOrd[i] = i;
 1591|  1.32k|        }
 1592|       |
 1593|     49|        for (; i < num_at_tg; i++)
  ------------------
  |  Branch (1593:16): [True: 2, False: 47]
  ------------------
 1594|      2|        {
 1595|      2|            pSortOrd[i] = i;
 1596|      2|        }
 1597|       |
 1598|     47|        pCG->m_pn_RankForSort = pConstitEquNumb;
 1599|     47|        inchi_qsort( pCG, pSortOrd, num_atoms, sizeof( pSortOrd[0] ), CompRanksOrd );
 1600|       |
 1601|  1.37k|        for (i = 0, nMinOrd = pSortOrd[0], j = 1; j <= num_atoms; j++)
  ------------------
  |  Branch (1601:51): [True: 1.32k, False: 47]
  ------------------
 1602|  1.32k|        {
 1603|  1.32k|            if (j == num_atoms || pConstitEquNumb[pSortOrd[i]] != pConstitEquNumb[pSortOrd[j]])
  ------------------
  |  Branch (1603:17): [True: 47, False: 1.27k]
  |  Branch (1603:35): [True: 113, False: 1.16k]
  ------------------
 1604|    160|            {
 1605|    160|                nMinOrd++;
 1606|       |
 1607|    160|                if (j - i > 1)
  ------------------
  |  Branch (1607:21): [True: 36, False: 124]
  ------------------
 1608|     36|                {
 1609|       |                    /*  found a sequence of equivalent atoms: i..j-1 */
 1610|  1.23k|                    while (i < j)
  ------------------
  |  Branch (1610:28): [True: 1.20k, False: 36]
  ------------------
 1611|  1.20k|                    {
 1612|  1.20k|                        pConstitEquNumb[pSortOrd[i++]] = nMinOrd;
 1613|  1.20k|                    }
 1614|     36|                }
 1615|    124|                else
 1616|    124|                {
 1617|    124|                    pConstitEquNumb[pSortOrd[i++]] = 0; /* nMinOrd; */
 1618|    124|                }
 1619|    160|                nMinOrd = pSortOrd[j];
 1620|    160|            }
 1621|  1.32k|        }
 1622|     47|    }
 1623|   109k|    else
 1624|   109k|    {
 1625|   109k|        goto exit_function; /*  no isotopic info available */
 1626|   109k|    }
 1627|       |
 1628|       |
 1629|       |    /*  Isotopic atoms */
 1630|       |
 1631|     47|    n = pINChI->nNumberOfIsotopicAtoms = pCS->nLenLinearCTIsotopic;
 1632|       |
 1633|    188|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (1633:17): [True: 141, False: 47]
  ------------------
 1634|    141|    {
 1635|    141|        pINChI->IsotopicAtom[i].nAtomNumber = pCS->LinearCTIsotopic[i].at_num;
 1636|    141|        pINChI->IsotopicAtom[i].nIsoDifference = pCS->LinearCTIsotopic[i].iso_atw_diff;
 1637|    141|        pINChI->IsotopicAtom[i].nNum_H = pCS->LinearCTIsotopic[i].num_1H;
 1638|    141|        pINChI->IsotopicAtom[i].nNum_D = pCS->LinearCTIsotopic[i].num_D;
 1639|    141|        pINChI->IsotopicAtom[i].nNum_T = pCS->LinearCTIsotopic[i].num_T;
 1640|    141|    }
 1641|       |
 1642|       |    /*  Isotopic tautomeric groups */
 1643|       |
 1644|     47|    n = pINChI->nNumberOfIsotopicTGroups = pCS->nLenLinearCTIsotopicTautomer;
 1645|       |
 1646|     47|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (1646:17): [True: 0, False: 47]
  ------------------
 1647|      0|    {
 1648|      0|        pINChI->IsotopicTGroup[i].nTGroupNumber = pCS->LinearCTIsotopicTautomer[i].tgroup_num;
 1649|      0|        pINChI->IsotopicTGroup[i].nNum_H = pCS->LinearCTIsotopicTautomer[i].num[2];
 1650|      0|        pINChI->IsotopicTGroup[i].nNum_D = pCS->LinearCTIsotopicTautomer[i].num[1];
 1651|      0|        pINChI->IsotopicTGroup[i].nNum_T = pCS->LinearCTIsotopicTautomer[i].num[0];
 1652|      0|    }
 1653|       |
 1654|       |    /* Atoms that may exchange isotopic H-atoms */
 1655|       |
 1656|     47|    if (pCS->nExchgIsoH && pINChI->nPossibleLocationsOfIsotopicH)
  ------------------
  |  Branch (1656:9): [True: 47, False: 0]
  |  Branch (1656:28): [True: 47, False: 0]
  ------------------
 1657|     47|    {
 1658|  1.37k|        for (i = 0, j = 1; i < num_atoms; i++)
  ------------------
  |  Branch (1658:28): [True: 1.32k, False: 47]
  ------------------
 1659|  1.32k|        {
 1660|  1.32k|            if (pCS->nExchgIsoH[i])
  ------------------
  |  Branch (1660:17): [True: 0, False: 1.32k]
  ------------------
 1661|      0|            {
 1662|      0|                pINChI->nPossibleLocationsOfIsotopicH[j++] = (AT_NUMB) ( i + 1 ); /* canonical number */
 1663|      0|            }
 1664|  1.32k|        }
 1665|     47|        pINChI->nPossibleLocationsOfIsotopicH[0] = (AT_NUMB) j; /* length including the 0th element */
 1666|     47|    }
 1667|       |
 1668|     47|    if (nStereoUnmarkMode = UnmarkAllUndefinedUnknownStereo( pINChI->StereoIsotopic, nUserMode ))
  ------------------
  |  Branch (1668:9): [True: 0, False: 47]
  ------------------
 1669|      0|    {
 1670|      0|        pINChI->nFlags |=
 1671|      0|            ( nStereoUnmarkMode & REQ_MODE_SC_IGN_ALL_UU ) ? INCHI_FLAG_SC_IGN_ALL_ISO_UU
  ------------------
  |  |   58|      0|#define REQ_MODE_SC_IGN_ALL_UU      0x000800    /* IAUSC Ignore stereocenters if All Undef/Unknown */
  ------------------
                          ( nStereoUnmarkMode & REQ_MODE_SC_IGN_ALL_UU ) ? INCHI_FLAG_SC_IGN_ALL_ISO_UU
  ------------------
  |  |  153|      0|#define INCHI_FLAG_SC_IGN_ALL_ISO_UU    0x0020   /* ignored all undefined/unknown stereocenters, isotopic */
  ------------------
  |  Branch (1671:13): [True: 0, False: 0]
  ------------------
 1672|      0|            : 0;
 1673|      0|        pINChI->nFlags |=
 1674|      0|            ( nStereoUnmarkMode & REQ_MODE_SB_IGN_ALL_UU ) ? INCHI_FLAG_SC_IGN_ALL_ISO_UU
  ------------------
  |  |   60|      0|#define REQ_MODE_SB_IGN_ALL_UU      0x001000    /* IAUSC Ignore stereobonds if All Undef/Unknown */
  ------------------
                          ( nStereoUnmarkMode & REQ_MODE_SB_IGN_ALL_UU ) ? INCHI_FLAG_SC_IGN_ALL_ISO_UU
  ------------------
  |  |  153|      0|#define INCHI_FLAG_SC_IGN_ALL_ISO_UU    0x0020   /* ignored all undefined/unknown stereocenters, isotopic */
  ------------------
  |  Branch (1674:13): [True: 0, False: 0]
  ------------------
 1675|      0|            : 0;
 1676|      0|        if (( nStereoUnmarkMode & REQ_MODE_SC_IGN_ALL_UU ) ||
  ------------------
  |  |   58|      0|#define REQ_MODE_SC_IGN_ALL_UU      0x000800    /* IAUSC Ignore stereocenters if All Undef/Unknown */
  ------------------
  |  Branch (1676:13): [True: 0, False: 0]
  ------------------
 1677|      0|            ( nStereoUnmarkMode & REQ_MODE_SB_IGN_ALL_UU ))
  ------------------
  |  |   60|      0|#define REQ_MODE_SB_IGN_ALL_UU      0x001000    /* IAUSC Ignore stereobonds if All Undef/Unknown */
  ------------------
  |  Branch (1677:13): [True: 0, False: 0]
  ------------------
 1678|      0|        {
 1679|      0|            if (!bNoWarnings)
  ------------------
  |  Branch (1679:17): [True: 0, False: 0]
  ------------------
 1680|      0|            {
 1681|      0|                WarningMessage( pStrErrStruct, "Omitted undefined stereo" );
  ------------------
  |  |  160|      0|#define WarningMessage AddErrorMessage
  ------------------
 1682|      0|            }
 1683|      0|        }
 1684|      0|    }
 1685|       |
 1686|       |    /* Mark ambiguous stereo */
 1687|       |
 1688|     47|    MarkAmbiguousStereo( at, norm_at, 1 /* isotopic */, pCanonOrd,
 1689|     47|                         pCS->LinearCTIsotopicStereoCarb, pCS->nLenLinearCTIsotopicStereoCarb,
 1690|     47|                         pCS->LinearCTIsotopicStereoDble, pCS->nLenLinearCTIsotopicStereoDble );
 1691|       |
 1692|       |
 1693|       |    /***********************************************************
 1694|       |     *  Isotopic tautomeric group(s) numbering and symmetry;
 1695|       |     *  should not depend on switching to rel. stereo numbering
 1696|       |     */
 1697|       |
 1698|     47|    if (pINChI->lenTautomer &&
  ------------------
  |  Branch (1698:9): [True: 2, False: 45]
  ------------------
 1699|     47|         pINChI_Aux->nConstitEquIsotopicTGroupNumbers &&
  ------------------
  |  Branch (1699:10): [True: 2, False: 0]
  ------------------
 1700|     47|         pCS->nSymmRankIsotopicTaut &&
  ------------------
  |  Branch (1700:10): [True: 2, False: 0]
  ------------------
 1701|     47|         ( pCS->nLenLinearCTIsotopic || pCS->nLenLinearCTIsotopicTautomer ) &&
  ------------------
  |  Branch (1701:12): [True: 2, False: 0]
  |  Branch (1701:41): [True: 0, False: 0]
  ------------------
 1702|     47|         t_group_info && t_group_info->num_t_groups > 0)
  ------------------
  |  Branch (1702:10): [True: 2, False: 0]
  |  Branch (1702:26): [True: 2, False: 0]
  ------------------
 1703|      2|    {
 1704|       |
 1705|      2|        n = t_group_info->num_t_groups;
 1706|       |
 1707|      2|        pCanonOrdTaut =
 1708|      2|            pCS->nLenCanonOrdIsotopicStereoTaut > 0 ? ( n = pCS->nLenCanonOrdIsotopicStereoTaut, pCS->nCanonOrdIsotopicStereoTaut )
  ------------------
  |  Branch (1708:13): [True: 0, False: 2]
  ------------------
 1709|      2|            : pCS->nLenCanonOrdIsotopicTaut > 0 ? ( n = pCS->nLenCanonOrdIsotopicTaut, pCS->nCanonOrdIsotopicTaut )
  ------------------
  |  Branch (1709:15): [True: 2, False: 0]
  ------------------
 1710|      2|            : ( n = 0, (AT_RANK*) NULL );
 1711|       |
 1712|      2|        pConstitEquNumb = pINChI_Aux->nConstitEquIsotopicTGroupNumbers;
 1713|       |
 1714|      2|        pSymmRank = pCS->nSymmRankIsotopicTaut;
 1715|       |
 1716|      2|        if (pCanonOrdTaut && pSymmRank && pConstitEquNumb && n > 0)
  ------------------
  |  Branch (1716:13): [True: 2, False: 0]
  |  Branch (1716:30): [True: 2, False: 0]
  |  Branch (1716:43): [True: 2, False: 0]
  |  Branch (1716:62): [True: 2, False: 0]
  ------------------
 1717|      2|        {
 1718|      4|            for (i = 0; i < n; i++)
  ------------------
  |  Branch (1718:25): [True: 2, False: 2]
  ------------------
 1719|      2|            {
 1720|      2|                pConstitEquNumb[i] = pSymmRank[pCanonOrdTaut[i]];
 1721|      2|                pSortOrd[i] = i;
 1722|      2|            }
 1723|       |
 1724|      2|            pCG->m_pn_RankForSort = pConstitEquNumb;
 1725|      2|            inchi_qsort( pCG, pSortOrd, n, sizeof( pSortOrd[0] ), CompRanksOrd );
 1726|      4|            for (i = 0, nMinOrd = pSortOrd[0], j = 1; j <= n; j++)
  ------------------
  |  Branch (1726:55): [True: 2, False: 2]
  ------------------
 1727|      2|            {
 1728|      2|                if (j == n || pConstitEquNumb[pSortOrd[i]] != pConstitEquNumb[pSortOrd[j]])
  ------------------
  |  Branch (1728:21): [True: 2, False: 0]
  |  Branch (1728:31): [True: 0, False: 0]
  ------------------
 1729|      2|                {
 1730|      2|                    nMinOrd++;
 1731|      2|                    if (j - i > 1)
  ------------------
  |  Branch (1731:25): [True: 0, False: 2]
  ------------------
 1732|      0|                    {
 1733|       |                        /*  found a sequence of equivalent t-groups: i..j-1 */
 1734|      0|                        while (i < j)
  ------------------
  |  Branch (1734:32): [True: 0, False: 0]
  ------------------
 1735|      0|                        {
 1736|      0|                            pConstitEquNumb[pSortOrd[i++]] = nMinOrd;
 1737|      0|                        }
 1738|      0|                    }
 1739|      2|                    else
 1740|      2|                    {
 1741|      2|                        pConstitEquNumb[pSortOrd[i++]] = 0; /*  nMinOrd; */
 1742|      2|                    }
 1743|      2|                    nMinOrd = pSortOrd[j]; /*  at the end j = n */
 1744|      2|                }
 1745|      2|            }
 1746|      2|        }
 1747|      2|    }
 1748|       |
 1749|       |
 1750|   110k|exit_function:
 1751|       |
 1752|   110k|    if (pCanonRankAtoms)
  ------------------
  |  Branch (1752:9): [True: 110k, False: 0]
  ------------------
 1753|   110k|    {
 1754|   110k|        inchi_free( pCanonRankAtoms );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1755|   110k|    }
 1756|   110k|    if (pSortOrd)
  ------------------
  |  Branch (1756:9): [True: 110k, False: 0]
  ------------------
 1757|   110k|    {
 1758|   110k|        inchi_free( pSortOrd );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1759|   110k|    }
 1760|       |
 1761|   110k|    pINChI->nErrorCode |= nErrorCode;
 1762|   110k|    pINChI_Aux->nErrorCode |= nErrorCode;
 1763|       |
 1764|   110k|    return ret;
 1765|     47|}

inp2spATOM:
  111|   110k|{
  112|   110k|    int i, j, val;
  113|       |
  114|   110k|    memset( at, 0, sizeof( at[0] )*num_inp_at );
  115|       |
  116|   222k|    for (i = 0; i < num_inp_at; i++)
  ------------------
  |  Branch (116:17): [True: 112k, False: 110k]
  ------------------
  117|   112k|    {
  118|   112k|        strncpy( at[i].elname, inp_at[i].elname, sizeof( at[0].elname ) );
  119|   112k|        at[i].el_number = (U_CHAR) get_periodic_table_number( at[i].elname );
  120|   112k|        val = at[i].valence = inp_at[i].valence;
  121|   112k|        for (j = 0; j < val; j++)
  ------------------
  |  Branch (121:21): [True: 64, False: 112k]
  ------------------
  122|     64|        {
  123|     64|            at[i].neighbor[j] = inp_at[i].neighbor[j];
  124|     64|            at[i].bond_type[j] = inp_at[i].bond_type[j];
  125|     64|        }
  126|   112k|        at[i].chem_bonds_valence = inp_at[i].chem_bonds_valence;
  127|   112k|        at[i].orig_at_number = inp_at[i].orig_at_number;
  128|   112k|        at[i].orig_compt_at_numb = inp_at[i].orig_compt_at_numb;
  129|   112k|        at[i].endpoint = inp_at[i].endpoint;
  130|   112k|        at[i].iso_atw_diff = inp_at[i].iso_atw_diff;
  131|   112k|        at[i].num_H = inp_at[i].num_H;
  132|   112k|        at[i].cFlags = inp_at[i].cFlags;
  133|   451k|        for (j = 0; j < NUM_H_ISOTOPES; j++)
  ------------------
  |  |  100|   451k|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (133:21): [True: 338k, False: 112k]
  ------------------
  134|   338k|        {
  135|   338k|            at[i].num_iso_H[j] = inp_at[i].num_iso_H[j];
  136|   338k|        }
  137|   112k|        at[i].charge = inp_at[i].charge;
  138|   112k|        at[i].radical = inp_at[i].radical;
  139|       |
  140|   112k|#if ( FIND_RING_SYSTEMS == 1 )
  141|   112k|        at[i].nBlockSystem = inp_at[i].nBlockSystem;
  142|   112k|        at[i].bCutVertex = inp_at[i].bCutVertex;
  143|   112k|        at[i].nRingSystem = inp_at[i].nRingSystem;
  144|   112k|        at[i].nNumAtInRingSystem = inp_at[i].nNumAtInRingSystem;
  145|       |#if ( FIND_RINS_SYSTEMS_DISTANCES == 1 )
  146|       |        at[i].nDistanceFromTerminal = inp_at[i].nDistanceFromTerminal;
  147|       |#endif
  148|   112k|#endif
  149|       |
  150|       |/*
  151|       |        at[i].x                  = inp_at[i].x;
  152|       |        at[i].y                  = inp_at[i].y;
  153|       |        at[i].z                  = inp_at[i].z;
  154|       |*/
  155|   112k|    }
  156|       |
  157|   110k|    return 0;
  158|   110k|}
GetElementAndCount:
  163|   309k|{
  164|   309k|    const char *p = *f;
  165|   309k|    char       *q;
  166|   309k|    int   i = 0;
  167|       |
  168|   309k|    if (*p)
  ------------------
  |  Branch (168:9): [True: 179k, False: 130k]
  ------------------
  169|   179k|    {
  170|   179k|        if (isupper( UCINT *p ))
  171|   179k|        {
  172|   179k|            szEl[i++] = *p++;
  173|   179k|            if (*p && islower( UCINT *p ))
  ------------------
  |  Branch (173:17): [True: 151k, False: 27.6k]
  ------------------
  174|   118k|            {
  175|   118k|                szEl[i++] = *p++;
  176|   118k|            }
  177|   179k|            szEl[i] = '\0';
  178|   179k|            if (1 == i && szEl[0] == 'C')
  ------------------
  |  Branch (178:17): [True: 60.3k, False: 118k]
  |  Branch (178:27): [True: 1.17k, False: 59.1k]
  ------------------
  179|  1.17k|            {
  180|  1.17k|                szEl[0] = 'A'; /*  less than any element: */
  181|       |                               /*  carbon-containing compounds should be first */
  182|  1.17k|            }
  183|   179k|            if (*p && isdigit( UCINT *p ))
  ------------------
  |  Branch (183:17): [True: 37.8k, False: 141k]
  ------------------
  184|  5.66k|            {
  185|  5.66k|                *count = strtol( p, &q, 10 );
  186|  5.66k|                p = q;
  187|  5.66k|            }
  188|   173k|            else
  189|   173k|            {
  190|   173k|                *count = 1;
  191|   173k|            }
  192|   179k|            *f = p; /*  next element; */
  193|   179k|            return 1;
  194|   179k|        }
  195|      0|        return -1; /*  not a chemical formula */
  196|   179k|    }
  197|       |    /* v. 1.06 Changed "Zz" to "Zzz" as "Zz" is valid symbol now */
  198|   130k|    strcpy( szEl, "Zzz" );
  199|       |    /*strcpy( szEl, "Zz" );*/
  200|       |    /*  zero termination 'element' is larger than any other element */
  201|   130k|    *count = 99999;         /* zero termination 'element count' is larger than any other count */
  202|   130k|    return 0;
  203|   309k|}
CompareHillFormulasNoH:
  265|  76.7k|{
  266|  76.7k|    char szEl1[4], szEl2[4];
  267|  76.7k|    int  count1, count2, ret1, ret2, ret;
  268|       |
  269|  76.7k|    do
  270|   154k|    {
  271|   154k|        ret1 = GetElementAndCount( &f1, szEl1, &count1 );
  272|   154k|        if (0 < ret1 && szEl1[0] == 'H' && !szEl1[1])
  ------------------
  |  Branch (272:13): [True: 89.3k, False: 65.1k]
  |  Branch (272:25): [True: 2.67k, False: 86.7k]
  |  Branch (272:44): [True: 8, False: 2.66k]
  ------------------
  273|      8|        {
  274|      8|            *num_H1 += count1;
  275|      8|            ret1 = GetElementAndCount( &f1, szEl1, &count1 );
  276|      8|        }
  277|   154k|        ret2 = GetElementAndCount( &f2, szEl2, &count2 );
  278|   154k|        if (0 < ret2 && szEl2[0] == 'H' && !szEl2[1])
  ------------------
  |  Branch (278:13): [True: 89.6k, False: 64.8k]
  |  Branch (278:25): [True: 2.86k, False: 86.8k]
  |  Branch (278:44): [True: 32, False: 2.82k]
  ------------------
  279|     32|        {
  280|     32|            *num_H2 += count2;
  281|     32|            ret2 = GetElementAndCount( &f2, szEl2, &count2 );
  282|     32|        }
  283|   154k|        if (0 <= ret1 && 0 <= ret2)
  ------------------
  |  Branch (283:13): [True: 154k, False: 0]
  |  Branch (283:26): [True: 154k, False: 0]
  ------------------
  284|   154k|        {
  285|   154k|            if (ret = strcmp( szEl1, szEl2 ))
  ------------------
  |  Branch (285:17): [True: 11.4k, False: 143k]
  ------------------
  286|  11.4k|            {
  287|  11.4k|                return ret; /*  lexicographic order, string termination > any character */
  288|  11.4k|            }
  289|   143k|            if (ret = count2 - count1)
  ------------------
  |  Branch (289:17): [True: 830, False: 142k]
  ------------------
  290|    830|            {
  291|    830|                return ret; /*  inverse atom count order */
  292|    830|            }
  293|   143k|        }
  294|      0|        else
  295|      0|        {
  296|      0|            return 0; /*  program error <BRKPT> */
  297|      0|        }
  298|   154k|    }
  299|   142k|    while (0 < ret1 && 0 < ret2);
  ------------------
  |  Branch (299:12): [True: 77.7k, False: 64.4k]
  |  Branch (299:24): [True: 77.7k, False: 0]
  ------------------
  300|       |
  301|  64.4k|    return 0;
  302|  76.7k|}
CompareTautNonIsoPartOfINChI:
  307|  10.7k|{
  308|  10.7k|    int len1, len2, ret, i;
  309|       |
  310|  10.7k|    len1 = i1->lenTautomer > 0 && i1->nTautomer[0] ? i1->lenTautomer : 0;
  ------------------
  |  Branch (310:12): [True: 0, False: 10.7k]
  |  Branch (310:35): [True: 0, False: 0]
  ------------------
  311|  10.7k|    len2 = i2->lenTautomer > 0 && i2->nTautomer[0] ? i2->lenTautomer : 0;
  ------------------
  |  Branch (311:12): [True: 0, False: 10.7k]
  |  Branch (311:35): [True: 0, False: 0]
  ------------------
  312|  10.7k|    if (ret = len2 - len1)
  ------------------
  |  Branch (312:9): [True: 0, False: 10.7k]
  ------------------
  313|      0|    {
  314|      0|        return ret;
  315|      0|    }
  316|  10.7k|    for (i = 0; i < len1; i++)
  ------------------
  |  Branch (316:17): [True: 0, False: 10.7k]
  ------------------
  317|      0|    {
  318|      0|        if (ret = (int) i2->nTautomer[i] - (int) i1->nTautomer[i])
  ------------------
  |  Branch (318:13): [True: 0, False: 0]
  ------------------
  319|      0|            return ret;
  320|      0|    }
  321|  10.7k|    return 0;
  322|  10.7k|}
CompINChITautVsNonTaut:
  334|  1.21k|{
  335|  1.21k|    int ret, num, i, num_H1, num_H2;
  336|       |
  337|  1.21k|    const INChI *i1 = NULL; /* Mobile-H layers in Mobile-H sorting order */
  338|  1.21k|    const INChI *i2 = NULL; /* Fixed-H  layers in Fixed-H  sorting order */
  339|       |
  340|  1.21k|    int   n1;               /* TAUT_YES if tautomeric i1 exists, otherwise TAUT_NON */
  341|       |
  342|       |    /* INChI_Stereo *Stereo1, *Stereo2; */
  343|       |
  344|  1.21k|    n1 = ( p1->pINChI[TAUT_YES] && p1->pINChI[TAUT_YES]->nNumberOfAtoms ) ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  580|  1.21k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  n1 = ( p1->pINChI[TAUT_YES] && p1->pINChI[TAUT_YES]->nNumberOfAtoms ) ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  580|  1.21k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  n1 = ( p1->pINChI[TAUT_YES] && p1->pINChI[TAUT_YES]->nNumberOfAtoms ) ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  580|  1.21k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  n1 = ( p1->pINChI[TAUT_YES] && p1->pINChI[TAUT_YES]->nNumberOfAtoms ) ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  579|  1.21k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (344:12): [True: 1.21k, False: 0]
  |  Branch (344:36): [True: 1.21k, False: 0]
  ------------------
  345|       |
  346|  1.21k|    i1 = p1->pINChI[n1];
  347|  1.21k|    i2 = ( n1 == TAUT_YES && p2->pINChI[TAUT_NON] &&
  ------------------
  |  |  580|  2.42k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  i2 = ( n1 == TAUT_YES && p2->pINChI[TAUT_NON] &&
  ------------------
  |  |  579|  1.21k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (347:12): [True: 1.21k, False: 0]
  |  Branch (347:30): [True: 0, False: 1.21k]
  ------------------
  348|  1.21k|           p2->pINChI[TAUT_NON]->nNumberOfAtoms ) ? p2->pINChI[TAUT_NON] : (const INChI *) NULL;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                         p2->pINChI[TAUT_NON]->nNumberOfAtoms ) ? p2->pINChI[TAUT_NON] : (const INChI *) NULL;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (348:12): [True: 0, False: 0]
  ------------------
  349|       |
  350|       |    /* non-deleted-non-empty < deleted < empty */
  351|  1.21k|    if (i1 && !i2)
  ------------------
  |  Branch (351:9): [True: 1.21k, False: 0]
  |  Branch (351:15): [True: 1.21k, False: 0]
  ------------------
  352|  1.21k|        return 0;   /* non-empty is the smallest (first) */
  353|      0|    if (!i1 && i2)
  ------------------
  |  Branch (353:9): [True: 0, False: 0]
  |  Branch (353:16): [True: 0, False: 0]
  ------------------
  354|      0|        return 0;
  355|      0|    if (!i1 && !i2)
  ------------------
  |  Branch (355:9): [True: 0, False: 0]
  |  Branch (355:16): [True: 0, False: 0]
  ------------------
  356|      0|        return 0;
  357|      0|    if (i1->bDeleted)
  ------------------
  |  Branch (357:9): [True: 0, False: 0]
  ------------------
  358|      0|        return 1;    /* deleted is the largest (last) among non-empty */
  359|      0|    if (i2->bDeleted)
  ------------------
  |  Branch (359:9): [True: 0, False: 0]
  ------------------
  360|      0|        return -1;
  361|       |
  362|      0|    if (i1->nNumberOfAtoms > 0 && !i2->nNumberOfAtoms)
  ------------------
  |  Branch (362:9): [True: 0, False: 0]
  |  Branch (362:35): [True: 0, False: 0]
  ------------------
  363|      0|        return 0;
  364|       |
  365|      0|    i2 = i2;
  366|       |
  367|      0|    num_H1 = num_H2 = 0;
  368|       |
  369|       |    /* do not compare terminal H */
  370|      0|    if (ret = CompareHillFormulasNoH( i1->szHillFormula, i2->szHillFormula, &num_H1, &num_H2 ))
  ------------------
  |  Branch (370:9): [True: 0, False: 0]
  ------------------
  371|      0|    {
  372|      0|        return ret;  /* lexicographic order except the shorter one is greater (last): CH2O < CH2; C3XX < C2XX */
  373|      0|    }
  374|       |
  375|       |    /*
  376|       |        compare non-isotopic non-tautomeric part
  377|       |    */
  378|       |
  379|       |    /* compare number of atoms (excluding terminal H) */
  380|      0|    if (ret = i2->nNumberOfAtoms - i1->nNumberOfAtoms)
  ------------------
  |  Branch (380:9): [True: 0, False: 0]
  ------------------
  381|      0|        return ret; /*  more atoms first */
  382|       |
  383|       |    /*  compare elements  (excluding terminal H) */
  384|      0|    num = i1->nNumberOfAtoms;
  385|      0|    for (i = 0; i < num; i++)
  ------------------
  |  Branch (385:17): [True: 0, False: 0]
  ------------------
  386|      0|    { /* should always be equal if Hill formulas are same */
  387|      0|        if (ret = (int) i2->nAtom[i] - (int) i1->nAtom[i])
  ------------------
  |  Branch (387:13): [True: 0, False: 0]
  ------------------
  388|      0|            return ret; /* greater periodic number first */
  389|      0|    }
  390|       |    /*
  391|       |        compare connection tables
  392|       |    */
  393|      0|    if (ret = i2->lenConnTable - i1->lenConnTable)
  ------------------
  |  Branch (393:9): [True: 0, False: 0]
  ------------------
  394|      0|        return ret; /* longer connection table first */
  395|      0|    num = i2->lenConnTable;
  396|      0|    for (i = 0; i < num; i++)
  ------------------
  |  Branch (396:17): [True: 0, False: 0]
  ------------------
  397|      0|    {
  398|      0|        if (ret = (int) i2->nConnTable[i] - (int) i1->nConnTable[i])
  ------------------
  |  Branch (398:13): [True: 0, False: 0]
  ------------------
  399|      0|            return ret; /* greater connection table first */
  400|      0|    }
  401|       |    /*
  402|       |      compare total number of H (inverse: H3 < H2 )
  403|       |    */
  404|      0|    if (ret = num_H2 - num_H1)
  ------------------
  |  Branch (404:9): [True: 0, False: 0]
  ------------------
  405|      0|        return ret;
  406|       |    /*
  407|       |      compare non-tautomeric num_H: N < NH3 < NH2 < NH
  408|       |    */
  409|      0|    num = i1->nNumberOfAtoms;
  410|      0|    for (i = 0; i < num; i++)
  ------------------
  |  Branch (410:17): [True: 0, False: 0]
  ------------------
  411|      0|    {
  412|      0|        if (i2->nNum_H[i] != i1->nNum_H[i])
  ------------------
  |  Branch (412:13): [True: 0, False: 0]
  ------------------
  413|      0|        {
  414|      0|            return !i2->nNum_H[i] ? 1 :  /* no H first */
  ------------------
  |  Branch (414:20): [True: 0, False: 0]
  ------------------
  415|      0|                !i1->nNum_H[i] ? -1 :
  ------------------
  |  Branch (415:17): [True: 0, False: 0]
  ------------------
  416|      0|                (int) i2->nNum_H[i] - (int) i1->nNum_H[i];
  417|      0|        }
  418|      0|    }
  419|       |    /*
  420|       |        compare non-isotopic tautomeric part
  421|       |    */
  422|      0|    if (ret = CompareTautNonIsoPartOfINChI( i1, i2 ))
  ------------------
  |  Branch (422:9): [True: 0, False: 0]
  ------------------
  423|      0|    {
  424|      0|        return ret;
  425|      0|    }
  426|       |    /*
  427|       |    if ( ret = i2->lenTautomer - i1->lenTautomer )
  428|       |        return ret;
  429|       |    num = inchi_min( i2->lenTautomer, i1->lenTautomer );
  430|       |    for ( i = 0; i < num; i ++ ) {
  431|       |        if ( ret = (int)i2->nTautomer[i] - (int)i1->nTautomer[i] )
  432|       |            return ret;
  433|       |    }
  434|       |    */
  435|       |
  436|       |    /*
  437|       |        at this point both components are either tautomeric
  438|       |        or non-tautomeric
  439|       |     */
  440|       |
  441|       |    /*
  442|       |        non-tautomeric "fixed H" specific
  443|       |    */
  444|      0|    if ( /*TAUT_NON == bTaut &&*/ ( i2 && i2->nNum_H_fixed ))
  ------------------
  |  Branch (444:37): [True: 0, False: 0]
  |  Branch (444:43): [True: 0, False: 0]
  ------------------
  445|      0|    {
  446|       |        /* first, compare non-tautomeric chem. formulas -- they may be different */
  447|       |        /* secondly, compare fixed-H distribution */
  448|      0|        if (i2->nNum_H_fixed)
  ------------------
  |  Branch (448:13): [True: 0, False: 0]
  ------------------
  449|      0|        {
  450|      0|            num = i2->nNumberOfAtoms;
  451|      0|            for (i = 0; i < num; i++)
  ------------------
  |  Branch (451:25): [True: 0, False: 0]
  ------------------
  452|      0|            {
  453|      0|                if (i2->nNum_H_fixed[i] != 0)
  ------------------
  |  Branch (453:21): [True: 0, False: 0]
  ------------------
  454|      0|                {
  455|      0|                    return 1;
  456|      0|                }
  457|      0|            }
  458|      0|        }
  459|      0|    }
  460|       |    /*
  461|       |        compare non-isotopic stereo
  462|       |    */
  463|      0|    ret = CompareInchiStereo( i1->Stereo, i1->nFlags, i2->Stereo, i2->nFlags );
  464|      0|    if (ret)
  ------------------
  |  Branch (464:9): [True: 0, False: 0]
  ------------------
  465|      0|    {
  466|      0|        return ret;
  467|      0|    }
  468|       |
  469|       |    /*
  470|       |        do not switch back to tautomeric i1, i2
  471|       |    */
  472|       |
  473|       |    /* -- how to switch back --
  474|       |    if ( i1t ) {
  475|       |        i1  = i1t;
  476|       |        i1t = NULL;
  477|       |    }
  478|       |    if ( i2t ) {
  479|       |        i2  = i2t;
  480|       |        i2t = NULL;
  481|       |    }
  482|       |    */
  483|       |
  484|       |    /*
  485|       |         compare isotopic non-tautomeric part
  486|       |    */
  487|      0|    if (bCompareIsotopic)
  ------------------
  |  Branch (487:9): [True: 0, False: 0]
  ------------------
  488|      0|    {
  489|      0|        if (ret = i2->nNumberOfIsotopicAtoms - i1->nNumberOfIsotopicAtoms)
  ------------------
  |  Branch (489:13): [True: 0, False: 0]
  ------------------
  490|      0|            return ret;
  491|      0|        num = i1->nNumberOfIsotopicAtoms;
  492|       |
  493|       |        /*  compare isotopic atoms */
  494|      0|        for (i = 0; i < num; i++)
  ------------------
  |  Branch (494:21): [True: 0, False: 0]
  ------------------
  495|      0|        {
  496|      0|            if (ret = (int) i2->IsotopicAtom[i].nAtomNumber - (int) i1->IsotopicAtom[i].nAtomNumber)
  ------------------
  |  Branch (496:17): [True: 0, False: 0]
  ------------------
  497|      0|                return ret;
  498|      0|            if (ret = (int) i2->IsotopicAtom[i].nIsoDifference - (int) i1->IsotopicAtom[i].nIsoDifference)
  ------------------
  |  Branch (498:17): [True: 0, False: 0]
  ------------------
  499|      0|                return ret;
  500|      0|        }
  501|       |
  502|       |        /* compare isotopic H */
  503|       |        /* if tautomeric comparison mode then here are compared only non-tautomeric H */
  504|      0|        for (i = 0; i < num; i++)
  ------------------
  |  Branch (504:21): [True: 0, False: 0]
  ------------------
  505|      0|        {
  506|      0|            if (ret = (int) i2->IsotopicAtom[i].nNum_T - (int) i1->IsotopicAtom[i].nNum_T)
  ------------------
  |  Branch (506:17): [True: 0, False: 0]
  ------------------
  507|      0|                return ret;
  508|      0|            if (ret = (int) i2->IsotopicAtom[i].nNum_D - (int) i1->IsotopicAtom[i].nNum_D)
  ------------------
  |  Branch (508:17): [True: 0, False: 0]
  ------------------
  509|      0|                return ret;
  510|      0|            if (ret = (int) i2->IsotopicAtom[i].nNum_H - (int) i1->IsotopicAtom[i].nNum_H)
  ------------------
  |  Branch (510:17): [True: 0, False: 0]
  ------------------
  511|      0|                return ret;
  512|      0|        }
  513|       |
  514|       |        /* compare isotopic tautomeric part */
  515|      0|        if (ret = i2->nNumberOfIsotopicTGroups || i1->nNumberOfIsotopicTGroups)
  ------------------
  |  Branch (515:13): [True: 0, False: 0]
  |  Branch (515:19): [True: 0, False: 0]
  |  Branch (515:51): [True: 0, False: 0]
  ------------------
  516|      0|            return ret;
  517|       |
  518|       |        /*
  519|       |        num = i1->nNumberOfIsotopicTGroups;
  520|       |        for ( i = 0; i < num; i ++ ) {
  521|       |            if ( ret = (int)i2->IsotopicTGroup[i].nTGroupNumber - (int)i1->IsotopicTGroup[i].nTGroupNumber )
  522|       |                return ret;
  523|       |            if ( ret = (int)i2->IsotopicTGroup[i].nNum_T - (int)i1->IsotopicTGroup[i].nNum_T )
  524|       |                return ret;
  525|       |            if ( ret = (int)i2->IsotopicTGroup[i].nNum_D - (int)i1->IsotopicTGroup[i].nNum_D )
  526|       |                return ret;
  527|       |            if ( ret = (int)i2->IsotopicTGroup[i].nNum_H - (int)i1->IsotopicTGroup[i].nNum_H )
  528|       |                return ret;
  529|       |        }
  530|       |        */
  531|       |
  532|       |        /* compare isotopic stereo */
  533|      0|        ret = CompareInchiStereo( i1->StereoIsotopic, i1->nFlags,
  534|      0|                                  i2->StereoIsotopic, i2->nFlags );
  535|      0|        if (ret)
  ------------------
  |  Branch (535:13): [True: 0, False: 0]
  ------------------
  536|      0|        {
  537|      0|            return ret;
  538|      0|        }
  539|      0|    }
  540|       |
  541|       |    /*
  542|       |        compare charges: non-charged first, then in order of
  543|       |        ascending charges (negative first)
  544|       |    */
  545|       |
  546|      0|    if (i2->nTotalCharge && i1->nTotalCharge)
  ------------------
  |  Branch (546:9): [True: 0, False: 0]
  |  Branch (546:29): [True: 0, False: 0]
  ------------------
  547|      0|    {
  548|       |        /*  both are charged; smaller charges first */
  549|      0|        ret = (int) i1->nTotalCharge - (int) i2->nTotalCharge;
  550|      0|        return ret;
  551|      0|    }
  552|      0|    if (ret = ( i1->nTotalCharge ? 1 : 0 ) - ( i2->nTotalCharge ? 1 : 0 ))
  ------------------
  |  Branch (552:9): [True: 0, False: 0]
  |  Branch (552:17): [True: 0, False: 0]
  |  Branch (552:48): [True: 0, False: 0]
  ------------------
  553|      0|    {
  554|       |        /*  only one is charged; uncharged first */
  555|      0|        return ret;
  556|      0|    }
  557|       |    /* stable sort */
  558|       |    /*ret = p1->ord_number - p2->ord_number;*/
  559|       |
  560|      0|    return ret;
  561|      0|}
GetSp3RelRacAbs:
  584|  4.85k|{
  585|  4.85k|    int nRet = SP3_NONE;
  586|  4.85k|    if (pINChI && !pINChI->bDeleted && Stereo && 0 < Stereo->nNumberOfStereoCenters)
  ------------------
  |  Branch (586:9): [True: 2.42k, False: 2.42k]
  |  Branch (586:19): [True: 2.42k, False: 0]
  |  Branch (586:40): [True: 1, False: 2.42k]
  |  Branch (586:50): [True: 0, False: 1]
  ------------------
  587|      0|    {
  588|      0|        if (0 != Stereo->nCompInv2Abs)
  ------------------
  |  Branch (588:13): [True: 0, False: 0]
  ------------------
  589|      0|        {
  590|      0|            if (pINChI->nFlags & INCHI_FLAG_REL_STEREO)
  ------------------
  |  |  149|      0|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
  |  Branch (590:17): [True: 0, False: 0]
  ------------------
  591|      0|            {
  592|       |#if ( REL_RAC_STEREO_IGN_1_SC == 1 )
  593|       |                if (1 < Stereo->nNumberOfStereoCenters)
  594|       |                {
  595|       |                    nRet = SP3_REL;
  596|       |                }
  597|       |#else
  598|      0|                nRet = SP3_REL;
  599|      0|#endif
  600|      0|            }
  601|      0|            else
  602|      0|                if (pINChI->nFlags & INCHI_FLAG_RAC_STEREO)
  ------------------
  |  |  150|      0|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (602:21): [True: 0, False: 0]
  ------------------
  603|      0|                {
  604|       |#if ( REL_RAC_STEREO_IGN_1_SC == 1 )
  605|       |                    if (1 < Stereo->nNumberOfStereoCenters)
  606|       |                    {
  607|       |                        nRet = SP3_REL;
  608|       |                    }
  609|       |#else
  610|      0|                    nRet = SP3_RAC;
  611|      0|#endif
  612|      0|                }
  613|      0|                else
  614|      0|                {
  615|      0|                    nRet = SP3_ABS;
  616|      0|                }
  617|      0|        }
  618|      0|        else
  619|       |#if ( REL_RAC_STEREO_IGN_1_SC == 1 )
  620|       |            if (!( ( pINChI->nFlags & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ) && 1 == Stereo->nNumberOfStereoCenters ))
  621|       |#endif
  622|      0|            {
  623|      0|                nRet = SP3_ONLY; /*  SP3_NONE if relative stereo and 1 stereocenter */
  624|      0|            }
  625|      0|    }
  626|  4.85k|    return nRet;
  627|  4.85k|}
CompINChILayers:
  639|  1.21k|{
  640|  1.21k|    int ret = 0, num, i, num_H1, num_H2;
  641|       |
  642|  1.21k|    const INChI *i1 = NULL; /* Mobile-H layers in Mobile-H sorting order */
  643|  1.21k|    const INChI *i2 = NULL; /* Fixed-H  layers in Fixed-H  sorting order */
  644|       |
  645|  1.21k|    int   n1;               /* TAUT_YES if tautomeric i1 exists, otherwise TAUT_NON */
  646|       |
  647|  1.21k|    INChI_Stereo *Stereo1, *Stereo2;
  648|  1.21k|    INChI_Stereo *IsoStereo1, *IsoStereo2;
  649|  1.21k|    int bRelRac[DIFL_LENGTH];
  650|  1.21k|    char *psDifSegs;
  651|       |
  652|  1.21k|    n1 = ( p1->pINChI[TAUT_YES] && p1->pINChI[TAUT_YES]->nNumberOfAtoms ) ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  580|  1.21k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  n1 = ( p1->pINChI[TAUT_YES] && p1->pINChI[TAUT_YES]->nNumberOfAtoms ) ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  580|  1.21k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  n1 = ( p1->pINChI[TAUT_YES] && p1->pINChI[TAUT_YES]->nNumberOfAtoms ) ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  580|  1.21k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  n1 = ( p1->pINChI[TAUT_YES] && p1->pINChI[TAUT_YES]->nNumberOfAtoms ) ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  579|  1.21k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (652:12): [True: 1.21k, False: 0]
  |  Branch (652:36): [True: 1.21k, False: 0]
  ------------------
  653|       |
  654|  1.21k|    i1 = p1->pINChI[n1];
  655|  1.21k|    i2 = ( n1 == TAUT_YES && p2->pINChI[TAUT_NON] &&
  ------------------
  |  |  580|  2.42k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  i2 = ( n1 == TAUT_YES && p2->pINChI[TAUT_NON] &&
  ------------------
  |  |  579|  1.21k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (655:12): [True: 1.21k, False: 0]
  |  Branch (655:30): [True: 0, False: 1.21k]
  ------------------
  656|  1.21k|           p2->pINChI[TAUT_NON]->nNumberOfAtoms ) ? p2->pINChI[TAUT_NON] : (const INChI *) NULL;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                         p2->pINChI[TAUT_NON]->nNumberOfAtoms ) ? p2->pINChI[TAUT_NON] : (const INChI *) NULL;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (656:12): [True: 0, False: 0]
  ------------------
  657|       |
  658|  1.21k|    num_H1 = num_H2 = 0;
  659|  1.21k|    memset( bRelRac, DIFV_BOTH_EMPTY, sizeof( bRelRac ) );
  660|       |    /*=====================*/
  661|       |    /*====     /f    ======*/
  662|       |    /*=====================*/
  663|  1.21k|    if (i1 && !i1->bDeleted && i1->szHillFormula && i1->szHillFormula[0])
  ------------------
  |  Branch (663:9): [True: 1.21k, False: 0]
  |  Branch (663:15): [True: 1.21k, False: 0]
  |  Branch (663:32): [True: 1.21k, False: 0]
  |  Branch (663:53): [True: 1.21k, False: 0]
  ------------------
  664|  1.21k|    {
  665|  1.21k|        sDifSegs[DIFL_M][DIFS_f_FORMULA] |= DIFV_NEQ2PRECED;
  666|  1.21k|        if (i2 && !i2->bDeleted && i2->szHillFormula && i2->szHillFormula[0])
  ------------------
  |  Branch (666:13): [True: 0, False: 1.21k]
  |  Branch (666:19): [True: 0, False: 0]
  |  Branch (666:36): [True: 0, False: 0]
  |  Branch (666:57): [True: 0, False: 0]
  ------------------
  667|      0|        {
  668|      0|            if (!CompareHillFormulasNoH( i1->szHillFormula, i2->szHillFormula, &num_H1, &num_H2 ) &&
  ------------------
  |  Branch (668:17): [True: 0, False: 0]
  ------------------
  669|      0|                  num_H1 == num_H2)
  ------------------
  |  Branch (669:19): [True: 0, False: 0]
  ------------------
  670|      0|            {
  671|      0|                sDifSegs[DIFL_F][DIFS_f_FORMULA] |= DIFV_EQL2PRECED;
  672|      0|            }
  673|      0|            else
  674|      0|            {
  675|      0|                sDifSegs[DIFL_F][DIFS_f_FORMULA] |= DIFV_NEQ2PRECED;
  676|      0|            }
  677|      0|        }
  678|  1.21k|        else
  679|  1.21k|        {
  680|  1.21k|            sDifSegs[DIFL_F][DIFS_f_FORMULA] |= i2 ? DIFV_IS_EMPTY : DIFV_EQL2PRECED;
  ------------------
  |  Branch (680:49): [True: 0, False: 1.21k]
  ------------------
  681|  1.21k|        }
  682|  1.21k|    }
  683|      0|    else
  684|      0|    {
  685|      0|        sDifSegs[DIFL_M][DIFS_f_FORMULA] |= DIFV_BOTH_EMPTY;
  686|      0|        if (i2 && !i2->bDeleted && i2->szHillFormula && i2->szHillFormula[0])
  ------------------
  |  Branch (686:13): [True: 0, False: 0]
  |  Branch (686:19): [True: 0, False: 0]
  |  Branch (686:36): [True: 0, False: 0]
  |  Branch (686:57): [True: 0, False: 0]
  ------------------
  687|      0|        {
  688|      0|            sDifSegs[DIFL_F][DIFS_f_FORMULA] |= DIFV_NEQ2PRECED;
  689|      0|        }
  690|      0|        else
  691|      0|        {
  692|      0|            sDifSegs[DIFL_F][DIFS_f_FORMULA] |= DIFV_BOTH_EMPTY;
  693|      0|        }
  694|      0|    }
  695|       |    /*=====================*/
  696|       |    /*====     /c    ======*/
  697|       |    /*=====================*/
  698|  1.21k|    if (i1 && !i1->bDeleted && i1->lenConnTable > 1)
  ------------------
  |  Branch (698:9): [True: 1.21k, False: 0]
  |  Branch (698:15): [True: 1.21k, False: 0]
  |  Branch (698:32): [True: 3, False: 1.21k]
  ------------------
  699|      3|    {
  700|      3|        sDifSegs[DIFL_M][DIFS_f_FORMULA] |= DIFV_NEQ2PRECED;
  701|      3|    }
  702|  1.21k|    else
  703|  1.21k|    {
  704|  1.21k|        sDifSegs[DIFL_M][DIFS_f_FORMULA] |= DIFV_BOTH_EMPTY;
  705|  1.21k|    }
  706|       |    /*=====================*/
  707|       |    /*====     /h    ======*/
  708|       |    /*=====================*/
  709|       |    /* M: H atoms */
  710|  1.21k|    if (i1 && !i1->bDeleted)
  ------------------
  |  Branch (710:9): [True: 1.21k, False: 0]
  |  Branch (710:15): [True: 1.21k, False: 0]
  ------------------
  711|  1.21k|    {
  712|  1.21k|        num_H1 = ( i1->lenTautomer > 0 && i1->nTautomer && i1->nTautomer[0] ) ? 1 : 0; /* number of t-groups */
  ------------------
  |  Branch (712:20): [True: 39, False: 1.17k]
  |  Branch (712:43): [True: 39, False: 0]
  |  Branch (712:60): [True: 39, False: 0]
  ------------------
  713|  1.21k|        if (!num_H1 && i1->nNum_H)
  ------------------
  |  Branch (713:13): [True: 1.17k, False: 39]
  |  Branch (713:24): [True: 1.17k, False: 0]
  ------------------
  714|  1.17k|        {
  715|  5.20k|            for (i = 0; i < i1->nNumberOfAtoms; i++)
  ------------------
  |  Branch (715:25): [True: 4.03k, False: 1.17k]
  ------------------
  716|  4.03k|            { /* immobile H */
  717|  4.03k|                if (i1->nNum_H[i])
  ------------------
  |  Branch (717:21): [True: 0, False: 4.03k]
  ------------------
  718|      0|                {
  719|      0|                    num_H1 = 1;
  720|      0|                    break;
  721|      0|                }
  722|  4.03k|            }
  723|  1.17k|        }
  724|  1.21k|        sDifSegs[DIFL_M][DIFS_h_H_ATOMS] |= num_H1 ? DIFV_NEQ2PRECED : DIFV_BOTH_EMPTY;
  ------------------
  |  Branch (724:45): [True: 39, False: 1.17k]
  ------------------
  725|  1.21k|    }
  726|      0|    else
  727|      0|    {
  728|      0|        sDifSegs[DIFL_M][DIFS_h_H_ATOMS] |= DIFV_BOTH_EMPTY;
  729|      0|    }
  730|       |    /* F: fixed mobile H */
  731|  1.21k|    if (i2 && !i2->bDeleted && i2->nNum_H_fixed)
  ------------------
  |  Branch (731:9): [True: 0, False: 1.21k]
  |  Branch (731:15): [True: 0, False: 0]
  |  Branch (731:32): [True: 0, False: 0]
  ------------------
  732|      0|    {
  733|      0|        num_H2 = 0;
  734|      0|        if (i1 && !i1->bDeleted)
  ------------------
  |  Branch (734:13): [True: 0, False: 0]
  |  Branch (734:19): [True: 0, False: 0]
  ------------------
  735|      0|        {
  736|      0|            for (i = 0; i < i1->nNumberOfAtoms; i++)
  ------------------
  |  Branch (736:25): [True: 0, False: 0]
  ------------------
  737|      0|            {
  738|      0|                if (i2->nNum_H_fixed[i])
  ------------------
  |  Branch (738:21): [True: 0, False: 0]
  ------------------
  739|      0|                {
  740|      0|                    num_H2 = 1;
  741|      0|                    break;
  742|      0|                }
  743|      0|            }
  744|      0|        }
  745|      0|        sDifSegs[DIFL_F][DIFS_h_H_ATOMS] |= num_H2 ? DIFV_NEQ2PRECED : DIFV_BOTH_EMPTY;
  ------------------
  |  Branch (745:45): [True: 0, False: 0]
  ------------------
  746|      0|    }
  747|  1.21k|    else
  748|  1.21k|    {
  749|  1.21k|        sDifSegs[DIFL_F][DIFS_h_H_ATOMS] |= DIFV_BOTH_EMPTY;
  750|  1.21k|    }
  751|       |    /* MI: exchangable isotopic H: see OutputINChI1(), num_iso_H[] */
  752|       |
  753|       |    /*=====================*/
  754|       |    /*====     /q    ======*/
  755|       |    /*=====================*/
  756|  1.21k|    psDifSegs = &sDifSegs[DIFL_F][DIFS_q_CHARGE];
  757|  1.21k|    if (i1 && !i1->bDeleted)
  ------------------
  |  Branch (757:9): [True: 1.21k, False: 0]
  |  Branch (757:15): [True: 1.21k, False: 0]
  ------------------
  758|  1.21k|    {
  759|  1.21k|        if (i1->nTotalCharge)
  ------------------
  |  Branch (759:13): [True: 3, False: 1.21k]
  ------------------
  760|      3|        {
  761|      3|            sDifSegs[DIFL_M][DIFS_q_CHARGE] |= DIFV_NEQ2PRECED;
  762|      3|        }
  763|  1.21k|        else
  764|  1.21k|        {
  765|  1.21k|            sDifSegs[DIFL_M][DIFS_q_CHARGE] |= DIFV_BOTH_EMPTY;
  766|  1.21k|        }
  767|  1.21k|        if (i2 && !i2->bDeleted)
  ------------------
  |  Branch (767:13): [True: 0, False: 1.21k]
  |  Branch (767:19): [True: 0, False: 0]
  ------------------
  768|      0|        {
  769|      0|            if (i1->nTotalCharge)
  ------------------
  |  Branch (769:17): [True: 0, False: 0]
  ------------------
  770|      0|            {
  771|      0|                if (i1->nTotalCharge == i2->nTotalCharge)
  ------------------
  |  Branch (771:21): [True: 0, False: 0]
  ------------------
  772|      0|                {
  773|      0|                    *psDifSegs |= DIFV_EQL2PRECED;
  774|      0|                }
  775|      0|                else
  776|      0|                {
  777|      0|                    if (i2->nTotalCharge)
  ------------------
  |  Branch (777:25): [True: 0, False: 0]
  ------------------
  778|      0|                    {
  779|      0|                        *psDifSegs |= DIFV_NEQ2PRECED;
  780|      0|                    }
  781|      0|                    else
  782|      0|                    {
  783|      0|                        *psDifSegs |= DIFV_IS_EMPTY;
  784|      0|                    }
  785|      0|                }
  786|      0|            }
  787|      0|            else
  788|      0|            {
  789|      0|                if (i2->nTotalCharge)
  ------------------
  |  Branch (789:21): [True: 0, False: 0]
  ------------------
  790|      0|                {
  791|      0|                    *psDifSegs |= DIFV_NEQ2PRECED;
  792|      0|                }
  793|      0|                else
  794|      0|                {
  795|      0|                    *psDifSegs |= DIFV_BOTH_EMPTY;
  796|      0|                }
  797|      0|            }
  798|      0|        }
  799|  1.21k|        else
  800|  1.21k|        {
  801|  1.21k|            if (!i2)
  ------------------
  |  Branch (801:17): [True: 1.21k, False: 0]
  ------------------
  802|  1.21k|            {
  803|  1.21k|                if (bFixTranspChargeBug == 1)
  ------------------
  |  Branch (803:21): [True: 1.21k, False: 0]
  ------------------
  804|  1.21k|                {
  805|       |                    /* bug explanation:
  806|       |
  807|       |                    component #1 is tautomeric, component #2 is not
  808|       |                    Mobile-H(#2) > Mobile-H(#1)
  809|       |                    Fixed-H(#2) = Mobile-H(#2) < Fixed-H(#1)
  810|       |
  811|       |                    Layer       first_charge   second_charge
  812|       |
  813|       |                    Mobile-H    0    (comp#1)  -1 (comp#2)
  814|       |                    Fixed-H     none (comp#2)  -1 (comp#1)
  815|       |
  816|       |                    v1.01 charge compared decided that charge layers are same and omitted Fixed-H /q layer
  817|       |
  818|       |                    Solution: when component permutation is detected AND fixed-H component does not exist,
  819|       |                    compare Mobile-H charge [0 (comp#1) in the example] to the charge of Mobile-H [-1 (comp#2)]
  820|       |                    of the component that has none Fixed-H charge
  821|       |                    */
  822|       |
  823|       |                    /* Fixed-H i2 is empty because Fixed-H struct is same as Mobile-H */
  824|  1.21k|                    if (p1->ord_number != p2->ord_number && /* component order in Fixed-H is different from Mobile-H */
  ------------------
  |  Branch (824:25): [True: 0, False: 1.21k]
  ------------------
  825|  1.21k|                         n1 == TAUT_YES && p2->pINChI[TAUT_YES] && !p2->pINChI[TAUT_YES]->bDeleted &&
  ------------------
  |  |  580|  1.21k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                                       n1 == TAUT_YES && p2->pINChI[TAUT_YES] && !p2->pINChI[TAUT_YES]->bDeleted &&
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                                       n1 == TAUT_YES && p2->pINChI[TAUT_YES] && !p2->pINChI[TAUT_YES]->bDeleted &&
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (825:26): [True: 0, False: 0]
  |  Branch (825:44): [True: 0, False: 0]
  |  Branch (825:68): [True: 0, False: 0]
  ------------------
  826|  1.21k|                        p2->pINChI[TAUT_YES]->nNumberOfAtoms)
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (826:25): [True: 0, False: 0]
  ------------------
  827|      0|                    {
  828|      0|                        int i2_nTotalCharge = p2->pINChI[TAUT_YES]->nTotalCharge;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  829|       |
  830|      0|                        if (i1->nTotalCharge)
  ------------------
  |  Branch (830:29): [True: 0, False: 0]
  ------------------
  831|      0|                        {
  832|      0|                            if (i1->nTotalCharge == i2_nTotalCharge)
  ------------------
  |  Branch (832:33): [True: 0, False: 0]
  ------------------
  833|      0|                            {
  834|      0|                                *psDifSegs |= DIFV_EQL2PRECED;
  835|      0|                            }
  836|      0|                            else
  837|      0|                            {
  838|      0|                                if (i2_nTotalCharge)
  ------------------
  |  Branch (838:37): [True: 0, False: 0]
  ------------------
  839|      0|                                {
  840|      0|                                    *psDifSegs |= DIFV_NEQ2PRECED;
  841|      0|                                }
  842|      0|                                else
  843|      0|                                {
  844|      0|                                    *psDifSegs |= DIFV_IS_EMPTY;
  845|      0|                                }
  846|      0|                            }
  847|      0|                        }
  848|      0|                        else
  849|      0|                        {
  850|      0|                            if (i2_nTotalCharge)
  ------------------
  |  Branch (850:33): [True: 0, False: 0]
  ------------------
  851|      0|                            {
  852|      0|                                *psDifSegs |= DIFV_NEQ2PRECED;
  853|      0|                            }
  854|      0|                            else
  855|      0|                            {
  856|      0|                                *psDifSegs |= DIFV_BOTH_EMPTY;
  857|      0|                            }
  858|      0|                        }
  859|      0|                    }
  860|  1.21k|                    else
  861|  1.21k|                    {
  862|  1.21k|                        *psDifSegs |= i1->nTotalCharge ? DIFV_EQL2PRECED : DIFV_BOTH_EMPTY;
  ------------------
  |  Branch (862:39): [True: 3, False: 1.21k]
  ------------------
  863|  1.21k|                    }
  864|  1.21k|                }
  865|      0|                else /* if (bFixTranspChargeBug==1) */
  866|      0|                {
  867|      0|                    *psDifSegs |= i1->nTotalCharge ? DIFV_EQL2PRECED : DIFV_BOTH_EMPTY;
  ------------------
  |  Branch (867:35): [True: 0, False: 0]
  ------------------
  868|      0|                }
  869|  1.21k|            }
  870|      0|            else /* if ( !i2 ) { */
  871|      0|            {
  872|       |                /* i2 && i2->bDeleted */
  873|      0|                *psDifSegs |= i1->nTotalCharge ? DIFV_IS_EMPTY : DIFV_BOTH_EMPTY;
  ------------------
  |  Branch (873:31): [True: 0, False: 0]
  ------------------
  874|      0|            }
  875|  1.21k|        }
  876|  1.21k|    }
  877|      0|    else
  878|      0|    {
  879|      0|        sDifSegs[DIFL_M][DIFS_q_CHARGE] |= DIFV_BOTH_EMPTY;
  880|      0|        if (i2 && !i2->bDeleted)
  ------------------
  |  Branch (880:13): [True: 0, False: 0]
  |  Branch (880:19): [True: 0, False: 0]
  ------------------
  881|      0|        {
  882|      0|            if (i2->nTotalCharge)
  ------------------
  |  Branch (882:17): [True: 0, False: 0]
  ------------------
  883|      0|            {
  884|      0|                sDifSegs[DIFL_F][DIFS_q_CHARGE] |= DIFV_NEQ2PRECED;
  885|      0|            }
  886|      0|            else
  887|      0|            {
  888|      0|                sDifSegs[DIFL_F][DIFS_q_CHARGE] |= DIFV_BOTH_EMPTY;
  889|      0|            }
  890|      0|        }
  891|      0|    }
  892|       |
  893|       |
  894|       |    /*************** stereo *****************/
  895|       |
  896|  1.21k|    if (i1 && !i1->bDeleted)
  ------------------
  |  Branch (896:9): [True: 1.21k, False: 0]
  |  Branch (896:15): [True: 1.21k, False: 0]
  ------------------
  897|  1.21k|    {
  898|  1.21k|        Stereo1 = i1->Stereo;
  899|  1.21k|        IsoStereo1 = i1->StereoIsotopic;
  900|  1.21k|    }
  901|      0|    else
  902|      0|    {
  903|      0|        Stereo1 = NULL;
  904|      0|        IsoStereo1 = NULL;
  905|      0|    }
  906|  1.21k|    if (i2 && !i2->bDeleted)
  ------------------
  |  Branch (906:9): [True: 0, False: 1.21k]
  |  Branch (906:15): [True: 0, False: 0]
  ------------------
  907|      0|    {
  908|      0|        Stereo2 = i2->Stereo;
  909|      0|        IsoStereo2 = i2->StereoIsotopic;
  910|      0|    }
  911|  1.21k|    else
  912|  1.21k|    {
  913|  1.21k|        Stereo2 = NULL;
  914|  1.21k|        IsoStereo2 = NULL;
  915|  1.21k|    }
  916|       |
  917|       |    /*=====================*/
  918|       |    /*====     /b    ======*/
  919|       |    /*=====================*/
  920|       |    /* M double bond stereo */
  921|  1.21k|    psDifSegs = &sDifSegs[DIFL_M][DIFS_b_SBONDS];
  922|  1.21k|    if (Stereo1 && Stereo1->nNumberOfStereoBonds)
  ------------------
  |  Branch (922:9): [True: 1, False: 1.21k]
  |  Branch (922:20): [True: 0, False: 1]
  ------------------
  923|      0|    {
  924|      0|        *psDifSegs |= DIFV_NEQ2PRECED;
  925|      0|    }
  926|  1.21k|    else
  927|  1.21k|    {
  928|  1.21k|        *psDifSegs |= DIFV_BOTH_EMPTY;
  929|  1.21k|    }
  930|       |    /* F double bond stereo */
  931|  1.21k|    psDifSegs = &sDifSegs[DIFL_F][DIFS_b_SBONDS];
  932|  1.21k|    if (Stereo2 && Stereo2->nNumberOfStereoBonds)
  ------------------
  |  Branch (932:9): [True: 0, False: 1.21k]
  |  Branch (932:20): [True: 0, False: 0]
  ------------------
  933|      0|    {
  934|      0|        if (Stereo1 && Stereo1->nNumberOfStereoBonds)
  ------------------
  |  Branch (934:13): [True: 0, False: 0]
  |  Branch (934:24): [True: 0, False: 0]
  ------------------
  935|      0|        {
  936|      0|            if (Eql_INChI_Stereo( Stereo1, EQL_SP2, Stereo2, EQL_SP2, 0 ))
  ------------------
  |  |  247|      0|#define EQL_SP2      8
  ------------------
                          if (Eql_INChI_Stereo( Stereo1, EQL_SP2, Stereo2, EQL_SP2, 0 ))
  ------------------
  |  |  247|      0|#define EQL_SP2      8
  ------------------
  |  Branch (936:17): [True: 0, False: 0]
  ------------------
  937|      0|            {
  938|      0|                *psDifSegs |= DIFV_EQL2PRECED;
  939|      0|            }
  940|      0|            else
  941|      0|            {
  942|      0|                *psDifSegs |= DIFV_NEQ2PRECED;
  943|      0|            }
  944|      0|        }
  945|      0|        else
  946|      0|        {
  947|      0|            *psDifSegs |= DIFV_NEQ2PRECED;
  948|      0|        }
  949|      0|    }
  950|  1.21k|    else
  951|  1.21k|    {
  952|  1.21k|        if (Stereo1 && Stereo1->nNumberOfStereoBonds)
  ------------------
  |  Branch (952:13): [True: 1, False: 1.21k]
  |  Branch (952:24): [True: 0, False: 1]
  ------------------
  953|      0|        {
  954|      0|            *psDifSegs |= i2 ? DIFV_IS_EMPTY : DIFV_EQL2PRECED;
  ------------------
  |  Branch (954:27): [True: 0, False: 0]
  ------------------
  955|      0|        }
  956|  1.21k|        else
  957|  1.21k|        {
  958|  1.21k|            *psDifSegs |= DIFV_BOTH_EMPTY;
  959|  1.21k|        }
  960|  1.21k|    }
  961|       |
  962|       |    /* MI double bond stereo */
  963|  1.21k|    psDifSegs = &sDifSegs[DIFL_MI][DIFS_b_SBONDS];
  964|  1.21k|    if (IsoStereo1 && IsoStereo1->nNumberOfStereoBonds)
  ------------------
  |  Branch (964:9): [True: 0, False: 1.21k]
  |  Branch (964:23): [True: 0, False: 0]
  ------------------
  965|      0|    {
  966|      0|        if (Eql_INChI_Stereo( IsoStereo1, EQL_SP2, Stereo1, EQL_SP2, 0 ))
  ------------------
  |  |  247|      0|#define EQL_SP2      8
  ------------------
                      if (Eql_INChI_Stereo( IsoStereo1, EQL_SP2, Stereo1, EQL_SP2, 0 ))
  ------------------
  |  |  247|      0|#define EQL_SP2      8
  ------------------
  |  Branch (966:13): [True: 0, False: 0]
  ------------------
  967|      0|        {
  968|      0|            *psDifSegs |= DIFV_EQL2PRECED;
  969|      0|        }
  970|      0|        else
  971|      0|        {
  972|      0|            *psDifSegs |= DIFV_NEQ2PRECED;
  973|      0|        }
  974|      0|    }
  975|  1.21k|    else
  976|  1.21k|    {
  977|  1.21k|        if (Stereo1 && Stereo1->nNumberOfStereoBonds)
  ------------------
  |  Branch (977:13): [True: 1, False: 1.21k]
  |  Branch (977:24): [True: 0, False: 1]
  ------------------
  978|      0|        {
  979|      0|            *psDifSegs |= DIFV_EQL2PRECED; /* isotopic is missing because there is no isotopes */
  980|      0|        }
  981|  1.21k|        else
  982|  1.21k|        {
  983|  1.21k|            *psDifSegs |= DIFV_BOTH_EMPTY;
  984|  1.21k|        }
  985|  1.21k|    }
  986|       |
  987|       |    /* FI double bond stereo */
  988|  1.21k|    psDifSegs = &sDifSegs[DIFL_FI][DIFS_b_SBONDS];
  989|  1.21k|    if (IsoStereo2 && IsoStereo2->nNumberOfStereoBonds)
  ------------------
  |  Branch (989:9): [True: 0, False: 1.21k]
  |  Branch (989:23): [True: 0, False: 0]
  ------------------
  990|      0|    {
  991|      0|        if (Eql_INChI_Stereo( IsoStereo2, EQL_SP2, Stereo2, EQL_SP2, 0 ))
  ------------------
  |  |  247|      0|#define EQL_SP2      8
  ------------------
                      if (Eql_INChI_Stereo( IsoStereo2, EQL_SP2, Stereo2, EQL_SP2, 0 ))
  ------------------
  |  |  247|      0|#define EQL_SP2      8
  ------------------
  |  Branch (991:13): [True: 0, False: 0]
  ------------------
  992|      0|        {
  993|      0|            *psDifSegs |= DIFV_EQL2PRECED;
  994|      0|        }
  995|      0|        else
  996|      0|        {
  997|      0|            if (!( Stereo1 && Stereo1->nNumberOfStereoBonds ) &&
  ------------------
  |  Branch (997:20): [True: 0, False: 0]
  |  Branch (997:31): [True: 0, False: 0]
  ------------------
  998|      0|                 !( Stereo2 && Stereo2->nNumberOfStereoBonds ) &&
  ------------------
  |  Branch (998:21): [True: 0, False: 0]
  |  Branch (998:32): [True: 0, False: 0]
  ------------------
  999|      0|                 Eql_INChI_Stereo( IsoStereo2, EQL_SP2, IsoStereo1, EQL_SP2, 0 ))
  ------------------
  |  |  247|      0|#define EQL_SP2      8
  ------------------
                               Eql_INChI_Stereo( IsoStereo2, EQL_SP2, IsoStereo1, EQL_SP2, 0 ))
  ------------------
  |  |  247|      0|#define EQL_SP2      8
  ------------------
  |  Branch (999:18): [True: 0, False: 0]
  ------------------
 1000|      0|            {
 1001|      0|                *psDifSegs |= DIFV_FI_EQ_MI;
 1002|      0|            }
 1003|      0|            else
 1004|      0|            {
 1005|      0|                *psDifSegs |= DIFV_NEQ2PRECED;
 1006|      0|            }
 1007|      0|        }
 1008|      0|    }
 1009|  1.21k|    else
 1010|  1.21k|    {
 1011|       |     /* the solution table for FI stereo,
 1012|       |        in case of FI stereo is empty
 1013|       |        E = segment is empty, NE = not empty
 1014|       |        +==============================+
 1015|       |        | M   | MI  | F   |  result    |
 1016|       |        +=====+=====+=====+============+
 1017|       |        | E   | E   | E   | both empty |
 1018|       |        +-----+-----+-----+------------+
 1019|       |        | NE  | E   | E   | both empty |
 1020|       |        +-----+-----+-----+------------+
 1021|       |        | E   | NE  | E   | is empty   |
 1022|       |        +-----+-----+-----+------------+
 1023|       |        | NE  | NE  | E   | both empty |
 1024|       |        +-----+-----+-----+------------+
 1025|       |        | E   | E   | NE  | is empty   |
 1026|       |        +-----+-----+-----+------------+
 1027|       |        | NE  | E   | NE  | is empty   |
 1028|       |        +-----+-----+-----+------------+
 1029|       |        | E   | NE  | NE  | is empty   |
 1030|       |        +-----+-----+-----+------------+
 1031|       |        | NE  | NE  | ME  | is empty   |
 1032|       |        +==============================+
 1033|       |     */
 1034|  1.21k|        if (Stereo2    && Stereo2->nNumberOfStereoBonds)
  ------------------
  |  Branch (1034:13): [True: 0, False: 1.21k]
  |  Branch (1034:27): [True: 0, False: 0]
  ------------------
 1035|      0|        {
 1036|      0|            *psDifSegs |= DIFV_EQL2PRECED; /* isotopic is missing because there is no isotopes */
 1037|      0|        }
 1038|  1.21k|        else
 1039|  1.21k|            if (IsoStereo1 && IsoStereo1->nNumberOfStereoBonds &&
  ------------------
  |  Branch (1039:17): [True: 0, False: 1.21k]
  |  Branch (1039:31): [True: 0, False: 0]
  ------------------
 1040|  1.21k|                 !( Stereo1 && Stereo1->nNumberOfStereoBonds )
  ------------------
  |  Branch (1040:21): [True: 0, False: 0]
  |  Branch (1040:32): [True: 0, False: 0]
  ------------------
 1041|  1.21k|                )
 1042|      0|            {
 1043|      0|                *psDifSegs |= i2 ? DIFV_IS_EMPTY : DIFV_EQL2PRECED;
  ------------------
  |  Branch (1043:31): [True: 0, False: 0]
  ------------------
 1044|      0|            }
 1045|  1.21k|            else
 1046|  1.21k|            {
 1047|  1.21k|                *psDifSegs |= DIFV_BOTH_EMPTY;
 1048|  1.21k|            }
 1049|  1.21k|    }
 1050|       |
 1051|       |    /*==================================*/
 1052|       |    /*====     /t, /m, /s for M   ======*/
 1053|       |    /*==================================*/
 1054|       |    /* M sp3 stereo */
 1055|  1.21k|    bRelRac[DIFL_M] = GetSp3RelRacAbs( i1, Stereo1 );       /* Mobile-H */
 1056|  1.21k|    bRelRac[DIFL_MI] = GetSp3RelRacAbs( i1, IsoStereo1 );
 1057|  1.21k|    bRelRac[DIFL_F] = GetSp3RelRacAbs( i2, Stereo2 );       /* Fixed-H */
 1058|  1.21k|    bRelRac[DIFL_FI] = GetSp3RelRacAbs( i2, IsoStereo2 );
 1059|  1.21k|    if (SP3_NONE != bRelRac[DIFL_M])
  ------------------
  |  Branch (1059:9): [True: 0, False: 1.21k]
  ------------------
 1060|      0|    {
 1061|      0|        sDifSegs[DIFL_M][DIFS_t_SATOMS] |= ( bRelRac[DIFL_M] & SP3_ANY ) ? DIFV_NEQ2PRECED : DIFV_BOTH_EMPTY;
  ------------------
  |  Branch (1061:44): [True: 0, False: 0]
  ------------------
 1062|      0|        sDifSegs[DIFL_M][DIFS_m_SP3INV] |= ( bRelRac[DIFL_M] & SP3_ABS ) ? DIFV_NEQ2PRECED : DIFV_BOTH_EMPTY;
  ------------------
  |  Branch (1062:44): [True: 0, False: 0]
  ------------------
 1063|      0|        sDifSegs[DIFL_M][DIFS_s_STYPE] |= ( bRelRac[DIFL_M] & SP3_TYPE ) ? DIFV_NEQ2PRECED : DIFV_BOTH_EMPTY;
  ------------------
  |  Branch (1063:43): [True: 0, False: 0]
  ------------------
 1064|      0|    }
 1065|  1.21k|    else
 1066|  1.21k|    {
 1067|  1.21k|        sDifSegs[DIFL_M][DIFS_t_SATOMS] |= DIFV_BOTH_EMPTY;
 1068|  1.21k|        sDifSegs[DIFL_M][DIFS_m_SP3INV] |= DIFV_BOTH_EMPTY;
 1069|  1.21k|        sDifSegs[DIFL_M][DIFS_s_STYPE] |= DIFV_BOTH_EMPTY;
 1070|  1.21k|    }
 1071|       |
 1072|       |    /*=====================*/
 1073|       |    /*====     /t    ======*/
 1074|       |    /*=====================*/
 1075|       |    /* F sp3 stereo */
 1076|  1.21k|    psDifSegs = &sDifSegs[DIFL_F][DIFS_t_SATOMS];
 1077|  1.21k|    if (SP3_ANY & bRelRac[DIFL_F])
  ------------------
  |  Branch (1077:9): [True: 0, False: 1.21k]
  ------------------
 1078|      0|    {
 1079|      0|        if (Eql_INChI_Stereo( Stereo2, EQL_SP3, Stereo1, EQL_SP3, 0 ))
  ------------------
  |  |  245|      0|#define EQL_SP3      2
  ------------------
                      if (Eql_INChI_Stereo( Stereo2, EQL_SP3, Stereo1, EQL_SP3, 0 ))
  ------------------
  |  |  245|      0|#define EQL_SP3      2
  ------------------
  |  Branch (1079:13): [True: 0, False: 0]
  ------------------
 1080|      0|        {
 1081|      0|            *psDifSegs |= DIFV_EQL2PRECED;
 1082|      0|        }
 1083|      0|        else
 1084|      0|        {
 1085|      0|            *psDifSegs |= DIFV_NEQ2PRECED;
 1086|      0|        }
 1087|      0|    }
 1088|  1.21k|    else
 1089|  1.21k|    {
 1090|  1.21k|        if (SP3_ANY & bRelRac[DIFL_M])
  ------------------
  |  Branch (1090:13): [True: 0, False: 1.21k]
  ------------------
 1091|      0|        {
 1092|      0|            *psDifSegs |= i2 ? DIFV_IS_EMPTY : DIFV_EQL2PRECED;
  ------------------
  |  Branch (1092:27): [True: 0, False: 0]
  ------------------
 1093|      0|        }
 1094|  1.21k|        else
 1095|  1.21k|        {
 1096|  1.21k|            *psDifSegs |= DIFV_BOTH_EMPTY;
 1097|  1.21k|        }
 1098|  1.21k|    }
 1099|       |
 1100|       |    /* MI sp3 stereo */
 1101|  1.21k|    psDifSegs = &sDifSegs[DIFL_MI][DIFS_t_SATOMS];
 1102|  1.21k|    if (SP3_ANY & bRelRac[DIFL_MI])
  ------------------
  |  Branch (1102:9): [True: 0, False: 1.21k]
  ------------------
 1103|      0|    {
 1104|      0|        if (Eql_INChI_Stereo( IsoStereo1, EQL_SP3, Stereo1, EQL_SP3, 0 ))
  ------------------
  |  |  245|      0|#define EQL_SP3      2
  ------------------
                      if (Eql_INChI_Stereo( IsoStereo1, EQL_SP3, Stereo1, EQL_SP3, 0 ))
  ------------------
  |  |  245|      0|#define EQL_SP3      2
  ------------------
  |  Branch (1104:13): [True: 0, False: 0]
  ------------------
 1105|      0|        {
 1106|      0|            *psDifSegs |= DIFV_EQL2PRECED;
 1107|      0|        }
 1108|      0|        else
 1109|      0|        {
 1110|      0|            *psDifSegs |= DIFV_NEQ2PRECED;
 1111|      0|        }
 1112|      0|    }
 1113|  1.21k|    else
 1114|  1.21k|    {
 1115|  1.21k|        if (SP3_ANY & bRelRac[DIFL_M])
  ------------------
  |  Branch (1115:13): [True: 0, False: 1.21k]
  ------------------
 1116|      0|        {
 1117|      0|            *psDifSegs |= DIFV_EQL2PRECED; /* isotopic is missing because there is no isotopes */
 1118|      0|        }
 1119|  1.21k|        else
 1120|  1.21k|        {
 1121|  1.21k|            *psDifSegs |= DIFV_BOTH_EMPTY;
 1122|  1.21k|        }
 1123|  1.21k|    }
 1124|       |
 1125|       |    /* FI sp3 stereo */
 1126|  1.21k|    psDifSegs = &sDifSegs[DIFL_FI][DIFS_t_SATOMS];
 1127|  1.21k|    if (SP3_ANY & bRelRac[DIFL_FI])
  ------------------
  |  Branch (1127:9): [True: 0, False: 1.21k]
  ------------------
 1128|      0|    {
 1129|      0|        if (Eql_INChI_Stereo( IsoStereo2, EQL_SP3, Stereo2, EQL_SP3, 0 ))
  ------------------
  |  |  245|      0|#define EQL_SP3      2
  ------------------
                      if (Eql_INChI_Stereo( IsoStereo2, EQL_SP3, Stereo2, EQL_SP3, 0 ))
  ------------------
  |  |  245|      0|#define EQL_SP3      2
  ------------------
  |  Branch (1129:13): [True: 0, False: 0]
  ------------------
 1130|      0|        {
 1131|      0|            *psDifSegs |= DIFV_EQL2PRECED;
 1132|      0|        }
 1133|      0|        else
 1134|      0|        {
 1135|      0|            if (!( SP3_ANY & bRelRac[DIFL_M] ) &&
  ------------------
  |  Branch (1135:17): [True: 0, False: 0]
  ------------------
 1136|      0|            !( SP3_ANY & bRelRac[DIFL_F] ) &&
  ------------------
  |  Branch (1136:13): [True: 0, False: 0]
  ------------------
 1137|      0|            Eql_INChI_Stereo( IsoStereo2, EQL_SP3, IsoStereo1, EQL_SP3, 0 ))
  ------------------
  |  |  245|      0|#define EQL_SP3      2
  ------------------
                          Eql_INChI_Stereo( IsoStereo2, EQL_SP3, IsoStereo1, EQL_SP3, 0 ))
  ------------------
  |  |  245|      0|#define EQL_SP3      2
  ------------------
  |  Branch (1137:13): [True: 0, False: 0]
  ------------------
 1138|      0|            {
 1139|      0|                *psDifSegs |= DIFV_FI_EQ_MI;
 1140|      0|            }
 1141|      0|            else
 1142|      0|            {
 1143|      0|                *psDifSegs |= DIFV_NEQ2PRECED;
 1144|      0|            }
 1145|      0|        }
 1146|      0|    }
 1147|  1.21k|    else /* similar to /b */
 1148|  1.21k|        if (( SP3_ANY & bRelRac[DIFL_F] ))
  ------------------
  |  Branch (1148:13): [True: 0, False: 1.21k]
  ------------------
 1149|      0|        {
 1150|      0|            *psDifSegs |= DIFV_EQL2PRECED; /* isotopic is missing because there is no isotopes */
 1151|      0|        }
 1152|  1.21k|        else
 1153|  1.21k|        {
 1154|  1.21k|            if (( SP3_ANY & bRelRac[DIFL_MI] ) && !( SP3_ANY & bRelRac[DIFL_M] ))
  ------------------
  |  Branch (1154:17): [True: 0, False: 1.21k]
  |  Branch (1154:51): [True: 0, False: 0]
  ------------------
 1155|      0|            {
 1156|      0|                *psDifSegs |= i2 ? DIFV_IS_EMPTY : DIFV_EQL2PRECED;
  ------------------
  |  Branch (1156:31): [True: 0, False: 0]
  ------------------
 1157|      0|            }
 1158|  1.21k|            else
 1159|  1.21k|            {
 1160|  1.21k|                *psDifSegs |= DIFV_BOTH_EMPTY;
 1161|  1.21k|            }
 1162|  1.21k|        }
 1163|       |
 1164|       |        /*=====================*/
 1165|       |        /*====     /m    ======*/
 1166|       |        /*=====================*/
 1167|       |        /* F sp3 abs stereo inversion */
 1168|  1.21k|    psDifSegs = &sDifSegs[DIFL_F][DIFS_m_SP3INV];
 1169|  1.21k|    if (bRelRac[DIFL_F] & SP3_ABS)
  ------------------
  |  Branch (1169:9): [True: 0, False: 1.21k]
  ------------------
 1170|      0|    {
 1171|       |        /* the order of || operands below is critically important: || is not a commutative operation */
 1172|      0|        if (!( bRelRac[DIFL_M] & SP3_ABS ) || Stereo2->nCompInv2Abs != Stereo1->nCompInv2Abs)
  ------------------
  |  Branch (1172:13): [True: 0, False: 0]
  |  Branch (1172:47): [True: 0, False: 0]
  ------------------
 1173|      0|        {
 1174|      0|            *psDifSegs |= DIFV_NEQ2PRECED;
 1175|      0|        }
 1176|      0|        else
 1177|      0|        {
 1178|      0|            *psDifSegs |= DIFV_EQL2PRECED;
 1179|      0|        }
 1180|      0|    }
 1181|  1.21k|    else
 1182|  1.21k|    {
 1183|  1.21k|        if (bRelRac[DIFL_M] & SP3_ABS)
  ------------------
  |  Branch (1183:13): [True: 0, False: 1.21k]
  ------------------
 1184|      0|        {
 1185|      0|            *psDifSegs |= i2 ? DIFV_IS_EMPTY : DIFV_EQL2PRECED;
  ------------------
  |  Branch (1185:27): [True: 0, False: 0]
  ------------------
 1186|      0|        }
 1187|  1.21k|        else
 1188|  1.21k|        {
 1189|  1.21k|            *psDifSegs |= DIFV_BOTH_EMPTY;
 1190|  1.21k|        }
 1191|  1.21k|    }
 1192|       |
 1193|       |    /* MI sp3 abs stereo inversion */
 1194|  1.21k|    psDifSegs = &sDifSegs[DIFL_MI][DIFS_m_SP3INV];
 1195|  1.21k|    if (SP3_ABS & bRelRac[DIFL_MI])
  ------------------
  |  Branch (1195:9): [True: 0, False: 1.21k]
  ------------------
 1196|      0|    {
 1197|      0|        if (( SP3_ABS & bRelRac[DIFL_M] ) && IsoStereo1->nCompInv2Abs == Stereo1->nCompInv2Abs)
  ------------------
  |  Branch (1197:13): [True: 0, False: 0]
  |  Branch (1197:46): [True: 0, False: 0]
  ------------------
 1198|      0|        {
 1199|      0|            *psDifSegs |= DIFV_EQL2PRECED;
 1200|      0|        }
 1201|      0|        else
 1202|      0|        {
 1203|      0|            *psDifSegs |= DIFV_NEQ2PRECED;
 1204|      0|        }
 1205|      0|    }
 1206|  1.21k|    else
 1207|  1.21k|    {
 1208|  1.21k|        if (SP3_ABS & bRelRac[DIFL_M])
  ------------------
  |  Branch (1208:13): [True: 0, False: 1.21k]
  ------------------
 1209|      0|        {
 1210|      0|            *psDifSegs |= DIFV_EQL2PRECED; /* isotopic is missing because there is no isotopes */
 1211|      0|        }
 1212|  1.21k|        else
 1213|  1.21k|        {
 1214|  1.21k|            *psDifSegs |= DIFV_BOTH_EMPTY;
 1215|  1.21k|        }
 1216|  1.21k|    }
 1217|       |
 1218|       |    /* FI sp3 abs stereo inversion */
 1219|  1.21k|    psDifSegs = &sDifSegs[DIFL_FI][DIFS_m_SP3INV];
 1220|  1.21k|    if (SP3_ABS & bRelRac[DIFL_FI])
  ------------------
  |  Branch (1220:9): [True: 0, False: 1.21k]
  ------------------
 1221|      0|    {
 1222|      0|        if (( SP3_ABS & bRelRac[DIFL_F] ) && IsoStereo2->nCompInv2Abs == Stereo2->nCompInv2Abs)
  ------------------
  |  Branch (1222:13): [True: 0, False: 0]
  |  Branch (1222:46): [True: 0, False: 0]
  ------------------
 1223|      0|        {
 1224|      0|            *psDifSegs |= DIFV_EQL2PRECED;
 1225|      0|        }
 1226|      0|        else
 1227|      0|        {
 1228|      0|            if (!( SP3_ABS & bRelRac[DIFL_M] ) &&
  ------------------
  |  Branch (1228:17): [True: 0, False: 0]
  ------------------
 1229|      0|            !( SP3_ABS & bRelRac[DIFL_F] ) &&
  ------------------
  |  Branch (1229:13): [True: 0, False: 0]
  ------------------
 1230|      0|       ( SP3_ABS & bRelRac[DIFL_MI] ) && /* make sure IsoStereo1 != NULL */
  ------------------
  |  Branch (1230:8): [True: 0, False: 0]
  ------------------
 1231|      0|            IsoStereo2->nCompInv2Abs == IsoStereo1->nCompInv2Abs)
  ------------------
  |  Branch (1231:13): [True: 0, False: 0]
  ------------------
 1232|      0|            {
 1233|      0|                *psDifSegs |= DIFV_FI_EQ_MI;
 1234|      0|            }
 1235|      0|            else
 1236|      0|            {
 1237|      0|                *psDifSegs |= DIFV_NEQ2PRECED;
 1238|      0|            }
 1239|      0|        }
 1240|      0|    }
 1241|       |
 1242|  1.21k|    else
 1243|  1.21k|    {
 1244|       |        /* similar to /b */
 1245|       |        /* the order of || operands below is critically important: || is no a commutative operation */
 1246|  1.21k|        if (( SP3_ABS & bRelRac[DIFL_F] ))
  ------------------
  |  Branch (1246:13): [True: 0, False: 1.21k]
  ------------------
 1247|      0|        {
 1248|      0|            *psDifSegs |= DIFV_EQL2PRECED; /* isotopic is missing because there is no isotopes */
 1249|      0|        }
 1250|  1.21k|        else
 1251|  1.21k|        {
 1252|  1.21k|            if (( SP3_ABS & bRelRac[DIFL_MI] ) && !( SP3_ABS & bRelRac[DIFL_M] ))
  ------------------
  |  Branch (1252:17): [True: 0, False: 1.21k]
  |  Branch (1252:51): [True: 0, False: 0]
  ------------------
 1253|      0|            {
 1254|      0|                *psDifSegs |= i2 ? DIFV_IS_EMPTY : DIFV_EQL2PRECED;
  ------------------
  |  Branch (1254:31): [True: 0, False: 0]
  ------------------
 1255|      0|            }
 1256|  1.21k|            else
 1257|  1.21k|            {
 1258|  1.21k|                *psDifSegs |= DIFV_BOTH_EMPTY;
 1259|  1.21k|            }
 1260|  1.21k|        }
 1261|  1.21k|    }
 1262|       |
 1263|       |    /*=====================*/
 1264|       |    /*====     /s    ======*/
 1265|       |    /*=====================*/
 1266|       |    /* F sp3 stereo type */
 1267|  1.21k|    psDifSegs = &sDifSegs[DIFL_F][DIFS_s_STYPE];
 1268|  1.21k|    if (bRelRac[DIFL_F] & SP3_TYPE)
  ------------------
  |  Branch (1268:9): [True: 0, False: 1.21k]
  ------------------
 1269|      0|    {
 1270|      0|        if (( bRelRac[DIFL_F] & SP3_TYPE ) == ( bRelRac[DIFL_M] & SP3_TYPE ))
  ------------------
  |  Branch (1270:13): [True: 0, False: 0]
  ------------------
 1271|      0|        {
 1272|      0|            *psDifSegs |= DIFV_EQL2PRECED;
 1273|      0|        }
 1274|      0|        else
 1275|      0|        {
 1276|      0|            *psDifSegs |= DIFV_NEQ2PRECED;
 1277|      0|        }
 1278|      0|    }
 1279|  1.21k|    else
 1280|  1.21k|    {
 1281|  1.21k|        if (bRelRac[DIFL_M] & SP3_TYPE)
  ------------------
  |  Branch (1281:13): [True: 0, False: 1.21k]
  ------------------
 1282|      0|        {
 1283|      0|            *psDifSegs |= i2 ? DIFV_IS_EMPTY : DIFV_EQL2PRECED;
  ------------------
  |  Branch (1283:27): [True: 0, False: 0]
  ------------------
 1284|      0|        }
 1285|  1.21k|        else
 1286|  1.21k|        {
 1287|  1.21k|            *psDifSegs |= DIFV_BOTH_EMPTY;
 1288|  1.21k|        }
 1289|  1.21k|    }
 1290|       |
 1291|       |    /* MI sp3 stereo type */
 1292|  1.21k|    psDifSegs = &sDifSegs[DIFL_MI][DIFS_s_STYPE];
 1293|  1.21k|    if (SP3_TYPE & bRelRac[DIFL_MI])
  ------------------
  |  Branch (1293:9): [True: 0, False: 1.21k]
  ------------------
 1294|      0|    {
 1295|      0|        if (( SP3_TYPE & bRelRac[DIFL_MI] ) == ( SP3_TYPE & bRelRac[DIFL_M] ))
  ------------------
  |  Branch (1295:13): [True: 0, False: 0]
  ------------------
 1296|      0|        {
 1297|      0|            *psDifSegs |= DIFV_EQL2PRECED;
 1298|      0|        }
 1299|      0|        else
 1300|      0|        {
 1301|      0|            *psDifSegs |= DIFV_NEQ2PRECED;
 1302|      0|        }
 1303|      0|    }
 1304|  1.21k|    else
 1305|  1.21k|    {
 1306|  1.21k|        if (SP3_TYPE & bRelRac[DIFL_M])
  ------------------
  |  Branch (1306:13): [True: 0, False: 1.21k]
  ------------------
 1307|      0|        {
 1308|      0|            *psDifSegs |= DIFV_EQL2PRECED; /* isotopic is missing because there is no isotopes */
 1309|      0|        }
 1310|  1.21k|        else
 1311|  1.21k|        {
 1312|  1.21k|            *psDifSegs |= DIFV_BOTH_EMPTY;
 1313|  1.21k|        }
 1314|  1.21k|    }
 1315|       |
 1316|       |    /* FI sp3 stereo type */
 1317|  1.21k|    psDifSegs = &sDifSegs[DIFL_FI][DIFS_s_STYPE];
 1318|  1.21k|    if (SP3_TYPE & bRelRac[DIFL_FI])
  ------------------
  |  Branch (1318:9): [True: 0, False: 1.21k]
  ------------------
 1319|      0|    {
 1320|      0|        if (( SP3_TYPE & bRelRac[DIFL_FI] ) == ( SP3_TYPE & bRelRac[DIFL_F] ))
  ------------------
  |  Branch (1320:13): [True: 0, False: 0]
  ------------------
 1321|      0|        {
 1322|      0|            *psDifSegs |= DIFV_EQL2PRECED;
 1323|      0|        }
 1324|      0|        else
 1325|      0|        {
 1326|      0|            if (!( SP3_TYPE & bRelRac[DIFL_M] ) &&
  ------------------
  |  Branch (1326:17): [True: 0, False: 0]
  ------------------
 1327|      0|            !( SP3_TYPE & bRelRac[DIFL_F] ) &&
  ------------------
  |  Branch (1327:13): [True: 0, False: 0]
  ------------------
 1328|      0|       ( SP3_TYPE & bRelRac[DIFL_MI] ))
  ------------------
  |  Branch (1328:8): [True: 0, False: 0]
  ------------------
 1329|      0|            {
 1330|      0|                *psDifSegs |= DIFV_FI_EQ_MI;
 1331|      0|            }
 1332|      0|            else
 1333|      0|            {
 1334|      0|                *psDifSegs |= DIFV_NEQ2PRECED;
 1335|      0|            }
 1336|      0|        }
 1337|      0|    }
 1338|  1.21k|    else
 1339|  1.21k|    {
 1340|       |        /* similar to /b */
 1341|       |        /* the order of || operands below is critically important: || is not a commutative operation */
 1342|  1.21k|        if (( SP3_TYPE & bRelRac[DIFL_F] ))
  ------------------
  |  Branch (1342:13): [True: 0, False: 1.21k]
  ------------------
 1343|      0|        {
 1344|      0|            *psDifSegs |= DIFV_EQL2PRECED; /* isotopic is missing because there is no isotopes */
 1345|      0|        }
 1346|  1.21k|        else
 1347|  1.21k|        {
 1348|  1.21k|            if (( SP3_TYPE & bRelRac[DIFL_MI] ) && !( SP3_TYPE & bRelRac[DIFL_M] ))
  ------------------
  |  Branch (1348:17): [True: 0, False: 1.21k]
  |  Branch (1348:52): [True: 0, False: 0]
  ------------------
 1349|      0|            {
 1350|      0|                *psDifSegs |= i2 ? DIFV_IS_EMPTY : DIFV_EQL2PRECED;
  ------------------
  |  Branch (1350:31): [True: 0, False: 0]
  ------------------
 1351|      0|            }
 1352|  1.21k|            else
 1353|  1.21k|            {
 1354|  1.21k|                *psDifSegs |= DIFV_BOTH_EMPTY;
 1355|  1.21k|            }
 1356|  1.21k|        }
 1357|  1.21k|    }
 1358|       |
 1359|       |    /*=====================*/
 1360|       |    /*====     /o    ======*/
 1361|       |    /*=====================*/
 1362|  1.21k|    if (p1 && p2 && p1->ord_number != p2->ord_number)
  ------------------
  |  Branch (1362:9): [True: 1.21k, False: 0]
  |  Branch (1362:15): [True: 1.21k, False: 0]
  |  Branch (1362:21): [True: 0, False: 1.21k]
  ------------------
 1363|      0|    {
 1364|      0|        sDifSegs[DIFL_F][DIFS_o_TRANSP] |= DIFV_NEQ2PRECED;
 1365|      0|    }
 1366|       |    /*=====================*/
 1367|       |    /*====     /i    ======*/
 1368|       |    /*=====================*/
 1369|       |
 1370|       |    /* M isotopic atoms */
 1371|  1.21k|    psDifSegs = &sDifSegs[DIFL_MI][DIFS_i_IATOMS];
 1372|  1.21k|    if (i1 && !i1->bDeleted && ( i1->nNumberOfIsotopicAtoms || i1->nNumberOfIsotopicTGroups ))
  ------------------
  |  Branch (1372:9): [True: 1.21k, False: 0]
  |  Branch (1372:15): [True: 1.21k, False: 0]
  |  Branch (1372:34): [True: 14, False: 1.20k]
  |  Branch (1372:64): [True: 0, False: 1.20k]
  ------------------
 1373|     14|    {
 1374|     14|        *psDifSegs |= DIFV_NEQ2PRECED;
 1375|     14|    }
 1376|  1.20k|    else
 1377|  1.20k|    {
 1378|  1.20k|        *psDifSegs |= DIFV_BOTH_EMPTY;
 1379|  1.20k|    }
 1380|       |    /* F isotopic atoms */
 1381|  1.21k|    psDifSegs = &sDifSegs[DIFL_FI][DIFS_i_IATOMS];
 1382|  1.21k|    if (i2 && !i2->bDeleted)
  ------------------
  |  Branch (1382:9): [True: 0, False: 1.21k]
  |  Branch (1382:15): [True: 0, False: 0]
  ------------------
 1383|      0|    {
 1384|      0|        if (i2->nNumberOfIsotopicAtoms || i2->nNumberOfIsotopicTGroups)
  ------------------
  |  Branch (1384:13): [True: 0, False: 0]
  |  Branch (1384:43): [True: 0, False: 0]
  ------------------
 1385|      0|        {
 1386|      0|            if (!i1 || i1->bDeleted ||
  ------------------
  |  Branch (1386:17): [True: 0, False: 0]
  |  Branch (1386:24): [True: 0, False: 0]
  ------------------
 1387|      0|                 i2->nNumberOfIsotopicAtoms != i1->nNumberOfIsotopicAtoms ||
  ------------------
  |  Branch (1387:18): [True: 0, False: 0]
  ------------------
 1388|      0|                 i2->nNumberOfIsotopicTGroups != i1->nNumberOfIsotopicTGroups)
  ------------------
  |  Branch (1388:18): [True: 0, False: 0]
  ------------------
 1389|      0|            {
 1390|      0|                *psDifSegs |= DIFV_NEQ2PRECED;
 1391|      0|            }
 1392|      0|            else
 1393|      0|            {
 1394|      0|                int diff;
 1395|      0|                num = i1->nNumberOfIsotopicAtoms;
 1396|      0|                diff = 0;
 1397|      0|                for (i = 0; i < num; i++)
  ------------------
  |  Branch (1397:29): [True: 0, False: 0]
  ------------------
 1398|      0|                {
 1399|       |                    /* compare isotopic atoms */
 1400|      0|                    if (diff = (int) i2->IsotopicAtom[i].nAtomNumber - (int) i1->IsotopicAtom[i].nAtomNumber)
  ------------------
  |  Branch (1400:25): [True: 0, False: 0]
  ------------------
 1401|      0|                    {
 1402|      0|                        break;
 1403|      0|                    }
 1404|      0|                    if (diff = (int) i2->IsotopicAtom[i].nIsoDifference - (int) i1->IsotopicAtom[i].nIsoDifference)
  ------------------
  |  Branch (1404:25): [True: 0, False: 0]
  ------------------
 1405|      0|                    {
 1406|      0|                        break;
 1407|      0|                    }
 1408|       |                    /* compare isotopic H */
 1409|      0|                    if (diff = (int) i2->IsotopicAtom[i].nNum_T - (int) i1->IsotopicAtom[i].nNum_T)
  ------------------
  |  Branch (1409:25): [True: 0, False: 0]
  ------------------
 1410|      0|                    {
 1411|      0|                        break;
 1412|      0|                    }
 1413|      0|                    if (diff = (int) i2->IsotopicAtom[i].nNum_D - (int) i1->IsotopicAtom[i].nNum_D)
  ------------------
  |  Branch (1413:25): [True: 0, False: 0]
  ------------------
 1414|      0|                    {
 1415|      0|                        break;
 1416|      0|                    }
 1417|      0|                    if (diff = (int) i2->IsotopicAtom[i].nNum_H - (int) i1->IsotopicAtom[i].nNum_H)
  ------------------
  |  Branch (1417:25): [True: 0, False: 0]
  ------------------
 1418|      0|                    {
 1419|      0|                        break;
 1420|      0|                    }
 1421|      0|                }
 1422|      0|                if (!diff)
  ------------------
  |  Branch (1422:21): [True: 0, False: 0]
  ------------------
 1423|      0|                {
 1424|      0|                    num = i1->nNumberOfIsotopicTGroups;
 1425|      0|                    for (i = 0; i < num; i++)
  ------------------
  |  Branch (1425:33): [True: 0, False: 0]
  ------------------
 1426|      0|                    {
 1427|      0|                        if (diff = (int) i2->IsotopicTGroup[i].nTGroupNumber - (int) i1->IsotopicTGroup[i].nTGroupNumber)
  ------------------
  |  Branch (1427:29): [True: 0, False: 0]
  ------------------
 1428|      0|                        {
 1429|      0|                            break;
 1430|      0|                        }
 1431|      0|                        if (diff = (int) i2->IsotopicTGroup[i].nNum_T - (int) i1->IsotopicTGroup[i].nNum_T)
  ------------------
  |  Branch (1431:29): [True: 0, False: 0]
  ------------------
 1432|      0|                        {
 1433|      0|                            break;
 1434|      0|                        }
 1435|      0|                        if (diff = (int) i2->IsotopicTGroup[i].nNum_D - (int) i1->IsotopicTGroup[i].nNum_D)
  ------------------
  |  Branch (1435:29): [True: 0, False: 0]
  ------------------
 1436|      0|                        {
 1437|      0|                            return diff;
 1438|      0|                        }
 1439|      0|                        if (diff = (int) i2->IsotopicTGroup[i].nNum_H - (int) i1->IsotopicTGroup[i].nNum_H)
  ------------------
  |  Branch (1439:29): [True: 0, False: 0]
  ------------------
 1440|      0|                        {
 1441|      0|                            break;
 1442|      0|                        }
 1443|      0|                    }
 1444|      0|                }
 1445|      0|                *psDifSegs |= diff ? DIFV_NEQ2PRECED : DIFV_FI_EQ_MI;
  ------------------
  |  Branch (1445:31): [True: 0, False: 0]
  ------------------
 1446|      0|            }
 1447|      0|        }
 1448|      0|        else
 1449|      0|        {
 1450|      0|            if (i1 && !i1->bDeleted && ( i1->nNumberOfIsotopicAtoms || i1->nNumberOfIsotopicTGroups ))
  ------------------
  |  Branch (1450:17): [True: 0, False: 0]
  |  Branch (1450:23): [True: 0, False: 0]
  |  Branch (1450:42): [True: 0, False: 0]
  |  Branch (1450:72): [True: 0, False: 0]
  ------------------
 1451|      0|            {
 1452|      0|                *psDifSegs |= DIFV_IS_EMPTY;
 1453|      0|            }
 1454|      0|        }
 1455|      0|    }
 1456|  1.21k|    else
 1457|  1.21k|    {
 1458|  1.21k|        if (!i2)
  ------------------
  |  Branch (1458:13): [True: 1.21k, False: 0]
  ------------------
 1459|  1.21k|        {
 1460|  1.21k|            if (i1 && !i1->bDeleted && ( i1->nNumberOfIsotopicAtoms || i1->nNumberOfIsotopicTGroups ))
  ------------------
  |  Branch (1460:17): [True: 1.21k, False: 0]
  |  Branch (1460:23): [True: 1.21k, False: 0]
  |  Branch (1460:42): [True: 14, False: 1.20k]
  |  Branch (1460:72): [True: 0, False: 1.20k]
  ------------------
 1461|     14|            {
 1462|     14|                *psDifSegs |= DIFV_EQL2PRECED;
 1463|     14|            }
 1464|  1.20k|            else
 1465|  1.20k|            {
 1466|  1.20k|                *psDifSegs |= DIFV_BOTH_EMPTY;
 1467|  1.20k|            }
 1468|  1.21k|        }
 1469|  1.21k|    }
 1470|       |
 1471|  1.21k|    return ret;
 1472|  1.21k|}
INChI_SegmentAction:
 1477|    804|{
 1478|    804|    if (!( cDifSegs & DIFV_OUTPUT_OMIT_F ))
  ------------------
  |  Branch (1478:9): [True: 734, False: 70]
  ------------------
 1479|    734|    {
 1480|    734|        return INCHI_SEGM_OMIT;
 1481|    734|    }
 1482|     70|    if (( cDifSegs & DIFV_OUTPUT_EMPTY_T ) && !( cDifSegs & DIFV_OUTPUT_EMPTY_F ))
  ------------------
  |  Branch (1482:9): [True: 0, False: 70]
  |  Branch (1482:47): [True: 0, False: 0]
  ------------------
 1483|      0|    {
 1484|      0|        return INCHI_SEGM_EMPTY;
 1485|      0|    }
 1486|     70|    if (( cDifSegs & DIFV_OUTPUT_FILL_T ))
  ------------------
  |  Branch (1486:9): [True: 70, False: 0]
  ------------------
 1487|     70|    {
 1488|     70|        return INCHI_SEGM_FILL;
 1489|     70|    }
 1490|       |
 1491|      0|    return INCHI_SEGM_OMIT; /* the control flow shoul never reach this point */
 1492|     70|}
MarkUnusedAndEmptyLayers:
 1516|     80|{
 1517|     80|    int i, nLayer, sBits, nFirstSegm;
 1518|     80|#define nFirstFmlSegm   DIFS_f_FORMULA
 1519|     80|#define nFirstIsoSegm   DIFS_i_IATOMS
 1520|       |     /* FI */
 1521|     80|    nLayer = DIFL_FI;
 1522|     80|    nFirstSegm = nFirstIsoSegm;
  ------------------
  |  | 1519|     80|#define nFirstIsoSegm   DIFS_i_IATOMS
  ------------------
 1523|     80|    sBits = 0;
 1524|    960|    for (i = 0; i < DIFS_idf_LENGTH; i++)
  ------------------
  |  Branch (1524:17): [True: 880, False: 80]
  ------------------
 1525|    880|    {
 1526|    880|        sBits |= sDifSegs[nLayer][i];
 1527|    880|    }
 1528|     80|    if (!( sBits & DIFV_OUTPUT_OMIT_F ))
  ------------------
  |  Branch (1528:9): [True: 80, False: 0]
  ------------------
 1529|     80|    {
 1530|       |        /* Omit the FI layer */
 1531|     80|        memset( sDifSegs[nLayer], DIFV_BOTH_EMPTY, DIFS_idf_LENGTH );
 1532|     80|    }
 1533|      0|    else
 1534|      0|    {
 1535|      0|        if (sDifSegs[nLayer][nFirstSegm] == DIFV_BOTH_EMPTY ||
  ------------------
  |  Branch (1535:13): [True: 0, False: 0]
  ------------------
 1536|      0|                !( sDifSegs[nLayer][nFirstSegm] & DIFV_OUTPUT_OMIT_F ))
  ------------------
  |  Branch (1536:17): [True: 0, False: 0]
  ------------------
 1537|      0|        {
 1538|      0|            sDifSegs[nLayer][nFirstSegm] = DIFV_IS_EMPTY;
 1539|      0|        }
 1540|      0|    }
 1541|       |
 1542|       |        /* MI */
 1543|     80|    nLayer = DIFL_MI;
 1544|     80|    nFirstSegm = nFirstIsoSegm;
  ------------------
  |  | 1519|     80|#define nFirstIsoSegm   DIFS_i_IATOMS
  ------------------
 1545|     80|    sBits = 0;
 1546|    960|    for (i = 0; i < DIFS_idf_LENGTH; i++)
  ------------------
  |  Branch (1546:17): [True: 880, False: 80]
  ------------------
 1547|    880|    {
 1548|    880|        sBits |= sDifSegs[nLayer][i];
 1549|    880|    }
 1550|     80|    if (!( sBits & DIFV_OUTPUT_OMIT_F ))
  ------------------
  |  Branch (1550:9): [True: 66, False: 14]
  ------------------
 1551|     66|    {
 1552|       |        /* Omit the MI layer */
 1553|     66|        memset( sDifSegs[nLayer], DIFV_BOTH_EMPTY, DIFS_idf_LENGTH );
 1554|     66|    }
 1555|     14|    else
 1556|     14|    {
 1557|     14|        if (sDifSegs[nLayer][nFirstSegm] == DIFV_BOTH_EMPTY ||
  ------------------
  |  Branch (1557:13): [True: 0, False: 14]
  ------------------
 1558|     14|          !( sDifSegs[nLayer][nFirstSegm] & DIFV_OUTPUT_OMIT_F ))
  ------------------
  |  Branch (1558:11): [True: 0, False: 14]
  ------------------
 1559|      0|        {
 1560|      0|            sDifSegs[nLayer][nFirstSegm] = DIFV_IS_EMPTY;
 1561|      0|        }
 1562|     14|    }
 1563|       |
 1564|       |    /* F */
 1565|     80|    nLayer = DIFL_F;
 1566|     80|    nFirstSegm = nFirstFmlSegm;
  ------------------
  |  | 1518|     80|#define nFirstFmlSegm   DIFS_f_FORMULA
  ------------------
 1567|     80|    sBits = 0;
 1568|    960|    for (i = 0; i < DIFS_idf_LENGTH; i++)
  ------------------
  |  Branch (1568:17): [True: 880, False: 80]
  ------------------
 1569|    880|    {
 1570|    880|        sBits |= sDifSegs[nLayer][i];
 1571|    880|    }
 1572|     80|    if (!( sBits & DIFV_OUTPUT_OMIT_F ) &&
  ------------------
  |  Branch (1572:9): [True: 80, False: 0]
  ------------------
 1573|     80|         sDifSegs[DIFL_FI][nFirstIsoSegm] == DIFV_BOTH_EMPTY)
  ------------------
  |  | 1519|     80|#define nFirstIsoSegm   DIFS_i_IATOMS
  ------------------
  |  Branch (1573:10): [True: 80, False: 0]
  ------------------
 1574|     80|    {
 1575|       |        /* Omit the F layer: no non-iotopic and no isotopic segments */
 1576|     80|        memset( sDifSegs[nLayer], DIFV_BOTH_EMPTY, DIFS_idf_LENGTH );
 1577|     80|    }
 1578|      0|    else
 1579|      0|    {    /* do not omit fixed-H layer */
 1580|      0|        if (sDifSegs[nLayer][nFirstSegm] == DIFV_BOTH_EMPTY ||
  ------------------
  |  Branch (1580:13): [True: 0, False: 0]
  ------------------
 1581|      0|             !( sDifSegs[nLayer][nFirstSegm] & DIFV_OUTPUT_OMIT_F ))
  ------------------
  |  Branch (1581:14): [True: 0, False: 0]
  ------------------
 1582|      0|        {
 1583|      0|            sDifSegs[nLayer][nFirstSegm] = DIFV_IS_EMPTY;
 1584|      0|        }
 1585|      0|    }
 1586|       |
 1587|       |    /* M -- leave as it is */
 1588|       |
 1589|     80|    return 0;
 1590|       |
 1591|     80|#undef nFirstFmlSegm
 1592|     80|#undef nFirstIsoSegm
 1593|     80|}
CompareInchiStereo:
 1601|  21.5k|{
 1602|  21.5k|    int i, num, ret;
 1603|  21.5k|    if (Stereo2 && Stereo1)
  ------------------
  |  Branch (1603:9): [True: 0, False: 21.5k]
  |  Branch (1603:20): [True: 0, False: 0]
  ------------------
 1604|      0|    {
 1605|       |        /*  compare stereogenic bonds */
 1606|      0|        num = inchi_min( Stereo2->nNumberOfStereoBonds, Stereo1->nNumberOfStereoBonds );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1607|      0|        for (i = 0; i < num; i++)
  ------------------
  |  Branch (1607:21): [True: 0, False: 0]
  ------------------
 1608|      0|        {
 1609|      0|            if (ret = (int) Stereo2->nBondAtom1[i] - (int) Stereo1->nBondAtom1[i])
  ------------------
  |  Branch (1609:17): [True: 0, False: 0]
  ------------------
 1610|      0|            {
 1611|      0|                return ret;
 1612|      0|            }
 1613|      0|            if (ret = (int) Stereo2->nBondAtom2[i] - (int) Stereo1->nBondAtom2[i])
  ------------------
  |  Branch (1613:17): [True: 0, False: 0]
  ------------------
 1614|      0|            {
 1615|      0|                return ret;
 1616|      0|            }
 1617|      0|            if (ret = (int) Stereo2->b_parity[i] - (int) Stereo1->b_parity[i])
  ------------------
  |  Branch (1617:17): [True: 0, False: 0]
  ------------------
 1618|      0|            {
 1619|      0|                return ret;
 1620|      0|            }
 1621|      0|        }
 1622|      0|        if (ret = (int) Stereo2->nNumberOfStereoBonds - (int) Stereo1->nNumberOfStereoBonds)
  ------------------
  |  Branch (1622:13): [True: 0, False: 0]
  ------------------
 1623|      0|        {
 1624|      0|            return ret;
 1625|      0|        }
 1626|       |
 1627|       |        /*  compare stereogenic atoms */
 1628|       |#if ( REL_RAC_STEREO_IGN_1_SC == 1 )
 1629|       |        if (( ( nFlags1 | nFlags2 ) & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ) &&
 1630|       |             1 == Stereo2->nNumberOfStereoCenters &&
 1631|       |             1 == Stereo1->nNumberOfStereoCenters)
 1632|       |        {
 1633|       |            ; /*  do not compare single stereocenters in case of relative stereo */
 1634|       |        }
 1635|       |        else
 1636|       |#endif
 1637|      0|        {
 1638|      0|            num = inchi_min( Stereo2->nNumberOfStereoCenters, Stereo1->nNumberOfStereoCenters );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1639|      0|            for (i = 0; i < num; i++)
  ------------------
  |  Branch (1639:25): [True: 0, False: 0]
  ------------------
 1640|      0|            {
 1641|      0|                if (ret = (int) Stereo2->nNumber[i] - (int) Stereo1->nNumber[i])
  ------------------
  |  Branch (1641:21): [True: 0, False: 0]
  ------------------
 1642|      0|                {
 1643|      0|                    return ret;
 1644|      0|                }
 1645|      0|                if (ret = (int) Stereo2->t_parity[i] - (int) Stereo1->t_parity[i])
  ------------------
  |  Branch (1645:21): [True: 0, False: 0]
  ------------------
 1646|      0|                {
 1647|      0|                    return ret;
 1648|      0|                }
 1649|      0|            }
 1650|      0|            if (ret = (int) Stereo2->nNumberOfStereoCenters - (int) Stereo1->nNumberOfStereoCenters)
  ------------------
  |  Branch (1650:17): [True: 0, False: 0]
  ------------------
 1651|      0|                return ret;
 1652|       |            /*  compare stereo-abs-is-inverted flags  for non-relative, non-racemic */
 1653|      0|            if (!( ( nFlags1 | nFlags2 ) & ( INCHI_FLAG_RAC_STEREO | INCHI_FLAG_REL_STEREO ) ))
  ------------------
  |  |  150|      0|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
                          if (!( ( nFlags1 | nFlags2 ) & ( INCHI_FLAG_RAC_STEREO | INCHI_FLAG_REL_STEREO ) ))
  ------------------
  |  |  149|      0|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
  |  Branch (1653:17): [True: 0, False: 0]
  ------------------
 1654|      0|            {
 1655|      0|                if (ret = ( Stereo2->nCompInv2Abs < 0 ) - ( Stereo1->nCompInv2Abs < 0 ))
  ------------------
  |  Branch (1655:21): [True: 0, False: 0]
  ------------------
 1656|      0|                {
 1657|      0|                    return ret;
 1658|      0|                }
 1659|      0|            }
 1660|      0|        }
 1661|      0|    }
 1662|  21.5k|    else
 1663|  21.5k|    {
 1664|  21.5k|        if (Stereo2 && ( Stereo2->nNumberOfStereoBonds > 0 || Stereo2->nNumberOfStereoCenters > 0
  ------------------
  |  Branch (1664:13): [True: 0, False: 21.5k]
  |  Branch (1664:26): [True: 0, False: 0]
  |  Branch (1664:63): [True: 0, False: 0]
  ------------------
 1665|       |#if ( REL_RAC_STEREO_IGN_1_SC == 1 )
 1666|       |                         && /*  do not compare single stereocenters in case of relative stereo */
 1667|       |                         !( ( nFlags2 & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ) &&
 1668|       |                            1 == Stereo2->nNumberOfStereoCenters
 1669|       |                            )
 1670|       |#endif
 1671|      0|                         ))
 1672|      0|        {
 1673|      0|            return 1;
 1674|      0|        }
 1675|  21.5k|        else
 1676|  21.5k|        {
 1677|  21.5k|            if (Stereo1 && ( Stereo1->nNumberOfStereoBonds > 0 || Stereo1->nNumberOfStereoCenters > 0
  ------------------
  |  Branch (1677:17): [True: 0, False: 21.5k]
  |  Branch (1677:30): [True: 0, False: 0]
  |  Branch (1677:67): [True: 0, False: 0]
  ------------------
 1678|       |#if ( REL_RAC_STEREO_IGN_1_SC == 1 )
 1679|       |                             && /*  do not compare single stereocenters in case of relative stereo */
 1680|       |                             !( ( nFlags1 & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ) &&
 1681|       |                                1 == Stereo1->nNumberOfStereoCenters
 1682|       |                                )
 1683|       |#endif
 1684|      0|                             ))
 1685|      0|            {
 1686|      0|                return -1;
 1687|      0|            }
 1688|  21.5k|        }
 1689|  21.5k|    }
 1690|       |
 1691|  21.5k|    return 0;
 1692|  21.5k|}
CompINChI2:
 1706|  23.0k|{
 1707|  23.0k|    int ret, num, i, num_H1, num_H2;
 1708|       |
 1709|  23.0k|    const INChI *i1 = NULL; /* tautomeric if exists, otherwise non-tautomeric */
 1710|  23.0k|    const INChI *i2 = NULL; /* tautomeric if exists, otherwise non-tautomeric */
 1711|       |
 1712|  23.0k|    int   n1;               /* TAUT_YES if tautomeric i1 exists, otherwise TAUT_NON */
 1713|  23.0k|    int   n2;               /* TAUT_YES if tautomeric i2 exists, otherwise TAUT_NON */
 1714|       |
 1715|  23.0k|    const INChI *i1n = NULL; /* non-tautomeric if both tautomeric AND non-tautomeric exist */
 1716|  23.0k|    const INChI *i2n = NULL; /* non-tautomeric if both tautomeric AND non-tautomeric exist */
 1717|       |
 1718|       |    /*const INChI *i1t = NULL;*/ /* temp for i1 if both tautomeric AND non-tautomeric exist */
 1719|       |    /*const INChI *i2t = NULL;*/ /* temp for i2 if both tautomeric AND non-tautomeric exist */
 1720|       |
 1721|       |    /* INChI_Stereo *Stereo1, *Stereo2; */
 1722|       |
 1723|  23.0k|    n1 = ( p1->pINChI[TAUT_YES] && p1->pINChI[TAUT_YES]->nNumberOfAtoms ) ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  580|  23.0k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  n1 = ( p1->pINChI[TAUT_YES] && p1->pINChI[TAUT_YES]->nNumberOfAtoms ) ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  580|  23.0k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  n1 = ( p1->pINChI[TAUT_YES] && p1->pINChI[TAUT_YES]->nNumberOfAtoms ) ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  580|  23.0k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  n1 = ( p1->pINChI[TAUT_YES] && p1->pINChI[TAUT_YES]->nNumberOfAtoms ) ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  579|  23.0k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1723:12): [True: 23.0k, False: 0]
  |  Branch (1723:36): [True: 23.0k, False: 0]
  ------------------
 1724|  23.0k|    n2 = ( p2->pINChI[TAUT_YES] && p2->pINChI[TAUT_YES]->nNumberOfAtoms ) ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  580|  23.0k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  n2 = ( p2->pINChI[TAUT_YES] && p2->pINChI[TAUT_YES]->nNumberOfAtoms ) ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  580|  23.0k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  n2 = ( p2->pINChI[TAUT_YES] && p2->pINChI[TAUT_YES]->nNumberOfAtoms ) ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  580|  23.0k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  n2 = ( p2->pINChI[TAUT_YES] && p2->pINChI[TAUT_YES]->nNumberOfAtoms ) ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  579|  23.0k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1724:12): [True: 23.0k, False: 0]
  |  Branch (1724:36): [True: 23.0k, False: 0]
  ------------------
 1725|       |
 1726|  23.0k|    i1 = p1->pINChI[n1];
 1727|  23.0k|    i1n = ( n1 == TAUT_YES && p1->pINChI[TAUT_NON] &&
  ------------------
  |  |  580|  46.1k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  i1n = ( n1 == TAUT_YES && p1->pINChI[TAUT_NON] &&
  ------------------
  |  |  579|  23.0k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1727:13): [True: 23.0k, False: 0]
  |  Branch (1727:31): [True: 0, False: 23.0k]
  ------------------
 1728|  23.0k|           p1->pINChI[TAUT_NON]->nNumberOfAtoms ) ? p1->pINChI[TAUT_NON] : (const INChI *) NULL;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                         p1->pINChI[TAUT_NON]->nNumberOfAtoms ) ? p1->pINChI[TAUT_NON] : (const INChI *) NULL;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1728:12): [True: 0, False: 0]
  ------------------
 1729|       |
 1730|  23.0k|    i2 = p2->pINChI[n2];
 1731|  23.0k|    i2n = ( n2 == TAUT_YES && p2->pINChI[TAUT_NON] &&
  ------------------
  |  |  580|  46.1k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  i2n = ( n2 == TAUT_YES && p2->pINChI[TAUT_NON] &&
  ------------------
  |  |  579|  23.0k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1731:13): [True: 23.0k, False: 0]
  |  Branch (1731:31): [True: 0, False: 23.0k]
  ------------------
 1732|  23.0k|          p2->pINChI[TAUT_NON]->nNumberOfAtoms ) ? p2->pINChI[TAUT_NON] : (const INChI *) NULL;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                        p2->pINChI[TAUT_NON]->nNumberOfAtoms ) ? p2->pINChI[TAUT_NON] : (const INChI *) NULL;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1732:11): [True: 0, False: 0]
  ------------------
 1733|       |
 1734|       |    /* non-deleted-non-empty < deleted < empty */
 1735|  23.0k|    if (i1 && !i2)
  ------------------
  |  Branch (1735:9): [True: 23.0k, False: 0]
  |  Branch (1735:15): [True: 0, False: 23.0k]
  ------------------
 1736|      0|        return -1;   /* non-empty is the smallest (first) */
 1737|  23.0k|    if (!i1 && i2)
  ------------------
  |  Branch (1737:9): [True: 0, False: 23.0k]
  |  Branch (1737:16): [True: 0, False: 0]
  ------------------
 1738|      0|        return 1;
 1739|  23.0k|    if (!i1 && !i2)
  ------------------
  |  Branch (1739:9): [True: 0, False: 23.0k]
  |  Branch (1739:16): [True: 0, False: 0]
  ------------------
 1740|      0|        return 0;
 1741|  23.0k|    if (i1->bDeleted && !i2->bDeleted)
  ------------------
  |  Branch (1741:9): [True: 0, False: 23.0k]
  |  Branch (1741:25): [True: 0, False: 0]
  ------------------
 1742|      0|        return 1;    /* deleted is the largest (last) among non-empty */
 1743|  23.0k|    if (!i1->bDeleted && i2->bDeleted)
  ------------------
  |  Branch (1743:9): [True: 23.0k, False: 0]
  |  Branch (1743:26): [True: 0, False: 23.0k]
  ------------------
 1744|      0|        return -1;
 1745|       |
 1746|  23.0k|    num_H1 = num_H2 = 0;
 1747|       |
 1748|       |    /* do not compare terminal H */
 1749|  23.0k|    if (ret = CompareHillFormulasNoH( i1->szHillFormula, i2->szHillFormula, &num_H1, &num_H2 ))
  ------------------
  |  Branch (1749:9): [True: 12.3k, False: 10.7k]
  ------------------
 1750|  12.3k|    {
 1751|  12.3k|        return ret;  /* lexicographic order except the shorter one is greater (last): CH2O < CH2; C3XX < C2XX */
 1752|  12.3k|    }
 1753|       |
 1754|       |    /*********************************************************
 1755|       |            compare non-isotopic non-tautomeric part
 1756|       |     *********************************************************/
 1757|       |
 1758|       |    /* compare number of atoms (excluding terminal H) */
 1759|  10.7k|    if (ret = i2->nNumberOfAtoms - i1->nNumberOfAtoms)
  ------------------
  |  Branch (1759:9): [True: 0, False: 10.7k]
  ------------------
 1760|      0|        return ret; /*  more atoms first */
 1761|       |
 1762|       |    /*  compare elements  (excluding terminal H) */
 1763|  10.7k|    num = i1->nNumberOfAtoms;
 1764|  33.4k|    for (i = 0; i < num; i++)
  ------------------
  |  Branch (1764:17): [True: 22.6k, False: 10.7k]
  ------------------
 1765|  22.6k|    {
 1766|       |        /* should always be equal if Hill formulas are same */
 1767|  22.6k|        if (ret = (int) i2->nAtom[i] - (int) i1->nAtom[i])
  ------------------
  |  Branch (1767:13): [True: 0, False: 22.6k]
  ------------------
 1768|      0|            return ret; /* greater periodic number first */
 1769|  22.6k|    }
 1770|       |
 1771|       |    /**********************************************************
 1772|       |        compare connection tables
 1773|       |    ***********************************************************/
 1774|  10.7k|    if (ret = i2->lenConnTable - i1->lenConnTable)
  ------------------
  |  Branch (1774:9): [True: 0, False: 10.7k]
  ------------------
 1775|      0|        return ret; /* longer connection table first */
 1776|  10.7k|    num = i2->lenConnTable;
 1777|  21.5k|    for (i = 0; i < num; i++)
  ------------------
  |  Branch (1777:17): [True: 10.7k, False: 10.7k]
  ------------------
 1778|  10.7k|    {
 1779|  10.7k|        if (ret = (int) i2->nConnTable[i] - (int) i1->nConnTable[i])
  ------------------
  |  Branch (1779:13): [True: 0, False: 10.7k]
  ------------------
 1780|      0|            return ret; /* greater connection table first */
 1781|  10.7k|    }
 1782|       |
 1783|       |    /*********************************************************
 1784|       |      compare compare total number of H (inverse: H3 < H2 )
 1785|       |    **********************************************************/
 1786|  10.7k|    if (ret = num_H2 - num_H1)
  ------------------
  |  Branch (1786:9): [True: 0, False: 10.7k]
  ------------------
 1787|      0|    {
 1788|      0|        return ret;
 1789|      0|    }
 1790|       |
 1791|       |    /*********************************************************
 1792|       |      compare non-tautomeric num_H: N < NH3 < NH2 < NH
 1793|       |    **********************************************************/
 1794|  10.7k|    num = i1->nNumberOfAtoms;
 1795|  33.4k|    for (i = 0; i < num; i++)
  ------------------
  |  Branch (1795:17): [True: 22.6k, False: 10.7k]
  ------------------
 1796|  22.6k|    {
 1797|  22.6k|        if (i2->nNum_H[i] != i1->nNum_H[i])
  ------------------
  |  Branch (1797:13): [True: 0, False: 22.6k]
  ------------------
 1798|      0|        {
 1799|      0|            return !i2->nNum_H[i] ? 1 :  /* no H first */
  ------------------
  |  Branch (1799:20): [True: 0, False: 0]
  ------------------
 1800|      0|                !i1->nNum_H[i] ? -1 :
  ------------------
  |  Branch (1800:17): [True: 0, False: 0]
  ------------------
 1801|      0|                (int) i2->nNum_H[i] - (int) i1->nNum_H[i];
 1802|      0|        }
 1803|  22.6k|    }
 1804|       |
 1805|       |    /*********************************************************
 1806|       |         compare non-isotopic tautomeric part
 1807|       |     *********************************************************/
 1808|  10.7k|    if (ret = CompareTautNonIsoPartOfINChI( i1, i2 ))
  ------------------
  |  Branch (1808:9): [True: 0, False: 10.7k]
  ------------------
 1809|      0|    {
 1810|      0|        return ret;
 1811|      0|    }
 1812|       |    /*
 1813|       |    if ( ret = i2->lenTautomer - i1->lenTautomer )
 1814|       |        return ret;
 1815|       |    num = inchi_min( i2->lenTautomer, i1->lenTautomer );
 1816|       |    for ( i = 0; i < num; i ++ ) {
 1817|       |        if ( ret = (int)i2->nTautomer[i] - (int)i1->nTautomer[i] )
 1818|       |           return ret;
 1819|       |    }
 1820|       |    */
 1821|       |
 1822|       |    /*********************************************************
 1823|       |     *                                                       *
 1824|       |     *  at this point both components are either tautomeric  *
 1825|       |     *  or non-tautomeric                                    *
 1826|       |     *                                                       *
 1827|       |     *********************************************************/
 1828|       |
 1829|       |    /*********************************************************
 1830|       |       non-tautomeric "fixed H" specific
 1831|       |     *********************************************************/
 1832|  10.7k|    if (TAUT_NON == bTaut && ( i1n && i1n->nNum_H_fixed || i2n && i2n->nNum_H_fixed ))
  ------------------
  |  |  579|  10.7k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1832:9): [True: 5.39k, False: 5.39k]
  |  Branch (1832:32): [True: 0, False: 5.39k]
  |  Branch (1832:39): [True: 0, False: 0]
  |  Branch (1832:60): [True: 0, False: 5.39k]
  |  Branch (1832:67): [True: 0, False: 0]
  ------------------
 1833|      0|    {
 1834|       |        /* first, compare non-tautomeric chem. formulas -- they may be different */
 1835|      0|        const char *f1 = ( i1n /*&& i1n->nNum_H_fixed*/ ) ? i1n->szHillFormula : i1->szHillFormula;
  ------------------
  |  Branch (1835:26): [True: 0, False: 0]
  ------------------
 1836|      0|        const char *f2 = ( i2n /*&& i2n->nNum_H_fixed*/ ) ? i2n->szHillFormula : i2->szHillFormula;
  ------------------
  |  Branch (1836:26): [True: 0, False: 0]
  ------------------
 1837|      0|        if (f1 && f2 && ( ret = CompareHillFormulas( f1, f2 ) ))
  ------------------
  |  Branch (1837:13): [True: 0, False: 0]
  |  Branch (1837:19): [True: 0, False: 0]
  |  Branch (1837:25): [True: 0, False: 0]
  ------------------
 1838|      0|        {
 1839|      0|            return ret;
 1840|      0|        }
 1841|       |        /* secondly, compare fixed-H distribution */
 1842|      0|        if (i1n && i1n->nNum_H_fixed && i2n && i2n->nNum_H_fixed)
  ------------------
  |  Branch (1842:13): [True: 0, False: 0]
  |  Branch (1842:20): [True: 0, False: 0]
  |  Branch (1842:41): [True: 0, False: 0]
  |  Branch (1842:48): [True: 0, False: 0]
  ------------------
 1843|      0|        {
 1844|      0|            num = inchi_min( i1n->nNumberOfAtoms, i2n->nNumberOfAtoms );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1845|      0|            for (i = 0; i < num; i++)
  ------------------
  |  Branch (1845:25): [True: 0, False: 0]
  ------------------
 1846|      0|            {
 1847|      0|                if (i2n->nNum_H_fixed[i] != i1n->nNum_H_fixed[i])
  ------------------
  |  Branch (1847:21): [True: 0, False: 0]
  ------------------
 1848|      0|                {
 1849|      0|                    return !i2n->nNum_H_fixed[i] ? 1 : /* no fixed H first */
  ------------------
  |  Branch (1849:28): [True: 0, False: 0]
  ------------------
 1850|      0|                        !i1n->nNum_H_fixed[i] ? -1 :
  ------------------
  |  Branch (1850:25): [True: 0, False: 0]
  ------------------
 1851|      0|                        (int) i2n->nNum_H_fixed[i] - (int) i1n->nNum_H_fixed[i];
 1852|      0|                }
 1853|      0|            }
 1854|      0|            if (ret = (int) i2n->nNumberOfAtoms - (int) i1n->nNumberOfAtoms)
  ------------------
  |  Branch (1854:17): [True: 0, False: 0]
  ------------------
 1855|      0|            {
 1856|      0|                return ret; /* should not happen <BRKPT> */
 1857|      0|            }
 1858|      0|        }
 1859|      0|        else
 1860|      0|        {
 1861|      0|            if (i1n && i1n->nNum_H_fixed)
  ------------------
  |  Branch (1861:17): [True: 0, False: 0]
  |  Branch (1861:24): [True: 0, False: 0]
  ------------------
 1862|      0|            {
 1863|      0|                num = i1n->nNumberOfAtoms;
 1864|      0|                for (i = 0; i < num; i++)
  ------------------
  |  Branch (1864:29): [True: 0, False: 0]
  ------------------
 1865|      0|                {
 1866|       |                    /* added 2004-05-04 */
 1867|      0|                    if (i1n->nNum_H_fixed[i])
  ------------------
  |  Branch (1867:25): [True: 0, False: 0]
  ------------------
 1868|      0|                    {
 1869|      0|                        return -1; /* i1n->nNum_H_fixed[i] > 0? -1:1;*/
 1870|      0|                    }
 1871|      0|                }
 1872|       |                /* p1 is tautomeric, p2 is not tautomeric; this must have been detected earlier */
 1873|       |                /*return -1;*/ /* has fixed H first *//* <BRKPT> */ /* removed 2004-05-04 */
 1874|      0|            }
 1875|      0|            else
 1876|      0|            {
 1877|      0|                num = i2n->nNumberOfAtoms;
 1878|      0|                for (i = 0; i < num; i++)
  ------------------
  |  Branch (1878:29): [True: 0, False: 0]
  ------------------
 1879|      0|                {
 1880|       |                    /* added 2004-05-04 */
 1881|      0|                    if (i2n->nNum_H_fixed[i])
  ------------------
  |  Branch (1881:25): [True: 0, False: 0]
  ------------------
 1882|      0|                    {
 1883|      0|                        return 1; /* i2n->nNum_H_fixed[i] > 0? 1:-1;*/
 1884|      0|                    }
 1885|      0|                }
 1886|       |                /* p2 is tautomeric, p1 is not tautomeric; this must have been detected earlier */
 1887|       |                /*return 1; */ /* has fixed H first *//* <BRKPT> */ /* removed 2004-05-04 */
 1888|      0|            }
 1889|      0|        }
 1890|      0|    }
 1891|       |
 1892|       |    /*************************************************************************
 1893|       |              if requested non-tautomeric comparison then
 1894|       |              prepare to compare non-taut non-isotopic stereo, etc.
 1895|       |     *************************************************************************/
 1896|  10.7k|    if (TAUT_NON == bTaut)
  ------------------
  |  |  579|  10.7k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1896:9): [True: 5.39k, False: 5.39k]
  ------------------
 1897|  5.39k|    {
 1898|  5.39k|        if (i1n)
  ------------------
  |  Branch (1898:13): [True: 0, False: 5.39k]
  ------------------
 1899|      0|        {
 1900|       |            /*i1t = i1;*/
 1901|      0|            i1 = i1n;
 1902|      0|        }
 1903|  5.39k|        if (i2n)
  ------------------
  |  Branch (1903:13): [True: 0, False: 5.39k]
  ------------------
 1904|      0|        {
 1905|       |            /*i2t = i2;*/
 1906|      0|            i2 = i2n;
 1907|      0|        }
 1908|  5.39k|    }
 1909|       |
 1910|       |    /*********************************************************
 1911|       |        compare non-isotopic stereo
 1912|       |     *********************************************************/
 1913|  10.7k|    ret = CompareInchiStereo( i1->Stereo, i1->nFlags, i2->Stereo, i2->nFlags );
 1914|  10.7k|    if (ret)
  ------------------
  |  Branch (1914:9): [True: 0, False: 10.7k]
  ------------------
 1915|      0|    {
 1916|      0|        return ret;
 1917|      0|    }
 1918|       |    /*******************************************************
 1919|       |        do not switch back to tautomeric i1, i2
 1920|       |     *******************************************************/
 1921|       |    /* -- how to switch back --
 1922|       |    if ( i1t ) {
 1923|       |        i1  = i1t;
 1924|       |        i1t = NULL;
 1925|       |    }
 1926|       |    if ( i2t ) {
 1927|       |        i2  = i2t;
 1928|       |        i2t = NULL;
 1929|       |    }
 1930|       |    */
 1931|       |
 1932|       |    /******************************************************
 1933|       |         compare isotopic non-tautomeric part
 1934|       |     ******************************************************/
 1935|  10.7k|    if (bCompareIsotopic)
  ------------------
  |  Branch (1935:9): [True: 10.7k, False: 0]
  ------------------
 1936|  10.7k|    {
 1937|  10.7k|        if (ret = i2->nNumberOfIsotopicAtoms - i1->nNumberOfIsotopicAtoms)
  ------------------
  |  Branch (1937:13): [True: 0, False: 10.7k]
  ------------------
 1938|      0|        {
 1939|      0|            return ret;
 1940|      0|        }
 1941|  10.7k|        num = i1->nNumberOfIsotopicAtoms;
 1942|       |        /*  compare isotopic atoms */
 1943|  10.7k|        for (i = 0; i < num; i++)
  ------------------
  |  Branch (1943:21): [True: 0, False: 10.7k]
  ------------------
 1944|      0|        {
 1945|      0|            if (ret = (int) i2->IsotopicAtom[i].nAtomNumber - (int) i1->IsotopicAtom[i].nAtomNumber)
  ------------------
  |  Branch (1945:17): [True: 0, False: 0]
  ------------------
 1946|      0|            {
 1947|      0|                return ret;
 1948|      0|            }
 1949|      0|            if (ret = (int) i2->IsotopicAtom[i].nIsoDifference - (int) i1->IsotopicAtom[i].nIsoDifference)
  ------------------
  |  Branch (1949:17): [True: 0, False: 0]
  ------------------
 1950|      0|            {
 1951|      0|                return ret;
 1952|      0|            }
 1953|      0|        }
 1954|       |
 1955|       |        /* compare isotopic H */
 1956|       |        /* if tautomeric comparison mode then here are compared only non-tautomeric H */
 1957|  10.7k|        for (i = 0; i < num; i++)
  ------------------
  |  Branch (1957:21): [True: 0, False: 10.7k]
  ------------------
 1958|      0|        {
 1959|      0|            if (ret = (int) i2->IsotopicAtom[i].nNum_T - (int) i1->IsotopicAtom[i].nNum_T)
  ------------------
  |  Branch (1959:17): [True: 0, False: 0]
  ------------------
 1960|      0|            {
 1961|      0|                return ret;
 1962|      0|            }
 1963|      0|            if (ret = (int) i2->IsotopicAtom[i].nNum_D - (int) i1->IsotopicAtom[i].nNum_D)
  ------------------
  |  Branch (1963:17): [True: 0, False: 0]
  ------------------
 1964|      0|            {
 1965|      0|                return ret;
 1966|      0|            }
 1967|      0|            if (ret = (int) i2->IsotopicAtom[i].nNum_H - (int) i1->IsotopicAtom[i].nNum_H)
  ------------------
  |  Branch (1967:17): [True: 0, False: 0]
  ------------------
 1968|      0|            {
 1969|      0|                return ret;
 1970|      0|            }
 1971|      0|        }
 1972|       |
 1973|       |        /*****************************************************
 1974|       |             compare isotopic tautomeric part
 1975|       |         *****************************************************/
 1976|  10.7k|        if (ret = i2->nNumberOfIsotopicTGroups - i1->nNumberOfIsotopicTGroups)
  ------------------
  |  Branch (1976:13): [True: 0, False: 10.7k]
  ------------------
 1977|      0|            return ret;
 1978|  10.7k|        num = i1->nNumberOfIsotopicTGroups;
 1979|  10.7k|        for (i = 0; i < num; i++)
  ------------------
  |  Branch (1979:21): [True: 0, False: 10.7k]
  ------------------
 1980|      0|        {
 1981|      0|            if (ret = (int) i2->IsotopicTGroup[i].nTGroupNumber - (int) i1->IsotopicTGroup[i].nTGroupNumber)
  ------------------
  |  Branch (1981:17): [True: 0, False: 0]
  ------------------
 1982|      0|            {
 1983|      0|                return ret;
 1984|      0|            }
 1985|      0|            if (ret = (int) i2->IsotopicTGroup[i].nNum_T - (int) i1->IsotopicTGroup[i].nNum_T)
  ------------------
  |  Branch (1985:17): [True: 0, False: 0]
  ------------------
 1986|      0|            {
 1987|      0|                return ret;
 1988|      0|            }
 1989|      0|            if (ret = (int) i2->IsotopicTGroup[i].nNum_D - (int) i1->IsotopicTGroup[i].nNum_D)
  ------------------
  |  Branch (1989:17): [True: 0, False: 0]
  ------------------
 1990|      0|            {
 1991|      0|                return ret;
 1992|      0|            }
 1993|      0|            if (ret = (int) i2->IsotopicTGroup[i].nNum_H - (int) i1->IsotopicTGroup[i].nNum_H)
  ------------------
  |  Branch (1993:17): [True: 0, False: 0]
  ------------------
 1994|      0|            {
 1995|      0|                return ret;
 1996|      0|            }
 1997|      0|        }
 1998|       |
 1999|       |        /****************************************************
 2000|       |            compare isotopic stereo
 2001|       |         ****************************************************/
 2002|  10.7k|        ret = CompareInchiStereo( i1->StereoIsotopic, i1->nFlags, i2->StereoIsotopic, i2->nFlags );
 2003|  10.7k|        if (ret)
  ------------------
  |  Branch (2003:13): [True: 0, False: 10.7k]
  ------------------
 2004|      0|        {
 2005|      0|            return ret;
 2006|      0|        }
 2007|  10.7k|    }
 2008|       |
 2009|       |    /**********************************************************
 2010|       |        compare charges: non-charged first, then in order of
 2011|       |        ascending charges (negative first)
 2012|       |    ***********************************************************/
 2013|  10.7k|    if (i2->nTotalCharge && i1->nTotalCharge)
  ------------------
  |  Branch (2013:9): [True: 0, False: 10.7k]
  |  Branch (2013:29): [True: 0, False: 0]
  ------------------
 2014|      0|    {
 2015|       |        /*  both are charged; smaller charges first */
 2016|      0|        ret = (int) i1->nTotalCharge - (int) i2->nTotalCharge;
 2017|      0|        return ret;
 2018|      0|    }
 2019|  10.7k|    if (ret = ( i1->nTotalCharge ? 1 : 0 ) - ( i2->nTotalCharge ? 1 : 0 ))
  ------------------
  |  Branch (2019:9): [True: 0, False: 10.7k]
  |  Branch (2019:17): [True: 0, False: 10.7k]
  |  Branch (2019:48): [True: 0, False: 10.7k]
  ------------------
 2020|      0|    {
 2021|       |        /*  only one is charged; uncharged first */
 2022|      0|        return ret;
 2023|      0|    }
 2024|       |    /* stable sort */
 2025|       |    /*ret = p1->ord_number - p2->ord_number;*/
 2026|       |
 2027|  10.7k|    return ret;
 2028|  10.7k|}
CompINChINonTaut2:
 2033|  8.84k|{
 2034|  8.84k|    int ret;
 2035|  8.84k|    ret = CompINChI2( (const INCHI_SORT *) p1, (const INCHI_SORT *) p2, TAUT_NON, 1 );
  ------------------
  |  |  579|  8.84k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 2036|  8.84k|#if ( CANON_FIXH_TRANS == 1 )
 2037|  8.84k|    if (!ret)
  ------------------
  |  Branch (2037:9): [True: 2.69k, False: 6.15k]
  ------------------
 2038|  2.69k|    {
 2039|       |        /* to obtain canonical transposition 2004-05-10 */
 2040|  2.69k|        ret = CompINChI2( (const INCHI_SORT *) p1, (const INCHI_SORT *) p2, TAUT_YES, 1 );
  ------------------
  |  |  580|  2.69k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2041|  2.69k|    }
 2042|  8.84k|#endif
 2043|  8.84k|    if (!ret)
  ------------------
  |  Branch (2043:9): [True: 2.69k, False: 6.15k]
  ------------------
 2044|  2.69k|    {
 2045|       |        /* stable sort */
 2046|  2.69k|        ret = ( (const INCHI_SORT *) p1 )->ord_number - ( (const INCHI_SORT *) p2 )->ord_number;
 2047|  2.69k|    }
 2048|       |
 2049|  8.84k|    return ret;
 2050|  8.84k|}
CompINChITaut2:
 2055|  8.84k|{
 2056|  8.84k|    int ret;
 2057|  8.84k|    ret = CompINChI2( (const INCHI_SORT *) p1, (const INCHI_SORT *) p2, TAUT_YES, 1 );
  ------------------
  |  |  580|  8.84k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2058|  8.84k|#if ( CANON_FIXH_TRANS == 1 )
 2059|  8.84k|    if (!ret)
  ------------------
  |  Branch (2059:9): [True: 2.69k, False: 6.15k]
  ------------------
 2060|  2.69k|    {
 2061|       |        /* to obtain canonical transposition 2004-05-10 */
 2062|  2.69k|        ret = CompINChI2( (const INCHI_SORT *) p1, (const INCHI_SORT *) p2, TAUT_NON, 1 );
  ------------------
  |  |  579|  2.69k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 2063|  2.69k|    }
 2064|  8.84k|#endif
 2065|  8.84k|    if (!ret)
  ------------------
  |  Branch (2065:9): [True: 2.69k, False: 6.15k]
  ------------------
 2066|  2.69k|    {
 2067|       |        /* stable sort */
 2068|  2.69k|        ret = ( (const INCHI_SORT *) p1 )->ord_number - ( (const INCHI_SORT *) p2 )->ord_number;
 2069|  2.69k|    }
 2070|       |
 2071|  8.84k|    return ret;
 2072|  8.84k|}
mystrrev:
 2081|  66.8k|{
 2082|  66.8k|    char c, *q = p;
 2083|   152k|    while (*q++)
  ------------------
  |  Branch (2083:12): [True: 85.2k, False: 66.8k]
  ------------------
 2084|  85.2k|    {
 2085|  85.2k|        ;
 2086|  85.2k|    }
 2087|  66.8k|    q -= 2; /*  pointer to the last character */
 2088|  79.9k|    while (p < q)
  ------------------
  |  Branch (2088:12): [True: 13.0k, False: 66.8k]
  ------------------
 2089|  13.0k|    {
 2090|  13.0k|        c = *q;  /*  swap */
 2091|  13.0k|        *q-- = *p;
 2092|  13.0k|        *p++ = c;
 2093|  13.0k|    }
 2094|  66.8k|}
GetDfsOrder4CT:
 2150|      3|{
 2151|      3|    AT_NUMB    *nStackAtom = NULL;
 2152|      3|    int         nTopStackAtom = -1;
 2153|      3|    AT_NUMB    *nNumDescendants = NULL; /*  number of descendants incl. closures and the atom itself */
 2154|      3|    AT_NUMB    *nDfsNumber = NULL;
 2155|      3|    S_CHAR     *cNeighNumb = NULL;
 2156|      3|    NEIGH_LIST *nl = NULL;
 2157|      3|    AT_NUMB     nDfs;
 2158|      3|    int         i, j, u, k, start, num_rings, nTotOutputStringLen;
 2159|      3|    AT_NUMB    *nOutputString = NULL, cDelim;
 2160|      3|    int         bCtPredecessors = ( nCtMode & CT_MODE_PREDECESSORS );
  ------------------
  |  |   56|      3|#define CT_MODE_PREDECESSORS      8
  ------------------
 2161|      3|    OrderStruct os;
 2162|       |
 2163|       |    /*  allocate arrays */
 2164|      3|    nStackAtom = (AT_NUMB *) inchi_malloc( num_atoms * sizeof( nStackAtom[0] ) );
  ------------------
  |  | 1130|      3|#define inchi_malloc   malloc
  ------------------
 2165|      3|    nNumDescendants = (AT_NUMB *) inchi_malloc( num_atoms * sizeof( nNumDescendants[0] ) );
  ------------------
  |  | 1130|      3|#define inchi_malloc   malloc
  ------------------
 2166|      3|    nDfsNumber = (AT_NUMB *) inchi_malloc( num_atoms * sizeof( nDfsNumber[0] ) );
  ------------------
  |  | 1130|      3|#define inchi_malloc   malloc
  ------------------
 2167|      3|    cNeighNumb = (S_CHAR  *) inchi_malloc( num_atoms * sizeof( cNeighNumb[0] ) );
  ------------------
  |  | 1130|      3|#define inchi_malloc   malloc
  ------------------
 2168|      3|    nl = CreateNeighListFromLinearCT( LinearCT, nLenCT, num_atoms );
 2169|       |
 2170|       |    /*  check allocation */
 2171|      3|    if (!nStackAtom || !nNumDescendants || !nDfsNumber || !cNeighNumb || !nl)
  ------------------
  |  Branch (2171:9): [True: 0, False: 3]
  |  Branch (2171:24): [True: 0, False: 3]
  |  Branch (2171:44): [True: 0, False: 3]
  |  Branch (2171:59): [True: 0, False: 3]
  |  Branch (2171:74): [True: 0, False: 3]
  ------------------
 2172|      0|    {
 2173|       |        /* ret = CT_OUT_OF_RAM; */ /*  program error */ /*   <BRKPT> */
 2174|      0|        goto exit_function;
 2175|      0|    }
 2176|      3|    if (bCtPredecessors)
  ------------------
  |  Branch (2176:9): [True: 0, False: 3]
  ------------------
 2177|      0|    {
 2178|      0|        start = 0;
 2179|      0|    }
 2180|      3|    else
 2181|      3|    {
 2182|       |        /*  find DFS start vertex (atom) */
 2183|     15|        for (i = 1, start = 0; i < num_atoms; i++)
  ------------------
  |  Branch (2183:32): [True: 12, False: 3]
  ------------------
 2184|     12|        {
 2185|     12|            if (nl[i][0] < nl[start][0])
  ------------------
  |  Branch (2185:17): [True: 3, False: 9]
  ------------------
 2186|      3|            { /*  index = nRank-1 */
 2187|      3|                start = i;
 2188|      3|            }
 2189|     12|        }
 2190|      3|    }
 2191|       |
 2192|       |    /*
 2193|       |      vertex information:
 2194|       |        1. Number of (forward edges) + (back edges, first visit -- ring closures): nl[i][0]
 2195|       |        2. Number of vertices traversed from this vertex, including the vertex:    nNumDescendants[i]
 2196|       |        3. Each edge information:
 2197|       |           a. forward edge (0) or back edge (1) indicator: nDfsNumber[i] > nDfsNumber[neigh]
 2198|       |           b. neighbor at another end of the edge neigh = nl[i][k+1], k < i
 2199|       |
 2200|       |        Total per edge: 2 + 2*(number of edges)
 2201|       |    */
 2202|       |
 2203|       |    /* DFS initiation */
 2204|      3|    u = start; /* start atom */
 2205|      3|    nDfs = 0;
 2206|      3|    nTopStackAtom = -1;
 2207|      3|    memset( nDfsNumber, 0, num_atoms * sizeof( nDfsNumber[0] ) );
 2208|      3|    memset( nNumDescendants, 0, num_atoms * sizeof( nNumDescendants[0] ) );
 2209|      3|    memset( cNeighNumb, 0, num_atoms * sizeof( cNeighNumb[0] ) );
 2210|       |    /*  push the start atom on the stack */
 2211|      3|    nDfsNumber[u] = ++nDfs;
 2212|      3|    if (bCtPredecessors)
  ------------------
  |  Branch (2212:9): [True: 0, False: 3]
  ------------------
 2213|      0|    {
 2214|      0|        nNumDescendants[u] = 0; /* atom #1 has no predecessor */
 2215|      0|    }
 2216|      3|    else
 2217|      3|    {
 2218|      3|        nNumDescendants[u] = 1; /* count itself as a descendant */
 2219|      3|    }
 2220|      3|    nStackAtom[++nTopStackAtom] = (AT_NUMB) u;
 2221|       |    /* nNumStartChildren = 0; */
 2222|      3|    num_rings = 0;
 2223|       |
 2224|       |    /* DFS */
 2225|      3|    do
 2226|     15|    {
 2227|       |        /* advance */
 2228|     39|        while (i = (int) nStackAtom[nTopStackAtom], j = (int) cNeighNumb[i] + 1, (int) nl[i][0] >= j)
  ------------------
  |  Branch (2228:16): [True: 24, False: 15]
  ------------------
 2229|       |            /*while ( (int)nl[i=nStackAtom[nTopStackAtom]][0] >= (j = (int)cNeighNumb[i]+1) )*/
 2230|       |
 2231|       |            /* replaced due to missing sequence point; undefined behavior, pointed by Geoffrey Hutchison */
 2232|     24|        {
 2233|     24|            cNeighNumb[i] ++;
 2234|     24|            u = (int) nl[i][j]; /*  jth neighbor of the vertex i */
 2235|     24|            if (!nDfsNumber[u])
  ------------------
  |  Branch (2235:17): [True: 12, False: 12]
  ------------------
 2236|     12|            {
 2237|       |                /* tree edge, 1st visit -- advance */
 2238|       |                /* put unexplored vertex u on the stack for further examination */
 2239|     12|                nStackAtom[++nTopStackAtom] = (AT_NUMB) u;
 2240|     12|                nDfsNumber[u] = ++nDfs;
 2241|     12|                if (bCtPredecessors)
  ------------------
  |  Branch (2241:21): [True: 0, False: 12]
  ------------------
 2242|      0|                {
 2243|      0|                    nNumDescendants[u] = i + 1; /* predecessor's rank */
 2244|      0|                }
 2245|     12|                else
 2246|     12|                {
 2247|     12|                    nNumDescendants[u] ++; /* count atom u as its descendant */
 2248|     12|                }
 2249|     12|            }
 2250|     12|            else
 2251|     12|            {
 2252|     12|                if (nTopStackAtom && u != (int) nStackAtom[nTopStackAtom - 1] &&
  ------------------
  |  Branch (2252:21): [True: 12, False: 0]
  |  Branch (2252:38): [True: 0, False: 12]
  ------------------
 2253|       |                    /* back edge: u is not a predecessor of i */
 2254|     12|                    nDfsNumber[u] < nDfsNumber[i])
  ------------------
  |  Branch (2254:21): [True: 0, False: 0]
  ------------------
 2255|      0|                {
 2256|       |                    /* Back edge, 1st visit: u is an ancestor of i (ring closure) */
 2257|      0|                    if (!bCtPredecessors)
  ------------------
  |  Branch (2257:25): [True: 0, False: 0]
  ------------------
 2258|      0|                    {
 2259|      0|                        nNumDescendants[i] ++; /* count closures as descendants */
 2260|      0|                    }
 2261|      0|                    num_rings++;          /* count ring closures */
 2262|      0|                }
 2263|     12|                else
 2264|     12|                {
 2265|     12|                    nl[i][j] = MAX_ATOMS + 1; /* back edge, 2nd visit: mark as deleted */
  ------------------
  |  |   43|     12|#define MAX_ATOMS  32766
  ------------------
 2266|     12|                }
 2267|     12|            }
 2268|     24|        }
 2269|     15|        cNeighNumb[i] = 0; /* all neighbors of the ith atom have been
 2270|       |                              traversed; resore the neighbor counter */
 2271|       |                              /* back up */
 2272|     15|        if (!bCtPredecessors && nTopStackAtom /* that is, i != start */)
  ------------------
  |  Branch (2272:13): [True: 15, False: 0]
  |  Branch (2272:33): [True: 12, False: 3]
  ------------------
 2273|     12|        {
 2274|     12|            u = (int) nStackAtom[nTopStackAtom - 1]; /* predecessor of i */
 2275|     12|            nNumDescendants[u] += nNumDescendants[i]; /* add descendants */
 2276|     12|        }
 2277|     15|    } while (--nTopStackAtom >= 0);
  ------------------
  |  Branch (2277:14): [True: 12, False: 3]
  ------------------
 2278|       |
 2279|       |    /* Sort the neighbors in ascending order so that:
 2280|       |       primary key   = number of descendants in the DFS tree; closure neighbor is 0
 2281|       |       secondary key = canonical number (here vertex number = canonical number - 1)
 2282|       |     */
 2283|       |
 2284|      3|    os.m_gDfs4CT_nDfsNumber = nDfsNumber;
 2285|      3|    os.m_gDfs4CT_nNumDescendants = nNumDescendants;
 2286|      3|    os.m_gDfs4CT_nCurrentAtom = -1;
 2287|       |
 2288|       |    /* sorting; deleted will be the last neighbors */
 2289|     18|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (2289:17): [True: 15, False: 3]
  ------------------
 2290|     15|    {
 2291|     15|        if (nl[i][0] > 1)
  ------------------
  |  Branch (2291:13): [True: 9, False: 6]
  ------------------
 2292|      9|        {
 2293|      9|            os.m_gDfs4CT_nCurrentAtom = i;
 2294|      9|            insertions_sort( &os, &nl[i][1], nl[i][0], sizeof( nl[i][1] ), CompareDfsDescendants4CT );
 2295|      9|        }
 2296|       |        /* reduce number of neighbors to exclude deleted */
 2297|     27|        for (k = 0; k < nl[i][0] && nl[i][k + 1] <= MAX_ATOMS; k++)
  ------------------
  |  |   43|     24|#define MAX_ATOMS  32766
  ------------------
  |  Branch (2297:21): [True: 24, False: 3]
  |  Branch (2297:37): [True: 12, False: 12]
  ------------------
 2298|     12|        {
 2299|     12|            ;
 2300|     12|        }
 2301|     15|        nl[i][0] = k;
 2302|     15|    }
 2303|       |
 2304|      3|    nTotOutputStringLen = 3 * ( num_atoms + num_rings + 1 ); /*  last 3 elements are a 'zero termination' */
 2305|       |
 2306|      3|    if (bCtPredecessors)
  ------------------
  |  Branch (2306:9): [True: 0, False: 3]
  ------------------
 2307|      0|    {
 2308|      0|        if (nOutputString = (AT_RANK *) inchi_calloc( nTotOutputStringLen, sizeof( nOutputString[0] ) ))
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  |  Branch (2308:13): [True: 0, False: 0]
  ------------------
 2309|      0|        {
 2310|      0|            cDelim = '-';
 2311|      0|            for (u = 0, k = -3; u < num_atoms; u++)
  ------------------
  |  Branch (2311:33): [True: 0, False: 0]
  ------------------
 2312|      0|            {
 2313|      0|                k += 3;
 2314|      0|                if (k + 6 > nTotOutputStringLen)
  ------------------
  |  Branch (2314:21): [True: 0, False: 0]
  ------------------
 2315|      0|                {
 2316|      0|                    goto exit_error;  /* program error */
 2317|      0|                }
 2318|      0|                nOutputString[k] = nNumDescendants[u] ? nNumDescendants[u] : MAX_ATOMS + 1;
  ------------------
  |  |   43|      0|#define MAX_ATOMS  32766
  ------------------
  |  Branch (2318:36): [True: 0, False: 0]
  ------------------
 2319|      0|                nOutputString[k + 1] = nNum_H ? 16 + nNum_H[u] : 0;
  ------------------
  |  Branch (2319:40): [True: 0, False: 0]
  ------------------
 2320|      0|                nOutputString[k + 2] = k ? ',' : '\0';
  ------------------
  |  Branch (2320:40): [True: 0, False: 0]
  ------------------
 2321|      0|                for (j = 1; j <= nl[u][0] && nDfsNumber[u] > nDfsNumber[i = nl[u][j]]; j++)
  ------------------
  |  Branch (2321:29): [True: 0, False: 0]
  |  Branch (2321:46): [True: 0, False: 0]
  ------------------
 2322|      0|                {
 2323|       |                    /* closures */
 2324|      0|                    k += 3;
 2325|      0|                    if (k + 6 > nTotOutputStringLen)
  ------------------
  |  Branch (2325:25): [True: 0, False: 0]
  ------------------
 2326|      0|                    {
 2327|      0|                        goto exit_error;  /* program error */
 2328|      0|                    }
 2329|      0|                    nOutputString[k] = i + 1;  /* closure */
 2330|      0|                    nOutputString[k + 1] = 0;
 2331|      0|                    nOutputString[k + 2] = cDelim;
 2332|      0|                }
 2333|      0|            }
 2334|      0|        }
 2335|      0|    }
 2336|      3|    else
 2337|      3|    {
 2338|      3|        if (nNumDescendants)
  ------------------
  |  Branch (2338:13): [True: 3, False: 0]
  ------------------
 2339|      3|        {  /* do not need anymore */
 2340|      3|            inchi_free( nNumDescendants );
  ------------------
  |  | 1136|      3|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 3, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2341|      3|            nNumDescendants = NULL;
 2342|      3|        }
 2343|       |
 2344|       |        /*
 2345|       |            the output string contains:
 2346|       |              (num_atoms) atoms for the DFS (spanning) tree
 2347|       |              (num_atoms-1) delimiters for the DFS (spanning) tree
 2348|       |              1 character for each atom that has 1 terminal hydrogen atoms
 2349|       |              2 characters  for each atom that has 2-9 terminal hydrogen atoms
 2350|       |              3 characters  for each atom that has 10-99 terminal hydrogen atoms, etc.
 2351|       |              (num_rings) atoms for the ring closures
 2352|       |              (num_rings) delimiters for the ring closures
 2353|       |        */
 2354|       |
 2355|      3|        if (nOutputString = (AT_RANK *) inchi_calloc( nTotOutputStringLen, sizeof( nOutputString[0] ) ))
  ------------------
  |  | 1133|      3|#define inchi_calloc   calloc
  ------------------
  |  Branch (2355:13): [True: 3, False: 0]
  ------------------
 2356|      3|        {
 2357|      3|            u = start; /*  start atom */
 2358|      3|            nTopStackAtom = -1;
 2359|      3|            memset( cNeighNumb, 0, num_atoms * sizeof( cNeighNumb[0] ) );
 2360|       |            /*  push the start atom on the stack */
 2361|      3|            nStackAtom[++nTopStackAtom] = (AT_NUMB) u;
 2362|       |            /*  output the starting atom */
 2363|      3|            k = 0;
 2364|      3|            nOutputString[k] = u + 1;
 2365|      3|            nOutputString[k + 1] = nNum_H ? 16 + nNum_H[u] : 0;
  ------------------
  |  Branch (2365:36): [True: 0, False: 3]
  ------------------
 2366|      3|            nOutputString[k + 2] = '\0';
 2367|       |
 2368|      3|            do
 2369|     15|            {
 2370|       |                /* advance */
 2371|     27|                while (i = (int) nStackAtom[nTopStackAtom], j = (int) cNeighNumb[i] + 1, (int) nl[i][0] >= j)
  ------------------
  |  Branch (2371:24): [True: 12, False: 15]
  ------------------
 2372|       |                    /*while ( (int)nl[i=nStackAtom[nTopStackAtom]][0] >= (j = (int)cNeighNumb[i]+1) )*/
 2373|       |                    /* replaced due to missing sequence point; undefined behavior, reported by Geoffrey Hutchison */
 2374|     12|                {
 2375|     12|                    k += 3;
 2376|     12|                    if (k + 6 > nTotOutputStringLen)
  ------------------
  |  Branch (2376:25): [True: 0, False: 12]
  ------------------
 2377|      0|                    {
 2378|      0|                        goto exit_error;  /* program error */
 2379|      0|                    }
 2380|     12|                    cNeighNumb[i] ++;
 2381|     12|                    u = (int) nl[i][j]; /* neighbor */
 2382|       |
 2383|       |                    /* output neighbor's canonical number */
 2384|     12|                    nOutputString[k] = u + 1;
 2385|       |
 2386|     12|                    if (nDfsNumber[u] > nDfsNumber[i])
  ------------------
  |  Branch (2386:25): [True: 12, False: 0]
  ------------------
 2387|     12|                    {
 2388|       |                        /* tree edge, 1st visit -- advance */
 2389|       |                        /* put 'unexplored' vertex u on the stack */
 2390|     12|                        nStackAtom[++nTopStackAtom] = (AT_NUMB) u;
 2391|       |
 2392|       |                        /* output neighbor's number of H */
 2393|     12|                        nOutputString[k + 1] = nNum_H ? 16 + nNum_H[u] : 0;
  ------------------
  |  Branch (2393:48): [True: 0, False: 12]
  ------------------
 2394|     12|                    }
 2395|      0|                    else
 2396|      0|                    {
 2397|      0|                        nOutputString[k + 1] = 0;
 2398|      0|                    }
 2399|       |                    /* output a delimiter preceding the neighbor */
 2400|     12|                    if (1 < nl[i][0])
  ------------------
  |  Branch (2400:25): [True: 0, False: 12]
  ------------------
 2401|      0|                    {
 2402|      0|                        if (j == 1)
  ------------------
  |  Branch (2402:29): [True: 0, False: 0]
  ------------------
 2403|      0|                        {
 2404|      0|                            cDelim = '(';
 2405|      0|                        }
 2406|      0|                        else
 2407|      0|                        {
 2408|      0|                            if (j == nl[i][0])
  ------------------
  |  Branch (2408:33): [True: 0, False: 0]
  ------------------
 2409|      0|                            {
 2410|      0|                                cDelim = ')';
 2411|      0|                            }
 2412|      0|                            else
 2413|      0|                            {
 2414|      0|                                cDelim = ',';
 2415|      0|                            }
 2416|      0|                        }
 2417|      0|                    }
 2418|     12|                    else
 2419|     12|                    {
 2420|     12|                        cDelim = '-';
 2421|     12|                    }
 2422|     12|                    nOutputString[k + 2] = cDelim;
 2423|     12|                }
 2424|     15|                cNeighNumb[i] = 0;
 2425|       |
 2426|       |                /* back up: nothing else to do */
 2427|     15|            } while (--nTopStackAtom >= 0);
  ------------------
  |  Branch (2427:22): [True: 12, False: 3]
  ------------------
 2428|      3|        }
 2429|      3|    }
 2430|      3|    goto exit_function;
 2431|       |
 2432|      3|exit_error:
 2433|      0|    if (nOutputString)
  ------------------
  |  Branch (2433:9): [True: 0, False: 0]
  ------------------
 2434|      0|    {
 2435|      0|        inchi_free( nOutputString );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2436|      0|        nOutputString = NULL;
 2437|      0|    }
 2438|       |
 2439|      3|exit_function:
 2440|      3|    if (nStackAtom)
  ------------------
  |  Branch (2440:9): [True: 3, False: 0]
  ------------------
 2441|      3|    {
 2442|      3|        inchi_free( nStackAtom );
  ------------------
  |  | 1136|      3|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 3, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2443|      3|    }
 2444|      3|    if (nNumDescendants)
  ------------------
  |  Branch (2444:9): [True: 0, False: 3]
  ------------------
 2445|      0|    {
 2446|      0|        inchi_free( nNumDescendants );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2447|      0|    }
 2448|      3|    if (nDfsNumber)
  ------------------
  |  Branch (2448:9): [True: 3, False: 0]
  ------------------
 2449|      3|    {
 2450|      3|        inchi_free( nDfsNumber );
  ------------------
  |  | 1136|      3|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 3, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2451|      3|    }
 2452|      3|    if (cNeighNumb)
  ------------------
  |  Branch (2452:9): [True: 3, False: 0]
  ------------------
 2453|      3|    {
 2454|      3|        inchi_free( cNeighNumb );
  ------------------
  |  | 1136|      3|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 3, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2455|      3|    }
 2456|      3|    if (nl)
  ------------------
  |  Branch (2456:9): [True: 3, False: 0]
  ------------------
 2457|      3|    {
 2458|      3|        FreeNeighList( nl );
 2459|      3|    }
 2460|       |
 2461|      3|    return nOutputString;
 2462|      0|}
CompareReversedStereoINChI:
 2544|   107k|{
 2545|   107k|    if (s1 == NULL && s2 == NULL)
  ------------------
  |  Branch (2545:9): [True: 107k, False: 0]
  |  Branch (2545:23): [True: 53.8k, False: 53.8k]
  ------------------
 2546|  53.8k|    {
 2547|  53.8k|        return 0;
 2548|  53.8k|    }
 2549|  53.8k|    if (( s1 == NULL ) ^ ( s2 == NULL ))
  ------------------
  |  Branch (2549:9): [True: 53.8k, False: 0]
  ------------------
 2550|  53.8k|    {
 2551|  53.8k|        INChI_Stereo *s = s1 ? s1 : s2;
  ------------------
  |  Branch (2551:27): [True: 0, False: 53.8k]
  ------------------
 2552|  53.8k|        if (s->nNumberOfStereoCenters || s->nNumberOfStereoBonds)
  ------------------
  |  Branch (2552:13): [True: 0, False: 53.8k]
  |  Branch (2552:42): [True: 0, False: 53.8k]
  ------------------
 2553|      0|        {
 2554|      0|            return 20; /* Diff: Missing Stereo */
 2555|      0|        }
 2556|  53.8k|        else
 2557|  53.8k|        {
 2558|  53.8k|            return 0;
 2559|  53.8k|        }
 2560|  53.8k|    }
 2561|       |
 2562|      0|    if (s1->nNumberOfStereoCenters != s2->nNumberOfStereoCenters)
  ------------------
  |  Branch (2562:9): [True: 0, False: 0]
  ------------------
 2563|      0|    {
 2564|      0|        return 21;      /* Diff: Number of sp3 stereocenters */
 2565|      0|    }
 2566|      0|    if (s1->nNumberOfStereoCenters > 0)
  ------------------
  |  Branch (2566:9): [True: 0, False: 0]
  ------------------
 2567|      0|    {
 2568|      0|        if (memcmp( s1->nNumber, s2->nNumber, s1->nNumberOfStereoCenters * sizeof( s1->nNumber[0] ) ))
  ------------------
  |  Branch (2568:13): [True: 0, False: 0]
  ------------------
 2569|      0|        {
 2570|      0|            return 22;  /* Diff: sp3 stereocenter locations */
 2571|      0|        }
 2572|      0|        if (memcmp( s1->t_parity, s2->t_parity, s1->nNumberOfStereoCenters * sizeof( s1->t_parity[0] ) ))
  ------------------
  |  Branch (2572:13): [True: 0, False: 0]
  ------------------
 2573|      0|        {
 2574|      0|            return 23;  /* Diff: sp3 stereocenter parities */
 2575|      0|        }
 2576|      0|        if (s1->nCompInv2Abs != s2->nCompInv2Abs && s1->nCompInv2Abs && s2->nCompInv2Abs)
  ------------------
  |  Branch (2576:13): [True: 0, False: 0]
  |  Branch (2576:53): [True: 0, False: 0]
  |  Branch (2576:73): [True: 0, False: 0]
  ------------------
 2577|      0|        {
 2578|      0|            return 24;  /* Diff: sp3 inversion */
 2579|      0|        }
 2580|       |        /*
 2581|       |        if ( s1->nNumberInv && s2->nNumberInv ) {
 2582|       |            if ( memcmp( s1->nNumberInv, s2->nNumberInv, s1->nNumberOfStereoCenters*sizeof(s1->nNumber[0]) ) )
 2583|       |                return 25;
 2584|       |            if ( memcmp( s1->t_parityInv, s2->t_parityInv, s1->nNumberOfStereoCenters*sizeof(s1->t_parity[0]) ) )
 2585|       |                return 26;
 2586|       |            if ( s1->nCompInv2Abs != s2->nCompInv2Abs ||
 2587|       |                 s1->bTrivialInv  != s2->bTrivialInv ) {
 2588|       |                return 27;
 2589|       |            }
 2590|       |        } else
 2591|       |        if ( s1->nNumberInv || s2->nNumberInv ) {
 2592|       |            return 28;
 2593|       |        }
 2594|       |        */
 2595|      0|    }
 2596|      0|    if (s1->nNumberOfStereoBonds != s2->nNumberOfStereoBonds)
  ------------------
  |  Branch (2596:9): [True: 0, False: 0]
  ------------------
 2597|      0|    {
 2598|      0|        return 25;      /* Diff: Number of stereobonds */
 2599|      0|    }
 2600|      0|    if (s1->nNumberOfStereoBonds > 0)
  ------------------
  |  Branch (2600:9): [True: 0, False: 0]
  ------------------
 2601|      0|    {
 2602|      0|        if (memcmp( s1->nBondAtom1, s2->nBondAtom1, s1->nNumberOfStereoBonds * sizeof( s1->nBondAtom1[0] ) ))
  ------------------
  |  Branch (2602:13): [True: 0, False: 0]
  ------------------
 2603|      0|        {
 2604|      0|            return 26; /* Diff: Stereobond 1st atom locations */
 2605|      0|        }
 2606|      0|        if (memcmp( s1->nBondAtom2, s2->nBondAtom2, s1->nNumberOfStereoBonds * sizeof( s1->nBondAtom2[0] ) ))
  ------------------
  |  Branch (2606:13): [True: 0, False: 0]
  ------------------
 2607|      0|        {
 2608|      0|            return 27; /* Diff: Stereobond 2nd atom locations */
 2609|      0|        }
 2610|      0|        if (memcmp( s1->b_parity, s2->b_parity, s1->nNumberOfStereoBonds * sizeof( s1->b_parity[0] ) ))
  ------------------
  |  Branch (2610:13): [True: 0, False: 0]
  ------------------
 2611|      0|        {
 2612|      0|            return 28; /* Diff: Stereobond parities */
 2613|      0|        }
 2614|      0|    }
 2615|       |
 2616|      0|    return 0;
 2617|      0|}
CompareReversedStereoINChI2:
 2624|     13|{
 2625|     13|    int ret = 0;
 2626|     13|    int j1, j2, num_eq, num_dif, num_extra_undf, num_miss_undf, num_in1_only, num_in2_only;
 2627|     13|    int bAddSb = !( picr->num_sb_undef_in1_only + picr->num_sb_in1_only + picr->num_sb_in2_only );
 2628|     13|    int bAddSc = !( picr->num_sc_undef_in1_only + picr->num_sc_in1_only + picr->num_sc_in2_only );
 2629|       |
 2630|     13|    int nNumSc1 = s1 ? s1->nNumberOfStereoCenters : 0;
  ------------------
  |  Branch (2630:19): [True: 13, False: 0]
  ------------------
 2631|     13|    int nNumSc2 = s2 ? s2->nNumberOfStereoCenters : 0;
  ------------------
  |  Branch (2631:19): [True: 0, False: 13]
  ------------------
 2632|     13|    int nNumSb1 = s1 ? s1->nNumberOfStereoBonds : 0;
  ------------------
  |  Branch (2632:19): [True: 13, False: 0]
  ------------------
 2633|     13|    int nNumSb2 = s2 ? s2->nNumberOfStereoBonds : 0;
  ------------------
  |  Branch (2633:19): [True: 0, False: 13]
  ------------------
 2634|       |
 2635|     13|    if (( nNumSc1 || nNumSc1 ) &&
  ------------------
  |  Branch (2635:11): [True: 0, False: 13]
  |  Branch (2635:22): [True: 0, False: 13]
  ------------------
 2636|     13|        ( nNumSc1 != nNumSc2 ||
  ------------------
  |  Branch (2636:11): [True: 0, False: 0]
  ------------------
 2637|      0|            memcmp( s1->nNumber, s2->nNumber, nNumSc1 * sizeof( s1->nNumber[0] ) ) ||
  ------------------
  |  Branch (2637:13): [True: 0, False: 0]
  ------------------
 2638|      0|            memcmp( s1->t_parity, s2->t_parity, nNumSc1 * sizeof( s1->t_parity[0] ) ) ))
  ------------------
  |  Branch (2638:13): [True: 0, False: 0]
  ------------------
 2639|      0|    {
 2640|      0|        num_eq = num_dif = num_extra_undf = num_miss_undf = num_in1_only = num_in2_only = 0;
 2641|      0|        for (j1 = j2 = 0; j1 < nNumSc1 && j2 < nNumSc2; )
  ------------------
  |  Branch (2641:27): [True: 0, False: 0]
  |  Branch (2641:43): [True: 0, False: 0]
  ------------------
 2642|      0|        {
 2643|      0|            if (s1->nNumber[j1] == s2->nNumber[j2])
  ------------------
  |  Branch (2643:17): [True: 0, False: 0]
  ------------------
 2644|      0|            {
 2645|      0|                if (s1->t_parity[j1] == s2->t_parity[j2])
  ------------------
  |  Branch (2645:21): [True: 0, False: 0]
  ------------------
 2646|      0|                {
 2647|      0|                    num_eq++;
 2648|      0|                }
 2649|      0|                else
 2650|      0|                {
 2651|      0|                    num_dif++;
 2652|      0|                }
 2653|      0|                j1++;
 2654|      0|                j2++;
 2655|      0|            }
 2656|      0|            else
 2657|      0|            {
 2658|      0|                if (s1->nNumber[j1] < s2->nNumber[j2])
  ------------------
  |  Branch (2658:21): [True: 0, False: 0]
  ------------------
 2659|      0|                {
 2660|      0|                    num_in1_only++;
 2661|      0|                    if (s1->t_parity[j1] == AB_PARITY_UNDF)
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2661:25): [True: 0, False: 0]
  ------------------
 2662|      0|                    {
 2663|      0|                        num_extra_undf++;
 2664|      0|                    }
 2665|      0|                    if (bAddSc)
  ------------------
  |  Branch (2665:25): [True: 0, False: 0]
  ------------------
 2666|      0|                    {
 2667|      0|                        if (picr->num_sc_in1_only < ICR_MAX_SC_IN1_ONLY)
  ------------------
  |  |  176|      0|#define ICR_MAX_SC_IN1_ONLY   32
  ------------------
  |  Branch (2667:29): [True: 0, False: 0]
  ------------------
 2668|      0|                        {
 2669|      0|                            picr->sc_in1_only[picr->num_sc_in1_only++] = j1;
 2670|      0|                        }
 2671|      0|                        if (s1->t_parity[j1] == AB_PARITY_UNDF)
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2671:29): [True: 0, False: 0]
  ------------------
 2672|      0|                        {
 2673|      0|                            if (picr->num_sc_undef_in1_only < ICR_MAX_SC_UNDF)
  ------------------
  |  |  179|      0|#define ICR_MAX_SC_UNDF       32
  ------------------
  |  Branch (2673:33): [True: 0, False: 0]
  ------------------
 2674|      0|                            {
 2675|      0|                                picr->sc_undef_in1_only[picr->num_sc_undef_in1_only++] = j1;
 2676|      0|                            }
 2677|      0|                        }
 2678|      0|                    }
 2679|      0|                    j1++;
 2680|      0|                }
 2681|      0|                else
 2682|      0|                {
 2683|      0|                    num_in2_only++;
 2684|      0|                    if (s2->t_parity[j2] == AB_PARITY_UNDF)
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2684:25): [True: 0, False: 0]
  ------------------
 2685|      0|                    {
 2686|      0|                        num_miss_undf++;
 2687|      0|                    }
 2688|      0|                    if (bAddSc)
  ------------------
  |  Branch (2688:25): [True: 0, False: 0]
  ------------------
 2689|      0|                    {
 2690|      0|                        if (picr->num_sc_in2_only < ICR_MAX_SC_IN2_ONLY)
  ------------------
  |  |  177|      0|#define ICR_MAX_SC_IN2_ONLY   32
  ------------------
  |  Branch (2690:29): [True: 0, False: 0]
  ------------------
 2691|      0|                        {
 2692|      0|                            picr->sc_in2_only[picr->num_sc_in2_only++] = j2;
 2693|      0|                        }
 2694|      0|                        if (s2->t_parity[j2] == AB_PARITY_UNDF)
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2694:29): [True: 0, False: 0]
  ------------------
 2695|      0|                        {
 2696|      0|                            if (picr->num_sc_undef_in2_only < ICR_MAX_SC_UNDF)
  ------------------
  |  |  179|      0|#define ICR_MAX_SC_UNDF       32
  ------------------
  |  Branch (2696:33): [True: 0, False: 0]
  ------------------
 2697|      0|                            {
 2698|      0|                                picr->sc_undef_in2_only[picr->num_sc_undef_in2_only++] = j1;
 2699|      0|                            }
 2700|      0|                        }
 2701|      0|                    }
 2702|      0|                    j2++;
 2703|      0|                }
 2704|      0|            }
 2705|      0|        }
 2706|      0|        while (j1 < nNumSc1)
  ------------------
  |  Branch (2706:16): [True: 0, False: 0]
  ------------------
 2707|      0|        {
 2708|      0|            if (s1->t_parity[j1] == AB_PARITY_UNDF)
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2708:17): [True: 0, False: 0]
  ------------------
 2709|      0|            {
 2710|      0|                num_extra_undf++;
 2711|      0|            }
 2712|      0|            num_in1_only++;
 2713|      0|            if (bAddSc)
  ------------------
  |  Branch (2713:17): [True: 0, False: 0]
  ------------------
 2714|      0|            {
 2715|      0|                if (picr->num_sc_in1_only < ICR_MAX_SC_IN1_ONLY)
  ------------------
  |  |  176|      0|#define ICR_MAX_SC_IN1_ONLY   32
  ------------------
  |  Branch (2715:21): [True: 0, False: 0]
  ------------------
 2716|      0|                {
 2717|      0|                    picr->sc_in1_only[picr->num_sc_in1_only++] = j1;
 2718|      0|                }
 2719|      0|                if (s1->t_parity[j1] == AB_PARITY_UNDF)
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2719:21): [True: 0, False: 0]
  ------------------
 2720|      0|                {
 2721|      0|                    if (picr->num_sc_undef_in1_only < ICR_MAX_SC_UNDF)
  ------------------
  |  |  179|      0|#define ICR_MAX_SC_UNDF       32
  ------------------
  |  Branch (2721:25): [True: 0, False: 0]
  ------------------
 2722|      0|                    {
 2723|      0|                        picr->sc_undef_in1_only[picr->num_sc_undef_in1_only++] = j1;
 2724|      0|                    }
 2725|      0|                }
 2726|      0|            }
 2727|      0|            j1++;
 2728|      0|        }
 2729|      0|        while (j2 < nNumSc2)
  ------------------
  |  Branch (2729:16): [True: 0, False: 0]
  ------------------
 2730|      0|        {
 2731|      0|            if (s2->t_parity[j2] == AB_PARITY_UNDF)
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2731:17): [True: 0, False: 0]
  ------------------
 2732|      0|            {
 2733|      0|                num_miss_undf++;
 2734|      0|            }
 2735|      0|            num_in2_only++;
 2736|      0|            if (bAddSc)
  ------------------
  |  Branch (2736:17): [True: 0, False: 0]
  ------------------
 2737|      0|            {
 2738|      0|                if (picr->num_sc_in2_only < ICR_MAX_SC_IN2_ONLY)
  ------------------
  |  |  177|      0|#define ICR_MAX_SC_IN2_ONLY   32
  ------------------
  |  Branch (2738:21): [True: 0, False: 0]
  ------------------
 2739|      0|                {
 2740|      0|                    picr->sc_in2_only[picr->num_sc_in2_only++] = j2;
 2741|      0|                }
 2742|      0|            }
 2743|      0|            j2++;
 2744|      0|        }
 2745|      0|        if (num_dif)
  ------------------
  |  Branch (2745:13): [True: 0, False: 0]
  ------------------
 2746|      0|        {
 2747|      0|            ret |= IDIF_SC_PARITY;
 2748|      0|        }
 2749|      0|        if (num_in1_only)
  ------------------
  |  Branch (2749:13): [True: 0, False: 0]
  ------------------
 2750|      0|        {
 2751|      0|            if (num_extra_undf)
  ------------------
  |  Branch (2751:17): [True: 0, False: 0]
  ------------------
 2752|      0|            {
 2753|      0|                ret |= IDIF_SC_EXTRA_UNDF;
 2754|      0|            }
 2755|      0|            if (num_in1_only != num_extra_undf)
  ------------------
  |  Branch (2755:17): [True: 0, False: 0]
  ------------------
 2756|      0|            {
 2757|      0|                ret |= IDIF_SC_EXTRA;
 2758|      0|            }
 2759|      0|        }
 2760|      0|        if (num_in2_only)
  ------------------
  |  Branch (2760:13): [True: 0, False: 0]
  ------------------
 2761|      0|        {
 2762|      0|            if (num_miss_undf)
  ------------------
  |  Branch (2762:17): [True: 0, False: 0]
  ------------------
 2763|      0|            {
 2764|      0|                ret |= IDIF_SC_MISS_UNDF;
 2765|      0|            }
 2766|      0|            if (num_in2_only != num_miss_undf)
  ------------------
  |  Branch (2766:17): [True: 0, False: 0]
  ------------------
 2767|      0|            {
 2768|      0|                ret |= IDIF_SC_MISS;
 2769|      0|            }
 2770|      0|        }
 2771|      0|    }
 2772|     13|    if (s1 && s2 && s1->nCompInv2Abs != s2->nCompInv2Abs && s1->nCompInv2Abs && s2->nCompInv2Abs)
  ------------------
  |  Branch (2772:9): [True: 13, False: 0]
  |  Branch (2772:15): [True: 0, False: 13]
  |  Branch (2772:21): [True: 0, False: 0]
  |  Branch (2772:61): [True: 0, False: 0]
  |  Branch (2772:81): [True: 0, False: 0]
  ------------------
 2773|      0|    {
 2774|      0|        ret |= IDIF_SC_INV;
 2775|      0|    }
 2776|       |
 2777|     13|    if (( nNumSb1 || nNumSb2 ) &&
  ------------------
  |  Branch (2777:11): [True: 0, False: 13]
  |  Branch (2777:22): [True: 0, False: 13]
  ------------------
 2778|     13|        ( nNumSb1 != nNumSb2 ||
  ------------------
  |  Branch (2778:11): [True: 0, False: 0]
  ------------------
 2779|      0|            memcmp( s1->nBondAtom1, s2->nBondAtom1, nNumSb1 * sizeof( s1->nBondAtom1[0] ) ) ||
  ------------------
  |  Branch (2779:13): [True: 0, False: 0]
  ------------------
 2780|      0|            memcmp( s1->nBondAtom2, s2->nBondAtom2, nNumSb1 * sizeof( s1->nBondAtom2[0] ) ) ||
  ------------------
  |  Branch (2780:13): [True: 0, False: 0]
  ------------------
 2781|      0|            memcmp( s1->b_parity, s2->b_parity, nNumSb1 * sizeof( s1->b_parity[0] ) ) ))
  ------------------
  |  Branch (2781:13): [True: 0, False: 0]
  ------------------
 2782|      0|    {
 2783|      0|        num_eq = num_dif = num_extra_undf = num_miss_undf = num_in1_only = num_in2_only = 0;
 2784|      0|        for (j1 = j2 = 0; j1 < nNumSb1 && j2 < nNumSb2; )
  ------------------
  |  Branch (2784:27): [True: 0, False: 0]
  |  Branch (2784:43): [True: 0, False: 0]
  ------------------
 2785|      0|        {
 2786|      0|            if (s1->nBondAtom1[j1] == s2->nBondAtom1[j2] &&
  ------------------
  |  Branch (2786:17): [True: 0, False: 0]
  ------------------
 2787|      0|                 s1->nBondAtom2[j1] == s2->nBondAtom2[j2])
  ------------------
  |  Branch (2787:18): [True: 0, False: 0]
  ------------------
 2788|      0|            {
 2789|      0|                if (s1->b_parity[j1] == s2->b_parity[j2])
  ------------------
  |  Branch (2789:21): [True: 0, False: 0]
  ------------------
 2790|      0|                {
 2791|      0|                    num_eq++;
 2792|      0|                }
 2793|      0|                else
 2794|      0|                {
 2795|      0|                    num_dif++;
 2796|      0|                }
 2797|      0|                j1++;
 2798|      0|                j2++;
 2799|      0|            }
 2800|      0|            else
 2801|      0|            {
 2802|      0|                if (s1->nBondAtom1[j1] < s2->nBondAtom1[j2] ||
  ------------------
  |  Branch (2802:21): [True: 0, False: 0]
  ------------------
 2803|      0|                        s1->nBondAtom1[j1] == s2->nBondAtom1[j2] && s1->nBondAtom2[j1] < s2->nBondAtom2[j2])
  ------------------
  |  Branch (2803:25): [True: 0, False: 0]
  |  Branch (2803:69): [True: 0, False: 0]
  ------------------
 2804|      0|                {
 2805|      0|                    num_in1_only++;
 2806|      0|                    if (s1->b_parity[j1] == AB_PARITY_UNDF)
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2806:25): [True: 0, False: 0]
  ------------------
 2807|      0|                    {
 2808|      0|                        num_extra_undf++;
 2809|      0|                    }
 2810|      0|                    if (bAddSb)
  ------------------
  |  Branch (2810:25): [True: 0, False: 0]
  ------------------
 2811|      0|                    {
 2812|      0|                        if (picr->num_sb_in1_only < ICR_MAX_SB_IN1_ONLY)
  ------------------
  |  |  174|      0|#define ICR_MAX_SB_IN1_ONLY   32
  ------------------
  |  Branch (2812:29): [True: 0, False: 0]
  ------------------
 2813|      0|                        {
 2814|      0|                            picr->sb_in1_only[picr->num_sb_in1_only++] = j1;
 2815|      0|                        }
 2816|      0|                        if (s1->b_parity[j1] == AB_PARITY_UNDF)
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2816:29): [True: 0, False: 0]
  ------------------
 2817|      0|                        {
 2818|      0|                            if (picr->num_sb_undef_in1_only < ICR_MAX_SB_UNDF)
  ------------------
  |  |  178|      0|#define ICR_MAX_SB_UNDF       32
  ------------------
  |  Branch (2818:33): [True: 0, False: 0]
  ------------------
 2819|      0|                            {
 2820|      0|                                picr->sb_undef_in1_only[picr->num_sb_undef_in1_only++] = j1;
 2821|      0|                            }
 2822|      0|                        }
 2823|      0|                    }
 2824|      0|                    j1++;
 2825|      0|                }
 2826|      0|                else
 2827|      0|                {
 2828|      0|                    num_in2_only++;
 2829|      0|                    if (s2->b_parity[j2] == AB_PARITY_UNDF)
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2829:25): [True: 0, False: 0]
  ------------------
 2830|      0|                    {
 2831|      0|                        num_miss_undf++;
 2832|      0|                    }
 2833|      0|                    if (bAddSb)
  ------------------
  |  Branch (2833:25): [True: 0, False: 0]
  ------------------
 2834|      0|                    {
 2835|      0|                        if (picr->num_sb_in2_only < ICR_MAX_SB_IN2_ONLY)
  ------------------
  |  |  175|      0|#define ICR_MAX_SB_IN2_ONLY   32
  ------------------
  |  Branch (2835:29): [True: 0, False: 0]
  ------------------
 2836|      0|                        {
 2837|      0|                            picr->sb_in2_only[picr->num_sb_in2_only++] = j2;
 2838|      0|                        }
 2839|      0|                        if (s2->b_parity[j2] == AB_PARITY_UNDF)
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2839:29): [True: 0, False: 0]
  ------------------
 2840|      0|                        {
 2841|      0|                            if (picr->num_sb_undef_in2_only < ICR_MAX_SB_UNDF)
  ------------------
  |  |  178|      0|#define ICR_MAX_SB_UNDF       32
  ------------------
  |  Branch (2841:33): [True: 0, False: 0]
  ------------------
 2842|      0|                            {
 2843|      0|                                picr->sb_undef_in2_only[picr->num_sb_undef_in2_only++] = j1;
 2844|      0|                            }
 2845|      0|                        }
 2846|      0|                    }
 2847|      0|                    j2++;
 2848|      0|                }
 2849|      0|            }
 2850|      0|        }
 2851|      0|        while (j1 < nNumSb1)
  ------------------
  |  Branch (2851:16): [True: 0, False: 0]
  ------------------
 2852|      0|        {
 2853|      0|            num_in1_only++;
 2854|      0|            if (s1->b_parity[j1] == AB_PARITY_UNDF)
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2854:17): [True: 0, False: 0]
  ------------------
 2855|      0|            {
 2856|      0|                num_extra_undf++;
 2857|      0|            }
 2858|      0|            if (bAddSb)
  ------------------
  |  Branch (2858:17): [True: 0, False: 0]
  ------------------
 2859|      0|            {
 2860|      0|                if (picr->num_sb_in1_only < ICR_MAX_SB_IN1_ONLY)
  ------------------
  |  |  174|      0|#define ICR_MAX_SB_IN1_ONLY   32
  ------------------
  |  Branch (2860:21): [True: 0, False: 0]
  ------------------
 2861|      0|                {
 2862|      0|                    picr->sb_in1_only[picr->num_sb_in1_only++] = j1;
 2863|      0|                }
 2864|      0|                if (s1->b_parity[j1] == AB_PARITY_UNDF)
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2864:21): [True: 0, False: 0]
  ------------------
 2865|      0|                {
 2866|      0|                    if (picr->num_sb_undef_in1_only < ICR_MAX_SB_UNDF)
  ------------------
  |  |  178|      0|#define ICR_MAX_SB_UNDF       32
  ------------------
  |  Branch (2866:25): [True: 0, False: 0]
  ------------------
 2867|      0|                    {
 2868|      0|                        picr->sb_undef_in1_only[picr->num_sb_undef_in1_only++] = j1;
 2869|      0|                    }
 2870|      0|                }
 2871|      0|            }
 2872|      0|            j1++;
 2873|      0|        }
 2874|      0|        while (j2 < nNumSb2)
  ------------------
  |  Branch (2874:16): [True: 0, False: 0]
  ------------------
 2875|      0|        {
 2876|      0|            num_in2_only++;
 2877|      0|            if (s2->b_parity[j2] == AB_PARITY_UNDF)
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2877:17): [True: 0, False: 0]
  ------------------
 2878|      0|            {
 2879|      0|                num_miss_undf++;
 2880|      0|            }
 2881|      0|            if (bAddSb)
  ------------------
  |  Branch (2881:17): [True: 0, False: 0]
  ------------------
 2882|      0|            {
 2883|      0|                if (picr->num_sb_in2_only < ICR_MAX_SB_IN2_ONLY)
  ------------------
  |  |  175|      0|#define ICR_MAX_SB_IN2_ONLY   32
  ------------------
  |  Branch (2883:21): [True: 0, False: 0]
  ------------------
 2884|      0|                {
 2885|      0|                    picr->sb_in2_only[picr->num_sb_in2_only++] = j2;
 2886|      0|                }
 2887|      0|                if (s2->b_parity[j2] == AB_PARITY_UNDF)
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2887:21): [True: 0, False: 0]
  ------------------
 2888|      0|                {
 2889|      0|                    if (picr->num_sb_undef_in2_only < ICR_MAX_SB_UNDF)
  ------------------
  |  |  178|      0|#define ICR_MAX_SB_UNDF       32
  ------------------
  |  Branch (2889:25): [True: 0, False: 0]
  ------------------
 2890|      0|                    {
 2891|      0|                        picr->sb_undef_in2_only[picr->num_sb_undef_in2_only++] = j1;
 2892|      0|                    }
 2893|      0|                }
 2894|      0|            }
 2895|      0|            j2++;
 2896|      0|        }
 2897|      0|        if (num_dif)
  ------------------
  |  Branch (2897:13): [True: 0, False: 0]
  ------------------
 2898|      0|        {
 2899|      0|            ret |= IDIF_SB_PARITY;
 2900|      0|        }
 2901|      0|        if (num_in1_only)
  ------------------
  |  Branch (2901:13): [True: 0, False: 0]
  ------------------
 2902|      0|        {
 2903|      0|            if (num_extra_undf)
  ------------------
  |  Branch (2903:17): [True: 0, False: 0]
  ------------------
 2904|      0|            {
 2905|      0|                ret |= IDIF_SB_EXTRA_UNDF;
 2906|      0|            }
 2907|      0|            if (num_in1_only != num_extra_undf)
  ------------------
  |  Branch (2907:17): [True: 0, False: 0]
  ------------------
 2908|      0|            {
 2909|      0|                ret |= IDIF_SB_EXTRA;
 2910|      0|            }
 2911|      0|        }
 2912|      0|        if (num_in2_only)
  ------------------
  |  Branch (2912:13): [True: 0, False: 0]
  ------------------
 2913|      0|        {
 2914|      0|            if (num_miss_undf)
  ------------------
  |  Branch (2914:17): [True: 0, False: 0]
  ------------------
 2915|      0|            {
 2916|      0|                ret |= IDIF_SB_MISS_UNDF;
 2917|      0|            }
 2918|      0|            if (num_in2_only != num_miss_undf)
  ------------------
  |  Branch (2918:17): [True: 0, False: 0]
  ------------------
 2919|      0|            {
 2920|      0|                ret |= IDIF_SB_MISS;
 2921|      0|            }
 2922|      0|        }
 2923|      0|    }
 2924|       |
 2925|     13|    return ret;
 2926|     13|}
CompareReversedINChI:
 2934|  53.8k|{
 2935|  53.8k|    int ret;
 2936|       |
 2937|  53.8k|    if (i1 == NULL && i2 == NULL)
  ------------------
  |  Branch (2937:9): [True: 0, False: 53.8k]
  |  Branch (2937:23): [True: 0, False: 0]
  ------------------
 2938|      0|    {
 2939|      0|        return 0;
 2940|      0|    }
 2941|  53.8k|    if (( i1 == NULL ) ^ ( i2 == NULL ))
  ------------------
  |  Branch (2941:9): [True: 0, False: 53.8k]
  ------------------
 2942|      0|    {
 2943|      0|        return 1; /* Diff: Missing InChI */
 2944|      0|    }
 2945|       |
 2946|  53.8k|    if (i1->nErrorCode == i2->nErrorCode)
  ------------------
  |  Branch (2946:9): [True: 53.8k, False: 0]
  ------------------
 2947|  53.8k|    {
 2948|  53.8k|        if (i1->nErrorCode)
  ------------------
  |  Branch (2948:13): [True: 0, False: 53.8k]
  ------------------
 2949|      0|        {
 2950|      0|            return 0;
 2951|      0|        }
 2952|  53.8k|    }
 2953|      0|    else
 2954|      0|    {
 2955|      0|        return 2; /* Diff: Error codes */
 2956|      0|    }
 2957|  53.8k|    if (i1->bDeleted != i2->bDeleted)
  ------------------
  |  Branch (2957:9): [True: 0, False: 53.8k]
  ------------------
 2958|      0|    {
 2959|      0|        return 1; /* Diff: Missing InChI */
 2960|      0|    }
 2961|  53.8k|    if (i1->nNumberOfAtoms != i2->nNumberOfAtoms)
  ------------------
  |  Branch (2961:9): [True: 0, False: 53.8k]
  ------------------
 2962|      0|    {
 2963|      0|        return 3;  /* Diff: Num. atoms */
 2964|      0|    }
 2965|       |
 2966|  53.8k|    if (i1->nNumberOfAtoms > 0)
  ------------------
  |  Branch (2966:9): [True: 53.8k, False: 0]
  ------------------
 2967|  53.8k|    {
 2968|  53.8k|        if (memcmp( i1->nAtom, i2->nAtom, i1->nNumberOfAtoms * sizeof( i1->nAtom[0] ) ))
  ------------------
  |  Branch (2968:13): [True: 0, False: 53.8k]
  ------------------
 2969|      0|        {
 2970|      0|            return 4; /* Diff: Elements */
 2971|      0|        }
 2972|  53.8k|        if (strcmp( i1->szHillFormula, i2->szHillFormula ))
  ------------------
  |  Branch (2972:13): [True: 2, False: 53.8k]
  ------------------
 2973|      2|        {
 2974|      2|            return 7; /* Diff: Hill Formulas */
 2975|      2|        }
 2976|  53.8k|        if (memcmp( i1->nNum_H, i2->nNum_H, i1->nNumberOfAtoms * sizeof( i1->nNum_H[0] ) ))
  ------------------
  |  Branch (2976:13): [True: 0, False: 53.8k]
  ------------------
 2977|      0|        {
 2978|      0|            if (i1->lenConnTable > 1 || i2->lenConnTable > 1)
  ------------------
  |  Branch (2978:17): [True: 0, False: 0]
  |  Branch (2978:41): [True: 0, False: 0]
  ------------------
 2979|      0|            {
 2980|      0|                return 5; /* Diff: H Locations (mobile H present) */
 2981|      0|            }
 2982|      0|            else
 2983|      0|            {
 2984|      0|                return 6; /* Diff: H Locations (no mobile H) */
 2985|      0|            }
 2986|      0|        }
 2987|       |
 2988|       |        /* fixed H */
 2989|  53.8k|        if (i1->nNum_H_fixed || i2->nNum_H_fixed)
  ------------------
  |  Branch (2989:13): [True: 0, False: 53.8k]
  |  Branch (2989:33): [True: 0, False: 53.8k]
  ------------------
 2990|      0|        {
 2991|      0|            int bHasFixedH1 = 0, bHasFixedH2 = 0, i, j1, j2;
 2992|      0|            if (i1->nNum_H_fixed)
  ------------------
  |  Branch (2992:17): [True: 0, False: 0]
  ------------------
 2993|      0|            {
 2994|      0|                for (i = 0; i < i1->nNumberOfAtoms; i++)
  ------------------
  |  Branch (2994:29): [True: 0, False: 0]
  ------------------
 2995|      0|                {
 2996|      0|                    if (i1->nNum_H_fixed[i])
  ------------------
  |  Branch (2996:25): [True: 0, False: 0]
  ------------------
 2997|      0|                    {
 2998|      0|                        bHasFixedH1++;
 2999|      0|                    }
 3000|      0|                }
 3001|      0|            }
 3002|      0|            if (i2->nNum_H_fixed)
  ------------------
  |  Branch (3002:17): [True: 0, False: 0]
  ------------------
 3003|      0|            {
 3004|      0|                for (i = 0; i < i2->nNumberOfAtoms; i++)
  ------------------
  |  Branch (3004:29): [True: 0, False: 0]
  ------------------
 3005|      0|                {
 3006|      0|                    if (i2->nNum_H_fixed[i])
  ------------------
  |  Branch (3006:25): [True: 0, False: 0]
  ------------------
 3007|      0|                    {
 3008|      0|                        bHasFixedH2++;
 3009|      0|                    }
 3010|      0|                }
 3011|      0|            }
 3012|       |
 3013|       |            /* count the differences */
 3014|      0|            j1 = j2 = 0;
 3015|      0|            if (bHasFixedH1 && !bHasFixedH2)
  ------------------
  |  Branch (3015:17): [True: 0, False: 0]
  |  Branch (3015:32): [True: 0, False: 0]
  ------------------
 3016|      0|            {
 3017|      0|                for (i = 0; i < i1->nNumberOfAtoms; i++)
  ------------------
  |  Branch (3017:29): [True: 0, False: 0]
  ------------------
 3018|      0|                {
 3019|      0|                    if (i1->nNum_H_fixed[i] > 0)
  ------------------
  |  Branch (3019:25): [True: 0, False: 0]
  ------------------
 3020|      0|                    {
 3021|      0|                        j1++;
 3022|      0|                    }
 3023|      0|                    else
 3024|      0|                        if (i1->nNum_H_fixed[i] < 0)
  ------------------
  |  Branch (3024:29): [True: 0, False: 0]
  ------------------
 3025|      0|                        {
 3026|      0|                            j2++;
 3027|      0|                        }
 3028|      0|                }
 3029|      0|                return 18; /* Diff: Extra Fixed-H */
 3030|      0|            }
 3031|      0|            else
 3032|      0|            {
 3033|      0|                if (!bHasFixedH1 && bHasFixedH2)
  ------------------
  |  Branch (3033:21): [True: 0, False: 0]
  |  Branch (3033:37): [True: 0, False: 0]
  ------------------
 3034|      0|                {
 3035|      0|                    for (i = j1 = j2 = 0; i < i1->nNumberOfAtoms; i++)
  ------------------
  |  Branch (3035:43): [True: 0, False: 0]
  ------------------
 3036|      0|                    {
 3037|      0|                        if (0 > i2->nNum_H_fixed[i])
  ------------------
  |  Branch (3037:29): [True: 0, False: 0]
  ------------------
 3038|      0|                        {
 3039|      0|                            j1++;
 3040|      0|                        }
 3041|      0|                        else
 3042|      0|                            if (0 < i2->nNum_H_fixed[i])
  ------------------
  |  Branch (3042:33): [True: 0, False: 0]
  ------------------
 3043|      0|                            {
 3044|      0|                                j2++;
 3045|      0|                            }
 3046|      0|                    }
 3047|      0|                    return 19; /* Diff: Missed Fixed-H */
 3048|      0|                }
 3049|      0|                else
 3050|      0|                {
 3051|      0|                    if (bHasFixedH1 && bHasFixedH2 &&
  ------------------
  |  Branch (3051:25): [True: 0, False: 0]
  |  Branch (3051:40): [True: 0, False: 0]
  ------------------
 3052|      0|                         memcmp( i1->nNum_H_fixed, i2->nNum_H_fixed, i1->nNumberOfAtoms * sizeof( i1->nNum_H_fixed[0] ) ))
  ------------------
  |  Branch (3052:26): [True: 0, False: 0]
  ------------------
 3053|      0|                    {
 3054|      0|                        for (i = j1 = j2 = 0; i < i1->nNumberOfAtoms; i++)
  ------------------
  |  Branch (3054:47): [True: 0, False: 0]
  ------------------
 3055|      0|                        {
 3056|      0|                            if (i1->nNum_H_fixed[i] > i2->nNum_H_fixed[i])
  ------------------
  |  Branch (3056:33): [True: 0, False: 0]
  ------------------
 3057|      0|                            {
 3058|      0|                                j1++;
 3059|      0|                            }
 3060|      0|                            else
 3061|      0|                            {
 3062|      0|                                if (i1->nNum_H_fixed[i] < i2->nNum_H_fixed[i])
  ------------------
  |  Branch (3062:37): [True: 0, False: 0]
  ------------------
 3063|      0|                                {
 3064|      0|                                    j2++;
 3065|      0|                                }
 3066|      0|                            }
 3067|      0|                        }
 3068|      0|                    }
 3069|      0|                }
 3070|      0|            }
 3071|      0|            ret = ( j1 && j2 ) ? 20 : j1 ? 18 : j2 ? 19 : 0;
  ------------------
  |  Branch (3071:21): [True: 0, False: 0]
  |  Branch (3071:27): [True: 0, False: 0]
  |  Branch (3071:39): [True: 0, False: 0]
  |  Branch (3071:49): [True: 0, False: 0]
  ------------------
 3072|      0|            if (ret)
  ------------------
  |  Branch (3072:17): [True: 0, False: 0]
  ------------------
 3073|      0|            {
 3074|      0|                return ret; /* 20 => Diff: NotEql Fixed-H */
 3075|       |                            /* 19 => Diff: Missed Fixed-H (i1 has less) */
 3076|       |                            /* 18 => Diff: Extra Fixed-H  (i1 has more) */
 3077|      0|            }
 3078|      0|        }
 3079|  53.8k|    }
 3080|       |
 3081|  53.8k|    if (i1->lenConnTable != i2->lenConnTable)
  ------------------
  |  Branch (3081:9): [True: 0, False: 53.8k]
  ------------------
 3082|      0|    {
 3083|      0|        return 8; /* Diff: Connections length */
 3084|      0|    }
 3085|  53.8k|    if (i1->lenConnTable > 0 && memcmp( i1->nConnTable, i2->nConnTable, i1->lenConnTable * sizeof( i1->nConnTable[0] ) ))
  ------------------
  |  Branch (3085:9): [True: 53.8k, False: 0]
  |  Branch (3085:33): [True: 0, False: 53.8k]
  ------------------
 3086|      0|    {
 3087|      0|        return 9; /* Diff: Connections */
 3088|      0|    }
 3089|       |
 3090|       |    /* output special cases: different number of t-groups, different sizes of t-groups, different endpoints */
 3091|  53.8k|    if (i1->lenTautomer != i2->lenTautomer && ( i1->lenTautomer > 1 || i2->lenTautomer > 1 ))
  ------------------
  |  Branch (3091:9): [True: 0, False: 53.8k]
  |  Branch (3091:49): [True: 0, False: 0]
  |  Branch (3091:72): [True: 0, False: 0]
  ------------------
 3092|      0|    {
 3093|      0|        return 10; /* Diff: Mobile groups length */ /* in isotopic or deprotonated cases i1->lenTautomer == 1 && i1->nTautomer[0] = 0 */
 3094|      0|    }
 3095|  53.8k|    if (( i1->lenTautomer > 1 && i2->lenTautomer > 1 ) &&
  ------------------
  |  Branch (3095:11): [True: 0, False: 53.8k]
  |  Branch (3095:34): [True: 0, False: 0]
  ------------------
 3096|  53.8k|         memcmp( i1->nTautomer, i2->nTautomer, i1->lenTautomer * sizeof( i1->nTautomer[0] ) ))
  ------------------
  |  Branch (3096:10): [True: 0, False: 0]
  ------------------
 3097|      0|    {
 3098|      0|        return 11; /* Diff: Mobile groups */
 3099|      0|    }
 3100|       |
 3101|  53.8k|    if (i1->nNumberOfIsotopicAtoms != i2->nNumberOfIsotopicAtoms)
  ------------------
  |  Branch (3101:9): [True: 18, False: 53.8k]
  ------------------
 3102|     18|    {
 3103|     18|        return 12; /* Diff: Isotopic atoms number */
 3104|     18|    }
 3105|  53.8k|    if (i1->nNumberOfIsotopicAtoms > 0 && memcmp( i1->IsotopicAtom, i2->IsotopicAtom, i1->nNumberOfIsotopicAtoms * sizeof( i1->IsotopicAtom[0] ) ))
  ------------------
  |  Branch (3105:9): [True: 0, False: 53.8k]
  |  Branch (3105:43): [True: 0, False: 0]
  ------------------
 3106|      0|    {
 3107|      0|        return 13; /* Diff: Isotopic atoms */
 3108|      0|    }
 3109|  53.8k|    if (i1->nTotalCharge != i2->nTotalCharge)
  ------------------
  |  Branch (3109:9): [True: 0, False: 53.8k]
  ------------------
 3110|      0|    {
 3111|      0|        return 14; /* Diff: Charge */
 3112|      0|    }
 3113|       |
 3114|       |    /*
 3115|       |        if ( i1->nNumberOfIsotopicTGroups != i2->nNumberOfIsotopicTGroups )
 3116|       |        {
 3117|       |            return 14;
 3118|       |        }
 3119|       |        if ( i1->nNumberOfIsotopicTGroups > 0 && memcmp( i1->IsotopicTGroup, i2->IsotopicTGroup, i1->nNumberOfIsotopicTGroups*sizeof(i1->IsotopicTGroup[0]) ) )
 3120|       |        {
 3121|       |            return 15;
 3122|       |            }
 3123|       |    */
 3124|       |
 3125|  53.8k|    if (a1 && a2)
  ------------------
  |  Branch (3125:9): [True: 0, False: 53.8k]
  |  Branch (3125:15): [True: 0, False: 0]
  ------------------
 3126|      0|    {
 3127|      0|        if (a1->nNumRemovedProtons != a2->nNumRemovedProtons)
  ------------------
  |  Branch (3127:13): [True: 0, False: 0]
  ------------------
 3128|      0|        {
 3129|      0|            return 16; /* Diff: Number of removed protons */
 3130|      0|        }
 3131|      0|        if (memcmp( a1->nNumRemovedIsotopicH, a2->nNumRemovedIsotopicH, sizeof( a1->nNumRemovedIsotopicH ) ))
  ------------------
  |  Branch (3131:13): [True: 0, False: 0]
  ------------------
 3132|      0|        {
 3133|      0|            return 17; /* Diff: Removed isotopic H */
 3134|      0|        }
 3135|      0|    }
 3136|       |
 3137|       |    /*
 3138|       |        if ( i1->nPossibleLocationsOfIsotopicH && i2->nPossibleLocationsOfIsotopicH ) {
 3139|       |        {
 3140|       |            if ( i1->nPossibleLocationsOfIsotopicH[0] != i2->nPossibleLocationsOfIsotopicH[0] ||
 3141|       |                 memcmp(i1->nPossibleLocationsOfIsotopicH, i2->nPossibleLocationsOfIsotopicH,
 3142|       |                        sizeof(i1->nPossibleLocationsOfIsotopicH[0])*i1->nPossibleLocationsOfIsotopicH[0]) )
 3143|       |            {
 3144|       |                return 18;
 3145|       |            }
 3146|       |        }
 3147|       |        } else
 3148|       |        {
 3149|       |            if ( !i1->nPossibleLocationsOfIsotopicH != !i2->nPossibleLocationsOfIsotopicH ) {
 3150|       |            {
 3151|       |                return 19;}
 3152|       |            }
 3153|       |        }
 3154|       |    */
 3155|       |
 3156|       |    /* ret = 20..31 => 40..51 */
 3157|  53.8k|    if (ret = CompareReversedStereoINChI( i1->Stereo, i2->Stereo ))
  ------------------
  |  Branch (3157:9): [True: 0, False: 53.8k]
  ------------------
 3158|      0|    {
 3159|      0|        return ret + 20;
 3160|      0|    }
 3161|       |    /* ret = 40..51 => 60..71 */
 3162|       |
 3163|  53.8k|    if (!i2->StereoIsotopic && i2->Stereo && i1->StereoIsotopic &&
  ------------------
  |  Branch (3163:9): [True: 0, False: 53.8k]
  |  Branch (3163:32): [True: 0, False: 0]
  |  Branch (3163:46): [True: 0, False: 0]
  ------------------
 3164|  53.8k|         0 < ( i1->StereoIsotopic->nNumberOfStereoBonds + i1->StereoIsotopic->nNumberOfStereoCenters ) &&
  ------------------
  |  Branch (3164:10): [True: 0, False: 0]
  ------------------
 3165|  53.8k|         0 == CompareReversedStereoINChI( i1->StereoIsotopic, i2->Stereo ))
  ------------------
  |  Branch (3165:10): [True: 0, False: 0]
  ------------------
 3166|      0|    {
 3167|       |        /* InChI from reversed structure does not contain fully duplicated isotopic stereo */
 3168|      0|        ;
 3169|      0|    }
 3170|  53.8k|    else
 3171|  53.8k|    {
 3172|  53.8k|        if (ret = CompareReversedStereoINChI( i1->StereoIsotopic, i2->StereoIsotopic ))
  ------------------
  |  Branch (3172:13): [True: 0, False: 53.8k]
  ------------------
 3173|      0|        {
 3174|      0|            return ret + 40;
 3175|      0|        }
 3176|  53.8k|    }
 3177|       |
 3178|  53.8k|    return 0;
 3179|  53.8k|}
CompareReversedINChI2:
 3262|    811|{
 3263|    811|    INCHI_MODE ret = 0;
 3264|    811|    INChI_Stereo *Stereo1 = NULL, *Stereo2 = NULL;
 3265|    811|    int  n1, n2, m, j, j1, j2, ret2, num_H1, num_H2;
 3266|       |
 3267|    811|    *err = 0;
 3268|       |
 3269|    811|    memset( picr, 0, sizeof( *picr ) );
 3270|       |
 3271|    811|    if (i1 == NULL && i2 == NULL)
  ------------------
  |  Branch (3271:9): [True: 0, False: 811]
  |  Branch (3271:23): [True: 0, False: 0]
  ------------------
 3272|      0|    {
 3273|      0|        return 0;
 3274|      0|    }
 3275|    811|    if (( i1 == NULL ) ^ ( i2 == NULL ))
  ------------------
  |  Branch (3275:9): [True: 0, False: 811]
  ------------------
 3276|      0|    {
 3277|      0|        ret |= IDIF_PROBLEM; /* one InChI exists while another doesn't */
 3278|      0|        goto exit_function;
 3279|      0|    }
 3280|       |
 3281|    811|    if (i1->nErrorCode == i2->nErrorCode)
  ------------------
  |  Branch (3281:9): [True: 811, False: 0]
  ------------------
 3282|    811|    {
 3283|    811|        if (i1->nErrorCode)
  ------------------
  |  Branch (3283:13): [True: 0, False: 811]
  ------------------
 3284|      0|        {
 3285|      0|            ret |= IDIF_PROBLEM; /* both InChI have same error codes */
 3286|      0|            goto exit_function;
 3287|      0|        }
 3288|    811|    }
 3289|      0|    else
 3290|      0|    {
 3291|      0|        ret |= IDIF_PROBLEM; /* at least one InChI has an error code */
 3292|      0|        goto exit_function;
 3293|      0|    }
 3294|       |
 3295|    811|    if (i1->nNumberOfAtoms != i2->nNumberOfAtoms)
  ------------------
  |  Branch (3295:9): [True: 0, False: 811]
  ------------------
 3296|      0|    {
 3297|      0|        ret |= IDIF_NUM_AT;
 3298|      0|        goto exit_function;
 3299|      0|    }
 3300|    811|    if (i1->nNumberOfAtoms > 0)
  ------------------
  |  Branch (3300:9): [True: 811, False: 0]
  ------------------
 3301|    811|    {
 3302|    811|        if (memcmp( i1->nAtom, i2->nAtom, i1->nNumberOfAtoms * sizeof( i1->nAtom[0] ) ))
  ------------------
  |  Branch (3302:13): [True: 621, False: 190]
  ------------------
 3303|    621|        {
 3304|    621|            ret |= IDIF_ATOMS;
 3305|    621|            goto exit_function;
 3306|    621|        }
 3307|       |        /* IDIF_NON_TAUT_H,  IDIF_MORE_FH, IDIF_LESS_FH */
 3308|    190|        if (memcmp( i1->nNum_H, i2->nNum_H, i1->nNumberOfAtoms * sizeof( i1->nNum_H[0] ) ))
  ------------------
  |  Branch (3308:13): [True: 0, False: 190]
  ------------------
 3309|      0|        {
 3310|      0|            ret |= IDIF_POSITION_H;
 3311|      0|            for (j1 = 0; j1 < i1->nNumberOfAtoms; j1++)
  ------------------
  |  Branch (3311:26): [True: 0, False: 0]
  ------------------
 3312|      0|            {
 3313|      0|                if (i1->nNum_H[j1] != i2->nNum_H[j1] && picr->num_diff_pos_H < ICR_MAX_DIFF_FIXED_H)
  ------------------
  |  |  173|      0|#define ICR_MAX_DIFF_FIXED_H  32
  ------------------
  |  Branch (3313:21): [True: 0, False: 0]
  |  Branch (3313:57): [True: 0, False: 0]
  ------------------
 3314|      0|                {
 3315|      0|                    picr->diff_pos_H_at[picr->num_diff_pos_H] = j1;
 3316|      0|                    picr->diff_pos_H_nH[picr->num_diff_pos_H] = i1->nNum_H[j1] - i2->nNum_H[j1];
 3317|      0|                    picr->num_diff_pos_H++;
 3318|      0|                }
 3319|      0|            }
 3320|      0|        }
 3321|       |        /* fixed H */
 3322|    190|        if (i1->nNum_H_fixed || i2->nNum_H_fixed)
  ------------------
  |  Branch (3322:13): [True: 190, False: 0]
  |  Branch (3322:33): [True: 0, False: 0]
  ------------------
 3323|    190|        {
 3324|    190|            int bHasFixedH1 = 0, bHasFixedH2 = 0, i;
 3325|    190|            if (i1->nNum_H_fixed)
  ------------------
  |  Branch (3325:17): [True: 190, False: 0]
  ------------------
 3326|    190|            {
 3327|  1.08k|                for (i = 0; i < i1->nNumberOfAtoms; i++)
  ------------------
  |  Branch (3327:29): [True: 897, False: 190]
  ------------------
 3328|    897|                {
 3329|    897|                    if (i1->nNum_H_fixed[i])
  ------------------
  |  Branch (3329:25): [True: 0, False: 897]
  ------------------
 3330|      0|                    {
 3331|      0|                        bHasFixedH1++;
 3332|      0|                    }
 3333|    897|                }
 3334|    190|            }
 3335|    190|            if (i2->nNum_H_fixed)
  ------------------
  |  Branch (3335:17): [True: 0, False: 190]
  ------------------
 3336|      0|            {
 3337|      0|                for (i = 0; i < i2->nNumberOfAtoms; i++)
  ------------------
  |  Branch (3337:29): [True: 0, False: 0]
  ------------------
 3338|      0|                {
 3339|      0|                    if (i2->nNum_H_fixed[i])
  ------------------
  |  Branch (3339:25): [True: 0, False: 0]
  ------------------
 3340|      0|                    {
 3341|      0|                        bHasFixedH2++;
 3342|      0|                    }
 3343|      0|                }
 3344|      0|            }
 3345|    190|            if (bHasFixedH1 && !bHasFixedH2)
  ------------------
  |  Branch (3345:17): [True: 0, False: 190]
  |  Branch (3345:32): [True: 0, False: 0]
  ------------------
 3346|      0|            {
 3347|      0|                for (i = j = 0; i < i1->nNumberOfAtoms; i++)
  ------------------
  |  Branch (3347:33): [True: 0, False: 0]
  ------------------
 3348|      0|                {
 3349|      0|                    if (i1->nNum_H_fixed[i])
  ------------------
  |  Branch (3349:25): [True: 0, False: 0]
  ------------------
 3350|      0|                    {
 3351|      0|                        if (j < ICR_MAX_DIFF_FIXED_H)
  ------------------
  |  |  173|      0|#define ICR_MAX_DIFF_FIXED_H  32
  ------------------
  |  Branch (3351:29): [True: 0, False: 0]
  ------------------
 3352|      0|                        {
 3353|      0|                            picr->fixed_H_at1_more[j] = i;
 3354|      0|                            picr->fixed_H_nH1_more[j] = i1->nNum_H_fixed[i];
 3355|      0|                            j++;
 3356|      0|                        }
 3357|      0|                    }
 3358|      0|                }
 3359|      0|                picr->num_fixed_H1_more = j;
 3360|      0|                ret |= IDIF_MORE_FH; /* Extra Fixed-H */
 3361|      0|            }
 3362|    190|            else
 3363|    190|            {
 3364|    190|                if (!bHasFixedH1 && bHasFixedH2)
  ------------------
  |  Branch (3364:21): [True: 190, False: 0]
  |  Branch (3364:37): [True: 0, False: 190]
  ------------------
 3365|      0|                {
 3366|      0|                    for (i = j = 0; i < i2->nNumberOfAtoms; i++)
  ------------------
  |  Branch (3366:37): [True: 0, False: 0]
  ------------------
 3367|      0|                    {
 3368|      0|                        if (i2->nNum_H_fixed[i])
  ------------------
  |  Branch (3368:29): [True: 0, False: 0]
  ------------------
 3369|      0|                        {
 3370|      0|                            if (j < ICR_MAX_DIFF_FIXED_H)
  ------------------
  |  |  173|      0|#define ICR_MAX_DIFF_FIXED_H  32
  ------------------
  |  Branch (3370:33): [True: 0, False: 0]
  ------------------
 3371|      0|                            {
 3372|      0|                                picr->fixed_H_at2_more[j] = i;
 3373|      0|                                picr->fixed_H_nH2_more[j] = i2->nNum_H_fixed[i];
 3374|      0|                                j++;
 3375|      0|                            }
 3376|      0|                        }
 3377|      0|                    }
 3378|      0|                    picr->num_fixed_H2_more = j;
 3379|      0|                    ret |= IDIF_LESS_FH; /* Missed Fixed-H */
 3380|      0|                }
 3381|    190|                else
 3382|    190|                {
 3383|    190|                    if (bHasFixedH1 && bHasFixedH2 &&
  ------------------
  |  Branch (3383:25): [True: 0, False: 190]
  |  Branch (3383:40): [True: 0, False: 0]
  ------------------
 3384|    190|                            memcmp( i1->nNum_H_fixed, i2->nNum_H_fixed, i1->nNumberOfAtoms * sizeof( i1->nNum_H_fixed[0] ) ))
  ------------------
  |  Branch (3384:29): [True: 0, False: 0]
  ------------------
 3385|      0|                    {
 3386|      0|                        for (i = j1 = j2 = 0; i < i1->nNumberOfAtoms; i++)
  ------------------
  |  Branch (3386:47): [True: 0, False: 0]
  ------------------
 3387|      0|                        {
 3388|      0|                            if (i1->nNum_H_fixed[i] > i2->nNum_H_fixed[i])
  ------------------
  |  Branch (3388:33): [True: 0, False: 0]
  ------------------
 3389|      0|                            {
 3390|      0|                                if (j1 < ICR_MAX_DIFF_FIXED_H)
  ------------------
  |  |  173|      0|#define ICR_MAX_DIFF_FIXED_H  32
  ------------------
  |  Branch (3390:37): [True: 0, False: 0]
  ------------------
 3391|      0|                                {
 3392|      0|                                    picr->fixed_H_at1_more[j1] = i;
 3393|      0|                                    picr->fixed_H_nH1_more[j1] = i1->nNum_H_fixed[i] - i2->nNum_H_fixed[i];
 3394|      0|                                    j1++;
 3395|      0|                                }
 3396|      0|                            }
 3397|      0|                            else
 3398|      0|                            {
 3399|      0|                                if (i1->nNum_H_fixed[i] < i2->nNum_H_fixed[i])
  ------------------
  |  Branch (3399:37): [True: 0, False: 0]
  ------------------
 3400|      0|                                {
 3401|      0|                                    if (j2 < ICR_MAX_DIFF_FIXED_H)
  ------------------
  |  |  173|      0|#define ICR_MAX_DIFF_FIXED_H  32
  ------------------
  |  Branch (3401:41): [True: 0, False: 0]
  ------------------
 3402|      0|                                    {
 3403|      0|                                        picr->fixed_H_at2_more[j2] = i;
 3404|      0|                                        picr->fixed_H_nH2_more[j2] = i2->nNum_H_fixed[i] - i1->nNum_H_fixed[i];
 3405|      0|                                        j2++;
 3406|      0|                                    }
 3407|      0|                                }
 3408|      0|                            }
 3409|      0|                        }
 3410|      0|                        ret |= ( j1 ? IDIF_MORE_FH : 0 ) | ( j2 ? IDIF_LESS_FH : 0 );
  ------------------
  |  Branch (3410:34): [True: 0, False: 0]
  |  Branch (3410:62): [True: 0, False: 0]
  ------------------
 3411|      0|                        picr->num_fixed_H1_more = j1;
 3412|      0|                        picr->num_fixed_H2_more = j2;
 3413|      0|                    }
 3414|    190|                }
 3415|    190|            }
 3416|    190|        }
 3417|    190|    }
 3418|       |
 3419|       |    /* compare formulas and H */
 3420|    190|    num_H1 = 0;
 3421|    190|    num_H2 = 0;
 3422|    190|    ret2 = CompareHillFormulasNoH( i1->szHillFormula, i2->szHillFormula, &num_H1, &num_H2 );
 3423|    190|    picr->tot_num_H1 = num_H1;
 3424|    190|    picr->tot_num_H2 = num_H2;
 3425|    190|    if (ret2)
  ------------------
  |  Branch (3425:9): [True: 0, False: 190]
  ------------------
 3426|      0|    {
 3427|      0|        ret |= IDIF_NUM_EL;
 3428|      0|        goto exit_function;
 3429|      0|    }
 3430|    190|    if (num_H1 > num_H2)
  ------------------
  |  Branch (3430:9): [True: 6, False: 184]
  ------------------
 3431|      6|    {
 3432|      6|        ret |= IDIF_MORE_H;
 3433|      6|    }
 3434|    190|    if (num_H1 < num_H2)
  ------------------
  |  Branch (3434:9): [True: 32, False: 158]
  ------------------
 3435|     32|    {
 3436|     32|        ret |= IDIF_LESS_H;
 3437|     32|    }
 3438|    190|    if (i1->lenConnTable != i2->lenConnTable)
  ------------------
  |  Branch (3438:9): [True: 177, False: 13]
  ------------------
 3439|    177|    {
 3440|    177|        ret |= IDIF_CON_LEN;
 3441|    177|        goto exit_function;
 3442|    177|    }
 3443|     13|    else
 3444|     13|    {
 3445|     13|        if (i1->lenConnTable > 0 && memcmp( i1->nConnTable, i2->nConnTable, i1->lenConnTable * sizeof( i1->nConnTable[0] ) ))
  ------------------
  |  Branch (3445:13): [True: 13, False: 0]
  |  Branch (3445:37): [True: 0, False: 13]
  ------------------
 3446|      0|        {
 3447|      0|            ret |= IDIF_CON_TBL;
 3448|      0|            goto exit_function;
 3449|      0|        }
 3450|     13|    }
 3451|       |
 3452|       |    /* output special cases: different number of t-groups, different sizes of t-groups, different endpoints */
 3453|       |    /* in isotopic or deprotonated cases i1->lenTautomer == 1 && i1->nTautomer[0] = 0 */
 3454|       |
 3455|       |    /*
 3456|       |        if ( i1->lenTautomer != i2->lenTautomer && (i1->lenTautomer > 1 || i2->lenTautomer > 1) ) {
 3457|       |            ret |=  IDIF_TAUT_LEN;
 3458|       |        }
 3459|       |    */
 3460|       |
 3461|       |    /* compare number of t-groups */
 3462|     13|    n1 = i1->lenTautomer ? i1->nTautomer[0] : 0;
  ------------------
  |  Branch (3462:10): [True: 6, False: 7]
  ------------------
 3463|     13|    n2 = i2->lenTautomer ? i2->nTautomer[0] : 0;
  ------------------
  |  Branch (3463:10): [True: 0, False: 13]
  ------------------
 3464|     13|    if (!n1 && n2)
  ------------------
  |  Branch (3464:9): [True: 7, False: 6]
  |  Branch (3464:16): [True: 0, False: 7]
  ------------------
 3465|      0|    {
 3466|      0|        ret |= IDIF_NO_TAUT;
 3467|      0|    }
 3468|     13|    else
 3469|     13|    {
 3470|     13|        if (n1 && !n2)
  ------------------
  |  Branch (3470:13): [True: 6, False: 7]
  |  Branch (3470:19): [True: 6, False: 0]
  ------------------
 3471|      6|        {
 3472|      6|            ret |= IDIF_WRONG_TAUT;
 3473|      6|        }
 3474|      7|        else
 3475|      7|        {
 3476|      7|            if (n1 == 1 && n2 > 1)
  ------------------
  |  Branch (3476:17): [True: 0, False: 7]
  |  Branch (3476:28): [True: 0, False: 0]
  ------------------
 3477|      0|            {
 3478|      0|                ret |= IDIF_SINGLE_TG;
 3479|      0|            }
 3480|      7|            else
 3481|      7|            {
 3482|      7|                if (n1 > 1 && n2 == 1)
  ------------------
  |  Branch (3482:21): [True: 0, False: 7]
  |  Branch (3482:31): [True: 0, False: 0]
  ------------------
 3483|      0|                {
 3484|      0|                    ret |= IDIF_MULTIPLE_TG;
 3485|      0|                }
 3486|      7|                else
 3487|      7|                {
 3488|      7|                    if (n1 != n2)
  ------------------
  |  Branch (3488:25): [True: 0, False: 7]
  ------------------
 3489|      0|                    {
 3490|      0|                        ret |= IDIF_NUM_TG;
 3491|      0|                    }
 3492|      7|                }
 3493|      7|            }
 3494|      7|        }
 3495|     13|    }
 3496|       |
 3497|     13|    if (n1 || n2)
  ------------------
  |  Branch (3497:9): [True: 6, False: 7]
  |  Branch (3497:15): [True: 0, False: 7]
  ------------------
 3498|      6|    {
 3499|       |        /* number of endpoints */
 3500|      6|        int num1 = 0, num2 = 0, num_M1 = 0, num_M2 = 0;
 3501|      6|        int len, num_eq, num_in1_only, num_in2_only;
 3502|      6|        AT_NUMB *pe1 = (AT_NUMB *) inchi_malloc( ( i1->lenTautomer + 1 ) * sizeof( pe1[0] ) );
  ------------------
  |  | 1130|      6|#define inchi_malloc   malloc
  ------------------
 3503|      6|        AT_NUMB *pe2 = (AT_NUMB *) inchi_malloc( ( i2->lenTautomer + 1 ) * sizeof( pe2[0] ) );
  ------------------
  |  | 1130|      6|#define inchi_malloc   malloc
  ------------------
 3504|      6|        num_H1 = num_H2 = 0;
 3505|       |        /* collect endpoints, H, (-) */
 3506|      6|        if (!pe1 || !pe2)
  ------------------
  |  Branch (3506:13): [True: 0, False: 6]
  |  Branch (3506:21): [True: 0, False: 6]
  ------------------
 3507|      0|        {
 3508|      0|            if (pe1)
  ------------------
  |  Branch (3508:17): [True: 0, False: 0]
  ------------------
 3509|      0|            {
 3510|      0|                inchi_free( pe1 );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3511|      0|            }
 3512|      0|            if (pe2)
  ------------------
  |  Branch (3512:17): [True: 0, False: 0]
  ------------------
 3513|      0|            {
 3514|      0|                inchi_free( pe2 );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3515|      0|            }
 3516|      0|            *err = -1; /* allocation error */
 3517|      0|            goto exit_function;
 3518|      0|        }
 3519|     12|        for (m = 1; m < i1->lenTautomer; m += len)
  ------------------
  |  Branch (3519:21): [True: 6, False: 6]
  ------------------
 3520|      6|        {
 3521|      6|            len = i1->nTautomer[m++];
 3522|      6|            num_H1 += i1->nTautomer[m];
 3523|      6|            num_M1 += i1->nTautomer[m + 1];
 3524|     18|            for (j = 2; j < len; j++)
  ------------------
  |  Branch (3524:25): [True: 12, False: 6]
  ------------------
 3525|     12|            {
 3526|     12|                pe1[num1++] = i1->nTautomer[m + j];
 3527|     12|            }
 3528|      6|        }
 3529|      6|        for (m = 1; m < i2->lenTautomer; m += len)
  ------------------
  |  Branch (3529:21): [True: 0, False: 6]
  ------------------
 3530|      0|        {
 3531|      0|            len = i2->nTautomer[m++];
 3532|      0|            num_H2 += i2->nTautomer[m];
 3533|      0|            num_M2 += i2->nTautomer[m + 1];
 3534|      0|            for (j = 2; j < len; j++)
  ------------------
  |  Branch (3534:25): [True: 0, False: 0]
  ------------------
 3535|      0|            {
 3536|      0|                pe2[num2++] = i2->nTautomer[m + j];
 3537|      0|            }
 3538|      0|        }
 3539|      6|        picr->num_taut_H1 = num_H1;
 3540|      6|        picr->num_taut_H2 = num_H2;
 3541|      6|        picr->num_taut_M1 = num_M1;
 3542|      6|        picr->num_taut_M2 = num_M2;
 3543|       |        /* sort endpoints */
 3544|      6|        insertions_sort_AT_RANK( pe1, num1 );
 3545|      6|        insertions_sort_AT_RANK( pe2, num2 );
 3546|       |        /* compare */
 3547|       |        /*
 3548|       |        if ( num1 < num2 ) {
 3549|       |            ret |= IDIF_LESS_TG_ENDP;
 3550|       |        } else
 3551|       |        if ( num1 > num2 ) {
 3552|       |            ret |= IDIF_MORE_TG_ENDP;
 3553|       |        }
 3554|       |        */
 3555|       |        /* compare all */
 3556|      6|        num_eq = num_in1_only = num_in2_only = 0;
 3557|      6|        for (j1 = j2 = 0; j1 < num1 && j2 < num2; )
  ------------------
  |  Branch (3557:27): [True: 6, False: 0]
  |  Branch (3557:40): [True: 0, False: 6]
  ------------------
 3558|      0|        {
 3559|      0|            if (pe1[j1] == pe2[j2])
  ------------------
  |  Branch (3559:17): [True: 0, False: 0]
  ------------------
 3560|      0|            {
 3561|      0|                j1++;
 3562|      0|                j2++;
 3563|      0|                num_eq++;
 3564|      0|            }
 3565|      0|            else
 3566|      0|            {
 3567|      0|                if (pe1[j1] < pe2[j2])
  ------------------
  |  Branch (3567:21): [True: 0, False: 0]
  ------------------
 3568|      0|                { /* BC: fixed, was pe2[j1] 2006-03-27 */
 3569|      0|                    if (picr->num_endp_in1_only < ICR_MAX_ENDP_IN1_ONLY)
  ------------------
  |  |  171|      0|#define ICR_MAX_ENDP_IN1_ONLY 32
  ------------------
  |  Branch (3569:25): [True: 0, False: 0]
  ------------------
 3570|      0|                    {
 3571|      0|                        picr->endp_in1_only[picr->num_endp_in1_only++] = pe1[j1];
 3572|      0|                    }
 3573|      0|                    j1++;
 3574|      0|                    num_in1_only++;
 3575|      0|                }
 3576|      0|                else
 3577|      0|                {
 3578|      0|                    if (picr->num_endp_in2_only < ICR_MAX_ENDP_IN2_ONLY)
  ------------------
  |  |  172|      0|#define ICR_MAX_ENDP_IN2_ONLY 32
  ------------------
  |  Branch (3578:25): [True: 0, False: 0]
  ------------------
 3579|      0|                    {
 3580|      0|                        picr->endp_in2_only[picr->num_endp_in2_only++] = pe2[j2];
 3581|      0|                    }
 3582|      0|                    j2++;
 3583|      0|                    num_in2_only++;
 3584|      0|                }
 3585|      0|            }
 3586|      0|        }
 3587|     18|        while (j1 < num1)
  ------------------
  |  Branch (3587:16): [True: 12, False: 6]
  ------------------
 3588|     12|        {
 3589|     12|            if (picr->num_endp_in1_only < ICR_MAX_ENDP_IN1_ONLY)
  ------------------
  |  |  171|     12|#define ICR_MAX_ENDP_IN1_ONLY 32
  ------------------
  |  Branch (3589:17): [True: 12, False: 0]
  ------------------
 3590|     12|            {
 3591|     12|                picr->endp_in1_only[picr->num_endp_in1_only++] = pe1[j1];
 3592|     12|            }
 3593|     12|            j1++;
 3594|     12|            num_in1_only++;
 3595|     12|        }
 3596|      6|        while (j2 < num2)
  ------------------
  |  Branch (3596:16): [True: 0, False: 6]
  ------------------
 3597|      0|        {
 3598|      0|            if (picr->num_endp_in2_only < ICR_MAX_ENDP_IN2_ONLY)
  ------------------
  |  |  172|      0|#define ICR_MAX_ENDP_IN2_ONLY 32
  ------------------
  |  Branch (3598:17): [True: 0, False: 0]
  ------------------
 3599|      0|            {
 3600|      0|                picr->endp_in2_only[picr->num_endp_in2_only++] = pe2[j2];
 3601|      0|            }
 3602|      0|            j2++;
 3603|      0|            num_in2_only++;
 3604|      0|        }
 3605|      6|        if (num_in1_only)
  ------------------
  |  Branch (3605:13): [True: 6, False: 0]
  ------------------
 3606|      6|        {
 3607|      6|            ret |= IDIF_EXTRA_TG_ENDP;
 3608|      6|        }
 3609|      6|        if (num_in2_only)
  ------------------
  |  Branch (3609:13): [True: 0, False: 6]
  ------------------
 3610|      0|        {
 3611|      0|            ret |= IDIF_MISS_TG_ENDP;
 3612|      0|        }
 3613|      6|        if (!num_in1_only && !num_in2_only && num_eq)
  ------------------
  |  Branch (3613:13): [True: 0, False: 6]
  |  Branch (3613:30): [True: 0, False: 0]
  |  Branch (3613:47): [True: 0, False: 0]
  ------------------
 3614|      0|        {
 3615|      0|            ; /* same t-groups endpoints */
 3616|      0|        }
 3617|      6|        else
 3618|      6|        {
 3619|      6|            ret |= IDIF_DIFF_TG_ENDP;
 3620|      6|        }
 3621|      6|        inchi_free( pe1 );
  ------------------
  |  | 1136|      6|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 6, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3622|      6|        inchi_free( pe2 );
  ------------------
  |  | 1136|      6|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 6, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3623|      6|    }
 3624|       |
 3625|     13|    if (( i1->lenTautomer > 1 && i2->lenTautomer > 1 ) &&
  ------------------
  |  Branch (3625:11): [True: 6, False: 7]
  |  Branch (3625:34): [True: 0, False: 6]
  ------------------
 3626|     13|        ( i1->lenTautomer != i2->lenTautomer ||
  ------------------
  |  Branch (3626:11): [True: 0, False: 0]
  ------------------
 3627|      0|            memcmp( i1->nTautomer, i2->nTautomer, i1->lenTautomer * sizeof( i1->nTautomer[0] ) ) ))
  ------------------
  |  Branch (3627:13): [True: 0, False: 0]
  ------------------
 3628|      0|    {
 3629|      0|        ret |= IDIF_TG;
 3630|      0|    }
 3631|       |
 3632|     13|    if (i1->nNumberOfIsotopicAtoms != i2->nNumberOfIsotopicAtoms)
  ------------------
  |  Branch (3632:9): [True: 6, False: 7]
  ------------------
 3633|      6|    {
 3634|      6|        ret |= IDIF_NUM_ISO_AT;
 3635|      6|    }
 3636|      7|    else
 3637|      7|    {
 3638|      7|        if (i1->nNumberOfIsotopicAtoms > 0 && memcmp( i1->IsotopicAtom, i2->IsotopicAtom, i1->nNumberOfIsotopicAtoms * sizeof( i1->IsotopicAtom[0] ) ))
  ------------------
  |  Branch (3638:13): [True: 4, False: 3]
  |  Branch (3638:47): [True: 0, False: 4]
  ------------------
 3639|      0|        {
 3640|      0|            ret |= IDIF_ISO_AT;
 3641|      0|        }
 3642|      7|    }
 3643|     13|    if (i1->nTotalCharge != i2->nTotalCharge)
  ------------------
  |  Branch (3643:9): [True: 6, False: 7]
  ------------------
 3644|      6|    {
 3645|      6|        ret |= IDIF_CHARGE;
 3646|      6|    }
 3647|     13|    if (a1 && a1->nNumRemovedProtons && ( !a2 || a2->nNumRemovedProtons != a1->nNumRemovedProtons ))
  ------------------
  |  Branch (3647:9): [True: 13, False: 0]
  |  Branch (3647:15): [True: 6, False: 7]
  |  Branch (3647:43): [True: 6, False: 0]
  |  Branch (3647:50): [True: 0, False: 0]
  ------------------
 3648|      6|    {
 3649|      6|        ret |= IDIF_REM_PROT;
 3650|      6|    }
 3651|     13|    if (a1 && ( !a2 ||
  ------------------
  |  Branch (3651:9): [True: 13, False: 0]
  |  Branch (3651:17): [True: 13, False: 0]
  ------------------
 3652|     13|        a2->nNumRemovedIsotopicH[0] != a1->nNumRemovedIsotopicH[0] ||
  ------------------
  |  Branch (3652:9): [True: 0, False: 0]
  ------------------
 3653|     13|        a2->nNumRemovedIsotopicH[1] != a1->nNumRemovedIsotopicH[1] ||
  ------------------
  |  Branch (3653:9): [True: 0, False: 0]
  ------------------
 3654|     13|        a2->nNumRemovedIsotopicH[2] != a1->nNumRemovedIsotopicH[2] ))
  ------------------
  |  Branch (3654:9): [True: 0, False: 0]
  ------------------
 3655|     13|    {
 3656|     13|        ret |= IDIF_REM_ISO_H;
 3657|     13|    }
 3658|       |
 3659|       |    /*
 3660|       |    if ( i1->nPossibleLocationsOfIsotopicH && i2->nPossibleLocationsOfIsotopicH ) {
 3661|       |        if ( i1->nPossibleLocationsOfIsotopicH[0] != i2->nPossibleLocationsOfIsotopicH[0] ||
 3662|       |             memcmp(i1->nPossibleLocationsOfIsotopicH, i2->nPossibleLocationsOfIsotopicH,
 3663|       |                    sizeof(i1->nPossibleLocationsOfIsotopicH[0])*i1->nPossibleLocationsOfIsotopicH[0]) )
 3664|       |            return 18;
 3665|       |    } else
 3666|       |    if ( !i1->nPossibleLocationsOfIsotopicH != !i2->nPossibleLocationsOfIsotopicH ) {
 3667|       |        return 19;
 3668|       |    }
 3669|       |    */
 3670|       |
 3671|     13|    if (i1->StereoIsotopic &&
  ------------------
  |  Branch (3671:9): [True: 13, False: 0]
  ------------------
 3672|     13|         i1->StereoIsotopic->nNumberOfStereoBonds + i1->StereoIsotopic->nNumberOfStereoCenters)
  ------------------
  |  Branch (3672:10): [True: 0, False: 13]
  ------------------
 3673|      0|    {
 3674|      0|        Stereo1 = i1->StereoIsotopic;
 3675|      0|    }
 3676|     13|    else
 3677|     13|    {
 3678|     13|        Stereo1 = i1->Stereo;
 3679|     13|    }
 3680|     13|    if (i2->StereoIsotopic &&
  ------------------
  |  Branch (3680:9): [True: 0, False: 13]
  ------------------
 3681|     13|         i2->StereoIsotopic->nNumberOfStereoBonds + i2->StereoIsotopic->nNumberOfStereoCenters)
  ------------------
  |  Branch (3681:10): [True: 0, False: 0]
  ------------------
 3682|      0|    {
 3683|      0|        Stereo2 = i2->StereoIsotopic;
 3684|      0|    }
 3685|     13|    else
 3686|     13|    {
 3687|     13|        Stereo2 = i2->Stereo;
 3688|     13|    }
 3689|     13|    ret |= CompareReversedStereoINChI2( Stereo1, Stereo2, picr );
 3690|       |
 3691|    811|exit_function:
 3692|       |
 3693|    811|    picr->flags = ret;
 3694|       |
 3695|    811|    return ret;
 3696|     13|}
Create_INChI:
 3716|   110k|{
 3717|       |/*
 3718|       |#define NON_TAUT 0
 3719|       |#define TAUT     1
 3720|       |*/
 3721|   110k|    int nebend = 0, *ebend = NULL;
 3722|       |
 3723|   110k|    sp_ATOM  *at[TAUT_NUM]; /* at[0]=>non-tautomeric, at[1]=>tautomeric */
 3724|   110k|    int                       i, n1, n2, num_atoms, num_at_tg, num_removed_H, num_removed_H_taut = 0, ret = 0, ret2 = 0;
 3725|   110k|    INCHI_MODE                 nMode = 0;
 3726|   110k|    T_GROUP_INFO              vt_group_info;
 3727|   110k|    T_GROUP_INFO              vt_group_info_orig;
 3728|   110k|    T_GROUP_INFO * /*const*/  t_group_info = &vt_group_info;
 3729|   110k|    T_GROUP_INFO * /*const*/  t_group_info_orig = &vt_group_info_orig;
 3730|       |
 3731|   110k|    CANON_STAT  CS, CS2;
 3732|   110k|    CANON_STAT *pCS = &CS;
 3733|   110k|    CANON_STAT *pCS2 = &CS2;  /*  save all allocations to avoid memory leaks in case Canon_INChI() removes the pointer */
 3734|       |
 3735|   110k|    ATOM_SIZES  s[TAUT_NUM];
 3736|       |
 3737|   110k|    BCN Bcn;
 3738|   110k|    BCN *pBCN = &Bcn;
 3739|       |
 3740|   110k|    int bHasIsotopicAtoms = 0;
 3741|   110k|    int bMayHaveStereo = 0;
 3742|   110k|    int num_taut_at = 0;
 3743|       |
 3744|   110k|    inp_ATOM *out_at = NULL;     /*, *norm_at_fixed_bonds[TAUT_NUM]; */ /*  = {out_norm_nontaut_at, out_norm_taut_at} ; */
 3745|   110k|    INChI     *pINChI = NULL;      /* added initialization 2006-03 */
 3746|   110k|    INChI_Aux *pINChI_Aux = NULL;  /* added initialization 2006-03 */
 3747|   110k|    int        bPointedEdgeStereo = ( ( TG_FLAG_POINTED_EDGE_STEREO & *pbTautFlags ) ? PES_BIT_POINT_EDGE_STEREO : 0 )
  ------------------
  |  |  940|   110k|#define TG_FLAG_POINTED_EDGE_STEREO      0x00002000   /* only pointed edge of stereo bond defines stereo */
  ------------------
                  int        bPointedEdgeStereo = ( ( TG_FLAG_POINTED_EDGE_STEREO & *pbTautFlags ) ? PES_BIT_POINT_EDGE_STEREO : 0 )
  ------------------
  |  |   72|   110k|#define PES_BIT_POINT_EDGE_STEREO    1
  ------------------
  |  Branch (3747:39): [True: 110k, False: 0]
  ------------------
 3748|   110k|        | ( ( TG_FLAG_PHOSPHINE_STEREO    & *pbTautFlags ) ? PES_BIT_PHOSPHINE_STEREO : 0 )
  ------------------
  |  |  944|   110k|#define TG_FLAG_PHOSPHINE_STEREO         0x00008000   /* add phosphine sp3 stereo */
  ------------------
                      | ( ( TG_FLAG_PHOSPHINE_STEREO    & *pbTautFlags ) ? PES_BIT_PHOSPHINE_STEREO : 0 )
  ------------------
  |  |   73|      0|#define PES_BIT_PHOSPHINE_STEREO     2
  ------------------
  |  Branch (3748:13): [True: 0, False: 110k]
  ------------------
 3749|   110k|        | ( ( TG_FLAG_ARSINE_STEREO       & *pbTautFlags ) ? PES_BIT_ARSINE_STEREO : 0 )
  ------------------
  |  |  945|   110k|#define TG_FLAG_ARSINE_STEREO            0x00010000   /* add arsine sp3 stereo */
  ------------------
                      | ( ( TG_FLAG_ARSINE_STEREO       & *pbTautFlags ) ? PES_BIT_ARSINE_STEREO : 0 )
  ------------------
  |  |   74|      0|#define PES_BIT_ARSINE_STEREO        4
  ------------------
  |  Branch (3749:13): [True: 0, False: 110k]
  ------------------
 3750|   110k|        | ( ( TG_FLAG_FIX_SP3_BUG         & *pbTautFlags ) ? PES_BIT_FIX_SP3_BUG : 0 );
  ------------------
  |  |  947|   110k|#define TG_FLAG_FIX_SP3_BUG              0x00040000   /* fix sp3 stereo bug: overlapping 2D stereo bond & coordinate scaling */
  ------------------
                      | ( ( TG_FLAG_FIX_SP3_BUG         & *pbTautFlags ) ? PES_BIT_FIX_SP3_BUG : 0 );
  ------------------
  |  |   75|      0|#define PES_BIT_FIX_SP3_BUG          8
  ------------------
  |  Branch (3750:13): [True: 0, False: 110k]
  ------------------
 3751|   110k|    INCHI_MODE bTautFlags = ( *pbTautFlags     & ( ~(INCHI_MODE) TG_FLAG_ALL_TAUTOMERIC ) );
  ------------------
  |  |  929|   110k|#define TG_FLAG_ALL_TAUTOMERIC          (TG_FLAG_TEST_TAUT__ATOMS| \
  |  |  ------------------
  |  |  |  |  921|   110k|#define TG_FLAG_TEST_TAUT__ATOMS         0x00000001   /* find regular tautomerism */
  |  |  ------------------
  |  |  930|   110k|                                         TG_FLAG_TEST_TAUT__SALTS| \
  |  |  ------------------
  |  |  |  |  923|   110k|#define TG_FLAG_TEST_TAUT__SALTS         0x00000004   /* DISCONNECT_SALTS if possible find long-range H/(-) taut. on =C-OH, >C=O    */
  |  |  ------------------
  |  |  931|   110k|                                         TG_FLAG_TEST_TAUT2_SALTS| \
  |  |  ------------------
  |  |  |  |  925|   110k|#define TG_FLAG_TEST_TAUT2_SALTS         0x00000010   /* TEST_REMOVE_S_ATOMS multi-attachement long-range H/(-) taut. on =C-OH, >C=O   */
  |  |  ------------------
  |  |  932|   110k|                                         TG_FLAG_MERGE_TAUT_SALTS)
  |  |  ------------------
  |  |  |  |  927|   110k|#define TG_FLAG_MERGE_TAUT_SALTS         0x00000040   /* DISCONNECT_SALTS merge all "salt"-t-groups and other =C-OH into one t-group */
  |  |  ------------------
  ------------------
 3752|   110k|    INCHI_MODE bTautFlagsDone = ( *pbTautFlagsDone /*& (~(INCHI_MODE)TG_FLAG_ALL_TAUTOMERIC) */ );
 3753|       |#if ( bRELEASE_VERSION == 0 )
 3754|       |    int bExtract = 0; /*  EXTR_HAS_ATOM_WITH_DEFINED_PARITY; */
 3755|       |#endif
 3756|       |
 3757|       |/* */
 3758|   110k|    int bFixIsoFixedH = 0;
 3759|   110k|    int bFixTermHChrg = 0;
 3760|       |
 3761|   110k|    int LargeMolecules = ip->bLargeMolecules;
 3762|   110k|    int Polymers;
 3763|       |
 3764|       |    /*    vABParityUnknown holds actual value of an internal constant signifying
 3765|       |        unknown parity: either the same as for undefined parity (default==standard)
 3766|       |        or a specific one (non-std; requested by SLUUD switch).                 */
 3767|   110k|    int vABParityUnknown = AB_PARITY_UNDF;
  ------------------
  |  |  250|   110k|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 3768|   110k|    if (0 != ( nUserMode & REQ_MODE_DIFF_UU_STEREO ))
  ------------------
  |  |   68|   110k|#define REQ_MODE_DIFF_UU_STEREO     0x004000    /* SLUUD Make labels for unknown and undefined stereo different */
  ------------------
  |  Branch (3768:9): [True: 0, False: 110k]
  ------------------
 3769|      0|    {
 3770|       |        /* Make labels for unknown and undefined stereo different */
 3771|      0|        vABParityUnknown = AB_PARITY_UNKN;
  ------------------
  |  |  249|      0|#define AB_PARITY_UNKN   3  /* 3 => user marked as unknown parity */
  ------------------
 3772|      0|    }
 3773|       |
 3774|   110k|    Polymers = ip->bPolymers; /* keep compiler happy */ Polymers;
 3775|       |
 3776|   110k|#if ( FIX_ISO_FIXEDH_BUG == 1 )
 3777|   110k|    if (TG_FLAG_FIX_ISO_FIXEDH_BUG & *pbTautFlags)
  ------------------
  |  |  953|   110k|#define TG_FLAG_FIX_ISO_FIXEDH_BUG       0x00200000   /* fix bug found after v.102b (isotopic H representation)  */
  ------------------
  |  Branch (3777:9): [True: 110k, False: 0]
  ------------------
 3778|   110k|        bFixIsoFixedH = 1;
 3779|   110k|#endif
 3780|   110k|#if ( FIX_TERM_H_CHRG_BUG == 1 )
 3781|   110k|    if (TG_FLAG_FIX_TERM_H_CHRG_BUG & *pbTautFlags)
  ------------------
  |  |  954|   110k|#define TG_FLAG_FIX_TERM_H_CHRG_BUG      0x00400000   /* fix bug found after v.102b (moving H charge in 'remove_terminal_HDT') */
  ------------------
  |  Branch (3781:9): [True: 110k, False: 0]
  ------------------
 3782|   110k|        bFixTermHChrg = 1;
 3783|   110k|#endif
 3784|       |
 3785|       |#ifdef FIX_SRU_CYCLIZING_PS_BONDS_IN_BNS
 3786|       |    /* Polymer related */
 3787|       |    if (orig_inp_data && orig_inp_data->polymer && orig_inp_data->polymer->n > 0 && orig_inp_data->polymer->valid)
 3788|       |    {
 3789|       |        int j, jj;
 3790|       |        nebend = 0;
 3791|       |        for (j = 0; j < orig_inp_data->polymer->n; j++)
 3792|       |            if (orig_inp_data->polymer->units[j]->cyclized == 1)
 3793|       |                nebend++;
 3794|       |        if (nebend)
 3795|       |        {
 3796|       |            nebend *= 2;
 3797|       |            ebend = inchi_calloc( 2 * nebend, sizeof( int ) );
 3798|       |            if (!ebend)
 3799|       |            {
 3800|       |                ret = CT_OUT_OF_RAM; goto exit_function;
 3801|       |            }
 3802|       |            jj = 0;
 3803|       |            for (j = 0; j < orig_inp_data->polymer->n; j++)
 3804|       |            {
 3805|       |                if (orig_inp_data->polymer->units[j]->cyclized == 1)
 3806|       |                {
 3807|       |                    ebend[jj] = orig_inp_data->polymer->units[j]->end_atom1;
 3808|       |                    ebend[jj + 1] = orig_inp_data->polymer->units[j]->end_atom2;
 3809|       |                    jj += 2;
 3810|       |                }
 3811|       |            }
 3812|       |        }
 3813|       |    }
 3814|       |#endif
 3815|       |
 3816|   110k|    memset( s, 0, sizeof( s ) );
 3817|   110k|    if (pBCN)
  ------------------
  |  Branch (3817:9): [True: 110k, False: 0]
  ------------------
 3818|   110k|    {
 3819|   110k|        memset( pBCN, 0, sizeof( pBCN[0] ) );
 3820|   110k|    }
 3821|   110k|    memset( t_group_info, 0, sizeof( *t_group_info ) );
 3822|   110k|    memset( t_group_info_orig, 0, sizeof( *t_group_info_orig ) );
 3823|       |    /*norm_at[TAUT_NON] = out_norm_data[TAUT_NON]->at; *//* output normalized non-tautomeric component */
 3824|       |    /*norm_at[TAUT_YES] = out_norm_data[TAUT_YES]->at; *//* output normalized tautomeric component */
 3825|       |    /*norm_at_fixed_bonds[TAUT_NON] = NULL;*/
 3826|       |    /*norm_at_fixed_bonds[TAUT_YES] = out_norm_data[TAUT_YES]->at_fixed_bonds;*/
 3827|   330k|    for (i = 0; i < TAUT_NUM; i++)
  ------------------
  |  |  578|   330k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (3827:17): [True: 220k, False: 110k]
  ------------------
 3828|   220k|    {
 3829|   220k|        if (out_norm_data[i]->at)
  ------------------
  |  Branch (3829:13): [True: 110k, False: 109k]
  ------------------
 3830|   110k|        {
 3831|   110k|            if (!( at[i] = (sp_ATOM  *) inchi_malloc( num_inp_at * sizeof( *at[0] ) ) ))
  ------------------
  |  | 1130|   110k|#define inchi_malloc   malloc
  ------------------
  |  Branch (3831:17): [True: 0, False: 110k]
  ------------------
 3832|      0|            {
 3833|      0|                ret = -1;
 3834|      0|            }
 3835|   110k|        }
 3836|   109k|        else
 3837|   109k|        {
 3838|   109k|            at[i] = NULL;
 3839|   109k|        }
 3840|   220k|    }
 3841|   110k|    if (!out_norm_data[TAUT_NON]->at && !out_norm_data[TAUT_YES]->at
  ------------------
  |  |  579|   110k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                  if (!out_norm_data[TAUT_NON]->at && !out_norm_data[TAUT_YES]->at
  ------------------
  |  |  580|   109k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3841:9): [True: 109k, False: 38]
  |  Branch (3841:41): [True: 0, False: 109k]
  ------------------
 3842|   110k|         || !inp_at || ret)
  ------------------
  |  Branch (3842:13): [True: 0, False: 110k]
  |  Branch (3842:24): [True: 0, False: 110k]
  ------------------
 3843|      0|    {
 3844|      0|        ret = -1;
 3845|      0|        goto exit_function;
 3846|      0|    }
 3847|       |
 3848|       |    /* the first struct to process: tautomeric if exists else non-tautomeric */
 3849|   110k|    out_at = out_norm_data[TAUT_YES]->at ? out_norm_data[TAUT_YES]->at : out_norm_data[TAUT_NON]->at;
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  out_at = out_norm_data[TAUT_YES]->at ? out_norm_data[TAUT_YES]->at : out_norm_data[TAUT_NON]->at;
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  out_at = out_norm_data[TAUT_YES]->at ? out_norm_data[TAUT_YES]->at : out_norm_data[TAUT_NON]->at;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (3849:14): [True: 110k, False: 0]
  ------------------
 3850|       |    /* copy the input structure to be normalized to the buffer for the normalization data */
 3851|   110k|    memcpy( out_at, inp_at, num_inp_at * sizeof( out_at[0] ) );
 3852|       |
 3853|       |    /*  tautomeric groups setting */
 3854|   110k|    t_group_info->bIgnoreIsotopic = 0;   /*  include tautomeric group isotopic info in MarkTautomerGroups() */
 3855|   110k|    t_group_info->bTautFlags = *pbTautFlags;
 3856|   110k|    t_group_info->bTautFlagsDone = *pbTautFlagsDone;
 3857|       |
 3858|       |    /*
 3859|       |        Preprocess the structure
 3860|       |        (here THE NUMBER OF ATOMS MAY BE REDUCED)
 3861|       |    */
 3862|       |
 3863|       |    /*  ??? Ambiguity: H-D may become HD or DH
 3864|       |        (that is, H+implicit D or D+implicit H)    */
 3865|   110k|    if (TG_FLAG_H_ALREADY_REMOVED & bTautFlags)
  ------------------
  |  |  946|   110k|#define TG_FLAG_H_ALREADY_REMOVED        0x00020000   /* processing structure restored from InChI */
  ------------------
  |  Branch (3865:9): [True: 55.4k, False: 54.6k]
  ------------------
 3866|  55.4k|    {
 3867|  55.4k|        INP_ATOM_DATA *out_norm_data1 = out_norm_data[TAUT_YES]->at ? out_norm_data[TAUT_YES] :
  ------------------
  |  |  580|  55.4k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                      INP_ATOM_DATA *out_norm_data1 = out_norm_data[TAUT_YES]->at ? out_norm_data[TAUT_YES] :
  ------------------
  |  |  580|  55.4k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3867:41): [True: 55.4k, False: 0]
  ------------------
 3868|  55.4k|            out_norm_data[TAUT_NON]->at ? out_norm_data[TAUT_NON] : NULL;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                          out_norm_data[TAUT_NON]->at ? out_norm_data[TAUT_NON] : NULL;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (3868:13): [True: 0, False: 0]
  ------------------
 3869|  55.4k|        if (out_norm_data1)
  ------------------
  |  Branch (3869:13): [True: 55.4k, False: 0]
  ------------------
 3870|  55.4k|        {
 3871|  55.4k|            num_at_tg =
 3872|  55.4k|                num_atoms = out_norm_data1->num_at - out_norm_data1->num_removed_H;
 3873|  55.4k|            num_removed_H = out_norm_data1->num_removed_H;
 3874|  55.4k|            t_group_info->tni.nNumRemovedExplicitH = num_removed_H;
 3875|  55.4k|        }
 3876|      0|        else
 3877|      0|        {
 3878|      0|            ret = -1;
 3879|      0|            goto exit_function;
 3880|      0|        }
 3881|  55.4k|    }
 3882|  54.6k|    else
 3883|  54.6k|    {
 3884|  54.6k|        num_at_tg = num_atoms = remove_terminal_HDT( num_inp_at, out_at, bFixTermHChrg );
 3885|  54.6k|        num_removed_H = num_inp_at - num_atoms;
 3886|  54.6k|        t_group_info->tni.nNumRemovedExplicitH = num_removed_H;
 3887|  54.6k|        add_DT_to_num_H( num_atoms, out_at );
 3888|  54.6k|    }
 3889|       |    /*fix_odd_things( num_atoms, out_at );*/
 3890|   110k|#if ( FIND_RING_SYSTEMS == 1 )
 3891|   110k|    MarkRingSystemsInp( out_at, num_atoms, 0 );
 3892|   110k|#endif
 3893|       |    /*  duplicate the preprocessed structure so that all supplied out_norm_data[]->at buffers are filled */
 3894|   110k|    if (out_at != out_norm_data[TAUT_YES]->at && out_norm_data[TAUT_YES]->at)
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  if (out_at != out_norm_data[TAUT_YES]->at && out_norm_data[TAUT_YES]->at)
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3894:9): [True: 0, False: 110k]
  |  Branch (3894:50): [True: 0, False: 0]
  ------------------
 3895|      0|    {
 3896|      0|        memcpy( out_norm_data[TAUT_YES]->at, out_at, num_inp_at * sizeof( out_at[0] ) );
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3897|      0|    }
 3898|   110k|    if (out_norm_data[TAUT_YES]->at_fixed_bonds && out_norm_data[TAUT_YES]->at)
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  if (out_norm_data[TAUT_YES]->at_fixed_bonds && out_norm_data[TAUT_YES]->at)
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3898:9): [True: 110k, False: 0]
  |  Branch (3898:52): [True: 110k, False: 0]
  ------------------
 3899|   110k|    {
 3900|   110k|        memcpy( out_norm_data[TAUT_YES]->at_fixed_bonds, out_at, num_inp_at * sizeof( out_at[0] ) );
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3901|   110k|    }
 3902|   110k|    if (out_at != out_norm_data[TAUT_NON]->at && out_norm_data[TAUT_NON]->at)
  ------------------
  |  |  579|   110k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                  if (out_at != out_norm_data[TAUT_NON]->at && out_norm_data[TAUT_NON]->at)
  ------------------
  |  |  579|   110k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (3902:9): [True: 110k, False: 0]
  |  Branch (3902:50): [True: 38, False: 109k]
  ------------------
 3903|     38|    {
 3904|     38|        memcpy( out_norm_data[TAUT_NON]->at, out_at, num_inp_at * sizeof( out_at[0] ) );
  ------------------
  |  |  579|     38|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 3905|     38|    }
 3906|       |
 3907|       |    /*
 3908|       |      ??? not true ??? duplicate inp_at and keep inp_at[] unchanged after terminal hydrogens removal
 3909|       |      set stereo parities in taut_at[], non_taut_at[]
 3910|       |      obtain max. lenghts of the name stereo parts
 3911|       |      Ignore absence/presence of isotopic stereo for now
 3912|       |      mark isotopic atoms
 3913|       |    */
 3914|   110k|    if (out_norm_data[TAUT_YES]->at && at[TAUT_YES])
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  if (out_norm_data[TAUT_YES]->at && at[TAUT_YES])
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3914:9): [True: 110k, False: 0]
  |  Branch (3914:40): [True: 110k, False: 0]
  ------------------
 3915|   110k|    {
 3916|       |        /* final normalization of possibly tautomeric structure */
 3917|   110k|        ret = mark_alt_bonds_and_taut_groups( ic, pCG,
 3918|   110k|                                              out_norm_data[TAUT_YES]->at,
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3919|   110k|                                              out_norm_data[TAUT_YES]->at_fixed_bonds,
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3920|   110k|                                              num_atoms, ulMaxTime, t_group_info,
 3921|   110k|                                              NULL, NULL,
 3922|   110k|                                              nebend, ebend );
 3923|   110k|        if (ret < 0)
  ------------------
  |  Branch (3923:13): [True: 0, False: 110k]
  ------------------
 3924|      0|        {
 3925|      0|            goto exit_function;/*  out of RAM or other normalization problem */
 3926|      0|        }
 3927|   110k|        num_taut_at = ret; /* number of atoms without removed H? */
 3928|   110k|        num_removed_H_taut = t_group_info->tni.nNumRemovedExplicitH;
 3929|   110k|        out_norm_data[TAUT_YES]->num_at = num_atoms + num_removed_H_taut; /* protons might have been removed */
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3930|   110k|        out_norm_data[TAUT_YES]->num_removed_H = num_removed_H_taut;
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3931|   110k|        out_norm_data[TAUT_YES]->nNumRemovedProtons += t_group_info->tni.nNumRemovedProtons;
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3932|   440k|        for (i = 0; i < NUM_H_ISOTOPES; i++)
  ------------------
  |  |  100|   440k|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (3932:21): [True: 330k, False: 110k]
  ------------------
 3933|   330k|        {
 3934|   330k|            out_norm_data[TAUT_YES]->nNumRemovedProtonsIsotopic[i] +=
  ------------------
  |  |  580|   330k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3935|   330k|                t_group_info->tni.nNumRemovedProtonsIsotopic[i] /*+ t_group_info->num_iso_H[i]*/;
 3936|   330k|            out_norm_data[TAUT_YES]->num_iso_H[i] +=
  ------------------
  |  |  580|   330k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3937|   330k|                t_group_info->num_iso_H[i];
 3938|   330k|        }
 3939|       |        /* mark deleted isolated tautomeric H(+) */
 3940|   110k|        if (num_taut_at == 1 &&
  ------------------
  |  Branch (3940:13): [True: 109k, False: 804]
  ------------------
 3941|   110k|             out_norm_data[TAUT_YES]->at[0].at_type == ATT_PROTON &&
  ------------------
  |  |  580|   109k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                           out_norm_data[TAUT_YES]->at[0].at_type == ATT_PROTON &&
  ------------------
  |  |   75|   219k|#define ATT_PROTON       0x1000
  ------------------
  |  Branch (3941:14): [True: 1, False: 109k]
  ------------------
 3942|   110k|             t_group_info && t_group_info->tni.nNumRemovedProtons == 1)
  ------------------
  |  Branch (3942:14): [True: 1, False: 0]
  |  Branch (3942:30): [True: 1, False: 0]
  ------------------
 3943|      1|        {
 3944|      1|            out_norm_data[TAUT_YES]->bDeleted = 1;
  ------------------
  |  |  580|      1|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3945|      1|            FreeInpAtom( &out_norm_data[TAUT_YES]->at_fixed_bonds );
  ------------------
  |  |  580|      1|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3946|      1|        }
 3947|   110k|        else
 3948|   110k|        {
 3949|   110k|            if (( t_group_info->tni.bNormalizationFlags & FLAG_NORM_CONSIDER_TAUT ) &&
  ------------------
  |  |  184|   110k|#define FLAG_NORM_CONSIDER_TAUT      ( FLAG_PROTON_NPO_SIMPLE_REMOVED | \
  |  |  ------------------
  |  |  |  |  174|   110k|#define FLAG_PROTON_NPO_SIMPLE_REMOVED 0x0001
  |  |  ------------------
  |  |  185|   110k|                                       FLAG_PROTON_NP_HARD_REMOVED    | \
  |  |  ------------------
  |  |  |  |  175|   110k|#define FLAG_PROTON_NP_HARD_REMOVED    0x0002
  |  |  ------------------
  |  |  186|   110k|                                       FLAG_PROTON_AC_SIMPLE_ADDED    | \
  |  |  ------------------
  |  |  |  |  176|   110k|#define FLAG_PROTON_AC_SIMPLE_ADDED    0x0004
  |  |  ------------------
  |  |  187|   110k|                                       FLAG_PROTON_AC_SIMPLE_REMOVED  | \
  |  |  ------------------
  |  |  |  |  177|   110k|#define FLAG_PROTON_AC_SIMPLE_REMOVED  0x0008
  |  |  ------------------
  |  |  188|   110k|                                       FLAG_PROTON_AC_HARD_REMOVED    | \
  |  |  ------------------
  |  |  |  |  178|   110k|#define FLAG_PROTON_AC_HARD_REMOVED    0x0010
  |  |  ------------------
  |  |  189|   110k|                                       FLAG_PROTON_AC_HARD_ADDED      | \
  |  |  ------------------
  |  |  |  |  179|   110k|#define FLAG_PROTON_AC_HARD_ADDED      0x0020
  |  |  ------------------
  |  |  190|   110k|                                       FLAG_PROTON_SINGLE_REMOVED     | \
  |  |  ------------------
  |  |  |  |  181|   110k|#define FLAG_PROTON_SINGLE_REMOVED     0x0080
  |  |  ------------------
  |  |  191|   110k|                                       FLAG_PROTON_CHARGE_CANCEL    )
  |  |  ------------------
  |  |  |  |  180|   110k|#define FLAG_PROTON_CHARGE_CANCEL      0x0040
  |  |  ------------------
  ------------------
  |  Branch (3949:17): [True: 4, False: 110k]
  ------------------
 3950|   110k|                    out_norm_data[TAUT_YES]->at_fixed_bonds)
  ------------------
  |  |  580|      4|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3950:21): [True: 4, False: 0]
  ------------------
 3951|      4|            {
 3952|      4|                out_norm_data[TAUT_YES]->bTautPreprocessed = 1;
  ------------------
  |  |  580|      4|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3953|      4|            }
 3954|   110k|        }
 3955|       |
 3956|       |        /*
 3957|       |            if ( !(t_group_info->tni.bNormalizationFlags & (FLAG_NORM_CONSIDER_TAUT & ~FLAG_PROTON_SINGLE_REMOVED)) &&
 3958|       |                 out_norm_data[TAUT_YES]->at_fixed_bonds) {
 3959|       |                 FreeInpAtom( &out_norm_data[TAUT_YES]->at_fixed_bonds );
 3960|       |            }
 3961|       |        */
 3962|       |
 3963|       |        /*out_norm_data[TAUT_YES]->num_removed_H = num_removed_H_taut;*/
 3964|       |
 3965|   110k|        out_norm_data[TAUT_YES]->bTautFlags = *pbTautFlags = t_group_info->bTautFlags;
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3966|   110k|        out_norm_data[TAUT_YES]->bTautFlagsDone = *pbTautFlagsDone = t_group_info->bTautFlagsDone;
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3967|   110k|        out_norm_data[TAUT_YES]->bNormalizationFlags = t_group_info->tni.bNormalizationFlags;
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3968|       |
 3969|       |        /* create internal sp_ATOM at[] out of out_norm_data[]->at */
 3970|   110k|        inp2spATOM( out_norm_data[TAUT_YES]->at, num_inp_at, at[TAUT_YES] );
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                      inp2spATOM( out_norm_data[TAUT_YES]->at, num_inp_at, at[TAUT_YES] );
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3971|       |
 3972|       |        /* set stereo parities to at[]; nUserMode: accept alt. stereo bonds, min ring size */
 3973|   110k|        ret = set_stereo_parity( pCG, out_norm_data[TAUT_YES]->at, at[TAUT_YES],
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                      ret = set_stereo_parity( pCG, out_norm_data[TAUT_YES]->at, at[TAUT_YES],
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3974|   110k|                                 num_taut_at, num_removed_H_taut,
 3975|   110k|                                 &s[TAUT_YES].nMaxNumStereoAtoms,
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3976|   110k|                                 &s[TAUT_YES].nMaxNumStereoBonds,
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3977|   110k|                                 nUserMode, bPointedEdgeStereo,
 3978|   110k|                                 vABParityUnknown, ip->bLooseTSACheck, ip->bStereoAtZz );
 3979|       |
 3980|       |#if ( bRELEASE_VERSION == 0 )
 3981|       |        if (0 < ret)
 3982|       |        {
 3983|       |            bExtract |= EXTR_HAS_ATOM_WITH_DEFINED_PARITY;
 3984|       |        }
 3985|       |        if (t_group_info->tni.bNormalizationFlags & FLAG_NORM_CONSIDER_TAUT)
 3986|       |        {
 3987|       |            bExtract |= EXTR_TAUT_TREATMENT_CHARGES;
 3988|       |        }
 3989|       |#endif
 3990|       |
 3991|   110k|        if (RETURNED_ERROR( ret ))
  ------------------
  |  |   72|   110k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   68|   110k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   66|   110k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   110k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   69|   110k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   46|   110k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (72:31): [True: 110k, False: 0]
  |  |  |  Branch (72:53): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
 3992|      0|        {
 3993|      0|            goto exit_function; /*  stereo bond error */
 3994|      0|        }
 3995|       |
 3996|   110k|        s[TAUT_YES].bMayHaveStereo =
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3997|   110k|            ( s[TAUT_YES].nMaxNumStereoAtoms ||
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3997:15): [True: 0, False: 110k]
  ------------------
 3998|   110k|             s[TAUT_YES].nMaxNumStereoBonds );
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3998:14): [True: 0, False: 110k]
  ------------------
 3999|       |
 4000|       |        /*
 4001|       |            mark isotopic atoms and atoms that have non-tautomeric
 4002|       |            isotopic terminal hydrogen atoms 1H, 2H(D), 3H(T)
 4003|       |        */
 4004|       |
 4005|   110k|        s[TAUT_YES].num_isotopic_atoms =
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4006|   110k|            set_atom_iso_sort_keys( num_taut_at,
 4007|   110k|                                    at[TAUT_YES],
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4008|   110k|                                    t_group_info,
 4009|   110k|                                    &s[TAUT_YES].bHasIsotopicTautGroups );
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4010|       |
 4011|       |        /*
 4012|       |            Prepare tautomeric (if no tautomerism found then prepare non-tautomeric)
 4013|       |            structure for canonicalizaton:
 4014|       |
 4015|       |                remove t-groups that have no H,
 4016|       |                remove charges from t-groups if requested
 4017|       |                renumber t-groups and find final t_group_info->num_t_groups
 4018|       |                add to t-groups lists of endpoints tgroup->nEndpointAtomNumber[]
 4019|       |                calculate length of the t-group part of the connection table
 4020|       |         */
 4021|       |
 4022|   110k|        s[TAUT_YES].nLenLinearCTTautomer = CountTautomerGroups( at[TAUT_YES], num_taut_at, t_group_info );
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                      s[TAUT_YES].nLenLinearCTTautomer = CountTautomerGroups( at[TAUT_YES], num_taut_at, t_group_info );
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4023|       |
 4024|   110k|        if (RETURNED_ERROR( s[TAUT_YES].nLenLinearCTTautomer ))
  ------------------
  |  |   72|   110k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   68|   110k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   66|   110k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   110k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   69|   110k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   46|   110k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (72:31): [True: 110k, False: 0]
  |  |  |  Branch (72:53): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
 4025|      0|        {
 4026|       |            /* added error treatment 9-11-2003 */
 4027|      0|            ret = s[TAUT_YES].nLenLinearCTTautomer;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4028|      0|            goto exit_function;
 4029|       |            /*  error has happened; no breakpoint here
 4030|       |            s[TAUT_YES].nLenLinearCTTautomer = 0;
 4031|       |            */
 4032|      0|        }
 4033|       |
 4034|   110k|        else if (s[TAUT_YES].nLenLinearCTTautomer > 0)
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4034:18): [True: 5, False: 110k]
  ------------------
 4035|      5|        {
 4036|      5|            num_at_tg = num_taut_at + t_group_info->num_t_groups;
 4037|       |            /*  ??? -not true- create t_group_info_orig for multiple calls with atom renumbering */
 4038|      5|            make_a_copy_of_t_group_info( t_group_info_orig /* dest*/, t_group_info /* source*/ );
 4039|       |            /*  mark isotopic tautomer groups: calculate t_group->iWeight */
 4040|      5|            s[TAUT_YES].nLenLinearCTIsotopicTautomer = set_tautomer_iso_sort_keys( t_group_info );
  ------------------
  |  |  580|      5|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4041|      5|            if (s[TAUT_YES].nLenLinearCTIsotopicTautomer < 0)
  ------------------
  |  |  580|      5|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4041:17): [True: 0, False: 5]
  ------------------
 4042|      0|            {
 4043|       |                /* ??? -error cannot happen- error has happened; no breakpoint here */
 4044|      0|                s[TAUT_YES].nLenLinearCTIsotopicTautomer = 0;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4045|      0|            }
 4046|      5|            out_norm_data[TAUT_YES]->bTautomeric = s[TAUT_YES].nLenLinearCTTautomer;
  ------------------
  |  |  580|      5|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                          out_norm_data[TAUT_YES]->bTautomeric = s[TAUT_YES].nLenLinearCTTautomer;
  ------------------
  |  |  580|      5|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4047|      5|        }
 4048|       |
 4049|       |        /*  new variable: s[TAUT_YES].nLenCT introduced 7-22-2002 */
 4050|   110k|        GetCanonLengths( num_taut_at, at[TAUT_YES], &s[TAUT_YES], t_group_info );
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                      GetCanonLengths( num_taut_at, at[TAUT_YES], &s[TAUT_YES], t_group_info );
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4051|   110k|    }
 4052|       |
 4053|   110k|    if (out_norm_data[TAUT_NON]->at &&
  ------------------
  |  |  579|   110k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (4053:9): [True: 38, False: 109k]
  ------------------
 4054|   110k|         out_norm_data[TAUT_YES]->at &&
  ------------------
  |  |  580|     38|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4054:10): [True: 38, False: 0]
  ------------------
 4055|   110k|         at[TAUT_NON] &&
  ------------------
  |  |  579|     38|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (4055:10): [True: 38, False: 0]
  ------------------
 4056|   110k|         !s[TAUT_YES].nLenLinearCTTautomer)
  ------------------
  |  |  580|     38|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4056:10): [True: 35, False: 3]
  ------------------
 4057|     35|    {
 4058|       |        /* the structure is non-tautomeric: use tautomeric treatment results only for it */
 4059|     35|        inchi_free( at[TAUT_NON] );
  ------------------
  |  | 1136|     35|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 35, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4060|     35|        at[TAUT_NON] = NULL;
  ------------------
  |  |  579|     35|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4061|     35|    }
 4062|       |
 4063|   109k|    else if (!out_norm_data[TAUT_NON]->at &&
  ------------------
  |  |  579|   109k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (4063:14): [True: 109k, False: 3]
  ------------------
 4064|   109k|         out_norm_data[TAUT_YES]->at &&
  ------------------
  |  |  580|   109k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4064:10): [True: 109k, False: 0]
  ------------------
 4065|   109k|         !at[TAUT_NON] &&
  ------------------
  |  |  579|   109k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (4065:10): [True: 109k, False: 0]
  ------------------
 4066|   109k|         at[TAUT_YES] &&
  ------------------
  |  |  580|   109k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4066:10): [True: 109k, False: 0]
  ------------------
 4067|   109k|         !s[TAUT_YES].nLenLinearCTTautomer)
  ------------------
  |  |  580|   109k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4067:10): [True: 109k, False: 2]
  ------------------
 4068|   109k|    {
 4069|       |        /* requested tautomeric; found non-tautomeric; it is located in out_norm_data[TAUT_YES]->at */
 4070|   109k|        out_norm_data[TAUT_YES]->bTautomeric = 0;
  ------------------
  |  |  580|   109k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4071|   109k|    }
 4072|       |
 4073|      5|    else if (out_norm_data[TAUT_NON]->at && at[TAUT_NON])
  ------------------
  |  |  579|      5|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                  else if (out_norm_data[TAUT_NON]->at && at[TAUT_NON])
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (4073:14): [True: 3, False: 2]
  |  Branch (4073:45): [True: 3, False: 0]
  ------------------
 4074|      3|    {
 4075|       |        /* the structure needs non-tautomeric treatment:
 4076|       |        final normalization of non-tautomeric structure */
 4077|      3|        ret = mark_alt_bonds_and_taut_groups( ic, pCG,
 4078|      3|                                              out_norm_data[TAUT_NON]->at,
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4079|      3|                                              NULL,
 4080|      3|                                              num_atoms,
 4081|      3|                                              ulMaxTime,
 4082|      3|                                              NULL,
 4083|      3|                                              &bTautFlags,
 4084|      3|                                              &bTautFlagsDone,
 4085|      3|                                              nebend, ebend );
 4086|      3|        if (ret < 0)
  ------------------
  |  Branch (4086:13): [True: 0, False: 3]
  ------------------
 4087|      0|        {
 4088|      0|            goto exit_function;  /*  out of RAM or other normalization problem */
 4089|      0|        }
 4090|      3|        out_norm_data[TAUT_NON]->num_at = num_atoms + num_removed_H;
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4091|      3|        out_norm_data[TAUT_NON]->num_removed_H = num_removed_H;
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4092|      3|        out_norm_data[TAUT_NON]->bTautFlags = *pbTautFlags;
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4093|      3|        out_norm_data[TAUT_NON]->bTautFlagsDone = *pbTautFlagsDone;
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4094|      3|        out_norm_data[TAUT_NON]->bNormalizationFlags = 0;
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4095|       |
 4096|       |        /* create internal sp_ATOM at[] out of out_norm_data[]->at */
 4097|      3|        inp2spATOM( out_norm_data[TAUT_NON]->at, num_inp_at, at[TAUT_NON] );
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                      inp2spATOM( out_norm_data[TAUT_NON]->at, num_inp_at, at[TAUT_NON] );
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4098|       |
 4099|       |        /* set stereo parities to at[]; nUserMode: accept alt. stereo bonds, min ring size */
 4100|      3|        ret = set_stereo_parity( pCG, out_norm_data[TAUT_NON]->at,
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4101|      3|                                 at[TAUT_NON], num_atoms, num_removed_H,
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4102|      3|                                 &s[TAUT_NON].nMaxNumStereoAtoms,
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4103|      3|                                 &s[TAUT_NON].nMaxNumStereoBonds, nUserMode,
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4104|      3|                                 bPointedEdgeStereo, vABParityUnknown,
 4105|      3|                                 ip->bLooseTSACheck, ip->bStereoAtZz );
 4106|       |#if ( bRELEASE_VERSION == 0 )
 4107|       |        if (0 < ret)
 4108|       |        {
 4109|       |            bExtract |= EXTR_HAS_ATOM_WITH_DEFINED_PARITY;
 4110|       |        }
 4111|       |#endif
 4112|      3|        if (RETURNED_ERROR( ret ))
  ------------------
  |  |   72|      3|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   68|      3|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   66|      3|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|      3|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   69|      3|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   46|      3|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (72:31): [True: 3, False: 0]
  |  |  |  Branch (72:53): [True: 0, False: 3]
  |  |  ------------------
  ------------------
 4113|      0|        {
 4114|      0|            goto exit_function; /*  stereo bond error */
 4115|      0|        }
 4116|      3|        s[TAUT_NON].bMayHaveStereo = ( s[TAUT_NON].nMaxNumStereoAtoms ||
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                      s[TAUT_NON].bMayHaveStereo = ( s[TAUT_NON].nMaxNumStereoAtoms ||
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (4116:40): [True: 0, False: 3]
  ------------------
 4117|      3|                                      s[TAUT_NON].nMaxNumStereoBonds );
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (4117:39): [True: 0, False: 3]
  ------------------
 4118|       |
 4119|       |        /*
 4120|       |         * mark isotopic atoms and atoms that have non-tautomeric
 4121|       |         * isotopic terminal hydrogen atoms 1H, 2H(D), 3H(T)
 4122|       |         */
 4123|      3|        s[TAUT_NON].num_isotopic_atoms = set_atom_iso_sort_keys( num_atoms, at[TAUT_NON], NULL, NULL );
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                      s[TAUT_NON].num_isotopic_atoms = set_atom_iso_sort_keys( num_atoms, at[TAUT_NON], NULL, NULL );
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4124|      3|        GetCanonLengths( num_atoms, at[TAUT_NON], &s[TAUT_NON], NULL );
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                      GetCanonLengths( num_atoms, at[TAUT_NON], &s[TAUT_NON], NULL );
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4125|      3|        out_norm_data[TAUT_NON]->bTautomeric = 0;
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4126|      3|    }
 4127|       |
 4128|       |    /* common  */
 4129|   110k|    bMayHaveStereo = s[TAUT_YES].bMayHaveStereo || s[TAUT_NON].bMayHaveStereo;
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  bMayHaveStereo = s[TAUT_YES].bMayHaveStereo || s[TAUT_NON].bMayHaveStereo;
  ------------------
  |  |  579|   110k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (4129:22): [True: 0, False: 110k]
  |  Branch (4129:52): [True: 0, False: 110k]
  ------------------
 4130|   110k|    bHasIsotopicAtoms = s[TAUT_NON].num_isotopic_atoms > 0 || s[TAUT_NON].bHasIsotopicTautGroups > 0 ||
  ------------------
  |  |  579|   110k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                  bHasIsotopicAtoms = s[TAUT_NON].num_isotopic_atoms > 0 || s[TAUT_NON].bHasIsotopicTautGroups > 0 ||
  ------------------
  |  |  579|   110k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (4130:25): [True: 2, False: 110k]
  |  Branch (4130:63): [True: 0, False: 110k]
  ------------------
 4131|   110k|        s[TAUT_YES].num_isotopic_atoms > 0 || s[TAUT_YES].bHasIsotopicTautGroups > 0;
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                      s[TAUT_YES].num_isotopic_atoms > 0 || s[TAUT_YES].bHasIsotopicTautGroups > 0;
  ------------------
  |  |  580|   109k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4131:9): [True: 43, False: 109k]
  |  Branch (4131:47): [True: 0, False: 109k]
  ------------------
 4132|   110k|    if (bFixIsoFixedH)
  ------------------
  |  Branch (4132:9): [True: 110k, False: 0]
  ------------------
 4133|   110k|    {
 4134|       |        /* 2008-03-21 DT */
 4135|   110k|        bHasIsotopicAtoms = bHasIsotopicAtoms
  ------------------
  |  Branch (4135:29): [True: 45, False: 109k]
  ------------------
 4136|   110k|            ||
 4137|   110k|            s[TAUT_YES].nLenLinearCTTautomer > 0 && t_group_info &&
  ------------------
  |  |  580|   109k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4137:13): [True: 3, False: 109k]
  |  Branch (4137:53): [True: 3, False: 0]
  ------------------
 4138|   109k|            ( 0 < NUM_H_ISOTOPES && t_group_info->tni.nNumRemovedProtonsIsotopic[0] ||
  ------------------
  |  |  100|      6|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (4138:15): [Folded - Ignored]
  |  Branch (4138:37): [True: 0, False: 3]
  ------------------
 4139|      3|              1 < NUM_H_ISOTOPES && t_group_info->tni.nNumRemovedProtonsIsotopic[1] ||
  ------------------
  |  |  100|      6|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (4139:15): [Folded - Ignored]
  |  Branch (4139:37): [True: 0, False: 3]
  ------------------
 4140|      3|              2 < NUM_H_ISOTOPES && t_group_info->tni.nNumRemovedProtonsIsotopic[2]
  ------------------
  |  |  100|      6|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (4140:15): [Folded - Ignored]
  |  Branch (4140:37): [True: 0, False: 3]
  ------------------
 4141|      3|            );
 4142|   110k|    }
 4143|   110k|    bHasIsotopicAtoms = bHasIsotopicAtoms
  ------------------
  |  Branch (4143:25): [True: 45, False: 109k]
  ------------------
 4144|   110k|        ||
 4145|   110k|        s[TAUT_YES].nLenIsotopicEndpoints > 1 && t_group_info &&
  ------------------
  |  |  580|   109k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4145:9): [True: 0, False: 109k]
  |  Branch (4145:50): [True: 0, False: 0]
  ------------------
 4146|   109k|        ( t_group_info->bTautFlagsDone & ( TG_FLAG_FOUND_ISOTOPIC_H_DONE | TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE ) );
  ------------------
  |  |  978|      0|#define TG_FLAG_FOUND_ISOTOPIC_H_DONE    0x00004000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
                      ( t_group_info->bTautFlagsDone & ( TG_FLAG_FOUND_ISOTOPIC_H_DONE | TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE ) );
  ------------------
  |  |  979|      0|#define TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE 0x00008000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
  |  Branch (4146:9): [True: 0, False: 0]
  ------------------
 4147|       |
 4148|       |    /* default mode */
 4149|   110k|    if (!( nUserMode & REQ_MODE_DEFAULT ))
  ------------------
  |  |   74|   110k|#define REQ_MODE_DEFAULT  (REQ_MODE_BASIC | REQ_MODE_TAUT | REQ_MODE_ISO | REQ_MODE_NON_ISO | REQ_MODE_STEREO)
  |  |  ------------------
  |  |  |  |   43|   110k|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  |  |  ------------------
  |  |               #define REQ_MODE_DEFAULT  (REQ_MODE_BASIC | REQ_MODE_TAUT | REQ_MODE_ISO | REQ_MODE_NON_ISO | REQ_MODE_STEREO)
  |  |  ------------------
  |  |  |  |   44|   110k|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  |  |  ------------------
  |  |               #define REQ_MODE_DEFAULT  (REQ_MODE_BASIC | REQ_MODE_TAUT | REQ_MODE_ISO | REQ_MODE_NON_ISO | REQ_MODE_STEREO)
  |  |  ------------------
  |  |  |  |   45|   110k|#define REQ_MODE_ISO                0x000004    /* I    */
  |  |  ------------------
  |  |               #define REQ_MODE_DEFAULT  (REQ_MODE_BASIC | REQ_MODE_TAUT | REQ_MODE_ISO | REQ_MODE_NON_ISO | REQ_MODE_STEREO)
  |  |  ------------------
  |  |  |  |   46|   110k|#define REQ_MODE_NON_ISO            0x000008    /* NI   */
  |  |  ------------------
  |  |               #define REQ_MODE_DEFAULT  (REQ_MODE_BASIC | REQ_MODE_TAUT | REQ_MODE_ISO | REQ_MODE_NON_ISO | REQ_MODE_STEREO)
  |  |  ------------------
  |  |  |  |   47|   110k|#define REQ_MODE_STEREO             0x000010    /* S    */
  |  |  ------------------
  ------------------
  |  Branch (4149:9): [True: 0, False: 110k]
  ------------------
 4150|      0|    {
 4151|       |        /*  default */
 4152|      0|        nUserMode |= REQ_MODE_DEFAULT;
  ------------------
  |  |   74|      0|#define REQ_MODE_DEFAULT  (REQ_MODE_BASIC | REQ_MODE_TAUT | REQ_MODE_ISO | REQ_MODE_NON_ISO | REQ_MODE_STEREO)
  |  |  ------------------
  |  |  |  |   43|      0|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  |  |  ------------------
  |  |               #define REQ_MODE_DEFAULT  (REQ_MODE_BASIC | REQ_MODE_TAUT | REQ_MODE_ISO | REQ_MODE_NON_ISO | REQ_MODE_STEREO)
  |  |  ------------------
  |  |  |  |   44|      0|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  |  |  ------------------
  |  |               #define REQ_MODE_DEFAULT  (REQ_MODE_BASIC | REQ_MODE_TAUT | REQ_MODE_ISO | REQ_MODE_NON_ISO | REQ_MODE_STEREO)
  |  |  ------------------
  |  |  |  |   45|      0|#define REQ_MODE_ISO                0x000004    /* I    */
  |  |  ------------------
  |  |               #define REQ_MODE_DEFAULT  (REQ_MODE_BASIC | REQ_MODE_TAUT | REQ_MODE_ISO | REQ_MODE_NON_ISO | REQ_MODE_STEREO)
  |  |  ------------------
  |  |  |  |   46|      0|#define REQ_MODE_NON_ISO            0x000008    /* NI   */
  |  |  ------------------
  |  |               #define REQ_MODE_DEFAULT  (REQ_MODE_BASIC | REQ_MODE_TAUT | REQ_MODE_ISO | REQ_MODE_NON_ISO | REQ_MODE_STEREO)
  |  |  ------------------
  |  |  |  |   47|      0|#define REQ_MODE_STEREO             0x000010    /* S    */
  |  |  ------------------
  ------------------
 4153|      0|    }
 4154|       |
 4155|       |    /* adjust the mode to the reality */
 4156|   110k|    if (( nUserMode & REQ_MODE_ISO ) && !bHasIsotopicAtoms)
  ------------------
  |  |   45|   110k|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
  |  Branch (4156:9): [True: 110k, False: 0]
  |  Branch (4156:41): [True: 109k, False: 45]
  ------------------
 4157|   109k|    {
 4158|   109k|        nUserMode ^= REQ_MODE_ISO;
  ------------------
  |  |   45|   109k|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
 4159|   109k|        nUserMode |= REQ_MODE_NON_ISO;  /*  at least one is needed */
  ------------------
  |  |   46|   109k|#define REQ_MODE_NON_ISO            0x000008    /* NI   */
  ------------------
 4160|   109k|    }
 4161|   110k|    if (( nUserMode & REQ_MODE_STEREO ) && ( nUserMode & REQ_MODE_ISO ))
  ------------------
  |  |   47|   110k|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
                  if (( nUserMode & REQ_MODE_STEREO ) && ( nUserMode & REQ_MODE_ISO ))
  ------------------
  |  |   45|      0|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
  |  Branch (4161:9): [True: 0, False: 110k]
  |  Branch (4161:44): [True: 0, False: 0]
  ------------------
 4162|      0|    {
 4163|      0|        nUserMode |= REQ_MODE_ISO_STEREO;
  ------------------
  |  |   48|      0|#define REQ_MODE_ISO_STEREO         0x000020    /* IS   */
  ------------------
 4164|      0|    }
 4165|   110k|    if (( nUserMode & REQ_MODE_STEREO ) && !( nUserMode & REQ_MODE_NON_ISO ))
  ------------------
  |  |   47|   110k|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
                  if (( nUserMode & REQ_MODE_STEREO ) && !( nUserMode & REQ_MODE_NON_ISO ))
  ------------------
  |  |   46|      0|#define REQ_MODE_NON_ISO            0x000008    /* NI   */
  ------------------
  |  Branch (4165:9): [True: 0, False: 110k]
  |  Branch (4165:44): [True: 0, False: 0]
  ------------------
 4166|      0|    {
 4167|      0|        nUserMode ^= REQ_MODE_STEREO;
  ------------------
  |  |   47|      0|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
 4168|      0|    }
 4169|   110k|    if (!bMayHaveStereo)
  ------------------
  |  Branch (4169:9): [True: 110k, False: 0]
  ------------------
 4170|   110k|    {
 4171|   110k|        if (nUserMode & REQ_MODE_STEREO)
  ------------------
  |  |   47|   110k|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
  |  Branch (4171:13): [True: 0, False: 110k]
  ------------------
 4172|      0|            nUserMode ^= REQ_MODE_STEREO;
  ------------------
  |  |   47|      0|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
 4173|   110k|        if (nUserMode & REQ_MODE_ISO_STEREO)
  ------------------
  |  |   48|   110k|#define REQ_MODE_ISO_STEREO         0x000020    /* IS   */
  ------------------
  |  Branch (4173:13): [True: 0, False: 110k]
  ------------------
 4174|      0|            nUserMode ^= REQ_MODE_ISO_STEREO;
  ------------------
  |  |   48|      0|#define REQ_MODE_ISO_STEREO         0x000020    /* IS   */
  ------------------
 4175|   110k|    }
 4176|       |
 4177|   110k|    if (( nUserMode & REQ_MODE_BASIC ) &&
  ------------------
  |  |   43|   110k|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
  |  Branch (4177:9): [True: 38, False: 109k]
  ------------------
 4178|   110k|        ( !out_norm_data[TAUT_NON]->at || !ppINChI[TAUT_NON] ||
  ------------------
  |  |  579|     38|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                      ( !out_norm_data[TAUT_NON]->at || !ppINChI[TAUT_NON] ||
  ------------------
  |  |  579|     38|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (4178:11): [True: 0, False: 38]
  |  Branch (4178:43): [True: 0, False: 38]
  ------------------
 4179|     38|            !ppINChI_Aux[TAUT_NON] || !at[TAUT_NON] ))
  ------------------
  |  |  579|     38|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                          !ppINChI_Aux[TAUT_NON] || !at[TAUT_NON] ))
  ------------------
  |  |  579|     38|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (4179:13): [True: 0, False: 38]
  |  Branch (4179:39): [True: 35, False: 3]
  ------------------
 4180|     35|    {
 4181|     35|        nUserMode ^= REQ_MODE_BASIC;
  ------------------
  |  |   43|     35|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
 4182|     35|    }
 4183|   110k|    if (( nUserMode & REQ_MODE_TAUT ) &&
  ------------------
  |  |   44|   110k|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
  |  Branch (4183:9): [True: 110k, False: 0]
  ------------------
 4184|   110k|        ( !out_norm_data[TAUT_YES]->at || !ppINChI[TAUT_YES] ||
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                      ( !out_norm_data[TAUT_YES]->at || !ppINChI[TAUT_YES] ||
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4184:11): [True: 0, False: 110k]
  |  Branch (4184:43): [True: 0, False: 110k]
  ------------------
 4185|   110k|            !ppINChI_Aux[TAUT_YES] || !at[TAUT_YES] ))
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                          !ppINChI_Aux[TAUT_YES] || !at[TAUT_YES] ))
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4185:13): [True: 0, False: 110k]
  |  Branch (4185:39): [True: 0, False: 110k]
  ------------------
 4186|      0|    {
 4187|      0|        nUserMode ^= REQ_MODE_TAUT;
  ------------------
  |  |   44|      0|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
 4188|      0|    }
 4189|       |
 4190|   110k|    switch ((int) nUserMode & ( REQ_MODE_BASIC | REQ_MODE_TAUT ))
  ------------------
  |  |   43|   110k|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
                  switch ((int) nUserMode & ( REQ_MODE_BASIC | REQ_MODE_TAUT ))
  ------------------
  |  |   44|   110k|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
 4191|   110k|    {
 4192|      0|        case REQ_MODE_BASIC:
  ------------------
  |  |   43|      0|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
  |  Branch (4192:9): [True: 0, False: 110k]
  ------------------
 4193|      0|            n1 = TAUT_NON;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4194|      0|            n2 = TAUT_NON;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4195|      0|            break;
 4196|   110k|        case REQ_MODE_TAUT:
  ------------------
  |  |   44|   110k|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
  |  Branch (4196:9): [True: 110k, False: 3]
  ------------------
 4197|   110k|            n1 = TAUT_YES;
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4198|   110k|            n2 = TAUT_YES;
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4199|   110k|            break;
 4200|      3|        case ( REQ_MODE_BASIC | REQ_MODE_TAUT ):
  ------------------
  |  |   43|      3|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
                      case ( REQ_MODE_BASIC | REQ_MODE_TAUT ):
  ------------------
  |  |   44|      3|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
  |  Branch (4200:9): [True: 3, False: 110k]
  ------------------
 4201|      3|            n1 = TAUT_NON;
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4202|      3|            n2 = TAUT_YES;
  ------------------
  |  |  580|      3|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4203|      3|            break;
 4204|      0|        default:
  ------------------
  |  Branch (4204:9): [True: 0, False: 110k]
  ------------------
 4205|      0|            ret = -3;
 4206|      0|            goto exit_function; /*  program error: inconsistent nUserMode or missing taut/non-taut allocation */ /*   <BRKPT> */
 4207|   110k|    }
 4208|       |
 4209|       |    /*
 4210|       |        Obtain all non-stereo canonical numberings
 4211|       |    */
 4212|       |
 4213|   110k|    if (( nUserMode & REQ_MODE_NON_ISO ) && !( nUserMode & REQ_MODE_ISO ))
  ------------------
  |  |   46|   110k|#define REQ_MODE_NON_ISO            0x000008    /* NI   */
  ------------------
                  if (( nUserMode & REQ_MODE_NON_ISO ) && !( nUserMode & REQ_MODE_ISO ))
  ------------------
  |  |   45|   110k|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
  |  Branch (4213:9): [True: 110k, False: 0]
  |  Branch (4213:45): [True: 109k, False: 45]
  ------------------
 4214|   109k|    {
 4215|       |        /* added for special non-isotopic test mode 2004-10-04 */
 4216|   109k|        if (t_group_info)
  ------------------
  |  Branch (4216:13): [True: 109k, False: 0]
  ------------------
 4217|   109k|        {
 4218|   109k|            t_group_info->bIgnoreIsotopic = 1;
 4219|   109k|            if (t_group_info->nIsotopicEndpointAtomNumber)
  ------------------
  |  Branch (4219:17): [True: 0, False: 109k]
  ------------------
 4220|      0|            {
 4221|      0|                t_group_info->nIsotopicEndpointAtomNumber[0] = inchi_min( 1, t_group_info->nIsotopicEndpointAtomNumber[0] );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4222|      0|            }
 4223|   109k|            memset( t_group_info->num_iso_H, 0, sizeof( t_group_info->num_iso_H ) );
 4224|   109k|            memset( t_group_info->tni.nNumRemovedProtonsIsotopic, 0, sizeof( t_group_info->tni.nNumRemovedProtonsIsotopic ) );
 4225|   109k|            t_group_info->bTautFlagsDone &= ~( TG_FLAG_FOUND_ISOTOPIC_H_DONE | TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE );
  ------------------
  |  |  978|   109k|#define TG_FLAG_FOUND_ISOTOPIC_H_DONE    0x00004000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
                          t_group_info->bTautFlagsDone &= ~( TG_FLAG_FOUND_ISOTOPIC_H_DONE | TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE );
  ------------------
  |  |  979|   109k|#define TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE 0x00008000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
 4226|   109k|        }
 4227|   329k|        for (i = 0; i < TAUT_NUM; i++)
  ------------------
  |  |  578|   329k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (4227:21): [True: 219k, False: 109k]
  ------------------
 4228|   219k|        {
 4229|   219k|            s[i].bHasIsotopicTautGroups = 0;
 4230|   219k|            s[i].bIgnoreIsotopic = 1;
 4231|   219k|            s[i].nLenIsotopic = 0;
 4232|   219k|            s[i].nLenIsotopicEndpoints = 0;
 4233|   219k|            s[i].nLenLinearCTIsotopicTautomer = 0;
 4234|   219k|            s[i].num_isotopic_atoms = 0;
 4235|   219k|        }
 4236|   109k|        bHasIsotopicAtoms = 0;
 4237|   109k|    }
 4238|       |
 4239|   110k|    ret = GetBaseCanonRanking( ic, num_atoms, num_at_tg, at,
 4240|   110k|                               t_group_info, s, pBCN, ulMaxTime,
 4241|   110k|                               pCG, bFixIsoFixedH, LargeMolecules );
 4242|       |
 4243|   110k|    if (ret < 0)
  ------------------
  |  Branch (4243:9): [True: 0, False: 110k]
  ------------------
 4244|      0|    {
 4245|      0|        goto exit_function; /*  program error */
 4246|      0|    }
 4247|       |#if ( bRELEASE_VERSION == 0 && FIND_CANON_NE_EQUITABLE == 1 )
 4248|       |    /* Debug only: find whether canonical equivalence is different from equitable partition */
 4249|       |    if (bCanonIsFinerThanEquitablePartition( num_atoms, at[n1], pBCN->ftcn[TAUT_NON].nSymmRankCt ))
 4250|       |    {
 4251|       |        bExtract |= EXTR_CANON_NE_EQUITABLE;
 4252|       |    }
 4253|       |#endif
 4254|       |
 4255|       |    /* added for special non-isotopic test mode 2004-10-04 */
 4256|   110k|    if (!pBCN->ftcn[n1].PartitionCt.Rank)
  ------------------
  |  Branch (4256:9): [True: 0, False: 110k]
  ------------------
 4257|      0|    {
 4258|      0|        n1 = ALT_TAUT( n1 );
  ------------------
  |  |  582|      0|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (582:29): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4259|      0|    }
 4260|   110k|    if (!pBCN->ftcn[n2].PartitionCt.Rank)
  ------------------
  |  Branch (4260:9): [True: 0, False: 110k]
  ------------------
 4261|      0|    {
 4262|      0|        n2 = ALT_TAUT( n2 );
  ------------------
  |  |  582|      0|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (582:29): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4263|      0|    }
 4264|   110k|    if (n1 > n2)
  ------------------
  |  Branch (4264:9): [True: 0, False: 110k]
  ------------------
 4265|      0|    {
 4266|      0|        ret = CT_TAUCOUNT_ERR;
  ------------------
  |  |   52|      0|#define CT_TAUCOUNT_ERR      (CT_ERR_FIRST- 5)  /*(-30005) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 4267|      0|        goto exit_function; /*  program error */
 4268|      0|    }
 4269|       |
 4270|       |    /*
 4271|       |        Obtain stereo canonical numberings
 4272|       |    */
 4273|       |
 4274|   220k|    for (i = n2; i >= n1 && !RETURNED_ERROR( ret ); i--)
  ------------------
  |  |   72|   110k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   68|   110k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   66|   110k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   110k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   69|   110k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   46|   110k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (72:31): [True: 110k, False: 0]
  |  |  |  Branch (72:53): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
  |  Branch (4274:18): [True: 110k, False: 110k]
  ------------------
 4275|   110k|    {
 4276|   110k|        memset( pCS, 0, sizeof( *pCS ) );
 4277|       |
 4278|   110k|        switch (i)
  ------------------
  |  Branch (4278:17): [True: 0, False: 110k]
  ------------------
 4279|   110k|        {
 4280|      3|            case TAUT_NON:
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (4280:13): [True: 3, False: 110k]
  ------------------
 4281|       |                /*  non-tautomeric */
 4282|      3|                nMode = 0;
 4283|      3|                nMode = ( s[i].nLenLinearCTTautomer == 0 ) ? CANON_MODE_CT : CANON_MODE_TAUT;
  ------------------
  |  |  789|      3|#define CANON_MODE_CT         (CMODE_CT)
  |  |  ------------------
  |  |  |  |  772|      3|#define CMODE_CT                 0x000001
  |  |  ------------------
  ------------------
                              nMode = ( s[i].nLenLinearCTTautomer == 0 ) ? CANON_MODE_CT : CANON_MODE_TAUT;
  ------------------
  |  |  790|      3|#define CANON_MODE_TAUT       (CMODE_CT|CMODE_TAUT)
  |  |  ------------------
  |  |  |  |  772|      0|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_TAUT       (CMODE_CT|CMODE_TAUT)
  |  |  ------------------
  |  |  |  |  777|      0|#define CMODE_TAUT               0x000020
  |  |  ------------------
  ------------------
  |  Branch (4283:25): [True: 3, False: 0]
  ------------------
 4284|      3|                nMode |= ( bHasIsotopicAtoms && ( nUserMode & REQ_MODE_ISO ) ) ? CANON_MODE_ISO : 0;
  ------------------
  |  |   45|      2|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
                              nMode |= ( bHasIsotopicAtoms && ( nUserMode & REQ_MODE_ISO ) ) ? CANON_MODE_ISO : 0;
  ------------------
  |  |  791|      2|#define CANON_MODE_ISO        (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT)
  |  |  ------------------
  |  |  |  |  772|      2|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_ISO        (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT)
  |  |  ------------------
  |  |  |  |  773|      2|#define CMODE_ISO                0x000002
  |  |  ------------------
  |  |               #define CANON_MODE_ISO        (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT)
  |  |  ------------------
  |  |  |  |  774|      2|#define CMODE_ISO_OUT            0x000004 /* obsolete ? */
  |  |  ------------------
  ------------------
  |  Branch (4284:28): [True: 2, False: 1]
  |  Branch (4284:49): [True: 2, False: 0]
  ------------------
 4285|      3|                nMode |= ( s[TAUT_NON].bMayHaveStereo && ( nUserMode & REQ_MODE_STEREO ) ) ? CANON_MODE_STEREO : 0;
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                              nMode |= ( s[TAUT_NON].bMayHaveStereo && ( nUserMode & REQ_MODE_STEREO ) ) ? CANON_MODE_STEREO : 0;
  ------------------
  |  |   47|      0|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
                              nMode |= ( s[TAUT_NON].bMayHaveStereo && ( nUserMode & REQ_MODE_STEREO ) ) ? CANON_MODE_STEREO : 0;
  ------------------
  |  |  792|      0|#define CANON_MODE_STEREO     (CMODE_CT|CMODE_STEREO)
  |  |  ------------------
  |  |  |  |  772|      0|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_STEREO     (CMODE_CT|CMODE_STEREO)
  |  |  ------------------
  |  |  |  |  775|      0|#define CMODE_STEREO             0x000008
  |  |  ------------------
  ------------------
  |  Branch (4285:28): [True: 0, False: 3]
  |  Branch (4285:58): [True: 0, False: 0]
  ------------------
 4286|      3|                nMode |= ( bHasIsotopicAtoms && s[TAUT_NON].bMayHaveStereo && ( nUserMode & REQ_MODE_ISO_STEREO ) ) ? CANON_MODE_ISO_STEREO : 0;
  ------------------
  |  |  579|      2|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                              nMode |= ( bHasIsotopicAtoms && s[TAUT_NON].bMayHaveStereo && ( nUserMode & REQ_MODE_ISO_STEREO ) ) ? CANON_MODE_ISO_STEREO : 0;
  ------------------
  |  |   48|      0|#define REQ_MODE_ISO_STEREO         0x000020    /* IS   */
  ------------------
                              nMode |= ( bHasIsotopicAtoms && s[TAUT_NON].bMayHaveStereo && ( nUserMode & REQ_MODE_ISO_STEREO ) ) ? CANON_MODE_ISO_STEREO : 0;
  ------------------
  |  |  793|      0|#define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  772|      0|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  773|      0|#define CMODE_ISO                0x000002
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  774|      0|#define CMODE_ISO_OUT            0x000004 /* obsolete ? */
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  776|      0|#define CMODE_ISO_STEREO         0x000010
  |  |  ------------------
  ------------------
  |  Branch (4286:28): [True: 2, False: 1]
  |  Branch (4286:49): [True: 0, False: 2]
  |  Branch (4286:79): [True: 0, False: 0]
  ------------------
 4287|      3|                nMode |= ( nUserMode & REQ_MODE_NOEQ_STEREO ) ? CMODE_NOEQ_STEREO : 0;
  ------------------
  |  |   49|      3|#define REQ_MODE_NOEQ_STEREO        0x000040    /* SS   */
  ------------------
                              nMode |= ( nUserMode & REQ_MODE_NOEQ_STEREO ) ? CMODE_NOEQ_STEREO : 0;
  ------------------
  |  |  778|      0|#define CMODE_NOEQ_STEREO        0x000040 /* 5-24-2002: do not use stereo equivalence to accelerate */
  ------------------
  |  Branch (4287:26): [True: 0, False: 3]
  ------------------
 4288|      3|                nMode |= ( nUserMode & REQ_MODE_REDNDNT_STEREO ) ? CMODE_REDNDNT_STEREO : 0;
  ------------------
  |  |   50|      3|#define REQ_MODE_REDNDNT_STEREO     0x000080    /* RS   */
  ------------------
                              nMode |= ( nUserMode & REQ_MODE_REDNDNT_STEREO ) ? CMODE_REDNDNT_STEREO : 0;
  ------------------
  |  |  779|      0|#define CMODE_REDNDNT_STEREO     0x000080 /* 6-11-2002: do not check for redundant stereo elements */
  ------------------
  |  Branch (4288:26): [True: 0, False: 3]
  ------------------
 4289|      3|                nMode |= ( nUserMode & REQ_MODE_NO_ALT_SBONDS ) ? CMODE_NO_ALT_SBONDS : 0;
  ------------------
  |  |   51|      3|#define REQ_MODE_NO_ALT_SBONDS      0x000100    /* NASB */
  ------------------
                              nMode |= ( nUserMode & REQ_MODE_NO_ALT_SBONDS ) ? CMODE_NO_ALT_SBONDS : 0;
  ------------------
  |  |  780|      0|#define CMODE_NO_ALT_SBONDS      0x000100 /* 6-14-2002: do not assign stereo to alternating bonds */
  ------------------
  |  Branch (4289:26): [True: 0, False: 3]
  ------------------
 4290|      3|                if (( nMode & CANON_MODE_STEREO ) == CANON_MODE_STEREO ||
  ------------------
  |  |  792|      3|#define CANON_MODE_STEREO     (CMODE_CT|CMODE_STEREO)
  |  |  ------------------
  |  |  |  |  772|      3|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_STEREO     (CMODE_CT|CMODE_STEREO)
  |  |  ------------------
  |  |  |  |  775|      3|#define CMODE_STEREO             0x000008
  |  |  ------------------
  ------------------
                              if (( nMode & CANON_MODE_STEREO ) == CANON_MODE_STEREO ||
  ------------------
  |  |  792|      6|#define CANON_MODE_STEREO     (CMODE_CT|CMODE_STEREO)
  |  |  ------------------
  |  |  |  |  772|      3|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_STEREO     (CMODE_CT|CMODE_STEREO)
  |  |  ------------------
  |  |  |  |  775|      3|#define CMODE_STEREO             0x000008
  |  |  ------------------
  ------------------
  |  Branch (4290:21): [True: 0, False: 3]
  ------------------
 4291|      3|                    ( nMode & CANON_MODE_ISO_STEREO ) == CANON_MODE_ISO_STEREO)
  ------------------
  |  |  793|      3|#define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  772|      3|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  773|      3|#define CMODE_ISO                0x000002
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  774|      3|#define CMODE_ISO_OUT            0x000004 /* obsolete ? */
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  776|      3|#define CMODE_ISO_STEREO         0x000010
  |  |  ------------------
  ------------------
                                  ( nMode & CANON_MODE_ISO_STEREO ) == CANON_MODE_ISO_STEREO)
  ------------------
  |  |  793|      3|#define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  772|      3|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  773|      3|#define CMODE_ISO                0x000002
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  774|      3|#define CMODE_ISO_OUT            0x000004 /* obsolete ? */
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  776|      3|#define CMODE_ISO_STEREO         0x000010
  |  |  ------------------
  ------------------
  |  Branch (4291:21): [True: 0, False: 3]
  ------------------
 4292|      0|                {
 4293|      0|                    nMode |= ( nUserMode & REQ_MODE_RELATIVE_STEREO ) ? CMODE_RELATIVE_STEREO : 0;
  ------------------
  |  |   54|      0|#define REQ_MODE_RELATIVE_STEREO    0x000200    /* REL All Relative Stereo */
  ------------------
                                  nMode |= ( nUserMode & REQ_MODE_RELATIVE_STEREO ) ? CMODE_RELATIVE_STEREO : 0;
  ------------------
  |  |  782|      0|#define CMODE_RELATIVE_STEREO    0x000200    /* REL All Relative Stereo */
  ------------------
  |  Branch (4293:30): [True: 0, False: 0]
  ------------------
 4294|      0|                    nMode |= ( nUserMode & REQ_MODE_RACEMIC_STEREO ) ? CMODE_RACEMIC_STEREO : 0;
  ------------------
  |  |   56|      0|#define REQ_MODE_RACEMIC_STEREO     0x000400    /* RAC All Racemic Stereo */
  ------------------
                                  nMode |= ( nUserMode & REQ_MODE_RACEMIC_STEREO ) ? CMODE_RACEMIC_STEREO : 0;
  ------------------
  |  |  783|      0|#define CMODE_RACEMIC_STEREO     0x000400    /* RAC All Racemic Stereo */
  ------------------
  |  Branch (4294:30): [True: 0, False: 0]
  ------------------
 4295|      0|                    nMode |= ( nUserMode & REQ_MODE_SC_IGN_ALL_UU ) ? CMODE_SC_IGN_ALL_UU : 0;
  ------------------
  |  |   58|      0|#define REQ_MODE_SC_IGN_ALL_UU      0x000800    /* IAUSC Ignore stereocenters if All Undef/Unknown */
  ------------------
                                  nMode |= ( nUserMode & REQ_MODE_SC_IGN_ALL_UU ) ? CMODE_SC_IGN_ALL_UU : 0;
  ------------------
  |  |  784|      0|#define CMODE_SC_IGN_ALL_UU      0x000800    /* IAUSC Ignore stereocenters if All Undef/Unknown */
  ------------------
  |  Branch (4295:30): [True: 0, False: 0]
  ------------------
 4296|      0|                    nMode |= ( nUserMode & REQ_MODE_SB_IGN_ALL_UU ) ? CMODE_SB_IGN_ALL_UU : 0;
  ------------------
  |  |   60|      0|#define REQ_MODE_SB_IGN_ALL_UU      0x001000    /* IAUSC Ignore stereobonds if All Undef/Unknown */
  ------------------
                                  nMode |= ( nUserMode & REQ_MODE_SB_IGN_ALL_UU ) ? CMODE_SB_IGN_ALL_UU : 0;
  ------------------
  |  |  785|      0|#define CMODE_SB_IGN_ALL_UU      0x001000    /* IAUSC Ignore stereobonds if All Undef/Unknown */
  ------------------
  |  Branch (4296:30): [True: 0, False: 0]
  ------------------
 4297|      0|                }
 4298|      3|                if (ret = AllocateCS( pCS, num_atoms, num_atoms, s[TAUT_NON].nLenCT, s[TAUT_NON].nLenCTAtOnly,
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                              if (ret = AllocateCS( pCS, num_atoms, num_atoms, s[TAUT_NON].nLenCT, s[TAUT_NON].nLenCTAtOnly,
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (4298:21): [True: 0, False: 3]
  ------------------
 4299|      3|                    s[TAUT_NON].nLenLinearCTStereoDble, s[TAUT_NON].nMaxNumStereoBonds,
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                                  s[TAUT_NON].nLenLinearCTStereoDble, s[TAUT_NON].nMaxNumStereoBonds,
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4300|      3|                    s[TAUT_NON].nLenLinearCTStereoCarb, s[TAUT_NON].nMaxNumStereoAtoms,
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                                  s[TAUT_NON].nLenLinearCTStereoCarb, s[TAUT_NON].nMaxNumStereoAtoms,
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4301|      3|                    0, 0, s[TAUT_NON].nLenIsotopic, nMode, pBCN ))
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4302|      0|                {
 4303|      0|                    goto exit_function;
 4304|      0|                }
 4305|      3|                *pCS2 = *pCS;
 4306|      3|                break;
 4307|   110k|            case TAUT_YES: /*  tautomeric */
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4307:13): [True: 110k, False: 3]
  ------------------
 4308|   110k|                nMode = 0;
 4309|   110k|                nMode = ( s[i].nLenLinearCTTautomer == 0 ) ? CANON_MODE_CT : CANON_MODE_TAUT;
  ------------------
  |  |  789|   110k|#define CANON_MODE_CT         (CMODE_CT)
  |  |  ------------------
  |  |  |  |  772|   110k|#define CMODE_CT                 0x000001
  |  |  ------------------
  ------------------
                              nMode = ( s[i].nLenLinearCTTautomer == 0 ) ? CANON_MODE_CT : CANON_MODE_TAUT;
  ------------------
  |  |  790|   110k|#define CANON_MODE_TAUT       (CMODE_CT|CMODE_TAUT)
  |  |  ------------------
  |  |  |  |  772|      5|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_TAUT       (CMODE_CT|CMODE_TAUT)
  |  |  ------------------
  |  |  |  |  777|      5|#define CMODE_TAUT               0x000020
  |  |  ------------------
  ------------------
  |  Branch (4309:25): [True: 110k, False: 5]
  ------------------
 4310|   110k|                nMode |= ( bHasIsotopicAtoms && ( nUserMode & REQ_MODE_ISO ) ) ? CANON_MODE_ISO : 0;
  ------------------
  |  |   45|     45|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
                              nMode |= ( bHasIsotopicAtoms && ( nUserMode & REQ_MODE_ISO ) ) ? CANON_MODE_ISO : 0;
  ------------------
  |  |  791|     45|#define CANON_MODE_ISO        (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT)
  |  |  ------------------
  |  |  |  |  772|     45|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_ISO        (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT)
  |  |  ------------------
  |  |  |  |  773|     45|#define CMODE_ISO                0x000002
  |  |  ------------------
  |  |               #define CANON_MODE_ISO        (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT)
  |  |  ------------------
  |  |  |  |  774|     45|#define CMODE_ISO_OUT            0x000004 /* obsolete ? */
  |  |  ------------------
  ------------------
  |  Branch (4310:28): [True: 45, False: 109k]
  |  Branch (4310:49): [True: 45, False: 0]
  ------------------
 4311|   110k|                nMode |= ( s[TAUT_YES].bMayHaveStereo && ( nUserMode & REQ_MODE_STEREO ) ) ? CANON_MODE_STEREO : 0;
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                              nMode |= ( s[TAUT_YES].bMayHaveStereo && ( nUserMode & REQ_MODE_STEREO ) ) ? CANON_MODE_STEREO : 0;
  ------------------
  |  |   47|      0|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
                              nMode |= ( s[TAUT_YES].bMayHaveStereo && ( nUserMode & REQ_MODE_STEREO ) ) ? CANON_MODE_STEREO : 0;
  ------------------
  |  |  792|      0|#define CANON_MODE_STEREO     (CMODE_CT|CMODE_STEREO)
  |  |  ------------------
  |  |  |  |  772|      0|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_STEREO     (CMODE_CT|CMODE_STEREO)
  |  |  ------------------
  |  |  |  |  775|      0|#define CMODE_STEREO             0x000008
  |  |  ------------------
  ------------------
  |  Branch (4311:28): [True: 0, False: 110k]
  |  Branch (4311:58): [True: 0, False: 0]
  ------------------
 4312|   110k|                nMode |= ( bHasIsotopicAtoms && s[TAUT_YES].bMayHaveStereo && ( nUserMode & REQ_MODE_ISO_STEREO ) ) ? CANON_MODE_ISO_STEREO : 0;
  ------------------
  |  |  580|     45|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                              nMode |= ( bHasIsotopicAtoms && s[TAUT_YES].bMayHaveStereo && ( nUserMode & REQ_MODE_ISO_STEREO ) ) ? CANON_MODE_ISO_STEREO : 0;
  ------------------
  |  |   48|      0|#define REQ_MODE_ISO_STEREO         0x000020    /* IS   */
  ------------------
                              nMode |= ( bHasIsotopicAtoms && s[TAUT_YES].bMayHaveStereo && ( nUserMode & REQ_MODE_ISO_STEREO ) ) ? CANON_MODE_ISO_STEREO : 0;
  ------------------
  |  |  793|      0|#define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  772|      0|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  773|      0|#define CMODE_ISO                0x000002
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  774|      0|#define CMODE_ISO_OUT            0x000004 /* obsolete ? */
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  776|      0|#define CMODE_ISO_STEREO         0x000010
  |  |  ------------------
  ------------------
  |  Branch (4312:28): [True: 45, False: 109k]
  |  Branch (4312:49): [True: 0, False: 45]
  |  Branch (4312:79): [True: 0, False: 0]
  ------------------
 4313|   110k|                nMode |= ( nUserMode & REQ_MODE_NOEQ_STEREO ) ? CMODE_NOEQ_STEREO : 0;
  ------------------
  |  |   49|   110k|#define REQ_MODE_NOEQ_STEREO        0x000040    /* SS   */
  ------------------
                              nMode |= ( nUserMode & REQ_MODE_NOEQ_STEREO ) ? CMODE_NOEQ_STEREO : 0;
  ------------------
  |  |  778|      0|#define CMODE_NOEQ_STEREO        0x000040 /* 5-24-2002: do not use stereo equivalence to accelerate */
  ------------------
  |  Branch (4313:26): [True: 0, False: 110k]
  ------------------
 4314|   110k|                nMode |= ( nUserMode & REQ_MODE_REDNDNT_STEREO ) ? CMODE_REDNDNT_STEREO : 0;
  ------------------
  |  |   50|   110k|#define REQ_MODE_REDNDNT_STEREO     0x000080    /* RS   */
  ------------------
                              nMode |= ( nUserMode & REQ_MODE_REDNDNT_STEREO ) ? CMODE_REDNDNT_STEREO : 0;
  ------------------
  |  |  779|      0|#define CMODE_REDNDNT_STEREO     0x000080 /* 6-11-2002: do not check for redundant stereo elements */
  ------------------
  |  Branch (4314:26): [True: 0, False: 110k]
  ------------------
 4315|   110k|                nMode |= ( nUserMode & REQ_MODE_NO_ALT_SBONDS ) ? CMODE_NO_ALT_SBONDS : 0;
  ------------------
  |  |   51|   110k|#define REQ_MODE_NO_ALT_SBONDS      0x000100    /* NASB */
  ------------------
                              nMode |= ( nUserMode & REQ_MODE_NO_ALT_SBONDS ) ? CMODE_NO_ALT_SBONDS : 0;
  ------------------
  |  |  780|      0|#define CMODE_NO_ALT_SBONDS      0x000100 /* 6-14-2002: do not assign stereo to alternating bonds */
  ------------------
  |  Branch (4315:26): [True: 0, False: 110k]
  ------------------
 4316|   110k|                if (( nMode & CANON_MODE_STEREO ) == CANON_MODE_STEREO ||
  ------------------
  |  |  792|   110k|#define CANON_MODE_STEREO     (CMODE_CT|CMODE_STEREO)
  |  |  ------------------
  |  |  |  |  772|   110k|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_STEREO     (CMODE_CT|CMODE_STEREO)
  |  |  ------------------
  |  |  |  |  775|   110k|#define CMODE_STEREO             0x000008
  |  |  ------------------
  ------------------
                              if (( nMode & CANON_MODE_STEREO ) == CANON_MODE_STEREO ||
  ------------------
  |  |  792|   220k|#define CANON_MODE_STEREO     (CMODE_CT|CMODE_STEREO)
  |  |  ------------------
  |  |  |  |  772|   110k|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_STEREO     (CMODE_CT|CMODE_STEREO)
  |  |  ------------------
  |  |  |  |  775|   110k|#define CMODE_STEREO             0x000008
  |  |  ------------------
  ------------------
  |  Branch (4316:21): [True: 0, False: 110k]
  ------------------
 4317|   110k|                    ( nMode & CANON_MODE_ISO_STEREO ) == CANON_MODE_ISO_STEREO)
  ------------------
  |  |  793|   110k|#define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  772|   110k|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  773|   110k|#define CMODE_ISO                0x000002
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  774|   110k|#define CMODE_ISO_OUT            0x000004 /* obsolete ? */
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  776|   110k|#define CMODE_ISO_STEREO         0x000010
  |  |  ------------------
  ------------------
                                  ( nMode & CANON_MODE_ISO_STEREO ) == CANON_MODE_ISO_STEREO)
  ------------------
  |  |  793|   110k|#define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  772|   110k|#define CMODE_CT                 0x000001
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  773|   110k|#define CMODE_ISO                0x000002
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  774|   110k|#define CMODE_ISO_OUT            0x000004 /* obsolete ? */
  |  |  ------------------
  |  |               #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
  |  |  ------------------
  |  |  |  |  776|   110k|#define CMODE_ISO_STEREO         0x000010
  |  |  ------------------
  ------------------
  |  Branch (4317:21): [True: 0, False: 110k]
  ------------------
 4318|      0|                {
 4319|      0|                    nMode |= ( nUserMode & REQ_MODE_RELATIVE_STEREO ) ? CMODE_RELATIVE_STEREO : 0;
  ------------------
  |  |   54|      0|#define REQ_MODE_RELATIVE_STEREO    0x000200    /* REL All Relative Stereo */
  ------------------
                                  nMode |= ( nUserMode & REQ_MODE_RELATIVE_STEREO ) ? CMODE_RELATIVE_STEREO : 0;
  ------------------
  |  |  782|      0|#define CMODE_RELATIVE_STEREO    0x000200    /* REL All Relative Stereo */
  ------------------
  |  Branch (4319:30): [True: 0, False: 0]
  ------------------
 4320|      0|                    nMode |= ( nUserMode & REQ_MODE_RACEMIC_STEREO ) ? CMODE_RACEMIC_STEREO : 0;
  ------------------
  |  |   56|      0|#define REQ_MODE_RACEMIC_STEREO     0x000400    /* RAC All Racemic Stereo */
  ------------------
                                  nMode |= ( nUserMode & REQ_MODE_RACEMIC_STEREO ) ? CMODE_RACEMIC_STEREO : 0;
  ------------------
  |  |  783|      0|#define CMODE_RACEMIC_STEREO     0x000400    /* RAC All Racemic Stereo */
  ------------------
  |  Branch (4320:30): [True: 0, False: 0]
  ------------------
 4321|      0|                    nMode |= ( nUserMode & REQ_MODE_SC_IGN_ALL_UU ) ? CMODE_SC_IGN_ALL_UU : 0;
  ------------------
  |  |   58|      0|#define REQ_MODE_SC_IGN_ALL_UU      0x000800    /* IAUSC Ignore stereocenters if All Undef/Unknown */
  ------------------
                                  nMode |= ( nUserMode & REQ_MODE_SC_IGN_ALL_UU ) ? CMODE_SC_IGN_ALL_UU : 0;
  ------------------
  |  |  784|      0|#define CMODE_SC_IGN_ALL_UU      0x000800    /* IAUSC Ignore stereocenters if All Undef/Unknown */
  ------------------
  |  Branch (4321:30): [True: 0, False: 0]
  ------------------
 4322|      0|                    nMode |= ( nUserMode & REQ_MODE_SB_IGN_ALL_UU ) ? CMODE_SB_IGN_ALL_UU : 0;
  ------------------
  |  |   60|      0|#define REQ_MODE_SB_IGN_ALL_UU      0x001000    /* IAUSC Ignore stereobonds if All Undef/Unknown */
  ------------------
                                  nMode |= ( nUserMode & REQ_MODE_SB_IGN_ALL_UU ) ? CMODE_SB_IGN_ALL_UU : 0;
  ------------------
  |  |  785|      0|#define CMODE_SB_IGN_ALL_UU      0x001000    /* IAUSC Ignore stereobonds if All Undef/Unknown */
  ------------------
  |  Branch (4322:30): [True: 0, False: 0]
  ------------------
 4323|      0|                }
 4324|   110k|                if (ret = AllocateCS( pCS, num_atoms, num_at_tg, s[TAUT_YES].nLenCT, s[TAUT_YES].nLenCTAtOnly,
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                              if (ret = AllocateCS( pCS, num_atoms, num_at_tg, s[TAUT_YES].nLenCT, s[TAUT_YES].nLenCTAtOnly,
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4324:21): [True: 0, False: 110k]
  ------------------
 4325|   110k|                    s[TAUT_YES].nLenLinearCTStereoDble, s[TAUT_YES].nMaxNumStereoBonds,
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                                  s[TAUT_YES].nLenLinearCTStereoDble, s[TAUT_YES].nMaxNumStereoBonds,
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4326|   110k|                    s[TAUT_YES].nLenLinearCTStereoCarb, s[TAUT_YES].nMaxNumStereoAtoms,
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                                  s[TAUT_YES].nLenLinearCTStereoCarb, s[TAUT_YES].nMaxNumStereoAtoms,
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4327|   110k|                    s[TAUT_YES].nLenLinearCTTautomer, s[TAUT_YES].nLenLinearCTIsotopicTautomer,
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                                  s[TAUT_YES].nLenLinearCTTautomer, s[TAUT_YES].nLenLinearCTIsotopicTautomer,
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4328|   110k|                    s[TAUT_YES].nLenIsotopic, nMode, pBCN ))
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4329|      0|                {
 4330|      0|                    goto exit_function;
 4331|      0|                }
 4332|   110k|                *pCS2 = *pCS;
 4333|   110k|                break;
 4334|   110k|        }
 4335|       |
 4336|       |        /* 2009-12-05 */
 4337|   110k|        nMode |= ( nUserMode & REQ_MODE_DIFF_UU_STEREO ) ? REQ_MODE_DIFF_UU_STEREO : 0;
  ------------------
  |  |   68|   110k|#define REQ_MODE_DIFF_UU_STEREO     0x004000    /* SLUUD Make labels for unknown and undefined stereo different */
  ------------------
                      nMode |= ( nUserMode & REQ_MODE_DIFF_UU_STEREO ) ? REQ_MODE_DIFF_UU_STEREO : 0;
  ------------------
  |  |   68|      0|#define REQ_MODE_DIFF_UU_STEREO     0x004000    /* SLUUD Make labels for unknown and undefined stereo different */
  ------------------
  |  Branch (4337:18): [True: 0, False: 110k]
  ------------------
 4338|       |        /* 2009-12-05 */
 4339|       |
 4340|       |        /*  settings */
 4341|   110k|        pCS->lNumDecreasedCT = -1;
 4342|   110k|        pCS->bDoubleBondSquare = DOUBLE_BOND_NEIGH_LIST ? 2 : 0;  /*  2 => special mode */
  ------------------
  |  |  813|   110k|#define DOUBLE_BOND_NEIGH_LIST    0  /* 1 => include double bond neighbor in NeighList 2 times */
  |  |  ------------------
  |  |  |  Branch (813:35): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4343|   110k|        pCS->bIgnoreIsotopic = !( ( s[TAUT_NON].num_isotopic_atoms ||
  ------------------
  |  |  579|   110k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (4343:37): [True: 4, False: 110k]
  ------------------
 4344|   110k|            s[TAUT_YES].num_isotopic_atoms ||
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4344:13): [True: 43, False: 109k]
  ------------------
 4345|   110k|            s[TAUT_YES].bHasIsotopicTautGroups ) ||
  ------------------
  |  |  580|   109k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4345:13): [True: 0, False: 109k]
  ------------------
 4346|   110k|            ( nUserMode & REQ_MODE_NON_ISO ) ||
  ------------------
  |  |   46|   109k|#define REQ_MODE_NON_ISO            0x000008    /* NI   */
  ------------------
  |  Branch (4346:13): [True: 109k, False: 0]
  ------------------
 4347|   110k|                                               !( nUserMode & REQ_MODE_ISO ) );
  ------------------
  |  |   45|      0|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
  |  Branch (4347:48): [True: 0, False: 0]
  ------------------
 4348|       |
 4349|   110k|        if (( nUserMode & REQ_MODE_NON_ISO ) && !( nUserMode & REQ_MODE_ISO ))
  ------------------
  |  |   46|   110k|#define REQ_MODE_NON_ISO            0x000008    /* NI   */
  ------------------
                      if (( nUserMode & REQ_MODE_NON_ISO ) && !( nUserMode & REQ_MODE_ISO ))
  ------------------
  |  |   45|   110k|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
  |  Branch (4349:13): [True: 110k, False: 0]
  |  Branch (4349:49): [True: 109k, False: 47]
  ------------------
 4350|   109k|        {
 4351|   109k|            pCS->bIgnoreIsotopic = 1; /* 10-04-2004 */
 4352|   109k|        }
 4353|       |
 4354|   110k|        if (i == TAUT_YES)
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4354:13): [True: 110k, False: 3]
  ------------------
 4355|   110k|        {
 4356|       |            /* tautomeric */
 4357|   110k|            pCS->t_group_info = t_group_info; /*  ??? make a copy or reuse ???  */
 4358|   110k|            pCS->t_group_info->bIgnoreIsotopic = !( s[TAUT_YES].bHasIsotopicTautGroups ||
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4358:53): [True: 2, False: 110k]
  ------------------
 4359|   110k|                ( nUserMode & REQ_MODE_NON_ISO ) ||
  ------------------
  |  |   46|   110k|#define REQ_MODE_NON_ISO            0x000008    /* NI   */
  ------------------
  |  Branch (4359:17): [True: 110k, False: 0]
  ------------------
 4360|   110k|                                                   !( nUserMode & REQ_MODE_ISO ) );
  ------------------
  |  |   45|      0|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
  |  Branch (4360:52): [True: 0, False: 0]
  ------------------
 4361|   110k|            if (( nUserMode & REQ_MODE_NON_ISO ) && !( nUserMode & REQ_MODE_ISO ))
  ------------------
  |  |   46|   110k|#define REQ_MODE_NON_ISO            0x000008    /* NI   */
  ------------------
                          if (( nUserMode & REQ_MODE_NON_ISO ) && !( nUserMode & REQ_MODE_ISO ))
  ------------------
  |  |   45|   110k|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
  |  Branch (4361:17): [True: 110k, False: 0]
  |  Branch (4361:53): [True: 109k, False: 45]
  ------------------
 4362|   109k|            {
 4363|   109k|                pCS->t_group_info->bIgnoreIsotopic = 1; /* 10-04-2004 */
 4364|   109k|            }
 4365|   110k|        }
 4366|       |
 4367|   110k|        pCS->ulTimeOutTime = pBCN->ulTimeOutTime;
 4368|       |        /*=========== Obsolete Mode Bits (bit 0 is Least Significant Bit) ===========
 4369|       |         *
 4370|       |         *  Mode      Bits       Description
 4371|       |         *   '0' c    0          Only one connection table canonicalization
 4372|       |         *   '1' C    1          Recalculate CT using fixed nSymmRank
 4373|       |         *   '2' i    1|2        Isotopic canonicalization (internal)
 4374|       |         *   '3' I    1|2|4      Isotopic canonicalization (output)
 4375|       |         *   '4' s    1|8        Stereo canonicalization
 4376|       |         *   '5' S    1|2|4|16   Stereo isotopic canonicalization
 4377|       |         *   '6' A    1|2|4|8|16 Output All
 4378|       |         */
 4379|       |
 4380|       |        /*
 4381|       |            The last canonicalization step
 4382|       |        */
 4383|       |
 4384|   110k|        if (pBCN)
  ------------------
  |  Branch (4384:13): [True: 110k, False: 0]
  ------------------
 4385|   110k|        {
 4386|       |            /* USE_CANON2 == 1 */
 4387|   110k|            pCS->NeighList = NULL;
 4388|   110k|            pCS->pBCN = pBCN;
 4389|       |
 4390|   110k|            ret = Canon_INChI( ic,
 4391|   110k|                               num_atoms,
 4392|   110k|                               i ? num_at_tg : num_atoms,
  ------------------
  |  Branch (4392:32): [True: 110k, False: 3]
  ------------------
 4393|   110k|                               at[i], pCS,
 4394|   110k|                               pCG,
 4395|   110k|                               nMode, i );
 4396|   110k|        }
 4397|      0|        else
 4398|      0|        {
 4399|       |            /* old way */
 4400|      0|            pCS->NeighList = CreateNeighList( num_atoms,
 4401|      0|                                               i ? num_at_tg : num_atoms,
  ------------------
  |  Branch (4401:48): [True: 0, False: 0]
  ------------------
 4402|      0|                                               at[i],
 4403|      0|                                               pCS->bDoubleBondSquare,
 4404|      0|                                               pCS->t_group_info );
 4405|      0|            pCS->pBCN = NULL;
 4406|       |
 4407|      0|            ret = Canon_INChI( ic,
 4408|      0|                               num_atoms,
 4409|      0|                               i ? num_at_tg : num_atoms,
  ------------------
  |  Branch (4409:32): [True: 0, False: 0]
  ------------------
 4410|      0|                               at[i], pCS,
 4411|      0|                               pCG,
 4412|      0|                               nMode, i );
 4413|      0|        }
 4414|       |
 4415|   110k|        pINChI = ppINChI[i];      /* pointers to already allocated still empty InChI */
 4416|   110k|        pINChI_Aux = ppINChI_Aux[i];
 4417|       |
 4418|   110k|        if (ret <= 0)
  ------------------
  |  Branch (4418:13): [True: 0, False: 110k]
  ------------------
 4419|      0|        {
 4420|       |            /*
 4421|       |                Failure in Canon_INChI()
 4422|       |            */
 4423|      0|            pINChI->nErrorCode = ret;
 4424|      0|            pINChI_Aux->nErrorCode = ret;
 4425|      0|        }
 4426|   110k|        else
 4427|   110k|        {
 4428|       |            /*
 4429|       |                Success Canon_INChI()
 4430|       |
 4431|       |                save canonicalization results in
 4432|       |                pINChI and pINChI_Aux
 4433|       |            */
 4434|   110k|            pINChI->nErrorCode = 0;
 4435|   110k|            pINChI_Aux->nErrorCode = 0;
 4436|   110k|            pINChI->bDeleted = pINChI_Aux->bDeleted = out_norm_data[i]->bDeleted;
 4437|   110k|            pINChI_Aux->nCanonFlags = pCS->nCanonFlags;
 4438|   110k|            pINChI_Aux->bTautFlags = out_norm_data[i]->bTautFlags;
 4439|   110k|            pINChI_Aux->bTautFlagsDone = out_norm_data[i]->bTautFlagsDone;
 4440|   110k|            pINChI_Aux->bNormalizationFlags = out_norm_data[i]->bNormalizationFlags;
 4441|       |
 4442|       |            /*  may return an error or a warning */
 4443|   110k|            ret = FillOutINChI( pINChI, pINChI_Aux,
 4444|   110k|                               num_atoms, i ? num_at_tg : num_atoms,
  ------------------
  |  Branch (4444:43): [True: 110k, False: 3]
  ------------------
 4445|   110k|                               i ? num_removed_H_taut : num_removed_H, at[i],
  ------------------
  |  Branch (4445:32): [True: 110k, False: 3]
  ------------------
 4446|   110k|                               out_norm_data[i]->at, pCS,
 4447|   110k|                               pCG,
 4448|   110k|                               i, nUserMode,
 4449|   110k|                               pStrErrStruct, ip->bNoWarnings );
 4450|       |
 4451|   110k|            if (RETURNED_ERROR( ret ))
  ------------------
  |  |   72|   110k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   68|   110k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   66|   110k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   110k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   69|   110k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   46|   110k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (72:31): [True: 110k, False: 0]
  |  |  |  Branch (72:53): [True: 0, False: 110k]
  |  |  ------------------
  ------------------
 4452|      0|            {
 4453|       |                /* Failure in FillOutINChI() */
 4454|      0|                pINChI->nErrorCode = ret;
 4455|      0|                pINChI_Aux->nErrorCode = ret;
 4456|      0|            }
 4457|   110k|            else
 4458|   110k|            {
 4459|       |                /* Success in FillOutINChI() */
 4460|       |
 4461|       |#if ( bRELEASE_VERSION == 0 )
 4462|       |                if (pINChI->Stereo &&
 4463|       |                    ( pINChI->Stereo->nCompInv2Abs && !pINChI->Stereo->bTrivialInv ) ||
 4464|       |                     pINChI->StereoIsotopic &&
 4465|       |                     ( pINChI->StereoIsotopic->nCompInv2Abs && !pINChI->StereoIsotopic->bTrivialInv ))
 4466|       |                {
 4467|       |                    bExtract |= EXTR_NON_TRIVIAL_STEREO;
 4468|       |                }
 4469|       |#endif
 4470|       |                /*    Mark non-tautomeric representation as having
 4471|       |                    another, tautomeric representation */
 4472|   110k|                if (pINChI_Aux && s[TAUT_YES].nLenLinearCTTautomer)
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4472:21): [True: 110k, False: 0]
  |  Branch (4472:35): [True: 8, False: 110k]
  ------------------
 4473|      8|                {
 4474|      8|                    pINChI_Aux->bIsTautomeric = s[TAUT_YES].nLenLinearCTTautomer;
  ------------------
  |  |  580|      8|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4475|      8|                }
 4476|       |#if ( bRELEASE_VERSION == 0 )
 4477|       |                pCS->bExtract |= bExtract;
 4478|       |                pINChI->bExtract |= pCS->bExtract;
 4479|       |#endif
 4480|       |
 4481|   110k|                ret2 = CheckCanonNumberingCorrectness( num_atoms,
 4482|   110k|                                                      i ? num_at_tg : num_atoms,
  ------------------
  |  Branch (4482:55): [True: 110k, False: 3]
  ------------------
 4483|   110k|                                                      at[i], pCS,
 4484|   110k|                                                      pCG,
 4485|   110k|                                                      i, pStrErrStruct );
 4486|   110k|                if (ret2)
  ------------------
  |  Branch (4486:21): [True: 0, False: 110k]
  ------------------
 4487|      0|                {
 4488|      0|                    pINChI->nErrorCode = ret2;
 4489|      0|                    pINChI_Aux->nErrorCode = ret2;
 4490|      0|                    ret = ret2;
 4491|      0|                }
 4492|   110k|            }
 4493|   110k|        }
 4494|       |
 4495|   110k|        FreeNeighList( pCS->NeighList );
 4496|   110k|        DeAllocateCS( pCS2 );
 4497|       |
 4498|   110k|        pINChI = NULL;      /* avoid dangling pointers */
 4499|   110k|        pINChI_Aux = NULL;  /* avoid dangling pointers */
 4500|   110k|    }
 4501|       |
 4502|   110k|    if (ret == 0)
  ------------------
  |  Branch (4502:9): [True: 110k, False: 0]
  ------------------
 4503|   110k|    {
 4504|   110k|        ret = num_atoms;
 4505|   110k|    }
 4506|       |    /*  treat the results later */
 4507|       |
 4508|   110k|exit_function:
 4509|       |
 4510|   110k|    DeAllocBCN( pBCN );
 4511|   110k|    if (at[TAUT_YES])
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (4511:9): [True: 110k, False: 0]
  ------------------
 4512|   110k|    {
 4513|   110k|        inchi_free( at[TAUT_YES] );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4514|   110k|    }
 4515|   110k|    if (at[TAUT_NON])
  ------------------
  |  |  579|   110k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (4515:9): [True: 3, False: 110k]
  ------------------
 4516|      3|    {
 4517|      3|        inchi_free( at[TAUT_NON] );
  ------------------
  |  | 1136|      3|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 3, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4518|      3|    }
 4519|   110k|    if (ti_out)
  ------------------
  |  Branch (4519:9): [True: 55.4k, False: 54.6k]
  ------------------
 4520|  55.4k|    {
 4521|  55.4k|        *ti_out = *t_group_info;
 4522|  55.4k|    }
 4523|  54.6k|    else
 4524|  54.6k|    {
 4525|  54.6k|        free_t_group_info( t_group_info );
 4526|  54.6k|    }
 4527|   110k|    free_t_group_info( t_group_info_orig );
 4528|       |
 4529|   110k|    if (ebend)
  ------------------
  |  Branch (4529:9): [True: 0, False: 110k]
  ------------------
 4530|      0|    {
 4531|      0|        inchi_free( ebend );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4532|      0|    }
 4533|       |
 4534|   110k|    return ret;
 4535|   110k|}
CheckCanonNumberingCorrectness:
 6247|   110k|{
 6248|   110k|    int i, ret = 0;
 6249|   110k|    AT_NUMB *pCanonOrd = NULL;
 6250|   110k|    int nErrorCode = 0;
 6251|   110k|    AT_NUMB *pCanonRank; /* canonical ranks of the atoms or tautomeric groups */
 6252|   110k|    AT_NUMB *pCanonRankAtoms = NULL;
 6253|       |
 6254|   110k|    static int count = 0; /* for debug only */
 6255|   110k|    count++;
 6256|       |
 6257|   110k|    pCanonRankAtoms = (AT_NUMB *) inchi_calloc( num_at_tg + 1, sizeof( pCanonRankAtoms[0] ) );
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
 6258|       |
 6259|       |    /*
 6260|       |        Non-isotopic part
 6261|       |    */
 6262|       |
 6263|   110k|    pCanonOrd = pCS->nLenCanonOrdStereo > 0 ? pCS->nCanonOrdStereo :
  ------------------
  |  Branch (6263:17): [True: 0, False: 110k]
  ------------------
 6264|   110k|        pCS->nLenCanonOrd > 0 ? pCS->nCanonOrd : NULL;
  ------------------
  |  Branch (6264:9): [True: 110k, False: 0]
  ------------------
 6265|   110k|    pCanonRank = pCanonRankAtoms;
 6266|   110k|    if (pCanonOrd && pCanonRank)
  ------------------
  |  Branch (6266:9): [True: 110k, False: 0]
  |  Branch (6266:22): [True: 110k, False: 0]
  ------------------
 6267|   110k|    {
 6268|   222k|        for (i = 0; i < num_at_tg; i++)
  ------------------
  |  Branch (6268:21): [True: 112k, False: 110k]
  ------------------
 6269|   112k|        {
 6270|   112k|            pCanonRank[pCanonOrd[i]] = (AT_NUMB) ( i + 1 );
 6271|   112k|        }
 6272|   110k|        ret = UpdateFullLinearCT( num_atoms, num_at_tg, at, pCanonRank, pCanonOrd, pCS,
 6273|   110k|                                  pCG,
 6274|   110k|                                  0 );
 6275|   110k|        if (ret /*|| memcmp(pCS->LinearCT, pCS->LinearCT2, sizeof(AT_RANK) * pCS->nLenLinearCT )*/)
  ------------------
  |  Branch (6275:13): [True: 0, False: 110k]
  ------------------
 6276|      0|        {
 6277|      0|            nErrorCode |= WARN_FAILED_STEREO;
  ------------------
  |  |   76|      0|#define WARN_FAILED_STEREO          0x0001
  ------------------
 6278|      0|        }
 6279|   110k|    }
 6280|      0|    else
 6281|      0|    {
 6282|      0|        nErrorCode |= ERR_NO_CANON_RESULTS;
  ------------------
  |  |   79|      0|#define ERR_NO_CANON_RESULTS        0x0008
  ------------------
 6283|      0|        goto exit_function;
 6284|      0|    }
 6285|       |
 6286|       |    /*
 6287|       |        Isotopic part
 6288|       |    */
 6289|       |
 6290|   110k|    pCanonOrd = pCS->nLenCanonOrdIsotopicStereo > 0 ? pCS->nCanonOrdIsotopicStereo :
  ------------------
  |  Branch (6290:17): [True: 0, False: 110k]
  ------------------
 6291|   110k|        pCS->nLenCanonOrdIsotopic > 0 ? pCS->nCanonOrdIsotopic : NULL;
  ------------------
  |  Branch (6291:9): [True: 47, False: 109k]
  ------------------
 6292|   110k|    pCanonRank = pCanonRankAtoms;
 6293|       |
 6294|   110k|    if (pCanonOrd && pCanonRank)
  ------------------
  |  Branch (6294:9): [True: 47, False: 109k]
  |  Branch (6294:22): [True: 47, False: 0]
  ------------------
 6295|     47|    {
 6296|  1.37k|        for (i = 0; i < num_at_tg; i++)
  ------------------
  |  Branch (6296:21): [True: 1.32k, False: 47]
  ------------------
 6297|  1.32k|        {
 6298|  1.32k|            pCanonRank[pCanonOrd[i]] = (AT_NUMB) ( i + 1 );
 6299|  1.32k|        }
 6300|     47|        ret = UpdateFullLinearCT( num_atoms, num_at_tg, at, pCanonRank, pCanonOrd, pCS,
 6301|     47|                                  pCG,
 6302|     47|                                  0 );
 6303|     47|        if (ret /*|| memcmp(pCS->LinearCT, pCS->LinearCT2, sizeof(AT_RANK) * pCS->nLenLinearCT )*/)
  ------------------
  |  Branch (6303:13): [True: 0, False: 47]
  ------------------
 6304|      0|        {
 6305|      0|            nErrorCode |= ( pCS->nLenCanonOrdIsotopicStereo ? WARN_FAILED_ISOTOPIC_STEREO : WARN_FAILED_ISOTOPIC );
  ------------------
  |  |   78|      0|#define WARN_FAILED_ISOTOPIC_STEREO 0x0004
  ------------------
                          nErrorCode |= ( pCS->nLenCanonOrdIsotopicStereo ? WARN_FAILED_ISOTOPIC_STEREO : WARN_FAILED_ISOTOPIC );
  ------------------
  |  |   77|      0|#define WARN_FAILED_ISOTOPIC        0x0002
  ------------------
  |  Branch (6305:29): [True: 0, False: 0]
  ------------------
 6306|      0|        }
 6307|     47|    }
 6308|       |
 6309|   110k|exit_function:
 6310|   110k|    if (pCanonRankAtoms)
  ------------------
  |  Branch (6310:9): [True: 110k, False: 0]
  ------------------
 6311|   110k|    {
 6312|   110k|        inchi_free( pCanonRankAtoms );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 6313|   110k|    }
 6314|       |
 6315|   110k|    if (nErrorCode)
  ------------------
  |  Branch (6315:9): [True: 0, False: 110k]
  ------------------
 6316|      0|    {
 6317|      0|        return CT_CANON_ERR;
  ------------------
  |  |   63|      0|#define CT_CANON_ERR         (CT_ERR_FIRST-16)  /*(-30016) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 6318|      0|    }
 6319|       |
 6320|   110k|    return 0;
 6321|   110k|}
ichimake.c:CompareDfsDescendants4CT:
 2110|      9|{
 2111|      9|    OrderStruct *os = (OrderStruct *) p;
 2112|      9|    int neigh1 = ( int )*(const AT_RANK*) a1;
 2113|      9|    int neigh2 = ( int )*(const AT_RANK*) a2;
 2114|      9|    if (neigh1 > MAX_ATOMS)
  ------------------
  |  |   43|      9|#define MAX_ATOMS  32766
  ------------------
  |  Branch (2114:9): [True: 3, False: 6]
  ------------------
 2115|      3|    {
 2116|      3|        if (neigh2 > MAX_ATOMS)
  ------------------
  |  |   43|      3|#define MAX_ATOMS  32766
  ------------------
  |  Branch (2116:13): [True: 0, False: 3]
  ------------------
 2117|      0|        {
 2118|      0|            return 0;
 2119|      0|        }
 2120|      3|        return 1;
 2121|      3|    }
 2122|      6|    else if (neigh2 > MAX_ATOMS)
  ------------------
  |  |   43|      6|#define MAX_ATOMS  32766
  ------------------
  |  Branch (2122:14): [True: 6, False: 0]
  ------------------
 2123|      6|    {
 2124|      6|        return -1;
 2125|      6|    }
 2126|      0|    else
 2127|      0|    {
 2128|      0|        AT_RANK nCurDfsNumber = os->m_gDfs4CT_nDfsNumber[os->m_gDfs4CT_nCurrentAtom];
 2129|      0|        int nDesc1 = nCurDfsNumber > os->m_gDfs4CT_nDfsNumber[neigh1] ?
  ------------------
  |  Branch (2129:22): [True: 0, False: 0]
  ------------------
 2130|      0|            0 : (int) os->m_gDfs4CT_nNumDescendants[neigh1];
 2131|      0|        int nDesc2 = nCurDfsNumber > os->m_gDfs4CT_nDfsNumber[neigh2] ?
  ------------------
  |  Branch (2131:22): [True: 0, False: 0]
  ------------------
 2132|      0|            0 : (int) os->m_gDfs4CT_nNumDescendants[neigh2];
 2133|      0|        int ret;
 2134|      0|        if (ret = nDesc1 - nDesc2)
  ------------------
  |  Branch (2134:13): [True: 0, False: 0]
  ------------------
 2135|      0|        {
 2136|      0|            return ret;
 2137|      0|        }
 2138|      0|        return  (int) neigh1 - (int) neigh2; /*  canon. numbers difference */
 2139|      0|    }
 2140|      9|}

CurTreeFree:
  866|   110k|{
  867|   110k|    if (cur_tree)
  ------------------
  |  Branch (867:9): [True: 0, False: 110k]
  ------------------
  868|      0|    {
  869|      0|        inchi_free( cur_tree->tree );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  870|      0|        memset( cur_tree, 0, sizeof( *cur_tree ) );
  871|      0|    }
  872|   110k|}

SortedEquInfoToRanks:
  141|   110k|{
  142|       |    /* v. 1.05 - changed declaration of nNumDiffRanks as suggested by Burt Leland
  143|       |                 to avoid the problem arising on compilation with VS2015
  144|       |
  145|       |    AT_RANK        rNew, rOld, nNumDiffRanks;*/
  146|   110k|    AT_RANK        rNew, rOld;
  147|   110k|    int            nNumDiffRanks = 1;
  148|       |
  149|       |
  150|   110k|    int            i, j, nNumChanges = 0;
  151|   110k|    for (i = num_atoms - 1, j = (int) nAtomNumber[i],
  152|   110k|          rOld = nSymmRank[j], rNew = nRank[j] = (AT_RANK) num_atoms,
  153|   110k|          nNumDiffRanks = 1;
  154|   112k|             i > 0;
  ------------------
  |  Branch (154:14): [True: 2.87k, False: 110k]
  ------------------
  155|   110k|                 i--)
  156|  2.87k|    {
  157|  2.87k|        j = (int) nAtomNumber[i - 1];
  158|       |
  159|  2.87k|        if (nSymmRank[j] != rOld)
  ------------------
  |  Branch (159:13): [True: 920, False: 1.95k]
  ------------------
  160|    920|        {
  161|    920|            nNumDiffRanks++;
  162|    920|            rNew = (AT_RANK) i;
  163|    920|            nNumChanges += ( rOld != rNew + 1 );
  164|    920|            rOld = nSymmRank[j];
  165|    920|        }
  166|       |
  167|  2.87k|        nRank[j] = rNew;
  168|  2.87k|    }
  169|   110k|    if (bChanged)
  ------------------
  |  Branch (169:9): [True: 110k, False: 0]
  ------------------
  170|   110k|    {
  171|   110k|        *bChanged = ( 0 != nNumChanges );
  172|   110k|    }
  173|       |
  174|   110k|    return nNumDiffRanks;
  175|   110k|}
switch_ptrs:
  216|   276k|{
  217|   276k|    AT_RANK *tmp = *p1;
  218|   276k|    *p1 = *p2;
  219|   276k|    *p2 = tmp;
  220|   276k|}
SetNewRanksFromNeighLists3:
  232|  88.7k|{
  233|  88.7k|    int     i, j, nNumDiffRanks, nNumNewRanks;
  234|  88.7k|    AT_RANK r1, r2;
  235|       |
  236|       |    /*  -- nAtomNumber[] is already properly set --
  237|       |    for ( i = 0; i < num_atoms; i++ ) {
  238|       |        nAtomNumber[i] = (AT_RANK)i;
  239|       |    }
  240|       |    */
  241|       |    /*  set globals for qsort */
  242|       |
  243|  88.7k|    pCG->m_pNeighList_RankForSort = NeighList;
  244|  88.7k|    pCG->m_pn_RankForSort = nRank;
  245|  88.7k|    nNumDiffRanks = 0;
  246|  88.7k|    nNumNewRanks = 0;
  247|       |
  248|  88.7k|    memset( nNewRank, 0, num_atoms * sizeof( nNewRank[0] ) );
  249|       |
  250|       |    /*  sorting */
  251|  8.00M|    for (i = 0, r1 = 1; i < num_atoms; r1++)
  ------------------
  |  Branch (251:25): [True: 7.91M, False: 88.7k]
  ------------------
  252|  7.91M|    {
  253|  7.91M|        if (r1 == ( r2 = nRank[j = (int) nAtomNumber[i]] ))
  ------------------
  |  Branch (253:13): [True: 7.77M, False: 133k]
  ------------------
  254|  7.77M|        {
  255|  7.77M|            nNewRank[j] = r2;
  256|  7.77M|            nNumDiffRanks++;
  257|  7.77M|            i++;
  258|  7.77M|            continue;
  259|  7.77M|        }
  260|   133k|        r1 = r2;
  261|   133k|        insertions_sort_AT_NUMBERS( pCG, nAtomNumber + i, (int) r2 - i, CompNeighLists );
  262|       |        /*insertions_sort( nAtomNumber+i, r2-i, sizeof( nAtomNumber[0] ), CompNeighLists );*/
  263|   133k|        j = r2 - 1;
  264|   133k|        nNewRank[(int) nAtomNumber[j]] = r2;
  265|   133k|        nNumDiffRanks++;
  266|  3.97M|        while (j > i)
  ------------------
  |  Branch (266:16): [True: 3.84M, False: 133k]
  ------------------
  267|  3.84M|        {
  268|  3.84M|            if (CompareNeighListLex( NeighList[(int) nAtomNumber[j - 1]],
  ------------------
  |  Branch (268:17): [True: 0, False: 3.84M]
  ------------------
  269|  3.84M|                NeighList[(int) nAtomNumber[j]], nRank ))
  270|      0|            {
  271|      0|                r2 = j;
  272|      0|                nNumDiffRanks++;
  273|      0|                nNumNewRanks++;
  274|      0|            }
  275|  3.84M|            j--;
  276|  3.84M|            nNewRank[(int) nAtomNumber[j]] = r2;
  277|  3.84M|        }
  278|   133k|        i = r1;
  279|   133k|    }
  280|       |
  281|  88.7k|    return nNumNewRanks ? -nNumDiffRanks : nNumDiffRanks;
  ------------------
  |  Branch (281:12): [True: 0, False: 88.7k]
  ------------------
  282|  88.7k|}
SetNewRanksFromNeighLists4:
  297|  77.7k|{
  298|  77.7k|    int     i, j, nNumDiffRanks, nNumNewRanks;
  299|  77.7k|    AT_RANK r1, r2;
  300|       |    /*  -- nAtomNumber[] is already properly set --
  301|       |    for ( i = 0; i < num_atoms; i++ ) {
  302|       |        nAtomNumber[i] = (AT_RANK)i;
  303|       |    }
  304|       |    */
  305|       |
  306|       |    /*  set globals for CompNeighListsUpToMaxRank */
  307|  77.7k|    pCG->m_pNeighList_RankForSort = NeighList;
  308|  77.7k|    pCG->m_pn_RankForSort = nRank;
  309|  77.7k|    nNumDiffRanks = 0;
  310|  77.7k|    nNumNewRanks = 0;
  311|  77.7k|    pCG->m_nMaxAtNeighRankForSort = nMaxAtRank;
  312|       |
  313|  77.7k|    memset( nNewRank, 0, num_atoms * sizeof( nNewRank[0] ) );
  314|       |
  315|       |    /*  sorting */
  316|  7.45M|    for (i = 0, r1 = 1; i < num_atoms; r1++)
  ------------------
  |  Branch (316:25): [True: 7.37M, False: 77.7k]
  ------------------
  317|  7.37M|    {
  318|  7.37M|        if (r1 == ( r2 = nRank[j = (int) nAtomNumber[i]] ))
  ------------------
  |  Branch (318:13): [True: 7.25M, False: 122k]
  ------------------
  319|  7.25M|        {
  320|       |            /* non-tied rank: singleton */
  321|  7.25M|            nNewRank[j] = r2;
  322|  7.25M|            nNumDiffRanks++;
  323|  7.25M|            i++;
  324|  7.25M|            continue;
  325|  7.25M|        }
  326|       |        /* tied rank r2
  327|       |           r2-i atoms have rank r2
  328|       |           next atom after them is in position r2
  329|       |        */
  330|   122k|        r1 = r2;
  331|       |
  332|   122k|        insertions_sort_AT_NUMBERS( pCG, nAtomNumber + i,
  333|   122k|            (int) r2 - i, CompNeighListsUpToMaxRank );
  334|       |        /*insertions_sort( nAtomNumber+i, r2-i, sizeof( nAtomNumber[0] ),  CompNeighListsUpToMaxRank );*/
  335|       |
  336|   122k|        j = r2 - 1; /* prepare cycle backward, from j to i step -1 */
  337|   122k|        nNewRank[(int) nAtomNumber[j]] = r2;
  338|   122k|        nNumDiffRanks++;
  339|  3.63M|        while (j > i)
  ------------------
  |  Branch (339:16): [True: 3.50M, False: 122k]
  ------------------
  340|  3.50M|        {
  341|  3.50M|            if (CompareNeighListLexUpToMaxRank( NeighList[nAtomNumber[j - 1]],
  ------------------
  |  Branch (341:17): [True: 0, False: 3.50M]
  ------------------
  342|  3.50M|                NeighList[nAtomNumber[j]], nRank, nMaxAtRank ))
  343|      0|            {
  344|      0|                r2 = j;
  345|      0|                nNumDiffRanks++;
  346|      0|                nNumNewRanks++;
  347|      0|            }
  348|  3.50M|            j--;
  349|  3.50M|            nNewRank[(int) nAtomNumber[j]] = r2;
  350|  3.50M|        }
  351|   122k|        i = r1;
  352|   122k|    }
  353|       |
  354|  77.7k|    return nNumNewRanks ? -nNumDiffRanks : nNumDiffRanks;
  ------------------
  |  Branch (354:12): [True: 0, False: 77.7k]
  ------------------
  355|  77.7k|}
SetNewRanksFromNeighLists:
  370|   110k|{
  371|   110k|    int     i, nNumDiffRanks;
  372|   110k|    AT_RANK nCurrentRank;
  373|       |    /*  -- nAtomNumber[] is already properly set --
  374|       |    for ( i = 0; i < num_atoms; i++ ) {
  375|       |        nAtomNumber[i] = (AT_RANK)i;
  376|       |    }
  377|       |    */
  378|       |
  379|       |    /*  set globals for qsort */
  380|   110k|    pCG->m_pNeighList_RankForSort = NeighList;
  381|   110k|    pCG->m_pn_RankForSort = nRank;
  382|       |
  383|       |    /*  sorting */
  384|   110k|    if (bUseAltSort & 1)
  ------------------
  |  Branch (384:9): [True: 110k, False: 0]
  ------------------
  385|   110k|        tsort( pCG, nAtomNumber, num_atoms, sizeof( nAtomNumber[0] ), comp /*CompNeighListRanksOrd*/ );
  ------------------
  |  |   46|   110k|#define tsort insertions_sort
  ------------------
  386|      0|    else
  387|      0|        inchi_qsort( pCG, nAtomNumber, num_atoms, sizeof( nAtomNumber[0] ), comp /*CompNeighListRanksOrd*/ );
  388|       |
  389|   110k|    for (i = num_atoms - 1, nCurrentRank = nNewRank[(int) nAtomNumber[i]] = (AT_RANK) num_atoms, nNumDiffRanks = 1;
  390|   114k|          0 < i;
  ------------------
  |  Branch (390:11): [True: 4.13k, False: 110k]
  ------------------
  391|   110k|          i--)
  392|  4.13k|    {
  393|       |        /*  Note: CompNeighListRanks() in following line implicitly reads nRank pointed by pn_RankForSort */
  394|  4.13k|        if (CompNeighListRanks( &nAtomNumber[i - 1], &nAtomNumber[i], pCG ))
  ------------------
  |  Branch (394:13): [True: 1.01k, False: 3.11k]
  ------------------
  395|  1.01k|        {
  396|  1.01k|            nNumDiffRanks++;
  397|  1.01k|            nCurrentRank = (AT_RANK) i;
  398|  1.01k|        }
  399|  4.13k|        nNewRank[(int) nAtomNumber[i - 1]] = nCurrentRank;
  400|  4.13k|    }
  401|       |
  402|   110k|    return nNumDiffRanks;
  403|   110k|}
SortNeighLists2:
  427|   110k|{
  428|   110k|    int k, i;
  429|   110k|    AT_RANK nPrevRank = 0;
  430|       |    /*
  431|       |     * on entry nRank[nAtomNumber[k]] <= nRank[nAtomNumber[k+1]]  ( k < num_atoms-1 )
  432|       |     *          nRank[nAtomNumber[k]] >= k+1                      ( k < num_atoms )
  433|       |     *          nRank[nAtomNumber[k]] == k+1 if this nRank value is not tied OR if
  434|       |     *                nRank[nAtomNumber[k]] < nRank[nAtomNumber[k+1]] OR if k = num_atoms-1.
  435|       |     *
  436|       |     */
  437|   224k|    for (k = 0; k < num_atoms; k++)
  ------------------
  |  Branch (437:17): [True: 114k, False: 110k]
  ------------------
  438|   114k|    {
  439|   114k|        i = nAtomNumber[k];
  440|   114k|#ifdef FIX_STEREOCOUNT_ERR
  441|   114k|        if (NeighList[i][0] > 1)
  ------------------
  |  Branch (441:13): [True: 24, False: 114k]
  ------------------
  442|       |#else
  443|       |        if (( nRank[i] != k + 1 || nRank[i] == nPrevRank ) && NeighList[i][0] > 1)
  444|       |#endif
  445|     24|        {
  446|       |            /*  nRank[i] is tied (duplicated) */
  447|     24|            insertions_sort_NeighList_AT_NUMBERS( NeighList[i], nRank );
  448|     24|        }
  449|   114k|        nPrevRank = nRank[i];
  450|   114k|    }
  451|       |
  452|   110k|    return 0;
  453|   110k|}
SortNeighLists3:
  461|   166k|{
  462|   166k|    int k, i;
  463|   166k|    AT_RANK nPrevRank = 0;
  464|       |    /*
  465|       |     * on entry nRank[nAtomNumber[k]] <= nRank[nAtomNumber[k+1]]  ( k < num_atoms-1 )
  466|       |     *          nRank[nAtomNumber[k]] >= k+1                      ( k < num_atoms )
  467|       |     *          nRank[nAtomNumber[k]] == k+1 if this nRank value is not tied OR if
  468|       |     *                nRank[nAtomNumber[k]] < nRank[nAtomNumber[k+1]] OR if k = num_atoms-1.
  469|       |     *
  470|       |     */
  471|  22.8M|    for (k = 0; k < num_atoms; k++)
  ------------------
  |  Branch (471:17): [True: 22.6M, False: 166k]
  ------------------
  472|  22.6M|    {
  473|  22.6M|        i = nAtomNumber[k];
  474|  22.6M|        if (( nRank[i] != k + 1 || nRank[i] == nPrevRank ) && NeighList[i][0] > 1)
  ------------------
  |  Branch (474:15): [True: 7.35M, False: 15.2M]
  |  Branch (474:36): [True: 256k, False: 15.0M]
  |  Branch (474:63): [True: 0, False: 7.60M]
  ------------------
  475|      0|        {
  476|       |            /*  nRank[i] is tied (duplicated) */
  477|      0|            insertions_sort_NeighList_AT_NUMBERS3( NeighList[i], nRank );
  478|      0|        }
  479|  22.6M|        nPrevRank = nRank[i];
  480|  22.6M|    }
  481|   166k|    return 0;
  482|   166k|}
DifferentiateRanks2:
  502|   110k|{
  503|       |    /*int nNumPrevRanks;*/
  504|       |
  505|       |    /*  SortNeighLists2 needs sorted ranks */
  506|   110k|    pCG->m_pn_RankForSort = pnCurrRank;
  507|   110k|    if (bUseAltSort & 1)
  ------------------
  |  Branch (507:9): [True: 0, False: 110k]
  ------------------
  508|      0|        tsort( pCG, nAtomNumber, num_atoms, sizeof( nAtomNumber[0] ), CompRank /* CompRanksOrd*/ );
  ------------------
  |  |   46|      0|#define tsort insertions_sort
  ------------------
  509|   110k|    else
  510|   110k|        inchi_qsort( pCG, nAtomNumber, num_atoms, sizeof( nAtomNumber[0] ), CompRanksOrd );
  511|       |
  512|   110k|    do
  513|   110k|    {
  514|   110k|        *lNumIter += 1;
  515|       |        /*nNumPrevRanks = nNumCurrRanks;*/
  516|   110k|        switch_ptrs( &pnCurrRank, &pnPrevRank );
  517|   110k|        SortNeighLists2( num_atoms, pnPrevRank, NeighList, nAtomNumber );
  518|       |        /*  the following call creates pnCurrRank out of pnPrevRank */
  519|   110k|        nNumCurrRanks = SetNewRanksFromNeighLists( pCG, num_atoms, NeighList, pnPrevRank, pnCurrRank, nAtomNumber,
  520|   110k|                                                 1, CompNeighListRanksOrd );
  521|   110k|    }
  522|   110k|    while ( /*nNumPrevRanks != nNumCurrRanks ||*/ memcmp( pnPrevRank, pnCurrRank, num_atoms * sizeof( pnCurrRank[0] ) ));
  ------------------
  |  Branch (522:51): [True: 0, False: 110k]
  ------------------
  523|       |
  524|   110k|    return nNumCurrRanks;
  525|   110k|}
DifferentiateRanks3:
  544|  88.7k|{
  545|       |    /*
  546|       |        static long count = 0;
  547|       |        count ++;
  548|       |        if ( count == 103 ) {
  549|       |            int stop=1;
  550|       |        }
  551|       |    */
  552|       |
  553|       |    /*  SortNeighLists3 needs sorted ranks: ranks/atnumbers must have been already sorted */
  554|  88.7k|    do
  555|  88.7k|    {
  556|  88.7k|        *lNumIter += 1;
  557|  88.7k|        switch_ptrs( &pnCurrRank, &pnPrevRank );
  558|  88.7k|        SortNeighLists3( num_atoms, pnPrevRank, NeighList, nAtomNumber );
  559|       |        /*  the following call creates pnCurrRank out of pnPrevRank */
  560|  88.7k|        nNumCurrRanks = SetNewRanksFromNeighLists3( pCG, num_atoms, NeighList, pnPrevRank,
  561|  88.7k|                                                    pnCurrRank, nAtomNumber );
  562|  88.7k|    }
  563|  88.7k|    while (nNumCurrRanks < 0 /* memcmp( pnPrevRank, pnCurrRank, num_atoms*sizeof(pnCurrRank[0]) )*/);
  ------------------
  |  Branch (563:12): [True: 0, False: 88.7k]
  ------------------
  564|       |
  565|  88.7k|    return nNumCurrRanks;
  566|  88.7k|}
DifferentiateRanks4:
  580|  77.7k|{
  581|       |    /*
  582|       |        static long count = 0;
  583|       |        count ++;
  584|       |        if ( count == 103 ) {
  585|       |            int stop=1;
  586|       |        }
  587|       |    */
  588|       |    /*  SortNeighLists4 needs sorted ranks: ranks/atnumbers must have been already sorted */
  589|  77.7k|    do
  590|  77.7k|    {
  591|  77.7k|        *lNumIter += 1;
  592|  77.7k|        switch_ptrs( &pnCurrRank, &pnPrevRank );
  593|  77.7k|        SortNeighLists3( num_atoms, pnPrevRank, NeighList, nAtomNumber );
  594|       |        /*  the following call creates pnCurrRank out of pnPrevRank */
  595|  77.7k|        nNumCurrRanks = SetNewRanksFromNeighLists4( pCG, num_atoms, NeighList, pnPrevRank,
  596|  77.7k|                                                    pnCurrRank, nAtomNumber, nMaxAtRank );
  597|  77.7k|    }
  598|  77.7k|    while (nNumCurrRanks < 0 /* memcmp( pnPrevRank, pnCurrRank, num_atoms*sizeof(pnCurrRank[0]) )*/);
  ------------------
  |  Branch (598:12): [True: 0, False: 77.7k]
  ------------------
  599|       |
  600|  77.7k|    return nNumCurrRanks;
  601|  77.7k|}

MarkRingSystemsInp:
   52|   110k|{
   53|   110k|    AT_NUMB   *nStackAtom = NULL;
   54|   110k|    int        nTopStackAtom = -1;
   55|   110k|    AT_NUMB   *nRingStack = NULL;
   56|   110k|    int        nTopRingStack = -1; /* was AT_NUMB */
   57|   110k|    AT_NUMB   *nDfsNumber = NULL;
   58|   110k|    AT_NUMB   *nLowNumber = NULL;
   59|   110k|    S_CHAR    *cNeighNumb = NULL;
   60|   110k|    AT_NUMB    nDfs;
   61|       |#if ( FIND_RINS_SYSTEMS_DISTANCES == 1 )
   62|       |    AT_NUMB    nRs, *nRsConnect = NULL;
   63|       |    int        k;
   64|       |    AT_NUMB   *tree = NULL;
   65|       |    int        nNumConnect, nMaxNumConnect, nLenConnect;
   66|       |#endif
   67|   110k|    AT_NUMB    nNumAtInRingSystem;
   68|   110k|    int        i, j, u, /*start,*/ nNumRingSystems, nNumStartChildren;
   69|       |
   70|       |    /*  allocate arrays */
   71|   110k|    nStackAtom = (AT_NUMB *) inchi_malloc( num_atoms * sizeof( nStackAtom[0] ) );
  ------------------
  |  | 1130|   110k|#define inchi_malloc   malloc
  ------------------
   72|   110k|    nRingStack = (AT_NUMB *) inchi_malloc( num_atoms * sizeof( nRingStack[0] ) );
  ------------------
  |  | 1130|   110k|#define inchi_malloc   malloc
  ------------------
   73|   110k|    nDfsNumber = (AT_NUMB *) inchi_malloc( num_atoms * sizeof( nDfsNumber[0] ) );
  ------------------
  |  | 1130|   110k|#define inchi_malloc   malloc
  ------------------
   74|   110k|    nLowNumber = (AT_NUMB *) inchi_malloc( num_atoms * sizeof( nLowNumber[0] ) );
  ------------------
  |  | 1130|   110k|#define inchi_malloc   malloc
  ------------------
   75|   110k|    cNeighNumb = (S_CHAR  *) inchi_malloc( num_atoms * sizeof( cNeighNumb[0] ) );
  ------------------
  |  | 1130|   110k|#define inchi_malloc   malloc
  ------------------
   76|       |#if ( FIND_RINS_SYSTEMS_DISTANCES == 1 )
   77|       |    nRsConnect = (AT_NUMB *) inchi_calloc( 3 * num_atoms + 3, sizeof( nRsConnect[0] ) );
   78|       |#endif
   79|       |    /*  check allocation */
   80|   110k|    if (!nStackAtom || !nRingStack || !nDfsNumber || !nLowNumber || !cNeighNumb
  ------------------
  |  Branch (80:9): [True: 0, False: 110k]
  |  Branch (80:24): [True: 0, False: 110k]
  |  Branch (80:39): [True: 0, False: 110k]
  |  Branch (80:54): [True: 0, False: 110k]
  |  Branch (80:69): [True: 0, False: 110k]
  ------------------
   81|       |#if ( FIND_RINS_SYSTEMS_DISTANCES == 1 )
   82|       |         || !nRsConnect
   83|       |#endif
   84|   110k|         )
   85|      0|    {
   86|      0|        nNumRingSystems = CT_OUT_OF_RAM;  /*  program error */ /*   <BRKPT> */
  ------------------
  |  |   49|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
   87|      0|        goto exit_function;
   88|      0|    }
   89|       |
   90|       |    /********************************************
   91|       |    *
   92|       |    * Find Cut-vertices & Blocks
   93|       |    *
   94|       |    ********************************************/
   95|       |
   96|       |    /*  initiation */
   97|       |    /*start           = 0;*/
   98|   110k|    nNumRingSystems = 0;
   99|   110k|    u = start; /*  start atom */
  100|   110k|    nDfs = 0;
  101|   110k|    nTopStackAtom = -1;
  102|   110k|    nTopRingStack = -1;
  103|   110k|    memset( nDfsNumber, 0, num_atoms * sizeof( nDfsNumber[0] ) );
  104|   110k|    memset( cNeighNumb, 0, num_atoms * sizeof( cNeighNumb[0] ) );
  105|       |    /*  push the start atom on the stack */
  106|   110k|    nLowNumber[u] = nDfsNumber[u] = ++nDfs;
  107|   110k|    nStackAtom[++nTopStackAtom] = (AT_NUMB) u;
  108|   110k|    nRingStack[++nTopRingStack] = (AT_NUMB) u;
  109|       |
  110|   110k|    nNumStartChildren = 0;
  111|       |
  112|   110k|    do
  113|   110k|    {
  114|       |
  115|       |        /* advance */
  116|   110k|    advance_block:
  117|       |
  118|       |        /*if ( (int)at[i=nStackAtom[nTopStackAtom]].valence > (j = (int)cNeighNumb[i]) )*/
  119|       |        /* replaced due to missing sequence point */
  120|   110k|        if (i = (int) nStackAtom[nTopStackAtom], j = (int) cNeighNumb[i], (int) at[i].valence > j)
  ------------------
  |  Branch (120:13): [True: 72, False: 110k]
  ------------------
  121|     72|        {
  122|     72|            cNeighNumb[i] ++;
  123|     72|            u = (int) at[i].neighbor[j];
  124|     72|            if (!nDfsNumber[u])
  ------------------
  |  Branch (124:17): [True: 36, False: 36]
  ------------------
  125|     36|            {
  126|       |                /* tree edge, 1st visit -- advance */
  127|     36|                nStackAtom[++nTopStackAtom] = (AT_NUMB) u;
  128|     36|                nRingStack[++nTopRingStack] = (AT_NUMB) u;
  129|     36|                nLowNumber[u] = nDfsNumber[u] = ++nDfs;
  130|     36|                nNumStartChildren += ( i == start );
  131|     36|            }
  132|     36|            else
  133|     36|            {
  134|     36|                if (!nTopStackAtom || u != (int) nStackAtom[nTopStackAtom - 1])
  ------------------
  |  Branch (134:21): [True: 0, False: 36]
  |  Branch (134:39): [True: 0, False: 36]
  ------------------
  135|      0|                {
  136|       |                    /*  may comment out ? */
  137|       |                    /* back edge: u is not a predecessor of i */
  138|      0|                    if (nDfsNumber[u] < nDfsNumber[i])
  ------------------
  |  Branch (138:25): [True: 0, False: 0]
  ------------------
  139|      0|                    {
  140|       |                        /* Back edge, 1st visit: u is an ancestor of i. Compare */
  141|      0|                        if (nLowNumber[i] > nDfsNumber[u])
  ------------------
  |  Branch (141:29): [True: 0, False: 0]
  ------------------
  142|      0|                        {
  143|      0|                            nLowNumber[i] = nDfsNumber[u];
  144|      0|                        }
  145|      0|                    }
  146|      0|                } /*  may comment out ? */
  147|     36|            }
  148|     72|            goto advance_block;
  149|     72|        }
  150|   110k|        else
  151|   110k|        {
  152|   110k|            cNeighNumb[i] = 0;
  153|   110k|        }
  154|       |
  155|       |        /* back up */
  156|   110k|        if (i != start)
  ------------------
  |  Branch (156:13): [True: 36, False: 110k]
  ------------------
  157|     36|        {
  158|     36|            u = (int) nStackAtom[nTopStackAtom - 1]; /* predecessor of i */
  159|     36|            if (nLowNumber[i] >= nDfsNumber[u])
  ------------------
  |  Branch (159:17): [True: 36, False: 0]
  ------------------
  160|     36|            {
  161|       |                /* output the block */
  162|     36|                nNumRingSystems++;
  163|     36|                at[u].nBlockSystem = nNumRingSystems;
  164|     36|                if (u != start || nNumStartChildren > 1)
  ------------------
  |  Branch (164:21): [True: 18, False: 18]
  |  Branch (164:35): [True: 9, False: 9]
  ------------------
  165|     27|                {
  166|     27|                    at[u].bCutVertex += 1;
  167|     27|                }
  168|     36|                while (nTopRingStack >= 0)
  ------------------
  |  Branch (168:24): [True: 36, False: 0]
  ------------------
  169|     36|                {
  170|     36|                    j = nRingStack[nTopRingStack--];
  171|     36|                    at[j].nBlockSystem = nNumRingSystems; /*  mark the atom */
  172|     36|                    if (i == j)
  ------------------
  |  Branch (172:25): [True: 36, False: 0]
  ------------------
  173|     36|                    {
  174|     36|                        break;
  175|     36|                    }
  176|     36|                }
  177|     36|            }
  178|      0|            else
  179|      0|            {
  180|      0|                if (nLowNumber[u] > nLowNumber[i])
  ------------------
  |  Branch (180:21): [True: 0, False: 0]
  ------------------
  181|      0|                {
  182|       |                    /* inherit */
  183|      0|                    nLowNumber[u] = nLowNumber[i];
  184|      0|                }
  185|      0|            }
  186|     36|        }
  187|   110k|    } while (--nTopStackAtom >= 0);
  ------------------
  |  Branch (187:14): [True: 36, False: 110k]
  ------------------
  188|       |
  189|       |    /****************************************************************************
  190|       |    *
  191|       |    * Find Ring Systems
  192|       |    * Including chain atoms X: A-X-B, where the bonds (of any kind) are bridges.
  193|       |    *
  194|       |    ****************************************************************************/
  195|       |
  196|       |
  197|       |    /*  initiation */
  198|       |    /* start           = 0;*/
  199|   110k|    nNumRingSystems = 0;
  200|   110k|    u = start; /*  start atom */
  201|   110k|    nDfs = 0;
  202|   110k|    nTopStackAtom = -1;
  203|   110k|    nTopRingStack = -1;
  204|   110k|    memset( nDfsNumber, 0, num_atoms * sizeof( nDfsNumber[0] ) );
  205|   110k|    memset( cNeighNumb, 0, num_atoms * sizeof( cNeighNumb[0] ) );
  206|       |    /*  push the start atom on the stack */
  207|   110k|    nLowNumber[u] = nDfsNumber[u] = ++nDfs;
  208|   110k|    nStackAtom[++nTopStackAtom] = (AT_NUMB) u;
  209|   110k|    nRingStack[++nTopRingStack] = (AT_NUMB) u;
  210|       |
  211|       |#if ( FIND_RINS_SYSTEMS_DISTANCES == 1 )
  212|       |    nNumConnect = nLenConnect = nMaxNumConnect = 0;
  213|       |#endif
  214|       |
  215|   110k|    do
  216|   110k|    {
  217|       |        /* advance */
  218|   110k|    advance_ring:
  219|       |        /*if ( (int)at[i=nStackAtom[nTopStackAtom]].valence > (j = (int)cNeighNumb[i]) )*/
  220|       |        /* replaced due to missing sequence point */
  221|   110k|        if (i = (int) nStackAtom[nTopStackAtom], j = (int) cNeighNumb[i], (int) at[i].valence > j)
  ------------------
  |  Branch (221:13): [True: 72, False: 110k]
  ------------------
  222|     72|        {
  223|     72|            cNeighNumb[i] ++;
  224|     72|            u = (int) at[i].neighbor[j];
  225|     72|            if (!nDfsNumber[u])
  ------------------
  |  Branch (225:17): [True: 36, False: 36]
  ------------------
  226|     36|            {
  227|       |                /* tree edge, 1st visit -- advance */
  228|     36|                nStackAtom[++nTopStackAtom] = (AT_NUMB) u;
  229|     36|                nRingStack[++nTopRingStack] = (AT_NUMB) u;
  230|     36|                nLowNumber[u] = nDfsNumber[u] = ++nDfs;
  231|     36|            }
  232|     36|            else
  233|     36|            {
  234|     36|                if (!nTopStackAtom || u != (int) nStackAtom[nTopStackAtom - 1])
  ------------------
  |  Branch (234:21): [True: 0, False: 36]
  |  Branch (234:39): [True: 0, False: 36]
  ------------------
  235|      0|                {
  236|       |                    /* back edge: u is not a predecessor of i */
  237|      0|                    if (nDfsNumber[u] < nDfsNumber[i])
  ------------------
  |  Branch (237:25): [True: 0, False: 0]
  ------------------
  238|      0|                    {
  239|       |                        /* Back edge, 1st visit: u is ancestor of i. Compare */
  240|      0|                        if (nLowNumber[i] > nDfsNumber[u])
  ------------------
  |  Branch (240:29): [True: 0, False: 0]
  ------------------
  241|      0|                        {
  242|      0|                            nLowNumber[i] = nDfsNumber[u];
  243|      0|                        }
  244|      0|                    }
  245|      0|                }
  246|     36|            }
  247|     72|            goto advance_ring;
  248|     72|        }
  249|   110k|        else
  250|   110k|        {
  251|   110k|            cNeighNumb[i] = 0;
  252|   110k|        }
  253|       |
  254|       |        /* back up */
  255|   110k|        if (nDfsNumber[i] == nLowNumber[i])
  ------------------
  |  Branch (255:13): [True: 110k, False: 0]
  ------------------
  256|   110k|        {
  257|       |            /*  found a ring system */
  258|   110k|            nNumRingSystems++;
  259|       |            /*  unwind nRingStack[] down to i */
  260|       |#if ( FIND_RINS_SYSTEMS_DISTANCES == 1 )
  261|       |            nNumConnect = 2;
  262|       |            /* data structure: for each ring system nRsConnect[] contains:
  263|       |            * 1) nNumConnect+1 = (number of already discovered neighboring "ring systems" + 1)+1
  264|       |            * 2) nNumAtInRingSystem
  265|       |            * 3) (nNumConnect-1) numbers (IDs) of neighboring ring systems.
  266|       |            * BFS guarantees that each neighboring ring system is encountered only one time
  267|       |            * Number of all neighboring ring systems = (nNumConnect-1)+1 = nNumConnect
  268|       |            * (One additional ring system is where the BFS retracts from the vertex #i,
  269|       |            * except when i=DFS root node. In the latter case there is/are only (nNumConnect-1)
  270|       |            * neighboring ring system(s).
  271|       |            */
  272|       |#endif
  273|       |            /*  count atoms in a ring system */
  274|   110k|            for (nNumAtInRingSystem = 0, j = nTopRingStack; 0 <= j; j--)
  ------------------
  |  Branch (274:61): [True: 110k, False: 0]
  ------------------
  275|   110k|            {
  276|   110k|                nNumAtInRingSystem++;
  277|   110k|                if (i == (int) nRingStack[j])
  ------------------
  |  Branch (277:21): [True: 110k, False: 0]
  ------------------
  278|   110k|                {
  279|   110k|                    break;
  280|   110k|                }
  281|   110k|            }
  282|   110k|            while (nTopRingStack >= 0)
  ------------------
  |  Branch (282:20): [True: 110k, False: 0]
  ------------------
  283|   110k|            {
  284|   110k|                j = (int) nRingStack[nTopRingStack--];
  285|   110k|                at[j].nRingSystem = (AT_NUMB) nNumRingSystems; /*  ring system id */
  286|   110k|                at[j].nNumAtInRingSystem = nNumAtInRingSystem;
  287|       |#if ( FIND_RINS_SYSTEMS_DISTANCES == 1 )
  288|       |                for (k = 0; k < at[j].valence; k++)
  289|       |                {
  290|       |                    if (( nRs = at[at[j].neighbor[k]].nRingSystem ) && (int) nRs != nNumRingSystems)
  291|       |                    {
  292|       |                        nRsConnect[nLenConnect + ( nNumConnect++ )] = nRs; /*  adjacent ring system id */
  293|       |                    }
  294|       |                }
  295|       |#endif
  296|   110k|                if (i == j)
  ------------------
  |  Branch (296:21): [True: 110k, False: 0]
  ------------------
  297|   110k|                {
  298|       |                    /*  reached atom on the top of nStackAtom[] stack  */
  299|   110k|                    break;
  300|   110k|                }
  301|   110k|            }
  302|       |#if ( FIND_RINS_SYSTEMS_DISTANCES == 1 )
  303|       |            nRsConnect[nLenConnect] = nNumConnect;
  304|       |            nRsConnect[nLenConnect + 1] = nNumAtInRingSystem;
  305|       |            nLenConnect += nNumConnect;
  306|       |            if (nMaxNumConnect < nNumConnect)
  307|       |            {
  308|       |                /*  max number of neighboring ring systems */
  309|       |                nMaxNumConnect = nNumConnect;
  310|       |            }
  311|       |#endif
  312|   110k|        }
  313|      0|        else
  314|      0|        {
  315|      0|            if (nTopStackAtom > 0)
  ------------------
  |  Branch (315:17): [True: 0, False: 0]
  ------------------
  316|      0|            {
  317|      0|                j = (int) nStackAtom[nTopStackAtom - 1];
  318|       |                /* inherit nLowNumber */
  319|      0|                if (nLowNumber[j] > nLowNumber[i])
  ------------------
  |  Branch (319:21): [True: 0, False: 0]
  ------------------
  320|      0|                {
  321|      0|                    nLowNumber[j] = nLowNumber[i];
  322|      0|                }
  323|      0|            }
  324|      0|        }
  325|   110k|    } while (--nTopStackAtom >= 0);
  ------------------
  |  Branch (325:14): [True: 36, False: 110k]
  ------------------
  326|       |
  327|       |#if ( FIND_RINS_SYSTEMS_DISTANCES == 1 ) /*  normally disabled */
  328|       |    nMaxNumConnect++;
  329|       |    if (nNumRingSystems > 1)
  330|       |    {
  331|       |        int nCol = nMaxNumConnect + 1;
  332|       |        int nNumInSyst = nMaxNumConnect;
  333|       |        int nMaxNeigh = nMaxNumConnect - 1;
  334|       |#define T(a,b) tree[(a)*nCol+b]
  335|       |        if (tree = (AT_NUMB *) inchi_calloc( nCol * ( nNumRingSystems + 1 ), sizeof( tree[0] ) ))
  336|       |        {
  337|       |            int len, neigh;
  338|       |            /*  reuse previous allocations */
  339|       |            AT_NUMB *nNumVisitedNeighbors = nStackAtom;
  340|       |            AT_NUMB *nDistanceFromTerminal = nRingStack;
  341|       |            AT_NUMB *nCurrActiveRingSystem = nDfsNumber;
  342|       |            AT_NUMB *nNextActiveRingSystem = nLowNumber;
  343|       |            int        nNumCurrActiveRingSystems, nNumNextActiveRingSystems, pass;
  344|       |            /* build a "condensation graph (actually, a tree)" in which
  345|       |            * each vertex corresponds to a ring system T(row, col) = T(ring syst, neighbors)
  346|       |            * Number of rows = column length = max. number of ring system neighbors + 2
  347|       |            * Number of cols = row length    = number of ring systems + 1
  348|       |            * Neighboring ring systems are contiguously stored in a row
  349|       |            * T(i,0) = number of neighbors,  1 <= i <= nNumRingSystems;
  350|       |            * T(i,k) = number of a neighboring ring system, 1 <= k <= T(i,0)
  351|       |            * T(i,nCol-1) = number of atoms in the system #i
  352|       |            */
  353|       |            for (i = 1, j = 0; len = nRsConnect[j]; i++)
  354|       |            {
  355|       |                T( i, nNumInSyst ) = nRsConnect[j + 1];
  356|       |                for (k = 2; k < len; k++)
  357|       |                {
  358|       |                    neigh = nRsConnect[j + k];
  359|       |                    if (T( i, 0 ) < nMaxNeigh && T( neigh, 0 ) < nMaxNeigh)
  360|       |                    {
  361|       |                        T( i, 0 )++;
  362|       |                        T( neigh, 0 )++;
  363|       |                        T( i, T( i, 0 ) ) = neigh;
  364|       |                        T( neigh, T( neigh, 0 ) ) = i;
  365|       |                    }
  366|       |                    else
  367|       |                    {
  368|       |                        nNumRingSystems = CT_OVERFLOW;  /*  program error */ /*   <BRKPT> */
  369|       |                        goto exit_function;
  370|       |                    }
  371|       |                }
  372|       |                j += len;
  373|       |            }
  374|       |            /*  clear memory */
  375|       |            memset( nNumVisitedNeighbors, 0, nNumRingSystems * sizeof( nNumVisitedNeighbors[0] ) );
  376|       |            memset( nDistanceFromTerminal, 0, nNumRingSystems * sizeof( nDistanceFromTerminal[0] ) );
  377|       |            memset( nCurrActiveRingSystem, 0, nNumRingSystems * sizeof( nCurrActiveRingSystem[0] ) );
  378|       |            memset( nNextActiveRingSystem, 0, nNumRingSystems * sizeof( nNextActiveRingSystem[0] ) );
  379|       |            nNumNextActiveRingSystems = 0;
  380|       |            for (i = 0; i < nNumRingSystems; i++)
  381|       |            {
  382|       |                if (1 == T( i + 1, 0 ))
  383|       |                {
  384|       |                    nNextActiveRingSystem[i] = 1; /*  number of traversed neighbors + 1 */
  385|       |                    nDistanceFromTerminal[i] = 1;
  386|       |                    nNumNextActiveRingSystems++;
  387|       |                }
  388|       |                else
  389|       |                {
  390|       |                    nNextActiveRingSystem[i] = 0;
  391|       |                    nDistanceFromTerminal[i] = 0;
  392|       |                }
  393|       |                nNumVisitedNeighbors[i] = 0;
  394|       |            }
  395|       |
  396|       |            /* nCurrActiveRingSystem[i] = a sum of:
  397|       |            * 1) +1 if it is or was active
  398|       |            * 2) +(number of neighbors from which it was reached)
  399|       |            * 3) +1 if it was left and not active anymore
  400|       |            */
  401|       |            pass = 0;
  402|       |            do
  403|       |            {
  404|       |                nNumCurrActiveRingSystems = nNumNextActiveRingSystems;
  405|       |                nNumNextActiveRingSystems = 0;
  406|       |                memcpy( nCurrActiveRingSystem, nNextActiveRingSystem,
  407|       |                        nNumRingSystems * sizeof( nNextActiveRingSystem[0] ) );
  408|       |                for (i = 0; i < nNumRingSystems; i++)
  409|       |                {
  410|       |                    if (T( i + 1, 0 ) == nCurrActiveRingSystem[i])
  411|       |                    {
  412|       |                        /* on the previous pass currently active ring system i+1 bas been reached
  413|       |                        * from all neighbors except one;
  414|       |                        * the neighbors from which it was reached have
  415|       |                        * T(neigh,0)+1 == nCurrActiveRingSystem[i]
  416|       |                        * this ring system has not been left yet
  417|       |                        */
  418|       |                        for (k = 1, len = T( i + 1, 0 ); k <= len; k++)
  419|       |                        {
  420|       |                            neigh = (int) T( i + 1, k );
  421|       |                            if (T( neigh, 0 ) >= nCurrActiveRingSystem[neigh - 1])
  422|       |                            {
  423|       |                                if (0 == pass)
  424|       |                                {
  425|       |                                    nDistanceFromTerminal[i] = 1;
  426|       |                                }
  427|       |                                break;
  428|       |                            }
  429|       |                        }
  430|       |                        if (k <= len)
  431|       |                        {
  432|       |                            /* neigh was not reached from at least 2 neighbors
  433|       |                            * walk along -R- chain (T(neigh,0)==2) up to
  434|       |                            * 1)  a terminal system, not including it or
  435|       |                            * 2)  a branching point.
  436|       |                            *
  437|       |                            * pass = 0: started from terminal systems:
  438|       |                            *     reach the branching point.
  439|       |                            * If chain system next to a terminal system has already been reached
  440|       |                            * then walk along it according to Note below
  441|       |                            *
  442|       |                            * pass > 0: started from branching points
  443|       |                            * 2a) If the branching point has not been reached from 2 or more neighbors,
  444|       |                            *     then include it
  445|       |                            * 2b) If the branching point has not been reached from 1 neighbor only,
  446|       |                            *     then do not include it: it will be a starting point later
  447|       |                            * Note: if a chain atom already has nDistanceFromTerminal[i] > 0, then
  448|       |                            *     the last atom should be the one such that
  449|       |                            *     its nDistanceFromTerminal[]+1>= nDistanceFromTerminal[] of the
  450|       |                            *     next in the chain
  451|       |                            */
  452|       |                            int bOk = 0;
  453|       |                            k = i + 1; /*  starting point */
  454|       |                            if (0 == pass && T( k, nNumInSyst ) > 1)
  455|       |                            {
  456|       |                                nNumNextActiveRingSystems++; /*  request next pass */
  457|       |                                continue; /*  stop a the terminal ring system */
  458|       |                            }
  459|       |                            while (2 == T( neigh, 0 ))
  460|       |                            {
  461|       |                                /*  walk along a chain */
  462|       |                                if (!nNextActiveRingSystem[neigh - 1])
  463|       |                                {
  464|       |                                    nNextActiveRingSystem[neigh - 1] = 1; /*  make neighbor active */
  465|       |                                }
  466|       |                                else
  467|       |                                    if (nDistanceFromTerminal[k - 1] + 1 <= nDistanceFromTerminal[neigh - 1])
  468|       |                                    {
  469|       |                                        /*  walking along the chain; already have had a walk */
  470|       |                                        /*  in the opposite direction at this pass */
  471|       |                                    }
  472|       |                                    else
  473|       |                                    {
  474|       |                                        /*  k is the last; neigh (it is a bridge -X-) has not been reached */
  475|       |                                        bOk = 1;
  476|       |                                        break;
  477|       |                                    }
  478|       |                                nNextActiveRingSystem[k - 1] ++; /*  leave system k */
  479|       |                                if (nNextActiveRingSystem[neigh - 1] < T( neigh, 0 ))
  480|       |                                {
  481|       |                                    nNextActiveRingSystem[neigh - 1] ++; /*  add one connection to neigh */
  482|       |                                }
  483|       |                                nDistanceFromTerminal[neigh - 1] = nDistanceFromTerminal[k - 1] + 1;
  484|       |                                j = ( T( neigh, 1 ) == k ) ? 2 : 1;
  485|       |                                k = neigh;
  486|       |                                neigh = T( k, j ); /*  next in the chain */
  487|       |                                nNumNextActiveRingSystems++;
  488|       |                                if (T( k, nNumInSyst ) > 1)
  489|       |                                {
  490|       |                                    bOk = 1;
  491|       |                                    break; /*  stop on a ring system */
  492|       |                                }
  493|       |                            }
  494|       |                            /*  neigh is a terminal or a bridge or a branching point */
  495|       |                            if (2 > T( neigh, 0 ))
  496|       |                            {
  497|       |                                /*  neighbor is a terminal atom */
  498|       |                                if (1 < pass)
  499|       |                                {
  500|       |                                    nNumRingSystems = CT_UNKNOWN_ERR; /*  error (debug only) */ /*   <BRKPT> */
  501|       |                                    goto exit_function;
  502|       |                                }
  503|       |                                continue;
  504|       |                            }
  505|       |                            if (2 == T( neigh, 0 ))
  506|       |                            {
  507|       |                                /*  neighbor is a bridge */
  508|       |                                continue;
  509|       |                            }
  510|       |                            /*  neighbor is a branching point */
  511|       |                            if (T( neigh, 0 ) > nCurrActiveRingSystem[neigh - 1])
  512|       |                            {
  513|       |                                /*  move to the neigh (make neigh active): on previous pass it */
  514|       |                                /*  has not been reached from 2 or more neighbors */
  515|       |                                if (!nNextActiveRingSystem[neigh - 1])
  516|       |                                {
  517|       |                                    nNextActiveRingSystem[neigh - 1] = 1;
  518|       |                                }
  519|       |                                if (nDistanceFromTerminal[neigh - 1] < nDistanceFromTerminal[k - 1] + 1)
  520|       |                                {
  521|       |                                    nDistanceFromTerminal[neigh - 1] = nDistanceFromTerminal[k - 1] + 1;
  522|       |                                }
  523|       |                                nNextActiveRingSystem[k - 1] ++; /*  leave system k */
  524|       |                                if (nNextActiveRingSystem[neigh - 1] < T( neigh, 0 ))
  525|       |                                {
  526|       |                                    nNextActiveRingSystem[neigh - 1] ++; /*  add one connection to neigh */
  527|       |                                }
  528|       |                                nNumNextActiveRingSystems++;
  529|       |                            }
  530|       |                        }
  531|       |                    }
  532|       |                }
  533|       |                pass++;
  534|       |            } while (nNumNextActiveRingSystems);
  535|       |
  536|       |            for (i = 0; i < num_atoms; i++)
  537|       |            {
  538|       |                at[i].nDistanceFromTerminal = nDistanceFromTerminal[(int) at[i].nRingSystem - 1];
  539|       |            }
  540|       |
  541|       |            inchi_free( tree );
  542|       |            tree = NULL;
  543|       |#undef T
  544|       |        }
  545|       |        else
  546|       |        {
  547|       |            nNumRingSystems = CT_OUT_OF_RAM; /*  error */ /*   <BRKPT> */
  548|       |            goto exit_function;
  549|       |        }
  550|       |    }
  551|       |#endif
  552|       |
  553|   110k|exit_function:
  554|       |
  555|   110k|    if (nStackAtom)
  ------------------
  |  Branch (555:9): [True: 110k, False: 0]
  ------------------
  556|   110k|    {
  557|   110k|        inchi_free( nStackAtom );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  558|   110k|    }
  559|   110k|    if (nRingStack)
  ------------------
  |  Branch (559:9): [True: 110k, False: 0]
  ------------------
  560|   110k|    {
  561|   110k|        inchi_free( nRingStack );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  562|   110k|    }
  563|   110k|    if (nDfsNumber)
  ------------------
  |  Branch (563:9): [True: 110k, False: 0]
  ------------------
  564|   110k|    {
  565|   110k|        inchi_free( nDfsNumber );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  566|   110k|    }
  567|   110k|    if (nLowNumber)
  ------------------
  |  Branch (567:9): [True: 110k, False: 0]
  ------------------
  568|   110k|    {
  569|   110k|        inchi_free( nLowNumber );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  570|   110k|    }
  571|   110k|    if (cNeighNumb)
  ------------------
  |  Branch (571:9): [True: 110k, False: 0]
  ------------------
  572|   110k|    {
  573|   110k|        inchi_free( cNeighNumb );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  574|   110k|    }
  575|       |
  576|       |#if ( FIND_RINS_SYSTEMS_DISTANCES == 1 )
  577|       |    if (nRsConnect)
  578|       |        inchi_free( nRsConnect );
  579|       |    if (tree)
  580|       |        inchi_free( tree );
  581|       |#endif
  582|       |
  583|   110k|    return nNumRingSystems;
  584|   110k|}

set_common_options_by_parg:
  142|    576|{
  143|    576|    int got = 0;
  144|       |
  145|       |    /* Input */
  146|    576|    if (!inchi_stricmp( pArg, "INPAUX" ))
  ------------------
  |  Branch (146:9): [True: 0, False: 576]
  ------------------
  147|      0|    {
  148|      0|        if (INPUT_NONE == ip->nInputType)
  ------------------
  |  Branch (148:13): [True: 0, False: 0]
  ------------------
  149|      0|        {
  150|      0|            ip->nInputType = INPUT_INCHI_PLAIN;
  151|      0|        }
  152|      0|        got = 1;
  153|      0|    }
  154|    576|    else if ( !inchi_memicmp( pArg, "START:", 6 ))
  ------------------
  |  Branch (154:15): [True: 0, False: 576]
  ------------------
  155|      0|    {
  156|      0|        ip->first_struct_number = strtol( pArg + 6, NULL, 10 );
  157|      0|        got = 1;
  158|      0|    }
  159|    576|    else if (!inchi_memicmp( pArg, "END:", 4 ))
  ------------------
  |  Branch (159:14): [True: 0, False: 576]
  ------------------
  160|      0|    {
  161|      0|        ip->last_struct_number = strtol( pArg + 4, NULL, 10 );
  162|      0|        got = 1;
  163|      0|    }
  164|    576|    else if (!inchi_memicmp( pArg, "RECORD:", 7 ))
  ------------------
  |  Branch (164:14): [True: 0, False: 576]
  ------------------
  165|      0|    {
  166|      0|        long num = strtol( pArg + 7, NULL, 10 );
  167|      0|        got = 1;
  168|      0|        ip->first_struct_number = num;
  169|      0|        ip->last_struct_number = num;
  170|      0|        got = 1;
  171|      0|    }
  172|    576|    else if (!inchi_stricmp( pArg, "NOLABELS" ))
  ------------------
  |  Branch (172:14): [True: 0, False: 576]
  ------------------
  173|      0|    {
  174|      0|        *pbNoStructLabels = 1;
  175|      0|        got = 1;
  176|      0|    }
  177|    576|    else if (!inchi_stricmp( pArg, "SAVEOPT" ))
  ------------------
  |  Branch (177:14): [True: 0, False: 576]
  ------------------
  178|      0|    {
  179|      0|        (*pbINChIOutputOptions) |= INCHI_OUT_SAVEOPT;
  ------------------
  |  |  174|      0|#define INCHI_OUT_SAVEOPT  0x8000
  ------------------
  180|      0|        got = 1;
  181|      0|    }
  182|       |    /* Generation */
  183|    576|    else if (!inchi_stricmp( pArg, "AUXNONE" ))
  ------------------
  |  Branch (183:14): [True: 0, False: 576]
  ------------------
  184|      0|    {
  185|       |        /* no aux. info */
  186|      0|        ( *pbINChIOutputOptions ) |= INCHI_OUT_NO_AUX_INFO;  /* no aux info */
  ------------------
  |  |  157|      0|#define INCHI_OUT_NO_AUX_INFO           0x0001   /* do not output Aux Info                  */
  ------------------
  187|      0|        ( *pbINChIOutputOptions ) &= ~INCHI_OUT_SHORT_AUX_INFO;
  ------------------
  |  |  158|      0|#define INCHI_OUT_SHORT_AUX_INFO        0x0002   /* output short version of Aux Info        */
  ------------------
  188|      0|        got = 1;
  189|      0|    }
  190|    576|    else if (!inchi_stricmp( pArg, "MISMATCHISERROR" ))
  ------------------
  |  Branch (190:14): [True: 0, False: 576]
  ------------------
  191|      0|    {
  192|       |        /* Consider InChI conversion "problem/mismatch" as error */
  193|      0|        (*pbINChIOutputOptions2) |= INCHI_OUT_MISMATCH_AS_ERROR;
  ------------------
  |  |  178|      0|#define INCHI_OUT_MISMATCH_AS_ERROR      0x0002 /* v. 1.05 */
  ------------------
  194|      0|        got = 1;
  195|      0|    }
  196|    576|    else if (!inchi_stricmp( pArg, "OUTERRINCHI" ))
  ------------------
  |  Branch (196:14): [True: 0, False: 576]
  ------------------
  197|      0|    {
  198|       |        /* Signify InChI error generation on InChI strings output, not only report to log file */
  199|      0|        ( *pbINChIOutputOptions2 ) |= INCHI_OUT_INCHI_GEN_ERROR;
  ------------------
  |  |  177|      0|#define INCHI_OUT_INCHI_GEN_ERROR        0x0001 /* v. 1.05 */
  ------------------
  200|      0|        got = 1;
  201|      0|    }
  202|       |    /* InChIKey/InChI hash */
  203|    576|    else if (!inchi_stricmp( pArg, "Key" ))
  ------------------
  |  Branch (203:14): [True: 0, False: 576]
  ------------------
  204|      0|    {
  205|      0|        *pbHashKey = 1;
  206|      0|        got = 1;
  207|      0|    }
  208|    576|    else if (!inchi_stricmp( pArg, "XHash1" ))
  ------------------
  |  Branch (208:14): [True: 0, False: 576]
  ------------------
  209|      0|    {
  210|      0|        *pbHashXtra1 = 1;
  211|      0|        got = 1;
  212|      0|    }
  213|    576|    else if (!inchi_stricmp( pArg, "XHash2" ))
  ------------------
  |  Branch (213:14): [True: 0, False: 576]
  ------------------
  214|      0|    {
  215|      0|        *pbHashXtra2 = 1;
  216|      0|        got = 1;
  217|      0|    }
  218|       |    /* All modes (std and non-std InChI) structure perception options */
  219|       |    /* These options DO NOT TURN OFF Std flag                         */
  220|    576|    else if (!inchi_stricmp( pArg, "SNON" ))
  ------------------
  |  Branch (220:14): [True: 0, False: 576]
  ------------------
  221|      0|    {
  222|      0|        (*pbVer1DefaultMode) &= ~REQ_MODE_STEREO; /* no stereo */
  ------------------
  |  |   47|      0|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
  223|      0|        (*pnMode) &= ~( REQ_MODE_RACEMIC_STEREO | REQ_MODE_RELATIVE_STEREO | REQ_MODE_CHIR_FLG_STEREO );
  ------------------
  |  |   56|      0|#define REQ_MODE_RACEMIC_STEREO     0x000400    /* RAC All Racemic Stereo */
  ------------------
                      (*pnMode) &= ~( REQ_MODE_RACEMIC_STEREO | REQ_MODE_RELATIVE_STEREO | REQ_MODE_CHIR_FLG_STEREO );
  ------------------
  |  |   54|      0|#define REQ_MODE_RELATIVE_STEREO    0x000200    /* REL All Relative Stereo */
  ------------------
                      (*pnMode) &= ~( REQ_MODE_RACEMIC_STEREO | REQ_MODE_RELATIVE_STEREO | REQ_MODE_CHIR_FLG_STEREO );
  ------------------
  |  |   62|      0|#define REQ_MODE_CHIR_FLG_STEREO    0x002000    /* SUCF  If Chiral flag then Abs otherwise Rel stereo */
  ------------------
  224|      0|        got = 1;
  225|      0|    }
  226|    576|    else if (!inchi_stricmp( pArg, "NEWPSOFF" ))
  ------------------
  |  Branch (226:14): [True: 0, False: 576]
  ------------------
  227|      0|    {
  228|      0|        *pbPointedEdgeStereo = 0;
  229|      0|        got = 1;
  230|      0|    }
  231|    576|    else if (!inchi_stricmp( pArg, "DONOTADDH" ))
  ------------------
  |  Branch (231:14): [True: 0, False: 576]
  ------------------
  232|      0|    {
  233|      0|        *pbDoNotAddH = 1;
  234|      0|        got = 1;
  235|      0|    }
  236|    576|    else if (!inchi_stricmp( pArg, "LooseTSACheck" ))
  ------------------
  |  Branch (236:14): [True: 0, False: 576]
  ------------------
  237|      0|    {
  238|      0|        (*pbLooseTSACheck) = 1;
  239|      0|        got = 1;
  240|      0|    }
  241|       |
  242|    576|#ifndef USE_STDINCHI_API
  243|       |    /* These options DO TURN OFF Std flag   */
  244|    576|    else if (!inchi_stricmp( pArg, "SREL" ))
  ------------------
  |  Branch (244:14): [True: 0, False: 576]
  ------------------
  245|      0|    {
  246|      0|        if ( (*pnMode) & REQ_MODE_RACEMIC_STEREO)
  ------------------
  |  |   56|      0|#define REQ_MODE_RACEMIC_STEREO     0x000400    /* RAC All Racemic Stereo */
  ------------------
  |  Branch (246:14): [True: 0, False: 0]
  ------------------
  247|      0|        {
  248|      0|            (*pnMode) ^= REQ_MODE_RACEMIC_STEREO;
  ------------------
  |  |   56|      0|#define REQ_MODE_RACEMIC_STEREO     0x000400    /* RAC All Racemic Stereo */
  ------------------
  249|      0|        }
  250|      0|        if ( (*pnMode) & REQ_MODE_CHIR_FLG_STEREO)
  ------------------
  |  |   62|      0|#define REQ_MODE_CHIR_FLG_STEREO    0x002000    /* SUCF  If Chiral flag then Abs otherwise Rel stereo */
  ------------------
  |  Branch (250:14): [True: 0, False: 0]
  ------------------
  251|      0|        {
  252|      0|            (*pnMode) ^= REQ_MODE_CHIR_FLG_STEREO;
  ------------------
  |  |   62|      0|#define REQ_MODE_CHIR_FLG_STEREO    0x002000    /* SUCF  If Chiral flag then Abs otherwise Rel stereo */
  ------------------
  253|      0|        }
  254|      0|        (*pnMode) |= REQ_MODE_RELATIVE_STEREO;
  ------------------
  |  |   54|      0|#define REQ_MODE_RELATIVE_STEREO    0x000200    /* REL All Relative Stereo */
  ------------------
  255|      0|        (*pnMode) |= REQ_MODE_STEREO;
  ------------------
  |  |   47|      0|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
  256|      0|        *pbStdFormat = 0;
  257|      0|        got = 1;
  258|      0|    }
  259|    576|    else if (!inchi_stricmp( pArg, "SRAC" ))
  ------------------
  |  Branch (259:14): [True: 0, False: 576]
  ------------------
  260|      0|    {
  261|      0|        if ((*pnMode) & REQ_MODE_RELATIVE_STEREO)
  ------------------
  |  |   54|      0|#define REQ_MODE_RELATIVE_STEREO    0x000200    /* REL All Relative Stereo */
  ------------------
  |  Branch (261:13): [True: 0, False: 0]
  ------------------
  262|      0|        {
  263|      0|            (*pnMode) ^= REQ_MODE_RELATIVE_STEREO;
  ------------------
  |  |   54|      0|#define REQ_MODE_RELATIVE_STEREO    0x000200    /* REL All Relative Stereo */
  ------------------
  264|      0|        }
  265|      0|        if ( (*pnMode) & REQ_MODE_CHIR_FLG_STEREO)
  ------------------
  |  |   62|      0|#define REQ_MODE_CHIR_FLG_STEREO    0x002000    /* SUCF  If Chiral flag then Abs otherwise Rel stereo */
  ------------------
  |  Branch (265:14): [True: 0, False: 0]
  ------------------
  266|      0|        {
  267|      0|            (*pnMode) ^= REQ_MODE_CHIR_FLG_STEREO;
  ------------------
  |  |   62|      0|#define REQ_MODE_CHIR_FLG_STEREO    0x002000    /* SUCF  If Chiral flag then Abs otherwise Rel stereo */
  ------------------
  268|      0|        }
  269|      0|        (*pnMode) |= REQ_MODE_RACEMIC_STEREO;
  ------------------
  |  |   56|      0|#define REQ_MODE_RACEMIC_STEREO     0x000400    /* RAC All Racemic Stereo */
  ------------------
  270|      0|        (*pnMode) |= REQ_MODE_STEREO;
  ------------------
  |  |   47|      0|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
  271|      0|        *pbStdFormat = 0;
  272|      0|        got = 1;
  273|      0|    }
  274|    576|    else if (!inchi_stricmp( pArg, "SUCF" ))
  ------------------
  |  Branch (274:14): [True: 0, False: 576]
  ------------------
  275|      0|    {
  276|      0|        if ( (*pnMode) & REQ_MODE_RELATIVE_STEREO)
  ------------------
  |  |   54|      0|#define REQ_MODE_RELATIVE_STEREO    0x000200    /* REL All Relative Stereo */
  ------------------
  |  Branch (276:14): [True: 0, False: 0]
  ------------------
  277|      0|        {
  278|      0|            (*pnMode) ^= REQ_MODE_RELATIVE_STEREO;
  ------------------
  |  |   54|      0|#define REQ_MODE_RELATIVE_STEREO    0x000200    /* REL All Relative Stereo */
  ------------------
  279|      0|        }
  280|      0|        if ( (*pnMode) & REQ_MODE_RACEMIC_STEREO)
  ------------------
  |  |   56|      0|#define REQ_MODE_RACEMIC_STEREO     0x000400    /* RAC All Racemic Stereo */
  ------------------
  |  Branch (280:14): [True: 0, False: 0]
  ------------------
  281|      0|        {
  282|      0|            (*pnMode) ^= REQ_MODE_RACEMIC_STEREO;
  ------------------
  |  |   56|      0|#define REQ_MODE_RACEMIC_STEREO     0x000400    /* RAC All Racemic Stereo */
  ------------------
  283|      0|        }
  284|      0|        (*pnMode) |= REQ_MODE_CHIR_FLG_STEREO; /* stereo defined by the Chiral flag */
  ------------------
  |  |   62|      0|#define REQ_MODE_CHIR_FLG_STEREO    0x002000    /* SUCF  If Chiral flag then Abs otherwise Rel stereo */
  ------------------
  285|      0|        (*pnMode) |= REQ_MODE_STEREO;
  ------------------
  |  |   47|      0|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
  286|      0|        *pbStdFormat = 0;
  287|      0|        got = 1;
  288|      0|    }
  289|    576|    else if (!inchi_stricmp( pArg, "ChiralFlagON" ))
  ------------------
  |  Branch (289:14): [True: 0, False: 576]
  ------------------
  290|      0|    {
  291|       |        /* used only with /SUCF */
  292|       |        /* NB: do not toggle off bStdFormat! (if necessary SUCF will do) */
  293|      0|        (*pbForcedChiralFlag) &= ~FLAG_SET_INP_AT_NONCHIRAL;
  ------------------
  |  |  490|      0|#define FLAG_SET_INP_AT_NONCHIRAL 8
  ------------------
  294|      0|        (*pbForcedChiralFlag) |= FLAG_SET_INP_AT_CHIRAL;
  ------------------
  |  |  489|      0|#define FLAG_SET_INP_AT_CHIRAL    4
  ------------------
  295|      0|        got = 1;
  296|      0|    }
  297|    576|    else if (!inchi_stricmp( pArg, "ChiralFlagOFF" ))
  ------------------
  |  Branch (297:14): [True: 0, False: 576]
  ------------------
  298|      0|    {
  299|       |        /* used only with /SUCF */
  300|       |        /* NB: do not toggle off bStdFormat! (if necessary SUCF will do) */
  301|      0|        (*pbForcedChiralFlag) &= ~FLAG_SET_INP_AT_CHIRAL;
  ------------------
  |  |  489|      0|#define FLAG_SET_INP_AT_CHIRAL    4
  ------------------
  302|      0|        (*pbForcedChiralFlag) |= FLAG_SET_INP_AT_NONCHIRAL;
  ------------------
  |  |  490|      0|#define FLAG_SET_INP_AT_NONCHIRAL 8
  ------------------
  303|      0|        got = 1;
  304|      0|    }
  305|       |
  306|       |    /*--- Non-std InChI creation options ---*/
  307|       |    /* These options DO TURN OFF Std flag       */
  308|    576|    else if (!inchi_stricmp( pArg, "SUU" ))
  ------------------
  |  Branch (308:14): [True: 0, False: 576]
  ------------------
  309|      0|    {
  310|       |        /* include omitted undef/unknown stereo */
  311|      0|        (*pbVer1DefaultMode) &= ~( REQ_MODE_SB_IGN_ALL_UU | REQ_MODE_SC_IGN_ALL_UU );
  ------------------
  |  |   60|      0|#define REQ_MODE_SB_IGN_ALL_UU      0x001000    /* IAUSC Ignore stereobonds if All Undef/Unknown */
  ------------------
                      (*pbVer1DefaultMode) &= ~( REQ_MODE_SB_IGN_ALL_UU | REQ_MODE_SC_IGN_ALL_UU );
  ------------------
  |  |   58|      0|#define REQ_MODE_SC_IGN_ALL_UU      0x000800    /* IAUSC Ignore stereocenters if All Undef/Unknown */
  ------------------
  312|      0|        *pbStdFormat = 0;
  313|      0|        got = 1;
  314|      0|    }
  315|    576|    else if (!inchi_stricmp( pArg, "SLUUD" ))
  ------------------
  |  Branch (315:14): [True: 0, False: 576]
  ------------------
  316|      0|    {
  317|       |        /* make labels for unknown and undefined stereo different */
  318|      0|        (*pbVer1DefaultMode) |= REQ_MODE_DIFF_UU_STEREO;
  ------------------
  |  |   68|      0|#define REQ_MODE_DIFF_UU_STEREO     0x004000    /* SLUUD Make labels for unknown and undefined stereo different */
  ------------------
  319|      0|        *pbStdFormat = 0;
  320|      0|        got = 1;
  321|      0|    }
  322|       |    /* FixedH */
  323|    576|    else if (!inchi_stricmp( pArg, "FIXEDH" ))
  ------------------
  |  Branch (323:14): [True: 0, False: 576]
  ------------------
  324|      0|    {
  325|      0|        (*pbVer1DefaultMode) |= REQ_MODE_BASIC;  /* tautomeric */
  ------------------
  |  |   43|      0|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
  326|      0|        *pbStdFormat = 0;
  327|      0|        got = 1;
  328|      0|    }
  329|       |    /* RecMet */
  330|    576|    else if (!inchi_stricmp( pArg, "RECMET" ))
  ------------------
  |  Branch (330:14): [True: 0, False: 576]
  ------------------
  331|      0|    {
  332|       |        /* reconnect metals */
  333|      0|        *pbReconnectCoord = 1;
  334|      0|        *pbStdFormat = 0;
  335|      0|        got = 1;
  336|      0|    }
  337|    576|#if ( KETO_ENOL_TAUT == 1 )
  338|    576|    else if (!inchi_stricmp( pArg, "KET" ))
  ------------------
  |  Branch (338:14): [True: 0, False: 576]
  ------------------
  339|      0|    {
  340|      0|        *pbKetoEnolTaut = 1;
  341|      0|        *pbStdFormat = 0;
  342|      0|        got = 1;
  343|      0|    }
  344|    576|#endif
  345|    576|#if ( TAUT_15_NON_RING == 1 )
  346|    576|    else if (!inchi_stricmp( pArg, "15T" ))
  ------------------
  |  Branch (346:14): [True: 0, False: 576]
  ------------------
  347|      0|    {
  348|      0|        *pb15TautNonRing = 1;
  349|      0|        *pbStdFormat = 0;
  350|      0|        got = 1;
  351|      0|    }
  352|    576|#endif
  353|       |
  354|    576|    else if (!inchi_stricmp( pArg, "LargeMolecules" ))
  ------------------
  |  Branch (354:14): [True: 0, False: 576]
  ------------------
  355|      0|    {
  356|      0|        *pbLargeMolecules = 1;
  357|      0|        got = 1;
  358|      0|    }
  359|    576|    else if (!inchi_stricmp( pArg, "Polymers" ))
  ------------------
  |  Branch (359:14): [True: 0, False: 576]
  ------------------
  360|      0|    {
  361|      0|        *pbPolymers = POLYMERS_MODERN;
  ------------------
  |  | 1198|      0|#define POLYMERS_MODERN 1	/* current (1.06) way to treat polymers with Zz			*/
  ------------------
  362|      0|        got = 1;
  363|      0|    }
  364|    576|    else if (!inchi_stricmp(pArg, "Polymers105"))
  ------------------
  |  Branch (364:14): [True: 0, False: 576]
  ------------------
  365|      0|    {
  366|      0|        *pbPolymers = POLYMERS_LEGACY;
  ------------------
  |  | 1199|      0|#define POLYMERS_LEGACY 2	/* 1.05 mode, no explicit Zz (internally they are here) */
  ------------------
  367|      0|        got = 1;
  368|      0|    }
  369|    576|    else if (!inchi_stricmp(pArg, "NPZz"))
  ------------------
  |  Branch (369:14): [True: 0, False: 576]
  ------------------
  370|      0|    {
  371|      0|        *pbNPZz = 1;
  372|      0|        got = 1;
  373|      0|    }
  374|    576|    else if (!inchi_stricmp( pArg, "NoWarnings" ))
  ------------------
  |  Branch (374:14): [True: 0, False: 576]
  ------------------
  375|      0|    {
  376|      0|        *pbNoWarnings = 1;
  377|      0|        got = 1;
  378|      0|    }
  379|    576|    else if (!inchi_stricmp( pArg, "MergeHash" ))
  ------------------
  |  Branch (379:14): [True: 0, False: 576]
  ------------------
  380|      0|    {
  381|      0|        *pbMergeHash = 1;
  382|      0|        got = 1;
  383|      0|    }
  384|    576|    else if (!inchi_stricmp( pArg, "NoInChI" ) || !inchi_stricmp( pArg, "HideInChI" ) )
  ------------------
  |  Branch (384:14): [True: 0, False: 576]
  |  Branch (384:51): [True: 0, False: 576]
  ------------------
  385|      0|    {
  386|      0|        *pbHideInChI = 1;
  387|      0|        got = 1;
  388|      0|    }
  389|    576|    else if (!inchi_stricmp( pArg, "FoldCRU" )) /* v. 1.06 */
  ------------------
  |  Branch (389:14): [True: 0, False: 576]
  ------------------
  390|      0|    {
  391|      0|        *pbFoldPolymerSRU = 1;
  392|      0|        got = 1;
  393|      0|    }
  394|    576|    else if (!inchi_stricmp( pArg, "FoldSRU" )) /* v. 1.06 */
  ------------------
  |  Branch (394:14): [True: 0, False: 576]
  ------------------
  395|      0|    {
  396|      0|        *pbFoldPolymerSRU = 1;
  397|      0|        got = 1;
  398|      0|    }
  399|    576|    else if (!inchi_memicmp( pArg, "FrameShift:", 11 ))
  ------------------
  |  Branch (399:14): [True: 0, False: 576]
  ------------------
  400|      0|    {
  401|      0|        int k;
  402|      0|        char wrd[256];
  403|      0|        k = 0;
  404|      0|        mystrncpy( wrd, pArg + 11, 256 );
  405|      0|        lrtrim( wrd, &k );
  406|      0|        if (k)
  ------------------
  |  Branch (406:13): [True: 0, False: 0]
  ------------------
  407|      0|        {
  408|      0|            if (!inchi_stricmp( wrd, "None" ))
  ------------------
  |  Branch (408:17): [True: 0, False: 0]
  ------------------
  409|      0|            {
  410|      0|                *pbFrameShiftScheme = FSS_NONE;
  411|      0|            }
  412|      0|            else if (!inchi_stricmp( wrd, "Cyclize" ))
  ------------------
  |  Branch (412:22): [True: 0, False: 0]
  ------------------
  413|      0|            {
  414|      0|                *pbFrameShiftScheme = FSS_STARS_CYCLED;
  415|      0|            }
  416|      0|            else if (!inchi_stricmp( wrd, "MoveStars" ))
  ------------------
  |  Branch (416:22): [True: 0, False: 0]
  ------------------
  417|      0|            {
  418|      0|                *pbFrameShiftScheme = FSS_STARS_OPENED;
  419|      0|            }
  420|      0|            else if (!inchi_stricmp( wrd, "MoveBrackets" ))
  ------------------
  |  Branch (420:22): [True: 0, False: 0]
  ------------------
  421|      0|            {
  422|      0|                *pbFrameShiftScheme = FSS_STARS_ENDS_OPENED;
  423|      0|            }
  424|      0|        }
  425|      0|        else
  426|      0|        {
  427|      0|            *pbFrameShiftScheme = FSS_STARS_CYCLED;
  428|      0|        }
  429|      0|        got = 1;
  430|      0|    }
  431|    576|    else if (!inchi_stricmp( pArg, "NoFrameShift" ))
  ------------------
  |  Branch (431:14): [True: 0, False: 576]
  ------------------
  432|      0|    {
  433|      0|        *pbFrameShiftScheme = FSS_NONE;
  434|      0|        got = 1;
  435|      0|    }
  436|    576|    else if (!inchi_stricmp(pArg, "NoEdits"))
  ------------------
  |  Branch (436:14): [True: 0, False: 576]
  ------------------
  437|      0|    {
  438|      0|        *pbFoldPolymerSRU = 0;
  439|      0|        *pbFrameShiftScheme = FSS_NONE;
  440|      0|        got = 1;
  441|      0|    }
  442|    576|    else if (!inchi_stricmp(pArg, "SATZZ"))
  ------------------
  |  Branch (442:14): [True: 0, False: 576]
  ------------------
  443|      0|    {
  444|      0|        *pbStereoAtZz = 1;
  445|      0|        got = 1;
  446|      0|    }
  447|       |    
  448|       |
  449|    576|#endif /* ifndef USE_STDINCHI_API */
  450|       |
  451|    576|    if ( !got && developer_options)
  ------------------
  |  Branch (451:10): [True: 576, False: 0]
  |  Branch (451:18): [True: 0, False: 576]
  ------------------
  452|      0|    {
  453|       |
  454|      0|        if (!inchi_stricmp(pArg, "PGO"))
  ------------------
  |  Branch (454:13): [True: 0, False: 0]
  ------------------
  455|      0|        {
  456|       |            /* PGO : extract all good MOLfiles into the problem file */
  457|      0|            ip->bSaveAllGoodStructsAsProblem = 1;
  458|      0|            got = 1;
  459|      0|        }
  460|       |#if ( ALLOW_SUBSTRUCTURE_FILTERING== 1 )
  461|       |        else if (!inchi_stricmp(pArg, "FilterSS"))
  462|       |        {
  463|       |            ip->bFilterSS = 1;
  464|       |            got = 1;
  465|       |        }
  466|       |        else if (!inchi_stricmp(pArg, "InvFilterSS"))
  467|       |        {
  468|       |            ip->bFilterSS = -1;
  469|       |            got = 1;
  470|       |        }
  471|       |#endif
  472|       |        /* Options below DO TURN OFF Std flag   */
  473|      0|        if ( !inchi_stricmp( pArg, "FNUDOFF") )
  ------------------
  |  Branch (473:14): [True: 0, False: 0]
  ------------------
  474|      0|        {
  475|      0|            ip->bFixNonUniformDraw = 0;
  476|      0|            *pbStdFormat = 0;
  477|      0|            got = 1;
  478|      0|        }
  479|      0|        else if ( !inchi_stricmp( pArg, "FixSp3bugOFF" ) )
  ------------------
  |  Branch (479:19): [True: 0, False: 0]
  ------------------
  480|      0|        {
  481|      0|            *pbFixSp3bug = 0;
  482|      0|            *pbStdFormat = 0;
  483|      0|            got = 1;
  484|      0|        }
  485|      0|        else if (!inchi_stricmp( pArg, "FBOFF" ) )
  ------------------
  |  Branch (485:18): [True: 0, False: 0]
  ------------------
  486|      0|        {
  487|      0|            *pbFixSp3bug = 0;
  488|      0|            *pbStdFormat = 0;
  489|      0|            got = 1;
  490|      0|        }
  491|      0|        else if (!inchi_stricmp( pArg, "FB2OFF" ) )
  ------------------
  |  Branch (491:18): [True: 0, False: 0]
  ------------------
  492|      0|        {
  493|      0|            *pbFixFB2 = 0;
  494|      0|            *pbStdFormat = 0;
  495|      0|            got = 1;
  496|      0|        }
  497|      0|        else if (!inchi_stricmp( pArg, "SPXYZOFF" ) )
  ------------------
  |  Branch (497:18): [True: 0, False: 0]
  ------------------
  498|      0|        {
  499|      0|            *pbAddPhosphineStereo = 0;
  500|      0|            *pbStdFormat = 0;
  501|      0|            got = 1;
  502|      0|        }
  503|      0|        else if (!inchi_stricmp( pArg, "SASXYZOFF" ) )
  ------------------
  |  Branch (503:18): [True: 0, False: 0]
  ------------------
  504|      0|        {
  505|      0|            *pbAddArsineStereo = 0;
  506|      0|            *pbStdFormat = 0;
  507|      0|            got = 1;
  508|      0|        }
  509|      0|        else if (!inchi_stricmp(pArg, "Polymers105+"))
  ------------------
  |  Branch (509:18): [True: 0, False: 0]
  ------------------
  510|      0|        {
  511|      0|            *pbPolymers = POLYMERS_LEGACY_PLUS;
  ------------------
  |  | 1200|      0|#define POLYMERS_LEGACY_PLUS 3	/* 1.05 mode with an addition of that in all
  ------------------
  512|      0|            *pbStdFormat = 0;
  513|      0|            got = 1;
  514|      0|        }
  515|       |
  516|       |
  517|      0|    }
  518|       |
  519|    576|    return got;
  520|    576|}
ReadCommandLineParms:
  533|    576|{
  534|       |#if (BUILD_WITH_ENG_OPTIONS==1)
  535|       |    const int developer_options = 1;
  536|       |#else
  537|    576|    const int developer_options = 0;
  538|    576|#endif
  539|    576|    const char *q;
  540|    576|    const char *ext[MAX_NUM_PATHS + 1];
  541|    576|    const char *pArg;
  542|    576|    char szNameSuffix[32], szOutputPath[512];
  543|       |
  544|    576|    unsigned long ul;
  545|       |
  546|    576|    double t = 0;
  547|       |
  548|    576|    int bVer1Options = 1;
  549|    576|    int nMode = 0;
  550|    576|    int nReleaseMode = nMode | ( REQ_MODE_BASIC | REQ_MODE_TAUT | REQ_MODE_ISO | REQ_MODE_STEREO );
  ------------------
  |  |   43|    576|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
                  int nReleaseMode = nMode | ( REQ_MODE_BASIC | REQ_MODE_TAUT | REQ_MODE_ISO | REQ_MODE_STEREO );
  ------------------
  |  |   44|    576|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
                  int nReleaseMode = nMode | ( REQ_MODE_BASIC | REQ_MODE_TAUT | REQ_MODE_ISO | REQ_MODE_STEREO );
  ------------------
  |  |   45|    576|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
                  int nReleaseMode = nMode | ( REQ_MODE_BASIC | REQ_MODE_TAUT | REQ_MODE_ISO | REQ_MODE_STEREO );
  ------------------
  |  |   47|    576|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
  551|    576|    INCHI_MODE bVer1DefaultMode = VER103_DEFAULT_MODE;
  ------------------
  |  |   66|    576|#define VER103_DEFAULT_MODE    (REQ_MODE_TAUT | REQ_MODE_ISO | REQ_MODE_STEREO |\
  |  |  ------------------
  |  |  |  |   44|    576|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  |  |  ------------------
  |  |               #define VER103_DEFAULT_MODE    (REQ_MODE_TAUT | REQ_MODE_ISO | REQ_MODE_STEREO |\
  |  |  ------------------
  |  |  |  |   45|    576|#define REQ_MODE_ISO                0x000004    /* I    */
  |  |  ------------------
  |  |               #define VER103_DEFAULT_MODE    (REQ_MODE_TAUT | REQ_MODE_ISO | REQ_MODE_STEREO |\
  |  |  ------------------
  |  |  |  |   47|    576|#define REQ_MODE_STEREO             0x000010    /* S    */
  |  |  ------------------
  |  |   67|    576|                                REQ_MODE_SB_IGN_ALL_UU | REQ_MODE_SC_IGN_ALL_UU)
  |  |  ------------------
  |  |  |  |   60|    576|#define REQ_MODE_SB_IGN_ALL_UU      0x001000    /* IAUSC Ignore stereobonds if All Undef/Unknown */
  |  |  ------------------
  |  |                                               REQ_MODE_SB_IGN_ALL_UU | REQ_MODE_SC_IGN_ALL_UU)
  |  |  ------------------
  |  |  |  |   58|    576|#define REQ_MODE_SC_IGN_ALL_UU      0x000800    /* IAUSC Ignore stereocenters if All Undef/Unknown */
  |  |  ------------------
  ------------------
  552|       |
  553|    576|    int bNameSuffix;
  554|    576|    int bOutputPath;
  555|    576|    int bMergeAllInputStructures;
  556|    576|    int bForcedChiralFlag = 0;
  557|       |
  558|    576|    int bDisconnectSalts = ( DISCONNECT_SALTS == 1 );
  ------------------
  |  |  530|    576|#define DISCONNECT_SALTS            1  /* 1=>disconnect metal atoms from salts, 0=>dont */
  ------------------
  559|    576|    int bDoNotAddH = 0;
  560|    576|    int bRecognizedOption;
  561|    576|    int bTgFlagVariableProtons = 1;
  562|    576|    int bTgFlagHardAddRenProtons = 1;
  563|    576|    int bReconnectCoord = ( RECONNECT_METALS == 1 );
  ------------------
  |  |  558|    576|#define RECONNECT_METALS            0  /* 1=> by default add reconnected layer in case of coord.
  ------------------
  564|    576|    int bDisconnectCoord = ( DISCONNECT_METALS == 1 );
  ------------------
  |  |  557|    576|#define DISCONNECT_METALS           1  /* make main layer disconnected */
  ------------------
  565|    576|    int bDisconnectCoordChkVal = ( CHECK_METAL_VALENCE == 1 );
  ------------------
  |  |  560|    576|#define CHECK_METAL_VALENCE         0  /* 1=> disconnect only metals that have abnormal valence */
  ------------------
  566|    576|    int bMovePositiveCharges = ( MOVE_CHARGES == 1 );
  ------------------
  |  |  540|    576|#define MOVE_CHARGES                1  /* 1 => take moveable charges into account */
  ------------------
  567|    576|    int bAcidTautomerism = ( DISCONNECT_SALTS == 1 ) ? ( TEST_REMOVE_S_ATOMS == 1 ? 2 : 1 ) : 0;
  ------------------
  |  |  530|    576|#define DISCONNECT_SALTS            1  /* 1=>disconnect metal atoms from salts, 0=>dont */
  ------------------
                  int bAcidTautomerism = ( DISCONNECT_SALTS == 1 ) ? ( TEST_REMOVE_S_ATOMS == 1 ? 2 : 1 ) : 0;
  ------------------
  |  |  531|    576|#define TEST_REMOVE_S_ATOMS         1  /* 1=>default: after merging into one group test &
  ------------------
  |  Branch (567:28): [Folded - Ignored]
  |  Branch (567:58): [Folded - Ignored]
  ------------------
  568|    576|    int bUnchargedAcidTaut = ( CHARGED_SALTS_ONLY == 0 );
  ------------------
  |  |  534|    576|#define CHARGED_SALTS_ONLY          1  /* 1=>(default)do not test far salts tautomerism if
  ------------------
  569|    576|    int bMergeSaltTGroups = ( DISCONNECT_SALTS == 1 );
  ------------------
  |  |  530|    576|#define DISCONNECT_SALTS            1  /* 1=>disconnect metal atoms from salts, 0=>dont */
  ------------------
  570|    576|#if ( MIN_SB_RING_SIZE > 0 )
  571|    576|    int nMinDbRinSize = MIN_SB_RING_SIZE, mdbr = 0;
  ------------------
  |  |  597|    576|#define MIN_SB_RING_SIZE            8    /* do not assume stereo bonds in rings containing 3..MIN_SB_RING_SIZE-1 atoms */
  ------------------
  572|    576|#endif
  573|    576|#ifdef STEREO_WEDGE_ONLY
  574|    576|    int bPointedEdgeStereo = STEREO_WEDGE_ONLY; /* NEWPS TG_FLAG_POINTED_EDGE_STEREO */
  ------------------
  |  |  619|    576|#define STEREO_WEDGE_ONLY          1 /* 1=> only pointed ends stereo bonds define stereo; 0=> both ends 1.12Beta */
  ------------------
  575|    576|#endif
  576|       |#if ( FIX_ADJ_RAD == 1 )
  577|       |    int bFixAdjacentRad = 0;
  578|       |#endif
  579|    576|    int bAddPhosphineStereo = 1;
  580|    576|    int bAddArsineStereo    = 1;
  581|    576|    int bFixSp3bug          = 1;
  582|    576|    int bFixFB2             = 1;
  583|    576|    int bKetoEnolTaut       = 0;
  584|    576|    int b15TautNonRing      = 0;
  585|    576|    int bStdFormat          = 1;
  586|    576|    int bHashKey            = 0;
  587|    576|    int bHashXtra1          = 0;
  588|    576|    int bHashXtra2          = 0;
  589|    576|    int bLargeMolecules     = 0;
  590|    576|    int bPolymers           = POLYMERS_NO;
  ------------------
  |  | 1197|    576|#define POLYMERS_NO 0		/* ignore polymers										*/
  ------------------
  591|       |#ifdef TARGET_LIB_FOR_WINCHI
  592|       |    int bFoldPolymerSRU     = 0;
  593|       |    int bFrameShiftScheme = FSS_STARS_CYCLED;
  594|       |#else
  595|    576|    int bFoldPolymerSRU = 0;
  596|    576|    int bFrameShiftScheme = FSS_STARS_CYCLED;
  597|    576|#endif
  598|    576|    int bLooseTSACheck      = 0;
  599|    576|    int bStereoAtZz         = 0;
  600|    576|    int bNPZz				= 0;
  601|    576|    int bNoWarnings         = 0;
  602|    576|    int bMergeHash          = 0;
  603|    576|    int bHideInChI          = 0;
  604|       |
  605|    576|    int bOutputStyle        = INCHI_OUT_PLAIN_TEXT;
  ------------------
  |  |  163|    576|#define INCHI_OUT_PLAIN_TEXT            0x0040   /* output plain text INChI                 */
  ------------------
  606|    576|    int bDisplay = 0;
  607|    576|    int bNoStructLabels = 0;
  608|    576|    int bOutputMolfileOnly = 0;
  609|    576|    int bOutputMolfileDT = 0;
  610|    576|    int bOutputMolfileSplit = 0;
  611|    576|    int bDisplayCompositeResults = 0;
  612|    576|    int nFontSize = -9;
  613|    576|    int bINChIOutputOptions2 = 0;
  614|       |#ifdef TARGET_LIB_FOR_WINCHI
  615|       |    int is_gui              = 1;
  616|       |    int bINChIOutputOptions = INCHI_OUT_EMBED_REC; /* embed reconnected & output full aux info */
  617|       |    int bCompareComponents  = CMP_COMPONENTS;
  618|       |#else
  619|    576|    int is_gui              = 0;
  620|    576|    int bINChIOutputOptions = ( ( EMBED_REC_METALS_INCHI == 1 ) ? INCHI_OUT_EMBED_REC : 0 );
  ------------------
  |  |  565|    576|#define EMBED_REC_METALS_INCHI      1  /* 1=> (default) output Reconnected embedded in Disconnected INChI;
  ------------------
                  int bINChIOutputOptions = ( ( EMBED_REC_METALS_INCHI == 1 ) ? INCHI_OUT_EMBED_REC : 0 );
  ------------------
  |  |  160|    576|#define INCHI_OUT_EMBED_REC             0x0008   /* embed reconnected INChI into disconnected INChI */
  ------------------
  |  Branch (620:33): [Folded - Ignored]
  ------------------
  621|    576|    int bCompareComponents  = 0;
  622|    576|#endif
  623|    576|#if ( READ_INCHI_STRING == 1 )
  624|    576|    int bDisplayIfRestoreWarnings = 0;
  625|    576|#endif
  626|       |#if ( BUILD_WITH_AMI == 1 ) && ( OUTPUT_FILE_EXT == 1 )
  627|       |    int numOutNameExt;
  628|       |    char szOutNameExt[3][128];
  629|       |#endif
  630|       |
  631|    576|    int i, k, c, got;
  632|    576|    int timeout_set_warning = 0;
  633|    576|    int timeout_set_error   = 0;
  634|       |
  635|    576|    ext[0] = ".mol";
  636|    576|    ext[1] = bVer1Options ? ".txt" : ".ich";
  ------------------
  |  Branch (636:14): [True: 576, False: 0]
  ------------------
  637|    576|    ext[2] = ".log";
  638|    576|    ext[3] = ".prb";
  639|    576|    ext[4] = "";
  640|       |
  641|       |    /*  Init table of parameters */
  642|    576|    memset( ip, 0, sizeof( *ip ) );
  643|       |
  644|       |    /* Default are StdInChI generation options */
  645|    576|    bVer1DefaultMode        &= ~REQ_MODE_BASIC; /* "FIXEDH - OFF" */
  ------------------
  |  |   43|    576|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
  646|    576|    bReconnectCoord         = 0;                /* "RECMET - OFF" */
  647|    576|    bPointedEdgeStereo      = 1;                /* "NEWPS"        */
  648|    576|    ip->bFixNonUniformDraw  = 1;                /* "FNUD"         */
  649|       |
  650|       |#ifndef COMPILE_ANSI_ONLY
  651|       |    strcpy( ip->tdp.ReqShownFoundTxt[ilSHOWN], "Shown" );
  652|       |    ip->dp.sdp.tdp = &ip->tdp;
  653|       |    ip->dp.pdp = &ip->pdp;
  654|       |#endif
  655|    576|    memset( szNameSuffix, 0, sizeof( szNameSuffix ) );
  656|    576|    bNameSuffix = 0;
  657|    576|    memset( szOutputPath, 0, sizeof( szOutputPath ) );
  658|    576|    bOutputPath = 0;
  659|       |#if( OUTPUT_FILE_EXT == 1 )
  660|       |    memset( szOutNameExt, 0, sizeof( szOutNameExt ) );
  661|       |    numOutNameExt = 0;
  662|       |#endif
  663|    576|    bMergeAllInputStructures = 0;
  664|    576|#ifdef TARGET_API_LIB
  665|    576|    ip->msec_MaxTime = 0;      /*  milliseconds, default in libinchi: unlimited */
  666|       |#else
  667|       |    ip->msec_MaxTime = 60000;  /*  milliseconds, default: 60 sec */
  668|       |#endif
  669|    576|    *ulDisplTime = 0;
  670|       |
  671|    576|    if (bReleaseVersion)
  ------------------
  |  Branch (671:9): [True: 576, False: 0]
  ------------------
  672|    576|    {
  673|       |        /*  normal */
  674|    576|        ip->bAbcNumbers = 0;
  675|    576|        ip->bCtPredecessors = 0;
  676|    576|    }
  677|      0|    else
  678|      0|    {
  679|      0|        nReleaseMode = 0;
  680|      0|    }
  681|    576|    if (bVer1Options)
  ------------------
  |  Branch (681:9): [True: 576, False: 0]
  ------------------
  682|    576|    {
  683|    576|        bNameSuffix = 1;
  684|    576|        szNameSuffix[0] = '\0';
  685|    576|    }
  686|       |
  687|       |#if ( ALLOW_SUBSTRUCTURE_FILTERING== 1 )
  688|       |    ip->bFilterSS = 0;
  689|       |#endif
  690|       |
  691|       |
  692|       |
  693|       |    /* Analyze command line switches */
  694|  1.15k|    for (i = 1; i < argc; i++)
  ------------------
  |  Branch (694:17): [True: 576, False: 576]
  ------------------
  695|    576|    {
  696|       |
  697|    576|        if ( is_gui && INCHI_OPTION_PREFX == argv[i][0] && INCHI_OPTION_PREFX != argv[i][1])
  ------------------
  |  |  255|      0|#define   INCHI_OPTION_PREFX  '-'
  ------------------
                      if ( is_gui && INCHI_OPTION_PREFX == argv[i][0] && INCHI_OPTION_PREFX != argv[i][1])
  ------------------
  |  |  255|      0|#define   INCHI_OPTION_PREFX  '-'
  ------------------
  |  Branch (697:14): [True: 0, False: 576]
  |  Branch (697:24): [True: 0, False: 0]
  |  Branch (697:60): [True: 0, False: 0]
  ------------------
  698|      0|        {
  699|       |            /* Parsing TARGET_LIB_FOR_WINCHI GUI options (and v. 0.9xx Beta as well)  */
  700|      0|            pArg = argv[i] + 1;
  701|      0|            got = set_common_options_by_parg( pArg, developer_options, ip, &bVer1DefaultMode, &nMode,
  702|      0|                                              &bINChIOutputOptions, &bINChIOutputOptions2,
  703|      0|                                              &bStdFormat, &bHashKey, &bHashXtra1, &bHashXtra2,
  704|      0|                                              &bFixSp3bug, &bFixFB2,
  705|      0|                                              &bAddPhosphineStereo, &bAddArsineStereo,
  706|      0|                                              &bNoStructLabels, &bPointedEdgeStereo,
  707|      0|                                              &bDoNotAddH, &bForcedChiralFlag, &bReconnectCoord,
  708|      0|                                              &bKetoEnolTaut, 
  709|      0|                                              &b15TautNonRing, 
  710|      0|                                              &bLooseTSACheck,
  711|      0|                                              &bLargeMolecules, &bPolymers,
  712|      0|                                              &bFoldPolymerSRU, &bFrameShiftScheme,
  713|      0|                                              &bStereoAtZz, &bNPZz,
  714|      0|                                              &bNoWarnings, &bMergeHash, &bHideInChI );
  715|      0|            if (got)
  ------------------
  |  Branch (715:17): [True: 0, False: 0]
  ------------------
  716|      0|            {
  717|      0|                ;
  718|      0|            }
  719|      0|            else if ( INPUT_NONE == ip->nInputType      &&
  ------------------
  |  Branch (719:23): [True: 0, False: 0]
  ------------------
  720|      0|                 ( !inchi_memicmp( pArg, "SDF", 3 ) )   &&
  ------------------
  |  Branch (720:18): [True: 0, False: 0]
  ------------------
  721|      0|                 ( pArg[3] == ':' )                      )
  ------------------
  |  Branch (721:18): [True: 0, False: 0]
  ------------------
  722|      0|            {
  723|      0|                k = 0;
  724|      0|                mystrncpy( ip->szSdfDataHeader, pArg + 4, MAX_SDF_HEADER + 1 );
  ------------------
  |  |   45|      0|#define MAX_SDF_HEADER        64 /* max length of the SDFile data header */
  ------------------
  725|      0|                lrtrim( ip->szSdfDataHeader, &k );
  726|      0|                if (k)
  ------------------
  |  Branch (726:21): [True: 0, False: 0]
  ------------------
  727|      0|                {
  728|      0|                    ip->pSdfLabel = ip->szSdfDataHeader;
  729|      0|                    ip->pSdfValue = szSdfDataValue;
  730|      0|                    ip->nInputType = INPUT_SDFILE;
  731|      0|                }
  732|      0|                else
  733|      0|                {
  734|      0|                    ip->pSdfLabel = NULL;
  735|      0|                    ip->pSdfValue = NULL;
  736|      0|                    ip->nInputType = INPUT_MOLFILE;
  737|      0|                }
  738|      0|            }
  739|      0|            else if (INPUT_NONE == ip->nInputType && !inchi_stricmp( pArg, "MOL" ))
  ------------------
  |  Branch (739:22): [True: 0, False: 0]
  |  Branch (739:54): [True: 0, False: 0]
  ------------------
  740|      0|            {
  741|      0|                ip->nInputType = INPUT_MOLFILE;
  742|      0|            }
  743|      0|            else if (INPUT_NONE == ip->nInputType && !inchi_stricmp( pArg, "SDF" ))
  ------------------
  |  Branch (743:22): [True: 0, False: 0]
  |  Branch (743:54): [True: 0, False: 0]
  ------------------
  744|      0|            {
  745|      0|                ip->nInputType = INPUT_MOLFILE;
  746|      0|            }
  747|       |            /*--- Output options ---*/
  748|       |#if ( !defined(TARGET_API_LIB) && !defined(TARGET_LIB_FOR_WINCHI) )
  749|       |            else if (!inchi_stricmp( pArg, "Tabbed" ) || !inchi_stricmp( pArg, "Tab" ))
  750|       |            {
  751|       |                bOutputStyle |= INCHI_OUT_TABBED_OUTPUT;
  752|       |            }
  753|       |#endif
  754|       |
  755|       |            /* Removed condition
  756|       |                #if ( defined(BUILD_WITH_ENG_OPTIONS) || defined(TARGET_LIB_FOR_WINCHI) )
  757|       |                which is always true, as we already are under condition
  758|       |                'if ( is_gui && ...)' and is_gui==1 means TARGET_LIB_FOR_WINCHI
  759|       |            */
  760|       |            /* #if ( defined(BUILD_WITH_ENG_OPTIONS) || defined(TARGET_LIB_FOR_WINCHI) )  */
  761|      0|            else if (!inchi_stricmp( pArg, "SDFID" ))
  ------------------
  |  Branch (761:22): [True: 0, False: 0]
  ------------------
  762|      0|            {
  763|      0|                ip->bGetSdfileId = 1;
  764|      0|            }
  765|      0|            else if (!inchi_stricmp( pArg, "PLAIN" ))
  ------------------
  |  Branch (765:22): [True: 0, False: 0]
  ------------------
  766|      0|            {
  767|      0|                bOutputStyle |= INCHI_OUT_PLAIN_TEXT;
  ------------------
  |  |  163|      0|#define INCHI_OUT_PLAIN_TEXT            0x0040   /* output plain text INChI                 */
  ------------------
  768|      0|            }
  769|      0|            else if (!inchi_stricmp( pArg, "ANNPLAIN" ))
  ------------------
  |  Branch (769:22): [True: 0, False: 0]
  ------------------
  770|      0|            {
  771|      0|                bOutputStyle |= INCHI_OUT_PLAIN_TEXT_COMMENTS;
  ------------------
  |  |  164|      0|#define INCHI_OUT_PLAIN_TEXT_COMMENTS   0x0080   /* output plain text annotation            */
  ------------------
  772|      0|            }
  773|      0|            else if (!inchi_memicmp( pArg, "AUXINFO:", 8 ) && isdigit( UCINT pArg[8] ))
  ------------------
  |  Branch (773:22): [True: 0, False: 0]
  ------------------
  774|      0|            {
  775|      0|                k = strtol( pArg + 8, NULL, 10 );
  776|      0|                if (k == 0)
  ------------------
  |  Branch (776:21): [True: 0, False: 0]
  ------------------
  777|      0|                {
  778|      0|                    bINChIOutputOptions |= INCHI_OUT_NO_AUX_INFO;  /* no aux info */
  ------------------
  |  |  157|      0|#define INCHI_OUT_NO_AUX_INFO           0x0001   /* do not output Aux Info                  */
  ------------------
  779|      0|                    bINChIOutputOptions &= ~INCHI_OUT_SHORT_AUX_INFO;
  ------------------
  |  |  158|      0|#define INCHI_OUT_SHORT_AUX_INFO        0x0002   /* output short version of Aux Info        */
  ------------------
  780|      0|                }
  781|      0|                else if (k == 1)
  ------------------
  |  Branch (781:26): [True: 0, False: 0]
  ------------------
  782|      0|                {
  783|      0|                    bINChIOutputOptions &= ~( INCHI_OUT_NO_AUX_INFO | INCHI_OUT_SHORT_AUX_INFO ); /* include full aux info */
  ------------------
  |  |  157|      0|#define INCHI_OUT_NO_AUX_INFO           0x0001   /* do not output Aux Info                  */
  ------------------
                                  bINChIOutputOptions &= ~( INCHI_OUT_NO_AUX_INFO | INCHI_OUT_SHORT_AUX_INFO ); /* include full aux info */
  ------------------
  |  |  158|      0|#define INCHI_OUT_SHORT_AUX_INFO        0x0002   /* output short version of Aux Info        */
  ------------------
  784|      0|                }
  785|      0|                else if (k == 2)
  ------------------
  |  Branch (785:26): [True: 0, False: 0]
  ------------------
  786|      0|                {
  787|      0|                    bINChIOutputOptions &= ~INCHI_OUT_NO_AUX_INFO; /* include short aux info */
  ------------------
  |  |  157|      0|#define INCHI_OUT_NO_AUX_INFO           0x0001   /* do not output Aux Info                  */
  ------------------
  788|      0|                    bINChIOutputOptions |= INCHI_OUT_SHORT_AUX_INFO;
  ------------------
  |  |  158|      0|#define INCHI_OUT_SHORT_AUX_INFO        0x0002   /* output short version of Aux Info        */
  ------------------
  789|      0|                }
  790|      0|                else
  791|      0|                {
  792|      0|                    bINChIOutputOptions = k;  /* override everything */
  793|      0|                }
  794|      0|            }
  795|      0|            else if (!inchi_stricmp( pArg, "MERGE" ))
  ------------------
  |  Branch (795:22): [True: 0, False: 0]
  ------------------
  796|      0|            {
  797|      0|                bMergeAllInputStructures = 1;
  798|      0|            }
  799|       |
  800|      0|            else if (!inchi_stricmp( pArg, "PGO" ))
  ------------------
  |  Branch (800:22): [True: 0, False: 0]
  ------------------
  801|      0|            {
  802|      0|                ip->bSaveAllGoodStructsAsProblem = 1;
  803|      0|            }
  804|      0|            else if (!inchi_stricmp( pArg, "DCR" ))
  ------------------
  |  Branch (804:22): [True: 0, False: 0]
  ------------------
  805|      0|            {
  806|      0|                bDisplayCompositeResults = 1;
  807|      0|            }
  808|       |
  809|      0|            else if (!inchi_stricmp( pArg, "DSB" ))
  ------------------
  |  Branch (809:22): [True: 0, False: 0]
  ------------------
  810|      0|            {
  811|      0|                nMode |= REQ_MODE_NO_ALT_SBONDS;
  ------------------
  |  |   51|      0|#define REQ_MODE_NO_ALT_SBONDS      0x000100    /* NASB */
  ------------------
  812|      0|            }
  813|      0|            else if (!inchi_stricmp( pArg, "NOHDR" ))
  ------------------
  |  Branch (813:22): [True: 0, False: 0]
  ------------------
  814|      0|            {
  815|      0|                bNoStructLabels = 1;
  816|      0|            }
  817|      0|            else if (!inchi_stricmp( pArg, "NoVarH" ))
  ------------------
  |  Branch (817:22): [True: 0, False: 0]
  ------------------
  818|      0|            {
  819|      0|                bTgFlagVariableProtons = 0;
  820|      0|            }
  821|       |            /*--- (hidden) Old structure-perception and InChI creation options ---*/
  822|       |            /*--- (engineering) Old structure-perception and InChI creation options ---*/
  823|      0|            else if (!inchi_stricmp( pArg, "NOUUSB" ))
  ------------------
  |  Branch (823:22): [True: 0, False: 0]
  ------------------
  824|      0|            {
  825|      0|                nMode |= REQ_MODE_SB_IGN_ALL_UU;
  ------------------
  |  |   60|      0|#define REQ_MODE_SB_IGN_ALL_UU      0x001000    /* IAUSC Ignore stereobonds if All Undef/Unknown */
  ------------------
  826|      0|                bStdFormat = 0;
  827|      0|            }
  828|      0|            else if (!inchi_stricmp( pArg, "NOUUSC" ))
  ------------------
  |  Branch (828:22): [True: 0, False: 0]
  ------------------
  829|      0|            {
  830|      0|                nMode |= REQ_MODE_SC_IGN_ALL_UU;
  ------------------
  |  |   58|      0|#define REQ_MODE_SC_IGN_ALL_UU      0x000800    /* IAUSC Ignore stereocenters if All Undef/Unknown */
  ------------------
  831|      0|                bStdFormat = 0;
  832|      0|            }
  833|       |#if ( FIX_ADJ_RAD == 1 )
  834|       |            else if (!inchi_stricmp( pArg, "FixRad" ))
  835|       |            {
  836|       |                bFixAdjacentRad = 1;
  837|       |                bStdFormat = 0;
  838|       |            }
  839|       |#endif
  840|       |#if ( UNDERIVATIZE == 1 )
  841|       |            else if (!inchi_stricmp( pArg, "DoDRV" ))
  842|       |            {
  843|       |                ip->bUnderivatize = 1;
  844|       |                bStdFormat = 0;
  845|       |            }
  846|       |#if( UNDERIVATIZE_REPORT == 1 )
  847|       |            else if (!inchi_stricmp( pArg, "DoDrvReport" ))
  848|       |            {
  849|       |                ip->bUnderivatize = 3;
  850|       |                bStdFormat = 0;
  851|       |            }
  852|       |#endif
  853|       |#endif
  854|       |#if ( RING2CHAIN == 1 )
  855|       |            else if (!inchi_stricmp( pArg, "DoR2C" ))
  856|       |            {
  857|       |                ip->bRing2Chain = 1;
  858|       |                bStdFormat = 0;
  859|       |            }
  860|       |#endif
  861|       |#if ( RING2CHAIN == 1 || UNDERIVATIZE == 1 )
  862|       |            else if (!inchi_stricmp( pArg, "DoneOnly" ))
  863|       |            {
  864|       |                ip->bIgnoreUnchanged = 1;
  865|       |                bStdFormat = 0;
  866|       |            }
  867|       |#endif
  868|      0|            else if (!inchi_stricmp( pArg, "NoADP" ))
  ------------------
  |  Branch (868:22): [True: 0, False: 0]
  ------------------
  869|      0|            {
  870|      0|                bTgFlagHardAddRenProtons = 0;
  871|      0|                bStdFormat = 0;
  872|      0|            }
  873|      0|            else if (!inchi_memicmp( pArg, "DISCONSALT:", 11 ))
  ------------------
  |  Branch (873:22): [True: 0, False: 0]
  ------------------
  874|      0|            {
  875|      0|                bDisconnectSalts = ( 0 != strtol( pArg + 11, NULL, 10 ) );
  876|      0|                bStdFormat = 0;
  877|      0|            }
  878|      0|            else if (!inchi_memicmp( pArg, "DISCONMETAL:", 12 ))
  ------------------
  |  Branch (878:22): [True: 0, False: 0]
  ------------------
  879|      0|            {
  880|      0|                bDisconnectCoord = ( 0 != strtol( pArg + 12, NULL, 10 ) );
  881|      0|                bStdFormat = 0;
  882|      0|            }
  883|      0|            else if (!inchi_memicmp( pArg, "RECONMETAL:", 11 ))
  ------------------
  |  Branch (883:22): [True: 0, False: 0]
  ------------------
  884|      0|            {
  885|      0|                bReconnectCoord = ( 0 != strtol( pArg + 11, NULL, 10 ) );
  886|      0|                bStdFormat = 0;
  887|      0|            }
  888|      0|            else if (!inchi_memicmp( pArg, "DISCONMETALCHKVAL:", 18 ))
  ------------------
  |  Branch (888:22): [True: 0, False: 0]
  ------------------
  889|      0|            {
  890|      0|                bDisconnectCoordChkVal = ( 0 != strtol( pArg + 18, NULL, 10 ) );
  891|      0|                bStdFormat = 0;
  892|      0|            }
  893|      0|            else if (!inchi_memicmp( pArg, "MOVEPOS:", 8 ))
  ------------------
  |  Branch (893:22): [True: 0, False: 0]
  ------------------
  894|      0|            {
  895|      0|                bMovePositiveCharges = ( 0 != strtol( pArg + 8, NULL, 10 ) );
  896|      0|                bStdFormat = 0;
  897|      0|            }
  898|      0|            else if (!inchi_memicmp( pArg, "MERGESALTTG:", 12 ))
  ------------------
  |  Branch (898:22): [True: 0, False: 0]
  ------------------
  899|      0|            {
  900|      0|                bMergeSaltTGroups = ( 0 != strtol( pArg + 12, NULL, 10 ) );
  901|      0|                bStdFormat = 0;
  902|      0|            }
  903|      0|            else if (!inchi_memicmp( pArg, "UNCHARGEDACIDS:", 15 ))
  ------------------
  |  Branch (903:22): [True: 0, False: 0]
  ------------------
  904|      0|            {
  905|      0|                bUnchargedAcidTaut = ( 0 != strtol( pArg + 15, NULL, 16 ) );
  906|      0|                bStdFormat = 0;
  907|      0|            }
  908|      0|            else if (!inchi_memicmp( pArg, "ACIDTAUT:", 9 ))
  ------------------
  |  Branch (908:22): [True: 0, False: 0]
  ------------------
  909|      0|            {
  910|      0|                bAcidTautomerism = c = (int) strtol( pArg + 9, NULL, 10 );
  911|      0|                if (0 <= c && c <= 2)  bAcidTautomerism = c;
  ------------------
  |  Branch (911:21): [True: 0, False: 0]
  |  Branch (911:31): [True: 0, False: 0]
  ------------------
  912|       |                /*else bNotRecognized = 2*bReleaseVersion;*/
  913|      0|                bStdFormat = 0;
  914|      0|            }
  915|       |            /*--- (hidden) Old output and other options ---*/
  916|      0|            else if (!inchi_memicmp( pArg, "O:", 2 ))
  ------------------
  |  Branch (916:22): [True: 0, False: 0]
  ------------------
  917|      0|            {
  918|      0|                bNameSuffix = 1;
  919|      0|                strncpy( szNameSuffix, pArg + 2, sizeof( szNameSuffix ) - 1 );
  920|      0|            }
  921|      0|            else if (!inchi_memicmp( pArg, "OP:", 3 ))
  ------------------
  |  Branch (921:22): [True: 0, False: 0]
  ------------------
  922|      0|            {
  923|      0|                bOutputPath = 1;
  924|      0|                strncpy( szOutputPath, pArg + 3, sizeof( szOutputPath ) - 1 );
  925|      0|            }
  926|      0|            else if (!inchi_stricmp( pArg, "ALT" ))
  ------------------
  |  Branch (926:22): [True: 0, False: 0]
  ------------------
  927|      0|            {
  928|      0|                ip->bAbcNumbers = 1;
  929|      0|                bStdFormat = 0;
  930|      0|            }
  931|      0|            else if (!inchi_stricmp( pArg, "SCT" ))
  ------------------
  |  Branch (931:22): [True: 0, False: 0]
  ------------------
  932|      0|            {
  933|      0|                ip->bCtPredecessors = 1;
  934|      0|                bStdFormat = 0;
  935|      0|            }
  936|      0|            else if (!inchi_stricmp( pArg, "CMP" ))
  ------------------
  |  Branch (936:22): [True: 0, False: 0]
  ------------------
  937|      0|            {
  938|      0|                bCompareComponents = CMP_COMPONENTS;
  ------------------
  |  |   82|      0|#define CMP_COMPONENTS              0x0001     /* perform compare components */
  ------------------
  939|      0|            }
  940|      0|            else if (!inchi_stricmp( pArg, "CMPNONISO" ))
  ------------------
  |  Branch (940:22): [True: 0, False: 0]
  ------------------
  941|      0|            {
  942|      0|                bCompareComponents = CMP_COMPONENTS | CMP_COMPONENTS_NONISO;
  ------------------
  |  |   82|      0|#define CMP_COMPONENTS              0x0001     /* perform compare components */
  ------------------
                              bCompareComponents = CMP_COMPONENTS | CMP_COMPONENTS_NONISO;
  ------------------
  |  |   83|      0|#define CMP_COMPONENTS_NONISO       0x0002     /* ignore isotopic */
  ------------------
  943|      0|            }
  944|      0|            else if (!inchi_stricmp( pArg, "PW" ))
  ------------------
  |  Branch (944:22): [True: 0, False: 0]
  ------------------
  945|      0|            {
  946|      0|                ip->bSaveWarningStructsAsProblem = 1;
  947|      0|            }
  948|       |
  949|      0|            else if (!inchi_memicmp( pArg, "RSB:", 4 ) && developer_options)
  ------------------
  |  Branch (949:22): [True: 0, False: 0]
  |  Branch (949:59): [Folded - Ignored]
  ------------------
  950|      0|            {
  951|      0|                mdbr = (int) strtol( pArg + 4, NULL, 10 );
  952|      0|            }
  953|      0|            else if (!inchi_memicmp( pArg, "DISCONSALT:", 11 ) && developer_options)
  ------------------
  |  Branch (953:22): [True: 0, False: 0]
  |  Branch (953:67): [Folded - Ignored]
  ------------------
  954|      0|            {
  955|      0|                bDisconnectSalts = ( 0 != strtol( pArg + 11, NULL, 10 ) );
  956|      0|            }
  957|      0|            else if (!inchi_memicmp( pArg, "DISCONMETAL:", 12 ) && developer_options)
  ------------------
  |  Branch (957:22): [True: 0, False: 0]
  |  Branch (957:68): [Folded - Ignored]
  ------------------
  958|      0|            {
  959|      0|                bDisconnectCoord = ( 0 != strtol( pArg + 12, NULL, 10 ) );
  960|      0|            }
  961|      0|            else if (!inchi_memicmp( pArg, "RECONMETAL:", 11 ) && developer_options)
  ------------------
  |  Branch (961:22): [True: 0, False: 0]
  |  Branch (961:67): [Folded - Ignored]
  ------------------
  962|      0|            {
  963|      0|                bReconnectCoord = ( 0 != strtol( pArg + 11, NULL, 10 ) );
  964|      0|            }
  965|      0|            else if (!inchi_memicmp( pArg, "DISCONMETALCHKVAL:", 18 ) && developer_options)
  ------------------
  |  Branch (965:22): [True: 0, False: 0]
  |  Branch (965:74): [Folded - Ignored]
  ------------------
  966|      0|            {
  967|      0|                bDisconnectCoordChkVal = ( 0 != strtol( pArg + 18, NULL, 10 ) );
  968|      0|            }
  969|      0|            else if (!inchi_memicmp( pArg, "MOVEPOS:", 8 ) && developer_options)
  ------------------
  |  Branch (969:22): [True: 0, False: 0]
  |  Branch (969:63): [Folded - Ignored]
  ------------------
  970|      0|            {
  971|      0|                bMovePositiveCharges = ( 0 != strtol( pArg + 8, NULL, 10 ) );
  972|      0|            }
  973|      0|            else if (!inchi_memicmp( pArg, "MERGESALTTG:", 12 ) && developer_options)
  ------------------
  |  Branch (973:22): [True: 0, False: 0]
  |  Branch (973:68): [Folded - Ignored]
  ------------------
  974|      0|            {
  975|      0|                bMergeSaltTGroups = ( 0 != strtol( pArg + 12, NULL, 10 ) );
  976|      0|            }
  977|      0|            else if (!inchi_memicmp( pArg, "UNCHARGEDACIDS:", 15 ) && developer_options)
  ------------------
  |  Branch (977:22): [True: 0, False: 0]
  |  Branch (977:71): [Folded - Ignored]
  ------------------
  978|      0|            {
  979|      0|                bUnchargedAcidTaut = ( 0 != strtol( pArg + 15, NULL, 16 ) );;
  980|      0|            }
  981|      0|            else if (!inchi_memicmp( pArg, "ACIDTAUT:", 9 ) && developer_options)
  ------------------
  |  Branch (981:22): [True: 0, False: 0]
  |  Branch (981:64): [Folded - Ignored]
  ------------------
  982|      0|            {
  983|      0|                bAcidTautomerism = c = (int) strtol( pArg + 9, NULL, 10 );
  984|      0|                if (0 <= c && c <= 2)
  ------------------
  |  Branch (984:21): [True: 0, False: 0]
  |  Branch (984:31): [True: 0, False: 0]
  ------------------
  985|      0|                {
  986|      0|                    bAcidTautomerism = c;
  987|      0|                }
  988|       |                /*else bNotRecognized = 2*bReleaseVersion;*/
  989|      0|            }
  990|       |
  991|      0|            else
  992|      0|            {
  993|       |                /*for ( k = 0; c=pArg[k]; k ++ )*/
  994|      0|                k = 0;
  995|      0|                c = pArg[k]; /* prohibit multiple option concatenations, strict syntax check 2008-11-05 DT  */
  996|      0|                {
  997|      0|                    c = toupper( c );
  998|      0|                    switch (c)
  999|      0|                    {
 1000|      0|                        case 'D':
  ------------------
  |  Branch (1000:25): [True: 0, False: 0]
  ------------------
 1001|      0|                            bDisplay |= 1;
 1002|      0|                            if (( pArg[k + 1] == 'C' || pArg[k + 1] == 'c' ) && !pArg[k + 2])
  ------------------
  |  Branch (1002:35): [True: 0, False: 0]
  |  Branch (1002:57): [True: 0, False: 0]
  |  Branch (1002:81): [True: 0, False: 0]
  ------------------
 1003|      0|                            {
 1004|      0|                                bDisplay |= 1;
 1005|      0|                                k++;
 1006|      0|                                ip->bDisplayEachComponentINChI = 1;
 1007|      0|                            }
 1008|      0|                            else if (!pArg[k + 1])
  ------------------
  |  Branch (1008:38): [True: 0, False: 0]
  ------------------
 1009|      0|                            {
 1010|      0|                                bDisplay |= 1;
 1011|      0|                            }
 1012|      0|                            break;
 1013|      0|                        case 'W':
  ------------------
  |  Branch (1013:25): [True: 0, False: 0]
  ------------------
 1014|      0|                            if (pArg[k + 1] == 'D')
  ------------------
  |  Branch (1014:33): [True: 0, False: 0]
  ------------------
 1015|      0|                            {
 1016|       |                                /* restore Display Time functionality */
 1017|      0|                                c = 'D';
 1018|      0|                                k++;
 1019|      0|                            }
 1020|      0|                            t = strtod( pArg + k + 1, (char**) &q ); /*  cast deliberately discards 'const' qualifier */
 1021|      0|                            if (q > pArg + k + 1 && errno == ERANGE || t < 0.0 || t*1000.0 >( double )ULONG_MAX)
  ------------------
  |  Branch (1021:33): [True: 0, False: 0]
  |  Branch (1021:53): [True: 0, False: 0]
  |  Branch (1021:72): [True: 0, False: 0]
  |  Branch (1021:83): [True: 0, False: 0]
  ------------------
 1022|      0|                            {
 1023|      0|                                ul = 0;
 1024|      0|                            }
 1025|      0|                            else
 1026|      0|                            {
 1027|      0|                                ul = (unsigned long) ( t*1000.0 );
 1028|      0|                            }
 1029|      0|                            if ( /*q > pArg+k &&*/ !*q)
  ------------------
  |  Branch (1029:52): [True: 0, False: 0]
  ------------------
 1030|      0|                            {
 1031|      0|                                k = q - pArg - 1; /* k will be incremented by the for() cycle */
 1032|      0|                                switch (c)
  ------------------
  |  Branch (1032:41): [True: 0, False: 0]
  ------------------
 1033|      0|                                {
 1034|      0|                                    case 'D':
  ------------------
  |  Branch (1034:37): [True: 0, False: 0]
  ------------------
 1035|      0|                                        *ulDisplTime = ul;
 1036|      0|                                        break;
 1037|      0|                                    case 'W':
  ------------------
  |  Branch (1037:37): [True: 0, False: 0]
  ------------------
 1038|      0|                                        ip->msec_MaxTime = ul;
 1039|      0|                                        break;
 1040|      0|                                }
 1041|      0|                            }
 1042|      0|                            break;
 1043|      0|                        case 'F':
  ------------------
  |  Branch (1043:25): [True: 0, False: 0]
  ------------------
 1044|      0|                            c = (int) strtol( pArg + k + 1, (char**) &q, 10 ); /*  cast deliberately discards 'const' qualifier */
 1045|      0|                            if (q > pArg + k && !*q)
  ------------------
  |  Branch (1045:33): [True: 0, False: 0]
  |  Branch (1045:49): [True: 0, False: 0]
  ------------------
 1046|      0|                            {
 1047|      0|                                k = q - pArg - 1;
 1048|      0|                                if (abs( c ) > 5)
  ------------------
  |  Branch (1048:37): [True: 0, False: 0]
  ------------------
 1049|      0|                                {
 1050|      0|                                    nFontSize = -c;  /* font size 5 or less is too small */
 1051|      0|                                }
 1052|      0|                            }
 1053|      0|                            break;
 1054|      0|                        default:
  ------------------
  |  Branch (1054:25): [True: 0, False: 0]
  ------------------
 1055|      0|                            if (!pArg[k + 1])
  ------------------
  |  Branch (1055:33): [True: 0, False: 0]
  ------------------
 1056|      0|                            {
 1057|      0|                                switch (c)
 1058|      0|                                {
 1059|      0|                                    case 'B':
  ------------------
  |  Branch (1059:37): [True: 0, False: 0]
  ------------------
 1060|      0|                                        nMode |= REQ_MODE_BASIC;
  ------------------
  |  |   43|      0|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
 1061|      0|                                        nReleaseMode = 0;
 1062|       |                                        /*bNotRecognized = bReleaseVersion;*/
 1063|      0|                                        bStdFormat = 0;
 1064|      0|                                        break;
 1065|      0|                                    case 'T':
  ------------------
  |  Branch (1065:37): [True: 0, False: 0]
  ------------------
 1066|      0|                                        nMode |= REQ_MODE_TAUT;
  ------------------
  |  |   44|      0|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
 1067|      0|                                        nReleaseMode = 0;
 1068|       |                                        /*bNotRecognized = bReleaseVersion;*/
 1069|      0|                                        break;
 1070|      0|                                    case 'I':
  ------------------
  |  Branch (1070:37): [True: 0, False: 0]
  ------------------
 1071|      0|                                        nMode |= REQ_MODE_ISO;
  ------------------
  |  |   45|      0|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
 1072|      0|                                        nReleaseMode = 0;
 1073|       |                                        /*bNotRecognized = bReleaseVersion;*/
 1074|      0|                                        break;
 1075|      0|                                    case 'N':
  ------------------
  |  Branch (1075:37): [True: 0, False: 0]
  ------------------
 1076|      0|                                        nMode |= REQ_MODE_NON_ISO;
  ------------------
  |  |   46|      0|#define REQ_MODE_NON_ISO            0x000008    /* NI   */
  ------------------
 1077|      0|                                        nReleaseMode = 0;
 1078|      0|                                        bStdFormat = 0;
 1079|       |                                        /*bNotRecognized = bReleaseVersion;*/
 1080|      0|                                        break;
 1081|      0|                                    case 'S':
  ------------------
  |  Branch (1081:37): [True: 0, False: 0]
  ------------------
 1082|      0|                                        nMode |= REQ_MODE_STEREO;
  ------------------
  |  |   47|      0|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
 1083|      0|                                        nReleaseMode = 0;
 1084|       |                                        /*bNotRecognized = bReleaseVersion;*/
 1085|      0|                                        break;
 1086|      0|                                    case 'E':
  ------------------
  |  Branch (1086:37): [True: 0, False: 0]
  ------------------
 1087|      0|                                        if (nReleaseMode & REQ_MODE_STEREO)
  ------------------
  |  |   47|      0|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
  |  Branch (1087:45): [True: 0, False: 0]
  ------------------
 1088|      0|                                        {
 1089|      0|                                            nReleaseMode ^= REQ_MODE_STEREO;
  ------------------
  |  |   47|      0|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
 1090|      0|                                            bStdFormat = 0;
 1091|      0|                                        }
 1092|      0|                                        break;
 1093|       |
 1094|      0|#ifndef TARGET_LIB_FOR_WINCHI
 1095|      0|                                    default:
  ------------------
  |  Branch (1095:37): [True: 0, False: 0]
  ------------------
 1096|      0|                                        inchi_ios_eprint( log_file, "Unrecognized optionQ1: \"%c\".\n", c );
 1097|       |
 1098|      0|#endif
 1099|      0|                                }
 1100|      0|                            }
 1101|       |
 1102|       |
 1103|      0|#ifndef TARGET_LIB_FOR_WINCHI
 1104|      0|                            else
 1105|      0|                            {
 1106|      0|                                inchi_ios_eprint( log_file, "Unrecognized optionQ2: \"%c\".\n", c );
 1107|      0|                            }
 1108|      0|#endif
 1109|      0|                    }
 1110|       |                    /*
 1111|       |                        if ( bNotRecognized && bNotRecognized == bReleaseVersion ) {
 1112|       |                        inchi_ios_eprint(stderr, "Unrecognized option: \"%c\".\n", c);
 1113|       |                        bNotRecognized = 0;
 1114|       |                        }
 1115|       |                    */
 1116|      0|                }
 1117|      0|            }
 1118|       |
 1119|       |            /*
 1120|       |                if ( bNotRecognized && bNotRecognized == 2*bReleaseVersion )
 1121|       |                {
 1122|       |                inchi_ios_eprint(stderr, "Unrecognized option: \"%s\".\n", argv[i]);
 1123|       |                bNotRecognized = 0;
 1124|       |                }
 1125|       |            */
 1126|       |
 1127|      0|        } /* eof Parsing TARGET_LIB_FOR_WINCHI GUI options (and v. 0.9xx Beta as well)  */
 1128|       |
 1129|    576|        else if (( bVer1Options & 1 ) && INCHI_OPTION_PREFX == argv[i][0] && argv[i][1])
  ------------------
  |  |  255|    576|#define   INCHI_OPTION_PREFX  '-'
  ------------------
  |  Branch (1129:18): [True: 576, False: 0]
  |  Branch (1129:42): [True: 576, False: 0]
  |  Branch (1129:78): [True: 576, False: 0]
  ------------------
 1130|    576|        {
 1131|       |            /* Parsing stand-alone executable/libinchi options */
 1132|       |
 1133|    576|            pArg = argv[i] + 1;
 1134|       |
 1135|    576|            bRecognizedOption = 2;
 1136|    576|            bVer1Options += 2;
 1137|       |            /* always on: REQ_MODE_TAUT | REQ_MODE_ISO | REQ_MODE_STEREO */
 1138|       |
 1139|    576|            got = set_common_options_by_parg( pArg, developer_options, ip, &bVer1DefaultMode, &nMode,
 1140|    576|                                              &bINChIOutputOptions, &bINChIOutputOptions2,
 1141|    576|                                              &bStdFormat, &bHashKey, &bHashXtra1, &bHashXtra2,
 1142|    576|                                              &bFixSp3bug, &bFixFB2,
 1143|    576|                                              &bAddPhosphineStereo, &bAddArsineStereo,
 1144|    576|                                              &bNoStructLabels, &bPointedEdgeStereo,
 1145|    576|                                              &bDoNotAddH, &bForcedChiralFlag, &bReconnectCoord,
 1146|    576|                                              &bKetoEnolTaut, 
 1147|    576|                                              &b15TautNonRing, 
 1148|    576|                                              &bLooseTSACheck,
 1149|    576|                                              &bLargeMolecules, &bPolymers,
 1150|    576|                                              &bFoldPolymerSRU, &bFrameShiftScheme,
 1151|    576|                                              &bStereoAtZz, &bNPZz,
 1152|    576|                                              &bNoWarnings, &bMergeHash, &bHideInChI );
 1153|       |
 1154|    576|            if (got)
  ------------------
  |  Branch (1154:17): [True: 0, False: 576]
  ------------------
 1155|      0|            {
 1156|      0|                ;
 1157|      0|            }
 1158|       |            /* Input */
 1159|    576|            else if (!inchi_stricmp( pArg, "STDIO" ))
  ------------------
  |  Branch (1159:22): [True: 0, False: 576]
  ------------------
 1160|      0|            {
 1161|      0|                bNameSuffix = 0;
 1162|      0|            }
 1163|    576|            else if ( /* INPUT_NONE == ip->nInputType &&*/
 1164|    576|                !inchi_memicmp( pArg, "SDF:", 4 ))
  ------------------
  |  Branch (1164:17): [True: 0, False: 576]
  ------------------
 1165|      0|            {
 1166|       |                /* SDfile label */
 1167|      0|                k = 0;
 1168|      0|                mystrncpy( ip->szSdfDataHeader, pArg + 4, MAX_SDF_HEADER + 1 );
  ------------------
  |  |   45|      0|#define MAX_SDF_HEADER        64 /* max length of the SDFile data header */
  ------------------
 1169|      0|                lrtrim( ip->szSdfDataHeader, &k );
 1170|      0|                if (k)
  ------------------
  |  Branch (1170:21): [True: 0, False: 0]
  ------------------
 1171|      0|                {
 1172|      0|                    ip->pSdfLabel = ip->szSdfDataHeader;
 1173|      0|                    ip->pSdfValue = szSdfDataValue;
 1174|      0|                    if (INPUT_NONE == ip->nInputType)
  ------------------
  |  Branch (1174:25): [True: 0, False: 0]
  ------------------
 1175|      0|                    {
 1176|      0|                        ip->nInputType = INPUT_SDFILE;
 1177|      0|                    }
 1178|      0|                }
 1179|      0|                else
 1180|      0|                {
 1181|      0|                    ip->pSdfLabel = NULL;
 1182|      0|                    ip->pSdfValue = NULL;
 1183|      0|                    if (INPUT_NONE == ip->nInputType)
  ------------------
  |  Branch (1183:25): [True: 0, False: 0]
  ------------------
 1184|      0|                    {
 1185|      0|                        ip->nInputType = INPUT_MOLFILE;
 1186|      0|                    }
 1187|      0|                }
 1188|      0|            }
 1189|       |
 1190|    576|            else if (!inchi_memicmp( pArg, "RSB:", 4 ) && developer_options)
  ------------------
  |  Branch (1190:22): [True: 0, False: 576]
  |  Branch (1190:59): [Folded - Ignored]
  ------------------
 1191|      0|            {
 1192|      0|                mdbr = (int) strtol( pArg + 4, NULL, 10 );
 1193|      0|            }
 1194|       |
 1195|       |            /* Output */
 1196|       |#if ( !defined(TARGET_API_LIB) && !defined(TARGET_LIB_FOR_WINCHI) )
 1197|       |            else if (!inchi_stricmp( pArg, "Tabbed" ) || !inchi_stricmp( pArg, "Tab" ))
 1198|       |            {
 1199|       |                bOutputStyle |= INCHI_OUT_TABBED_OUTPUT;
 1200|       |            }
 1201|       |#endif
 1202|    576|            else if (!inchi_stricmp( pArg, "OUTPUTSDF" ))
  ------------------
  |  Branch (1202:22): [True: 0, False: 576]
  ------------------
 1203|      0|            {
 1204|       |                /* output SDfile */
 1205|      0|                bOutputMolfileOnly = 1;
 1206|      0|            }
 1207|    576|            else if (!inchi_stricmp( pArg, "SdfAtomsDT" ))
  ------------------
  |  Branch (1207:22): [True: 0, False: 576]
  ------------------
 1208|      0|            {
 1209|       |                /* output isotopes H as D and T in SDfile */
 1210|      0|                bOutputMolfileDT = 1;
 1211|      0|            }
 1212|    576|            else if (!inchi_stricmp( pArg, "D" ))
  ------------------
  |  Branch (1212:22): [True: 0, False: 576]
  ------------------
 1213|      0|            {
 1214|       |                /* display the structures */
 1215|      0|                bDisplay |= 1;
 1216|      0|            }
 1217|    576|            else if (!inchi_memicmp( pArg, "F", 1 ) && ( c = (int) strtol( pArg + 1, (char**) &q, 10 ), q > pArg + 1 ))
  ------------------
  |  Branch (1217:22): [True: 0, False: 576]
  |  Branch (1217:56): [True: 0, False: 0]
  ------------------
 1218|      0|            {
 1219|      0|                nFontSize = -c;                      /* struct. display font size */
 1220|      0|            }
 1221|    576|            else if (!inchi_stricmp( pArg, "EQU" ))
  ------------------
  |  Branch (1221:22): [True: 0, False: 576]
  ------------------
 1222|      0|            {
 1223|      0|                bCompareComponents = CMP_COMPONENTS;
  ------------------
  |  |   82|      0|#define CMP_COMPONENTS              0x0001     /* perform compare components */
  ------------------
 1224|      0|            }
 1225|       |#if( OUTPUT_FILE_EXT == 1 )
 1226|       |            else if (pArg[0] == '.' && numOutNameExt < (int) ( sizeof( szOutNameExt ) / sizeof( szOutNameExt[0] ) ))
 1227|       |            {
 1228|       |                strncpy( szOutNameExt[numOutNameExt], pArg, sizeof( szOutNameExt[0] ) - 1 );
 1229|       |                numOutNameExt++;
 1230|       |                if (ip->path[numOutNameExt])
 1231|       |                {
 1232|       |                    ip->path[numOutNameExt] = ""; /*strcpy( ip->path[numOutNameExt], "");*/
 1233|       |                }
 1234|       |            }
 1235|       |#endif
 1236|       |            /* Generation options */
 1237|    576|            else if (!inchi_memicmp( pArg, "W", 1 ))
  ------------------
  |  Branch (1237:22): [True: 0, False: 576]
  ------------------
 1238|      0|            {
 1239|      0|                long timeout_value;
 1240|      0|                const char c1 = *( pArg + 1 );
 1241|      0|                if (c1 && ( c1 == 'M' || c1 == 'm' ))
  ------------------
  |  Branch (1241:21): [True: 0, False: 0]
  |  Branch (1241:29): [True: 0, False: 0]
  |  Branch (1241:42): [True: 0, False: 0]
  ------------------
 1242|      0|                {
 1243|       |                    /* "WMnumber", milliseconds */
 1244|      0|                    timeout_value = strtol( pArg + 2, (char**) &q, 10 );
 1245|      0|                    if (timeout_value  && q > pArg + 2 && *q == '\0')
  ------------------
  |  Branch (1245:25): [True: 0, False: 0]
  |  Branch (1245:43): [True: 0, False: 0]
  |  Branch (1245:59): [True: 0, False: 0]
  ------------------
 1246|      0|                    {
 1247|      0|                        if (errno == ERANGE || timeout_value < 0.0 || timeout_value>LONG_MAX)
  ------------------
  |  Branch (1247:29): [True: 0, False: 0]
  |  Branch (1247:48): [True: 0, False: 0]
  |  Branch (1247:71): [True: 0, False: 0]
  ------------------
 1248|      0|                        {
 1249|      0|                            timeout_value = 0;
 1250|      0|                            timeout_set_warning = 1;
 1251|      0|                        }
 1252|      0|                        timeout_set_error = 0;
 1253|      0|                    }
 1254|      0|                    else
 1255|      0|                    {
 1256|      0|                        timeout_set_error = 1;
 1257|      0|                    }
 1258|      0|                }
 1259|      0|                else
 1260|      0|                {
 1261|       |                    /* expect "Wnumber", seconds */
 1262|      0|                    t = strtod( pArg + 1, (char**) &q );
 1263|      0|                    if (t && q > pArg + 1)
  ------------------
  |  Branch (1263:25): [True: 0, False: 0]
  |  Branch (1263:30): [True: 0, False: 0]
  ------------------
 1264|      0|                    {
 1265|      0|                        if (*q != '\0')
  ------------------
  |  Branch (1265:29): [True: 0, False: 0]
  ------------------
 1266|      0|                        {
 1267|      0|                            timeout_set_warning = 1;
 1268|      0|                        }
 1269|      0|                        if (errno == ERANGE || t < 0.0 || t*1000.0 >( double )LONG_MAX)
  ------------------
  |  Branch (1269:29): [True: 0, False: 0]
  |  Branch (1269:48): [True: 0, False: 0]
  |  Branch (1269:59): [True: 0, False: 0]
  ------------------
 1270|      0|                        {
 1271|      0|                            timeout_value = 0;
 1272|      0|                            timeout_set_warning = 1;
 1273|      0|                        }
 1274|      0|                        else
 1275|      0|                        {
 1276|      0|                            timeout_value = (long) ( t*1000.0 );  /* max. time per structure */
 1277|      0|                        }
 1278|      0|                        timeout_set_error = 0;
 1279|      0|                    }
 1280|      0|                    else
 1281|      0|                    {
 1282|      0|                        timeout_set_error = 1;
 1283|      0|                    }
 1284|      0|                }
 1285|      0|                if (timeout_set_error == 0)
  ------------------
  |  Branch (1285:21): [True: 0, False: 0]
  ------------------
 1286|      0|                {
 1287|      0|                    ip->msec_MaxTime = timeout_value;
 1288|      0|                }
 1289|      0|            }
 1290|       |
 1291|    576|            else if (!inchi_stricmp( pArg, "WarnOnEmptyStructure" ))
  ------------------
  |  Branch (1291:22): [True: 0, False: 576]
  ------------------
 1292|      0|            {
 1293|      0|                ip->bAllowEmptyStructure = 1;
 1294|      0|            }
 1295|       |            /*--- Conversion modes ---*/
 1296|    576|#if ( READ_INCHI_STRING == 1 )
 1297|       |
 1298|       |/*#if (BUILD_WITH_ENG_OPTIONS==1)*/
 1299|    576|            else if (!inchi_stricmp( pArg, "InChI2InChI" ))
  ------------------
  |  Branch (1299:22): [True: 288, False: 288]
  ------------------
 1300|    288|            {
 1301|       |                /* Read InChI Identifiers and output InChI Identifiers */
 1302|    288|                ip->nInputType = INPUT_INCHI;
 1303|    288|                ip->bReadInChIOptions |= READ_INCHI_OUTPUT_INCHI;
  ------------------
  |  |  985|    288|#define READ_INCHI_OUTPUT_INCHI          0x00000001
  ------------------
 1304|    288|                ip->bReadInChIOptions &= ~READ_INCHI_TO_STRUCTURE;
  ------------------
  |  |  988|    288|#define READ_INCHI_TO_STRUCTURE          0x00000008
  ------------------
 1305|    288|            }
 1306|       |/*#endif*/
 1307|       |
 1308|    288|            else if (!inchi_stricmp( pArg, "InChI2Struct" ))
  ------------------
  |  Branch (1308:22): [True: 288, False: 0]
  ------------------
 1309|    288|            {
 1310|       |                /* Split InChI Identifiers into components */
 1311|    288|                ip->bReadInChIOptions |= READ_INCHI_TO_STRUCTURE;
  ------------------
  |  |  988|    288|#define READ_INCHI_TO_STRUCTURE          0x00000008
  ------------------
 1312|    288|                ip->bReadInChIOptions &= ~READ_INCHI_OUTPUT_INCHI;
  ------------------
  |  |  985|    288|#define READ_INCHI_OUTPUT_INCHI          0x00000001
  ------------------
 1313|    288|                ip->nInputType = INPUT_INCHI;
 1314|    288|            }
 1315|       |
 1316|      0|            else if (!inchi_stricmp( pArg, "KeepBalanceP" ) && developer_options)
  ------------------
  |  Branch (1316:22): [True: 0, False: 0]
  |  Branch (1316:64): [Folded - Ignored]
  ------------------
 1317|      0|            {
 1318|       |                /* When spliting InChI Identifiers into components: */
 1319|       |                /* If MobileH output then add p to each component;  */
 1320|       |                /* Otherwise add one more component containing balance */
 1321|       |                /* of protons and exchangeable isotopic H */
 1322|      0|                ip->bReadInChIOptions |= READ_INCHI_KEEP_BALANCE_P;
  ------------------
  |  |  987|      0|#define READ_INCHI_KEEP_BALANCE_P        0x00000004
  ------------------
 1323|      0|                bStdFormat = 0;
 1324|      0|            }
 1325|      0|#endif
 1326|       |
 1327|       |            /*--- (engineering) Undo bug/draw fixes options ---*/
 1328|       |
 1329|       |            /* (developer_options) Old structure-perception and InChI creation options */
 1330|       |#if ( FIX_ADJ_RAD == 1 )
 1331|       |            else if (!inchi_stricmp( pArg, "FixRad" ) && developer_options)
 1332|       |            {
 1333|       |                bFixAdjacentRad = 1;
 1334|       |                bStdFormat = 0;
 1335|       |            }
 1336|       |#endif
 1337|       |#if ( UNDERIVATIZE == 1 )
 1338|       |            else if (!inchi_stricmp( pArg, "DoDRV" ) && developer_options)
 1339|       |            {
 1340|       |                ip->bUnderivatize = 1;
 1341|       |                bStdFormat = 0;
 1342|       |            }
 1343|       |#if( UNDERIVATIZE_REPORT == 1 )
 1344|       |            else if (!inchi_stricmp( pArg, "DoDrvReport" ))
 1345|       |            {
 1346|       |                ip->bUnderivatize = 3;
 1347|       |                bStdFormat = 0;
 1348|       |            }
 1349|       |#endif
 1350|       |#endif
 1351|       |#if ( RING2CHAIN == 1 )
 1352|       |            else if (!inchi_stricmp( pArg, "DoR2C" ) && developer_options)
 1353|       |            {
 1354|       |                ip->bRing2Chain = 1;
 1355|       |                bStdFormat = 0;
 1356|       |            }
 1357|       |#endif
 1358|       |#if ( RING2CHAIN == 1 || UNDERIVATIZE == 1 )
 1359|       |            else if (!inchi_stricmp( pArg, "DoneOnly" ) && developer_options)
 1360|       |            {
 1361|       |                ip->bIgnoreUnchanged = 1;
 1362|       |                bStdFormat = 0;
 1363|       |            }
 1364|       |#endif
 1365|      0|            else if (!inchi_memicmp( pArg, "MOVEPOS:", 8 ) && developer_options)
  ------------------
  |  Branch (1365:22): [True: 0, False: 0]
  |  Branch (1365:63): [Folded - Ignored]
  ------------------
 1366|      0|            {
 1367|      0|                bMovePositiveCharges = ( 0 != strtol( pArg + 8, NULL, 10 ) );
 1368|      0|                bStdFormat = 0;
 1369|      0|            }
 1370|       |
 1371|      0|            else if (!inchi_stricmp( pArg, "NoADP" ) && developer_options)
  ------------------
  |  Branch (1371:22): [True: 0, False: 0]
  |  Branch (1371:57): [Folded - Ignored]
  ------------------
 1372|      0|            {
 1373|      0|                bTgFlagHardAddRenProtons = 0;
 1374|      0|                bStdFormat = 0;
 1375|      0|            }
 1376|       |            /* Tautomer perception off */
 1377|      0|            else if (!inchi_stricmp( pArg, "EXACT" ) && developer_options)
  ------------------
  |  Branch (1377:22): [True: 0, False: 0]
  |  Branch (1377:57): [Folded - Ignored]
  ------------------
 1378|      0|            {
 1379|      0|                bVer1DefaultMode |= REQ_MODE_BASIC;
  ------------------
  |  |   43|      0|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
 1380|      0|                bStdFormat = 0;
 1381|      0|            }
 1382|      0|            else if (!inchi_stricmp( pArg, "ONLYRECSALT" ) && developer_options)
  ------------------
  |  Branch (1382:22): [True: 0, False: 0]
  |  Branch (1382:63): [Folded - Ignored]
  ------------------
 1383|      0|            {
 1384|       |                /* do not disconnect salts */
 1385|      0|                bDisconnectSalts = 0;
 1386|      0|                bStdFormat = 0;
 1387|      0|            }
 1388|      0|            else if ( (!inchi_stricmp( pArg, "ONLYEXACT" ) || !inchi_stricmp( pArg, "ONLYFIXEDH") ) && developer_options )
  ------------------
  |  Branch (1388:24): [True: 0, False: 0]
  |  Branch (1388:63): [True: 0, False: 0]
  |  Branch (1388:104): [Folded - Ignored]
  ------------------
 1389|      0|            {
 1390|      0|                bVer1DefaultMode |= REQ_MODE_BASIC;
  ------------------
  |  |   43|      0|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
 1391|      0|                bVer1DefaultMode &= ~REQ_MODE_TAUT;
  ------------------
  |  |   44|      0|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
 1392|      0|                bStdFormat = 0;
 1393|      0|            }
 1394|      0|            else if (!inchi_stricmp( pArg, "ONLYNONISO" ) && developer_options)
  ------------------
  |  Branch (1394:22): [True: 0, False: 0]
  |  Branch (1394:62): [Folded - Ignored]
  ------------------
 1395|      0|            {
 1396|      0|                bVer1DefaultMode |= REQ_MODE_NON_ISO;
  ------------------
  |  |   46|      0|#define REQ_MODE_NON_ISO            0x000008    /* NI   */
  ------------------
 1397|      0|                bVer1DefaultMode &= ~REQ_MODE_ISO;
  ------------------
  |  |   45|      0|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
 1398|      0|                bStdFormat = 0;
 1399|      0|            }
 1400|      0|            else if (!inchi_stricmp( pArg, "TAUT" ) && developer_options)
  ------------------
  |  Branch (1400:22): [True: 0, False: 0]
  |  Branch (1400:56): [Folded - Ignored]
  ------------------
 1401|      0|            {
 1402|      0|                bVer1DefaultMode &= ~REQ_MODE_BASIC;
  ------------------
  |  |   43|      0|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
 1403|      0|                bVer1DefaultMode |= REQ_MODE_TAUT;
  ------------------
  |  |   44|      0|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
 1404|      0|            }
 1405|      0|            else if (!inchi_stricmp( pArg, "ONLYRECMET" ) && developer_options)
  ------------------
  |  Branch (1405:22): [True: 0, False: 0]
  |  Branch (1405:62): [Folded - Ignored]
  ------------------
 1406|      0|            {
 1407|       |                /* do not disconnect metals */
 1408|      0|                bDisconnectCoord = 0;
 1409|      0|                bStdFormat = 0;
 1410|      0|            }
 1411|       |
 1412|       |            /*--- (hidden) Old output and other options ---*/
 1413|       |
 1414|      0|            else if (!inchi_stricmp( pArg, "SdfSplit" ) && developer_options)
  ------------------
  |  Branch (1414:22): [True: 0, False: 0]
  |  Branch (1414:60): [Folded - Ignored]
  ------------------
 1415|      0|            {
 1416|       |                /* Split single Molfiles into disconnected components */
 1417|      0|                bOutputMolfileSplit = 1;
 1418|      0|            }
 1419|      0|            else if (!inchi_stricmp( pArg, "DCR" ) && developer_options)
  ------------------
  |  Branch (1419:22): [True: 0, False: 0]
  |  Branch (1419:55): [Folded - Ignored]
  ------------------
 1420|      0|            {
 1421|      0|                bDisplayCompositeResults = 1;
 1422|      0|            }
 1423|      0|            else if ( (!inchi_stricmp( pArg, "AUXFULL" ) || !inchi_stricmp( pArg, "AUXMAX" )) && developer_options )
  ------------------
  |  Branch (1423:24): [True: 0, False: 0]
  |  Branch (1423:61): [True: 0, False: 0]
  |  Branch (1423:98): [Folded - Ignored]
  ------------------
 1424|      0|            {
 1425|       |                /* full aux info */
 1426|      0|                bINChIOutputOptions &= ~( INCHI_OUT_NO_AUX_INFO | INCHI_OUT_SHORT_AUX_INFO ); /* include short aux info */
  ------------------
  |  |  157|      0|#define INCHI_OUT_NO_AUX_INFO           0x0001   /* do not output Aux Info                  */
  ------------------
                              bINChIOutputOptions &= ~( INCHI_OUT_NO_AUX_INFO | INCHI_OUT_SHORT_AUX_INFO ); /* include short aux info */
  ------------------
  |  |  158|      0|#define INCHI_OUT_SHORT_AUX_INFO        0x0002   /* output short version of Aux Info        */
  ------------------
 1427|      0|            }
 1428|      0|            else if (!inchi_stricmp( pArg, "AUXMIN" ) && developer_options)
  ------------------
  |  Branch (1428:22): [True: 0, False: 0]
  |  Branch (1428:58): [Folded - Ignored]
  ------------------
 1429|      0|            {
 1430|       |                /* minimal aux info */
 1431|      0|                bINChIOutputOptions &= ~INCHI_OUT_NO_AUX_INFO; /* include short aux info */
  ------------------
  |  |  157|      0|#define INCHI_OUT_NO_AUX_INFO           0x0001   /* do not output Aux Info                  */
  ------------------
 1432|      0|                bINChIOutputOptions |= INCHI_OUT_SHORT_AUX_INFO;
  ------------------
  |  |  158|      0|#define INCHI_OUT_SHORT_AUX_INFO        0x0002   /* output short version of Aux Info        */
  ------------------
 1433|      0|            }
 1434|       |
 1435|      0|#if ( READ_INCHI_STRING == 1 )
 1436|      0|            else if (!inchi_stricmp( pArg, "DDSRC" ) && developer_options)
  ------------------
  |  Branch (1436:22): [True: 0, False: 0]
  |  Branch (1436:57): [Folded - Ignored]
  ------------------
 1437|      0|            {
 1438|      0|                bDisplayIfRestoreWarnings = 1;  /* InChI->Structure debugging: Display Debug Structure Restore Components */
 1439|      0|            }
 1440|      0|#endif
 1441|       |
 1442|      0|            else if (!inchi_stricmp( pArg, "NoVarH" ) && developer_options)
  ------------------
  |  Branch (1442:22): [True: 0, False: 0]
  |  Branch (1442:58): [Folded - Ignored]
  ------------------
 1443|      0|            {
 1444|      0|                bTgFlagVariableProtons = 0;
 1445|      0|            }
 1446|      0|            else if (!inchi_stricmp( pArg, "FULL" ) && developer_options)
  ------------------
  |  Branch (1446:22): [True: 0, False: 0]
  |  Branch (1446:56): [Folded - Ignored]
  ------------------
 1447|      0|            {
 1448|      0|                bVer1DefaultMode = VER103_DEFAULT_MODE;
  ------------------
  |  |   66|      0|#define VER103_DEFAULT_MODE    (REQ_MODE_TAUT | REQ_MODE_ISO | REQ_MODE_STEREO |\
  |  |  ------------------
  |  |  |  |   44|      0|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  |  |  ------------------
  |  |               #define VER103_DEFAULT_MODE    (REQ_MODE_TAUT | REQ_MODE_ISO | REQ_MODE_STEREO |\
  |  |  ------------------
  |  |  |  |   45|      0|#define REQ_MODE_ISO                0x000004    /* I    */
  |  |  ------------------
  |  |               #define VER103_DEFAULT_MODE    (REQ_MODE_TAUT | REQ_MODE_ISO | REQ_MODE_STEREO |\
  |  |  ------------------
  |  |  |  |   47|      0|#define REQ_MODE_STEREO             0x000010    /* S    */
  |  |  ------------------
  |  |   67|      0|                                REQ_MODE_SB_IGN_ALL_UU | REQ_MODE_SC_IGN_ALL_UU)
  |  |  ------------------
  |  |  |  |   60|      0|#define REQ_MODE_SB_IGN_ALL_UU      0x001000    /* IAUSC Ignore stereobonds if All Undef/Unknown */
  |  |  ------------------
  |  |                                               REQ_MODE_SB_IGN_ALL_UU | REQ_MODE_SC_IGN_ALL_UU)
  |  |  ------------------
  |  |  |  |   58|      0|#define REQ_MODE_SC_IGN_ALL_UU      0x000800    /* IAUSC Ignore stereocenters if All Undef/Unknown */
  |  |  ------------------
  ------------------
 1449|      0|                nMode = 0;
 1450|      0|                bReconnectCoord = 1;            /* full output */
 1451|      0|                bINChIOutputOptions = ( ( EMBED_REC_METALS_INCHI == 1 ) ? INCHI_OUT_EMBED_REC : 0 ) | INCHI_OUT_SHORT_AUX_INFO;
  ------------------
  |  |  565|      0|#define EMBED_REC_METALS_INCHI      1  /* 1=> (default) output Reconnected embedded in Disconnected INChI;
  ------------------
                              bINChIOutputOptions = ( ( EMBED_REC_METALS_INCHI == 1 ) ? INCHI_OUT_EMBED_REC : 0 ) | INCHI_OUT_SHORT_AUX_INFO;
  ------------------
  |  |  160|      0|#define INCHI_OUT_EMBED_REC             0x0008   /* embed reconnected INChI into disconnected INChI */
  ------------------
                              bINChIOutputOptions = ( ( EMBED_REC_METALS_INCHI == 1 ) ? INCHI_OUT_EMBED_REC : 0 ) | INCHI_OUT_SHORT_AUX_INFO;
  ------------------
  |  |  158|      0|#define INCHI_OUT_SHORT_AUX_INFO        0x0002   /* output short version of Aux Info        */
  ------------------
  |  Branch (1451:41): [Folded - Ignored]
  ------------------
 1452|      0|                ip->bCtPredecessors = 0;
 1453|      0|                ip->bAbcNumbers = 0;
 1454|      0|                bOutputStyle |= INCHI_OUT_PLAIN_TEXT | INCHI_OUT_PLAIN_TEXT_COMMENTS;
  ------------------
  |  |  163|      0|#define INCHI_OUT_PLAIN_TEXT            0x0040   /* output plain text INChI                 */
  ------------------
                              bOutputStyle |= INCHI_OUT_PLAIN_TEXT | INCHI_OUT_PLAIN_TEXT_COMMENTS;
  ------------------
  |  |  164|      0|#define INCHI_OUT_PLAIN_TEXT_COMMENTS   0x0080   /* output plain text annotation            */
  ------------------
 1455|      0|            }
 1456|      0|            else if (!inchi_stricmp( pArg, "MIN" ) && developer_options)
  ------------------
  |  Branch (1456:22): [True: 0, False: 0]
  |  Branch (1456:55): [Folded - Ignored]
  ------------------
 1457|      0|            {
 1458|      0|                bVer1DefaultMode = VER103_DEFAULT_MODE;
  ------------------
  |  |   66|      0|#define VER103_DEFAULT_MODE    (REQ_MODE_TAUT | REQ_MODE_ISO | REQ_MODE_STEREO |\
  |  |  ------------------
  |  |  |  |   44|      0|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  |  |  ------------------
  |  |               #define VER103_DEFAULT_MODE    (REQ_MODE_TAUT | REQ_MODE_ISO | REQ_MODE_STEREO |\
  |  |  ------------------
  |  |  |  |   45|      0|#define REQ_MODE_ISO                0x000004    /* I    */
  |  |  ------------------
  |  |               #define VER103_DEFAULT_MODE    (REQ_MODE_TAUT | REQ_MODE_ISO | REQ_MODE_STEREO |\
  |  |  ------------------
  |  |  |  |   47|      0|#define REQ_MODE_STEREO             0x000010    /* S    */
  |  |  ------------------
  |  |   67|      0|                                REQ_MODE_SB_IGN_ALL_UU | REQ_MODE_SC_IGN_ALL_UU)
  |  |  ------------------
  |  |  |  |   60|      0|#define REQ_MODE_SB_IGN_ALL_UU      0x001000    /* IAUSC Ignore stereobonds if All Undef/Unknown */
  |  |  ------------------
  |  |                                               REQ_MODE_SB_IGN_ALL_UU | REQ_MODE_SC_IGN_ALL_UU)
  |  |  ------------------
  |  |  |  |   58|      0|#define REQ_MODE_SC_IGN_ALL_UU      0x000800    /* IAUSC Ignore stereocenters if All Undef/Unknown */
  |  |  ------------------
  ------------------
 1459|      0|                nMode = 0;
 1460|      0|                bReconnectCoord = 1;            /* minimal output */
 1461|      0|                bINChIOutputOptions = ( ( EMBED_REC_METALS_INCHI == 1 ) ? INCHI_OUT_EMBED_REC : 0 ) | INCHI_OUT_NO_AUX_INFO;            /* minimal compressed output */
  ------------------
  |  |  565|      0|#define EMBED_REC_METALS_INCHI      1  /* 1=> (default) output Reconnected embedded in Disconnected INChI;
  ------------------
                              bINChIOutputOptions = ( ( EMBED_REC_METALS_INCHI == 1 ) ? INCHI_OUT_EMBED_REC : 0 ) | INCHI_OUT_NO_AUX_INFO;            /* minimal compressed output */
  ------------------
  |  |  160|      0|#define INCHI_OUT_EMBED_REC             0x0008   /* embed reconnected INChI into disconnected INChI */
  ------------------
                              bINChIOutputOptions = ( ( EMBED_REC_METALS_INCHI == 1 ) ? INCHI_OUT_EMBED_REC : 0 ) | INCHI_OUT_NO_AUX_INFO;            /* minimal compressed output */
  ------------------
  |  |  157|      0|#define INCHI_OUT_NO_AUX_INFO           0x0001   /* do not output Aux Info                  */
  ------------------
  |  Branch (1461:41): [Folded - Ignored]
  ------------------
 1462|      0|                ip->bCtPredecessors = 1;
 1463|      0|                ip->bAbcNumbers = 1;
 1464|      0|                bOutputStyle |= INCHI_OUT_PLAIN_TEXT | INCHI_OUT_PLAIN_TEXT_COMMENTS;
  ------------------
  |  |  163|      0|#define INCHI_OUT_PLAIN_TEXT            0x0040   /* output plain text INChI                 */
  ------------------
                              bOutputStyle |= INCHI_OUT_PLAIN_TEXT | INCHI_OUT_PLAIN_TEXT_COMMENTS;
  ------------------
  |  |  164|      0|#define INCHI_OUT_PLAIN_TEXT_COMMENTS   0x0080   /* output plain text annotation            */
  ------------------
 1465|      0|            }
 1466|      0|            else if (!inchi_stricmp( pArg, "COMPRESS" ) && developer_options)
  ------------------
  |  Branch (1466:22): [True: 0, False: 0]
  |  Branch (1466:60): [Folded - Ignored]
  ------------------
 1467|      0|            {
 1468|      0|                ip->bAbcNumbers = 1;
 1469|      0|                ip->bCtPredecessors = 1;             /* compressed output */
 1470|      0|            }
 1471|       |
 1472|      0|#if ( READ_INCHI_STRING == 1 )
 1473|      0|            else if (!inchi_stricmp( pArg, "InChI2InChI" ) ) /*&& developer_options)*/
  ------------------
  |  Branch (1473:22): [True: 0, False: 0]
  ------------------
 1474|      0|            {
 1475|       |                /* Read InChI Identifiers and output InChI Identifiers */
 1476|      0|                ip->nInputType = INPUT_INCHI;
 1477|      0|                ip->bReadInChIOptions |= READ_INCHI_OUTPUT_INCHI;
  ------------------
  |  |  985|      0|#define READ_INCHI_OUTPUT_INCHI          0x00000001
  ------------------
 1478|      0|                ip->bReadInChIOptions &= ~READ_INCHI_TO_STRUCTURE;
  ------------------
  |  |  988|      0|#define READ_INCHI_TO_STRUCTURE          0x00000008
  ------------------
 1479|      0|            }
 1480|       |
 1481|      0|            else if (!inchi_stricmp( pArg, "SplitInChI" ) && developer_options)
  ------------------
  |  Branch (1481:22): [True: 0, False: 0]
  |  Branch (1481:62): [Folded - Ignored]
  ------------------
 1482|      0|            {
 1483|       |                /* Split InChI Identifiers into components */
 1484|      0|                ip->bReadInChIOptions |= READ_INCHI_SPLIT_OUTPUT;
  ------------------
  |  |  986|      0|#define READ_INCHI_SPLIT_OUTPUT          0x00000002
  ------------------
 1485|      0|            }
 1486|      0|#endif
 1487|       |
 1488|      0|            else if (!inchi_stricmp( pArg, "MOLFILENUMBER" ) && developer_options)
  ------------------
  |  Branch (1488:22): [True: 0, False: 0]
  |  Branch (1488:65): [Folded - Ignored]
  ------------------
 1489|      0|            {
 1490|      0|                ip->bGetMolfileNumber |= 1;
 1491|      0|            }
 1492|      0|            else if (!inchi_stricmp( pArg, "OutputPLAIN" ) && developer_options)
  ------------------
  |  Branch (1492:22): [True: 0, False: 0]
  |  Branch (1492:63): [Folded - Ignored]
  ------------------
 1493|      0|            {
 1494|      0|                bOutputStyle |= INCHI_OUT_PLAIN_TEXT;
  ------------------
  |  |  163|      0|#define INCHI_OUT_PLAIN_TEXT            0x0040   /* output plain text INChI                 */
  ------------------
 1495|      0|            }
 1496|      0|            else if (!inchi_stricmp( pArg, "OutputANNPLAIN" ) && developer_options)
  ------------------
  |  Branch (1496:22): [True: 0, False: 0]
  |  Branch (1496:66): [Folded - Ignored]
  ------------------
 1497|      0|            {
 1498|      0|                bOutputStyle |= INCHI_OUT_PLAIN_TEXT_COMMENTS;
  ------------------
  |  |  164|      0|#define INCHI_OUT_PLAIN_TEXT_COMMENTS   0x0080   /* output plain text annotation            */
  ------------------
 1499|      0|                bOutputStyle |= INCHI_OUT_WINCHI_WINDOW; /* debug */
  ------------------
  |  |  166|      0|#define INCHI_OUT_WINCHI_WINDOW         0x0200   /* output into wINChI text window          */
  ------------------
 1500|      0|            }
 1501|      0|            else if ( (!inchi_stricmp( pArg, "ONLYEXACT" ) || !inchi_stricmp( pArg, "ONLYFIXEDH" )) && developer_options )
  ------------------
  |  Branch (1501:24): [True: 0, False: 0]
  |  Branch (1501:63): [True: 0, False: 0]
  |  Branch (1501:104): [Folded - Ignored]
  ------------------
 1502|      0|            {
 1503|      0|                bVer1DefaultMode |= REQ_MODE_BASIC;
  ------------------
  |  |   43|      0|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
 1504|      0|                bVer1DefaultMode &= ~REQ_MODE_TAUT;
  ------------------
  |  |   44|      0|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
 1505|      0|            }
 1506|      0|            else if (!inchi_stricmp( pArg, "ONLYNONISO" ) && developer_options)
  ------------------
  |  Branch (1506:22): [True: 0, False: 0]
  |  Branch (1506:62): [Folded - Ignored]
  ------------------
 1507|      0|            {
 1508|      0|                bVer1DefaultMode |= REQ_MODE_NON_ISO;
  ------------------
  |  |   46|      0|#define REQ_MODE_NON_ISO            0x000008    /* NI   */
  ------------------
 1509|      0|                bVer1DefaultMode &= ~REQ_MODE_ISO;
  ------------------
  |  |   45|      0|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
 1510|      0|            }
 1511|      0|            else if (!inchi_stricmp( pArg, "TAUT" ) && developer_options)
  ------------------
  |  Branch (1511:22): [True: 0, False: 0]
  |  Branch (1511:56): [Folded - Ignored]
  ------------------
 1512|      0|            {
 1513|      0|                bVer1DefaultMode &= ~REQ_MODE_BASIC;
  ------------------
  |  |   43|      0|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
 1514|      0|                bVer1DefaultMode |= REQ_MODE_TAUT;
  ------------------
  |  |   44|      0|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
 1515|      0|            }
 1516|      0|            else if (!inchi_stricmp( pArg, "ONLYRECMET" ) && developer_options)
  ------------------
  |  Branch (1516:22): [True: 0, False: 0]
  |  Branch (1516:62): [Folded - Ignored]
  ------------------
 1517|      0|            {  /* do not disconnect metals */
 1518|      0|                bDisconnectCoord = 0;
 1519|      0|            }
 1520|      0|            else if (!inchi_stricmp( pArg, "ONLYRECSALT" ) && developer_options)
  ------------------
  |  Branch (1520:22): [True: 0, False: 0]
  |  Branch (1520:63): [Folded - Ignored]
  ------------------
 1521|      0|            {  /* do not disconnect salts */
 1522|      0|                bDisconnectSalts = 0;
 1523|      0|            }
 1524|      0|            else if (!inchi_memicmp( pArg, "MOVEPOS:", 8 ) && developer_options)
  ------------------
  |  Branch (1524:22): [True: 0, False: 0]
  |  Branch (1524:63): [Folded - Ignored]
  ------------------
 1525|      0|            {   /* added -- 2010-03-01 DT */
 1526|      0|                bMovePositiveCharges = ( 0 != strtol( pArg + 8, NULL, 10 ) );
 1527|      0|            }
 1528|      0|            else if (!inchi_memicmp( pArg, "RSB:", 4 ) && developer_options)
  ------------------
  |  Branch (1528:22): [True: 0, False: 0]
  |  Branch (1528:59): [Folded - Ignored]
  ------------------
 1529|      0|            {
 1530|      0|                mdbr = (int) strtol( pArg + 4, NULL, 10 );
 1531|      0|            }
 1532|      0|            else if (!inchi_stricmp( pArg, "EQU" ) && developer_options)
  ------------------
  |  Branch (1532:22): [True: 0, False: 0]
  |  Branch (1532:55): [Folded - Ignored]
  ------------------
 1533|      0|            {
 1534|      0|                bCompareComponents = CMP_COMPONENTS;
  ------------------
  |  |   82|      0|#define CMP_COMPONENTS              0x0001     /* perform compare components */
  ------------------
 1535|      0|            }
 1536|      0|            else if (!inchi_stricmp( pArg, "EQUNONISO" ) && developer_options)
  ------------------
  |  Branch (1536:22): [True: 0, False: 0]
  |  Branch (1536:61): [Folded - Ignored]
  ------------------
 1537|      0|            {
 1538|      0|                bCompareComponents = CMP_COMPONENTS | CMP_COMPONENTS_NONISO;
  ------------------
  |  |   82|      0|#define CMP_COMPONENTS              0x0001     /* perform compare components */
  ------------------
                              bCompareComponents = CMP_COMPONENTS | CMP_COMPONENTS_NONISO;
  ------------------
  |  |   83|      0|#define CMP_COMPONENTS_NONISO       0x0002     /* ignore isotopic */
  ------------------
 1539|      0|            }
 1540|      0|            else if (!inchi_memicmp( pArg, "OP:", 3 ) && developer_options)
  ------------------
  |  Branch (1540:22): [True: 0, False: 0]
  |  Branch (1540:58): [Folded - Ignored]
  ------------------
 1541|      0|            {
 1542|      0|                bOutputPath = 1;
 1543|      0|                strncpy( szOutputPath, pArg + 3, sizeof( szOutputPath ) - 1 );
 1544|      0|            }
 1545|       |            /* eof developer_options */
 1546|       |
 1547|       |            /* Display unrecognized option */
 1548|      0|            else
 1549|      0|            {
 1550|      0|                bRecognizedOption = 0;
 1551|       |
 1552|      0|#ifndef TARGET_LIB_FOR_WINCHI
 1553|      0|                inchi_ios_eprint( log_file, "Unrecognized optionQ3: \"%s\".\n", pArg );
 1554|      0|#endif
 1555|      0|            }
 1556|    576|            bVer1Options |= bRecognizedOption;
 1557|       |
 1558|    576|        } /* eof Parsing stand-alone executable/libinchi options */
 1559|       |
 1560|      0|        else if (ip->num_paths < MAX_NUM_PATHS)
  ------------------
  |  |   86|      0|#define MAX_NUM_PATHS 4
  ------------------
  |  Branch (1560:18): [True: 0, False: 0]
  ------------------
 1561|      0|        {
 1562|      0|            char *sz;
 1563|       |#if( ALLOW_EMPTY_PATHS == 1 )
 1564|       |            if (argv[i])
 1565|       |#else
 1566|      0|            if (argv[i] && argv[i][0])
  ------------------
  |  Branch (1566:17): [True: 0, False: 0]
  |  Branch (1566:28): [True: 0, False: 0]
  ------------------
 1567|      0|#endif
 1568|      0|            {
 1569|      0|                if (sz = (char*) inchi_malloc( ( strlen( argv[i] ) + 1 ) * sizeof( sz[0] ) ))
  ------------------
  |  | 1130|      0|#define inchi_malloc   malloc
  ------------------
  |  Branch (1569:21): [True: 0, False: 0]
  ------------------
 1570|      0|                {
 1571|      0|                    strcpy( sz, argv[i] );
 1572|      0|                }
 1573|       |
 1574|      0|                ip->path[ip->num_paths++] = sz;
 1575|      0|            }
 1576|      0|        }
 1577|    576|    } /*  eof parsing argv loop */
 1578|       |
 1579|       |
 1580|       |    /* Print messages and set controil variables according to just parsed options */
 1581|       |
 1582|       |    /* Timeout option(s) */
 1583|    576|    if (timeout_set_warning)
  ------------------
  |  Branch (1583:9): [True: 0, False: 576]
  ------------------
 1584|      0|    {
 1585|      0|        inchi_ios_eprint( log_file, "Warning: timeout value may have been modified (truncated?) due to number formatting issues;\n" );
 1586|      0|    }
 1587|    576|    if (timeout_set_error)
  ------------------
  |  Branch (1587:9): [True: 0, False: 576]
  ------------------
 1588|      0|    {
 1589|      0|        inchi_ios_eprint( log_file, "Warning: specified timeout value was ignored due to invalid number format, using the default;\n" );
 1590|      0|    }
 1591|       |
 1592|       |    /* InChIKey option(s) */
 1593|    576|    if (bHashKey != 0)
  ------------------
  |  Branch (1593:9): [True: 0, False: 576]
  ------------------
 1594|      0|    {
 1595|       |        /* Suppress InChIKey calculation if:                */
 1596|       |        /* compressed output OR Inchi2Struct OR Inchi2Inchi */
 1597|      0|        if (( ip->bAbcNumbers == 1 ) && ( ip->bCtPredecessors == 1 ))
  ------------------
  |  Branch (1597:13): [True: 0, False: 0]
  |  Branch (1597:41): [True: 0, False: 0]
  ------------------
 1598|      0|        {
 1599|      0|            bHashKey = 0;
 1600|      0|#ifndef TARGET_LIB_FOR_WINCHI
 1601|      0|            inchi_ios_eprint( log_file, "Terminating: generation of InChIKey is not available with 'Compress' option\n" );
 1602|      0|            return -1;
 1603|      0|#endif
 1604|      0|        }
 1605|      0|        if (ip->nInputType == INPUT_INCHI)
  ------------------
  |  Branch (1605:13): [True: 0, False: 0]
  ------------------
 1606|      0|        {
 1607|      0|            bHashKey = 0;
 1608|      0|#ifndef TARGET_LIB_FOR_WINCHI
 1609|      0|            inchi_ios_eprint( log_file, "Terminating: generation of InChIKey is not available in InChI conversion mode\n" );
 1610|      0|            return -1;
 1611|      0|#endif
 1612|      0|        }
 1613|      0|        else
 1614|      0|        {
 1615|      0|            if (bOutputMolfileOnly == 1)
  ------------------
  |  Branch (1615:17): [True: 0, False: 0]
  ------------------
 1616|      0|            {
 1617|      0|                bHashKey = 0;
 1618|      0|#ifndef TARGET_LIB_FOR_WINCHI
 1619|      0|                inchi_ios_eprint( log_file, "Terminating: generation of InChIKey is not available with 'OutputSDF' option\n" );
 1620|      0|                return -1;
 1621|      0|#endif
 1622|      0|            }
 1623|      0|        }
 1624|      0|    }
 1625|       |
 1626|    576|    if (bNameSuffix || bOutputPath)
  ------------------
  |  Branch (1626:9): [True: 576, False: 0]
  |  Branch (1626:24): [True: 0, False: 0]
  ------------------
 1627|    576|    {
 1628|    576|        const char szNUL[] = "NUL";
 1629|       |        /* fix for AMD processor: use const char[] instead of just "NUL" constant 2008-11-5 DT */
 1630|    576|        const char *p = NULL;
 1631|    576|        char *r = NULL;
 1632|    576|        char *sz;
 1633|    576|        int len;
 1634|       |        /*  find the 1st path */
 1635|  2.88k|        for (i = 0; i < MAX_NUM_PATHS; i++)
  ------------------
  |  |   86|  2.88k|#define MAX_NUM_PATHS 4
  ------------------
  |  Branch (1635:21): [True: 2.30k, False: 576]
  ------------------
 1636|  2.30k|        {
 1637|  2.30k|            if (!p && ip->path[i] && ip->path[i][0])
  ------------------
  |  Branch (1637:17): [True: 2.30k, False: 0]
  |  Branch (1637:23): [True: 0, False: 2.30k]
  |  Branch (1637:38): [True: 0, False: 0]
  ------------------
 1638|      0|            {
 1639|      0|                p = ip->path[i];
 1640|      0|                break;
 1641|      0|            }
 1642|  2.30k|        }
 1643|       |        /* fix output path */
 1644|    576|        if (bOutputPath && szOutputPath[0] && p)
  ------------------
  |  Branch (1644:13): [True: 0, False: 576]
  |  Branch (1644:28): [True: 0, False: 0]
  |  Branch (1644:47): [True: 0, False: 0]
  ------------------
 1645|      0|        {
 1646|       |            /* remove last slash */
 1647|      0|            len = (int) strlen( szOutputPath );
 1648|      0|            if (len > 0 && szOutputPath[len - 1] != INCHI_PATH_DELIM)
  ------------------
  |  |  256|      0|#define   INCHI_PATH_DELIM    '/'
  ------------------
  |  Branch (1648:17): [True: 0, False: 0]
  |  Branch (1648:28): [True: 0, False: 0]
  ------------------
 1649|      0|            {
 1650|      0|                szOutputPath[len++] = INCHI_PATH_DELIM;
  ------------------
  |  |  256|      0|#define   INCHI_PATH_DELIM    '/'
  ------------------
 1651|      0|                szOutputPath[len] = '\0';
 1652|      0|            }
 1653|      0|            if (len > 0 && ( r = (char *) strrchr( p, INCHI_PATH_DELIM ) ) && r[1])
  ------------------
  |  |  256|      0|#define   INCHI_PATH_DELIM    '/'
  ------------------
  |  Branch (1653:17): [True: 0, False: 0]
  |  Branch (1653:28): [True: 0, False: 0]
  |  Branch (1653:79): [True: 0, False: 0]
  ------------------
 1654|      0|            {
 1655|      0|                strcat( szOutputPath, r + 1 );
 1656|      0|                p = szOutputPath;
 1657|      0|            }
 1658|      0|        }
 1659|       |        /*  add missing paths */
 1660|    576|        for (i = 0; p && i < MAX_NUM_PATHS; i++)
  ------------------
  |  |   86|      0|#define MAX_NUM_PATHS 4
  ------------------
  |  Branch (1660:21): [True: 0, False: 576]
  |  Branch (1660:26): [True: 0, False: 0]
  ------------------
 1661|      0|        {
 1662|       |            /* fix for AMD processor: changed order 2008-11-5 DT */
 1663|      0|            if (!ip->path[i] || !ip->path[i][0])
  ------------------
  |  Branch (1663:17): [True: 0, False: 0]
  |  Branch (1663:33): [True: 0, False: 0]
  ------------------
 1664|      0|            {
 1665|       |#if ( BUILD_WITH_AMI == 1 ) && ( OUTPUT_FILE_EXT == 1 )
 1666|       |                char *pLastExt = ( i && numOutNameExt >= i ) ? strrchr( (char*) p, '.' ) : 0;
 1667|       |                char *pLastSlash = ( i && numOutNameExt >= i ) ? strrchr( (char*) p, INCHI_PATH_DELIM ) : 0;
 1668|       |                if (pLastExt && pLastSlash && pLastSlash > pLastExt)
 1669|       |                    pLastExt = NULL;
 1670|       |#else
 1671|      0|                char *pLastExt = NULL;
 1672|      0|#endif
 1673|      0|                len = (int) strlen( p ) + strlen( szNameSuffix ) + strlen( ext[i] );
 1674|      0|                if (sz = (char*) inchi_malloc( ( len + 1 ) * sizeof( sz[0] ) ))
  ------------------
  |  | 1130|      0|#define inchi_malloc   malloc
  ------------------
  |  Branch (1674:21): [True: 0, False: 0]
  ------------------
 1675|      0|                {
 1676|      0|                    strcpy( sz, p );
 1677|       |#if ( BUILD_WITH_AMI == 1 ) && ( OUTPUT_FILE_EXT == 1 )
 1678|       |                    if (pLastExt)
 1679|       |                    {
 1680|       |                        strcpy( sz + ( pLastExt - p ), szOutNameExt[i - 1] );
 1681|       |                    }
 1682|       |#endif
 1683|      0|                    strcat( sz, szNameSuffix );
 1684|      0|                    if (!pLastExt)
  ------------------
  |  Branch (1684:25): [True: 0, False: 0]
  ------------------
 1685|      0|                        strcat( sz, ext[i] );
 1686|      0|                    ip->num_paths++;
 1687|      0|                    if (ip->path[i])
  ------------------
  |  Branch (1687:25): [True: 0, False: 0]
  ------------------
 1688|      0|                    {
 1689|      0|                        inchi_free( (char*) ip->path[i] ); /* eliminate memory leak 2013-12-18 DCh */
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1690|      0|                    }
 1691|      0|                    ip->path[i] = sz;
 1692|      0|                }
 1693|      0|            }
 1694|      0|            else if (!inchi_stricmp( ip->path[i], szNUL ))
  ------------------
  |  Branch (1694:22): [True: 0, False: 0]
  ------------------
 1695|      0|            {
 1696|      0|                inchi_free( (char *) ip->path[i] ); /* cast deliberately const qualifier */
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1697|      0|                ip->path[i] = NULL;
 1698|      0|            }
 1699|      0|        }
 1700|    576|    }
 1701|       |
 1702|       |    /* inchi2inchi and inchi2struct option(s) */
 1703|    576|#if ( READ_INCHI_STRING == 1 )
 1704|    576|    if (INPUT_INCHI == ip->nInputType)
  ------------------
  |  Branch (1704:9): [True: 576, False: 0]
  ------------------
 1705|    576|    {
 1706|    576|        bCompareComponents = 0;
 1707|       |        /*bDisplayCompositeResults = 0;*/
 1708|       |#if ( I2S_MODIFY_OUTPUT == 1 )
 1709|       |        if (!( ip->bReadInChIOptions & READ_INCHI_TO_STRUCTURE ))
 1710|       |#endif
 1711|    576|        {
 1712|    576|            bOutputMolfileOnly  = 0;
 1713|    576|            bINChIOutputOptions |= INCHI_OUT_NO_AUX_INFO;
  ------------------
  |  |  157|    576|#define INCHI_OUT_NO_AUX_INFO           0x0001   /* do not output Aux Info                  */
  ------------------
 1714|    576|            bINChIOutputOptions &= ~INCHI_OUT_SHORT_AUX_INFO;
  ------------------
  |  |  158|    576|#define INCHI_OUT_SHORT_AUX_INFO        0x0002   /* output short version of Aux Info        */
  ------------------
 1715|    576|            bINChIOutputOptions &= ~INCHI_OUT_ONLY_AUX_INFO;
  ------------------
  |  |  159|    576|#define INCHI_OUT_ONLY_AUX_INFO         0x0004   /* output only Aux Info                    */
  ------------------
 1716|       |            /* bNoStructLabels   = 1; */
 1717|    576|        }
 1718|    576|        ip->bDisplayIfRestoreWarnings = bDisplayIfRestoreWarnings;
 1719|    576|        if (   !( bINChIOutputOptions &
  ------------------
  |  Branch (1719:16): [True: 576, False: 0]
  ------------------
 1720|    576|                  ( INCHI_OUT_SDFILE_ONLY |       /* not in bINChIOutputOptions yet */
  ------------------
  |  |  161|    576|#define INCHI_OUT_SDFILE_ONLY           0x0010   /* save input data in a Molfile instead of creating INChI */
  ------------------
 1721|    576|                    INCHI_OUT_PLAIN_TEXT |        /* not in bINChIOutputOptions yet */
  ------------------
  |  |  163|    576|#define INCHI_OUT_PLAIN_TEXT            0x0040   /* output plain text INChI                 */
  ------------------
 1722|       |                    INCHI_OUT_PLAIN_TEXT_COMMENTS /* not in bINChIOutputOptions yet */
  ------------------
  |  |  164|    576|#define INCHI_OUT_PLAIN_TEXT_COMMENTS   0x0080   /* output plain text annotation            */
  ------------------
 1723|    576|                   )
 1724|    576|                 )
 1725|       |#if ( I2S_MODIFY_OUTPUT == 1 )
 1726|       |               && !bOutputMolfileOnly
 1727|       |               && !( bOutputStyle & ( INCHI_OUT_PLAIN_TEXT ) )
 1728|       |#endif
 1729|    576|        )
 1730|    576|        {
 1731|    576|            bINChIOutputOptions |= INCHI_OUT_PLAIN_TEXT;
  ------------------
  |  |  163|    576|#define INCHI_OUT_PLAIN_TEXT            0x0040   /* output plain text INChI                 */
  ------------------
 1732|    576|        }
 1733|    576|    }
 1734|    576|#endif
 1735|       |
 1736|    576|    if (bVer1Options)
  ------------------
  |  Branch (1736:9): [True: 576, False: 0]
  ------------------
 1737|    576|    {
 1738|    576|        nMode |= bVer1DefaultMode;
 1739|    576|    }
 1740|      0|    else if (bReleaseVersion)
  ------------------
  |  Branch (1740:14): [True: 0, False: 0]
  ------------------
 1741|      0|    {
 1742|      0|        nMode |= nReleaseMode;
 1743|      0|    }
 1744|       |
 1745|    576|#if ( defined(COMPILE_ANSI_ONLY) || defined(TARGET_LIB_FOR_WINCHI) )
 1746|    576|    if (bCompareComponents && !( bDisplay & 1 ))
  ------------------
  |  Branch (1746:9): [True: 0, False: 576]
  |  Branch (1746:31): [True: 0, False: 0]
  ------------------
 1747|      0|    {
 1748|      0|        bCompareComponents = 0;
 1749|      0|    }
 1750|    576|#endif
 1751|       |
 1752|       |    /* Save original options */
 1753|       |    /* nOrigMode = nMode; */
 1754|       |#ifndef COMPILE_ANSI_ONLY
 1755|       |    ip->dp.sdp.nFontSize = nFontSize;
 1756|       |    ip->dp.sdp.ulDisplTime = *ulDisplTime;
 1757|       |    ip->bDisplay = bDisplay;
 1758|       |#ifdef TARGET_LIB_FOR_WINCHI
 1759|       |    ip->bDisplayCompositeResults = bDisplay;
 1760|       |#else
 1761|       |    ip->bDisplayCompositeResults = bDisplayCompositeResults;
 1762|       |#endif
 1763|       |#else
 1764|    576|    ip->bDisplayEachComponentINChI = 0;
 1765|    576|    bCompareComponents = 0;
 1766|    576|#endif
 1767|       |
 1768|    576|    ip->bMergeAllInputStructures = bMergeAllInputStructures;
 1769|    576|    ip->bDoNotAddH = bDoNotAddH;
 1770|       |
 1771|       |    /*  Set default options */
 1772|    576|    if (!nMode || nMode == REQ_MODE_STEREO)
  ------------------
  |  |   47|    576|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
  |  Branch (1772:9): [True: 0, False: 576]
  |  Branch (1772:19): [True: 0, False: 576]
  ------------------
 1773|      0|    {
 1774|       |        /*  requested all output */
 1775|      0|        nMode |= ( REQ_MODE_BASIC | REQ_MODE_TAUT | REQ_MODE_ISO | REQ_MODE_NON_ISO | REQ_MODE_STEREO );
  ------------------
  |  |   43|      0|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
                      nMode |= ( REQ_MODE_BASIC | REQ_MODE_TAUT | REQ_MODE_ISO | REQ_MODE_NON_ISO | REQ_MODE_STEREO );
  ------------------
  |  |   44|      0|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
                      nMode |= ( REQ_MODE_BASIC | REQ_MODE_TAUT | REQ_MODE_ISO | REQ_MODE_NON_ISO | REQ_MODE_STEREO );
  ------------------
  |  |   45|      0|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
                      nMode |= ( REQ_MODE_BASIC | REQ_MODE_TAUT | REQ_MODE_ISO | REQ_MODE_NON_ISO | REQ_MODE_STEREO );
  ------------------
  |  |   46|      0|#define REQ_MODE_NON_ISO            0x000008    /* NI   */
  ------------------
                      nMode |= ( REQ_MODE_BASIC | REQ_MODE_TAUT | REQ_MODE_ISO | REQ_MODE_NON_ISO | REQ_MODE_STEREO );
  ------------------
  |  |   47|      0|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
 1776|      0|    }
 1777|    576|    else
 1778|    576|    {
 1779|    576|        if (!( nMode & ( REQ_MODE_BASIC | REQ_MODE_TAUT ) ))
  ------------------
  |  |   43|    576|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
                      if (!( nMode & ( REQ_MODE_BASIC | REQ_MODE_TAUT ) ))
  ------------------
  |  |   44|    576|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
  |  Branch (1779:13): [True: 0, False: 576]
  ------------------
 1780|      0|        {
 1781|      0|            nMode |= ( REQ_MODE_BASIC | REQ_MODE_TAUT );
  ------------------
  |  |   43|      0|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
                          nMode |= ( REQ_MODE_BASIC | REQ_MODE_TAUT );
  ------------------
  |  |   44|      0|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
 1782|      0|        }
 1783|    576|        if (( nMode & REQ_MODE_STEREO ) && !( nMode & ( REQ_MODE_ISO | REQ_MODE_NON_ISO ) ))
  ------------------
  |  |   47|    576|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
                      if (( nMode & REQ_MODE_STEREO ) && !( nMode & ( REQ_MODE_ISO | REQ_MODE_NON_ISO ) ))
  ------------------
  |  |   45|    576|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
                      if (( nMode & REQ_MODE_STEREO ) && !( nMode & ( REQ_MODE_ISO | REQ_MODE_NON_ISO ) ))
  ------------------
  |  |   46|    576|#define REQ_MODE_NON_ISO            0x000008    /* NI   */
  ------------------
  |  Branch (1783:13): [True: 576, False: 0]
  |  Branch (1783:44): [True: 0, False: 576]
  ------------------
 1784|      0|        {
 1785|      0|            nMode |= ( REQ_MODE_ISO | REQ_MODE_NON_ISO );
  ------------------
  |  |   45|      0|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
                          nMode |= ( REQ_MODE_ISO | REQ_MODE_NON_ISO );
  ------------------
  |  |   46|      0|#define REQ_MODE_NON_ISO            0x000008    /* NI   */
  ------------------
 1786|      0|        }
 1787|    576|    }
 1788|       |    /*  if the user requested isotopic then unconditionally add non-isotopic output. */
 1789|    576|    if (nMode & REQ_MODE_ISO)
  ------------------
  |  |   45|    576|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
  |  Branch (1789:9): [True: 576, False: 0]
  ------------------
 1790|    576|    {
 1791|    576|        nMode |= REQ_MODE_NON_ISO;
  ------------------
  |  |   46|    576|#define REQ_MODE_NON_ISO            0x000008    /* NI   */
  ------------------
 1792|    576|    }
 1793|       |
 1794|    576|#if ( MIN_SB_RING_SIZE > 0 )
 1795|    576|    if (mdbr)
  ------------------
  |  Branch (1795:9): [True: 0, False: 576]
  ------------------
 1796|      0|    {
 1797|      0|        nMinDbRinSize = mdbr;
 1798|      0|    }
 1799|    576|    nMode |= ( nMinDbRinSize << REQ_MODE_MIN_SB_RING_SHFT ) & REQ_MODE_MIN_SB_RING_MASK;
  ------------------
  |  |   72|    576|#define REQ_MODE_MIN_SB_RING_SHFT      16
  ------------------
                  nMode |= ( nMinDbRinSize << REQ_MODE_MIN_SB_RING_SHFT ) & REQ_MODE_MIN_SB_RING_MASK;
  ------------------
  |  |   71|    576|#define REQ_MODE_MIN_SB_RING_MASK   0x0F0000    /* RSB  */
  ------------------
 1800|    576|#endif
 1801|       |
 1802|       |    /* Input file */
 1803|    576|    if (ip->nInputType == INPUT_NONE && ip->num_paths > 0)
  ------------------
  |  Branch (1803:9): [True: 0, False: 576]
  |  Branch (1803:41): [True: 0, False: 0]
  ------------------
 1804|      0|    {
 1805|      0|        ip->nInputType = INPUT_MOLFILE; /*  default */
 1806|      0|    }
 1807|    576|    ip->nMode = nMode;
 1808|       |    /* Compare components */
 1809|    576|    if (( bCompareComponents & CMP_COMPONENTS ) && ( nMode & REQ_MODE_BASIC ))
  ------------------
  |  |   82|    576|#define CMP_COMPONENTS              0x0001     /* perform compare components */
  ------------------
                  if (( bCompareComponents & CMP_COMPONENTS ) && ( nMode & REQ_MODE_BASIC ))
  ------------------
  |  |   43|      0|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
  |  Branch (1809:9): [True: 0, False: 576]
  |  Branch (1809:52): [True: 0, False: 0]
  ------------------
 1810|      0|    {
 1811|      0|        bCompareComponents |= CMP_COMPONENTS_NONTAUT; /* compare non-tautomeric */
  ------------------
  |  |   84|      0|#define CMP_COMPONENTS_NONTAUT      0x0004     /* compare non-tautomeric */
  ------------------
 1812|      0|    }
 1813|    576|    ip->bCompareComponents = bCompareComponents;
 1814|       |    /* Output */
 1815|    576|    ip->bINChIOutputOptions = bINChIOutputOptions | ( bOutputMolfileOnly ? INCHI_OUT_SDFILE_ONLY : 0 );
  ------------------
  |  |  161|      0|#define INCHI_OUT_SDFILE_ONLY           0x0010   /* save input data in a Molfile instead of creating INChI */
  ------------------
  |  Branch (1815:55): [True: 0, False: 576]
  ------------------
 1816|    576|    if (bOutputMolfileOnly)
  ------------------
  |  Branch (1816:9): [True: 0, False: 576]
  ------------------
 1817|      0|    {
 1818|      0|        bOutputStyle &= ~( INCHI_OUT_PLAIN_TEXT |
  ------------------
  |  |  163|      0|#define INCHI_OUT_PLAIN_TEXT            0x0040   /* output plain text INChI                 */
  ------------------
 1819|      0|            INCHI_OUT_PLAIN_TEXT_COMMENTS |
  ------------------
  |  |  164|      0|#define INCHI_OUT_PLAIN_TEXT_COMMENTS   0x0080   /* output plain text annotation            */
  ------------------
 1820|      0|            INCHI_OUT_TABBED_OUTPUT );
  ------------------
  |  |  167|      0|#define INCHI_OUT_TABBED_OUTPUT         0x0400   /* tab-delimited (only for plain text)     */
  ------------------
 1821|      0|#if ( SDF_OUTPUT_DT == 1 )
 1822|      0|        ip->bINChIOutputOptions |= bOutputMolfileDT    ? INCHI_OUT_SDFILE_ATOMS_DT : 0;
  ------------------
  |  |  168|      0|#define INCHI_OUT_SDFILE_ATOMS_DT       0x0800   /* SDfile output H isotopes as D and T     */
  ------------------
  |  Branch (1822:36): [True: 0, False: 0]
  ------------------
 1823|      0|        ip->bINChIOutputOptions |= bOutputMolfileSplit ? INCHI_OUT_SDFILE_SPLIT : 0;
  ------------------
  |  |  169|      0|#define INCHI_OUT_SDFILE_SPLIT          0x1000   /* Split SDfile into components            */
  ------------------
  |  Branch (1823:36): [True: 0, False: 0]
  ------------------
 1824|      0|#endif
 1825|      0|    }
 1826|       |#ifdef TARGET_LIB_FOR_WINCHI
 1827|       |    if (!( bDisplay & 1 ))
 1828|       |    {
 1829|       |        bOutputStyle &= ~( INCHI_OUT_PLAIN_TEXT_COMMENTS ); /* do not ouput comments in wINChI text file results */
 1830|       |    }
 1831|       |    else
 1832|       |    {
 1833|       |        bOutputStyle |= INCHI_OUT_WINCHI_WINDOW;
 1834|       |    }
 1835|       |#endif
 1836|    576|    ip->bINChIOutputOptions |= bOutputStyle;
 1837|    576|    ip->bNoStructLabels = bNoStructLabels;
 1838|       |
 1839|       |    /* Processing options */
 1840|    576|    if (bForcedChiralFlag)
  ------------------
  |  Branch (1840:9): [True: 0, False: 576]
  ------------------
 1841|      0|    {
 1842|      0|        ip->bChiralFlag = bForcedChiralFlag;
 1843|      0|    }
 1844|       |
 1845|       |    /* Tautomeric/salts options */
 1846|    576|    ip->bTautFlags = 0;
 1847|    576|    ip->bTautFlagsDone = 0;
 1848|       |
 1849|       |    /* Find regular tautomerism */
 1850|    576|    ip->bTautFlags |= TG_FLAG_TEST_TAUT__ATOMS;
  ------------------
  |  |  921|    576|#define TG_FLAG_TEST_TAUT__ATOMS         0x00000001   /* find regular tautomerism */
  ------------------
 1851|       |
 1852|       |    /* Disconnect salts */
 1853|    576|    ip->bTautFlags |= bDisconnectSalts ? TG_FLAG_DISCONNECT_SALTS : 0;
  ------------------
  |  |  922|    576|#define TG_FLAG_DISCONNECT_SALTS         0x00000002   /* DISCONNECT_SALTS disconnect */
  ------------------
  |  Branch (1853:23): [True: 576, False: 0]
  ------------------
 1854|       |
 1855|       |    /* If possible, find long-range H/(-) taut. on =C-OH, >C=O    */
 1856|    576|    ip->bTautFlags |= bAcidTautomerism ? TG_FLAG_TEST_TAUT__SALTS : 0;
  ------------------
  |  |  923|    576|#define TG_FLAG_TEST_TAUT__SALTS         0x00000004   /* DISCONNECT_SALTS if possible find long-range H/(-) taut. on =C-OH, >C=O    */
  ------------------
  |  Branch (1856:23): [True: 576, False: 0]
  ------------------
 1857|       |
 1858|       |    /* Allow long-range movement of N(+), P(+) charges           */
 1859|    576|    ip->bTautFlags |= bMovePositiveCharges ? TG_FLAG_MOVE_POS_CHARGES : 0;
  ------------------
  |  |  924|    576|#define TG_FLAG_MOVE_POS_CHARGES         0x00000008   /* MOVE_CHARGES allow long-range movement of N(+), P(+) charges           */
  ------------------
  |  Branch (1859:23): [True: 576, False: 0]
  ------------------
 1860|       |
 1861|       |    /* Multi-attachement long-range H/(-) taut. on =C-OH, >C=O   */
 1862|    576|    ip->bTautFlags |= ( bAcidTautomerism > 1 ) ? TG_FLAG_TEST_TAUT2_SALTS : 0;
  ------------------
  |  |  925|    576|#define TG_FLAG_TEST_TAUT2_SALTS         0x00000010   /* TEST_REMOVE_S_ATOMS multi-attachement long-range H/(-) taut. on =C-OH, >C=O   */
  ------------------
  |  Branch (1862:23): [True: 576, False: 0]
  ------------------
 1863|       |
 1864|       |    /* (Debug) allow to find long-range H-only tautomerism on =C-OH, >C=O */
 1865|    576|    ip->bTautFlags |= ( bUnchargedAcidTaut == 1 ) ? TG_FLAG_ALLOW_NO_NEGTV_O : 0;
  ------------------
  |  |  926|      0|#define TG_FLAG_ALLOW_NO_NEGTV_O         0x00000020   /* CHARGED_SALTS_ONLY=0 (debug) find long-range H-only tautomerism on =C-OH, >C=O */
  ------------------
  |  Branch (1865:23): [True: 0, False: 576]
  ------------------
 1866|       |
 1867|       |    /* Merge =C-OH and >C=O containing t-groups and other =C-OH groups */
 1868|    576|    ip->bTautFlags |= bMergeSaltTGroups ? TG_FLAG_MERGE_TAUT_SALTS : 0;
  ------------------
  |  |  927|    576|#define TG_FLAG_MERGE_TAUT_SALTS         0x00000040   /* DISCONNECT_SALTS merge all "salt"-t-groups and other =C-OH into one t-group */
  ------------------
  |  Branch (1868:23): [True: 576, False: 0]
  ------------------
 1869|    576|    ip->bTautFlags |= bDisconnectCoord ? TG_FLAG_DISCONNECT_COORD : 0;
  ------------------
  |  |  934|    576|#define TG_FLAG_DISCONNECT_COORD         0x00000080   /* find "coord. centers" and disconnect them */
  ------------------
  |  Branch (1869:23): [True: 576, False: 0]
  ------------------
 1870|    576|    ip->bTautFlags |= ( bDisconnectCoord && bReconnectCoord ) ? TG_FLAG_RECONNECT_COORD : 0;
  ------------------
  |  |  935|      0|#define TG_FLAG_RECONNECT_COORD          0x00000100   /* reconnect disconnected "coord. centers" */
  ------------------
  |  Branch (1870:25): [True: 576, False: 0]
  |  Branch (1870:45): [True: 0, False: 576]
  ------------------
 1871|    576|    ip->bTautFlags |= bDisconnectCoordChkVal ? TG_FLAG_CHECK_VALENCE_COORD : 0;
  ------------------
  |  |  936|      0|#define TG_FLAG_CHECK_VALENCE_COORD      0x00000200   /* do not disconnect "coord. centers" with usual valence */
  ------------------
  |  Branch (1871:23): [True: 0, False: 576]
  ------------------
 1872|    576|    ip->bTautFlags |= bTgFlagVariableProtons ? TG_FLAG_VARIABLE_PROTONS : 0;
  ------------------
  |  |  938|    576|#define TG_FLAG_VARIABLE_PROTONS         0x00000800   /* add/remove protons to neutralize */
  ------------------
  |  Branch (1872:23): [True: 576, False: 0]
  ------------------
 1873|    576|    ip->bTautFlags |= bTgFlagHardAddRenProtons ? TG_FLAG_HARD_ADD_REM_PROTONS : 0;
  ------------------
  |  |  939|    576|#define TG_FLAG_HARD_ADD_REM_PROTONS     0x00001000   /* add/remove protons to neutralize in hard way */
  ------------------
  |  Branch (1873:23): [True: 576, False: 0]
  ------------------
 1874|    576|    ip->bTautFlags |= bKetoEnolTaut ? TG_FLAG_KETO_ENOL_TAUT : 0;
  ------------------
  |  |  949|      0|#define TG_FLAG_KETO_ENOL_TAUT           0x00080000   /* turn on keto-enol tautomerism detection */
  ------------------
  |  Branch (1874:23): [True: 0, False: 576]
  ------------------
 1875|    576|    ip->bTautFlags |= b15TautNonRing ? TG_FLAG_1_5_TAUT : 0;
  ------------------
  |  |  950|      0|#define TG_FLAG_1_5_TAUT                 0x00100000   /* turn on 1,5 tautomerism detection */
  ------------------
  |  Branch (1875:23): [True: 0, False: 576]
  ------------------
 1876|    576|#ifdef STEREO_WEDGE_ONLY
 1877|    576|    ip->bTautFlags |= bPointedEdgeStereo ? TG_FLAG_POINTED_EDGE_STEREO : 0;
  ------------------
  |  |  940|    576|#define TG_FLAG_POINTED_EDGE_STEREO      0x00002000   /* only pointed edge of stereo bond defines stereo */
  ------------------
  |  Branch (1877:23): [True: 576, False: 0]
  ------------------
 1878|    576|#endif
 1879|       |#if ( FIX_ADJ_RAD == 1 )
 1880|       |    ip->bTautFlags |= bFixAdjacentRad ? TG_FLAG_FIX_ADJ_RADICALS : 0;
 1881|       |#endif
 1882|    576|    ip->bTautFlags |= bAddPhosphineStereo ? TG_FLAG_PHOSPHINE_STEREO : 0;
  ------------------
  |  |  944|    576|#define TG_FLAG_PHOSPHINE_STEREO         0x00008000   /* add phosphine sp3 stereo */
  ------------------
  |  Branch (1882:23): [True: 576, False: 0]
  ------------------
 1883|    576|    ip->bTautFlags |= bAddArsineStereo ? TG_FLAG_ARSINE_STEREO : 0;
  ------------------
  |  |  945|    576|#define TG_FLAG_ARSINE_STEREO            0x00010000   /* add arsine sp3 stereo */
  ------------------
  |  Branch (1883:23): [True: 576, False: 0]
  ------------------
 1884|    576|    ip->bTautFlags |= bFixSp3bug ? TG_FLAG_FIX_SP3_BUG : 0;
  ------------------
  |  |  947|    576|#define TG_FLAG_FIX_SP3_BUG              0x00040000   /* fix sp3 stereo bug: overlapping 2D stereo bond & coordinate scaling */
  ------------------
  |  Branch (1884:23): [True: 576, False: 0]
  ------------------
 1885|       |
 1886|       |    /* Bug fixes */
 1887|    576|    if (bFixFB2)
  ------------------
  |  Branch (1887:9): [True: 576, False: 0]
  ------------------
 1888|    576|    {
 1889|    576|#if ( FIX_ISO_FIXEDH_BUG == 1 )
 1890|    576|        ip->bTautFlags |= TG_FLAG_FIX_ISO_FIXEDH_BUG; /* accomodate FIX_ISO_FIXEDH_BUG */
  ------------------
  |  |  953|    576|#define TG_FLAG_FIX_ISO_FIXEDH_BUG       0x00200000   /* fix bug found after v.102b (isotopic H representation)  */
  ------------------
 1891|    576|#endif
 1892|       |
 1893|    576|#if ( FIX_TERM_H_CHRG_BUG == 1 )
 1894|    576|        ip->bTautFlags |= TG_FLAG_FIX_TERM_H_CHRG_BUG; /* accomodate FIX_TERM_H_CHRG_BUG */
  ------------------
  |  |  954|    576|#define TG_FLAG_FIX_TERM_H_CHRG_BUG      0x00400000   /* fix bug found after v.102b (moving H charge in 'remove_terminal_HDT') */
  ------------------
 1895|    576|#endif
 1896|       |
 1897|    576|#if ( FIX_TRANSPOSITION_CHARGE_BUG == 1 )
 1898|    576|        ip->bINChIOutputOptions |= INCHI_OUT_FIX_TRANSPOSITION_CHARGE_BUG;
  ------------------
  |  |  171|    576|#define INCHI_OUT_FIX_TRANSPOSITION_CHARGE_BUG 0x2000
  ------------------
 1899|    576|#endif
 1900|    576|    }
 1901|       |
 1902|    576|    if (!ip->nInputType)
  ------------------
  |  Branch (1902:9): [True: 0, False: 576]
  ------------------
 1903|      0|    {
 1904|      0|        ip->nInputType = INPUT_MOLFILE;
 1905|      0|    }
 1906|       |
 1907|       |    /* Check if /SNon requested turn OFF SUU/SLUUD */
 1908|    576|    if (!( ip->nMode & REQ_MODE_STEREO ))
  ------------------
  |  |   47|    576|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
  |  Branch (1908:9): [True: 0, False: 576]
  ------------------
 1909|      0|    {
 1910|      0|        ip->nMode &= ~REQ_MODE_DIFF_UU_STEREO;
  ------------------
  |  |   68|      0|#define REQ_MODE_DIFF_UU_STEREO     0x004000    /* SLUUD Make labels for unknown and undefined stereo different */
  ------------------
 1911|      0|        ip->nMode &= ~( REQ_MODE_SB_IGN_ALL_UU | REQ_MODE_SC_IGN_ALL_UU );
  ------------------
  |  |   60|      0|#define REQ_MODE_SB_IGN_ALL_UU      0x001000    /* IAUSC Ignore stereobonds if All Undef/Unknown */
  ------------------
                      ip->nMode &= ~( REQ_MODE_SB_IGN_ALL_UU | REQ_MODE_SC_IGN_ALL_UU );
  ------------------
  |  |   58|      0|#define REQ_MODE_SC_IGN_ALL_UU      0x000800    /* IAUSC Ignore stereocenters if All Undef/Unknown */
  ------------------
 1912|      0|    }
 1913|       |
 1914|       |    /* Standard InChI ? */
 1915|    576|    if (bStdFormat)
  ------------------
  |  Branch (1915:9): [True: 576, False: 0]
  ------------------
 1916|    576|    {
 1917|    576|        ip->bINChIOutputOptions |= INCHI_OUT_STDINCHI;
  ------------------
  |  |  173|    576|#define INCHI_OUT_STDINCHI 0x4000
  ------------------
 1918|    576|    }
 1919|       |
 1920|       |    /* InChIKey ? */
 1921|    576|    if (!bHashKey)
  ------------------
  |  Branch (1921:9): [True: 576, False: 0]
  ------------------
 1922|    576|    {
 1923|    576|        ip->bCalcInChIHash = INCHIHASH_NONE;
 1924|    576|    }
 1925|      0|    else
 1926|      0|    {
 1927|      0|        ip->bCalcInChIHash = INCHIHASH_KEY;
 1928|      0|    }
 1929|       |    /* Extension(s) to hash (in non-std mode only) ? */
 1930|    576|    if (!bHashKey)
  ------------------
  |  Branch (1930:9): [True: 576, False: 0]
  ------------------
 1931|    576|    {
 1932|    576|        if (( bHashXtra1 != 0 ) || ( bHashXtra2 != 0 ))
  ------------------
  |  Branch (1932:13): [True: 0, False: 576]
  |  Branch (1932:36): [True: 0, False: 576]
  ------------------
 1933|      0|        {
 1934|      0|            inchi_ios_eprint( log_file, "Hash extension(s) not generated: InChIKey not requested" );
 1935|      0|        }
 1936|    576|    }
 1937|      0|    else
 1938|      0|    {
 1939|      0|        if (bHashXtra1)
  ------------------
  |  Branch (1939:13): [True: 0, False: 0]
  ------------------
 1940|      0|        {
 1941|      0|            if (bHashXtra2)
  ------------------
  |  Branch (1941:17): [True: 0, False: 0]
  ------------------
 1942|      0|            {
 1943|      0|                ip->bCalcInChIHash = INCHIHASH_KEY_XTRA1_XTRA2;
 1944|      0|            }
 1945|      0|            else
 1946|      0|            {
 1947|      0|                ip->bCalcInChIHash = INCHIHASH_KEY_XTRA1;
 1948|      0|            }
 1949|      0|        }
 1950|      0|        else if (bHashXtra2)
  ------------------
  |  Branch (1950:18): [True: 0, False: 0]
  ------------------
 1951|      0|        {
 1952|      0|            ip->bCalcInChIHash = INCHIHASH_KEY_XTRA2;
 1953|      0|        }
 1954|      0|    }
 1955|       |
 1956|    576|    ip->bLargeMolecules = bLargeMolecules;
 1957|    576|    ip->bLooseTSACheck  = bLooseTSACheck;
 1958|       |
 1959|    576|    ip->bNPZz			= bNPZz;
 1960|    576|    ip->bStereoAtZz     = bStereoAtZz;  /*STEREO_AT_ZZ;*/
 1961|       |
 1962|    576|    ip->bNoWarnings     = bNoWarnings;
 1963|    576|    ip->bMergeHash      = bMergeHash;
 1964|    576|    ip->bHideInChI      = bHideInChI;
 1965|       |
 1966|    576|    ip->bPolymers       = bPolymers;
 1967|    576|    ip->bFoldPolymerSRU = bFoldPolymerSRU;
 1968|    576|    ip->bFrameShiftScheme = bFrameShiftScheme;
 1969|       |
 1970|       |#ifdef TARGET_LIB_FOR_WINCHI
 1971|       |    ip->bLargeMolecules = 1;
 1972|       |    /*ip->bPolymers = POLYMERS_MODERN; */
 1973|       |    /*ip->bNPZz = 1;*/
 1974|       |    /*ip->bFrameShiftScheme = FSS_NONE;*/
 1975|       |    /*ip->bFoldPolymerSRU = 1;*/
 1976|       |
 1977|       |#if ( UNDERIVATIZE == 1 )
 1978|       |    ip->bUnderivatize = 1;
 1979|       |    if (ip->bUnderivatize)
 1980|       |    {
 1981|       |        ip->bINChIOutputOptions &= ~INCHI_OUT_STDINCHI;
 1982|       |    }
 1983|       |#endif
 1984|       |    ip->bNoWarnings = 0;
 1985|       |    ip->bMergeHash  = 0;
 1986|       |    ip->bHideInChI  = 0;
 1987|       |
 1988|       |#endif
 1989|       |
 1990|    576|    ip->bINChIOutputOptions2 = bINChIOutputOptions2;
 1991|       |
 1992|    576|    return 0;
 1993|    576|}
PrintInputParms:
 2001|    454|{
 2002|       |
 2003|       |#if (BUILD_WITH_ENG_OPTIONS==1)
 2004|       |    const int developer_options = 1;
 2005|       |#else
 2006|    454|    const int developer_options = 0;
 2007|    454|#endif
 2008|       |#ifdef TARGET_LIB_FOR_WINCHI
 2009|       |    int bInChI2Struct = 0; /* winchi-1 can not convert InChI to structure */
 2010|       |#else
 2011|    454|    int bInChI2Struct = ( ip->bReadInChIOptions & READ_INCHI_TO_STRUCTURE ) && ip->nInputType == INPUT_INCHI;
  ------------------
  |  |  988|    454|#define READ_INCHI_TO_STRUCTURE          0x00000008
  ------------------
  |  Branch (2011:25): [True: 227, False: 227]
  |  Branch (2011:80): [True: 227, False: 0]
  ------------------
 2012|    454|#endif
 2013|       |
 2014|    454|    INCHI_MODE nMode = ip->nMode;
 2015|    454|    int k;
 2016|    454|    int bStdFormat = 1;
 2017|    454|    int first = 1;
 2018|       |
 2019|       |
 2020|    454|    if (!( ip->bINChIOutputOptions & INCHI_OUT_STDINCHI ))
  ------------------
  |  |  173|    454|#define INCHI_OUT_STDINCHI 0x4000
  ------------------
  |  Branch (2020:9): [True: 0, False: 454]
  ------------------
 2021|      0|    {
 2022|      0|        bStdFormat = 0;
 2023|      0|    }
 2024|       |    /* Some stereo */
 2025|    454|    if (!( nMode & REQ_MODE_STEREO ))
  ------------------
  |  |   47|    454|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
  |  Branch (2025:9): [True: 0, False: 454]
  ------------------
 2026|      0|    {
 2027|      0|        inchi_ios_eprint( log_file, "Using specific structure perception features:\n" );
 2028|      0|        first = 0;
 2029|      0|        inchi_ios_eprint( log_file, "  Stereo OFF\n" );
 2030|      0|    }
 2031|    454|    else
 2032|    454|    {
 2033|    454|        if (!( TG_FLAG_POINTED_EDGE_STEREO & ip->bTautFlags ))
  ------------------
  |  |  940|    454|#define TG_FLAG_POINTED_EDGE_STEREO      0x00002000   /* only pointed edge of stereo bond defines stereo */
  ------------------
  |  Branch (2033:13): [True: 0, False: 454]
  ------------------
 2034|      0|        {
 2035|      0|            if (first)
  ------------------
  |  Branch (2035:17): [True: 0, False: 0]
  ------------------
 2036|      0|            {
 2037|      0|                inchi_ios_eprint( log_file, "Using specific structure perception features:\n" );
 2038|      0|                first = 0;
 2039|      0|            }
 2040|      0|            inchi_ios_eprint( log_file, "  Both ends of wedge point to stereocenters\n" );
 2041|      0|        }
 2042|    454|    }
 2043|    454|    if (ip->bDoNotAddH)
  ------------------
  |  Branch (2043:9): [True: 0, False: 454]
  ------------------
 2044|      0|    {
 2045|      0|        if (first)
  ------------------
  |  Branch (2045:13): [True: 0, False: 0]
  ------------------
 2046|      0|        {
 2047|      0|            inchi_ios_eprint( log_file, "Using specific structure perception features:\n" );
 2048|      0|        }
 2049|      0|        inchi_ios_eprint( log_file, "  Do not add H\n" );
 2050|      0|    }
 2051|       |
 2052|       |#if ( UNDERIVATIZE == 1 )
 2053|       |    if (ip->bUnderivatize==1)
 2054|       |    {
 2055|       |        inchi_ios_eprint( log_file, "\nConvert input structure to derivative precursor before InChI calculation\n\n" );
 2056|       |    }
 2057|       |    else if (ip->bUnderivatize == 3)
 2058|       |    {
 2059|       |        inchi_ios_eprint( log_file, "\nOutputs derivative information for the input structure\n\n" );
 2060|       |    }
 2061|       |#endif
 2062|       |
 2063|       |
 2064|       |
 2065|       |    /*  Generation/conversion indicator */
 2066|    454|    if (bStdFormat)
  ------------------
  |  Branch (2066:9): [True: 454, False: 0]
  ------------------
 2067|    454|    {
 2068|    454|        if (!( ip->bINChIOutputOptions & INCHI_OUT_SDFILE_ONLY ) && !bInChI2Struct)
  ------------------
  |  |  161|    454|#define INCHI_OUT_SDFILE_ONLY           0x0010   /* save input data in a Molfile instead of creating INChI */
  ------------------
  |  Branch (2068:13): [True: 454, False: 0]
  |  Branch (2068:69): [True: 227, False: 227]
  ------------------
 2069|    227|        {
 2070|    227|            inchi_ios_eprint( log_file, "Generating standard InChI\n" );
 2071|    227|        }
 2072|       |
 2073|       |#if ( !defined(TARGET_API_LIB) && !defined(TARGET_LIB_FOR_WINCHI) && !defined(TARGET_EXE_USING_API) )
 2074|       |        /* effective only in command line program InChI or stdInChI */
 2075|       |        else if (bInChI2Struct)
 2076|       |        {
 2077|       |            inchi_ios_eprint( log_file, "Converting InChI(s) to structure(s) in %s\n",
 2078|       |                ( ip->bINChIOutputOptions & INCHI_OUT_SDFILE_ONLY ) ?
 2079|       |               "MOL format" : "aux. info format" );
 2080|       |        }
 2081|       |#endif
 2082|    454|    }
 2083|      0|    else
 2084|      0|    {
 2085|      0|        inchi_ios_eprint( log_file, "Generating non-standard InChI with the options: \n" );
 2086|      0|    }
 2087|       |
 2088|       |    /* SDfile output */
 2089|    454|    if (ip->bINChIOutputOptions & INCHI_OUT_SDFILE_ONLY)
  ------------------
  |  |  161|    454|#define INCHI_OUT_SDFILE_ONLY           0x0010   /* save input data in a Molfile instead of creating INChI */
  ------------------
  |  Branch (2089:9): [True: 0, False: 454]
  ------------------
 2090|      0|    {
 2091|      0|        inchi_ios_eprint( log_file,
 2092|      0|            "Output SDfile only without stereochemical information and atom coordinates%s\n",
 2093|      0|            ( ip->bINChIOutputOptions & INCHI_OUT_SDFILE_ATOMS_DT ) ?
  ------------------
  |  |  168|      0|#define INCHI_OUT_SDFILE_ATOMS_DT       0x0800   /* SDfile output H isotopes as D and T     */
  ------------------
  |  Branch (2093:13): [True: 0, False: 0]
  ------------------
 2094|      0|            "\n(write H isotopes as D, T)" : "" );
 2095|      0|    }
 2096|       |
 2097|       |    /* Fixed/Mobile H */
 2098|    454|    if (!bStdFormat)
  ------------------
  |  Branch (2098:9): [True: 0, False: 454]
  ------------------
 2099|      0|    {
 2100|      0|        if (( nMode & ( REQ_MODE_BASIC | REQ_MODE_TAUT ) ) == ( REQ_MODE_BASIC | REQ_MODE_TAUT ))
  ------------------
  |  |   43|      0|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
                      if (( nMode & ( REQ_MODE_BASIC | REQ_MODE_TAUT ) ) == ( REQ_MODE_BASIC | REQ_MODE_TAUT ))
  ------------------
  |  |   44|      0|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
                      if (( nMode & ( REQ_MODE_BASIC | REQ_MODE_TAUT ) ) == ( REQ_MODE_BASIC | REQ_MODE_TAUT ))
  ------------------
  |  |   43|      0|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
                      if (( nMode & ( REQ_MODE_BASIC | REQ_MODE_TAUT ) ) == ( REQ_MODE_BASIC | REQ_MODE_TAUT ))
  ------------------
  |  |   44|      0|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
  |  Branch (2100:13): [True: 0, False: 0]
  ------------------
 2101|      0|        {
 2102|      0|            inchi_ios_eprint( log_file, "  Mobile H Perception OFF (include FixedH layer)\n" );
 2103|      0|        }
 2104|      0|        else if (( nMode & ( REQ_MODE_BASIC | REQ_MODE_TAUT ) ) == ( REQ_MODE_TAUT ))
  ------------------
  |  |   43|      0|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
                      else if (( nMode & ( REQ_MODE_BASIC | REQ_MODE_TAUT ) ) == ( REQ_MODE_TAUT ))
  ------------------
  |  |   44|      0|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
                      else if (( nMode & ( REQ_MODE_BASIC | REQ_MODE_TAUT ) ) == ( REQ_MODE_TAUT ))
  ------------------
  |  |   44|      0|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
  |  Branch (2104:18): [True: 0, False: 0]
  ------------------
 2105|      0|        {
 2106|      0|            inchi_ios_eprint( log_file, "  Mobile H Perception ON  (omit FixedH layer)\n" );
 2107|      0|        }
 2108|      0|        else if (( nMode & ( REQ_MODE_BASIC | REQ_MODE_TAUT ) ) == ( REQ_MODE_BASIC ))
  ------------------
  |  |   43|      0|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
                      else if (( nMode & ( REQ_MODE_BASIC | REQ_MODE_TAUT ) ) == ( REQ_MODE_BASIC ))
  ------------------
  |  |   44|      0|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
                      else if (( nMode & ( REQ_MODE_BASIC | REQ_MODE_TAUT ) ) == ( REQ_MODE_BASIC ))
  ------------------
  |  |   43|      0|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
  |  Branch (2108:18): [True: 0, False: 0]
  ------------------
 2109|      0|        {
 2110|      0|            inchi_ios_eprint( log_file, "  Mobile H ignored\n" );
 2111|      0|        }
 2112|      0|        else
 2113|      0|        {
 2114|      0|            inchi_ios_eprint( log_file, "  Undefined Mobile H mode\n" );
 2115|      0|        }
 2116|       |
 2117|      0|        if (( ip->bTautFlags & TG_FLAG_VARIABLE_PROTONS ))
  ------------------
  |  |  938|      0|#define TG_FLAG_VARIABLE_PROTONS         0x00000800   /* add/remove protons to neutralize */
  ------------------
  |  Branch (2117:13): [True: 0, False: 0]
  ------------------
 2118|      0|        {
 2119|      0|            if (!( ip->bTautFlags & TG_FLAG_HARD_ADD_REM_PROTONS ))
  ------------------
  |  |  939|      0|#define TG_FLAG_HARD_ADD_REM_PROTONS     0x00001000   /* add/remove protons to neutralize in hard way */
  ------------------
  |  Branch (2119:17): [True: 0, False: 0]
  ------------------
 2120|      0|            {
 2121|      0|                inchi_ios_eprint( log_file, "  Disabled Aggressive (De)protonation\n" );
 2122|      0|            }
 2123|      0|        }
 2124|       |
 2125|       |#if ( FIND_RING_SYSTEMS != 1 )
 2126|       |        inchi_ios_eprint( log_file, "  %s5-, 6-, 7-memb. ring taut. ignored\n", i ? "; " : "" );
 2127|       |#endif
 2128|       |
 2129|       |        /* RecMet */
 2130|      0|        if (ip->bTautFlags & TG_FLAG_DISCONNECT_COORD)
  ------------------
  |  |  934|      0|#define TG_FLAG_DISCONNECT_COORD         0x00000080   /* find "coord. centers" and disconnect them */
  ------------------
  |  Branch (2130:13): [True: 0, False: 0]
  ------------------
 2131|      0|        {
 2132|      0|            if (ip->bTautFlags & TG_FLAG_RECONNECT_COORD)
  ------------------
  |  |  935|      0|#define TG_FLAG_RECONNECT_COORD          0x00000100   /* reconnect disconnected "coord. centers" */
  ------------------
  |  Branch (2132:17): [True: 0, False: 0]
  ------------------
 2133|      0|            {
 2134|      0|                inchi_ios_eprint( log_file, "  Include bonds to metals\n" );
 2135|      0|            }
 2136|      0|            else
 2137|      0|            {
 2138|      0|                inchi_ios_eprint( log_file, "  Do not reconnect metals (omit RecMet layer)\n" );
 2139|      0|            }
 2140|      0|        }
 2141|      0|        else
 2142|      0|        {
 2143|      0|            inchi_ios_eprint( log_file, "  Do not disconnect metals\n" );
 2144|      0|        }
 2145|       |
 2146|       |        /* Isotopic - always ON, output disabled. 09-17-2009*/
 2147|       |        /*
 2148|       |        if ( nMode & REQ_MODE_ISO )
 2149|       |        inchi_ios_eprint( log_file, "  Isotopic ON\n");
 2150|       |        else if ( nMode & REQ_MODE_NON_ISO )
 2151|       |        inchi_ios_eprint( log_file, "  Isotopic OFF\n");
 2152|       |        */
 2153|       |
 2154|       |#if ( FIX_ADJ_RAD == 1 )
 2155|       |        if (ip->bTautFlags & TG_FLAG_FIX_ADJ_RADICALS)
 2156|       |        {
 2157|       |            inchi_ios_eprint( log_file, "Fix Adjacent Radicals\n" );
 2158|       |        }
 2159|       |#endif
 2160|       |
 2161|       |        /* Stereo */
 2162|      0|        if (nMode & REQ_MODE_STEREO)
  ------------------
  |  |   47|      0|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
  |  Branch (2162:13): [True: 0, False: 0]
  ------------------
 2163|      0|        {
 2164|      0|            inchi_ios_eprint( log_file, "  %s%s%s%sStereo ON\n",
 2165|      0|                ( nMode & REQ_MODE_NOEQ_STEREO ) ? "Slow " : "",
  ------------------
  |  |   49|      0|#define REQ_MODE_NOEQ_STEREO        0x000040    /* SS   */
  ------------------
  |  Branch (2165:17): [True: 0, False: 0]
  ------------------
 2166|      0|                ( nMode & REQ_MODE_REDNDNT_STEREO ) ? "Redund. " : "",
  ------------------
  |  |   50|      0|#define REQ_MODE_REDNDNT_STEREO     0x000080    /* RS   */
  ------------------
  |  Branch (2166:17): [True: 0, False: 0]
  ------------------
 2167|      0|                ( nMode & REQ_MODE_NO_ALT_SBONDS ) ? "No AltBond " : "",
  ------------------
  |  |   51|      0|#define REQ_MODE_NO_ALT_SBONDS      0x000100    /* NASB */
  ------------------
  |  Branch (2167:17): [True: 0, False: 0]
  ------------------
 2168|       |
 2169|      0|                ( nMode & REQ_MODE_RACEMIC_STEREO ) ? "Racemic " :
  ------------------
  |  |   56|      0|#define REQ_MODE_RACEMIC_STEREO     0x000400    /* RAC All Racemic Stereo */
  ------------------
  |  Branch (2169:17): [True: 0, False: 0]
  ------------------
 2170|      0|                ( nMode &  REQ_MODE_RELATIVE_STEREO ) ? "Relative " :
  ------------------
  |  |   54|      0|#define REQ_MODE_RELATIVE_STEREO    0x000200    /* REL All Relative Stereo */
  ------------------
  |  Branch (2170:17): [True: 0, False: 0]
  ------------------
 2171|      0|                ( nMode &  REQ_MODE_CHIR_FLG_STEREO ) ? "Chiral Flag " : "Absolute " );
  ------------------
  |  |   62|      0|#define REQ_MODE_CHIR_FLG_STEREO    0x002000    /* SUCF  If Chiral flag then Abs otherwise Rel stereo */
  ------------------
  |  Branch (2171:17): [True: 0, False: 0]
  ------------------
 2172|       |
 2173|      0|            if (0 == ( nMode & ( REQ_MODE_SB_IGN_ALL_UU | REQ_MODE_SC_IGN_ALL_UU ) ))
  ------------------
  |  |   60|      0|#define REQ_MODE_SB_IGN_ALL_UU      0x001000    /* IAUSC Ignore stereobonds if All Undef/Unknown */
  ------------------
                          if (0 == ( nMode & ( REQ_MODE_SB_IGN_ALL_UU | REQ_MODE_SC_IGN_ALL_UU ) ))
  ------------------
  |  |   58|      0|#define REQ_MODE_SC_IGN_ALL_UU      0x000800    /* IAUSC Ignore stereocenters if All Undef/Unknown */
  ------------------
  |  Branch (2173:17): [True: 0, False: 0]
  ------------------
 2174|      0|            {
 2175|      0|                inchi_ios_eprint( log_file, "  Include undefined/unknown stereogenic centers and bonds\n" );
 2176|      0|            }
 2177|      0|            else if (REQ_MODE_SC_IGN_ALL_UU == ( nMode & ( REQ_MODE_SB_IGN_ALL_UU | REQ_MODE_SC_IGN_ALL_UU ) ))
  ------------------
  |  |   58|      0|#define REQ_MODE_SC_IGN_ALL_UU      0x000800    /* IAUSC Ignore stereocenters if All Undef/Unknown */
  ------------------
                          else if (REQ_MODE_SC_IGN_ALL_UU == ( nMode & ( REQ_MODE_SB_IGN_ALL_UU | REQ_MODE_SC_IGN_ALL_UU ) ))
  ------------------
  |  |   60|      0|#define REQ_MODE_SB_IGN_ALL_UU      0x001000    /* IAUSC Ignore stereobonds if All Undef/Unknown */
  ------------------
                          else if (REQ_MODE_SC_IGN_ALL_UU == ( nMode & ( REQ_MODE_SB_IGN_ALL_UU | REQ_MODE_SC_IGN_ALL_UU ) ))
  ------------------
  |  |   58|      0|#define REQ_MODE_SC_IGN_ALL_UU      0x000800    /* IAUSC Ignore stereocenters if All Undef/Unknown */
  ------------------
  |  Branch (2177:22): [True: 0, False: 0]
  ------------------
 2178|      0|            {
 2179|      0|                inchi_ios_eprint( log_file, "  Omit undefined/unknown stereogenic centers\n" );
 2180|      0|            }
 2181|      0|            else if (REQ_MODE_SB_IGN_ALL_UU == ( nMode & ( REQ_MODE_SB_IGN_ALL_UU | REQ_MODE_SC_IGN_ALL_UU ) ))
  ------------------
  |  |   60|      0|#define REQ_MODE_SB_IGN_ALL_UU      0x001000    /* IAUSC Ignore stereobonds if All Undef/Unknown */
  ------------------
                          else if (REQ_MODE_SB_IGN_ALL_UU == ( nMode & ( REQ_MODE_SB_IGN_ALL_UU | REQ_MODE_SC_IGN_ALL_UU ) ))
  ------------------
  |  |   60|      0|#define REQ_MODE_SB_IGN_ALL_UU      0x001000    /* IAUSC Ignore stereobonds if All Undef/Unknown */
  ------------------
                          else if (REQ_MODE_SB_IGN_ALL_UU == ( nMode & ( REQ_MODE_SB_IGN_ALL_UU | REQ_MODE_SC_IGN_ALL_UU ) ))
  ------------------
  |  |   58|      0|#define REQ_MODE_SC_IGN_ALL_UU      0x000800    /* IAUSC Ignore stereocenters if All Undef/Unknown */
  ------------------
  |  Branch (2181:22): [True: 0, False: 0]
  ------------------
 2182|      0|            {
 2183|      0|                inchi_ios_eprint( log_file, "  Omit undefined/unknown stereogenic bonds\n" );
 2184|      0|            }
 2185|      0|            else
 2186|      0|            {
 2187|       |                /*case REQ_MODE_SB_IGN_ALL_UU | REQ_MODE_SC_IGN_ALL_UU*/
 2188|      0|                inchi_ios_eprint( log_file, "  Omit undefined/unknown stereogenic centers and bonds\n" );
 2189|      0|            }
 2190|      0|            if (0 != ( nMode & REQ_MODE_DIFF_UU_STEREO ))
  ------------------
  |  |   68|      0|#define REQ_MODE_DIFF_UU_STEREO     0x004000    /* SLUUD Make labels for unknown and undefined stereo different */
  ------------------
  |  Branch (2190:17): [True: 0, False: 0]
  ------------------
 2191|      0|            {
 2192|      0|                inchi_ios_eprint( log_file, "  Make labels for unknown and undefined stereo different\n" );
 2193|      0|            }
 2194|       |
 2195|      0|#if ( defined(MIN_SB_RING_SIZE) && MIN_SB_RING_SIZE > 0 )
 2196|      0|            k = ( ip->nMode & REQ_MODE_MIN_SB_RING_MASK ) >> REQ_MODE_MIN_SB_RING_SHFT;
  ------------------
  |  |   71|      0|#define REQ_MODE_MIN_SB_RING_MASK   0x0F0000    /* RSB  */
  ------------------
                          k = ( ip->nMode & REQ_MODE_MIN_SB_RING_MASK ) >> REQ_MODE_MIN_SB_RING_SHFT;
  ------------------
  |  |   72|      0|#define REQ_MODE_MIN_SB_RING_SHFT      16
  ------------------
 2197|      0|            if (bRELEASE_VERSION != 1 || k != MIN_SB_RING_SIZE)
  ------------------
  |  |  262|      0|#define bRELEASE_VERSION  1    /* 1=> release version; comment out to disable */
  ------------------
                          if (bRELEASE_VERSION != 1 || k != MIN_SB_RING_SIZE)
  ------------------
  |  |  597|      0|#define MIN_SB_RING_SIZE            8    /* do not assume stereo bonds in rings containing 3..MIN_SB_RING_SIZE-1 atoms */
  ------------------
  |  Branch (2197:17): [Folded - Ignored]
  |  Branch (2197:42): [True: 0, False: 0]
  ------------------
 2198|      0|            {
 2199|      0|                if (k >= 3)
  ------------------
  |  Branch (2199:21): [True: 0, False: 0]
  ------------------
 2200|      0|                {
 2201|      0|                    inchi_ios_eprint( log_file, "  Min. stereobond ring size: %d\n", k );
 2202|      0|                }
 2203|      0|                else
 2204|      0|                {
 2205|      0|                    inchi_ios_eprint( log_file, "  Min. stereobond ring size: NONE\n" );
 2206|      0|                }
 2207|      0|            }
 2208|      0|#endif
 2209|      0|        }   /* Stereo */
 2210|      0|    }   /* !bStdFormat */
 2211|       |
 2212|    454|    if (!bStdFormat)
  ------------------
  |  Branch (2212:9): [True: 0, False: 454]
  ------------------
 2213|      0|    {
 2214|      0|        if (TG_FLAG_KETO_ENOL_TAUT & ip->bTautFlags)
  ------------------
  |  |  949|      0|#define TG_FLAG_KETO_ENOL_TAUT           0x00080000   /* turn on keto-enol tautomerism detection */
  ------------------
  |  Branch (2214:13): [True: 0, False: 0]
  ------------------
 2215|      0|        {
 2216|      0|            inchi_ios_eprint( log_file, "  Account for keto-enol tautomerism\n" );
 2217|      0|        }
 2218|      0|        else
 2219|      0|        {
 2220|      0|            inchi_ios_eprint( log_file, "  Do not account for keto-enol tautomerism\n" );
 2221|      0|        }
 2222|      0|        if (TG_FLAG_1_5_TAUT & ip->bTautFlags)
  ------------------
  |  |  950|      0|#define TG_FLAG_1_5_TAUT                 0x00100000   /* turn on 1,5 tautomerism detection */
  ------------------
  |  Branch (2222:13): [True: 0, False: 0]
  ------------------
 2223|      0|        {
 2224|      0|            inchi_ios_eprint( log_file, "  Account for 1,5-tautomerism\n" );
 2225|      0|        }
 2226|      0|        else
 2227|      0|        {
 2228|      0|            inchi_ios_eprint( log_file, "  Do not account for 1,5-tautomerism\n" );
 2229|      0|        }
 2230|       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
 2231|      0|        if (developer_options)
  ------------------
  |  Branch (2231:13): [Folded - Ignored]
  ------------------
 2232|      0|        {
 2233|      0|            if (TG_FLAG_PHOSPHINE_STEREO & ip->bTautFlags)
  ------------------
  |  |  944|      0|#define TG_FLAG_PHOSPHINE_STEREO         0x00008000   /* add phosphine sp3 stereo */
  ------------------
  |  Branch (2233:17): [True: 0, False: 0]
  ------------------
 2234|      0|            {
 2235|      0|                inchi_ios_eprint( log_file, "  Include phosphine stereochemistry\n" );
 2236|      0|            }
 2237|      0|            else
 2238|      0|            {
 2239|      0|                inchi_ios_eprint( log_file, "  Do not include phosphine stereochemistry\n" );
 2240|      0|            }
 2241|      0|            if (TG_FLAG_ARSINE_STEREO & ip->bTautFlags)
  ------------------
  |  |  945|      0|#define TG_FLAG_ARSINE_STEREO            0x00010000   /* add arsine sp3 stereo */
  ------------------
  |  Branch (2241:17): [True: 0, False: 0]
  ------------------
 2242|      0|            {
 2243|      0|                inchi_ios_eprint( log_file, "  Include arsine stereochemistry\n" );
 2244|      0|            }
 2245|      0|            else
 2246|      0|            {
 2247|      0|                inchi_ios_eprint( log_file, "  Do not include arsine stereochemistry\n" );
 2248|      0|            }
 2249|      0|            if (!( TG_FLAG_FIX_SP3_BUG & ip->bTautFlags ))
  ------------------
  |  |  947|      0|#define TG_FLAG_FIX_SP3_BUG              0x00040000   /* fix sp3 stereo bug: overlapping 2D stereo bond & coordinate scaling */
  ------------------
  |  Branch (2249:17): [True: 0, False: 0]
  ------------------
 2250|      0|            {
 2251|      0|                inchi_ios_eprint( log_file, "  Turned OFF fix of bug leading to missing or undefined sp3 parity\n" );
 2252|      0|            }
 2253|      0|            if (!( TG_FLAG_FIX_ISO_FIXEDH_BUG & ip->bTautFlags ))
  ------------------
  |  |  953|      0|#define TG_FLAG_FIX_ISO_FIXEDH_BUG       0x00200000   /* fix bug found after v.102b (isotopic H representation)  */
  ------------------
  |  Branch (2253:17): [True: 0, False: 0]
  ------------------
 2254|      0|            {
 2255|      0|                inchi_ios_eprint( log_file, "  Turned OFF bug-fixes found after v.1.02b release\n" );
 2256|      0|            }
 2257|      0|            if (!( ip->bFixNonUniformDraw ))
  ------------------
  |  Branch (2257:17): [True: 0, False: 0]
  ------------------
 2258|      0|            {
 2259|      0|                inchi_ios_eprint( log_file, "  Turned OFF fixes of non-uniform drawing issues\n" );
 2260|      0|            }
 2261|      0|            if (!( TG_FLAG_MOVE_POS_CHARGES & ip->bTautFlags ))
  ------------------
  |  |  924|      0|#define TG_FLAG_MOVE_POS_CHARGES         0x00000008   /* MOVE_CHARGES allow long-range movement of N(+), P(+) charges           */
  ------------------
  |  Branch (2261:17): [True: 0, False: 0]
  ------------------
 2262|      0|            {
 2263|      0|                inchi_ios_eprint( log_file, "  MovePos turned OFF\n" );
 2264|      0|            }
 2265|      0|        }
 2266|       |
 2267|      0|    } /* !bStdFormat */
 2268|       |
 2269|    454|    if (ip->bCalcInChIHash != INCHIHASH_NONE)
  ------------------
  |  Branch (2269:9): [True: 0, False: 454]
  ------------------
 2270|      0|    {
 2271|      0|        if (bStdFormat)
  ------------------
  |  Branch (2271:13): [True: 0, False: 0]
  ------------------
 2272|      0|        {
 2273|      0|            inchi_ios_eprint( log_file, "Generating standard InChIKey\n" );
 2274|      0|        }
 2275|      0|        else
 2276|      0|        {
 2277|      0|            inchi_ios_eprint( log_file, "Generating InChIKey\n" );
 2278|      0|        }
 2279|      0|        if (ip->bCalcInChIHash == INCHIHASH_KEY_XTRA1)
  ------------------
  |  Branch (2279:13): [True: 0, False: 0]
  ------------------
 2280|      0|        {
 2281|      0|            inchi_ios_eprint( log_file, "Generating hash extension (1st block)\n" );
 2282|      0|        }
 2283|      0|        else if (ip->bCalcInChIHash == INCHIHASH_KEY_XTRA2)
  ------------------
  |  Branch (2283:18): [True: 0, False: 0]
  ------------------
 2284|      0|        {
 2285|      0|            inchi_ios_eprint( log_file, "Generating hash extension (2nd block)\n" );
 2286|      0|        }
 2287|      0|        else if (ip->bCalcInChIHash == INCHIHASH_KEY_XTRA1_XTRA2)
  ------------------
  |  Branch (2287:18): [True: 0, False: 0]
  ------------------
 2288|      0|        {
 2289|      0|            inchi_ios_eprint( log_file, "Generating hash extension (two blocks)\n" );
 2290|      0|        }
 2291|      0|    }
 2292|       |
 2293|    454|    if (ip->bINChIOutputOptions & INCHI_OUT_SAVEOPT)
  ------------------
  |  |  174|    454|#define INCHI_OUT_SAVEOPT  0x8000
  ------------------
  |  Branch (2293:9): [True: 0, False: 454]
  ------------------
 2294|      0|    {
 2295|      0|        inchi_ios_eprint( log_file, "Saving InChI creation options" );
 2296|      0|        if (bStdFormat)
  ------------------
  |  Branch (2296:13): [True: 0, False: 0]
  ------------------
 2297|      0|        {
 2298|      0|            inchi_ios_eprint( log_file, " suppressed for standard InChI" );
 2299|       |            /* NB: actual suppression takes place on InChI serialization */
 2300|       |            /* (as on e.g. Inchi2Inchi conversion it may appear that we create non-std */
 2301|       |            /*  InChI instead of standard one) */
 2302|      0|        }
 2303|      0|        inchi_ios_eprint( log_file, "\n" );
 2304|      0|    }
 2305|       |
 2306|    454|    if (ip->bAllowEmptyStructure)
  ------------------
  |  Branch (2306:9): [True: 0, False: 454]
  ------------------
 2307|      0|    {
 2308|      0|        inchi_ios_eprint( log_file, "Issue warning on empty structure\n" );
 2309|      0|    }
 2310|       |
 2311|       |    /* Input */
 2312|    454|    if (ip->nInputType)
  ------------------
  |  Branch (2312:9): [True: 454, False: 0]
  ------------------
 2313|    454|    {
 2314|    454|        inchi_ios_eprint( log_file, "Input format: %s",
 2315|    454|                                    ip->nInputType == INPUT_MOLFILE ? "MOLfile" :
  ------------------
  |  Branch (2315:37): [True: 0, False: 454]
  ------------------
 2316|    454|                                    ip->nInputType == INPUT_SDFILE ? "SDfile" :
  ------------------
  |  Branch (2316:37): [True: 0, False: 454]
  ------------------
 2317|    454|#if ( READ_INCHI_STRING == 1 )
 2318|    454|            ip->nInputType == INPUT_INCHI ? "InChI (plain identifier)" :
  ------------------
  |  Branch (2318:13): [True: 454, False: 0]
  ------------------
 2319|    454|#endif
 2320|    454|            ip->nInputType == INPUT_INCHI_PLAIN ? "InChI AuxInfo (plain)" : "Unknown" );
  ------------------
  |  Branch (2320:13): [True: 0, False: 0]
  ------------------
 2321|    454|        if (( ip->nInputType == INPUT_MOLFILE || ip->nInputType == INPUT_SDFILE ) &&
  ------------------
  |  Branch (2321:15): [True: 0, False: 454]
  |  Branch (2321:50): [True: 0, False: 454]
  ------------------
 2322|    454|            ip->bGetMolfileNumber)
  ------------------
  |  Branch (2322:13): [True: 0, False: 0]
  ------------------
 2323|      0|        {
 2324|      0|            inchi_ios_eprint( log_file, "  (attempting to read Molfile number)" );
 2325|      0|        }
 2326|    454|        inchi_ios_eprint( log_file, "\n" );
 2327|    454|    }
 2328|       |
 2329|    454|    if (ip->szSdfDataHeader[0] && ip->nInputType != INPUT_SDFILE)
  ------------------
  |  Branch (2329:9): [True: 0, False: 454]
  |  Branch (2329:35): [True: 0, False: 0]
  ------------------
 2330|      0|    {
 2331|      0|        inchi_ios_eprint( log_file, "  SDfile data header: \"%s\"\n", ip->szSdfDataHeader );
 2332|      0|    }
 2333|       |
 2334|       |    /* Output */
 2335|    454|    inchi_ios_eprint( log_file, "Output format: %s%s\n",
 2336|    454|                            ( ip->bINChIOutputOptions & INCHI_OUT_PLAIN_TEXT ) ? "Plain text" :
  ------------------
  |  |  163|    454|#define INCHI_OUT_PLAIN_TEXT            0x0040   /* output plain text INChI                 */
  ------------------
  |  Branch (2336:29): [True: 454, False: 0]
  ------------------
 2337|       |
 2338|    454|                            ( ( ip->bINChIOutputOptions & INCHI_OUT_SDFILE_ONLY ) && bInChI2Struct ) ? "SDfile only (without stereochemical info and atom coordinates)" :
  ------------------
  |  |  161|      0|#define INCHI_OUT_SDFILE_ONLY           0x0010   /* save input data in a Molfile instead of creating INChI */
  ------------------
  |  Branch (2338:31): [True: 0, False: 0]
  |  Branch (2338:86): [True: 0, False: 0]
  ------------------
 2339|      0|                            ( ( ip->bINChIOutputOptions & INCHI_OUT_SDFILE_ONLY ) && !bInChI2Struct ) ? "SDfile only" : "Unknown",
  ------------------
  |  |  161|      0|#define INCHI_OUT_SDFILE_ONLY           0x0010   /* save input data in a Molfile instead of creating INChI */
  ------------------
  |  Branch (2339:31): [True: 0, False: 0]
  |  Branch (2339:86): [True: 0, False: 0]
  ------------------
 2340|       |
 2341|    454|                            ( ( ip->bINChIOutputOptions & INCHI_OUT_PLAIN_TEXT ) &&
  ------------------
  |  |  163|    454|#define INCHI_OUT_PLAIN_TEXT            0x0040   /* output plain text INChI                 */
  ------------------
  |  Branch (2341:31): [True: 454, False: 0]
  ------------------
 2342|    454|                            ( ip->bINChIOutputOptions & INCHI_OUT_TABBED_OUTPUT ) ) ? ", tabbed" : "" );
  ------------------
  |  |  167|    454|#define INCHI_OUT_TABBED_OUTPUT         0x0400   /* tab-delimited (only for plain text)     */
  ------------------
  |  Branch (2342:29): [True: 0, False: 454]
  ------------------
 2343|       |
 2344|    454|#if ( bRELEASE_VERSION == 1 )
 2345|    454|    if (ip->bCtPredecessors || ip->bAbcNumbers)
  ------------------
  |  Branch (2345:9): [True: 0, False: 454]
  |  Branch (2345:32): [True: 0, False: 454]
  ------------------
 2346|      0|    {
 2347|      0|        if (ip->bCtPredecessors && ip->bAbcNumbers)
  ------------------
  |  Branch (2347:13): [True: 0, False: 0]
  |  Branch (2347:36): [True: 0, False: 0]
  ------------------
 2348|      0|        {
 2349|      0|            inchi_ios_eprint( log_file, "Representation: Compressed\n" );
 2350|      0|        }
 2351|      0|        else
 2352|      0|        {
 2353|      0|            inchi_ios_eprint( log_file, "Connection table: %s, %s\n",
 2354|      0|             ip->bCtPredecessors ? "Predecessor_numbers(closures)" : "Canon_numbers(branching, ring closures)",
  ------------------
  |  Branch (2354:14): [True: 0, False: 0]
  ------------------
 2355|      0|             ip->bAbcNumbers ? "Shorter alternative" : "Numerical" );
  ------------------
  |  Branch (2355:14): [True: 0, False: 0]
  ------------------
 2356|      0|        }
 2357|      0|    }
 2358|       |#else
 2359|       |    if (( bRELEASE_VERSION != 1 ) || ip->bCtPredecessors || ip->bAbcNumbers)
 2360|       |    {
 2361|       |        inchi_ios_eprint( log_file, "Connection table: %s, %s\n",
 2362|       |               ip->bCtPredecessors ? "Predecessor_numbers(closures)" : "Canon_numbers(branching, ring closures)",
 2363|       |               ip->bAbcNumbers ? "Shorter alternative" : "Numerical" );
 2364|       |    }
 2365|       |    else
 2366|       |    {
 2367|       |        inchi_ios_eprint( log_file, "Representation: Numerical" );
 2368|       |    }
 2369|       |#endif
 2370|       |
 2371|    454|    if (ip->bNoWarnings)
  ------------------
  |  Branch (2371:9): [True: 0, False: 454]
  ------------------
 2372|      0|    {
 2373|      0|        inchi_ios_eprint( log_file, "Warnings suppressed\n" );
 2374|      0|    }
 2375|       |
 2376|    454|    if (ip->bHideInChI)
  ------------------
  |  Branch (2376:9): [True: 0, False: 454]
  ------------------
 2377|      0|    {
 2378|      0|        inchi_ios_eprint( log_file, "Printing InChI string itself suppressed\n" );
 2379|      0|    }
 2380|    454|    if (ip->bMergeHash)
  ------------------
  |  Branch (2380:9): [True: 0, False: 454]
  ------------------
 2381|      0|    {
 2382|      0|        inchi_ios_eprint( log_file, "InChIKey combined with extra hash(es)\n" );
 2383|      0|    }
 2384|       |
 2385|       |
 2386|       |
 2387|    454|    if (!( ip->bINChIOutputOptions & INCHI_OUT_SDFILE_ONLY ))
  ------------------
  |  |  161|    454|#define INCHI_OUT_SDFILE_ONLY           0x0010   /* save input data in a Molfile instead of creating INChI */
  ------------------
  |  Branch (2387:9): [True: 454, False: 0]
  ------------------
 2388|    454|    {
 2389|    454|        if (ip->bINChIOutputOptions & INCHI_OUT_NO_AUX_INFO)
  ------------------
  |  |  157|    454|#define INCHI_OUT_NO_AUX_INFO           0x0001   /* do not output Aux Info                  */
  ------------------
  |  Branch (2389:13): [True: 454, False: 0]
  ------------------
 2390|    454|        {
 2391|    454|            inchi_ios_eprint( log_file, "Aux. info suppressed\n" );
 2392|    454|        }
 2393|      0|        else if (ip->bINChIOutputOptions & INCHI_OUT_SHORT_AUX_INFO)
  ------------------
  |  |  158|      0|#define INCHI_OUT_SHORT_AUX_INFO        0x0002   /* output short version of Aux Info        */
  ------------------
  |  Branch (2393:18): [True: 0, False: 0]
  ------------------
 2394|      0|        {
 2395|      0|            inchi_ios_eprint( log_file, "Minimal Aux. info\n" );
 2396|      0|        }
 2397|      0|        else
 2398|      0|        {
 2399|      0|            inchi_ios_eprint( log_file, "Full Aux. info\n" );
 2400|      0|        }
 2401|    454|    }
 2402|    454|    if (ip->first_struct_number > 1)
  ------------------
  |  Branch (2402:9): [True: 0, False: 454]
  ------------------
 2403|      0|    {
 2404|      0|        inchi_ios_eprint( log_file, "Skipping %ld structure%s\n", ip->first_struct_number - 1, ip->first_struct_number == 2 ? "" : "s" );
  ------------------
  |  Branch (2404:96): [True: 0, False: 0]
  ------------------
 2405|      0|    }
 2406|    454|    if (ip->last_struct_number > 0)
  ------------------
  |  Branch (2406:9): [True: 0, False: 454]
  ------------------
 2407|      0|    {
 2408|      0|        inchi_ios_eprint( log_file, "Terminate after structure #%ld\n", ip->last_struct_number );
 2409|      0|    }
 2410|    454|    if (ip->bSaveWarningStructsAsProblem && ip->path[3] && ip->path[3][0])
  ------------------
  |  Branch (2410:9): [True: 0, False: 454]
  |  Branch (2410:45): [True: 0, False: 0]
  |  Branch (2410:60): [True: 0, False: 0]
  ------------------
 2411|      0|    {
 2412|      0|        inchi_ios_eprint( log_file, "Saving warning structures into the problem file\n" );
 2413|      0|    }
 2414|    454|    if (ip->bSaveAllGoodStructsAsProblem && ip->path[3] && ip->path[3][0])
  ------------------
  |  Branch (2414:9): [True: 0, False: 454]
  |  Branch (2414:45): [True: 0, False: 0]
  |  Branch (2414:60): [True: 0, False: 0]
  ------------------
 2415|      0|    {
 2416|      0|        inchi_ios_eprint( log_file, "Saving only all good structures into the problem file\n" );
 2417|      0|    }
 2418|       |
 2419|    454|    if (ip->bINChIOutputOptions2 & INCHI_OUT_INCHI_GEN_ERROR)
  ------------------
  |  |  177|    454|#define INCHI_OUT_INCHI_GEN_ERROR        0x0001 /* v. 1.05 */
  ------------------
  |  Branch (2419:9): [True: 0, False: 454]
  ------------------
 2420|      0|    {
 2421|      0|        inchi_ios_eprint(log_file, "Print empty InChI if generation fails\n");
 2422|      0|    }
 2423|    454|    if (ip->bINChIOutputOptions2 & INCHI_OUT_MISMATCH_AS_ERROR)
  ------------------
  |  |  178|    454|#define INCHI_OUT_MISMATCH_AS_ERROR      0x0002 /* v. 1.05 */
  ------------------
  |  Branch (2423:9): [True: 0, False: 454]
  ------------------
 2424|      0|    {
 2425|      0|        inchi_ios_eprint(log_file, "Consider problem/mismatch on InChI conversion as error\n");
 2426|      0|    }
 2427|    454|    if (ip->msec_MaxTime)
  ------------------
  |  Branch (2427:9): [True: 0, False: 454]
  ------------------
 2428|      0|    {
 2429|      0|        inchi_ios_eprint(log_file, "Timeout per structure: %ld msec\n", ip->msec_MaxTime);
 2430|       |        /*
 2431|       |        unsigned long seconds = ip->msec_MaxTime / 1000;
 2432|       |        unsigned long milliseconds = (ip->msec_MaxTime%1000);
 2433|       |        inchi_ios_eprint( log_file, "Timeout per structure: %lu/*.%03lu sec\n", seconds, milliseconds);
 2434|       |        inchi_ios_eprint( log_file, "Timeout per structure: %lu sec\n", seconds );
 2435|       |        */
 2436|      0|    }
 2437|    454|    else
 2438|    454|    {
 2439|    454|        inchi_ios_eprint(log_file, "No timeout\n");
 2440|    454|    }
 2441|       |
 2442|    454|    if (ip->bLooseTSACheck)
  ------------------
  |  Branch (2442:9): [True: 0, False: 454]
  ------------------
 2443|      0|    {
 2444|      0|        inchi_ios_eprint(log_file, "Relax criteria of ambiguous drawing for in-ring stereo centers\n");
 2445|      0|    }
 2446|       |
 2447|    454|    {
 2448|    454|        int maxna = NORMALLY_ALLOWED_INP_MAX_ATOMS;
  ------------------
  |  |   44|    454|#define NORMALLY_ALLOWED_INP_MAX_ATOMS 1024
  ------------------
 2449|    454|        if (ip->bLargeMolecules)
  ------------------
  |  Branch (2449:13): [True: 0, False: 454]
  ------------------
 2450|      0|        {
 2451|      0|            inchi_ios_eprint(log_file, "Experimental mode: ");
 2452|      0|            maxna = MAX_ATOMS;
  ------------------
  |  |   43|      0|#define MAX_ATOMS  32766
  ------------------
 2453|      0|        }
 2454|    454|        inchi_ios_eprint(log_file, "Up to %d atoms per structure\n", maxna);
 2455|    454|    }
 2456|       |
 2457|    454|    if (ip->bPolymers != POLYMERS_NO)
  ------------------
  |  | 1197|    454|#define POLYMERS_NO 0		/* ignore polymers										*/
  ------------------
  |  Branch (2457:9): [True: 0, False: 454]
  ------------------
 2458|      0|    {
 2459|      0|        inchi_ios_eprint(log_file, "Experimental mode: Treating polymers");
 2460|       |
 2461|      0|        if (ip->bPolymers == POLYMERS_MODERN)
  ------------------
  |  | 1198|      0|#define POLYMERS_MODERN 1	/* current (1.06) way to treat polymers with Zz			*/
  ------------------
  |  Branch (2461:13): [True: 0, False: 0]
  ------------------
 2462|      0|        {
 2463|      0|            ;
 2464|      0|        }
 2465|      0|        else if (ip->bPolymers == POLYMERS_LEGACY)
  ------------------
  |  | 1199|      0|#define POLYMERS_LEGACY 2	/* 1.05 mode, no explicit Zz (internally they are here) */
  ------------------
  |  Branch (2465:18): [True: 0, False: 0]
  ------------------
 2466|      0|        {
 2467|      0|            inchi_ios_eprint(log_file, " (v. 1.05 legacy mode)");
 2468|      0|        }
 2469|      0|        else if (ip->bPolymers == POLYMERS_LEGACY_PLUS)
  ------------------
  |  | 1200|      0|#define POLYMERS_LEGACY_PLUS 3	/* 1.05 mode with an addition of that in all
  ------------------
  |  Branch (2469:18): [True: 0, False: 0]
  ------------------
 2470|      0|        {
 2471|      0|            inchi_ios_eprint(log_file, " (v. 1.05 legacy mode with senior link placed at start)");
 2472|      0|        }
 2473|      0|        if (ip->bFoldPolymerSRU)
  ------------------
  |  Branch (2473:13): [True: 0, False: 0]
  ------------------
 2474|      0|        {
 2475|      0|            inchi_ios_eprint(log_file, "; CRU folding enabled");
 2476|      0|        }
 2477|      0|    }
 2478|    454|    inchi_ios_eprint(log_file, "\n");
 2479|       |
 2480|    454|    if (ip->bNPZz == 1)
  ------------------
  |  Branch (2480:9): [True: 0, False: 454]
  ------------------
 2481|      0|    {
 2482|      0|        inchi_ios_eprint(log_file, "Allowing non-polymer Zz pseudo atoms\n");
 2483|      0|    }
 2484|    454|    if (ip->bStereoAtZz == 1)
  ------------------
  |  Branch (2484:9): [True: 0, False: 454]
  ------------------
 2485|      0|    {
 2486|      0|        inchi_ios_eprint(log_file, "Allowing stereo at atoms connected to Zz\n");
 2487|      0|    }
 2488|       |
 2489|       |    /*  Report debug modes */
 2490|       |#if ( bRELEASE_VERSION != 1 )
 2491|       |    inchi_ios_eprint( log_file, "Release version = NO\n" );
 2492|       |#endif
 2493|       |#if ( TRACE_MEMORY_LEAKS == 1 && defined(_DEBUG) )
 2494|       |    inchi_ios_eprint( log_file, "Tracing memory leaks (SLOW)\n" );
 2495|       |#endif
 2496|       |
 2497|       |#if (BUILD_WITH_ENG_OPTIONS==1)
 2498|       |    inchi_ios_eprint( log_file, "! Working in engineering mode\n" );
 2499|       |#endif
 2500|    454|    inchi_ios_eprint( log_file, "\n" );
 2501|       |
 2502|       |#if ( bRELEASE_VERSION != 1 )
 2503|       |#if ( FIND_RING_SYSTEMS == 1 )
 2504|       |    inchi_ios_eprint( log_file, "Find ring systems=Y\nTautomers:\n" );
 2505|       |    inchi_ios_eprint( log_file, " 4-pyridinol=%s\n", TAUT_4PYRIDINOL_RINGS == 1 ? "Y" : "N" );
 2506|       |    inchi_ios_eprint( log_file, " pyrazole=%s\n", TAUT_PYRAZOLE_RINGS == 1 ? "Y" : "N" );
 2507|       |    inchi_ios_eprint( log_file, " tropolone=%s\n", TAUT_TROPOLONE_7 == 1 ? "Y" : "N" );
 2508|       |    inchi_ios_eprint( log_file, " tropolone-5=%s\n", TAUT_TROPOLONE_5 == 1 ? "Y" : "N" );
 2509|       |    inchi_ios_eprint( log_file, "Only chain attachments to tautomeric rings=%s\n", TAUT_RINGS_ATTACH_CHAIN == 1 ? "Y" : "N" );
 2510|       |#endif
 2511|       |
 2512|       |    if (ip->bGetSdfileId)
 2513|       |    {
 2514|       |        inchi_ios_eprint( log_file, "Extracting SDfile IDs\n" );
 2515|       |    }
 2516|       |    inchi_ios_eprint( log_file, "\nDbg: MOVE_CHARGES=%d\n",
 2517|       |                                0 != ( ip->bTautFlags&TG_FLAG_MOVE_POS_CHARGES ) );
 2518|       |    inchi_ios_eprint( log_file, "     REPLACE_ALT_WITH_TAUT=%d; NEUTRALIZE_ENDPOINTS=%d; BNS_PROTECT_FROM_TAUT=%d\n",
 2519|       |                                REPLACE_ALT_WITH_TAUT, NEUTRALIZE_ENDPOINTS, BNS_PROTECT_FROM_TAUT );
 2520|       |    inchi_ios_eprint( log_file, "     DISCONNECT_SALTS=%d;   TEST_TAUT_SALTS=%d;    TEST_TAUT2_SALTS=%d\n",
 2521|       |                                0 != ( ip->bTautFlags&TG_FLAG_DISCONNECT_SALTS ),
 2522|       |                                0 != ( ip->bTautFlags&TG_FLAG_TEST_TAUT__SALTS ),
 2523|       |                                0 != ( ip->bTautFlags&TG_FLAG_TEST_TAUT2_SALTS ) );
 2524|       |    inchi_ios_eprint( log_file, "     CHARGED_ACID_TAUT_ONLY=%d MERGE_TAUT_SALTS=%d\n",
 2525|       |                                0 == ( ip->bTautFlags&TG_FLAG_ALLOW_NO_NEGTV_O ),
 2526|       |                                0 != ( ip->bTautFlags&TG_FLAG_MERGE_TAUT_SALTS ) );
 2527|       |    inchi_ios_eprint( log_file, "     DISCONNECT_COORD=%d\n",
 2528|       |                                0 != ( ip->bTautFlags&TG_FLAG_DISCONNECT_COORD ) );
 2529|       |#endif /* ( bRELEASE_VERSION != 1 ) */
 2530|       |
 2531|    454|    return 0;
 2532|    454|}

OutputINChI2:
  990|     80|{
  991|     80|    int bINChIOutputOptions0 = bINChIOutputOptions & ~( INCHI_OUT_PLAIN_TEXT | INCHI_OUT_PLAIN_TEXT_COMMENTS );
  ------------------
  |  |  163|     80|#define INCHI_OUT_PLAIN_TEXT            0x0040   /* output plain text INChI                 */
  ------------------
                  int bINChIOutputOptions0 = bINChIOutputOptions & ~( INCHI_OUT_PLAIN_TEXT | INCHI_OUT_PLAIN_TEXT_COMMENTS );
  ------------------
  |  |  164|     80|#define INCHI_OUT_PLAIN_TEXT_COMMENTS   0x0080   /* output plain text annotation            */
  ------------------
  992|     80|    int bINChIOutputOptionsCur;
  993|     80|    int bCurOption, ret, i;
  994|       |
  995|     80|    ret = 0;
  996|       |
  997|    320|    for (i = 0; i < 3; i++)
  ------------------
  |  Branch (997:17): [True: 240, False: 80]
  ------------------
  998|    240|    {
  999|    240|        switch (i)
 1000|    240|        {
 1001|     80|            case 1:
  ------------------
  |  Branch (1001:13): [True: 80, False: 160]
  ------------------
 1002|     80|                bCurOption = INCHI_OUT_PLAIN_TEXT;
  ------------------
  |  |  163|     80|#define INCHI_OUT_PLAIN_TEXT            0x0040   /* output plain text INChI                 */
  ------------------
 1003|     80|                break;
 1004|     80|            case 2:
  ------------------
  |  Branch (1004:13): [True: 80, False: 160]
  ------------------
 1005|     80|                bCurOption = INCHI_OUT_PLAIN_TEXT_COMMENTS;
  ------------------
  |  |  164|     80|#define INCHI_OUT_PLAIN_TEXT_COMMENTS   0x0080   /* output plain text annotation            */
  ------------------
 1006|     80|                break;
 1007|     80|            default:
  ------------------
  |  Branch (1007:13): [True: 80, False: 160]
  ------------------
 1008|     80|                continue;
 1009|    240|        }
 1010|    160|        if (bINChIOutputOptions & bCurOption)
  ------------------
  |  Branch (1010:13): [True: 80, False: 80]
  ------------------
 1011|     80|        {
 1012|     80|            bINChIOutputOptionsCur = bINChIOutputOptions0 | bCurOption;
 1013|     80|            if (i != 1)
  ------------------
  |  Branch (1013:17): [True: 0, False: 80]
  ------------------
 1014|      0|            {
 1015|      0|                bINChIOutputOptionsCur &= ~INCHI_OUT_TABBED_OUTPUT;
  ------------------
  |  |  167|      0|#define INCHI_OUT_TABBED_OUTPUT         0x0400   /* tab-delimited (only for plain text)     */
  ------------------
 1016|      0|            }
 1017|     80|            ret |= OutputINChI1( pCG,
 1018|     80|                                 strbuf,
 1019|     80|                                 pINChISortTautAndNonTaut2,
 1020|     80|                                 INCHI_basic_or_INCHI_reconnected,
 1021|     80|                                 orig_inp_data,
 1022|     80|                                 pOrigStruct,
 1023|     80|                                 ip,
 1024|     80|                                 bDisconnectedCoord,
 1025|     80|                                 bOutputType,
 1026|     80|                                 bINChIOutputOptionsCur,
 1027|     80|                                 num_components2,
 1028|     80|                                 num_non_taut2,
 1029|     80|                                 num_taut2,
 1030|     80|                                 output_file,
 1031|     80|                                 log_file,
 1032|     80|                                 num_input_struct,
 1033|     80|                                 pSortPrintINChIFlags,
 1034|     80|                                 save_opt_bits );
 1035|     80|        }
 1036|    160|    }
 1037|       |
 1038|     80|    return ret;
 1039|     80|}
OutputINChI1:
 1067|     80|{
 1068|     80|    INCHI_OUT_CTL io;
 1069|       |    /*
 1070|       |        bINChIOutputOptions bits:
 1071|       |          INCHI_OUT_NO_AUX_INFO           0x0001    do not output Aux Info
 1072|       |          INCHI_OUT_SHORT_AUX_INFO        0x0002    output short version of Aux Info
 1073|       |          INCHI_OUT_ONLY_AUX_INFO         0x0004    output only Aux Info
 1074|       |          INCHI_OUT_EMBED_REC             0x0008    embed reconnected INChI into disconnected INChI
 1075|       |
 1076|       |        bOutputType =
 1077|       |         TAUT_YES  => tautomeric only (if no tautomeric components then no output;
 1078|       |         TAUT_NON  => only non-tautomeric output (if no non-taut present then no output;
 1079|       |         TAUT_BOTH => tautomeric and non-tautomeric
 1080|       |    */
 1081|     80|    int  i, j, ii, jj, /*ii2, jj2,*/ bEmbeddedOutputCalled = 0;
 1082|     80|    int  bTautIsoHNum, bTautIsoAt, bHasIsotopicAtoms[TAUT_NUM];
 1083|     80|    int  bStereoSp2[TAUT_NUM], bStereoSp3[TAUT_NUM];
 1084|     80|    int  bIsotopicStereoSp2[TAUT_NUM], bIsotopicStereoSp3[TAUT_NUM];
 1085|     80|    int  bStereoAbsInverted[TAUT_NUM], bIsotopicStereoAbsInverted[TAUT_NUM];
 1086|     80|    int  bStereoAbs[TAUT_NUM], bIsotopicStereoAbs[TAUT_NUM];
 1087|     80|    int  bTautomericAcid, bHardAddRemProton;
 1088|     80|    int  bRequestedRacemicStereo = 0, bRequestedRelativeStereo = 0;
 1089|     80|    int  ind, inc, npass = 0;
 1090|       |
 1091|     80|    INCHI_SORT   *is, *is2;
 1092|     80|    INChI        *pINChI /*, *pINChI2*/;
 1093|     80|    INChI_Aux    *pINChI_Aux = NULL;
 1094|       |
 1095|     80|    int  ret = 0;        /*  0 failed, 1 success */
 1096|     80|    int  intermediate_result = 0;
 1097|     80|    int then_goto_repeat = 0;
 1098|     80|    int  max_num_comp;
 1099|     80|    int  bHasIsoH;
 1100|     80|    int  nNumMovedProtons;
 1101|     80|    int  bTautAndNonTaut, bTautIsNonTaut;
 1102|     80|    int nAtomsAllComp1, nAtomsAllComp2;    /* v. 1.05 Total atoms in all components */
 1103|       |
 1104|     80|    int  bPlainText = 0 != ( bINChIOutputOptions & ( INCHI_OUT_PLAIN_TEXT | INCHI_OUT_PLAIN_TEXT_COMMENTS ) );
  ------------------
  |  |  163|     80|#define INCHI_OUT_PLAIN_TEXT            0x0040   /* output plain text INChI                 */
  ------------------
                  int  bPlainText = 0 != ( bINChIOutputOptions & ( INCHI_OUT_PLAIN_TEXT | INCHI_OUT_PLAIN_TEXT_COMMENTS ) );
  ------------------
  |  |  164|     80|#define INCHI_OUT_PLAIN_TEXT_COMMENTS   0x0080   /* output plain text annotation            */
  ------------------
 1105|     80|    int  bPlainTextCommnts = 0 != ( bINChIOutputOptions & INCHI_OUT_PLAIN_TEXT_COMMENTS );
  ------------------
  |  |  164|     80|#define INCHI_OUT_PLAIN_TEXT_COMMENTS   0x0080   /* output plain text annotation            */
  ------------------
 1106|       |
 1107|     80|    char *pLF, *pTAB;
 1108|       |#ifdef TARGET_LIB_FOR_WINCHI
 1109|       |    int silent = 1;
 1110|       |#endif
 1111|       |
 1112|     80|    int bFixTranspChargeBug = 0;
 1113|     80|#if ( FIX_TRANSPOSITION_CHARGE_BUG == 1 ) /* 2008-01-02 */
 1114|     80|    if (INCHI_OUT_FIX_TRANSPOSITION_CHARGE_BUG & bINChIOutputOptions)
  ------------------
  |  |  171|     80|#define INCHI_OUT_FIX_TRANSPOSITION_CHARGE_BUG 0x2000
  ------------------
  |  Branch (1114:9): [True: 80, False: 0]
  ------------------
 1115|     80|        bFixTranspChargeBug = 1;
 1116|     80|#endif
 1117|       |
 1118|     80|    io.bAbcNumbers = ip->bAbcNumbers;
 1119|       |
 1120|     80|    io.ATOM_MODE = ( ( io.bAbcNumbers ? CT_MODE_ABC_NUMBERS : 0 )
  ------------------
  |  |   54|      0|#define CT_MODE_ABC_NUMBERS       2
  ------------------
  |  Branch (1120:24): [True: 0, False: 80]
  ------------------
 1121|     80|                    | CT_MODE_ATOM_COUNTS
  ------------------
  |  |   55|     80|#define CT_MODE_ATOM_COUNTS       4
  ------------------
 1122|     80|                    | CT_MODE_NO_ORPHANS
  ------------------
  |  |   53|     80|#define CT_MODE_NO_ORPHANS        1 /* no orphans, that CT should have only atoms with neighbors */
  ------------------
 1123|     80|#if ( EQL_H_NUM_TOGETHER == 1 )
 1124|     80|                    | CT_MODE_EQL_H_TOGETHER
  ------------------
  |  |   57|     80|#define CT_MODE_EQL_H_TOGETHER   16
  ------------------
 1125|     80|#endif
 1126|     80|#if ( ABC_CT_NUM_CLOSURES == 1 )
 1127|     80|                    | ( io.bAbcNumbers && ip->bCtPredecessors ? CT_MODE_ABC_NUM_CLOSURES : 0 )
  ------------------
  |  |   58|      0|#define CT_MODE_ABC_NUM_CLOSURES 32 /* in CT_MODE_ABC_NUMBERS output AB1AC2AB instead of AB-AC-A-B */
  ------------------
  |  Branch (1127:25): [True: 0, False: 80]
  |  Branch (1127:43): [True: 0, False: 0]
  ------------------
 1128|     80|#endif
 1129|     80|                    | ( ip->bCtPredecessors ? CT_MODE_PREDECESSORS : 0 ) );
  ------------------
  |  |   56|      0|#define CT_MODE_PREDECESSORS      8
  ------------------
  |  Branch (1129:25): [True: 0, False: 80]
  ------------------
 1130|       |
 1131|     80|    io.TAUT_MODE = ( io.bAbcNumbers ? CT_MODE_ABC_NUMBERS : 0 );
  ------------------
  |  |   54|      0|#define CT_MODE_ABC_NUMBERS       2
  ------------------
  |  Branch (1131:22): [True: 0, False: 80]
  ------------------
 1132|     80|    io.pSortPrintINChIFlags = pSortPrintINChIFlags;
 1133|     80|    io.num_components = num_components2[INCHI_basic_or_INCHI_reconnected];
 1134|     80|    io.pINChISortTautAndNonTaut = pINChISortTautAndNonTaut2[INCHI_basic_or_INCHI_reconnected];
 1135|     80|    io.pINChISort = io.pINChISortTautAndNonTaut[TAUT_YES];
  ------------------
  |  |  580|     80|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1136|     80|    io.pINChISort2 = io.pINChISortTautAndNonTaut[TAUT_YES];
  ------------------
  |  |  580|     80|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1137|     80|    io.bAlways = 0;
 1138|     80|    io.bUseMulipliers = 1;
 1139|     80|    io.bOmitRepetitions = 1;
 1140|     80|    io.bPlainTextTags = 2;  /* 0 => no plain tags, 1=> plain text tags, 2=>plaintext tags without consecutive // */
 1141|     80|    io.bOutputType = bOutputType; /* remains constant */
 1142|     80|    io.bOutType = bOutputType;    /* will change! */
 1143|     80|    io.bOverflow = 0;
 1144|     80|    io.bSecondNonTautPass = 0;
 1145|     80|    io.bNonTautIsoIdentifierNotEmpty = 0;
 1146|     80|    io.bNonTautNonIsoIdentifierNotEmpty = 0;
 1147|     80|    io.bNonTautIsIdenticalToTaut = 1;
 1148|     80|    io.bFhTag = 0;
 1149|     80|    io.nTag = bPlainTextCommnts ? 3 : bPlainText ? 2 : 0; /* tag type */
  ------------------
  |  Branch (1149:15): [True: 0, False: 80]
  |  Branch (1149:39): [True: 80, False: 0]
  ------------------
 1150|       |
 1151|       |
 1152|     80|    if (NULL==orig_inp_data)
  ------------------
  |  Branch (1152:9): [True: 80, False: 0]
  ------------------
 1153|     80|    {
 1154|       |        /*intermediate_result = 1;
 1155|       |        goto exit_function;*/
 1156|     80|        io.n_zy     = 0;
 1157|     80|        io.n_pzz    = 0;
 1158|     80|        io.n_pzz    = 0;
 1159|     80|    }
 1160|      0|    else
 1161|      0|    {
 1162|      0|        io.n_zy = orig_inp_data->n_zy;
 1163|      0|        io.n_pzz = 0;
 1164|      0|        if (orig_inp_data->polymer)
  ------------------
  |  Branch (1164:13): [True: 0, False: 0]
  ------------------
 1165|      0|        {
 1166|      0|            io.n_pzz = orig_inp_data->polymer->n_pzz;
 1167|      0|        }
 1168|      0|    }
 1169|       |    
 1170|       |
 1171|     80|    io.bPolymers = ip->bPolymers;
 1172|       |
 1173|     80|    ind = -1;
 1174|     80|    inc = -1;
 1175|       |
 1176|       |#ifdef TARGET_LIB_FOR_WINCHI
 1177|       |    /* @@@ From now on we will go with silent output; it ends on @@@ below */
 1178|       |    silent = 1;
 1179|       |#endif
 1180|       |
 1181|       |    /* Analyze layers, make adjustments and fixes, etc. */
 1182|       |
 1183|     80|    set_line_separators( bINChIOutputOptions, &pLF, &pTAB );
 1184|     80|    memset( io.sDifSegs, DIFV_BOTH_EMPTY, sizeof( io.sDifSegs ) );
 1185|     80|    if (!strbuf || !( strbuf->pStr ) || strbuf->nAllocatedLength <= 0)
  ------------------
  |  Branch (1185:9): [True: 0, False: 80]
  |  Branch (1185:20): [True: 0, False: 80]
  |  Branch (1185:41): [True: 0, False: 80]
  ------------------
 1186|      0|    {
 1187|      0|        inchi_ios_eprint( log_file, "Cannot allocate output buffer. No output for structure #%d.%s%s%s%s\n",
 1188|      0|                         num_input_struct, SDF_LBL_VAL( ip->pSdfLabel, ip->pSdfValue ) );
  ------------------
  |  |  410|      0|#define SDF_LBL_VAL(L,V)  ((L)&&(L)[0])?gsSpace:gsEmpty, ((L)&&(L)[0])?L:gsEmpty, ((L)&&(L)[0])? (((V)&&(V)[0])?gsEqual:gsSpace):gsEmpty, ((V)&&(V)[0])?V:((L)&&(L)[0])?gsMissing:gsEmpty
  |  |  ------------------
  |  |  |  Branch (410:28): [True: 0, False: 0]
  |  |  |  Branch (410:33): [True: 0, False: 0]
  |  |  |  Branch (410:59): [True: 0, False: 0]
  |  |  |  Branch (410:64): [True: 0, False: 0]
  |  |  |  Branch (410:84): [True: 0, False: 0]
  |  |  |  Branch (410:89): [True: 0, False: 0]
  |  |  |  Branch (410:100): [True: 0, False: 0]
  |  |  |  Branch (410:105): [True: 0, False: 0]
  |  |  |  Branch (410:140): [True: 0, False: 0]
  |  |  |  Branch (410:145): [True: 0, False: 0]
  |  |  |  Branch (410:156): [True: 0, False: 0]
  |  |  |  Branch (410:161): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1189|      0|        return ret;
 1190|      0|    }
 1191|       |
 1192|       |    /*    -- commented out to allow empty InChI --
 1193|       |    if (!io.num_components ) return 0;
 1194|       |    */
 1195|       |
 1196|    240|    for (i = 0; i < TAUT_NUM; i++)
  ------------------
  |  |  578|    240|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1196:17): [True: 160, False: 80]
  ------------------
 1197|    160|    {
 1198|    160|        bHasIsotopicAtoms[i] =
 1199|    160|            io.num_comp[i] =
 1200|    160|            bStereoSp2[i] =
 1201|    160|            bStereoSp3[i] =
 1202|    160|            bIsotopicStereoSp2[i] =
 1203|    160|            bIsotopicStereoSp3[i] =
 1204|    160|            io.bIsotopicOrigNumb[i] =
 1205|    160|            bStereoAbs[i] =
 1206|    160|            bIsotopicStereoAbs[i] =
 1207|    160|            bStereoAbsInverted[i] =
 1208|    160|            bIsotopicStereoAbsInverted[i] =
 1209|    160|            io.bRacemicStereo[i] =
 1210|    160|            io.bRelativeStereo[i] =
 1211|    160|            io.bIsotopicRacemicStereo[i] =
 1212|    160|            io.bIsotopicRelativeStereo[i] =
 1213|    160|            io.bAtomEqu[i] =
 1214|    160|            io.bTautEqu[i] =
 1215|    160|            io.bIsotopicAtomEqu[i] =
 1216|    160|            io.bIsotopicTautEqu[i] =
 1217|    160|            io.bInvStereo[i] =
 1218|    160|            io.bInvIsotopicStereo[i] =
 1219|    160|            io.bInvStereoOrigNumb[i] =
 1220|    160|            io.bInvIsotopicStereoOrigNumb[i] =
 1221|    160|            io.bIgn_UU_Sp3[i] =
 1222|    160|            io.bIgn_UU_Sp2[i] =
 1223|    160|            io.bIgn_UU_Sp3_Iso[i] =
 1224|    160|            io.bIgn_UU_Sp2_Iso[i] =
 1225|    160|            io.bChargesRadVal[i] =
 1226|    160|            io.bOrigCoord[i] = 0;
 1227|    160|    }
 1228|       |
 1229|       |    /*    Find if it is isotopic */
 1230|     80|        io.bIsotopic =
 1231|     80|        io.bTautomeric =
 1232|     80|        io.bNonTautomeric =
 1233|     80|        bTautomericAcid =
 1234|     80|        bHardAddRemProton =
 1235|     80|        bTautIsoHNum =
 1236|     80|        bTautIsoAt =
 1237|     80|        bTautAndNonTaut =
 1238|     80|        bTautIsNonTaut = 0;
 1239|       |
 1240|       |        /*
 1241|       |             x = bStereo, bStereoSp2, bStereoSp3, bStereoAbsInverted,
 1242|       |                 bIsotopicStereo, bIsotopicStereoSp2, bIsotopicStereoSp3, bIsotopicStereoAbsInverted
 1243|       |
 1244|       |             OUT_N1: x[TAUT_NON] refers to non-tautomeric only
 1245|       |             OUT_T1: x[TAUT_YES] refers to tautomeric if exists otherwise non-tautomeric
 1246|       |             OUT_NT: x[TAUT_NON] refers to non-taut representations of tautomeric
 1247|       |             OUT_TN: x[TAUT_YES] refers to tautomeric if exists otherwise non-tautomeric
 1248|       |                     x[TAUT_NON] refers to non-taut representations of tautomeric
 1249|       |         */
 1250|       |
 1251|     80|    memset( io.num_iso_H, 0, sizeof( io.num_iso_H ) );
 1252|     80|    io.nNumRemovedProtons = 0;
 1253|     80|    nNumMovedProtons = 0;
 1254|     80|    bHasIsoH = 0;
 1255|     80|    io.bTautomericOutputAllowed = ( io.bOutType == OUT_T1 || io.bOutType == OUT_TN );
  ------------------
  |  |  586|    160|#define OUT_T1              1    /* tautomeric if present otherwise non-tautomeric */
  ------------------
                  io.bTautomericOutputAllowed = ( io.bOutType == OUT_T1 || io.bOutType == OUT_TN );
  ------------------
  |  |  588|     80|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  ------------------
  |  Branch (1255:37): [True: 0, False: 80]
  |  Branch (1255:62): [True: 80, False: 0]
  ------------------
 1256|     80|    io.pINChISort = io.pINChISortTautAndNonTaut[io.bTautomericOutputAllowed ? TAUT_YES : TAUT_NON];
  ------------------
  |  |  580|     80|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  io.pINChISort = io.pINChISortTautAndNonTaut[io.bTautomericOutputAllowed ? TAUT_YES : TAUT_NON];
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1256:49): [True: 80, False: 0]
  ------------------
 1257|     80|    is = io.pINChISort;
 1258|     80|    is2 = ( io.bOutType == OUT_TN ) ? io.pINChISortTautAndNonTaut[TAUT_NON] : NULL;
  ------------------
  |  |  588|     80|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  ------------------
                  is2 = ( io.bOutType == OUT_TN ) ? io.pINChISortTautAndNonTaut[TAUT_NON] : NULL;
  ------------------
  |  |  579|     80|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1258:11): [True: 80, False: 0]
  ------------------
 1259|       |
 1260|       |
 1261|  1.29k|    for (i = 0, is2 = io.pINChISortTautAndNonTaut[TAUT_NON]; i < io.num_components; i++, is++, is2 ? is2++ : NULL)
  ------------------
  |  |  579|     80|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1261:62): [True: 1.21k, False: 80]
  |  Branch (1261:96): [True: 1.21k, False: 0]
  ------------------
 1262|  1.21k|    {
 1263|       |
 1264|  1.21k|        CompINChILayers( is, is2, io.sDifSegs, bFixTranspChargeBug );
 1265|       |
 1266|  1.21k|        io.bNonTautIsIdenticalToTaut = io.bNonTautIsIdenticalToTaut && !CompINChITautVsNonTaut( is, is2, 1 );
  ------------------
  |  Branch (1266:40): [True: 1.21k, False: 0]
  |  Branch (1266:72): [True: 1.21k, False: 0]
  ------------------
 1267|       |
 1268|  1.21k|        if (is && ( pINChI_Aux = is->pINChI_Aux[TAUT_YES] ))
  ------------------
  |  |  580|  1.21k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1268:13): [True: 1.21k, False: 0]
  |  Branch (1268:19): [True: 1.21k, False: 0]
  ------------------
 1269|  1.21k|        {
 1270|  4.85k|            for (j = 0; j < NUM_H_ISOTOPES; j++)
  ------------------
  |  |   53|  4.85k|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (1270:25): [True: 3.64k, False: 1.21k]
  ------------------
 1271|  3.64k|            {
 1272|  3.64k|                bHasIsoH += abs( pINChI_Aux->nNumRemovedIsotopicH[j] );
 1273|  3.64k|                io.num_iso_H[j] += pINChI_Aux->nNumRemovedIsotopicH[j];
 1274|  3.64k|            }
 1275|  1.21k|            io.nNumRemovedProtons += pINChI_Aux->nNumRemovedProtons;
 1276|  1.21k|            nNumMovedProtons += abs( pINChI_Aux->nNumRemovedProtons );
 1277|  1.21k|        }
 1278|       |
 1279|  1.21k|        if (io.bTautomericOutputAllowed)
  ------------------
  |  Branch (1279:13): [True: 1.21k, False: 0]
  ------------------
 1280|  1.21k|        {
 1281|       |            /* Check for removed isotopic H */
 1282|  2.42k|            for (j = TAUT_YES; j < TAUT_NUM; j++)
  ------------------
  |  |  580|  1.21k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                          for (j = TAUT_YES; j < TAUT_NUM; j++)
  ------------------
  |  |  578|  2.42k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1282:32): [True: 1.21k, False: 1.21k]
  ------------------
 1283|  1.21k|            {
 1284|  1.21k|                switch (io.bOutType)
 1285|  1.21k|                {
 1286|      0|                    case OUT_N1: /* x[TAUT_NON]: non-tautomeric only -- never happens */
  ------------------
  |  |  585|      0|#define OUT_N1              0    /* non-tautomeric only */
  ------------------
  |  Branch (1286:21): [True: 0, False: 1.21k]
  ------------------
 1287|      0|                        jj = GET_II( io.bOutType, is );
  ------------------
  |  |   73|      0|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  585|      0|#define OUT_N1              0    /* non-tautomeric only */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (73:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   74|      0|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  586|      0|#define OUT_T1              1    /* tautomeric if present otherwise non-tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  588|      0|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   63|      0|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (63:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (63:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   65|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (65:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (65:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (74:23): [True: 0, False: 0]
  |  |  |  Branch (74:36): [True: 0, False: 0]
  |  |  ------------------
  |  |   75|      0|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  590|      0|#define OUT_NN              4    /* only non-taut representations: non-taut else tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (75:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   76|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  587|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   68|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (68:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (76:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1288|      0|                        if (jj != j)
  ------------------
  |  Branch (1288:29): [True: 0, False: 0]
  ------------------
 1289|      0|                            continue;
 1290|      0|                        ii = TAUT_NON;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 1291|      0|                        break;
 1292|      0|                    case OUT_T1: /* x[TAUT_YES]: tautomeric if present otherwise non-tautomeric */
  ------------------
  |  |  586|      0|#define OUT_T1              1    /* tautomeric if present otherwise non-tautomeric */
  ------------------
  |  Branch (1292:21): [True: 0, False: 1.21k]
  ------------------
 1293|      0|                        jj = GET_II( io.bOutType, is );
  ------------------
  |  |   73|      0|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  585|      0|#define OUT_N1              0    /* non-tautomeric only */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (73:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   74|      0|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  586|      0|#define OUT_T1              1    /* tautomeric if present otherwise non-tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  588|      0|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   63|      0|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (63:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (63:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   65|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (65:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (65:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (74:23): [True: 0, False: 0]
  |  |  |  Branch (74:36): [True: 0, False: 0]
  |  |  ------------------
  |  |   75|      0|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  590|      0|#define OUT_NN              4    /* only non-taut representations: non-taut else tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (75:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   76|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  587|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   68|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (68:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (76:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1294|      0|                        if (jj != j)
  ------------------
  |  Branch (1294:29): [True: 0, False: 0]
  ------------------
 1295|      0|                            continue;
 1296|      0|                        ii = TAUT_YES;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1297|      0|                        break;
 1298|      0|                    case OUT_NT: /* x[TAUT_NON]: only non-taut representations of tautomeric -- never happens */
  ------------------
  |  |  587|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  ------------------
  |  Branch (1298:21): [True: 0, False: 1.21k]
  ------------------
 1299|      0|                        jj = GET_II( io.bOutType, is );
  ------------------
  |  |   73|      0|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  585|      0|#define OUT_N1              0    /* non-tautomeric only */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (73:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   74|      0|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  586|      0|#define OUT_T1              1    /* tautomeric if present otherwise non-tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  588|      0|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   63|      0|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (63:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (63:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   65|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (65:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (65:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (74:23): [True: 0, False: 0]
  |  |  |  Branch (74:36): [True: 0, False: 0]
  |  |  ------------------
  |  |   75|      0|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  590|      0|#define OUT_NN              4    /* only non-taut representations: non-taut else tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (75:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   76|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  587|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   68|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (68:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (76:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1300|      0|                        if (jj != j)
  ------------------
  |  Branch (1300:29): [True: 0, False: 0]
  ------------------
 1301|      0|                            continue;
 1302|      0|                        ii = TAUT_NON;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 1303|      0|                        break;
 1304|       |                    /* main path of control flow */
 1305|  1.21k|                    case OUT_TN: /* x[TAUT_YES]: tautomeric if present otherwise non-tautomeric;
  ------------------
  |  |  588|  1.21k|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  ------------------
  |  Branch (1305:21): [True: 1.21k, False: 0]
  ------------------
 1306|       |                                  * x[TAUT_NON]: non-taut only if tautomeric is present */
 1307|  1.21k|                        jj = ( j == TAUT_YES ) ? GET_II( OUT_T1, is ) : ( j == TAUT_NON ) ? GET_II( OUT_NT, is ) : -1;
  ------------------
  |  |  580|  1.21k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                                      jj = ( j == TAUT_YES ) ? GET_II( OUT_T1, is ) : ( j == TAUT_NON ) ? GET_II( OUT_NT, is ) : -1;
  ------------------
  |  |   73|  1.21k|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  585|  1.21k|#define OUT_N1              0    /* non-tautomeric only */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (73:22): [Folded - Ignored]
  |  |  ------------------
  |  |   74|  1.21k|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  586|  2.42k|#define OUT_T1              1    /* tautomeric if present otherwise non-tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  588|  1.21k|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   63|  1.21k|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|  1.21k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|  1.21k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (63:20): [True: 1.21k, False: 0]
  |  |  |  |  |  Branch (63:43): [True: 1.21k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|  1.21k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   65|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (65:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (65:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (74:23): [Folded - Ignored]
  |  |  |  Branch (74:36): [Folded - Ignored]
  |  |  ------------------
  |  |   75|  1.21k|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  590|      0|#define OUT_NN              4    /* only non-taut representations: non-taut else tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (75:22): [Folded - Ignored]
  |  |  ------------------
  |  |   76|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  587|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   68|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (68:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (76:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
                                      jj = ( j == TAUT_YES ) ? GET_II( OUT_T1, is ) : ( j == TAUT_NON ) ? GET_II( OUT_NT, is ) : -1;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                                      jj = ( j == TAUT_YES ) ? GET_II( OUT_T1, is ) : ( j == TAUT_NON ) ? GET_II( OUT_NT, is ) : -1;
  ------------------
  |  |   73|      0|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  585|      0|#define OUT_N1              0    /* non-tautomeric only */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (73:22): [Folded - Ignored]
  |  |  ------------------
  |  |   74|      0|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  586|      0|#define OUT_T1              1    /* tautomeric if present otherwise non-tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  588|      0|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   63|      0|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (63:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (63:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   65|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (65:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (65:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (74:23): [Folded - Ignored]
  |  |  |  Branch (74:36): [Folded - Ignored]
  |  |  ------------------
  |  |   75|      0|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  590|      0|#define OUT_NN              4    /* only non-taut representations: non-taut else tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (75:22): [Folded - Ignored]
  |  |  ------------------
  |  |   76|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  587|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   68|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (68:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (76:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (1307:30): [True: 1.21k, False: 0]
  |  Branch (1307:73): [True: 0, False: 0]
  ------------------
 1308|  1.21k|                        if (jj == TAUT_YES)
  ------------------
  |  |  580|  1.21k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1308:29): [True: 1.21k, False: 0]
  ------------------
 1309|  1.21k|                        {
 1310|       |                            /* Fix12 */
 1311|  1.21k|                            if (is->pINChI[jj]->lenTautomer > 0)
  ------------------
  |  Branch (1311:33): [True: 39, False: 1.17k]
  ------------------
 1312|     39|                            {
 1313|     39|                                bTautAndNonTaut += ( !is->pINChI[jj]->bDeleted && HAS_N( is ) );
  ------------------
  |  |   65|     39|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  ------------------
  |  |  |  |  579|     39|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (65:20): [True: 0, False: 39]
  |  |  |  Branch (65:43): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1313:54): [True: 39, False: 0]
  ------------------
 1314|     39|                            }
 1315|  1.17k|                            else
 1316|  1.17k|                            {
 1317|  1.17k|                                bTautIsNonTaut++;
 1318|  1.17k|                            }
 1319|  1.21k|                        }
 1320|  1.21k|                        if (jj < 0)
  ------------------
  |  Branch (1320:29): [True: 0, False: 1.21k]
  ------------------
 1321|      0|                            continue;
 1322|  1.21k|                        ii = j;
 1323|  1.21k|                        break;
 1324|      0|                    default:
  ------------------
  |  Branch (1324:21): [True: 0, False: 1.21k]
  ------------------
 1325|      0|                        continue;
 1326|  1.21k|                }
 1327|  1.21k|                if (jj != j)
  ------------------
  |  Branch (1327:21): [True: 0, False: 1.21k]
  ------------------
 1328|      0|                    continue;
 1329|  1.21k|                if (( pINChI = is->pINChI[jj] ) && pINChI->nNumberOfAtoms > 0 && ( pINChI_Aux = is->pINChI_Aux[jj] ))
  ------------------
  |  Branch (1329:21): [True: 1.21k, False: 0]
  |  Branch (1329:52): [True: 1.21k, False: 0]
  |  Branch (1329:82): [True: 1.21k, False: 0]
  ------------------
 1330|  1.21k|                {
 1331|  1.21k|                    bTautIsoHNum += ( pINChI_Aux->nNumRemovedIsotopicH[0] +
 1332|  1.21k|                                     pINChI_Aux->nNumRemovedIsotopicH[1] +
 1333|  1.21k|                                     pINChI_Aux->nNumRemovedIsotopicH[2] );
 1334|  1.21k|                    bTautIsoAt += ( pINChI->nNumberOfIsotopicAtoms > 0 || pINChI->nNumberOfIsotopicTGroups > 0 );
  ------------------
  |  Branch (1334:37): [True: 14, False: 1.20k]
  |  Branch (1334:75): [True: 0, False: 1.20k]
  ------------------
 1335|  1.21k|                }
 1336|  1.21k|            }
 1337|  1.21k|        }
 1338|  1.21k|    }
 1339|       |
 1340|     80|    io.sDifSegs[DIFL_M][DIFS_p_PROTONS] = io.nNumRemovedProtons ? DIFV_NEQ2PRECED : DIFV_BOTH_EMPTY;
  ------------------
  |  Branch (1340:43): [True: 0, False: 80]
  ------------------
 1341|     80|    io.sDifSegs[DIFL_MI][DIFS_h_H_ATOMS] = bHasIsoH ? DIFV_NEQ2PRECED : DIFV_BOTH_EMPTY;
  ------------------
  |  Branch (1341:44): [True: 0, False: 80]
  ------------------
 1342|       |
 1343|     80|    MarkUnusedAndEmptyLayers( io.sDifSegs );
 1344|       |
 1345|     80|    io.bNonTautIsIdenticalToTaut = io.bNonTautIsIdenticalToTaut && !bTautIsoHNum;
  ------------------
  |  Branch (1345:36): [True: 80, False: 0]
  |  Branch (1345:68): [True: 80, False: 0]
  ------------------
 1346|     80|    nAtomsAllComp1 = nAtomsAllComp2 = 0;
 1347|       |
 1348|  1.29k|    for (i = 0, is = io.pINChISort; i < io.num_components; i++, is++)
  ------------------
  |  Branch (1348:37): [True: 1.21k, False: 80]
  ------------------
 1349|  1.21k|    {
 1350|  1.21k|        int bCurIso, bCurStereo, bCurIsoStereo, bCurHasIsoStereo /* Fix14 */, bCurTaut /*, bCurTaut2*/;
 1351|  1.21k|        int bCompExists, bCurIsoHPos, bCurIsoHStereo;
 1352|  1.21k|        int bCurStereoSp2, bCurIsoStereoSp2, bCurStereoSp3, bCurIsoStereoSp3, bCurIsoStereoSp3Inv;
 1353|  1.21k|        int bCurRacemic, bCurRelative, bCurIsoRacemic, bCurIsoRelative;
 1354|  1.21k|        bCompExists = 0;
 1355|       |
 1356|  3.64k|        for (j = TAUT_NON; j < TAUT_NUM; j++)
  ------------------
  |  |  579|  1.21k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                      for (j = TAUT_NON; j < TAUT_NUM; j++)
  ------------------
  |  |  578|  3.64k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1356:28): [True: 2.42k, False: 1.21k]
  ------------------
 1357|  2.42k|        {
 1358|  2.42k|            switch (io.bOutType)
 1359|  2.42k|            {
 1360|      0|                case OUT_N1:
  ------------------
  |  |  585|      0|#define OUT_N1              0    /* non-tautomeric only */
  ------------------
  |  Branch (1360:17): [True: 0, False: 2.42k]
  ------------------
 1361|       |                    /* x[TAUT_NON]: non-tautomeric only */
 1362|      0|                    jj = GET_II( io.bOutType, is );
  ------------------
  |  |   73|      0|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  585|      0|#define OUT_N1              0    /* non-tautomeric only */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (73:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   74|      0|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  586|      0|#define OUT_T1              1    /* tautomeric if present otherwise non-tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  588|      0|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   63|      0|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (63:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (63:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   65|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (65:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (65:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (74:23): [True: 0, False: 0]
  |  |  |  Branch (74:36): [True: 0, False: 0]
  |  |  ------------------
  |  |   75|      0|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  590|      0|#define OUT_NN              4    /* only non-taut representations: non-taut else tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (75:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   76|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  587|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   68|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (68:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (76:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1363|      0|                    if (jj != j)
  ------------------
  |  Branch (1363:25): [True: 0, False: 0]
  ------------------
 1364|      0|                        continue;
 1365|      0|                    ii = TAUT_NON;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 1366|      0|                    break;
 1367|      0|                case OUT_T1:
  ------------------
  |  |  586|      0|#define OUT_T1              1    /* tautomeric if present otherwise non-tautomeric */
  ------------------
  |  Branch (1367:17): [True: 0, False: 2.42k]
  ------------------
 1368|       |                    /* x[TAUT_YES]: tautomeric if present otherwise non-tautomeric */
 1369|      0|                    jj = GET_II( io.bOutType, is );
  ------------------
  |  |   73|      0|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  585|      0|#define OUT_N1              0    /* non-tautomeric only */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (73:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   74|      0|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  586|      0|#define OUT_T1              1    /* tautomeric if present otherwise non-tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  588|      0|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   63|      0|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (63:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (63:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   65|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (65:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (65:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (74:23): [True: 0, False: 0]
  |  |  |  Branch (74:36): [True: 0, False: 0]
  |  |  ------------------
  |  |   75|      0|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  590|      0|#define OUT_NN              4    /* only non-taut representations: non-taut else tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (75:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   76|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  587|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   68|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (68:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (76:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1370|      0|                    if (jj != j)
  ------------------
  |  Branch (1370:25): [True: 0, False: 0]
  ------------------
 1371|      0|                        continue;
 1372|      0|                    ii = TAUT_YES;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1373|      0|                    break;
 1374|      0|                case OUT_NT:
  ------------------
  |  |  587|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  ------------------
  |  Branch (1374:17): [True: 0, False: 2.42k]
  ------------------
 1375|       |                    /* x[TAUT_NON]: only non-taut representations of tautomeric */
 1376|      0|                    jj = GET_II( io.bOutType, is );
  ------------------
  |  |   73|      0|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  585|      0|#define OUT_N1              0    /* non-tautomeric only */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (73:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   74|      0|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  586|      0|#define OUT_T1              1    /* tautomeric if present otherwise non-tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  588|      0|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   63|      0|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (63:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (63:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   65|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (65:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (65:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (74:23): [True: 0, False: 0]
  |  |  |  Branch (74:36): [True: 0, False: 0]
  |  |  ------------------
  |  |   75|      0|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  590|      0|#define OUT_NN              4    /* only non-taut representations: non-taut else tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (75:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   76|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  587|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   68|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (68:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (76:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1377|      0|                    if (jj != j)
  ------------------
  |  Branch (1377:25): [True: 0, False: 0]
  ------------------
 1378|      0|                        continue;
 1379|      0|                    ii = TAUT_NON;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 1380|      0|                    break;
 1381|       |                /* main control flow comes here: requested both mobile and fixed H results */
 1382|  2.42k|                case OUT_TN:
  ------------------
  |  |  588|  2.42k|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  ------------------
  |  Branch (1382:17): [True: 2.42k, False: 0]
  ------------------
 1383|       |                    /* x[TAUT_YES]: tautomeric if present otherwise non-tautomeric; */
 1384|       |                    /* x[TAUT_NON]: non-taut only if tautomeric is present          */
 1385|  2.42k|                    jj = ( j == TAUT_YES ) ? GET_II( OUT_T1, is ) : ( j == TAUT_NON ) ? GET_II( OUT_NT, is ) : -1;
  ------------------
  |  |  580|  2.42k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                                  jj = ( j == TAUT_YES ) ? GET_II( OUT_T1, is ) : ( j == TAUT_NON ) ? GET_II( OUT_NT, is ) : -1;
  ------------------
  |  |   73|  1.21k|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  585|  1.21k|#define OUT_N1              0    /* non-tautomeric only */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (73:22): [Folded - Ignored]
  |  |  ------------------
  |  |   74|  1.21k|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  586|  2.42k|#define OUT_T1              1    /* tautomeric if present otherwise non-tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  588|  1.21k|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   63|  1.21k|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|  1.21k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|  1.21k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (63:20): [True: 1.21k, False: 0]
  |  |  |  |  |  Branch (63:43): [True: 1.21k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|  1.21k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   65|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (65:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (65:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (74:23): [Folded - Ignored]
  |  |  |  Branch (74:36): [Folded - Ignored]
  |  |  ------------------
  |  |   75|  1.21k|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  590|      0|#define OUT_NN              4    /* only non-taut representations: non-taut else tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (75:22): [Folded - Ignored]
  |  |  ------------------
  |  |   76|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  587|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   68|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (68:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (76:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
                                  jj = ( j == TAUT_YES ) ? GET_II( OUT_T1, is ) : ( j == TAUT_NON ) ? GET_II( OUT_NT, is ) : -1;
  ------------------
  |  |  579|  1.21k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                                  jj = ( j == TAUT_YES ) ? GET_II( OUT_T1, is ) : ( j == TAUT_NON ) ? GET_II( OUT_NT, is ) : -1;
  ------------------
  |  |   73|  1.21k|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  585|  1.21k|#define OUT_N1              0    /* non-tautomeric only */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (73:22): [Folded - Ignored]
  |  |  ------------------
  |  |   74|  1.21k|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  586|  2.42k|#define OUT_T1              1    /* tautomeric if present otherwise non-tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  588|  1.21k|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   63|      0|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (63:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (63:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   65|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (65:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (65:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (74:23): [Folded - Ignored]
  |  |  |  Branch (74:36): [Folded - Ignored]
  |  |  ------------------
  |  |   75|  1.21k|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  590|  1.21k|#define OUT_NN              4    /* only non-taut representations: non-taut else tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (75:22): [Folded - Ignored]
  |  |  ------------------
  |  |   76|  1.21k|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  587|  1.21k|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   68|  2.42k|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|  1.21k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|  1.21k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|  1.21k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (68:20): [True: 1.21k, False: 0]
  |  |  |  |  |  Branch (68:43): [True: 1.21k, False: 0]
  |  |  |  |  |  Branch (68:82): [True: 39, False: 1.17k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   72|     39|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|     39|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 39]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (76:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (1385:26): [True: 1.21k, False: 1.21k]
  |  Branch (1385:69): [True: 1.21k, False: 0]
  ------------------
 1386|  2.42k|                    if (jj < 0)
  ------------------
  |  Branch (1386:25): [True: 1.21k, False: 1.21k]
  ------------------
 1387|  1.21k|                    {
 1388|       |                        /* Fix12 */
 1389|  1.21k|                        if (bTautAndNonTaut && bTautIsNonTaut &&
  ------------------
  |  Branch (1389:29): [True: 0, False: 1.21k]
  |  Branch (1389:48): [True: 0, False: 0]
  ------------------
 1390|  1.21k|                             j == TAUT_NON && 0 <= ( jj = GET_II( OUT_T1, is ) ) &&
  ------------------
  |  |  579|  1.21k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                                           j == TAUT_NON && 0 <= ( jj = GET_II( OUT_T1, is ) ) &&
  ------------------
  |  |   73|      0|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  585|      0|#define OUT_N1              0    /* non-tautomeric only */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (73:22): [Folded - Ignored]
  |  |  ------------------
  |  |   74|      0|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  586|      0|#define OUT_T1              1    /* tautomeric if present otherwise non-tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  588|      0|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   63|      0|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (63:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (63:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   65|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (65:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (65:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (74:23): [Folded - Ignored]
  |  |  |  Branch (74:36): [Folded - Ignored]
  |  |  ------------------
  |  |   75|      0|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  590|      0|#define OUT_NN              4    /* only non-taut representations: non-taut else tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (75:22): [Folded - Ignored]
  |  |  ------------------
  |  |   76|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  587|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   68|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (68:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (76:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (1390:30): [True: 0, False: 0]
  |  Branch (1390:47): [True: 0, False: 0]
  ------------------
 1391|  1.21k|                             !is->pINChI[jj]->bDeleted && !is->pINChI[jj]->lenTautomer)
  ------------------
  |  Branch (1391:30): [True: 0, False: 0]
  |  Branch (1391:59): [True: 0, False: 0]
  ------------------
 1392|      0|                        {
 1393|      0|                            ; /* the requested non-tautomeric component is in tautomeric position   */
 1394|       |                              /*   (is->pINChI[TAUT_YES]);                                          */
 1395|       |                              /*   process it also as non-tautomeric if Fixed-H layer was requested */
 1396|      0|                        }
 1397|  1.21k|                        else
 1398|  1.21k|                        {
 1399|  1.21k|                            continue;
 1400|  1.21k|                        }
 1401|  1.21k|                    }
 1402|       |
 1403|  1.21k|                    ii = j; /* ii is what we wanted; jj is what we found (0 = TAUT_NON: fixed_H, 1 = TAUT_YES: mobile_H) */
 1404|       |
 1405|       |                    /* -- not used 2004-09-16 ---
 1406|       |                    if ( is2 ) {
 1407|       |                        jj2 = ( j == TAUT_YES )? GET_II(OUT_T1,is2) : ( j == TAUT_NON )? GET_II(OUT_NT,is2) : -1;
 1408|       |                        if ( jj2 >= 0 ) {
 1409|       |                            ii2 = j;
 1410|       |                        } else {
 1411|       |                            ii2 = -1;
 1412|       |                        }
 1413|       |                    } else {
 1414|       |                        jj2 = ii2 = -1;
 1415|       |                    }
 1416|       |                    -----------------------------*/
 1417|  1.21k|                    break;
 1418|       |
 1419|      0|                default:
  ------------------
  |  Branch (1419:17): [True: 0, False: 2.42k]
  ------------------
 1420|      0|                    continue;
 1421|  2.42k|            }
 1422|       |
 1423|  1.21k|            if (( pINChI = is->pINChI[jj] ) && pINChI->nNumberOfAtoms > 0)
  ------------------
  |  Branch (1423:17): [True: 1.21k, False: 0]
  |  Branch (1423:48): [True: 1.21k, False: 0]
  ------------------
 1424|  1.21k|            {
 1425|       |                /*pINChI_Aux = is->pINChI_Aux[jj];*/
 1426|  1.21k|                bCompExists++;
 1427|       |
 1428|  1.21k|                if (j == TAUT_NON)
  ------------------
  |  |  579|  1.21k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1428:21): [True: 0, False: 1.21k]
  ------------------
 1429|      0|                    nAtomsAllComp1 += pINChI->nNumberOfAtoms;
 1430|  1.21k|                else if (j == TAUT_YES)
  ------------------
  |  |  580|  1.21k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1430:26): [True: 1.21k, False: 0]
  ------------------
 1431|  1.21k|                    nAtomsAllComp2 += pINChI->nNumberOfAtoms;
 1432|       |
 1433|       |
 1434|  1.21k|                bCurTaut = ( pINChI->lenTautomer > 0 );
 1435|  1.21k|                bCurIso = ( pINChI->nNumberOfIsotopicAtoms > 0 || pINChI->nNumberOfIsotopicTGroups > 0 );
  ------------------
  |  Branch (1435:29): [True: 14, False: 1.20k]
  |  Branch (1435:67): [True: 0, False: 1.20k]
  ------------------
 1436|  1.21k|                bCurIsoHPos = ( pINChI->nPossibleLocationsOfIsotopicH && pINChI->nPossibleLocationsOfIsotopicH[0] > 1 || pINChI->lenTautomer > 1 );
  ------------------
  |  Branch (1436:33): [True: 0, False: 1.21k]
  |  Branch (1436:74): [True: 0, False: 0]
  |  Branch (1436:122): [True: 39, False: 1.17k]
  ------------------
 1437|       |                /* present isotopic H + their possible positions AND/OR isotopic atoms */
 1438|  1.21k|                bCurIsoHStereo = bCurIsoHPos && ( bTautIsoHNum || bTautIsoAt ) || bCurIso;
  ------------------
  |  Branch (1438:34): [True: 39, False: 1.17k]
  |  Branch (1438:51): [True: 0, False: 39]
  |  Branch (1438:67): [True: 0, False: 39]
  |  Branch (1438:83): [True: 14, False: 1.20k]
  ------------------
 1439|  1.21k|                if (jj == j && pINChI->bDeleted)
  ------------------
  |  Branch (1439:21): [True: 1.21k, False: 0]
  |  Branch (1439:32): [True: 0, False: 1.21k]
  ------------------
 1440|      0|                {
 1441|      0|                    io.num_comp[j] --;
 1442|      0|                    if (bCurTaut)
  ------------------
  |  Branch (1442:25): [True: 0, False: 0]
  ------------------
 1443|      0|                    {
 1444|      0|                        io.bTautomeric |= 1; /* tautomeric representation is present */
 1445|      0|                        io.bNonTautomeric |= HAS_N( is );
  ------------------
  |  |   65|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (65:20): [True: 0, False: 0]
  |  |  |  Branch (65:43): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1446|      0|                    }
 1447|      0|                    io.bIsotopic |= bCurIso;
 1448|      0|                    continue; /* deleted H(+) in tautomeric representation */
 1449|      0|                }
 1450|       |
 1451|  1.21k|                bCurStereoSp2 = pINChI->Stereo && ( pINChI->Stereo->nNumberOfStereoBonds > 0 );
  ------------------
  |  Branch (1451:33): [True: 1, False: 1.21k]
  |  Branch (1451:51): [True: 0, False: 1]
  ------------------
 1452|       |
 1453|  1.21k|                bCurHasIsoStereo =
 1454|  1.21k|                    bCurStereoSp3 = pINChI->Stereo && ( pINChI->Stereo->nNumberOfStereoCenters > 0 );
  ------------------
  |  Branch (1454:37): [True: 1, False: 1.21k]
  |  Branch (1454:55): [True: 0, False: 1]
  ------------------
 1455|       |
 1456|  1.21k|                bCurIsoStereoSp2 = bCurIsoHStereo && pINChI->StereoIsotopic && ( pINChI->StereoIsotopic->nNumberOfStereoBonds > 0 );
  ------------------
  |  Branch (1456:36): [True: 14, False: 1.20k]
  |  Branch (1456:54): [True: 0, False: 14]
  |  Branch (1456:80): [True: 0, False: 0]
  ------------------
 1457|  1.21k|                bCurIsoStereoSp3 = bCurIsoHStereo && pINChI->StereoIsotopic && ( pINChI->StereoIsotopic->nNumberOfStereoCenters > 0 );
  ------------------
  |  Branch (1457:36): [True: 14, False: 1.20k]
  |  Branch (1457:54): [True: 0, False: 14]
  |  Branch (1457:80): [True: 0, False: 0]
  ------------------
 1458|  1.21k|                bCurIsoStereoSp3Inv = bCurIsoStereoSp3 && pINChI->StereoIsotopic->nCompInv2Abs; /* inversion changes sp3 stereo */
  ------------------
  |  Branch (1458:39): [True: 0, False: 1.21k]
  |  Branch (1458:59): [True: 0, False: 0]
  ------------------
 1459|  1.21k|                bRequestedRacemicStereo |= ( 0 != ( pINChI->nFlags & INCHI_FLAG_RAC_STEREO ) );
  ------------------
  |  |  150|  1.21k|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
 1460|  1.21k|                bRequestedRelativeStereo |= ( 0 != ( pINChI->nFlags & INCHI_FLAG_REL_STEREO ) );
  ------------------
  |  |  149|  1.21k|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
 1461|       |
 1462|       |                /* Check whether isotopic stereo is same as non-isotopic; if same than do not output isotopic stereo */
 1463|  1.21k|                if (bCurStereoSp2 && bCurIsoStereoSp2)
  ------------------
  |  Branch (1463:21): [True: 0, False: 1.21k]
  |  Branch (1463:38): [True: 0, False: 0]
  ------------------
 1464|      0|                {
 1465|      0|                    bCurIsoStereoSp2 = !Eql_INChI_Stereo( pINChI->Stereo, EQL_SP2, pINChI->StereoIsotopic, EQL_SP2, 0 );
  ------------------
  |  |  247|      0|#define EQL_SP2      8
  ------------------
                                  bCurIsoStereoSp2 = !Eql_INChI_Stereo( pINChI->Stereo, EQL_SP2, pINChI->StereoIsotopic, EQL_SP2, 0 );
  ------------------
  |  |  247|      0|#define EQL_SP2      8
  ------------------
 1466|      0|                }
 1467|  1.21k|                if (bCurStereoSp3 && bCurIsoStereoSp3)
  ------------------
  |  Branch (1467:21): [True: 0, False: 1.21k]
  |  Branch (1467:38): [True: 0, False: 0]
  ------------------
 1468|      0|                {
 1469|       |                    /* bCurIsoStereoSp3=0 means (iso stereo sp3) = (non-iso stereo sp3) or (iso stereo sp3) = Inv(non-iso stereo sp3) */
 1470|      0|                    bCurIsoStereoSp3 = !Eql_INChI_Stereo( pINChI->Stereo, EQL_SP3, pINChI->StereoIsotopic, EQL_SP3,
  ------------------
  |  |  245|      0|#define EQL_SP3      2
  ------------------
                                  bCurIsoStereoSp3 = !Eql_INChI_Stereo( pINChI->Stereo, EQL_SP3, pINChI->StereoIsotopic, EQL_SP3,
  ------------------
  |  |  245|      0|#define EQL_SP3      2
  ------------------
 1471|      0|                        ( pINChI->nFlags & INCHI_FLAG_RAC_STEREO ) || ( pINChI->nFlags & INCHI_FLAG_REL_STEREO ) );
  ------------------
  |  |  150|      0|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
                                      ( pINChI->nFlags & INCHI_FLAG_RAC_STEREO ) || ( pINChI->nFlags & INCHI_FLAG_REL_STEREO ) );
  ------------------
  |  |  149|      0|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
  |  Branch (1471:25): [True: 0, False: 0]
  |  Branch (1471:71): [True: 0, False: 0]
  ------------------
 1472|      0|                    if (!bCurIsoStereoSp3)
  ------------------
  |  Branch (1472:25): [True: 0, False: 0]
  ------------------
 1473|      0|                    {
 1474|       |                        /* Inversion changes iso sp3 differently from non-iso sp3 Fix11 */
 1475|      0|                        bCurIsoStereoSp3Inv &= ( pINChI->StereoIsotopic->nCompInv2Abs != pINChI->Stereo->nCompInv2Abs );
 1476|      0|                    }
 1477|      0|                }
 1478|       |
 1479|  1.21k|                bCurRelative = bRequestedRelativeStereo && bCurStereoSp3;
  ------------------
  |  Branch (1479:32): [True: 0, False: 1.21k]
  |  Branch (1479:60): [True: 0, False: 0]
  ------------------
 1480|       |#if ( REL_RAC_STEREO_IGN_1_SC == 1 )
 1481|       |                bCurRelative = bCurRelative &&
 1482|       |                    ( pINChI->Stereo->nNumberOfStereoCenters > 1 ) &&
 1483|       |                    ( pINChI->Stereo->nCompInv2Abs != 0 ) &&
 1484|       |#endif
 1485|       |
 1486|       |
 1487|       |
 1488|  1.21k|                    bCurIsoRelative = bRequestedRelativeStereo && ( bCurIsoStereoSp3 || bCurIsoStereoSp3Inv );
  ------------------
  |  Branch (1488:39): [True: 0, False: 1.21k]
  |  Branch (1488:69): [True: 0, False: 0]
  |  Branch (1488:89): [True: 0, False: 0]
  ------------------
 1489|       |#if ( REL_RAC_STEREO_IGN_1_SC == 1 )
 1490|       |                bCurIsoRelative = bCurIsoRelative &&
 1491|       |                    ( pINChI->StereoIsotopic->nNumberOfStereoCenters > 1 ) &&
 1492|       |                    ( pINChI->StereoIsotopic->nCompInv2Abs != 0 ) &&
 1493|       |#endif
 1494|       |
 1495|       |
 1496|  1.21k|                    bCurRacemic = bRequestedRacemicStereo && bCurStereoSp3;
  ------------------
  |  Branch (1496:35): [True: 0, False: 1.21k]
  |  Branch (1496:62): [True: 0, False: 0]
  ------------------
 1497|       |#if ( REL_RAC_STEREO_IGN_1_SC == 1 )
 1498|       |                bCurRacemic = bCurRacemic &&
 1499|       |                    ( pINChI->Stereo->nCompInv2Abs != 0 ) &&
 1500|       |                    ( pINChI->Stereo->nNumberOfStereoCenters > 0 ) ?
 1501|       |                    pINChI->Stereo->nNumberOfStereoCenters : 0;
 1502|       |#endif
 1503|       |
 1504|  1.21k|                bCurIsoRacemic = bRequestedRacemicStereo && ( bCurIsoStereoSp3 || bCurIsoStereoSp3Inv );
  ------------------
  |  Branch (1504:34): [True: 0, False: 1.21k]
  |  Branch (1504:63): [True: 0, False: 0]
  |  Branch (1504:83): [True: 0, False: 0]
  ------------------
 1505|       |#if ( REL_RAC_STEREO_IGN_1_SC == 1 )
 1506|       |                bCurIsoRacemic = bCurIsoRacemic &
 1507|       |                    ( pINChI->StereoIsotopic->nCompInv2Abs != 0 ) &&
 1508|       |                    ( pINChI->StereoIsotopic->nNumberOfStereoCenters > 0 ) ?
 1509|       |                    pINChI->StereoIsotopic->nNumberOfStereoCenters : 0;
 1510|       |#endif
 1511|  1.21k|                if (bRequestedRelativeStereo)
  ------------------
  |  Branch (1511:21): [True: 0, False: 1.21k]
  ------------------
 1512|      0|                {
 1513|      0|                    bCurStereoSp3 = bCurRelative || bCurStereoSp3 && ( pINChI->Stereo->nNumberOfStereoCenters > 1 ); /* Fix11 */
  ------------------
  |  Branch (1513:37): [True: 0, False: 0]
  |  Branch (1513:53): [True: 0, False: 0]
  |  Branch (1513:70): [True: 0, False: 0]
  ------------------
 1514|      0|                    bCurIsoStereoSp3 = bCurIsoRelative ? bCurIsoStereoSp3 : 0;
  ------------------
  |  Branch (1514:40): [True: 0, False: 0]
  ------------------
 1515|      0|                }
 1516|  1.21k|                else
 1517|  1.21k|                {
 1518|  1.21k|                    if (bRequestedRacemicStereo)
  ------------------
  |  Branch (1518:25): [True: 0, False: 1.21k]
  ------------------
 1519|      0|                    {
 1520|      0|                        bCurStereoSp3 = bCurRacemic > 1 || bCurStereoSp3 && ( pINChI->Stereo->nNumberOfStereoCenters > 1 ); /* Fix11 */
  ------------------
  |  Branch (1520:41): [True: 0, False: 0]
  |  Branch (1520:60): [True: 0, False: 0]
  |  Branch (1520:77): [True: 0, False: 0]
  ------------------
 1521|      0|                        bCurIsoStereoSp3 = bCurIsoRacemic > 1 ? bCurIsoStereoSp3 : 0;
  ------------------
  |  Branch (1521:44): [True: 0, False: 0]
  ------------------
 1522|      0|                    }
 1523|  1.21k|                }
 1524|  1.21k|                bCurStereo = bCurStereoSp2 || bCurStereoSp3;
  ------------------
  |  Branch (1524:30): [True: 0, False: 1.21k]
  |  Branch (1524:47): [True: 0, False: 1.21k]
  ------------------
 1525|  1.21k|                bCurIsoStereo = bCurIsoStereoSp2 || bCurIsoStereoSp3;
  ------------------
  |  Branch (1525:33): [True: 0, False: 1.21k]
  |  Branch (1525:53): [True: 0, False: 1.21k]
  ------------------
 1526|       |
 1527|  1.21k|                io.bIsotopic |= bCurIso;
 1528|  1.21k|                bHasIsotopicAtoms[ii] |= bCurIso;
 1529|  1.21k|                bStereoSp2[ii] |= bCurStereoSp2;
 1530|  1.21k|                bStereoSp3[ii] |= bCurStereoSp3;
 1531|  1.21k|                io.bIgn_UU_Sp3[ii] |= !bCurStereoSp3 && ( pINChI->nFlags & INCHI_FLAG_SC_IGN_ALL_UU );
  ------------------
  |  |  151|  1.21k|#define INCHI_FLAG_SC_IGN_ALL_UU        0x0008   /* ignored all undefined/unknown stereocenters, non-isotopic */
  ------------------
  |  Branch (1531:39): [True: 1.21k, False: 0]
  |  Branch (1531:57): [True: 0, False: 1.21k]
  ------------------
 1532|  1.21k|                io.bIgn_UU_Sp2[ii] |= !bCurStereoSp2 && ( pINChI->nFlags & INCHI_FLAG_SB_IGN_ALL_UU );
  ------------------
  |  |  152|  1.21k|#define INCHI_FLAG_SB_IGN_ALL_UU        0x0010   /* ignored all undefined/unknown stereocenters, non-isotopic */
  ------------------
  |  Branch (1532:39): [True: 1.21k, False: 0]
  |  Branch (1532:57): [True: 0, False: 1.21k]
  ------------------
 1533|  1.21k|                bIsotopicStereoSp2[ii] |= bCurIsoStereoSp2;
 1534|  1.21k|                bIsotopicStereoSp3[ii] |= bCurIsoStereoSp3;
 1535|  1.21k|                io.bIgn_UU_Sp3_Iso[ii] |= !bCurIsoStereoSp3 && ( pINChI->nFlags & INCHI_FLAG_SC_IGN_ALL_ISO_UU );
  ------------------
  |  |  153|  1.21k|#define INCHI_FLAG_SC_IGN_ALL_ISO_UU    0x0020   /* ignored all undefined/unknown stereocenters, isotopic */
  ------------------
  |  Branch (1535:43): [True: 1.21k, False: 0]
  |  Branch (1535:64): [True: 0, False: 1.21k]
  ------------------
 1536|  1.21k|                io.bIgn_UU_Sp2_Iso[ii] |= !bCurIsoStereoSp2 && ( pINChI->nFlags & INCHI_FLAG_SB_IGN_ALL_ISO_UU );
  ------------------
  |  |  154|  1.21k|#define INCHI_FLAG_SB_IGN_ALL_ISO_UU    0x0040   /* ignored all undefined/unknown stereocenters, isotopic */
  ------------------
  |  Branch (1536:43): [True: 1.21k, False: 0]
  |  Branch (1536:64): [True: 0, False: 1.21k]
  ------------------
 1537|  1.21k|                bStereoAbs[ii] |= bCurStereoSp3 && ( pINChI->Stereo->nCompInv2Abs != 0 );
  ------------------
  |  Branch (1537:35): [True: 0, False: 1.21k]
  |  Branch (1537:52): [True: 0, False: 0]
  ------------------
 1538|       |
 1539|  1.21k|                bStereoAbsInverted[ii] |= bCurStereoSp3 && ( pINChI->Stereo->nCompInv2Abs < 0 );
  ------------------
  |  Branch (1539:43): [True: 0, False: 1.21k]
  |  Branch (1539:60): [True: 0, False: 0]
  ------------------
 1540|       |
 1541|       |                /* Fix08: missing isotopic inverted flag if isotopic = inverted non-isotopic */
 1542|  1.21k|                bIsotopicStereoAbsInverted[ii] |= bCurIsoStereoSp3 && ( pINChI->StereoIsotopic->nCompInv2Abs < 0 ) ||
  ------------------
  |  Branch (1542:51): [True: 0, False: 1.21k]
  |  Branch (1542:71): [True: 0, False: 0]
  ------------------
 1543|  1.21k|                    !bCurIsoStereoSp3  && pINChI->StereoIsotopic  && pINChI->Stereo &&
  ------------------
  |  Branch (1543:21): [True: 1.21k, False: 0]
  |  Branch (1543:43): [True: 0, False: 1.21k]
  |  Branch (1543:70): [True: 0, False: 0]
  ------------------
 1544|  1.21k|                    pINChI->StereoIsotopic->nCompInv2Abs &&
  ------------------
  |  Branch (1544:21): [True: 0, False: 0]
  ------------------
 1545|  1.21k|                    pINChI->StereoIsotopic->nCompInv2Abs != pINChI->Stereo->nCompInv2Abs;
  ------------------
  |  Branch (1545:21): [True: 0, False: 0]
  ------------------
 1546|       |
 1547|       |                /* Fix 11: missing /s1 if only isotopic stereo is inverted */
 1548|  1.21k|                bIsotopicStereoAbs[ii] |= bCurIsoStereoSp3 && ( pINChI->StereoIsotopic->nCompInv2Abs != 0 ) ||
  ------------------
  |  Branch (1548:43): [True: 0, False: 1.21k]
  |  Branch (1548:63): [True: 0, False: 0]
  ------------------
 1549|  1.21k|                    !bCurIsoStereoSp3  && pINChI->StereoIsotopic  && pINChI->Stereo &&
  ------------------
  |  Branch (1549:21): [True: 1.21k, False: 0]
  |  Branch (1549:43): [True: 0, False: 1.21k]
  |  Branch (1549:70): [True: 0, False: 0]
  ------------------
 1550|  1.21k|                    pINChI->StereoIsotopic->nCompInv2Abs &&
  ------------------
  |  Branch (1550:21): [True: 0, False: 0]
  ------------------
 1551|  1.21k|                    pINChI->StereoIsotopic->nCompInv2Abs != pINChI->Stereo->nCompInv2Abs;
  ------------------
  |  Branch (1551:21): [True: 0, False: 0]
  ------------------
 1552|       |
 1553|  1.21k|                io.bRelativeStereo[ii] |= bCurRelative;
 1554|  1.21k|                io.bIsotopicRelativeStereo[ii] |= bCurIsoRelative;
 1555|  1.21k|                io.bRacemicStereo[ii] |= bCurRacemic;
 1556|  1.21k|                io.bIsotopicRacemicStereo[ii] |= bCurIsoRacemic;
 1557|       |
 1558|       |
 1559|  1.21k|                bTautomericAcid |= ( 0 != ( pINChI->nFlags & INCHI_FLAG_ACID_TAUT ) );
  ------------------
  |  |  148|  1.21k|#define INCHI_FLAG_ACID_TAUT            0x0001   /* tautomerism of dissociated acid invoked */
  ------------------
 1560|  1.21k|                bHardAddRemProton |= ( 0 != ( pINChI->nFlags & INCHI_FLAG_HARD_ADD_REM_PROTON ) );
  ------------------
  |  |  155|  1.21k|#define INCHI_FLAG_HARD_ADD_REM_PROTON  0x0080   /* in normalization a proton has been added or removed along alt path */
  ------------------
 1561|  1.21k|                if (bCurTaut)
  ------------------
  |  Branch (1561:21): [True: 39, False: 1.17k]
  ------------------
 1562|     39|                {
 1563|     39|                    io.bTautomeric |= 1; /* tautomeric representation is present */
 1564|       |                    /* does tautomeric structure have also a non-tautomeric repesentation? */
 1565|     39|                    io.bNonTautomeric |= HAS_N( is );
  ------------------
  |  |   65|     39|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  ------------------
  |  |  |  |  579|     39|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (65:20): [True: 0, False: 39]
  |  |  |  Branch (65:43): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1566|     39|                }
 1567|       |
 1568|       |                /* Auxiliary info */
 1569|  1.21k|                if (!( bINChIOutputOptions & INCHI_OUT_NO_AUX_INFO ) && ( pINChI_Aux = is->pINChI_Aux[jj] ))
  ------------------
  |  |  157|  1.21k|#define INCHI_OUT_NO_AUX_INFO           0x0001   /* do not output Aux Info                  */
  ------------------
  |  Branch (1569:21): [True: 0, False: 1.21k]
  |  Branch (1569:73): [True: 0, False: 0]
  ------------------
 1570|      0|                {
 1571|       |                    /* detect presence of constitutional equivalence onfo */
 1572|      0|                    int bCurEqu, bCurTautEqu = 0, bCurIsoEqu = 0, bCurIsoTautEqu = 0; /* Fix15-disabled */
 1573|      0|                    io.bAtomEqu[ii] |= ( bCurEqu = bHasEquString( pINChI_Aux->nConstitEquNumbers,
 1574|      0|                        pINChI_Aux->nNumberOfAtoms ) );
 1575|      0|                    if (bCurTaut)
  ------------------
  |  Branch (1575:25): [True: 0, False: 0]
  ------------------
 1576|      0|                    {
 1577|      0|                        io.bTautEqu[ii] |= ( bCurTautEqu = bHasEquString( pINChI_Aux->nConstitEquTGroupNumbers,
 1578|      0|                            pINChI_Aux->nNumberOfTGroups ) );
 1579|      0|                    }
 1580|      0|                    if (bCurIso)
  ------------------
  |  Branch (1580:25): [True: 0, False: 0]
  ------------------
 1581|      0|                    {
 1582|      0|                        io.bIsotopicAtomEqu[ii] |= ( bCurIsoEqu = bHasEquString( pINChI_Aux->nConstitEquIsotopicNumbers,
 1583|      0|                            pINChI_Aux->nNumberOfAtoms ) ) /*|| bCurEqu*/;
 1584|      0|                        if (bCurTaut)
  ------------------
  |  Branch (1584:29): [True: 0, False: 0]
  ------------------
 1585|      0|                        {
 1586|      0|                            io.bIsotopicTautEqu[ii] |= ( bCurIsoTautEqu = bHasEquString( pINChI_Aux->nConstitEquIsotopicTGroupNumbers,
 1587|      0|                                pINChI_Aux->nNumberOfTGroups ) ) /*|| bCurTautEqu*/;
 1588|      0|                        }
 1589|       |                        /* non-zero if isotopic numbering for inverted isotopic stereo is different */
 1590|      0|                        io.bIsotopicOrigNumb[ii] |= bCurHasIsoStereo && /* Fix14 */
  ------------------
  |  Branch (1590:53): [True: 0, False: 0]
  ------------------
 1591|      0|                            pINChI_Aux->nOrigAtNosInCanonOrdInv &&
  ------------------
  |  Branch (1591:29): [True: 0, False: 0]
  ------------------
 1592|      0|                            pINChI_Aux->nIsotopicOrigAtNosInCanonOrd &&
  ------------------
  |  Branch (1592:29): [True: 0, False: 0]
  ------------------
 1593|      0|                            ( 0 != memcmp( pINChI_Aux->nOrigAtNosInCanonOrdInv,
  ------------------
  |  Branch (1593:29): [True: 0, False: 0]
  ------------------
 1594|      0|                                pINChI_Aux->nIsotopicOrigAtNosInCanonOrd,
 1595|      0|                                sizeof( pINChI_Aux->nOrigAtNosInCanonOrdInv[0] ) * pINChI_Aux->nNumberOfAtoms ) );
 1596|      0|                    }
 1597|       |                    /* Inverted stereo */
 1598|      0|                    if (bCurStereoSp3 && pINChI->Stereo->nCompInv2Abs)
  ------------------
  |  Branch (1598:25): [True: 0, False: 0]
  |  Branch (1598:42): [True: 0, False: 0]
  ------------------
 1599|      0|                    {
 1600|      0|                        io.bInvStereo[ii] |= 1;
 1601|      0|                        io.bInvStereoOrigNumb[ii] |= pINChI_Aux->nOrigAtNosInCanonOrd &&
  ------------------
  |  Branch (1601:54): [True: 0, False: 0]
  ------------------
 1602|      0|                            pINChI_Aux->nOrigAtNosInCanonOrdInv &&
  ------------------
  |  Branch (1602:29): [True: 0, False: 0]
  ------------------
 1603|      0|                            ( 0 != memcmp( pINChI_Aux->nOrigAtNosInCanonOrd,
  ------------------
  |  Branch (1603:29): [True: 0, False: 0]
  ------------------
 1604|      0|                                pINChI_Aux->nOrigAtNosInCanonOrdInv,
 1605|      0|                                sizeof( pINChI_Aux->nOrigAtNosInCanonOrd[0] ) * pINChI_Aux->nNumberOfAtoms ) );
 1606|      0|                    }
 1607|       |
 1608|       |                    /* Inverted isotopic stereo */
 1609|      0|                    if (bCurIsoStereoSp3 && pINChI->StereoIsotopic->nCompInv2Abs)
  ------------------
  |  Branch (1609:25): [True: 0, False: 0]
  |  Branch (1609:45): [True: 0, False: 0]
  ------------------
 1610|      0|                    {
 1611|      0|                        io.bInvIsotopicStereo[ii] |= 1;
 1612|       |
 1613|      0|                        io.bInvIsotopicStereoOrigNumb[ii]
 1614|      0|                            |= pINChI_Aux->nIsotopicOrigAtNosInCanonOrd &&
  ------------------
  |  Branch (1614:32): [True: 0, False: 0]
  ------------------
 1615|      0|                            pINChI_Aux->nIsotopicOrigAtNosInCanonOrdInv &&
  ------------------
  |  Branch (1615:29): [True: 0, False: 0]
  ------------------
 1616|      0|                            ( 0 != memcmp( pINChI_Aux->nIsotopicOrigAtNosInCanonOrd,
  ------------------
  |  Branch (1616:29): [True: 0, False: 0]
  ------------------
 1617|      0|                                pINChI_Aux->nIsotopicOrigAtNosInCanonOrdInv,
 1618|      0|                                sizeof( pINChI_Aux->nIsotopicOrigAtNosInCanonOrd[0] ) * pINChI_Aux->nNumberOfAtoms ) );
 1619|      0|                    }
 1620|       |
 1621|      0|                    if (pINChI_Aux->OrigInfo && bHasOrigInfo( pINChI_Aux->OrigInfo, pINChI_Aux->nNumberOfAtoms ))
  ------------------
  |  Branch (1621:25): [True: 0, False: 0]
  |  Branch (1621:49): [True: 0, False: 0]
  ------------------
 1622|      0|                    {
 1623|      0|                        io.bChargesRadVal[ii] |= 1;
 1624|      0|                    }
 1625|      0|                }
 1626|  1.21k|            }
 1627|  1.21k|        }
 1628|  1.21k|        if (bCompExists)
  ------------------
  |  Branch (1628:13): [True: 1.21k, False: 0]
  ------------------
 1629|  1.21k|        {
 1630|  3.64k|            for (j = TAUT_NON; j < TAUT_NUM; j++)
  ------------------
  |  |  579|  1.21k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                          for (j = TAUT_NON; j < TAUT_NUM; j++)
  ------------------
  |  |  578|  3.64k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1630:32): [True: 2.42k, False: 1.21k]
  ------------------
 1631|  2.42k|            {
 1632|  2.42k|                io.num_comp[j] ++;
 1633|  2.42k|            }
 1634|  1.21k|        }
 1635|  1.21k|    }
 1636|     80|    if (io.bTautomeric /*&& bTautomericAcid*/) /* "&& bTautomericAcid" commented out 2004-06-02 */
  ------------------
  |  Branch (1636:9): [True: 39, False: 41]
  ------------------
 1637|     39|    {
 1638|     39|        io.bTautomeric += bTautomericAcid; /* long-range tautomerism */
 1639|     39|        io.bTautomeric += ( bHardAddRemProton ? 4 : 0 );
  ------------------
  |  Branch (1639:29): [True: 0, False: 39]
  ------------------
 1640|     39|    }
 1641|     80|    if (bRequestedRacemicStereo || bRequestedRelativeStereo)
  ------------------
  |  Branch (1641:9): [True: 0, False: 80]
  |  Branch (1641:36): [True: 0, False: 80]
  ------------------
 1642|      0|    {
 1643|       |        /* do not output inverted stereo info */
 1644|      0|        for (i = 0; i < TAUT_NUM; i++)
  ------------------
  |  |  578|      0|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1644:21): [True: 0, False: 0]
  ------------------
 1645|      0|        {
 1646|       |            /* Fix11 */
 1647|      0|            bStereoAbsInverted[i] =
 1648|      0|                bStereoAbs[i] =
 1649|      0|                io.bInvStereo[i] =
 1650|      0|                io.bInvStereoOrigNumb[i] = 0;
 1651|       |                /* io.bIsotopicRelativeStereo[i]=0 may happen because iso stereo is same or inverted non-iso stereo */
 1652|      0|            bIsotopicStereoAbsInverted[i] =
 1653|      0|                bIsotopicStereoAbs[i] =
 1654|      0|                io.bInvIsotopicStereo[i] =
 1655|      0|                io.bInvIsotopicStereoOrigNumb[i] = 0;
 1656|      0|        }
 1657|      0|    }
 1658|       |
 1659|       |
 1660|     80|    io.iCurTautMode = io.bOutType == OUT_N1 ? TAUT_NON :  /*  only non-taut */
  ------------------
  |  |  585|     80|#define OUT_N1              0    /* non-tautomeric only */
  ------------------
                  io.iCurTautMode = io.bOutType == OUT_N1 ? TAUT_NON :  /*  only non-taut */
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1660:23): [True: 0, False: 80]
  ------------------
 1661|       |
 1662|     80|        io.bOutType == OUT_T1 ? TAUT_YES :      /*  tautomeric if present, otherwise non-tautomeric     */
  ------------------
  |  |  586|     80|#define OUT_T1              1    /* tautomeric if present otherwise non-tautomeric */
  ------------------
                      io.bOutType == OUT_T1 ? TAUT_YES :      /*  tautomeric if present, otherwise non-tautomeric     */
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1662:9): [True: 0, False: 80]
  ------------------
 1663|     80|        io.bOutType == OUT_NT ? TAUT_NON :      /*  only non-taut representations of tautomeric         */
  ------------------
  |  |  587|     80|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  ------------------
                      io.bOutType == OUT_NT ? TAUT_NON :      /*  only non-taut representations of tautomeric         */
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1663:9): [True: 0, False: 80]
  ------------------
 1664|     80|        io.bOutType == OUT_TN ? TAUT_YES :       /*  tautomeric if present otherwise non-tautomeric;     */
  ------------------
  |  |  588|     80|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  ------------------
                      io.bOutType == OUT_TN ? TAUT_YES :       /*  tautomeric if present otherwise non-tautomeric;     */
  ------------------
  |  |  580|     80|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1664:9): [True: 80, False: 0]
  ------------------
 1665|     80|        -1; /*  separately output non-taut representations of tautomeric if present */
 1666|       |
 1667|     80|    if (io.iCurTautMode < 0)
  ------------------
  |  Branch (1667:9): [True: 0, False: 80]
  ------------------
 1668|      0|    {
 1669|      0|        return 0;  /* error */
 1670|      0|    }
 1671|       |
 1672|       |
 1673|       |    /* Now print out */
 1674|       |
 1675|     80|    io.bOverflow = 0;
 1676|     80|    io.num_components = io.num_comp[io.iCurTautMode];
 1677|     80|    max_num_comp = inchi_max( io.num_comp[TAUT_NON], io.num_comp[TAUT_YES] );
  ------------------
  |  |  166|     80|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 80]
  |  |  ------------------
  ------------------
 1678|       |
 1679|     80|    if (bINChIOutputOptions & INCHI_OUT_ONLY_AUX_INFO)
  ------------------
  |  |  159|     80|#define INCHI_OUT_ONLY_AUX_INFO         0x0004   /* output only Aux Info                    */
  ------------------
  |  Branch (1679:9): [True: 0, False: 80]
  ------------------
 1680|      0|    {
 1681|      0|        goto output_aux_info;
 1682|      0|    }
 1683|       |
 1684|     80|    io.nCurINChISegment = DIFL_M;
 1685|       |
 1686|       |    /* InChI output: version and kind */
 1687|     80|    if (INCHI_basic_or_INCHI_reconnected == INCHI_BAS || !( bINChIOutputOptions & INCHI_OUT_EMBED_REC ))
  ------------------
  |  |  575|    160|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                  if (INCHI_basic_or_INCHI_reconnected == INCHI_BAS || !( bINChIOutputOptions & INCHI_OUT_EMBED_REC ))
  ------------------
  |  |  160|      0|#define INCHI_OUT_EMBED_REC             0x0008   /* embed reconnected INChI into disconnected INChI */
  ------------------
  |  Branch (1687:9): [True: 80, False: 0]
  |  Branch (1687:58): [True: 0, False: 0]
  ------------------
 1688|     80|    {
 1689|     80|        int is_beta = 0;
 1690|     80|        int nAtomsAllComp = inchi_max( nAtomsAllComp1, nAtomsAllComp2 );
  ------------------
  |  |  166|     80|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 80]
  |  |  ------------------
  ------------------
 1691|       |
 1692|     80|        if (nAtomsAllComp > NORMALLY_ALLOWED_INP_MAX_ATOMS)
  ------------------
  |  |   44|     80|#define NORMALLY_ALLOWED_INP_MAX_ATOMS 1024
  ------------------
  |  Branch (1692:13): [True: 36, False: 44]
  ------------------
 1693|     36|        {
 1694|       |            /* v. 1.05 for LargeMolecules */
 1695|     36|            is_beta = 1;
 1696|     36|        }
 1697|     80|        if (pOrigStruct && pOrigStruct->polymer)
  ------------------
  |  Branch (1697:13): [True: 0, False: 80]
  |  Branch (1697:28): [True: 0, False: 0]
  ------------------
 1698|      0|        {
 1699|       |            /* v. 1.05 for Polymers */
 1700|      0|            is_beta = 1;
 1701|      0|        }
 1702|       |        /* specifically put 'B' for empty structure InChI    */
 1703|       |        /* if "Polymers" or "LargeMolecules" requested        */
 1704|     80|        else if (!pOrigStruct && ( ip->bLargeMolecules || ip->bPolymers ))
  ------------------
  |  Branch (1704:18): [True: 80, False: 0]
  |  Branch (1704:36): [True: 0, False: 80]
  |  Branch (1704:59): [True: 0, False: 80]
  ------------------
 1705|      0|        {
 1706|      0|            is_beta = 1;
 1707|      0|        }
 1708|     80|        else if (pOrigStruct && pOrigStruct->n_zy)
  ------------------
  |  Branch (1708:18): [True: 0, False: 80]
  |  Branch (1708:33): [True: 0, False: 0]
  ------------------
 1709|      0|        {
 1710|      0|            is_beta = 1;
 1711|      0|        }
 1712|       |
 1713|     80|        OutputINCHI_VersionAndKind( out_file, strbuf, bINChIOutputOptions, is_beta, pLF, pTAB );
 1714|     80|    }
 1715|       |
 1716|       |
 1717|       |
 1718|       |    /* InChI output: atoms */
 1719|     80|    intermediate_result = OutputINCHI_MainLayerFormula( pCG, out_file, strbuf,
 1720|     80|                                                        num_components2,
 1721|     80|                                                        &INCHI_basic_or_INCHI_reconnected,
 1722|     80|                                                        &io, pLF, pTAB );
 1723|     80|    if (intermediate_result != 0)
  ------------------
  |  Branch (1723:9): [True: 0, False: 80]
  ------------------
 1724|      0|        goto exit_function;
 1725|       |
 1726|       |    /* InChI output: connection table */
 1727|     80|    intermediate_result = OutputINCHI_MainLayerConnections( pCG, out_file, strbuf, num_components2,
 1728|     80|                                                                &INCHI_basic_or_INCHI_reconnected,
 1729|     80|                                                                &io, pLF, pTAB );
 1730|     80|    if (intermediate_result != 0)
  ------------------
  |  Branch (1730:9): [True: 0, False: 80]
  ------------------
 1731|      0|        goto exit_function;
 1732|       |
 1733|       |    /* InChI output: hydrogens (with tautomeric info) */
 1734|     80|    intermediate_result = OutputINCHI_MainLayerHydrogens( pCG, out_file, strbuf, num_components2,
 1735|     80|                                                              &INCHI_basic_or_INCHI_reconnected,
 1736|     80|                                                              &io, pLF, pTAB );
 1737|     80|    if (intermediate_result != 0)
  ------------------
  |  Branch (1737:9): [True: 0, False: 80]
  ------------------
 1738|      0|        goto exit_function;
 1739|       |
 1740|     80|    io.bFhTag = 0;
 1741|     80|    npass = 0;
 1742|       |
 1743|       |
 1744|     80|repeat_INChI_output:
 1745|       |
 1746|       |    /* InChI output: charge and  removed protons */
 1747|     80|    intermediate_result = OutputINCHI_ChargeAndRemovedAddedProtonsLayers( pCG, out_file, strbuf,
 1748|     80|                                                                              &io, pLF, pTAB );
 1749|     80|    if (intermediate_result != 0)
  ------------------
  |  Branch (1749:9): [True: 0, False: 80]
  ------------------
 1750|      0|        goto exit_function;
 1751|       |
 1752|       |    /* InChI output: polymer layer */
 1753|     80|    if (npass == 0)
  ------------------
  |  Branch (1753:9): [True: 80, False: 0]
  ------------------
 1754|     80|    {
 1755|     80|        intermediate_result = OutputINCHI_PolymerLayer( pCG, out_file, strbuf,
 1756|     80|                                                        &INCHI_basic_or_INCHI_reconnected,
 1757|     80|                                                        orig_inp_data, pOrigStruct,
 1758|     80|                                                        &io, pLF, pTAB );
 1759|     80|        if (intermediate_result != 0)
  ------------------
  |  Branch (1759:13): [True: 0, False: 80]
  ------------------
 1760|      0|            goto exit_function;
 1761|     80|    }
 1762|       |
 1763|       |    /* InChI output: stereo (non-isotopic) */
 1764|     80|    intermediate_result = OutputINCHI_StereoLayer( pCG, out_file, strbuf, &io, pLF, pTAB );
 1765|     80|    if (intermediate_result != 0)
  ------------------
  |  Branch (1765:9): [True: 0, False: 80]
  ------------------
 1766|      0|        goto exit_function;
 1767|       |
 1768|       |
 1769|       |    /* Switch from M to MI or from F to FI */
 1770|     80|    io.nCurINChISegment++;
 1771|       |
 1772|       |    /* InChI output: isotopic */
 1773|     80|    intermediate_result = OutputINCHI_IsotopicLayer( pCG, out_file, strbuf,
 1774|     80|                                                         &INCHI_basic_or_INCHI_reconnected,
 1775|     80|                                                         &io, pLF, pTAB );
 1776|       |
 1777|     80|    if (intermediate_result != 0)
  ------------------
  |  Branch (1777:9): [True: 0, False: 80]
  ------------------
 1778|      0|    {
 1779|      0|        goto exit_function;
 1780|      0|    }
 1781|       |
 1782|       |
 1783|       |
 1784|       |    /*
 1785|       |        At this point the INChI part of the output has been done.
 1786|       |        If this INChI is tautomeric and non-tautomeric results exist,
 1787|       |        then we need to output non-tautomeric data:
 1788|       |            fixed H
 1789|       |            stereo
 1790|       |            isotopic
 1791|       |            isotopic stereo
 1792|       |    */
 1793|       |
 1794|       |
 1795|       |    /* InChI output: FixedH and sublayers */
 1796|     80|    intermediate_result = OutputINCHI_FixedHLayerWithSublayers( pCG, out_file, strbuf,
 1797|     80|                                                                &INCHI_basic_or_INCHI_reconnected,
 1798|     80|                                                                &io, pLF, pTAB,
 1799|     80|                                                                &then_goto_repeat );
 1800|     80|    if (intermediate_result != 0)
  ------------------
  |  Branch (1800:9): [True: 0, False: 80]
  ------------------
 1801|      0|    {
 1802|      0|        goto exit_function;
 1803|      0|    }
 1804|     80|    if (then_goto_repeat)
  ------------------
  |  Branch (1804:9): [True: 0, False: 80]
  ------------------
 1805|      0|    {
 1806|      0|        npass++;
 1807|      0|        goto repeat_INChI_output;
 1808|      0|    }
 1809|       |
 1810|       |
 1811|       |    /*
 1812|       |        InChI output:  reconnected structure
 1813|       |    */
 1814|       |
 1815|     80|    bEmbeddedOutputCalled = 0;
 1816|     80|    if (bDisconnectedCoord && INCHI_basic_or_INCHI_reconnected == INCHI_BAS &&
  ------------------
  |  |  575|     80|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (1816:9): [True: 0, False: 80]
  |  Branch (1816:31): [True: 0, False: 0]
  ------------------
 1817|     80|        ( bINChIOutputOptions & INCHI_OUT_EMBED_REC ) && num_components2[INCHI_REC])
  ------------------
  |  |  160|      0|#define INCHI_OUT_EMBED_REC             0x0008   /* embed reconnected INChI into disconnected INChI */
  ------------------
                      ( bINChIOutputOptions & INCHI_OUT_EMBED_REC ) && num_components2[INCHI_REC])
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (1817:9): [True: 0, False: 0]
  |  Branch (1817:58): [True: 0, False: 0]
  ------------------
 1818|      0|    {
 1819|      0|        int nRet;
 1820|      0|        bEmbeddedOutputCalled = 1;
 1821|       |
 1822|       |        /* output blank line before /R: in case of bPlainTextCommnts=1 */
 1823|      0|        inchi_ios_print_nodisplay( out_file, "%s", pLF );
 1824|       |        /* end of disconnected INChI output */
 1825|       |
 1826|      0|        nRet = OutputINChI1( pCG,
 1827|      0|                             strbuf,
 1828|      0|                             pINChISortTautAndNonTaut2,
 1829|      0|                             INCHI_REC,
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1830|      0|                             orig_inp_data,
 1831|      0|                             pOrigStruct,
 1832|      0|                             ip,
 1833|      0|                             0 /*bDisconnectedCoord*/,
 1834|      0|                             bOutputType,
 1835|      0|                             bINChIOutputOptions | INCHI_OUT_NO_AUX_INFO,
  ------------------
  |  |  157|      0|#define INCHI_OUT_NO_AUX_INFO           0x0001   /* do not output Aux Info                  */
  ------------------
 1836|      0|                             num_components2,
 1837|      0|                             num_non_taut2,
 1838|      0|                             num_taut2,
 1839|      0|                             out_file,
 1840|      0|                             log_file,
 1841|      0|                             num_input_struct,
 1842|      0|                             pSortPrintINChIFlags,
 1843|      0|                             save_opt_bits );
 1844|       |
 1845|      0|        if (!nRet)
  ------------------
  |  Branch (1845:13): [True: 0, False: 0]
  ------------------
 1846|      0|        {
 1847|      0|            goto exit_function; /* error */
 1848|      0|        }
 1849|      0|    }
 1850|       |
 1851|       |    /* InChI output: save InChI creation options if requested */
 1852|     80|    if (!bEmbeddedOutputCalled &&
  ------------------
  |  Branch (1852:9): [True: 80, False: 0]
  ------------------
 1853|     80|        ( bINChIOutputOptions & INCHI_OUT_SAVEOPT ) &&
  ------------------
  |  |  174|     80|#define INCHI_OUT_SAVEOPT  0x8000
  ------------------
  |  Branch (1853:9): [True: 0, False: 80]
  ------------------
 1854|     80|        ( 0 == ( bINChIOutputOptions & INCHI_OUT_STDINCHI ) )    /* not std-InChI output */
  ------------------
  |  |  173|      0|#define INCHI_OUT_STDINCHI 0x4000
  ------------------
  |  Branch (1854:9): [True: 0, False: 0]
  ------------------
 1855|     80|        )
 1856|      0|    {
 1857|      0|        char let1, let2;
 1858|      0|        GetSaveOptLetters( save_opt_bits, &let1, &let2 );
 1859|      0|        inchi_ios_print_nodisplay( out_file, "\\%c%c", let1, let2 );
 1860|      0|    }
 1861|     80|    if (!bEmbeddedOutputCalled && !bPlainTextCommnts)
  ------------------
  |  Branch (1861:9): [True: 80, False: 0]
  |  Branch (1861:35): [True: 80, False: 0]
  ------------------
 1862|     80|    { /* plain text comment earlier ended with LF */
 1863|     80|        inchi_ios_print_nodisplay( out_file, "%s%s",
 1864|     80|            ( !num_components2[0] && !num_components2[1] ) ? "//" : "", /* empty InChI=// */
  ------------------
  |  Branch (1864:15): [True: 0, False: 80]
  |  Branch (1864:38): [True: 0, False: 0]
  ------------------
 1865|     80|            ( bINChIOutputOptions & INCHI_OUT_NO_AUX_INFO ) ? "\n" : pTAB );
  ------------------
  |  |  157|     80|#define INCHI_OUT_NO_AUX_INFO           0x0001   /* do not output Aux Info                  */
  ------------------
  |  Branch (1865:13): [True: 80, False: 0]
  ------------------
 1866|       |/* end of INChI= output */
 1867|     80|    }
 1868|       |
 1869|     80|    inchi_strbuf_reset( strbuf );
 1870|       |
 1871|       |#ifdef TARGET_LIB_FOR_WINCHI
 1872|       |    /* @@@ Here we end up with silent output: display previously hidden output */
 1873|       |    if (inchi_ios_flush_not_displayed( out_file ) != -1)
 1874|       |        silent = 0;
 1875|       |#endif
 1876|       |
 1877|       |
 1878|       |
 1879|     80|output_aux_info:
 1880|       |
 1881|       |    /*  Output Aux Info */
 1882|       |
 1883|     80|    io.bFhTag = 0;
 1884|     80|    if (( bINChIOutputOptions & INCHI_OUT_NO_AUX_INFO ) == 0)
  ------------------
  |  |  157|     80|#define INCHI_OUT_NO_AUX_INFO           0x0001   /* do not output Aux Info                  */
  ------------------
  |  Branch (1884:9): [True: 0, False: 80]
  ------------------
 1885|      0|    {
 1886|       |
 1887|      0|        io.num_components = io.num_comp[io.iCurTautMode];
 1888|       |
 1889|       |        /* AuxInfo: header and normalization type */
 1890|      0|        intermediate_result = OutputAUXINFO_HeaderAndNormalization_type( pCG, out_file, strbuf,
 1891|      0|                                                                         bINChIOutputOptions,
 1892|      0|                                                                         &INCHI_basic_or_INCHI_reconnected,
 1893|      0|                                                                         num_components2,
 1894|      0|                                                                         &io, pLF, pTAB );
 1895|      0|        if (intermediate_result != 0)
  ------------------
  |  Branch (1895:13): [True: 0, False: 0]
  ------------------
 1896|      0|            goto exit_function;
 1897|       |
 1898|       |
 1899|      0|    repeat_INChI_Aux_output:
 1900|       |
 1901|       |        /* AuxInfo: original atom numbers and symmetry numbers (constit. equivalence /E: )    */
 1902|      0|        intermediate_result = OutputAUXINFO_OriginalNumbersAndEquivalenceClasses( pCG, out_file, strbuf,
 1903|      0|                                                                                  num_components2,
 1904|      0|                                                                                  &io, pLF, pTAB );
 1905|      0|        if (intermediate_result != 0)
  ------------------
  |  Branch (1905:13): [True: 0, False: 0]
  ------------------
 1906|      0|            goto exit_function;
 1907|       |
 1908|       |        /* AuxInfo: tautomeric groups equivalence */
 1909|      0|        intermediate_result = OutputAUXINFO_TautomericGroupsEquivalence( pCG, out_file, strbuf, &io );
 1910|      0|        if (intermediate_result != 0)
  ------------------
  |  Branch (1910:13): [True: 0, False: 0]
  ------------------
 1911|      0|            goto exit_function;
 1912|       |
 1913|       |        /* AuxInfo: stereo data */
 1914|      0|        intermediate_result = OutputAUXINFO_Stereo( pCG, out_file, strbuf, &io, pLF, pTAB );
 1915|      0|        if (intermediate_result != 0)
  ------------------
  |  Branch (1915:13): [True: 0, False: 0]
  ------------------
 1916|      0|            goto exit_function;
 1917|       |
 1918|      0|    repeat_INChI_Aux_Iso_output:
 1919|       |            /* AuxInfo: isotopic info */
 1920|      0|        intermediate_result = OutputAUXINFO_IsotopicInfo( pCG, out_file, strbuf,
 1921|      0|                                                          &INCHI_basic_or_INCHI_reconnected,
 1922|      0|                                                          &io, pLF, pTAB );
 1923|      0|        if (intermediate_result != 0)
  ------------------
  |  Branch (1923:13): [True: 0, False: 0]
  ------------------
 1924|      0|        {
 1925|      0|            goto exit_function;
 1926|      0|        }
 1927|       |
 1928|       |
 1929|       |        /*
 1930|       |          At this point the INChI_Aux part of the output has been completed.
 1931|       |          If this INChI is tautomeric and non-tautomeric results exist,
 1932|       |          then we need to output non-tautomeric auxilialy data
 1933|       |          (same as above excluding tautomeric information).
 1934|       |          Currently, this is enabled for xml output only
 1935|       |        */
 1936|       |
 1937|      0|        if (io.bOutType == OUT_TN && io.bTautomeric && io.bNonTautomeric &&
  ------------------
  |  |  588|      0|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  ------------------
  |  Branch (1937:13): [True: 0, False: 0]
  |  Branch (1937:38): [True: 0, False: 0]
  |  Branch (1937:56): [True: 0, False: 0]
  ------------------
 1938|       |            /* Check whether the Fixed-H layer is empty */
 1939|      0|            ( *pSortPrintINChIFlags & ( ( INCHI_basic_or_INCHI_reconnected == INCHI_BAS ) ? FLAG_SORT_PRINT_NO_NFIX_H_BAS :
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          ( *pSortPrintINChIFlags & ( ( INCHI_basic_or_INCHI_reconnected == INCHI_BAS ) ? FLAG_SORT_PRINT_NO_NFIX_H_BAS :
  ------------------
  |  |  331|      0|#define FLAG_SORT_PRINT_NO_NFIX_H_BAS  4 /* no fixed H non-isotopic in the main InChI layer */
  ------------------
  |  Branch (1939:13): [True: 0, False: 0]
  |  Branch (1939:41): [True: 0, False: 0]
  ------------------
 1940|      0|                FLAG_SORT_PRINT_NO_NFIX_H_REC ) ) &&
  ------------------
  |  |  332|      0|#define FLAG_SORT_PRINT_NO_NFIX_H_REC  8 /* no fixed H non-isotopic in the reconnected InChI layer */
  ------------------
 1941|      0|                ( *pSortPrintINChIFlags & ( ( INCHI_basic_or_INCHI_reconnected == INCHI_BAS ) ? FLAG_SORT_PRINT_NO_IFIX_H_BAS :
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                              ( *pSortPrintINChIFlags & ( ( INCHI_basic_or_INCHI_reconnected == INCHI_BAS ) ? FLAG_SORT_PRINT_NO_IFIX_H_BAS :
  ------------------
  |  |  333|      0|#define FLAG_SORT_PRINT_NO_IFIX_H_BAS 16 /* no fixed H isotopic in the main InChI layer */
  ------------------
  |  Branch (1941:17): [True: 0, False: 0]
  |  Branch (1941:45): [True: 0, False: 0]
  ------------------
 1942|      0|                    FLAG_SORT_PRINT_NO_IFIX_H_REC ) )
  ------------------
  |  |  334|      0|#define FLAG_SORT_PRINT_NO_IFIX_H_REC 32 /* no fixed H isotopic in the the reconnected InChI layer */
  ------------------
 1943|      0|              )
 1944|      0|        {
 1945|      0|            io.bNonTautomeric = 0; /* bNonTautIdentifierNotEmpty == 0 => no fixed H info 02-10-2995 */
 1946|      0|        }
 1947|       |
 1948|      0|        if (io.bOutType == OUT_TN && io.bTautomeric && io.bNonTautomeric)
  ------------------
  |  |  588|      0|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  ------------------
  |  Branch (1948:13): [True: 0, False: 0]
  |  Branch (1948:38): [True: 0, False: 0]
  |  Branch (1948:56): [True: 0, False: 0]
  ------------------
 1949|      0|        {
 1950|       |            /* add the second (non-tautomeric) output */
 1951|      0|            io.bOutType = OUT_NONTAUT;
  ------------------
  |  |  967|      0|#define OUT_NONTAUT  OUT_NN  /* was OUT_NT until 2004-04-07 */
  |  |  ------------------
  |  |  |  |  590|      0|#define OUT_NN              4    /* only non-taut representations: non-taut else tautomeric */
  |  |  ------------------
  ------------------
 1952|      0|            io.iCurTautMode = TAUT_NON;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 1953|      0|            io.pINChISort = io.pINChISortTautAndNonTaut[TAUT_NON];
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 1954|      0|            io.bSecondNonTautPass = 1;
 1955|      0|            io.num_components = io.num_comp[io.iCurTautMode];
 1956|      0|            io.bFhTag = AL_FIXH;
 1957|      0|            inchi_strbuf_reset( strbuf ); /*pStr[io.tot_len=0] = '\0';*/
 1958|       |
 1959|       |            /* if InChI Fixed-H isotopic is empty then do not output corresponding AuxInfo */
 1960|      0|            if (!( *pSortPrintINChIFlags &
  ------------------
  |  Branch (1960:17): [True: 0, False: 0]
  ------------------
 1961|      0|                ( ( INCHI_basic_or_INCHI_reconnected == INCHI_BAS ) ? FLAG_SORT_PRINT_NO_NFIX_H_BAS :
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                              ( ( INCHI_basic_or_INCHI_reconnected == INCHI_BAS ) ? FLAG_SORT_PRINT_NO_NFIX_H_BAS :
  ------------------
  |  |  331|      0|#define FLAG_SORT_PRINT_NO_NFIX_H_BAS  4 /* no fixed H non-isotopic in the main InChI layer */
  ------------------
  |  Branch (1961:19): [True: 0, False: 0]
  ------------------
 1962|      0|                    FLAG_SORT_PRINT_NO_NFIX_H_REC ) )
  ------------------
  |  |  332|      0|#define FLAG_SORT_PRINT_NO_NFIX_H_REC  8 /* no fixed H non-isotopic in the reconnected InChI layer */
  ------------------
 1963|      0|               )
 1964|      0|            {
 1965|      0|                npass++;
 1966|      0|                goto repeat_INChI_Aux_output;
 1967|      0|            }
 1968|      0|            else
 1969|      0|            {
 1970|      0|                npass++;
 1971|      0|                goto repeat_INChI_Aux_Iso_output;
 1972|      0|            }
 1973|      0|        }
 1974|      0|        else
 1975|      0|        {
 1976|      0|            if (io.bOutType == OUT_NONTAUT && io.bOutputType == OUT_TN && io.bTautomeric && io.bNonTautomeric)
  ------------------
  |  |  967|      0|#define OUT_NONTAUT  OUT_NN  /* was OUT_NT until 2004-04-07 */
  |  |  ------------------
  |  |  |  |  590|      0|#define OUT_NN              4    /* only non-taut representations: non-taut else tautomeric */
  |  |  ------------------
  ------------------
                          if (io.bOutType == OUT_NONTAUT && io.bOutputType == OUT_TN && io.bTautomeric && io.bNonTautomeric)
  ------------------
  |  |  588|      0|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  ------------------
  |  Branch (1976:17): [True: 0, False: 0]
  |  Branch (1976:47): [True: 0, False: 0]
  |  Branch (1976:75): [True: 0, False: 0]
  |  Branch (1976:93): [True: 0, False: 0]
  ------------------
 1977|      0|            {
 1978|       |                /* the second (non-taut) output has been done; restore variables */
 1979|      0|                io.bOutType = OUT_TN;
  ------------------
  |  |  588|      0|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  ------------------
 1980|      0|                io.iCurTautMode = TAUT_YES;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1981|      0|                io.pINChISort = io.pINChISortTautAndNonTaut[TAUT_YES];
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1982|      0|                io.bSecondNonTautPass = 0;
 1983|       |                /* set correct num components for the reversibility info 02-10-2005 */
 1984|      0|                io.num_components = io.num_comp[io.iCurTautMode];
 1985|      0|                io.bFhTag = 0;
 1986|      0|            }
 1987|      0|        }
 1988|       |
 1989|       |        /*    Charges, radicals, unusual valences */
 1990|      0|        intermediate_result = OutputAUXINFO_ChargesRadicalsAndUnusualValences( pCG, out_file, strbuf, &io, pLF, pTAB );
 1991|      0|        if (intermediate_result != 0)
  ------------------
  |  Branch (1991:13): [True: 0, False: 0]
  ------------------
 1992|      0|        {
 1993|      0|            goto exit_function;
 1994|      0|        }
 1995|       |
 1996|       |
 1997|       |        /* Output the original input structure -- quick fix */
 1998|      0|        intermediate_result = OutputAUXINFO_ReversibilityInfo( pCG, out_file, strbuf, pOrigStruct, &io, pLF, pTAB );
 1999|      0|        if (intermediate_result != 0)
  ------------------
  |  Branch (1999:13): [True: 0, False: 0]
  ------------------
 2000|      0|        {
 2001|      0|            goto exit_function;
 2002|      0|        }
 2003|       |
 2004|       |        /* Output polymeric Aux Info */
 2005|      0|        intermediate_result = OutputAUXINFO_PolymerInfo( pCG, out_file, strbuf, pOrigStruct, &io, pLF, pTAB );
 2006|      0|        if (intermediate_result != 0)
  ------------------
  |  Branch (2006:13): [True: 0, False: 0]
  ------------------
 2007|      0|        {
 2008|      0|            goto exit_function;
 2009|      0|        }
 2010|       |
 2011|       |        /*
 2012|       |            Output INChI_Aux of the reconnected structure
 2013|       |        */
 2014|       |
 2015|      0|        bEmbeddedOutputCalled = 0;
 2016|      0|        if (bDisconnectedCoord && INCHI_basic_or_INCHI_reconnected == INCHI_BAS && ( bINChIOutputOptions & INCHI_OUT_EMBED_REC ) &&
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                      if (bDisconnectedCoord && INCHI_basic_or_INCHI_reconnected == INCHI_BAS && ( bINChIOutputOptions & INCHI_OUT_EMBED_REC ) &&
  ------------------
  |  |  160|      0|#define INCHI_OUT_EMBED_REC             0x0008   /* embed reconnected INChI into disconnected INChI */
  ------------------
  |  Branch (2016:13): [True: 0, False: 0]
  |  Branch (2016:35): [True: 0, False: 0]
  |  Branch (2016:84): [True: 0, False: 0]
  ------------------
 2017|      0|             num_components2[INCHI_REC] && !( bINChIOutputOptions & INCHI_OUT_NO_AUX_INFO ))
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                           num_components2[INCHI_REC] && !( bINChIOutputOptions & INCHI_OUT_NO_AUX_INFO ))
  ------------------
  |  |  157|      0|#define INCHI_OUT_NO_AUX_INFO           0x0001   /* do not output Aux Info                  */
  ------------------
  |  Branch (2017:14): [True: 0, False: 0]
  |  Branch (2017:44): [True: 0, False: 0]
  ------------------
 2018|      0|        {
 2019|      0|            int nRet;
 2020|      0|            bEmbeddedOutputCalled = 1;
 2021|      0|            inchi_ios_print( out_file, "%s", pLF );
 2022|       |
 2023|      0|            nRet = OutputINChI1( pCG,
 2024|      0|                                 strbuf,
 2025|      0|                                 pINChISortTautAndNonTaut2,
 2026|      0|                                 INCHI_REC,
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 2027|      0|                                 NULL,
 2028|      0|                                 NULL,
 2029|      0|                                 ip,
 2030|      0|                                 0 /*bDisconnectedCoord*/,
 2031|      0|                                 bOutputType,
 2032|      0|                                 INCHI_OUT_ONLY_AUX_INFO | bINChIOutputOptions,
  ------------------
  |  |  159|      0|#define INCHI_OUT_ONLY_AUX_INFO         0x0004   /* output only Aux Info                    */
  ------------------
 2033|      0|                                 num_components2,
 2034|      0|                                 num_non_taut2,
 2035|      0|                                 num_taut2,
 2036|      0|                                 out_file,
 2037|      0|                                 log_file,
 2038|      0|                                 num_input_struct,
 2039|      0|                                 pSortPrintINChIFlags,
 2040|      0|                                 save_opt_bits );
 2041|       |
 2042|      0|            if (!nRet)
  ------------------
  |  Branch (2042:17): [True: 0, False: 0]
  ------------------
 2043|      0|            {
 2044|      0|                goto exit_function; /* error */
 2045|      0|            }
 2046|      0|        }
 2047|       |
 2048|       |        /* Close INChI_Aux */
 2049|      0|        if (!bEmbeddedOutputCalled && !bPlainTextCommnts)
  ------------------
  |  Branch (2049:13): [True: 0, False: 0]
  |  Branch (2049:39): [True: 0, False: 0]
  ------------------
 2050|      0|        {
 2051|      0|            inchi_ios_print( out_file, "%s\n", ( !num_components2[0] && !num_components2[1] ) ? "//" : "" );
  ------------------
  |  Branch (2051:50): [True: 0, False: 0]
  |  Branch (2051:73): [True: 0, False: 0]
  ------------------
 2052|       |            /* plain text comment earlier ended with LF */
 2053|      0|        }
 2054|       |
 2055|       |        /* in wINChI window, separate AuxInfo: from InChIKey: with blank line */
 2056|      0|        inchi_ios_print( out_file, "%s",
 2057|      0|            ( bINChIOutputOptions & INCHI_OUT_WINCHI_WINDOW ) ? "\n" : "" );
  ------------------
  |  |  166|      0|#define INCHI_OUT_WINCHI_WINDOW         0x0200   /* output into wINChI text window          */
  ------------------
  |  Branch (2057:13): [True: 0, False: 0]
  ------------------
 2058|      0|    } /* end of output AuxInfo */
 2059|       |
 2060|     80|    ret = 1;
 2061|       |
 2062|       |
 2063|     80|exit_function:
 2064|       |
 2065|       |
 2066|       |#ifdef TARGET_LIB_FOR_WINCHI
 2067|       |    /* @@@ If for any error we get here silent, display previously hidden output */
 2068|       |    if (silent)
 2069|       |    {
 2070|       |     /*
 2071|       |        if ( !inchi_ios_flush_not_displayed( out_file ) != -1  )
 2072|       |            silent = 0;
 2073|       |    */
 2074|       |        silent = 0;
 2075|       |    }
 2076|       |#endif
 2077|       |
 2078|     80|    if (io.bOverflow)
  ------------------
  |  Branch (2078:9): [True: 0, False: 80]
  ------------------
 2079|      0|    {
 2080|      0|        inchi_ios_print( out_file, "\nFATAL ERROR: Output buffer overflow\n" );
 2081|      0|    }
 2082|       |
 2083|     80|    if (intermediate_result)
  ------------------
  |  Branch (2083:9): [True: 0, False: 80]
  ------------------
 2084|      0|    {
 2085|      0|        ret = 0;
 2086|      0|        inchi_ios_eprint( log_file, "InChI serialization error for structure #%d.%s%s%s%s\n",
 2087|      0|                                    num_input_struct, SDF_LBL_VAL( ip->pSdfLabel, ip->pSdfValue ) );
  ------------------
  |  |  410|      0|#define SDF_LBL_VAL(L,V)  ((L)&&(L)[0])?gsSpace:gsEmpty, ((L)&&(L)[0])?L:gsEmpty, ((L)&&(L)[0])? (((V)&&(V)[0])?gsEqual:gsSpace):gsEmpty, ((V)&&(V)[0])?V:((L)&&(L)[0])?gsMissing:gsEmpty
  |  |  ------------------
  |  |  |  Branch (410:28): [True: 0, False: 0]
  |  |  |  Branch (410:33): [True: 0, False: 0]
  |  |  |  Branch (410:59): [True: 0, False: 0]
  |  |  |  Branch (410:64): [True: 0, False: 0]
  |  |  |  Branch (410:84): [True: 0, False: 0]
  |  |  |  Branch (410:89): [True: 0, False: 0]
  |  |  |  Branch (410:100): [True: 0, False: 0]
  |  |  |  Branch (410:105): [True: 0, False: 0]
  |  |  |  Branch (410:140): [True: 0, False: 0]
  |  |  |  Branch (410:145): [True: 0, False: 0]
  |  |  |  Branch (410:156): [True: 0, False: 0]
  |  |  |  Branch (410:161): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2088|      0|    }
 2089|       |
 2090|     80|    return ret;
 2091|     80|} /* OutputINChI1 */
szGetTag:
 2100|    230|{
 2101|    230|    int i, j, bit, num, len;
 2102|    230|    if (0 < nTag && nTag < 3)
  ------------------
  |  Branch (2102:9): [True: 230, False: 0]
  |  Branch (2102:21): [True: 230, False: 0]
  ------------------
 2103|    230|    {
 2104|       |        /* no plain text comments: pick up the last tag */
 2105|  4.60k|        for (i = 0, j = -1, bit = 1; i < MAX_TAG_NUM; i++, bit <<= 1)
  ------------------
  |  Branch (2105:38): [True: 4.37k, False: 230]
  ------------------
 2106|  4.37k|        {
 2107|  4.37k|            if (bTag & bit)
  ------------------
  |  Branch (2107:17): [True: 244, False: 4.12k]
  ------------------
 2108|    244|            {
 2109|    244|                j = i;
 2110|    244|            }
 2111|  4.37k|        }
 2112|    230|        if (j >= 0)
  ------------------
  |  Branch (2112:13): [True: 230, False: 0]
  ------------------
 2113|    230|        {
 2114|    230|            strcpy( szTag, nTag == 1 ? Tag[j].szXmlLabel : nTag == 2 ? Tag[j].szPlainLabel : "???" );
  ------------------
  |  Branch (2114:28): [True: 0, False: 230]
  |  Branch (2114:60): [True: 230, False: 0]
  ------------------
 2115|    230|            if (nTag != 2)
  ------------------
  |  Branch (2115:17): [True: 0, False: 230]
  ------------------
 2116|      0|            {
 2117|      0|                *bAlways = Tag[j].bAlwaysOutput;
 2118|      0|            }
 2119|    230|            return szTag;
 2120|    230|        }
 2121|    230|    }
 2122|      0|    else
 2123|      0|        if (nTag == 3)
  ------------------
  |  Branch (2123:13): [True: 0, False: 0]
  ------------------
 2124|      0|        {
 2125|       |            /* plain text with comments */
 2126|      0|            szTag[0] = '{';
 2127|      0|            szTag[1] = '\0';
 2128|      0|            for (i = 0, j = -1, bit = 1, num = 0; i < MAX_TAG_NUM; i++, bit <<= 1)
  ------------------
  |  Branch (2128:51): [True: 0, False: 0]
  ------------------
 2129|      0|            {
 2130|      0|                if (bTag & bit)
  ------------------
  |  Branch (2130:21): [True: 0, False: 0]
  ------------------
 2131|      0|                {
 2132|      0|                    j = i;
 2133|      0|                    if (num++)
  ------------------
  |  Branch (2133:25): [True: 0, False: 0]
  ------------------
 2134|      0|                    {
 2135|      0|                        strcat( szTag, ":" );
 2136|      0|                    }
 2137|      0|                    strcat( szTag, Tag[i].szPlainComment );
 2138|      0|                }
 2139|      0|            }
 2140|      0|            if (num)
  ------------------
  |  Branch (2140:17): [True: 0, False: 0]
  ------------------
 2141|      0|            {
 2142|      0|                strcat( szTag, "}" );
 2143|      0|                num = (int) strlen( Tag[j].szPlainLabel );
 2144|      0|                len = (int) strlen( szTag );
 2145|      0|                if (len)
  ------------------
  |  Branch (2145:21): [True: 0, False: 0]
  ------------------
 2146|      0|                {
 2147|      0|                    memmove( szTag + num, szTag, len + 1 );
 2148|      0|                    memcpy( szTag, Tag[j].szPlainLabel, num );
 2149|      0|                }
 2150|      0|                else
 2151|      0|                {
 2152|      0|                    strcpy( szTag, Tag[j].szPlainLabel );
 2153|      0|                }
 2154|      0|                *bAlways = Tag[j].bAlwaysOutput;
 2155|      0|            }
 2156|      0|            else
 2157|      0|            {
 2158|      0|                strcpy( szTag, "???" );
 2159|      0|            }
 2160|      0|            return szTag;
 2161|      0|        }
 2162|      0|    strcpy( szTag, "???" );
 2163|       |
 2164|      0|    return szTag;
 2165|    230|}
OrigStruct_FillOut:
 2938|  54.6k|{
 2939|  54.6k|    char szBuf[ORIG_STR_BUFLEN];
 2940|  54.6k|    int  i, len, len_coord, len_atoms, len_bonds;
 2941|       |
 2942|  54.6k|    pOrigStruct->polymer = NULL;
 2943|  54.6k|    pOrigStruct->v3000 = NULL;
 2944|       |
 2945|  54.6k|    pOrigStruct->n_zy = orig_inp_data->n_zy;
 2946|       |    /* Coordinates */
 2947|  54.6k|    len_coord = i = 0;
 2948|       |
 2949|  54.6k|    if (orig_inp_data->szCoord)
  ------------------
  |  Branch (2949:9): [True: 0, False: 54.6k]
  ------------------
 2950|      0|    {
 2951|       |
 2952|      0|        while (len = WriteOrigCoord( orig_inp_data->num_inp_atoms,
  ------------------
  |  Branch (2952:16): [True: 0, False: 0]
  ------------------
 2953|      0|            orig_inp_data->szCoord, &i, szBuf, sizeof( szBuf ) ))
 2954|      0|        {
 2955|      0|            len_coord += len;
 2956|      0|        }
 2957|      0|        pOrigStruct->szCoord = (char*) inchi_malloc( ( len_coord + 1 ) * sizeof( pOrigStruct->szCoord[0] ) );
  ------------------
  |  | 1130|      0|#define inchi_malloc   malloc
  ------------------
 2958|      0|        i = 0;
 2959|      0|        if (pOrigStruct->szCoord &&
  ------------------
  |  Branch (2959:13): [True: 0, False: 0]
  ------------------
 2960|      0|             len_coord == WriteOrigCoord( orig_inp_data->num_inp_atoms,
  ------------------
  |  Branch (2960:14): [True: 0, False: 0]
  ------------------
 2961|      0|                 orig_inp_data->szCoord, &i, pOrigStruct->szCoord, len_coord + 1 ) &&
 2962|      0|             i == orig_inp_data->num_inp_atoms)
  ------------------
  |  Branch (2962:14): [True: 0, False: 0]
  ------------------
 2963|      0|        {
 2964|       |            /* success */
 2965|      0|            if (orig_inp_data->szCoord)
  ------------------
  |  Branch (2965:17): [True: 0, False: 0]
  ------------------
 2966|      0|            {
 2967|      0|                inchi_free( orig_inp_data->szCoord );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2968|      0|                orig_inp_data->szCoord = NULL;
 2969|      0|            }
 2970|      0|        }
 2971|      0|        else
 2972|      0|        {
 2973|      0|            return -1;
 2974|      0|        }
 2975|      0|    }
 2976|       |
 2977|       |    /* Atoms */
 2978|  54.6k|    len_atoms = i = 0;
 2979|   109k|    while (len = WriteOrigAtoms( pCG, orig_inp_data->num_inp_atoms,
  ------------------
  |  Branch (2979:12): [True: 54.6k, False: 54.6k]
  ------------------
 2980|   109k|        orig_inp_data->at, &i, szBuf, sizeof( szBuf ), sd ))
 2981|  54.6k|    {
 2982|  54.6k|        len_atoms += len;
 2983|  54.6k|        if (!orig_inp_data->num_inp_atoms)
  ------------------
  |  Branch (2983:13): [True: 0, False: 54.6k]
  ------------------
 2984|      0|            break;
 2985|  54.6k|    }
 2986|  54.6k|    pOrigStruct->szAtoms = (char*) inchi_malloc( ( len_atoms + 1 ) * sizeof( pOrigStruct->szAtoms[0] ) );
  ------------------
  |  | 1130|  54.6k|#define inchi_malloc   malloc
  ------------------
 2987|  54.6k|    i = 0;
 2988|  54.6k|    if (pOrigStruct->szAtoms &&
  ------------------
  |  Branch (2988:9): [True: 54.6k, False: 0]
  ------------------
 2989|  54.6k|         len_atoms == WriteOrigAtoms( pCG, orig_inp_data->num_inp_atoms,
  ------------------
  |  Branch (2989:10): [True: 54.6k, False: 0]
  ------------------
 2990|  54.6k|             orig_inp_data->at, &i, pOrigStruct->szAtoms, len_atoms + 1, sd ) &&
 2991|  54.6k|         i == orig_inp_data->num_inp_atoms)
  ------------------
  |  Branch (2991:10): [True: 54.6k, False: 0]
  ------------------
 2992|  54.6k|    {
 2993|  54.6k|        ; /* success */
 2994|  54.6k|    }
 2995|      0|    else
 2996|      0|    {
 2997|      0|        return -1;
 2998|      0|    }
 2999|       |
 3000|       |    /* Bonds */
 3001|  54.6k|    len_bonds = 0;
 3002|  54.6k|    i = 1;
 3003|  54.6k|    while (len = WriteOrigBonds( pCG, orig_inp_data->num_inp_atoms,
  ------------------
  |  Branch (3003:12): [True: 3, False: 54.6k]
  ------------------
 3004|  54.6k|#if ( FIX_CURE53_ISSUE_OOB_ALREADY_HAVE_THIS_MESSAGE==1 )
 3005|  54.6k|        orig_inp_data->at, &i, szBuf, sizeof(szBuf), sd))
 3006|       |#else
 3007|       |        orig_inp_data->at, &i, szBuf, sizeof(szBuf), NULL))
 3008|       |#endif
 3009|      3|    {
 3010|      3|        len_bonds += len;
 3011|      3|        if (!orig_inp_data->num_inp_atoms)
  ------------------
  |  Branch (3011:13): [True: 0, False: 3]
  ------------------
 3012|      0|        {
 3013|      0|            break;
 3014|      0|        }
 3015|      3|    }
 3016|       |
 3017|  54.6k|    pOrigStruct->szBonds = (char*) inchi_malloc( ( len_bonds + 2 ) * sizeof( pOrigStruct->szBonds[0] ) );
  ------------------
  |  | 1130|  54.6k|#define inchi_malloc   malloc
  ------------------
 3018|  54.6k|    i = 1;
 3019|       |
 3020|  54.6k|    if (pOrigStruct->szBonds &&
  ------------------
  |  Branch (3020:9): [True: 54.6k, False: 0]
  ------------------
 3021|  54.6k|         len_bonds == WriteOrigBonds( pCG, orig_inp_data->num_inp_atoms,
  ------------------
  |  Branch (3021:10): [True: 54.6k, False: 0]
  ------------------
 3022|  54.6k|             orig_inp_data->at, &i, pOrigStruct->szBonds, len_bonds + 2, sd ) &&
 3023|  54.6k|         i == orig_inp_data->num_inp_atoms)
  ------------------
  |  Branch (3023:10): [True: 54.6k, False: 0]
  ------------------
 3024|  54.6k|    {
 3025|  54.6k|        ; /* success */
 3026|  54.6k|    }
 3027|      0|    else
 3028|      0|    {
 3029|      0|        return -1;
 3030|      0|    }
 3031|  54.6k|    pOrigStruct->num_atoms = orig_inp_data->num_inp_atoms;
 3032|       |
 3033|       |    /* Extensions of v. 1.05 */
 3034|  54.6k|    if (orig_inp_data->polymer != NULL
  ------------------
  |  Branch (3034:9): [True: 0, False: 54.6k]
  ------------------
 3035|  54.6k|         && orig_inp_data->polymer->n > 0
  ------------------
  |  Branch (3035:13): [True: 0, False: 0]
  ------------------
 3036|  54.6k|         && orig_inp_data->valid_polymer)
  ------------------
  |  Branch (3036:13): [True: 0, False: 0]
  ------------------
 3037|      0|    {
 3038|      0|        pOrigStruct->polymer = orig_inp_data->polymer;
 3039|       |                                /* pointer copy, do not free after use! */
 3040|      0|    }
 3041|  54.6k|    if (orig_inp_data->v3000 != NULL)
  ------------------
  |  Branch (3041:9): [True: 0, False: 54.6k]
  ------------------
 3042|      0|    {
 3043|      0|        pOrigStruct->v3000 = orig_inp_data->v3000;
 3044|       |                                /* pointer copy, do not free after use! */
 3045|      0|    }
 3046|       |
 3047|  54.6k|    return 0;
 3048|  54.6k|}
OrigStruct_Free:
 3053|  54.6k|{
 3054|  54.6k|    if (pOrigStruct)
  ------------------
  |  Branch (3054:9): [True: 54.6k, False: 0]
  ------------------
 3055|  54.6k|    {
 3056|  54.6k|        if (pOrigStruct->szAtoms)
  ------------------
  |  Branch (3056:13): [True: 54.6k, False: 0]
  ------------------
 3057|  54.6k|        {
 3058|  54.6k|            inchi_free( pOrigStruct->szAtoms );
  ------------------
  |  | 1136|  54.6k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 54.6k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3059|  54.6k|        }
 3060|  54.6k|        if (pOrigStruct->szBonds)
  ------------------
  |  Branch (3060:13): [True: 54.6k, False: 0]
  ------------------
 3061|  54.6k|        {
 3062|  54.6k|            inchi_free( pOrigStruct->szBonds );
  ------------------
  |  | 1136|  54.6k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 54.6k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3063|  54.6k|        }
 3064|  54.6k|        if (pOrigStruct->szCoord)
  ------------------
  |  Branch (3064:13): [True: 0, False: 54.6k]
  ------------------
 3065|      0|        {
 3066|      0|            inchi_free( pOrigStruct->szCoord );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3067|      0|        }
 3068|       |
 3069|       |        /* For
 3070|       |
 3071|       |            OAD_Polymer *polymer;
 3072|       |            OAD_V3000    *v3000;
 3073|       |
 3074|       |            we used shallow (pointer) copy of analogs from orig_inp_data, so do not free these here */
 3075|       |
 3076|       |        /*memset( pOrigStruct, 0, sizeof(*pOrigStruct) );*/
 3077|  54.6k|        pOrigStruct->szAtoms = NULL;
 3078|  54.6k|        pOrigStruct->szBonds = NULL;
 3079|  54.6k|        pOrigStruct->szCoord = NULL;
 3080|  54.6k|    }
 3081|  54.6k|}
set_line_separators:
 3114|     80|{
 3115|     80|    int  bPlainTextCommnts = 0 != ( bINChIOutputOptions & INCHI_OUT_PLAIN_TEXT_COMMENTS );
  ------------------
  |  |  164|     80|#define INCHI_OUT_PLAIN_TEXT_COMMENTS   0x0080   /* output plain text annotation            */
  ------------------
 3116|       |
 3117|     80|    *pLF = (char *)(bPlainTextCommnts ? "\n" : "\0");
  ------------------
  |  Branch (3117:21): [True: 0, False: 80]
  ------------------
 3118|       |
 3119|       |#if ( !defined(TARGET_API_LIB) && !defined(TARGET_LIB_FOR_WINCHI) )
 3120|       |    {
 3121|       |        int  bPlainText = 0 != ( bINChIOutputOptions & ( INCHI_OUT_PLAIN_TEXT | INCHI_OUT_PLAIN_TEXT_COMMENTS ) );
 3122|       |        int  bPlainTabbedOutput = 0 != ( bINChIOutputOptions & INCHI_OUT_TABBED_OUTPUT ) &&
 3123|       |            bPlainText && !bPlainTextCommnts;
 3124|       |
 3125|       |        *pTAB = bPlainTabbedOutput ? "\t" : "\n";
 3126|       |    }
 3127|       |#else
 3128|     80|    *pTAB = "\n";
 3129|     80|#endif
 3130|       |
 3131|     80|    return;
 3132|     80|}
ichiprt1.c:WriteOrigAtoms:
 2426|   163k|{
 2427|   163k|    int j, k, n, len, len0, cur_len, val, bonds_val, mw, parity, num_trans, is_ok, b_self;
 2428|   163k|    static const char szIsoH[] = "hdt";
 2429|   163k|    char szCurAtom[32];
 2430|   163k|    AT_NUMB nNeighOrder[MAXVAL], neigh;
 2431|       |
 2432|   163k|    cur_len = 0;
 2433|   163k|    if (0 == *i)
  ------------------
  |  Branch (2433:9): [True: 109k, False: 54.6k]
  ------------------
 2434|   109k|    {
 2435|   109k|        cur_len = sprintf( szBuf, "%d%s", num_inp_atoms,
 2436|   109k|            ( sd->bChiralFlag & FLAG_INP_AT_CHIRAL ) ? "c" :
  ------------------
  |  |  487|   109k|#define FLAG_INP_AT_CHIRAL        1
  ------------------
  |  Branch (2436:13): [True: 0, False: 109k]
  ------------------
 2437|   109k|            ( sd->bChiralFlag & FLAG_INP_AT_NONCHIRAL ) ? "n" : "" );
  ------------------
  |  |  488|   109k|#define FLAG_INP_AT_NONCHIRAL     2
  ------------------
  |  Branch (2437:13): [True: 0, False: 109k]
  ------------------
 2438|   109k|    }
 2439|   273k|    for (j = *i; j < num_inp_atoms; )
  ------------------
  |  Branch (2439:18): [True: 109k, False: 163k]
  ------------------
 2440|   109k|    {
 2441|       |        /* tetrahedral parity treatment */
 2442|   109k|        parity = 0;
 2443|   109k|        num_trans = 0;
 2444|   109k|        if (at[j].p_parity)
  ------------------
  |  Branch (2444:13): [True: 0, False: 109k]
  ------------------
 2445|      0|        {
 2446|       |            /* verify neighbors */
 2447|      0|            is_ok = 1;
 2448|      0|            b_self = 0;
 2449|      0|            for (n = 0, k = 0; n < MAX_NUM_STEREO_ATOM_NEIGH; n++)
  ------------------
  |  |  880|      0|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (2449:32): [True: 0, False: 0]
  ------------------
 2450|      0|            {
 2451|      0|                neigh = at[j].p_orig_at_num[n] - 1;
 2452|      0|                if (is_in_the_list( at[j].neighbor, neigh, at[j].valence ) &&
  ------------------
  |  Branch (2452:21): [True: 0, False: 0]
  ------------------
 2453|      0|                     at[neigh].orig_at_number == at[j].p_orig_at_num[n])
  ------------------
  |  Branch (2453:22): [True: 0, False: 0]
  ------------------
 2454|      0|                {
 2455|       |                    /* real neighbor */
 2456|      0|                    nNeighOrder[k++] = at[j].p_orig_at_num[n];
 2457|      0|                }
 2458|      0|                else
 2459|      0|                {
 2460|      0|                    if ((int) neigh == j && at[neigh].orig_at_number == at[j].p_orig_at_num[n])
  ------------------
  |  Branch (2460:25): [True: 0, False: 0]
  |  Branch (2460:45): [True: 0, False: 0]
  ------------------
 2461|      0|                    {
 2462|       |                        /* central atom is a neighbor */
 2463|      0|                        num_trans = n; /* move this neighbor to 0 position permutation parity */
 2464|      0|                        b_self++;
 2465|      0|                    }
 2466|      0|                    else
 2467|      0|                    {
 2468|      0|                        is_ok = 0;
 2469|      0|                        break;
 2470|      0|                    }
 2471|      0|                }
 2472|      0|            }
 2473|      0|            if (is_ok && b_self <= 1 && b_self + k == MAX_NUM_STEREO_ATOM_NEIGH)
  ------------------
  |  |  880|      0|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (2473:17): [True: 0, False: 0]
  |  Branch (2473:26): [True: 0, False: 0]
  |  Branch (2473:41): [True: 0, False: 0]
  ------------------
 2474|      0|            {
 2475|      0|                num_trans += insertions_sort( pCG, nNeighOrder, k, sizeof( nNeighOrder[0] ), comp_AT_RANK );
 2476|      0|                if (ATOM_PARITY_WELL_DEF( at[j].p_parity ))
  ------------------
  |  |  287|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  265|      0|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  264|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (287:38): [True: 0, False: 0]
  |  |  |  Branch (287:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2477|      0|                {
 2478|      0|                    parity = 2 - ( num_trans + at[j].p_parity ) % 2;
 2479|      0|                }
 2480|      0|                else
 2481|      0|                {
 2482|      0|                    if (ATOM_PARITY_ILL_DEF( at[j].p_parity ))
  ------------------
  |  |  285|      0|#define ATOM_PARITY_ILL_DEF(X)      (AB_MIN_ILL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_ILL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  267|      0|#define AB_MIN_ILL_DEFINED_PARITY  3
  |  |  ------------------
  |  |               #define ATOM_PARITY_ILL_DEF(X)      (AB_MIN_ILL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_ILL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  268|      0|#define AB_MAX_ILL_DEFINED_PARITY  4
  |  |  ------------------
  |  |  |  Branch (285:38): [True: 0, False: 0]
  |  |  |  Branch (285:74): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2483|      0|                    {
 2484|      0|                        parity = at[j].p_parity;
 2485|      0|                    }
 2486|      0|                    else
 2487|      0|                    {
 2488|      0|                        ; /* invalid atom parity */
 2489|      0|                    }
 2490|      0|                }
 2491|      0|            }
 2492|      0|            else
 2493|      0|            {
 2494|      0|                ;/* add error message here */
 2495|      0|            }
 2496|      0|        }
 2497|       |
 2498|   109k|        len = len0 = (int) strlen( at[j].elname );
 2499|   109k|        memcpy( szCurAtom, at[j].elname, len );
 2500|   109k|        bonds_val = nBondsValenceInpAt( at + j, NULL, NULL );
 2501|       |
 2502|   109k|        if (( val = needed_unusual_el_valence( at[j].el_number, at[j].charge, at[j].radical,
  ------------------
  |  Branch (2502:13): [True: 502, False: 108k]
  ------------------
 2503|   109k|            at[j].chem_bonds_valence, bonds_val, at[j].num_H, at[j].valence ) ) ||
 2504|   109k|             at[j].charge || at[j].radical || at[j].iso_atw_diff || NUM_ISO_H( at, j ) || parity)
  ------------------
  |  |   87|   217k|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  |  |  |  Branch (87:25): [True: 0, False: 108k]
  |  |  ------------------
  ------------------
  |  Branch (2504:14): [True: 28, False: 108k]
  |  Branch (2504:30): [True: 0, False: 108k]
  |  Branch (2504:47): [True: 26, False: 108k]
  |  Branch (2504:91): [True: 0, False: 108k]
  ------------------
 2505|    556|        {
 2506|       |            /* valence */
 2507|    556|            if (val)
  ------------------
  |  Branch (2507:17): [True: 502, False: 54]
  ------------------
 2508|    502|            {
 2509|    502|                len += sprintf( szCurAtom + len, "%d", val > 0 ? val : 0 );
  ------------------
  |  Branch (2509:56): [True: 0, False: 502]
  ------------------
 2510|    502|            }
 2511|       |            /* charge */
 2512|    556|            if (val = at[j].charge)
  ------------------
  |  Branch (2512:17): [True: 28, False: 528]
  ------------------
 2513|     28|            {
 2514|     28|                szCurAtom[len++] = val > 0 ? '+' : '-';
  ------------------
  |  Branch (2514:36): [True: 2, False: 26]
  ------------------
 2515|     28|                if (( val = abs( val ) ) > 1)
  ------------------
  |  Branch (2515:21): [True: 6, False: 22]
  ------------------
 2516|      6|                {
 2517|      6|                    len += sprintf( szCurAtom + len, "%d", val );
 2518|      6|                }
 2519|     28|            }
 2520|       |            /* radical */
 2521|    556|            if (val = at[j].radical)
  ------------------
  |  Branch (2521:17): [True: 6, False: 550]
  ------------------
 2522|      6|            {
 2523|      6|                len += sprintf( szCurAtom + len, ".%d", val );
 2524|      6|            }
 2525|       |            /* isotopic shift */
 2526|    556|            if (val = at[j].iso_atw_diff)
  ------------------
  |  Branch (2526:17): [True: 30, False: 526]
  ------------------
 2527|     30|            {
 2528|     30|                mw = get_atomic_mass_from_elnum( at[j].el_number );
 2529|     30|                if (val == 1)
  ------------------
  |  Branch (2529:21): [True: 26, False: 4]
  ------------------
 2530|     26|                    val = mw;
 2531|      4|                else
 2532|      4|                    if (val > 0)
  ------------------
  |  Branch (2532:25): [True: 4, False: 0]
  ------------------
 2533|      4|                        val = mw + val - 1;
 2534|      0|                    else
 2535|      0|                        val = mw + val;
 2536|     30|                len += sprintf( szCurAtom + len, "%si%d", len == len0 ? "." : "", val );
  ------------------
  |  Branch (2536:59): [True: 26, False: 4]
  ------------------
 2537|     30|            }
 2538|       |            /* parity */
 2539|    556|            if (parity)
  ------------------
  |  Branch (2539:17): [True: 0, False: 556]
  ------------------
 2540|      0|            {
 2541|      0|                len += sprintf( szCurAtom + len, "%s%s", len == len0 ? "." : "",
  ------------------
  |  Branch (2541:58): [True: 0, False: 0]
  ------------------
 2542|      0|                                parity == AB_PARITY_ODD ? "o" :
  ------------------
  |  |  247|      0|#define AB_PARITY_ODD    1  /* 1 => odd parity */
  ------------------
  |  Branch (2542:33): [True: 0, False: 0]
  ------------------
 2543|      0|                                parity == AB_PARITY_EVEN ? "e" :
  ------------------
  |  |  248|      0|#define AB_PARITY_EVEN   2  /* 2 => even parity */
  ------------------
  |  Branch (2543:33): [True: 0, False: 0]
  ------------------
 2544|      0|                                parity == AB_PARITY_UNKN ? "u" :
  ------------------
  |  |  249|      0|#define AB_PARITY_UNKN   3  /* 3 => user marked as unknown parity */
  ------------------
  |  Branch (2544:33): [True: 0, False: 0]
  ------------------
 2545|      0|                                parity == AB_PARITY_UNDF ? "?" : "" );
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2545:33): [True: 0, False: 0]
  ------------------
 2546|      0|            }
 2547|       |            /* implicit isotopic H */
 2548|    556|            if (NUM_ISO_H( at, j ))
  ------------------
  |  |   87|    556|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  |  |  |  Branch (87:25): [True: 0, False: 556]
  |  |  ------------------
  ------------------
 2549|      0|            {
 2550|      0|                for (k = 0; k < NUM_H_ISOTOPES; k++)
  ------------------
  |  |   53|      0|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (2550:29): [True: 0, False: 0]
  ------------------
 2551|      0|                {
 2552|      0|                    if (val = at[j].num_iso_H[k])
  ------------------
  |  Branch (2552:25): [True: 0, False: 0]
  ------------------
 2553|      0|                    {
 2554|      0|                        len += sprintf( szCurAtom + len, "%s%c", len == len0 ? "." : "", szIsoH[k] );
  ------------------
  |  Branch (2554:66): [True: 0, False: 0]
  ------------------
 2555|      0|                        if (val > 1)
  ------------------
  |  Branch (2555:29): [True: 0, False: 0]
  ------------------
 2556|      0|                        {
 2557|      0|                            len += sprintf( szCurAtom + len, "%d", val );
 2558|      0|                        }
 2559|      0|                    }
 2560|      0|                }
 2561|      0|            }
 2562|    556|        }
 2563|       |
 2564|   109k|        if (len + cur_len < buf_len)
  ------------------
  |  Branch (2564:13): [True: 109k, False: 0]
  ------------------
 2565|   109k|        {
 2566|   109k|            memcpy( szBuf + cur_len, szCurAtom, len );
 2567|   109k|            cur_len += len;
 2568|   109k|            j++;
 2569|   109k|        }
 2570|      0|        else
 2571|      0|        {
 2572|      0|            break;
 2573|      0|        }
 2574|   109k|        szBuf[cur_len] = '\0';
 2575|   109k|        *i = j;
 2576|   109k|    }
 2577|       |
 2578|   163k|    return cur_len;
 2579|   163k|}
ichiprt1.c:WriteOrigBonds:
 2624|   109k|{
 2625|   109k|    int j, k, k2, kk, len, cur_len, j2 = 0, bond_stereo, bond_char, bond_parity, bond_parityNM, num_trans;
 2626|   109k|    char szCurBonds[7 * MAXVAL + 2]; /* num_neigh*(1 byte bond type + 2 bytes for bond parity up to 4 digits per neighbor number) + at the end one ';' */
 2627|   109k|    AT_RANK nNeighOrder[MAXVAL];
 2628|   109k|    int  chain_len, pnxt_atom, pinxt2cur, pinxt_sb_parity_ord;
 2629|   109k|    int  chain_len2, pnxt_atom2, pinxt2cur2, pinxt_sb_parity_ord2, m1, m2;
 2630|   109k|    int  pcur_atom, picur2nxt, picur_sb_parity_ord;
 2631|       |
 2632|   109k|    cur_len = 0;
 2633|   109k|    for (j = *i; j < num_inp_atoms; )
  ------------------
  |  Branch (2633:18): [True: 24, False: 109k]
  ------------------
 2634|     24|    {
 2635|     24|        len = 0;
 2636|     24|        if (at[j].valence > 1)
  ------------------
  |  Branch (2636:13): [True: 12, False: 12]
  ------------------
 2637|     12|        {
 2638|     36|            for (k = 0; k < at[j].valence; k++)
  ------------------
  |  Branch (2638:25): [True: 24, False: 12]
  ------------------
 2639|     24|            {
 2640|     24|                nNeighOrder[k] = k;
 2641|     24|            }
 2642|     12|            pCG->m_pn_RankForSort = at[j].neighbor;
 2643|     12|            num_trans = insertions_sort( pCG, nNeighOrder, at[j].valence, sizeof( nNeighOrder[0] ), CompRank );
 2644|     12|        }
 2645|     12|        else
 2646|     12|        {
 2647|     12|            num_trans = 0;
 2648|     12|            nNeighOrder[0] = 0;
 2649|     12|        }
 2650|     60|        for (kk = 0; kk < at[j].valence; kk++)
  ------------------
  |  Branch (2650:22): [True: 36, False: 24]
  ------------------
 2651|     36|        {
 2652|     36|            k = nNeighOrder[kk];
 2653|     36|            j2 = at[j].neighbor[k];
 2654|     36|            bond_parity = 0;
 2655|     36|            bond_parityNM = 0;
 2656|     36|            if (j2 < j)
  ------------------
  |  Branch (2656:17): [True: 24, False: 12]
  ------------------
 2657|     24|            {
 2658|     24|                bond_stereo = at[j].bond_stereo[k];
 2659|     24|                switch (at[j].bond_type[k])
 2660|     24|                {
 2661|     18|                    case BOND_TYPE_SINGLE:
  ------------------
  |  |   60|     18|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2661:21): [True: 18, False: 6]
  ------------------
 2662|     18|                        switch (bond_stereo)
 2663|     18|                        {
 2664|      0|                            case  STEREO_SNGL_UP:
  ------------------
  |  |   65|      0|#define STEREO_SNGL_UP       1
  ------------------
  |  Branch (2664:29): [True: 0, False: 18]
  ------------------
 2665|      0|                                bond_char = 'p';
 2666|      0|                                break;
 2667|      0|                            case -STEREO_SNGL_UP:
  ------------------
  |  |   65|      0|#define STEREO_SNGL_UP       1
  ------------------
  |  Branch (2667:29): [True: 0, False: 18]
  ------------------
 2668|      0|                                bond_char = 'P';
 2669|      0|                                break;
 2670|      0|                            case  STEREO_SNGL_DOWN:
  ------------------
  |  |   67|      0|#define STEREO_SNGL_DOWN     6
  ------------------
  |  Branch (2670:29): [True: 0, False: 18]
  ------------------
 2671|      0|                                bond_char = 'n';
 2672|      0|                                break;
 2673|      0|                            case -STEREO_SNGL_DOWN:
  ------------------
  |  |   67|      0|#define STEREO_SNGL_DOWN     6
  ------------------
  |  Branch (2673:29): [True: 0, False: 18]
  ------------------
 2674|      0|                                bond_char = 'N';
 2675|      0|                                break;
 2676|      0|#if ( FIX_EITHER_STEREO_IN_AUX_INFO == 1 )
 2677|      0|                            case  STEREO_SNGL_EITHER:
  ------------------
  |  |   66|      0|#define STEREO_SNGL_EITHER   4
  ------------------
  |  Branch (2677:29): [True: 0, False: 18]
  ------------------
 2678|      0|                                bond_char = 'v';
 2679|      0|                                break;
 2680|      0|                            case -STEREO_SNGL_EITHER:
  ------------------
  |  |   66|      0|#define STEREO_SNGL_EITHER   4
  ------------------
  |  Branch (2680:29): [True: 0, False: 18]
  ------------------
 2681|      0|                                bond_char = 'V';
 2682|      0|                                break;
 2683|       |#else
 2684|       |                            case  STEREO_SNGL_EITHER:
 2685|       |                            case -STEREO_SNGL_EITHER:
 2686|       |                                bond_char = 'v';
 2687|       |                                break;
 2688|       |#endif
 2689|     18|                            default:
  ------------------
  |  Branch (2689:29): [True: 18, False: 0]
  ------------------
 2690|     18|                                bond_char = 's';
 2691|     18|                                break;
 2692|     18|                        }
 2693|     18|                        break;
 2694|     18|                    case BOND_TYPE_DOUBLE:
  ------------------
  |  |   61|      6|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (2694:21): [True: 6, False: 18]
  ------------------
 2695|      6|                        switch (bond_stereo)
 2696|      6|                        {
 2697|      0|                            case  STEREO_DBLE_EITHER:
  ------------------
  |  |   68|      0|#define STEREO_DBLE_EITHER   3
  ------------------
  |  Branch (2697:29): [True: 0, False: 6]
  ------------------
 2698|      0|                            case -STEREO_DBLE_EITHER:
  ------------------
  |  |   68|      0|#define STEREO_DBLE_EITHER   3
  ------------------
  |  Branch (2698:29): [True: 0, False: 6]
  ------------------
 2699|      0|                                bond_char = 'w';
 2700|      0|                                break;
 2701|      6|                            default:
  ------------------
  |  Branch (2701:29): [True: 6, False: 0]
  ------------------
 2702|      6|                                bond_char = 'd';
 2703|      6|                                break;
 2704|      6|                        }
 2705|      6|                        break;
 2706|      6|                    case BOND_TYPE_TRIPLE:
  ------------------
  |  |   62|      0|#define BOND_TYPE_TRIPLE    3
  ------------------
  |  Branch (2706:21): [True: 0, False: 24]
  ------------------
 2707|      0|                        bond_char = 't';
 2708|      0|                        break;
 2709|      0|                    case BOND_TYPE_ALTERN:
  ------------------
  |  |   63|      0|#define BOND_TYPE_ALTERN    4
  ------------------
  |  Branch (2709:21): [True: 0, False: 24]
  ------------------
 2710|      0|                        bond_char = 'a';
 2711|      0|                        break;
 2712|      0|                    default:
  ------------------
  |  Branch (2712:21): [True: 0, False: 24]
  ------------------
 2713|      0|                        bond_char = 's';
 2714|      0|                        break;
 2715|     24|                }
 2716|       |                /* check for allene/cumulene */
 2717|     24|                k2 = (int) ( is_in_the_list( at[j2].neighbor, (AT_NUMB) j, at[j2].valence ) - at[j2].neighbor );
 2718|     24|                chain_len = chain_len2 = 0;
 2719|     24|                if (at[j].sb_parity[0])
  ------------------
  |  Branch (2719:21): [True: 0, False: 24]
  ------------------
 2720|      0|                {
 2721|      0|                    for (m1 = 0; m1 < MAX_NUM_STEREO_BONDS && at[j].sb_parity[m1]; m1++)
  ------------------
  |  |  876|      0|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (2721:34): [True: 0, False: 0]
  |  Branch (2721:63): [True: 0, False: 0]
  ------------------
 2722|      0|                    {
 2723|      0|                        if (k == at[j].sb_ord[m1])
  ------------------
  |  Branch (2723:29): [True: 0, False: 0]
  ------------------
 2724|      0|                        {
 2725|      0|                            chain_len = get_opposite_sb_atom( at, j, k,
 2726|      0|                                          &pnxt_atom, &pinxt2cur, &pinxt_sb_parity_ord );
 2727|      0|                            break;
 2728|      0|                        }
 2729|      0|                    }
 2730|      0|                }
 2731|     24|                if (at[j2].sb_parity[0])
  ------------------
  |  Branch (2731:21): [True: 0, False: 24]
  ------------------
 2732|      0|                {
 2733|      0|                    for (m2 = 0; m2 < MAX_NUM_STEREO_BONDS && at[j2].sb_parity[m2]; m2++)
  ------------------
  |  |  876|      0|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (2733:34): [True: 0, False: 0]
  |  Branch (2733:63): [True: 0, False: 0]
  ------------------
 2734|      0|                    {
 2735|      0|                        if (k2 == at[j2].sb_ord[m2])
  ------------------
  |  Branch (2735:29): [True: 0, False: 0]
  ------------------
 2736|      0|                        {
 2737|      0|                            chain_len2 = get_opposite_sb_atom( at, j2, k2,
 2738|      0|                                           &pnxt_atom2, &pinxt2cur2, &pinxt_sb_parity_ord2 );
 2739|      0|                            break;
 2740|      0|                        }
 2741|      0|                    }
 2742|      0|                }
 2743|     24|                if (chain_len == 1 && chain_len2 == 1 ||  /* regular stereobond */
  ------------------
  |  Branch (2743:21): [True: 0, False: 24]
  |  Branch (2743:39): [True: 0, False: 0]
  ------------------
 2744|     24|                     chain_len > 1 && j > pnxt_atom)
  ------------------
  |  Branch (2744:22): [True: 0, False: 24]
  |  Branch (2744:39): [True: 0, False: 0]
  ------------------
 2745|      0|                {
 2746|       |                    /* j  is a cumulene endpoint */
 2747|      0|                    int m;
 2748|      0|                    pcur_atom = j;  /* pcur_atom > pnxt_atom */
 2749|      0|                    picur2nxt = k;
 2750|      0|                    picur_sb_parity_ord = -1;
 2751|      0|                    for (m = 0; m < MAX_NUM_STEREO_BONDS && at[pcur_atom].sb_parity[m]; m++)
  ------------------
  |  |  876|      0|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (2751:33): [True: 0, False: 0]
  |  Branch (2751:61): [True: 0, False: 0]
  ------------------
 2752|      0|                    {
 2753|      0|                        if (at[pcur_atom].sb_ord[m] == k)
  ------------------
  |  Branch (2753:29): [True: 0, False: 0]
  ------------------
 2754|      0|                        {
 2755|      0|                            picur_sb_parity_ord = m;
 2756|      0|                            break;
 2757|      0|                        }
 2758|      0|                    }
 2759|      0|                    chain_len2 = 0;
 2760|      0|                }
 2761|     24|                else
 2762|     24|                {
 2763|     24|                    if (chain_len2 > 1 && j2 > pnxt_atom2)
  ------------------
  |  Branch (2763:25): [True: 0, False: 24]
  |  Branch (2763:43): [True: 0, False: 0]
  ------------------
 2764|      0|                    { /* j2 is a cumulene endpoint */
 2765|      0|                        int m;
 2766|      0|                        pcur_atom = j2;
 2767|      0|                        picur2nxt = k2;
 2768|      0|                        pnxt_atom = pnxt_atom2;
 2769|      0|                        pinxt2cur = pinxt2cur2;
 2770|      0|                        pinxt_sb_parity_ord = pinxt_sb_parity_ord2;
 2771|      0|                        picur_sb_parity_ord = -1;
 2772|      0|                        for (m = 0; m < MAX_NUM_STEREO_BONDS && at[pcur_atom].sb_parity[m]; m++)
  ------------------
  |  |  876|      0|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (2772:37): [True: 0, False: 0]
  |  Branch (2772:65): [True: 0, False: 0]
  ------------------
 2773|      0|                        {
 2774|      0|                            if (at[pcur_atom].sb_ord[m] == k2)
  ------------------
  |  Branch (2774:33): [True: 0, False: 0]
  ------------------
 2775|      0|                                picur_sb_parity_ord = m;
 2776|      0|                        }
 2777|      0|                        chain_len = chain_len2;
 2778|      0|                        chain_len2 = 0;
 2779|      0|                    }
 2780|     24|                    else
 2781|     24|                    {
 2782|     24|                        chain_len = chain_len2 = 0;
 2783|     24|                    }
 2784|     24|                }
 2785|       |                /*len += sprintf( szCurBonds + len, "%c%d", bond_char, val+1);*/
 2786|     24|                if (chain_len)
  ------------------
  |  Branch (2786:21): [True: 0, False: 24]
  ------------------
 2787|      0|                {
 2788|       |                    /* both atoms belong to a stereo bond */
 2789|      0|                    int kc;
 2790|      0|                    int p1, p2, p1NM, p2NM, neigh, neigh1, neigh2, bHasMetal, bWellDef;
 2791|      0|                    int     bNeighSwitched1, bNeighSwitched2;
 2792|       |
 2793|      0|                    p1 = SB_PARITY_1( at[pcur_atom].sb_parity[picur_sb_parity_ord] );
  ------------------
  |  |   97|      0|#define SB_PARITY_1(X) (X & SB_PARITY_MASK)  /* refers to connected structure */
  |  |  ------------------
  |  |  |  |   96|      0|#define SB_PARITY_MASK  0x07
  |  |  ------------------
  ------------------
 2794|      0|                    p1NM = SB_PARITY_2( at[pcur_atom].sb_parity[picur_sb_parity_ord] );
  ------------------
  |  |   98|      0|#define SB_PARITY_2(X) (((X) >> SB_PARITY_SHFT) & SB_PARITY_MASK) /* refers to connected structure */
  |  |  ------------------
  |  |  |  |   95|      0|#define SB_PARITY_SHFT  3    /* number of right shift bits to get disconnected metal parity */
  |  |  ------------------
  |  |               #define SB_PARITY_2(X) (((X) >> SB_PARITY_SHFT) & SB_PARITY_MASK) /* refers to connected structure */
  |  |  ------------------
  |  |  |  |   96|      0|#define SB_PARITY_MASK  0x07
  |  |  ------------------
  ------------------
 2795|      0|                    p2 = SB_PARITY_1( at[pnxt_atom].sb_parity[pinxt_sb_parity_ord] );
  ------------------
  |  |   97|      0|#define SB_PARITY_1(X) (X & SB_PARITY_MASK)  /* refers to connected structure */
  |  |  ------------------
  |  |  |  |   96|      0|#define SB_PARITY_MASK  0x07
  |  |  ------------------
  ------------------
 2796|      0|                    p2NM = SB_PARITY_2( at[pnxt_atom].sb_parity[pinxt_sb_parity_ord] );
  ------------------
  |  |   98|      0|#define SB_PARITY_2(X) (((X) >> SB_PARITY_SHFT) & SB_PARITY_MASK) /* refers to connected structure */
  |  |  ------------------
  |  |  |  |   95|      0|#define SB_PARITY_SHFT  3    /* number of right shift bits to get disconnected metal parity */
  |  |  ------------------
  |  |               #define SB_PARITY_2(X) (((X) >> SB_PARITY_SHFT) & SB_PARITY_MASK) /* refers to connected structure */
  |  |  ------------------
  |  |  |  |   96|      0|#define SB_PARITY_MASK  0x07
  |  |  ------------------
  ------------------
 2797|       |
 2798|      0|                    bWellDef = ATOM_PARITY_WELL_DEF( p1 ) && ATOM_PARITY_WELL_DEF( p2 );
  ------------------
  |  |  287|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  265|      0|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  264|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (287:38): [True: 0, False: 0]
  |  |  |  Branch (287:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                                  bWellDef = ATOM_PARITY_WELL_DEF( p1 ) && ATOM_PARITY_WELL_DEF( p2 );
  ------------------
  |  |  287|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  265|      0|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  264|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (287:38): [True: 0, False: 0]
  |  |  |  Branch (287:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2799|      0|                    bHasMetal = ATOM_PARITY_WELL_DEF( p1NM ) && ATOM_PARITY_WELL_DEF( p2NM );
  ------------------
  |  |  287|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  265|      0|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  264|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (287:38): [True: 0, False: 0]
  |  |  |  Branch (287:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                                  bHasMetal = ATOM_PARITY_WELL_DEF( p1NM ) && ATOM_PARITY_WELL_DEF( p2NM );
  ------------------
  |  |  287|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  265|      0|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  264|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (287:38): [True: 0, False: 0]
  |  |  |  Branch (287:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2800|       |
 2801|      0|                    bNeighSwitched1 = bNeighSwitched2 = 0;
 2802|       |
 2803|      0|                    if (bWellDef || bHasMetal)
  ------------------
  |  Branch (2803:25): [True: 0, False: 0]
  |  Branch (2803:37): [True: 0, False: 0]
  ------------------
 2804|      0|                    {
 2805|       |
 2806|      0|                        neigh1 = num_inp_atoms;
 2807|      0|                        for (kc = 0; kc < at[pcur_atom].valence; kc++)
  ------------------
  |  Branch (2807:38): [True: 0, False: 0]
  ------------------
 2808|      0|                        {
 2809|      0|                            if (kc == picur2nxt)
  ------------------
  |  Branch (2809:33): [True: 0, False: 0]
  ------------------
 2810|      0|                                continue;
 2811|      0|                            neigh = at[pcur_atom].neighbor[kc];
 2812|      0|                            if (bHasMetal && is_el_a_metal( at[neigh].el_number ))
  ------------------
  |  Branch (2812:33): [True: 0, False: 0]
  |  Branch (2812:46): [True: 0, False: 0]
  ------------------
 2813|      0|                                continue;
 2814|      0|                            if (neigh < neigh1)
  ------------------
  |  Branch (2814:33): [True: 0, False: 0]
  ------------------
 2815|      0|                                neigh1 = neigh;
 2816|      0|                        }
 2817|      0|                        if (neigh1 < num_inp_atoms)
  ------------------
  |  Branch (2817:29): [True: 0, False: 0]
  ------------------
 2818|      0|                        {
 2819|      0|                            bNeighSwitched1 = ( neigh1 != at[pcur_atom].neighbor[(int) at[pcur_atom].sn_ord[picur_sb_parity_ord]] );
 2820|      0|                        }
 2821|      0|                        else
 2822|      0|                        {
 2823|      0|                            AddErrorMessage( sd->pStrErrStruct, "Cannot find 0D stereobond neighbor" );
 2824|       |                            /*
 2825|       |                            sd->nStructReadError =  99;
 2826|       |                            sd->nErrorType = _IS_ERROR;
 2827|       |                            */
 2828|      0|                        }
 2829|       |
 2830|      0|                        neigh2 = num_inp_atoms;
 2831|      0|                        for (kc = 0; kc < at[pnxt_atom].valence; kc++)
  ------------------
  |  Branch (2831:38): [True: 0, False: 0]
  ------------------
 2832|      0|                        {
 2833|      0|                            if (kc == pinxt2cur)
  ------------------
  |  Branch (2833:33): [True: 0, False: 0]
  ------------------
 2834|      0|                                continue;
 2835|      0|                            neigh = at[pnxt_atom].neighbor[kc];
 2836|      0|                            if (bHasMetal && is_el_a_metal( at[neigh].el_number ))
  ------------------
  |  Branch (2836:33): [True: 0, False: 0]
  |  Branch (2836:46): [True: 0, False: 0]
  ------------------
 2837|      0|                                continue;
 2838|      0|                            if (neigh < neigh2)
  ------------------
  |  Branch (2838:33): [True: 0, False: 0]
  ------------------
 2839|      0|                                neigh2 = neigh;
 2840|      0|                        }
 2841|      0|                        if (neigh2 < num_inp_atoms)
  ------------------
  |  Branch (2841:29): [True: 0, False: 0]
  ------------------
 2842|      0|                        {
 2843|      0|                            bNeighSwitched2 = ( neigh2 != at[pnxt_atom].neighbor[(int) at[pnxt_atom].sn_ord[pinxt_sb_parity_ord]] );
 2844|      0|                        }
 2845|      0|                        else
 2846|      0|                        {
 2847|      0|                            AddErrorMessage( sd->pStrErrStruct, "Cannot find 0D stereobond neighbor" );
 2848|       |                            /*
 2849|       |                            sd->nStructReadError =  99;
 2850|       |                            sd->nErrorType = _IS_ERROR;
 2851|       |                            */
 2852|      0|                        }
 2853|       |
 2854|      0|                        if (neigh1 < num_inp_atoms && neigh2 < num_inp_atoms)
  ------------------
  |  Branch (2854:29): [True: 0, False: 0]
  |  Branch (2854:55): [True: 0, False: 0]
  ------------------
 2855|      0|                        {
 2856|      0|                            if (ATOM_PARITY_WELL_DEF( p1 ) && ATOM_PARITY_WELL_DEF( p2 ))
  ------------------
  |  |  287|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  265|      0|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  264|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (287:38): [True: 0, False: 0]
  |  |  |  Branch (287:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                                          if (ATOM_PARITY_WELL_DEF( p1 ) && ATOM_PARITY_WELL_DEF( p2 ))
  ------------------
  |  |  287|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  265|      0|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  264|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (287:38): [True: 0, False: 0]
  |  |  |  Branch (287:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2857|      0|                            {
 2858|      0|                                bond_parity = 2 - ( p1 + p2 + bNeighSwitched1 + bNeighSwitched2 ) % 2;
 2859|      0|                            }
 2860|      0|                            else
 2861|      0|                            {
 2862|      0|                                bond_parity = inchi_min( p1, p2 );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2863|      0|                            }
 2864|       |
 2865|      0|                            if (bHasMetal)
  ------------------
  |  Branch (2865:33): [True: 0, False: 0]
  ------------------
 2866|      0|                            {
 2867|      0|                                bond_parityNM = 2 - ( p1NM + p2NM + bNeighSwitched1 + bNeighSwitched2 ) % 2;
 2868|      0|                            }
 2869|      0|                            else
 2870|      0|                            {
 2871|      0|                                if (p1NM && p2NM)
  ------------------
  |  Branch (2871:37): [True: 0, False: 0]
  |  Branch (2871:45): [True: 0, False: 0]
  ------------------
 2872|      0|                                {
 2873|      0|                                    bond_parityNM = inchi_min( p1NM, p2NM );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2874|      0|                                }
 2875|      0|                            }
 2876|      0|                        }
 2877|      0|                    }
 2878|      0|                    else
 2879|      0|                    {
 2880|      0|                        if (p1 && p2)
  ------------------
  |  Branch (2880:29): [True: 0, False: 0]
  |  Branch (2880:35): [True: 0, False: 0]
  ------------------
 2881|      0|                        {
 2882|      0|                            bond_parity = inchi_min( p1, p2 );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2883|      0|                        }
 2884|      0|                        if (p1NM && p2NM)
  ------------------
  |  Branch (2884:29): [True: 0, False: 0]
  |  Branch (2884:37): [True: 0, False: 0]
  ------------------
 2885|      0|                        {
 2886|      0|                            bond_parityNM = inchi_min( p1NM, p2NM );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2887|      0|                        }
 2888|      0|                        if (bond_parityNM && !bond_parity)
  ------------------
  |  Branch (2888:29): [True: 0, False: 0]
  |  Branch (2888:46): [True: 0, False: 0]
  ------------------
 2889|      0|                        {
 2890|      0|                            bond_parity = AB_PARITY_UNDF;
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 2891|      0|                        }
 2892|      0|                    }
 2893|      0|                }
 2894|     24|                len += sprintf( szCurBonds + len, "%c%s%s%d",
 2895|     24|                                                  bond_char,
 2896|       |
 2897|     24|                                                  ( bond_parity == AB_PARITY_ODD ) ? "-" :
  ------------------
  |  |  247|     24|#define AB_PARITY_ODD    1  /* 1 => odd parity */
  ------------------
  |  Branch (2897:51): [True: 0, False: 24]
  ------------------
 2898|     24|                                                  ( bond_parity == AB_PARITY_EVEN ) ? "+" :
  ------------------
  |  |  248|     24|#define AB_PARITY_EVEN   2  /* 2 => even parity */
  ------------------
  |  Branch (2898:51): [True: 0, False: 24]
  ------------------
 2899|     24|                                                  ( bond_parity == AB_PARITY_UNKN ) ? "u" :
  ------------------
  |  |  249|     24|#define AB_PARITY_UNKN   3  /* 3 => user marked as unknown parity */
  ------------------
  |  Branch (2899:51): [True: 0, False: 24]
  ------------------
 2900|     24|                                                  ( bond_parity == AB_PARITY_UNDF ) ? "?" : "",
  ------------------
  |  |  250|     24|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2900:51): [True: 0, False: 24]
  ------------------
 2901|       |
 2902|     24|                                                  ( bond_parityNM == AB_PARITY_ODD ) ? "-" :
  ------------------
  |  |  247|     24|#define AB_PARITY_ODD    1  /* 1 => odd parity */
  ------------------
  |  Branch (2902:51): [True: 0, False: 24]
  ------------------
 2903|     24|                                                  ( bond_parityNM == AB_PARITY_EVEN ) ? "+" :
  ------------------
  |  |  248|     24|#define AB_PARITY_EVEN   2  /* 2 => even parity */
  ------------------
  |  Branch (2903:51): [True: 0, False: 24]
  ------------------
 2904|     24|                                                  ( bond_parityNM == AB_PARITY_UNKN ) ? "u" :
  ------------------
  |  |  249|     24|#define AB_PARITY_UNKN   3  /* 3 => user marked as unknown parity */
  ------------------
  |  Branch (2904:51): [True: 0, False: 24]
  ------------------
 2905|     24|                                                  ( bond_parityNM == AB_PARITY_UNDF ) ? "?" : "",
  ------------------
  |  |  250|     24|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2905:51): [True: 0, False: 24]
  ------------------
 2906|       |
 2907|     24|                                                  j2 + 1 );
 2908|     24|            }
 2909|     36|        }
 2910|     24|        if (len + cur_len + 2 < buf_len)
  ------------------
  |  Branch (2910:13): [True: 24, False: 0]
  ------------------
 2911|     24|        {
 2912|     24|            memcpy( szBuf + cur_len, szCurBonds, len );
 2913|     24|            cur_len += len;
 2914|     24|            szBuf[cur_len++] = ';';
 2915|     24|            j++;
 2916|     24|        }
 2917|      0|        else
 2918|      0|        {
 2919|      0|            break;
 2920|      0|        }
 2921|     24|    }
 2922|   109k|    szBuf[cur_len] = '\0';
 2923|   109k|    *i = num_inp_atoms > 0 ? j : 0;
  ------------------
  |  Branch (2923:10): [True: 109k, False: 0]
  ------------------
 2924|       |
 2925|   109k|    return cur_len;
 2926|   109k|}
ichiprt1.c:OutputINCHI_VersionAndKind:
 3144|     80|{
 3145|     80|    inchi_ios_print_nodisplay( out_file, "%s%s=%s", pLF, INCHI_NAME, pLF );
  ------------------
  |  |  248|     80|#define INCHI_NAME          "InChI"
  ------------------
 3146|       |
 3147|     80|    inchi_strbuf_reset( strbuf );
 3148|     80|    inchi_strbuf_printf( strbuf, "%s", x_curr_ver );
 3149|       |
 3150|       |    /* - add 'Beta' flag if applicable */
 3151|     80|    if (is_beta)
  ------------------
  |  Branch (3151:9): [True: 36, False: 44]
  ------------------
 3152|     36|    {
 3153|     36|        inchi_strbuf_printf( strbuf, "B" );
 3154|     36|    }
 3155|       |    /* - add 'Standard' flag if applicable */
 3156|     44|    else if (bINChIOutputOptions & INCHI_OUT_STDINCHI)
  ------------------
  |  |  173|     44|#define INCHI_OUT_STDINCHI 0x4000
  ------------------
  |  Branch (3156:14): [True: 0, False: 44]
  ------------------
 3157|      0|    {
 3158|      0|        inchi_strbuf_printf( strbuf, "S" );
 3159|      0|    }
 3160|       |
 3161|     80|    inchi_ios_print_nodisplay( out_file, "%s%s", strbuf->pStr, pLF );
 3162|       |
 3163|     80|    return 0;
 3164|     80|}
ichiprt1.c:OutputINCHI_MainLayerFormula:
 3179|     80|{
 3180|       |
 3181|       |    /* constitution ( dot-disconnected Hill formulas: <formula> ) */
 3182|       |
 3183|     80|    if (num_components2[0] || num_components2[1])
  ------------------
  |  Branch (3183:9): [True: 80, False: 0]
  |  Branch (3183:31): [True: 0, False: 0]
  ------------------
 3184|     80|    {
 3185|     80|        szGetTag( IdentLbl, io->nTag, io->bTag1 = *INCHI_basic_or_INCHI_reconnected == INCHI_REC ? IL_REC_ : IL_FML_, io->szTag1, &io->bAlways );
  ------------------
  |  |  576|     80|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (3185:51): [True: 0, False: 80]
  ------------------
 3186|     80|        inchi_strbuf_reset( strbuf );
 3187|     80|        io->tot_len = str_HillFormula( io->pINChISort, strbuf, &io->bOverflow, io->bOutType,
 3188|     80|                                   io->num_components, io->bUseMulipliers );
 3189|       |
 3190|     80|        if (str_LineEnd( io->szTag1, &io->bOverflow, strbuf, -1, 1 ))
  ------------------
  |  Branch (3190:13): [True: 0, False: 80]
  ------------------
 3191|      0|        {
 3192|      0|            return 1;
 3193|      0|        }
 3194|     80|        if (io->n_pzz > 0 && io->n_zy > 0)
  ------------------
  |  Branch (3194:13): [True: 0, False: 80]
  |  Branch (3194:30): [True: 0, False: 0]
  ------------------
 3195|      0|        {
 3196|      0|            int retm = MergeZzInHillFormula(strbuf);
 3197|      0|            if (0 != retm)
  ------------------
  |  Branch (3197:17): [True: 0, False: 0]
  ------------------
 3198|      0|            {
 3199|      0|                return -1;
 3200|      0|            }
 3201|      0|        }
 3202|     80|        inchi_ios_print_nodisplay( out_file, "%s%s", strbuf->pStr, pLF );
 3203|     80|    }
 3204|       |
 3205|     80|    return 0;
 3206|     80|}
ichiprt1.c:str_LineEnd:
 2208|    139|{
 2209|    139|    static const int  add_tag_len = sizeof( x_line_closing ) - 1 + sizeof( x_close_line ) - 1;
 2210|    139|    int tag_len;
 2211|       |
 2212|       |    /* check buffer overflow */
 2213|    139|    if (*bOverflow)
  ------------------
  |  Branch (2213:9): [True: 0, False: 139]
  ------------------
 2214|      0|    {
 2215|      0|        return 1;
 2216|      0|    }
 2217|       |
 2218|    139|    if (ind < 0)
  ------------------
  |  Branch (2218:9): [True: 139, False: 0]
  ------------------
 2219|    139|    {
 2220|       |        /* Plain text */
 2221|       |        /* insert plain text tag if:
 2222|       |           (a) pStr has non-zero length, or
 2223|       |           (b) ind < -1
 2224|       |        */
 2225|    139|        if (buf->pStr[0] || ind < -1)
  ------------------
  |  Branch (2225:13): [True: 139, False: 0]
  |  Branch (2225:29): [True: 0, False: 0]
  ------------------
 2226|    139|        {
 2227|    139|            tag_len = bPlainTextTags ? (int) strlen( tag ) : 0;
  ------------------
  |  Branch (2227:23): [True: 139, False: 0]
  ------------------
 2228|    139|            if (tag_len > 0)
  ------------------
  |  Branch (2228:17): [True: 139, False: 0]
  ------------------
 2229|    139|            {
 2230|    139|                int n_added = tag_len + 2 + 2;
 2231|    139|                inchi_strbuf_update( buf, n_added );
 2232|    139|                memmove( buf->pStr + tag_len, buf->pStr, buf->nUsedLength + 1 );
 2233|       |                                    /* NB: trailing 0 is also memmoved */
 2234|    139|                memcpy( buf->pStr, tag, tag_len );
 2235|       |                /* to be sure...  */
 2236|    139|                buf->nUsedLength = strlen( buf->pStr );
 2237|    139|            }
 2238|    139|        }
 2239|    139|    }
 2240|       |
 2241|    139|    return 0;
 2242|    139|}
ichiprt1.c:OutputINCHI_MainLayerConnections:
 3218|     80|{
 3219|       |    /* connections ( semicolon/dot-disconnected connection tables ) */
 3220|       |
 3221|     80|    szGetTag( IdentLbl, io->nTag, io->bTag1 = IL_CONN, io->szTag1, &io->bAlways );
 3222|     80|    inchi_strbuf_reset( strbuf );
 3223|     80|    io->tot_len = 0;
 3224|     80|    io->tot_len2 = str_Connections( pCG, io->pINChISort, strbuf, &io->bOverflow, io->bOutType,
 3225|     80|                                    io->ATOM_MODE, io->num_components, io->bUseMulipliers );
 3226|       |
 3227|       |    /* current version does not output empty (";;;;") connectivity */
 3228|       |
 3229|     80|    if (io->tot_len != io->tot_len2)
  ------------------
  |  Branch (3229:9): [True: 3, False: 77]
  ------------------
 3230|      3|    { /* 2004-06-30: never output empty connection table */
 3231|      3|        io->tot_len = io->tot_len2;
 3232|      3|        if (str_LineEnd( io->szTag1, &io->bOverflow, strbuf, -2, io->bPlainTextTags ))
  ------------------
  |  Branch (3232:13): [True: 0, False: 3]
  ------------------
 3233|      0|        {
 3234|      0|            return 1; /* pStr overfow */
 3235|      0|        }
 3236|      3|        inchi_ios_print_nodisplay( out_file, "%s%s", strbuf->pStr, pLF );
 3237|      3|    }
 3238|       |
 3239|     80|    return 0;
 3240|     80|}
ichiprt1.c:OutputINCHI_MainLayerHydrogens:
 3252|     80|{
 3253|       |
 3254|       |    /* hydrogen atoms (do not output empty) */
 3255|       |
 3256|     80|    if (INCHI_SEGM_FILL == INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_h_H_ATOMS] ))
  ------------------
  |  Branch (3256:9): [True: 39, False: 41]
  ------------------
 3257|     39|    {
 3258|     39|        szGetTag( IdentLbl, io->nTag, io->bTag1 = IL_ALLH, io->szTag1, &io->bAlways );
 3259|     39|        inchi_strbuf_reset( strbuf );
 3260|     39|        io->tot_len = 0;
 3261|     39|        io->tot_len2 = str_H_atoms( io->pINChISort, strbuf, &io->bOverflow, io->bOutType,
 3262|     39|                                io->ATOM_MODE, io->TAUT_MODE,
 3263|     39|                                io->num_components, io->bUseMulipliers );
 3264|     39|        if (io->tot_len != io->tot_len2)
  ------------------
  |  Branch (3264:13): [True: 39, False: 0]
  ------------------
 3265|     39|        { /* 2004-06-21: never output empty */
 3266|     39|            io->tot_len = io->tot_len2;
 3267|     39|            if (str_LineEnd( io->szTag1, &io->bOverflow, strbuf, -2, 1 ))
  ------------------
  |  Branch (3267:17): [True: 0, False: 39]
  ------------------
 3268|      0|            {
 3269|      0|                return 1;
 3270|      0|            }
 3271|     39|            inchi_ios_print_nodisplay( out_file, "%s%s", strbuf->pStr, pLF );
 3272|     39|        }
 3273|     39|    }
 3274|       |
 3275|     80|    return 0;
 3276|     80|}
ichiprt1.c:OutputINCHI_ChargeAndRemovedAddedProtonsLayers:
 3288|     80|{
 3289|       |
 3290|       |    /* charge  */
 3291|       |
 3292|     80|    io->nSegmAction = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_q_CHARGE] );
 3293|     80|    if (io->nSegmAction)
  ------------------
  |  Branch (3293:9): [True: 3, False: 77]
  ------------------
 3294|      3|    {
 3295|      3|        szGetTag( IdentLbl, io->nTag, io->bTag1 = IL_CHRG | io->bFhTag, io->szTag1, &io->bAlways );
 3296|      3|        inchi_strbuf_reset( strbuf );
 3297|      3|        io->tot_len = 0;
 3298|      3|        if (INCHI_SEGM_FILL == io->nSegmAction)
  ------------------
  |  Branch (3298:13): [True: 3, False: 0]
  ------------------
 3299|      3|        {
 3300|      3|            io->tot_len = str_Charge2( io->pINChISort, io->pINChISort2,
 3301|      3|                                   strbuf, &io->bOverflow, io->bOutType, io->num_components,
 3302|      3|                                   io->bSecondNonTautPass, io->bOmitRepetitions, io->bUseMulipliers );
 3303|      3|            io->bNonTautNonIsoIdentifierNotEmpty += io->bSecondNonTautPass;
 3304|      3|        }
 3305|      3|        if (str_LineEnd( io->szTag1, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags ))
  ------------------
  |  Branch (3305:13): [True: 0, False: 3]
  ------------------
 3306|      0|        {
 3307|      0|            return 1;
 3308|      0|        }
 3309|      3|        inchi_ios_print_nodisplay( out_file, "%s%s", strbuf->pStr, pLF );
 3310|      3|    }
 3311|       |
 3312|       |    /* removed protons */
 3313|       |
 3314|     80|    if (io->iCurTautMode == TAUT_YES && !io->bSecondNonTautPass)
  ------------------
  |  |  580|    160|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3314:9): [True: 80, False: 0]
  |  Branch (3314:41): [True: 80, False: 0]
  ------------------
 3315|     80|    {
 3316|       |
 3317|     80|        io->nSegmAction = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_p_PROTONS] );
 3318|     80|        if (io->nSegmAction)
  ------------------
  |  Branch (3318:13): [True: 0, False: 80]
  ------------------
 3319|      0|        {
 3320|      0|            szGetTag( IdentLbl, io->nTag, io->bTag1 = IL_PROT | io->bFhTag, io->szTag1, &io->bAlways );
 3321|      0|            inchi_strbuf_reset( strbuf );
 3322|      0|            io->tot_len = 0;
 3323|      0|            inchi_strbuf_printf( strbuf, "%+d", io->nNumRemovedProtons );
 3324|      0|            if (str_LineEnd( io->szTag1, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags ))
  ------------------
  |  Branch (3324:17): [True: 0, False: 0]
  ------------------
 3325|      0|            {
 3326|      0|                return 1;
 3327|      0|            }
 3328|      0|            inchi_ios_print_nodisplay( out_file, "%s%s", strbuf->pStr, pLF );
 3329|      0|        }
 3330|     80|        else
 3331|     80|        {
 3332|     80|            if (io->bPlainTextTags == 1) inchi_ios_print_nodisplay( out_file, "/" );
  ------------------
  |  Branch (3332:17): [True: 0, False: 80]
  ------------------
 3333|     80|        }
 3334|     80|    }
 3335|       |
 3336|     80|    return 0;
 3337|     80|}
ichiprt1.c:OutputINCHI_StereoLayer:
 3349|     80|{
 3350|       |
 3351|     80|    {
 3352|     80|        int i;
 3353|     80|        i = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_t_SATOMS] );
 3354|     80|        i = i;
 3355|     80|    }
 3356|       |
 3357|     80|    if (INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_b_SBONDS] ) ||
  ------------------
  |  Branch (3357:9): [True: 0, False: 80]
  ------------------
 3358|     80|         INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_t_SATOMS] ) ||
  ------------------
  |  Branch (3358:10): [True: 0, False: 80]
  ------------------
 3359|     80|         INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_m_SP3INV] ) ||
  ------------------
  |  Branch (3359:10): [True: 0, False: 80]
  ------------------
 3360|     80|         INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_s_STYPE] ))
  ------------------
  |  Branch (3360:10): [True: 0, False: 80]
  ------------------
 3361|      0|    {
 3362|       |
 3363|       |        /*  stereo */
 3364|       |
 3365|      0|        szGetTag( IdentLbl, io->nTag, io->bTag1 = IL_STER | io->bFhTag, io->szTag1, &io->bAlways );
 3366|       |
 3367|       |        /*  sp2 */
 3368|       |
 3369|       |        /*if ( bStereoSp2[io->iCurTautMode]  )*/
 3370|      0|        if (io->nSegmAction = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_b_SBONDS] ))
  ------------------
  |  Branch (3370:13): [True: 0, False: 0]
  ------------------
 3371|      0|        {
 3372|      0|            szGetTag( IdentLbl, io->nTag, io->bTag2 = io->bTag1 | IL_DBND, io->szTag2, &io->bAlways );
 3373|      0|            inchi_strbuf_reset( strbuf );
 3374|      0|            io->tot_len = 0;
 3375|      0|            if (INCHI_SEGM_FILL == io->nSegmAction)
  ------------------
  |  Branch (3375:17): [True: 0, False: 0]
  ------------------
 3376|      0|            {
 3377|      0|                io->tot_len = str_Sp2( io->pINChISort, io->pINChISort2, strbuf, &io->bOverflow,
 3378|      0|                                        io->bOutType, io->TAUT_MODE, io->num_components,
 3379|      0|                                        io->bSecondNonTautPass, io->bOmitRepetitions, io->bUseMulipliers );
 3380|       |
 3381|      0|                io->bNonTautNonIsoIdentifierNotEmpty += io->bSecondNonTautPass;
 3382|      0|            }
 3383|       |
 3384|      0|            if (str_LineEnd( io->szTag2, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags ))
  ------------------
  |  Branch (3384:17): [True: 0, False: 0]
  ------------------
 3385|      0|            {
 3386|      0|                return 1;
 3387|      0|            }
 3388|      0|            inchi_ios_print_nodisplay( out_file, "%s%s", strbuf->pStr, pLF );
 3389|      0|        }
 3390|      0|        else
 3391|      0|        {
 3392|      0|            if (io->bPlainTextTags == 1)
  ------------------
  |  Branch (3392:17): [True: 0, False: 0]
  ------------------
 3393|      0|            {
 3394|      0|                inchi_ios_print_nodisplay( out_file, "/" ); /* sp2 */
 3395|      0|            }
 3396|      0|        }
 3397|       |
 3398|       |        /*  sp3 */
 3399|       |
 3400|       |        /*if ( bStereoSp3[io->iCurTautMode]  )*/
 3401|      0|        if (io->nSegmAction = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_t_SATOMS] ))
  ------------------
  |  Branch (3401:13): [True: 0, False: 0]
  ------------------
 3402|      0|        {
 3403|      0|            io->bRelRac = io->bRelativeStereo[io->iCurTautMode] || io->bRacemicStereo[io->iCurTautMode];
  ------------------
  |  Branch (3403:27): [True: 0, False: 0]
  |  Branch (3403:68): [True: 0, False: 0]
  ------------------
 3404|      0|            szGetTag( IdentLbl, io->nTag, io->bTag2 = io->bTag1 | IL_SP3S, io->szTag2, &io->bAlways );
 3405|      0|            inchi_strbuf_reset( strbuf );
 3406|      0|            io->tot_len = 0;
 3407|      0|            if (INCHI_SEGM_FILL == io->nSegmAction)
  ------------------
  |  Branch (3407:17): [True: 0, False: 0]
  ------------------
 3408|      0|            {
 3409|      0|                io->tot_len = str_Sp3( io->pINChISort, io->pINChISort2, strbuf, &io->bOverflow,
 3410|      0|                                       io->bOutType, io->TAUT_MODE, io->num_components, io->bRelRac,
 3411|      0|                                   io->bSecondNonTautPass, io->bOmitRepetitions, io->bUseMulipliers );
 3412|       |
 3413|      0|                io->bNonTautNonIsoIdentifierNotEmpty += io->bSecondNonTautPass;
 3414|      0|            }
 3415|       |
 3416|      0|            if (str_LineEnd( io->szTag2, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags ))
  ------------------
  |  Branch (3416:17): [True: 0, False: 0]
  ------------------
 3417|      0|            {
 3418|      0|                return 2;
 3419|      0|            }
 3420|      0|            inchi_ios_print_nodisplay( out_file, "%s%s", strbuf->pStr, pLF );
 3421|      0|        }
 3422|      0|        else
 3423|      0|        {
 3424|      0|            if (io->bPlainTextTags == 1) inchi_ios_print_nodisplay( out_file, "/" ); /* sp3 */
  ------------------
  |  Branch (3424:17): [True: 0, False: 0]
  ------------------
 3425|      0|        }
 3426|       |
 3427|       |        /* bStereoAbsInverted[io->iCurTautMode]  */
 3428|       |
 3429|       |        /* if ( bStereoAbs[io->iCurTautMode]  ) */
 3430|      0|        if (io->nSegmAction = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_m_SP3INV] ))
  ------------------
  |  Branch (3430:13): [True: 0, False: 0]
  ------------------
 3431|      0|        {
 3432|      0|            szGetTag( IdentLbl, io->nTag, io->bTag2 = io->bTag1 | IL_INVS, io->szTag2, &io->bAlways );
 3433|      0|            inchi_strbuf_reset( strbuf ); io->tot_len = 0;
 3434|      0|            if (INCHI_SEGM_FILL == io->nSegmAction)
  ------------------
  |  Branch (3434:17): [True: 0, False: 0]
  ------------------
 3435|      0|            {
 3436|      0|                io->tot_len = str_StereoAbsInv( io->pINChISort, strbuf,
 3437|      0|                                            &io->bOverflow, io->bOutType, io->num_components );
 3438|      0|                io->bNonTautNonIsoIdentifierNotEmpty += io->bSecondNonTautPass;
 3439|      0|            }
 3440|       |
 3441|      0|            if (str_LineEnd( io->szTag2, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags ))
  ------------------
  |  Branch (3441:17): [True: 0, False: 0]
  ------------------
 3442|      0|            {
 3443|      0|                return 3;
 3444|      0|            }
 3445|      0|            inchi_ios_print_nodisplay( out_file, "%s%s", strbuf->pStr, pLF );
 3446|      0|        }
 3447|      0|        else
 3448|      0|        {
 3449|      0|            if (io->bPlainTextTags == 1)
  ------------------
  |  Branch (3449:17): [True: 0, False: 0]
  ------------------
 3450|      0|            {
 3451|      0|                inchi_ios_print_nodisplay( out_file, "/" ); /* stereo-abs-inv */
 3452|      0|            }
 3453|      0|        }
 3454|       |
 3455|       |        /* stereo type */
 3456|       |
 3457|       |        /*if ( io->bRacemicStereo[io->iCurTautMode] || io->bRelativeStereo[io->iCurTautMode] || bStereoAbs[io->iCurTautMode] )*/
 3458|      0|        if (io->nSegmAction = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_s_STYPE] ))
  ------------------
  |  Branch (3458:13): [True: 0, False: 0]
  ------------------
 3459|      0|        {
 3460|      0|            const char *p_stereo = io->bRelativeStereo[io->iCurTautMode] ? x_rel :
  ------------------
  |  Branch (3460:36): [True: 0, False: 0]
  ------------------
 3461|      0|                io->bRacemicStereo[io->iCurTautMode] ? x_rac : x_abs;
  ------------------
  |  Branch (3461:17): [True: 0, False: 0]
  ------------------
 3462|      0|            szGetTag( IdentLbl, io->nTag, io->bTag2 = io->bTag1 | IL_TYPS, io->szTag2, &io->bAlways );
 3463|      0|            inchi_strbuf_reset( strbuf ); io->tot_len = 0;
 3464|      0|            if (INCHI_SEGM_FILL == io->nSegmAction)
  ------------------
  |  Branch (3464:17): [True: 0, False: 0]
  ------------------
 3465|      0|            {
 3466|      0|                ( io->tot_len ) += MakeDelim( p_stereo, strbuf, &io->bOverflow );
 3467|      0|                io->bNonTautNonIsoIdentifierNotEmpty += io->bSecondNonTautPass;
 3468|      0|            }
 3469|      0|            if (str_LineEnd( io->szTag2, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags ))
  ------------------
  |  Branch (3469:17): [True: 0, False: 0]
  ------------------
 3470|      0|            {
 3471|      0|                return 1;
 3472|      0|            }
 3473|      0|            inchi_ios_print_nodisplay( out_file, "%s%s", strbuf->pStr, pLF );
 3474|      0|        }
 3475|      0|        if (io->bPlainTextTags == 1)
  ------------------
  |  Branch (3475:13): [True: 0, False: 0]
  ------------------
 3476|      0|        {
 3477|      0|            inchi_ios_print_nodisplay( out_file, "/" );  /* no abs, inv or racemic stereo */
 3478|      0|        }
 3479|      0|    }
 3480|     80|    else
 3481|     80|    {
 3482|     80|        if (io->bPlainTextTags == 1) inchi_ios_print_nodisplay( out_file, "////" ); /* sp3, sp2, abs-inv, stereo.type */
  ------------------
  |  Branch (3482:13): [True: 0, False: 80]
  ------------------
 3483|     80|    }
 3484|       |
 3485|     80|    return 0;
 3486|     80|}
ichiprt1.c:OutputINCHI_IsotopicLayer:
 3498|     80|{
 3499|       |
 3500|     80|    if (INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_i_IATOMS] ))
  ------------------
  |  Branch (3500:9): [True: 14, False: 66]
  ------------------
 3501|     14|    {
 3502|       |        /*  isotopic #1:  composition -- atoms -- do not output in xml if empty */
 3503|     14|        szGetTag( IdentLbl, io->nTag, io->bTag1 = IL_ISOT | io->bFhTag, io->szTag1, &io->bAlways );
 3504|       |        /* isotopic atoms without mobile H.
 3505|       |         * Fixed 2004-06-15: always output if not bXml. Note:
 3506|       |         * Previous condition if( bHasIsotopicAtoms[io->iCurTautMode] || bIsotopic && !bXml)
 3507|       |         * did not optput /i in case of only mobile isotopic H
 3508|       |         */
 3509|     14|        if (io->nSegmAction = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_i_IATOMS] ))
  ------------------
  |  Branch (3509:13): [True: 14, False: 0]
  ------------------
 3510|     14|        {
 3511|     14|            szGetTag( IdentLbl, io->nTag, io->bTag2 = io->bTag1 | IL_ATMS, io->szTag2, &io->bAlways );
 3512|     14|            inchi_strbuf_reset( strbuf );
 3513|     14|            io->tot_len = 0;
 3514|       |            /*if ( bHasIsotopicAtoms[io->iCurTautMode] )*/
 3515|     14|            if (INCHI_SEGM_FILL == io->nSegmAction)
  ------------------
  |  Branch (3515:17): [True: 14, False: 0]
  ------------------
 3516|     14|            {
 3517|     14|                io->tot_len2 = str_IsoAtoms( io->pINChISort, io->pINChISort2, strbuf, &io->bOverflow,
 3518|     14|                                             io->bOutType, io->TAUT_MODE, io->num_components, io->bAbcNumbers,
 3519|     14|                                             io->bSecondNonTautPass, io->bOmitRepetitions, io->bUseMulipliers );
 3520|     14|                io->bNonTautIsoIdentifierNotEmpty += io->bSecondNonTautPass;
 3521|     14|            }
 3522|      0|            else
 3523|      0|            {
 3524|      0|                io->tot_len2 = io->tot_len;
 3525|      0|            }
 3526|       |
 3527|     14|            io->tot_len = io->tot_len2;
 3528|     14|            if (str_LineEnd( io->szTag2, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags ))
  ------------------
  |  Branch (3528:17): [True: 0, False: 14]
  ------------------
 3529|      0|            {
 3530|      0|                return 1;
 3531|      0|            }
 3532|     14|            inchi_ios_print_nodisplay( out_file, "%s%s", strbuf->pStr, pLF );
 3533|     14|        }
 3534|       |
 3535|       |        /*  isotopic #1a:  composition -- exchangeable isotopic H (mobile H only) */
 3536|       |        /*if ( !io->bSecondNonTautPass && bHasIsoH )*/
 3537|     14|        if (io->nSegmAction = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_h_H_ATOMS] ))
  ------------------
  |  Branch (3537:13): [True: 0, False: 14]
  ------------------
 3538|      0|        {
 3539|      0|            szGetTag( IdentLbl, io->nTag, io->bTag2 = io->bTag1 | IL_XCGA, io->szTag2, &io->bAlways );
 3540|      0|            inchi_strbuf_reset( strbuf );
 3541|      0|            io->tot_len = 0;
 3542|      0|            ( io->tot_len ) += MakeIsoHString( io->num_iso_H, strbuf, io->TAUT_MODE, &io->bOverflow );
 3543|      0|            io->bNonTautIsoIdentifierNotEmpty += io->bSecondNonTautPass;
 3544|      0|            if (str_LineEnd( io->szTag2, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags ))
  ------------------
  |  Branch (3544:17): [True: 0, False: 0]
  ------------------
 3545|      0|            {
 3546|      0|                return 2;
 3547|      0|            }
 3548|      0|            inchi_ios_print_nodisplay( out_file, "%s%s", strbuf->pStr, pLF );
 3549|      0|        }
 3550|       |
 3551|       |        /***************************************************
 3552|       |         *
 3553|       |         *       Isotopic stereo
 3554|       |         *
 3555|       |         ***************************************************/
 3556|       |
 3557|       |        /*if ( bIsotopicStereo[io->iCurTautMode] )*/
 3558|     14|        if (INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_b_SBONDS] ) ||
  ------------------
  |  Branch (3558:13): [True: 0, False: 14]
  ------------------
 3559|     14|             INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_t_SATOMS] ) ||
  ------------------
  |  Branch (3559:14): [True: 0, False: 14]
  ------------------
 3560|     14|             INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_m_SP3INV] ) ||
  ------------------
  |  Branch (3560:14): [True: 0, False: 14]
  ------------------
 3561|     14|             INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_s_STYPE] ))
  ------------------
  |  Branch (3561:14): [True: 0, False: 14]
  ------------------
 3562|      0|        {
 3563|       |            /*  stereo */
 3564|      0|            szGetTag( IdentLbl, io->nTag, io->bTag2 = io->bTag1 | IL_STER, io->szTag2, &io->bAlways );
 3565|       |
 3566|       |            /************************
 3567|       |              isotopic #2:  sp2
 3568|       |             ************************/
 3569|       |            /*if ( bIsotopicStereoSp2[io->iCurTautMode]  )*/
 3570|      0|            if (io->nSegmAction = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_b_SBONDS] ))
  ------------------
  |  Branch (3570:17): [True: 0, False: 0]
  ------------------
 3571|      0|            {
 3572|      0|                szGetTag( IdentLbl, io->nTag, io->bTag3 = io->bTag2 | IL_DBND, io->szTag3, &io->bAlways );
 3573|      0|                inchi_strbuf_reset( strbuf );
 3574|      0|                io->tot_len = 0;
 3575|      0|                if (INCHI_SEGM_FILL == io->nSegmAction)
  ------------------
  |  Branch (3575:21): [True: 0, False: 0]
  ------------------
 3576|      0|                {
 3577|      0|                    io->tot_len = str_IsoSp2( io->pINChISort, io->pINChISort2, strbuf, &io->bOverflow,
 3578|      0|                                              io->bOutType, io->TAUT_MODE, io->num_components,
 3579|      0|                                          io->bSecondNonTautPass, io->bOmitRepetitions, io->bUseMulipliers );
 3580|      0|                    io->bNonTautIsoIdentifierNotEmpty += io->bSecondNonTautPass;
 3581|      0|                }
 3582|      0|                if (str_LineEnd( io->szTag3, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags ))
  ------------------
  |  Branch (3582:21): [True: 0, False: 0]
  ------------------
 3583|      0|                {
 3584|      0|                    return 3;
 3585|      0|                }
 3586|      0|                inchi_ios_print_nodisplay( out_file, "%s%s", strbuf->pStr, pLF );
 3587|      0|            }
 3588|      0|            else
 3589|      0|            {
 3590|      0|                if (io->bPlainTextTags == 1) inchi_ios_print_nodisplay( out_file, "/" ); /* iso sp2 */
  ------------------
  |  Branch (3590:21): [True: 0, False: 0]
  ------------------
 3591|      0|            }
 3592|       |
 3593|       |            /************************
 3594|       |              isotopic #3:  sp3
 3595|       |             ************************/
 3596|       |            /*if ( bIsotopicStereoSp3[io->iCurTautMode]  )*/
 3597|      0|            if (io->nSegmAction = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_t_SATOMS] ))
  ------------------
  |  Branch (3597:17): [True: 0, False: 0]
  ------------------
 3598|      0|            {
 3599|      0|                io->bRelRac = io->bIsotopicRelativeStereo[io->iCurTautMode] || io->bIsotopicRacemicStereo[io->iCurTautMode];
  ------------------
  |  Branch (3599:31): [True: 0, False: 0]
  |  Branch (3599:80): [True: 0, False: 0]
  ------------------
 3600|       |
 3601|      0|                szGetTag( IdentLbl, io->nTag, io->bTag3 = io->bTag2 | IL_SP3S, io->szTag3, &io->bAlways );
 3602|      0|                inchi_strbuf_reset( strbuf );
 3603|      0|                io->tot_len = 0;
 3604|      0|                if (INCHI_SEGM_FILL == io->nSegmAction)
  ------------------
  |  Branch (3604:21): [True: 0, False: 0]
  ------------------
 3605|      0|                {
 3606|      0|                    io->tot_len = str_IsoSp3( io->pINChISort, io->pINChISort2, strbuf, &io->bOverflow,
 3607|      0|                                              io->bOutType, io->TAUT_MODE, io->num_components, io->bRelRac,
 3608|      0|                                              io->bSecondNonTautPass, io->bOmitRepetitions, io->bUseMulipliers );
 3609|      0|                    io->bNonTautIsoIdentifierNotEmpty += io->bSecondNonTautPass;
 3610|      0|                }
 3611|      0|                if (str_LineEnd( io->szTag3, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags ))
  ------------------
  |  Branch (3611:21): [True: 0, False: 0]
  ------------------
 3612|      0|                {
 3613|      0|                    return 5;
 3614|      0|                }
 3615|      0|                inchi_ios_print_nodisplay( out_file, "%s%s", strbuf->pStr, pLF );
 3616|      0|            }
 3617|      0|            else
 3618|      0|            {
 3619|      0|                if (io->bPlainTextTags == 1)
  ------------------
  |  Branch (3619:21): [True: 0, False: 0]
  ------------------
 3620|      0|                {
 3621|      0|                    inchi_ios_print_nodisplay( out_file, "/" ); /* iso-sp3 */
 3622|      0|                }
 3623|      0|            }
 3624|       |
 3625|       |            /* isotopic #4: abs inverted */
 3626|      0|            if (io->nSegmAction = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_m_SP3INV] ))
  ------------------
  |  Branch (3626:17): [True: 0, False: 0]
  ------------------
 3627|      0|            {
 3628|      0|                szGetTag( IdentLbl, io->nTag, io->bTag3 = io->bTag2 | IL_INVS, io->szTag3, &io->bAlways );
 3629|      0|                inchi_strbuf_reset( strbuf );
 3630|      0|                io->tot_len = 0;
 3631|      0|                if (INCHI_SEGM_FILL == io->nSegmAction)
  ------------------
  |  Branch (3631:21): [True: 0, False: 0]
  ------------------
 3632|      0|                {
 3633|      0|                    io->tot_len = str_IsoStereoAbsInv( io->pINChISort, strbuf,
 3634|      0|                                                   &io->bOverflow, io->bOutType, io->num_components );
 3635|      0|                    io->bNonTautIsoIdentifierNotEmpty += io->bSecondNonTautPass;
 3636|      0|                }
 3637|      0|                if (str_LineEnd( io->szTag3, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags ))
  ------------------
  |  Branch (3637:21): [True: 0, False: 0]
  ------------------
 3638|      0|                {
 3639|      0|                    return 5;
 3640|      0|                }
 3641|      0|                inchi_ios_print_nodisplay( out_file, "%s%s", strbuf->pStr, pLF );
 3642|      0|            }
 3643|      0|            else
 3644|      0|            {
 3645|      0|                if (io->bPlainTextTags == 1)
  ------------------
  |  Branch (3645:21): [True: 0, False: 0]
  ------------------
 3646|      0|                {
 3647|      0|                    inchi_ios_print_nodisplay( out_file, "/" );
 3648|      0|                }
 3649|      0|            }
 3650|       |
 3651|       |            /* isotopic #5: stereo type. Do not output if it has already been output in non-iso */
 3652|      0|            if (io->nSegmAction = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_s_STYPE] ))
  ------------------
  |  Branch (3652:17): [True: 0, False: 0]
  ------------------
 3653|      0|            {
 3654|      0|                const char *p_stereo = io->bIsotopicRelativeStereo[io->iCurTautMode] ? x_rel :
  ------------------
  |  Branch (3654:40): [True: 0, False: 0]
  ------------------
 3655|      0|                    io->bIsotopicRacemicStereo[io->iCurTautMode] ? x_rac : x_abs;
  ------------------
  |  Branch (3655:21): [True: 0, False: 0]
  ------------------
 3656|      0|                szGetTag( IdentLbl, io->nTag, io->bTag3 = io->bTag2 | IL_TYPS, io->szTag3, &io->bAlways );
 3657|      0|                inchi_strbuf_reset( strbuf );
 3658|      0|                io->tot_len = 0;
 3659|      0|                if (INCHI_SEGM_FILL == io->nSegmAction)
  ------------------
  |  Branch (3659:21): [True: 0, False: 0]
  ------------------
 3660|      0|                {
 3661|      0|                    io->tot_len += MakeDelim( p_stereo, strbuf, &io->bOverflow );
 3662|      0|                    io->bNonTautIsoIdentifierNotEmpty += io->bSecondNonTautPass;
 3663|      0|                }
 3664|      0|                if (str_LineEnd( io->szTag3, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags ))
  ------------------
  |  Branch (3664:21): [True: 0, False: 0]
  ------------------
 3665|      0|                {
 3666|      0|                    return 6;
 3667|      0|                }
 3668|      0|                inchi_ios_print_nodisplay( out_file, "%s%s", strbuf->pStr, pLF );
 3669|      0|            }
 3670|      0|            if (io->bPlainTextTags == 1)
  ------------------
  |  Branch (3670:17): [True: 0, False: 0]
  ------------------
 3671|      0|            {
 3672|      0|                inchi_ios_print_nodisplay( out_file, "/" );  /* no abs, inv or racemic stereo */
 3673|      0|            }
 3674|      0|        }
 3675|     14|        else
 3676|     14|        {
 3677|       |            /* no isotopic stereo */
 3678|     14|            if (io->bPlainTextTags == 1)
  ------------------
  |  Branch (3678:17): [True: 0, False: 14]
  ------------------
 3679|      0|            {
 3680|      0|                inchi_ios_print_nodisplay( out_file, "////" ); /* sp3, sp2, abs-inv, stereo.type */
 3681|      0|            }
 3682|     14|        }
 3683|     14|    }
 3684|     66|    else
 3685|     66|    {
 3686|     66|        if (io->bPlainTextTags == 1)
  ------------------
  |  Branch (3686:13): [True: 0, False: 66]
  ------------------
 3687|      0|        {
 3688|      0|            inchi_ios_print_nodisplay( out_file, "///" ); /* isotopic composition, sp2, sp3 */
 3689|      0|        }
 3690|     66|        if (io->bPlainTextTags == 1)
  ------------------
  |  Branch (3690:13): [True: 0, False: 66]
  ------------------
 3691|      0|        {
 3692|      0|            inchi_ios_print_nodisplay( out_file, "//" );   /* inv or racemic stereo */
 3693|      0|        }
 3694|     66|    }
 3695|       |
 3696|     80|#if ( CANON_FIXH_TRANS == 1 )
 3697|     80|    if (io->bOutType == OUT_NONTAUT && io->bOutputType == OUT_TN && io->bSecondNonTautPass &&
  ------------------
  |  |  967|     80|#define OUT_NONTAUT  OUT_NN  /* was OUT_NT until 2004-04-07 */
  |  |  ------------------
  |  |  |  |  590|    160|#define OUT_NN              4    /* only non-taut representations: non-taut else tautomeric */
  |  |  ------------------
  ------------------
                  if (io->bOutType == OUT_NONTAUT && io->bOutputType == OUT_TN && io->bSecondNonTautPass &&
  ------------------
  |  |  588|     80|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  ------------------
  |  Branch (3697:9): [True: 0, False: 80]
  |  Branch (3697:40): [True: 0, False: 0]
  |  Branch (3697:69): [True: 0, False: 0]
  ------------------
 3698|     80|         INCHI_SEGM_FILL == INChI_SegmentAction( io->sDifSegs[DIFL_F][DIFS_o_TRANSP] ))
  ------------------
  |  Branch (3698:10): [True: 0, False: 0]
  ------------------
 3699|      0|    {
 3700|       |        /* find and print non-tautomeric components transposition, if non-trivial */
 3701|      0|        AT_NUMB *nTrans_n, *nTrans_s;
 3702|       |
 3703|      0|        if (0 < bin_AuxTautTrans( io->pINChISort, io->pINChISort2, &nTrans_n, &nTrans_s, io->bOutType, io->num_components ))
  ------------------
  |  Branch (3703:13): [True: 0, False: 0]
  ------------------
 3704|      0|        {
 3705|       |            /* a non-trivial transposition does exist; output start tag */
 3706|      0|            szGetTag( IdentLbl, io->nTag, io->bTag1 = IL_TRNS | io->bFhTag, io->szTag1, &io->bAlways );
 3707|      0|            inchi_strbuf_reset( strbuf );
 3708|      0|            io->tot_len = 0;
 3709|       |            /* print the transposition, cycle after cycle */
 3710|      0|            io->tot_len = str_AuxTautTrans( pCG, nTrans_n, nTrans_s, strbuf,
 3711|      0|                                            &io->bOverflow, io->TAUT_MODE, io->num_components );
 3712|      0|            io->bNonTautIsoIdentifierNotEmpty += io->bSecondNonTautPass;
 3713|      0|            if (str_LineEnd( io->szTag1, &io->bOverflow, strbuf, -1, io->bPlainTextTags ))
  ------------------
  |  Branch (3713:17): [True: 0, False: 0]
  ------------------
 3714|      0|            {
 3715|      0|                return 7;
 3716|      0|            }
 3717|      0|            inchi_ios_print_nodisplay( out_file, "%s%s", strbuf->pStr, pLF );
 3718|       |             /* detected transposition */
 3719|      0|            ( *io->pSortPrintINChIFlags ) |=
 3720|      0|                ( *INCHI_basic_or_INCHI_reconnected == INCHI_BAS ) ? FLAG_SORT_PRINT_TRANSPOS_BAS : FLAG_SORT_PRINT_TRANSPOS_REC;
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                              ( *INCHI_basic_or_INCHI_reconnected == INCHI_BAS ) ? FLAG_SORT_PRINT_TRANSPOS_BAS : FLAG_SORT_PRINT_TRANSPOS_REC;
  ------------------
  |  |  329|      0|#define FLAG_SORT_PRINT_TRANSPOS_BAS   1 /* transposition in the main InChI layer */
  ------------------
                              ( *INCHI_basic_or_INCHI_reconnected == INCHI_BAS ) ? FLAG_SORT_PRINT_TRANSPOS_BAS : FLAG_SORT_PRINT_TRANSPOS_REC;
  ------------------
  |  |  330|      0|#define FLAG_SORT_PRINT_TRANSPOS_REC   2 /* transposition in the reconnected InChI layer */
  ------------------
  |  Branch (3720:17): [True: 0, False: 0]
  ------------------
 3721|      0|        }
 3722|      0|        else
 3723|      0|        {
 3724|      0|            if (io->bPlainTextTags == 1)
  ------------------
  |  Branch (3724:17): [True: 0, False: 0]
  ------------------
 3725|      0|            {
 3726|      0|                inchi_ios_print_nodisplay( out_file, "/" );
 3727|      0|            }
 3728|      0|        }
 3729|      0|    }
 3730|     80|#endif
 3731|       |
 3732|     80|    return 0;
 3733|     80|}
ichiprt1.c:OutputINCHI_FixedHLayerWithSublayers:
 3747|     80|{
 3748|       |
 3749|     80|    *then_goto_repeat = 0;
 3750|       |
 3751|     80|    if (io->bOutType == OUT_TN &&
  ------------------
  |  |  588|    160|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  ------------------
  |  Branch (3751:9): [True: 80, False: 0]
  ------------------
 3752|     80|         !( io->bSecondNonTautPass ) &&
  ------------------
  |  Branch (3752:10): [True: 80, False: 0]
  ------------------
 3753|     80|         io->bNonTautIsIdenticalToTaut &&
  ------------------
  |  Branch (3753:10): [True: 80, False: 0]
  ------------------
 3754|     80|         io->bTautomeric &&
  ------------------
  |  Branch (3754:10): [True: 39, False: 41]
  ------------------
 3755|     80|         io->bNonTautomeric)
  ------------------
  |  Branch (3755:10): [True: 0, False: 39]
  ------------------
 3756|      0|    {
 3757|       |            /* Fixed-H layer is empty in the Identifier */
 3758|      0|        ( *io->pSortPrintINChIFlags ) |=
 3759|      0|            ( *INCHI_basic_or_INCHI_reconnected == INCHI_BAS ) ? FLAG_SORT_PRINT_NO_NFIX_H_BAS :
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          ( *INCHI_basic_or_INCHI_reconnected == INCHI_BAS ) ? FLAG_SORT_PRINT_NO_NFIX_H_BAS :
  ------------------
  |  |  331|      0|#define FLAG_SORT_PRINT_NO_NFIX_H_BAS  4 /* no fixed H non-isotopic in the main InChI layer */
  ------------------
  |  Branch (3759:13): [True: 0, False: 0]
  ------------------
 3760|      0|            FLAG_SORT_PRINT_NO_NFIX_H_REC;
  ------------------
  |  |  332|      0|#define FLAG_SORT_PRINT_NO_NFIX_H_REC  8 /* no fixed H non-isotopic in the reconnected InChI layer */
  ------------------
 3761|      0|        ( *io->pSortPrintINChIFlags ) |=
 3762|      0|            ( *INCHI_basic_or_INCHI_reconnected == INCHI_BAS ) ? FLAG_SORT_PRINT_NO_IFIX_H_BAS :
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          ( *INCHI_basic_or_INCHI_reconnected == INCHI_BAS ) ? FLAG_SORT_PRINT_NO_IFIX_H_BAS :
  ------------------
  |  |  333|      0|#define FLAG_SORT_PRINT_NO_IFIX_H_BAS 16 /* no fixed H isotopic in the main InChI layer */
  ------------------
  |  Branch (3762:13): [True: 0, False: 0]
  ------------------
 3763|      0|            FLAG_SORT_PRINT_NO_IFIX_H_REC;
  ------------------
  |  |  334|      0|#define FLAG_SORT_PRINT_NO_IFIX_H_REC 32 /* no fixed H isotopic in the the reconnected InChI layer */
  ------------------
 3764|      0|    }
 3765|       |
 3766|     80|    if (io->bOutType == OUT_TN &&
  ------------------
  |  |  588|    160|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  ------------------
  |  Branch (3766:9): [True: 80, False: 0]
  ------------------
 3767|     80|         !io->bNonTautIsIdenticalToTaut && /* added 2004-10-04 Fix16 */
  ------------------
  |  Branch (3767:10): [True: 0, False: 80]
  ------------------
 3768|       |#ifdef OLD_ITEM_DISCOVERY
 3769|       |         io->bTautomeric &&
 3770|       |         io->bNonTautomeric &&
 3771|       |#endif
 3772|     80|         INChI_SegmentAction( io->sDifSegs[DIFL_F][DIFS_f_FORMULA] )
  ------------------
  |  Branch (3772:10): [True: 0, False: 0]
  ------------------
 3773|       |                                    /* special case: removed isolated H(+): */
 3774|       |                                    /* || io->iCurTautMode == TAUT_YES && num_comp[TAUT_YES] < num_comp[TAUT_NON] &&
 3775|       |                                        0 < num_comp[TAUT_NON]*/
 3776|     80|       )
 3777|       |
 3778|      0|    {
 3779|       |        /* add the second (non-tautomeric) output */
 3780|      0|        io->bOutType = OUT_NONTAUT;    /* pick up only non-tautomeric representation of tautomeric */
  ------------------
  |  |  967|      0|#define OUT_NONTAUT  OUT_NN  /* was OUT_NT until 2004-04-07 */
  |  |  ------------------
  |  |  |  |  590|      0|#define OUT_NN              4    /* only non-taut representations: non-taut else tautomeric */
  |  |  ------------------
  ------------------
 3781|      0|        io->iCurTautMode = TAUT_NON;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 3782|      0|        io->pINChISort = io->pINChISortTautAndNonTaut[TAUT_NON];
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 3783|      0|        io->bSecondNonTautPass = 1;
 3784|      0|        io->nCurINChISegment = DIFL_F;
 3785|      0|        io->num_components = io->num_comp[io->iCurTautMode]; /* number of components could change due to removal of isolated H(+) from tautomeric */
 3786|      0|        io->bFhTag = IL_FIXH;
 3787|      0|        szGetTag( IdentLbl, io->nTag, io->bTag1 = io->bFhTag, io->szTag1, &io->bAlways );
 3788|       |        /***** constitution non-taut: dot-disconnected Hill formulas: <formula> -- only if different */
 3789|      0|        szGetTag( IdentLbl, io->nTag, io->bTag1 = IL_FMLF | io->bFhTag, io->szTag1, &io->bAlways );
 3790|      0|        inchi_strbuf_reset( strbuf ); io->tot_len = 0;
 3791|      0|        io->nSegmAction = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_f_FORMULA] );
 3792|      0|        if (INCHI_SEGM_FILL == io->nSegmAction)
  ------------------
  |  Branch (3792:13): [True: 0, False: 0]
  ------------------
 3793|      0|        {
 3794|      0|            io->tot_len2 = str_HillFormula2( io->pINChISort, io->pINChISort2,
 3795|      0|                                             strbuf, &io->bOverflow, io->bOutType,
 3796|      0|                                             io->num_components, io->bUseMulipliers );
 3797|      0|            if (io->n_pzz > 0 && io->n_zy > 0)
  ------------------
  |  Branch (3797:17): [True: 0, False: 0]
  |  Branch (3797:34): [True: 0, False: 0]
  ------------------
 3798|      0|            {
 3799|      0|                MergeZzInHillFormula(strbuf);
 3800|      0|            }
 3801|      0|            io->bNonTautNonIsoIdentifierNotEmpty += io->bSecondNonTautPass;
 3802|      0|        }
 3803|      0|        else
 3804|      0|        {
 3805|      0|            io->tot_len2 = io->tot_len;
 3806|      0|        }
 3807|      0|        io->tot_len = io->tot_len2;
 3808|      0|        if (str_LineEnd( io->szTag1, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags ))
  ------------------
  |  Branch (3808:13): [True: 0, False: 0]
  ------------------
 3809|      0|        {
 3810|      0|            return 1;
 3811|      0|        }
 3812|      0|        inchi_ios_print_nodisplay( out_file, "%s%s", strbuf->pStr, pLF );
 3813|       |
 3814|      0|        io->nSegmAction = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_h_H_ATOMS] );
 3815|       |
 3816|      0|        if (INCHI_SEGM_FILL == io->nSegmAction)
  ------------------
  |  Branch (3816:13): [True: 0, False: 0]
  ------------------
 3817|      0|        {
 3818|      0|            szGetTag( IdentLbl, io->nTag, io->bTag1 = IL_HFIX | io->bFhTag, io->szTag1, &io->bAlways );
 3819|      0|            inchi_strbuf_reset( strbuf ); io->tot_len = 0; /* open H-fixed */
 3820|       |            /* output the second non-tautomeric item: fixed H -- do not output in xml if empty */
 3821|      0|            io->tot_len2 = str_FixedH_atoms( io->pINChISort, strbuf,
 3822|      0|                                             &io->bOverflow, io->bOutType, io->ATOM_MODE,
 3823|      0|                                             io->num_components, io->bUseMulipliers );
 3824|      0|            io->tot_len = io->tot_len2;
 3825|      0|            if (str_LineEnd( io->szTag1, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags ))
  ------------------
  |  Branch (3825:17): [True: 0, False: 0]
  ------------------
 3826|      0|            {
 3827|      0|                return 2;
 3828|      0|            }
 3829|      0|            inchi_ios_print_nodisplay( out_file, "%s%s", strbuf->pStr, pLF );
 3830|      0|            io->bNonTautNonIsoIdentifierNotEmpty += io->bSecondNonTautPass;
 3831|      0|        }
 3832|      0|        *then_goto_repeat = 1;
 3833|      0|        return 0;
 3834|      0|    }
 3835|       |
 3836|     80|    else
 3837|     80|    {
 3838|     80|        if (io->bOutType == OUT_NONTAUT && io->bOutputType == OUT_TN && io->bSecondNonTautPass /* && io->bTautomeric && io->bNonTautomeric*/)
  ------------------
  |  |  967|     80|#define OUT_NONTAUT  OUT_NN  /* was OUT_NT until 2004-04-07 */
  |  |  ------------------
  |  |  |  |  590|    160|#define OUT_NN              4    /* only non-taut representations: non-taut else tautomeric */
  |  |  ------------------
  ------------------
                      if (io->bOutType == OUT_NONTAUT && io->bOutputType == OUT_TN && io->bSecondNonTautPass /* && io->bTautomeric && io->bNonTautomeric*/)
  ------------------
  |  |  588|     80|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  ------------------
  |  Branch (3838:13): [True: 0, False: 80]
  |  Branch (3838:44): [True: 0, False: 0]
  |  Branch (3838:73): [True: 0, False: 0]
  ------------------
 3839|      0|        {
 3840|       |            /* the second (non-taut) output has been done; restore variables */
 3841|      0|            io->bOutType = OUT_TN;
  ------------------
  |  |  588|      0|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  ------------------
 3842|      0|            io->iCurTautMode = TAUT_YES;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3843|      0|            io->pINChISort = io->pINChISortTautAndNonTaut[TAUT_YES];
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3844|      0|            io->bSecondNonTautPass = 0;
 3845|      0|            io->num_components = io->num_comp[io->iCurTautMode];
 3846|      0|            if (!io->bNonTautNonIsoIdentifierNotEmpty)
  ------------------
  |  Branch (3846:17): [True: 0, False: 0]
  ------------------
 3847|      0|            {
 3848|       |                /* Fixed-H layer is empty in the Identifier */
 3849|      0|                ( *io->pSortPrintINChIFlags ) |= ( *INCHI_basic_or_INCHI_reconnected == INCHI_BAS ) ? FLAG_SORT_PRINT_NO_NFIX_H_BAS :
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                              ( *io->pSortPrintINChIFlags ) |= ( *INCHI_basic_or_INCHI_reconnected == INCHI_BAS ) ? FLAG_SORT_PRINT_NO_NFIX_H_BAS :
  ------------------
  |  |  331|      0|#define FLAG_SORT_PRINT_NO_NFIX_H_BAS  4 /* no fixed H non-isotopic in the main InChI layer */
  ------------------
  |  Branch (3849:50): [True: 0, False: 0]
  ------------------
 3850|      0|                    FLAG_SORT_PRINT_NO_NFIX_H_REC;
  ------------------
  |  |  332|      0|#define FLAG_SORT_PRINT_NO_NFIX_H_REC  8 /* no fixed H non-isotopic in the reconnected InChI layer */
  ------------------
 3851|      0|            }
 3852|      0|            if (!io->bNonTautIsoIdentifierNotEmpty)
  ------------------
  |  Branch (3852:17): [True: 0, False: 0]
  ------------------
 3853|      0|            {
 3854|       |                /* Fixed-H layer is empty in the Identifier */
 3855|      0|                ( *io->pSortPrintINChIFlags ) |= ( *INCHI_basic_or_INCHI_reconnected == INCHI_BAS ) ? FLAG_SORT_PRINT_NO_IFIX_H_BAS :
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                              ( *io->pSortPrintINChIFlags ) |= ( *INCHI_basic_or_INCHI_reconnected == INCHI_BAS ) ? FLAG_SORT_PRINT_NO_IFIX_H_BAS :
  ------------------
  |  |  333|      0|#define FLAG_SORT_PRINT_NO_IFIX_H_BAS 16 /* no fixed H isotopic in the main InChI layer */
  ------------------
  |  Branch (3855:50): [True: 0, False: 0]
  ------------------
 3856|      0|                    FLAG_SORT_PRINT_NO_IFIX_H_REC;
  ------------------
  |  |  334|      0|#define FLAG_SORT_PRINT_NO_IFIX_H_REC 32 /* no fixed H isotopic in the the reconnected InChI layer */
  ------------------
 3857|      0|            }
 3858|      0|            io->bFhTag = 0;
 3859|      0|        }
 3860|     80|    }
 3861|       |
 3862|     80|    return 0;
 3863|     80|}
ichiprt1.c:OutputINCHI_PolymerLayer:
 3878|     80|{
 3879|     80|    int i, err = 0;
 3880|     80|    int nunits2 = 0;
 3881|     80|    int n_used_stars = 0;
 3882|     80|    int *cano_nums = NULL, *compnt_nums = NULL, *unum = NULL, *old_stars = NULL;
 3883|     80|    OAD_PolymerUnit *u = NULL;
 3884|     80|    OAD_PolymerUnit **units2 = NULL;
 3885|     80|    OAD_Polymer *p = NULL;
 3886|     80|    OAD_AtProps *aprops = NULL;
 3887|     80|    int nat,num_inp_bonds;
 3888|     80|    inp_ATOM    *at = NULL;
 3889|     80|    int is_inchi2inchi = 0;
 3890|       |
 3891|     80|    if (!orig_inp_data)
  ------------------
  |  Branch (3891:9): [True: 80, False: 0]
  ------------------
 3892|     80|    {
 3893|     80|        goto exit_function;
 3894|     80|    }
 3895|       |
 3896|      0|    at = orig_inp_data->at;
 3897|      0|    nat = orig_inp_data->num_inp_atoms;
 3898|      0|    num_inp_bonds = orig_inp_data->num_inp_bonds;
 3899|       |
 3900|       |    
 3901|      0|    if (pOrigStruct && !pOrigStruct->polymer)
  ------------------
  |  Branch (3901:9): [True: 0, False: 0]
  |  Branch (3901:24): [True: 0, False: 0]
  ------------------
 3902|      0|    {
 3903|      0|        return 0;
 3904|      0|    }
 3905|       |
 3906|      0|    p = pOrigStruct->polymer;
 3907|      0|    is_inchi2inchi = !pOrigStruct->szAtoms && !pOrigStruct->szBonds && !pOrigStruct->szCoord;
  ------------------
  |  Branch (3907:22): [True: 0, False: 0]
  |  Branch (3907:47): [True: 0, False: 0]
  |  Branch (3907:72): [True: 0, False: 0]
  ------------------
 3908|      0|    if (is_inchi2inchi)
  ------------------
  |  Branch (3908:9): [True: 0, False: 0]
  ------------------
 3909|      0|    {
 3910|      0|        err = NOT_YET_I2I_FOR_POLYMERS;
  ------------------
  |  |  510|      0|#define NOT_YET_I2I_FOR_POLYMERS 40
  ------------------
 3911|      0|        goto exit_function;
 3912|      0|    }
 3913|       |
 3914|       |    /*OAD_Polymer_DebugTrace( p );*/
 3915|       |
 3916|       |    /* Get canonical numbers and numbers-of-components for each original atom */
 3917|      0|    cano_nums = (int *) inchi_calloc( pOrigStruct->num_atoms + 1, sizeof( int ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 3918|      0|    if (!cano_nums)
  ------------------
  |  Branch (3918:9): [True: 0, False: 0]
  ------------------
 3919|      0|    {
 3920|      0|        err = 1;
 3921|      0|        goto exit_function;
 3922|      0|    }
 3923|      0|    compnt_nums = (int *) inchi_calloc( pOrigStruct->num_atoms + 1, sizeof( int ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 3924|      0|    if (!compnt_nums)
  ------------------
  |  Branch (3924:9): [True: 0, False: 0]
  ------------------
 3925|      0|    {
 3926|      0|        err = 2;
 3927|      0|        goto exit_function;
 3928|      0|    }
 3929|      0|    err = InternallyGetCanoNumsAndComponentNums( pCG,
 3930|      0|                                                 strbuf,
 3931|      0|                                                 io,
 3932|      0|                                                 pOrigStruct->num_atoms,
 3933|      0|                                                 cano_nums,
 3934|      0|                                                 compnt_nums );
 3935|      0|    if (err != 0)
  ------------------
  |  Branch (3935:9): [True: 0, False: 0]
  ------------------
 3936|      0|    {
 3937|      0|        err = 3;
 3938|      0|        goto exit_function;
 3939|      0|    }
 3940|       |
 3941|       |
 3942|       |    /* Set atom properties for sorting */
 3943|      0|    aprops = (OAD_AtProps *) inchi_calloc( nat + 1, sizeof( OAD_AtProps ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 3944|       |    /* nat + 1: add extra element for possibe 1-based indexing */
 3945|      0|    if (!aprops)
  ------------------
  |  Branch (3945:9): [True: 0, False: 0]
  ------------------
 3946|      0|    {
 3947|      0|        return 0;
 3948|      0|    }
 3949|       |
 3950|       |    /* Note that aprops[] is in orig_atoms domain (0-based) and      */
 3951|       |    /* u (from units) are in cano_nums domain (1-based)              */
 3952|       |    /* Supply non-NULL cano_nums to adjust the domains (base will be adjusted at place) */
 3953|      0|    OAD_Polymer_SetAtProps( p, at, nat, &num_inp_bonds, aprops, cano_nums );
 3954|       |
 3955|       |
 3956|       |    /* Make a working copy of polymer units data: units2 is a copy        */
 3957|       |    /* of original polymer units (p->units) with atomic numbers changed    */
 3958|       |    /* to curr canonical ones; atoms in alists sorted; atoms in blists    */
 3959|       |    /* and blists themselves sorted                                     */
 3960|      0|    units2 = (OAD_PolymerUnit **) inchi_calloc( p->n, sizeof( OAD_PolymerUnit* ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 3961|       |
 3962|      0|    if (NULL == units2)
  ------------------
  |  Branch (3962:9): [True: 0, False: 0]
  ------------------
 3963|      0|    {
 3964|      0|        err = 3;
 3965|      0|        goto exit_function;
 3966|      0|    }
 3967|      0|    memset( units2, 0, sizeof( *units2 ) );
 3968|       |
 3969|      0|    old_stars = (int *) inchi_calloc( pOrigStruct->polymer->n_pzz, sizeof( int ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 3970|      0|    if (NULL == old_stars)
  ------------------
  |  Branch (3970:9): [True: 0, False: 0]
  ------------------
 3971|      0|    {
 3972|      0|        err = 3;
 3973|      0|        goto exit_function;
 3974|      0|    }
 3975|      0|    for (i = 0; i < pOrigStruct->polymer->n_pzz; i++)
  ------------------
  |  Branch (3975:17): [True: 0, False: 0]
  ------------------
 3976|      0|    {
 3977|      0|        old_stars[i] = pOrigStruct->polymer->pzz[i];
 3978|      0|    }
 3979|       |
 3980|       |
 3981|      0|    for (i = 0; i < p->n; i++)
  ------------------
  |  Branch (3981:17): [True: 0, False: 0]
  ------------------
 3982|      0|    {
 3983|      0|        units2[i] = OAD_PolymerUnit_CreateCopy( p->units[i] );
 3984|      0|        if (NULL == units2[i])
  ------------------
  |  Branch (3984:13): [True: 0, False: 0]
  ------------------
 3985|      0|        {
 3986|      0|            err = 4;
 3987|      0|            goto exit_function;
 3988|      0|        }
 3989|      0|        nunits2 = i + 1;
 3990|      0|    }
 3991|       |
 3992|       |    /* unum contains numbers of units (0..p->n) as they go  */
 3993|       |    /* when sorted by alist's in lexicographic order        */
 3994|      0|    unum = (int *) inchi_calloc( p->n, sizeof( int ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 3995|      0|    if (NULL == unum)
  ------------------
  |  Branch (3995:9): [True: 0, False: 0]
  ------------------
 3996|      0|    {
 3997|      0|        err = 4;
 3998|      0|        goto exit_function;
 3999|      0|    }
 4000|       |
 4001|       |
 4002|      0|    err = OAD_Polymer_PrepareWorkingSet( p, cano_nums, compnt_nums, units2, unum );
 4003|       |
 4004|      0|    if (err != 0)
  ------------------
  |  Branch (4004:9): [True: 0, False: 0]
  ------------------
 4005|      0|    {
 4006|      0|        err = 5;
 4007|      0|        goto exit_function;
 4008|      0|    }
 4009|       |
 4010|       |    /* Prepare polymer substring */
 4011|       |
 4012|       |    /* Mark layer beginning */
 4013|      0|    inchi_strbuf_printf( strbuf, "%s", "/z" );
 4014|       |
 4015|       |    /* Print polymer units data */
 4016|      0|    n_used_stars = 0;
 4017|      0|    for (i = 0; i < p->n; i++)
  ------------------
  |  Branch (4017:17): [True: 0, False: 0]
  ------------------
 4018|      0|    {
 4019|       |        /* For each unit u ... */
 4020|      0|        u = units2[unum[i]];
 4021|       |
 4022|      0|        err = OutputINCHI_PolymerLayer_SingleUnit(  u, 
 4023|      0|                                                    io->bPolymers,
 4024|      0|                                                    pOrigStruct->polymer->n_pzz, 
 4025|      0|                                                    &n_used_stars, aprops,
 4026|      0|                                                    cano_nums, 
 4027|      0|                                                    orig_inp_data, 
 4028|      0|                                                    pOrigStruct, strbuf );
 4029|      0|        if (err)
  ------------------
  |  Branch (4029:13): [True: 0, False: 0]
  ------------------
 4030|      0|        {
 4031|      0|            goto exit_function;
 4032|      0|        }
 4033|      0|        if (i < p->n - 1)
  ------------------
  |  Branch (4033:13): [True: 0, False: 0]
  ------------------
 4034|      0|        {
 4035|      0|            inchi_strbuf_printf( strbuf, ";" );
 4036|      0|        }
 4037|      0|    }
 4038|      0|    inchi_ios_print_nodisplay( out_file, "%s%s", strbuf->pStr, pLF );
 4039|       |
 4040|     80|exit_function:
 4041|     80|    if (cano_nums)
  ------------------
  |  Branch (4041:9): [True: 0, False: 80]
  ------------------
 4042|      0|    {
 4043|      0|        inchi_free( cano_nums );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4044|      0|    }
 4045|     80|    if (compnt_nums)
  ------------------
  |  Branch (4045:9): [True: 0, False: 80]
  ------------------
 4046|      0|    {
 4047|      0|        inchi_free( compnt_nums );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4048|      0|    }
 4049|     80|    if (aprops)
  ------------------
  |  Branch (4049:9): [True: 0, False: 80]
  ------------------
 4050|      0|    {
 4051|      0|        inchi_free( aprops );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4052|      0|    }
 4053|     80|    if (unum)
  ------------------
  |  Branch (4053:9): [True: 0, False: 80]
  ------------------
 4054|      0|    {
 4055|      0|        inchi_free( unum );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4056|      0|    }
 4057|     80|    if (units2)
  ------------------
  |  Branch (4057:9): [True: 0, False: 80]
  ------------------
 4058|      0|    {
 4059|      0|        for (i = 0; i < nunits2; i++)
  ------------------
  |  Branch (4059:21): [True: 0, False: 0]
  ------------------
 4060|      0|        {
 4061|      0|            OAD_PolymerUnit_Free( units2[i] );
 4062|      0|        }
 4063|      0|        inchi_free( units2 );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4064|      0|    }
 4065|     80|    if (old_stars)
  ------------------
  |  Branch (4065:9): [True: 0, False: 80]
  ------------------
 4066|      0|    {
 4067|      0|        for (i = 0; i < pOrigStruct->polymer->n_pzz; i++)
  ------------------
  |  Branch (4067:21): [True: 0, False: 0]
  ------------------
 4068|      0|            pOrigStruct->polymer->pzz[i] = old_stars[i];
 4069|      0|        inchi_free( old_stars );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4070|      0|    }
 4071|       |
 4072|     80|    return err;
 4073|      0|}

Eql_INChI_Isotopic:
  197|     14|{
  198|     14|    int eq = i1
  ------------------
  |  Branch (198:14): [True: 0, False: 14]
  ------------------
  199|     14|            && i2
  ------------------
  |  Branch (199:16): [True: 0, False: 0]
  ------------------
  200|     14|            && !i1->bDeleted
  ------------------
  |  Branch (200:16): [True: 0, False: 0]
  ------------------
  201|     14|            && !i2->bDeleted
  ------------------
  |  Branch (201:16): [True: 0, False: 0]
  ------------------
  202|     14|            && ( i1->nNumberOfIsotopicAtoms > 0 || i1->nNumberOfIsotopicTGroups > 0 )
  ------------------
  |  Branch (202:18): [True: 0, False: 0]
  |  Branch (202:52): [True: 0, False: 0]
  ------------------
  203|     14|            && i1->nNumberOfIsotopicAtoms == i2->nNumberOfIsotopicAtoms
  ------------------
  |  Branch (203:16): [True: 0, False: 0]
  ------------------
  204|     14|            && i1->nNumberOfIsotopicTGroups == i2->nNumberOfIsotopicTGroups
  ------------------
  |  Branch (204:16): [True: 0, False: 0]
  ------------------
  205|     14|            && ( !i1->nNumberOfIsotopicAtoms ||
  ------------------
  |  Branch (205:18): [True: 0, False: 0]
  ------------------
  206|      0|                i1->IsotopicAtom && i2->IsotopicAtom &&
  ------------------
  |  Branch (206:17): [True: 0, False: 0]
  |  Branch (206:37): [True: 0, False: 0]
  ------------------
  207|      0|                !memcmp( i1->IsotopicAtom, i2->IsotopicAtom,
  ------------------
  |  Branch (207:17): [True: 0, False: 0]
  ------------------
  208|      0|                        i1->nNumberOfIsotopicAtoms * sizeof( i1->IsotopicAtom[0] ) ) )
  209|     14|            && ( !i1->nNumberOfIsotopicTGroups ||
  ------------------
  |  Branch (209:18): [True: 0, False: 0]
  ------------------
  210|      0|                i1->IsotopicTGroup && i2->IsotopicTGroup &&
  ------------------
  |  Branch (210:17): [True: 0, False: 0]
  |  Branch (210:39): [True: 0, False: 0]
  ------------------
  211|      0|                !memcmp( i1->IsotopicTGroup, i2->IsotopicTGroup,
  ------------------
  |  Branch (211:17): [True: 0, False: 0]
  ------------------
  212|      0|                    i1->nNumberOfIsotopicTGroups * sizeof( i1->IsotopicAtom[0] ) )
  213|      0|            );
  214|       |
  215|     14|    return eq;
  216|     14|}
MakeMult:
  429|    227|{
  430|    227|    char szValue[2048];
  431|    227|    int  len = 0, len_delim, n;
  432|       |
  433|    227|    if (mult == 1 || *bOverflow)
  ------------------
  |  Branch (433:9): [True: 156, False: 71]
  |  Branch (433:22): [True: 0, False: 71]
  ------------------
  434|    156|    {
  435|    156|        return 0;
  436|    156|    }
  437|     71|    if (nCtMode & CT_MODE_ABC_NUMBERS)
  ------------------
  |  |   54|     71|#define CT_MODE_ABC_NUMBERS       2
  ------------------
  |  Branch (437:9): [True: 0, False: 71]
  ------------------
  438|      0|    {
  439|      0|        len += MakeAbcNumber( szValue, ( int )sizeof( szValue ), NULL, mult );
  440|      0|    }
  441|     71|    else
  442|     71|    {
  443|     71|        len += MakeDecNumber( szValue, ( int )sizeof( szValue ), NULL, mult );
  444|     71|    }
  445|     71|    len_delim = (int) strlen( szTailingDelim );
  446|       |
  447|     71|    if (len + len_delim < ( int )sizeof( szValue ))
  ------------------
  |  Branch (447:9): [True: 71, False: 0]
  ------------------
  448|     71|    {
  449|     71|        strcpy( szValue + len, szTailingDelim );
  450|       |
  451|     71|        n = inchi_strbuf_printf( buf, "%s", szValue );
  452|     71|        if (-1 == n) *bOverflow |= 1;
  ------------------
  |  Branch (452:13): [True: 0, False: 71]
  ------------------
  453|     71|        return n;
  454|       |        /*
  455|       |        len += len_delim;
  456|       |        if ( len < nLen_szLinearCT )
  457|       |        {
  458|       |            strcpy( szLinearCT, szValue );
  459|       |            return len;
  460|       |        }*/
  461|     71|    }
  462|       |
  463|      0|    *bOverflow |= 1;
  464|       |
  465|      0|    return 0;
  466|     71|}
MakeDelim:
  473|  1.22k|{
  474|  1.22k|    int n;
  475|  1.22k|    if (!szTailingDelim || !*szTailingDelim || *bOverflow)
  ------------------
  |  Branch (475:9): [True: 0, False: 1.22k]
  |  Branch (475:28): [True: 0, False: 1.22k]
  |  Branch (475:48): [True: 0, False: 1.22k]
  ------------------
  476|      0|    {
  477|      0|        return 0;
  478|      0|    }
  479|       |
  480|  1.22k|    n = inchi_strbuf_printf( buf, szTailingDelim );
  481|  1.22k|    if (-1 == n)
  ------------------
  |  Branch (481:9): [True: 0, False: 1.22k]
  ------------------
  482|      0|    {
  483|      0|        *bOverflow |= 1;
  484|      0|    }
  485|       |
  486|  1.22k|    return n;
  487|       |    /*
  488|       |    len_delim = (int) strlen(szTailingDelim);
  489|       |    if ( len_delim < nLen_szLinearCT ) {
  490|       |    strcpy( szLinearCT, szTailingDelim );
  491|       |    return len_delim;
  492|       |    }
  493|       |    *bOverflow |= 1;
  494|       |    return 0;
  495|       |    */
  496|  1.22k|}
MakeCtStringNew:
  554|      3|{
  555|       |    /*  produce output string; */
  556|      3|    int nUsedLength0 = 0, nLen = 0, len, i, bOvfl = *bOverflow;
  557|      3|    char szValue[2048];
  558|      3|    int   nValue, nDelim, num_H;
  559|      3|    AT_NUMB *nDfsOrderCT = NULL;
  560|      3|    int      bNoNum_H = ( NULL == nNum_H );
  561|      3|    int      nNumRingClosures;
  562|      3|    int      bAbcNumbers = ( 0 != ( nCtMode & CT_MODE_ABC_NUMBERS ) );
  ------------------
  |  |   54|      3|#define CT_MODE_ABC_NUMBERS       2
  ------------------
  563|      3|    int      bPredecessors = ( 0 != ( nCtMode & CT_MODE_PREDECESSORS ) );
  ------------------
  |  |   56|      3|#define CT_MODE_PREDECESSORS      8
  ------------------
  564|      3|    int      bCountRingClosures = bAbcNumbers && bPredecessors && ( nCtMode & CT_MODE_ABC_NUM_CLOSURES );
  ------------------
  |  |   58|      0|#define CT_MODE_ABC_NUM_CLOSURES 32 /* in CT_MODE_ABC_NUMBERS output AB1AC2AB instead of AB-AC-A-B */
  ------------------
  |  Branch (564:35): [True: 0, False: 3]
  |  Branch (564:50): [True: 0, False: 0]
  |  Branch (564:67): [True: 0, False: 0]
  ------------------
  565|       |
  566|      3|    if (nLenCT <= 1)
  ------------------
  |  Branch (566:9): [True: 0, False: 3]
  ------------------
  567|      0|    {
  568|      0|        return 0;  /*  no atoms or a single atom: no connection table */
  569|      0|    }
  570|       |
  571|      3|    nUsedLength0 = strbuf->nUsedLength;
  572|       |
  573|       |    /*  make array containing connection string data */
  574|      3|    if (!( nDfsOrderCT = GetDfsOrder4CT( pCG, LinearCT, nLenCT,
  ------------------
  |  Branch (574:9): [True: 0, False: 3]
  ------------------
  575|      3|        nNum_H, num_atoms, nCtMode ) ))
  576|      0|    {
  577|      0|        ( *bOverflow )++;
  578|      0|        return 0;
  579|      0|    }
  580|       |
  581|       |    /*  add connection table string */
  582|      3|    if (!bOvfl && bAddDelim)
  ------------------
  |  Branch (582:9): [True: 3, False: 0]
  |  Branch (582:19): [True: 0, False: 3]
  ------------------
  583|      0|    {
  584|      0|        inchi_strbuf_printf( strbuf, "," );
  585|      0|    }
  586|       |
  587|      3|    if (!bOvfl)
  ------------------
  |  Branch (587:9): [True: 3, False: 0]
  ------------------
  588|      3|    {
  589|      3|        nNumRingClosures = 0;
  590|     18|        for (i = 0; nDfsOrderCT[i]/* && nLen < nLen_szLinearCT*/; i += 3)
  ------------------
  |  Branch (590:21): [True: 15, False: 3]
  ------------------
  591|     15|        {
  592|     15|            nValue = ( nDfsOrderCT[i] > MAX_ATOMS ) ? 0 : nDfsOrderCT[i];
  ------------------
  |  |   43|     15|#define MAX_ATOMS  32766
  ------------------
  |  Branch (592:22): [True: 0, False: 15]
  ------------------
  593|     15|            num_H = nDfsOrderCT[i + 1] ? nDfsOrderCT[i + 1] - 16 : 0;
  ------------------
  |  Branch (593:21): [True: 0, False: 15]
  ------------------
  594|     15|            nDelim = nDfsOrderCT[i + 2];
  595|     15|            len = 0;
  596|       |            /*  delimiter */
  597|     15|            if (bPredecessors)
  ------------------
  |  Branch (597:17): [True: 0, False: 15]
  ------------------
  598|      0|            {
  599|      0|                if (bCountRingClosures)
  ------------------
  |  Branch (599:21): [True: 0, False: 0]
  ------------------
  600|      0|                {
  601|      0|                    if (nDelim == '-' && i > 3 && bNoNum_H)
  ------------------
  |  Branch (601:25): [True: 0, False: 0]
  |  Branch (601:42): [True: 0, False: 0]
  |  Branch (601:51): [True: 0, False: 0]
  ------------------
  602|      0|                    {
  603|      0|                        if (!nNumRingClosures)
  ------------------
  |  Branch (603:29): [True: 0, False: 0]
  ------------------
  604|      0|                        {
  605|      0|                            int j;
  606|      0|                            for (j = i; nDfsOrderCT[j] && '-' == nDfsOrderCT[j + 2]; j += 3)
  ------------------
  |  Branch (606:41): [True: 0, False: 0]
  |  Branch (606:59): [True: 0, False: 0]
  ------------------
  607|      0|                            {
  608|      0|                                nNumRingClosures++;
  609|      0|                            }
  610|      0|                            if (nNumRingClosures)
  ------------------
  |  Branch (610:33): [True: 0, False: 0]
  ------------------
  611|      0|                            {
  612|      0|                                len += MakeDecNumber( szValue + len, ( int )sizeof( szValue ) - len, NULL, nNumRingClosures );
  613|      0|                            }
  614|      0|                            nNumRingClosures--;
  615|      0|                        }
  616|      0|                        else
  617|      0|                        {
  618|      0|                            nNumRingClosures--;
  619|      0|                        }
  620|      0|                    }
  621|      0|                    else
  622|      0|                    {
  623|      0|                        nNumRingClosures = 0;
  624|      0|                    }
  625|      0|                }
  626|      0|                else if (nDelim && !( bAbcNumbers && nDelim == ',' ))
  ------------------
  |  Branch (626:26): [True: 0, False: 0]
  |  Branch (626:39): [True: 0, False: 0]
  |  Branch (626:54): [True: 0, False: 0]
  ------------------
  627|      0|                {
  628|      0|                    if (nNum_H || i > 3)
  ------------------
  |  Branch (628:25): [True: 0, False: 0]
  |  Branch (628:35): [True: 0, False: 0]
  ------------------
  629|      0|                    {
  630|      0|                        szValue[len++] = nDelim;
  631|      0|                    }
  632|      0|                }
  633|      0|            }
  634|     15|            else
  635|     15|            {
  636|     15|                if (nDelim && !( bAbcNumbers && nDelim == '-' ))
  ------------------
  |  Branch (636:21): [True: 12, False: 3]
  |  Branch (636:34): [True: 0, False: 12]
  |  Branch (636:49): [True: 0, False: 0]
  ------------------
  637|     12|                {
  638|     12|                    szValue[len++] = nDelim;
  639|     12|                }
  640|     15|            }
  641|     15|            if (bAbcNumbers)
  ------------------
  |  Branch (641:17): [True: 0, False: 15]
  ------------------
  642|      0|            {
  643|      0|                if (nValue || i)
  ------------------
  |  Branch (643:21): [True: 0, False: 0]
  |  Branch (643:31): [True: 0, False: 0]
  ------------------
  644|      0|                {
  645|       |                    /* the 1st value may be zero in case of presdecessor list */
  646|      0|                    len += MakeAbcNumber( szValue + len, ( int )sizeof( szValue ) - len, NULL, nValue );
  647|      0|                }
  648|      0|                if (num_H)
  ------------------
  |  Branch (648:21): [True: 0, False: 0]
  ------------------
  649|      0|                {
  650|      0|                    len += MakeDecNumber( szValue + len, ( int )sizeof( szValue ) - len, NULL, num_H );
  651|      0|                }
  652|      0|            }
  653|     15|            else
  654|     15|            {
  655|     15|                if (nValue || i)
  ------------------
  |  Branch (655:21): [True: 15, False: 0]
  |  Branch (655:31): [True: 0, False: 0]
  ------------------
  656|     15|                {
  657|       |                    /* the 1st value may be zero in case of presdecessor list */
  658|     15|                    len += MakeDecNumber( szValue + len, ( int )sizeof( szValue ) - len, NULL, nValue );
  659|     15|                }
  660|     15|                if (num_H)
  ------------------
  |  Branch (660:21): [True: 0, False: 15]
  ------------------
  661|      0|                {
  662|      0|                    szValue[len] = 'H';
  663|      0|                    len++;
  664|      0|                    if (num_H > 1)
  ------------------
  |  Branch (664:25): [True: 0, False: 0]
  ------------------
  665|      0|                    {
  666|      0|                        len += MakeDecNumber( szValue + len, ( int )sizeof( szValue ) - len, NULL, num_H );
  667|      0|                    }
  668|      0|                }
  669|     15|            }
  670|       |
  671|     15|            if (len > 0)
  ------------------
  |  Branch (671:17): [True: 15, False: 0]
  ------------------
  672|     15|            {
  673|     15|                inchi_strbuf_printf( strbuf, "%s", szValue );
  674|     15|            }
  675|     15|        }
  676|      3|    }
  677|       |
  678|      3|    *bOverflow |= bOvfl;
  679|      3|    if (nDfsOrderCT)
  ------------------
  |  Branch (679:9): [True: 3, False: 0]
  ------------------
  680|      3|    {
  681|      3|        inchi_free( nDfsOrderCT );
  ------------------
  |  | 1136|      3|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 3, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  682|      3|    }
  683|       |
  684|      3|    nLen = strbuf->nUsedLength - nUsedLength0;
  685|       |
  686|      3|    return nLen;
  687|      3|}
MakeHString:
  789|     39|{
  790|     39|#define INIT_MIN_NUM_H (-4)
  791|     39|#define INIT_MAX_NUM_H 16
  792|     39|#define INIT_LEN_NUM_H (INIT_MAX_NUM_H - INIT_MIN_NUM_H + 1)
  793|       |
  794|       |    /*  produce output string; */
  795|     39|    int nUsedLength0 = 0, nLen = 0, len, i, iFirst, nVal, bOvfl = *bOverflow;
  796|     39|    char szValue[2048];
  797|     39|    const char *pH;
  798|     39|    int  bNext = 0;
  799|       |
  800|     39|    nUsedLength0 = strbuf->nUsedLength;
  801|       |
  802|       |    /*  add connection table string */
  803|     39|    if (!( nCtMode & CT_MODE_ABC_NUMBERS ) && !bOvfl && bAddDelim)
  ------------------
  |  |   54|     39|#define CT_MODE_ABC_NUMBERS       2
  ------------------
  |  Branch (803:9): [True: 39, False: 0]
  |  Branch (803:47): [True: 39, False: 0]
  |  Branch (803:57): [True: 0, False: 39]
  ------------------
  804|      0|    {
  805|      0|        inchi_strbuf_printf( strbuf, "," );
  806|       |                            /*if ( nLen_szLinearCT > 1 ) {
  807|       |                                strcpy( szLinearCT, "," );
  808|       |                                nLen ++;
  809|       |                                } else {
  810|       |                                    bOvfl = 1;
  811|       |                            }*/
  812|      0|    }
  813|     39|    if (!bOvfl && 0 < nLenCT && LinearCT)
  ------------------
  |  Branch (813:9): [True: 39, False: 0]
  |  Branch (813:19): [True: 39, False: 0]
  |  Branch (813:33): [True: 39, False: 0]
  ------------------
  814|     39|    {
  815|     39|        if (nCtMode & CT_MODE_EQL_H_TOGETHER)
  ------------------
  |  |   57|     39|#define CT_MODE_EQL_H_TOGETHER   16
  ------------------
  |  Branch (815:13): [True: 39, False: 0]
  ------------------
  816|     39|        {
  817|     39|            int  curMinH = INIT_MIN_NUM_H;
  ------------------
  |  |  790|     39|#define INIT_MIN_NUM_H (-4)
  ------------------
  818|     39|            int  curMaxH = INIT_MAX_NUM_H;
  ------------------
  |  |  791|     39|#define INIT_MAX_NUM_H 16
  ------------------
  819|     39|            int  curLenH = INIT_LEN_NUM_H;
  ------------------
  |  |  792|     39|#define INIT_LEN_NUM_H (INIT_MAX_NUM_H - INIT_MIN_NUM_H + 1)
  |  |  ------------------
  |  |  |  |  791|     39|#define INIT_MAX_NUM_H 16
  |  |  ------------------
  |  |               #define INIT_LEN_NUM_H (INIT_MAX_NUM_H - INIT_MIN_NUM_H + 1)
  |  |  ------------------
  |  |  |  |  790|     39|#define INIT_MIN_NUM_H (-4)
  |  |  ------------------
  ------------------
  820|     39|            int  nInitNumH[INIT_LEN_NUM_H];
  821|     39|            int *nNumH = nInitNumH;
  822|     39|            int  numAt, curNumH;
  823|     39|            int      j, bOutOfRange, tot_num_no_H;
  824|       |            /* count atoms H */
  825|     39|            do
  826|     39|            {
  827|     39|                bOutOfRange = 0;
  828|     39|                tot_num_no_H = 0; /* number of atoms that have no H */
  829|     39|                memset( nNumH, 0, curLenH * sizeof( nNumH[0] ) );
  830|   649k|                for (i = 0; i < nLenCT; i++)
  ------------------
  |  Branch (830:29): [True: 649k, False: 39]
  ------------------
  831|   649k|                {
  832|   649k|                    curNumH = LinearCT[i];
  833|   649k|                    if (curNumH < curMinH)
  ------------------
  |  Branch (833:25): [True: 0, False: 649k]
  ------------------
  834|      0|                    {
  835|      0|                        curMinH = curNumH;
  836|      0|                        bOutOfRange++;
  837|      0|                    }
  838|   649k|                    else
  839|   649k|                    {
  840|   649k|                        if (curNumH > curMaxH)
  ------------------
  |  Branch (840:29): [True: 0, False: 649k]
  ------------------
  841|      0|                        {
  842|      0|                            curMaxH = curNumH;
  843|      0|                            bOutOfRange++;
  844|      0|                        }
  845|   649k|                        else
  846|   649k|                            if (!bOutOfRange)
  ------------------
  |  Branch (846:33): [True: 649k, False: 0]
  ------------------
  847|   649k|                            {
  848|   649k|                                nNumH[curNumH - curMinH] ++;
  849|   649k|                            }
  850|   649k|                    }
  851|   649k|                    tot_num_no_H += !curNumH;
  852|   649k|                }
  853|     39|                if (tot_num_no_H == nLenCT)
  ------------------
  |  Branch (853:21): [True: 39, False: 0]
  ------------------
  854|     39|                {
  855|     39|                    return nLen; /* empty string */
  856|     39|                }
  857|      0|                if (bOutOfRange)
  ------------------
  |  Branch (857:21): [True: 0, False: 0]
  ------------------
  858|      0|                {
  859|       |                    /* for debug only */
  860|      0|                    if (nNumH != nInitNumH)
  ------------------
  |  Branch (860:25): [True: 0, False: 0]
  ------------------
  861|      0|                    {
  862|      0|                        *bOverflow |= 1;
  863|      0|                        inchi_free( nNumH );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  864|      0|                        return nLen;
  865|      0|                    }
  866|       |                    /* end debug */
  867|      0|                    curLenH = curMaxH - curMinH + 1;
  868|      0|                    nNumH = (int*) inchi_malloc( curLenH * sizeof( nNumH[0] ) );
  ------------------
  |  | 1130|      0|#define inchi_malloc   malloc
  ------------------
  869|      0|                    if (!nNumH)
  ------------------
  |  Branch (869:25): [True: 0, False: 0]
  ------------------
  870|      0|                    {
  871|      0|                        *bOverflow |= 1;
  872|      0|                        return nLen;
  873|      0|                    }
  874|      0|                }
  875|      0|            }
  876|     39|            while (bOutOfRange); /* the loop may be executed 1 or 2 times only */
  ------------------
  |  Branch (876:20): [True: 0, False: 0]
  ------------------
  877|       |
  878|      0|            for (curNumH = curMinH; curNumH <= curMaxH; curNumH++)
  ------------------
  |  Branch (878:37): [True: 0, False: 0]
  ------------------
  879|      0|            {
  880|      0|                numAt = nNumH[curNumH - curMinH]; /* number of atoms that have curNumH atoms H */
  881|      0|                if (!numAt || !curNumH)
  ------------------
  |  Branch (881:21): [True: 0, False: 0]
  |  Branch (881:31): [True: 0, False: 0]
  ------------------
  882|      0|                {
  883|      0|                    continue; /* no atom has this number of H or number of H = 0 */
  884|      0|                }
  885|      0|                j = 0;
  886|      0|                while (j < nLenCT && numAt)
  ------------------
  |  Branch (886:24): [True: 0, False: 0]
  |  Branch (886:38): [True: 0, False: 0]
  ------------------
  887|      0|                {
  888|      0|                    if (curNumH == LinearCT[j])
  ------------------
  |  Branch (888:25): [True: 0, False: 0]
  ------------------
  889|      0|                    {
  890|      0|                        iFirst = ++j;
  891|      0|                        numAt--;
  892|      0|                        for (; j < nLenCT && curNumH == LinearCT[j] && numAt; j++)
  ------------------
  |  Branch (892:32): [True: 0, False: 0]
  |  Branch (892:46): [True: 0, False: 0]
  |  Branch (892:72): [True: 0, False: 0]
  ------------------
  893|      0|                        {
  894|      0|                            numAt--;
  895|      0|                        }
  896|      0|                        if (nCtMode & CT_MODE_ABC_NUMBERS)
  ------------------
  |  |   54|      0|#define CT_MODE_ABC_NUMBERS       2
  ------------------
  |  Branch (896:29): [True: 0, False: 0]
  ------------------
  897|      0|                        {
  898|      0|                            len = MakeAbcNumber( szValue, ( int )sizeof( szValue ), NULL, iFirst );
  899|      0|                        }
  900|      0|                        else
  901|      0|                        {
  902|      0|                            len = MakeDecNumber( szValue, ( int )sizeof( szValue ), bNext ? ITEM_DELIMETER : NULL, iFirst );
  ------------------
  |  |   45|      0|#define ITEM_DELIMETER    ","
  ------------------
  |  Branch (902:85): [True: 0, False: 0]
  ------------------
  903|      0|                            bNext++; /* add a delimiter (comma) before all except the first */
  904|      0|                        }
  905|      0|                        if (iFirst < j)
  ------------------
  |  Branch (905:29): [True: 0, False: 0]
  ------------------
  906|      0|                        {
  907|       |                            /* output last canonical number */
  908|      0|                            if (nCtMode & CT_MODE_ABC_NUMBERS)
  ------------------
  |  |   54|      0|#define CT_MODE_ABC_NUMBERS       2
  ------------------
  |  Branch (908:33): [True: 0, False: 0]
  ------------------
  909|      0|                            {
  910|      0|                                len += MakeAbcNumber( szValue + len, ( int )sizeof( szValue ), NULL, j );
  911|      0|                            }
  912|      0|                            else
  913|      0|                            {
  914|      0|                                len += MakeDecNumber( szValue + len, ( int )sizeof( szValue ) - len, "-", j );
  915|      0|                            }
  916|      0|                        }
  917|      0|                        if (!numAt || ( nCtMode & CT_MODE_ABC_NUMBERS ))
  ------------------
  |  |   54|      0|#define CT_MODE_ABC_NUMBERS       2
  ------------------
  |  Branch (917:29): [True: 0, False: 0]
  |  Branch (917:39): [True: 0, False: 0]
  ------------------
  918|      0|                        {
  919|       |                            /* add number of H */
  920|       |                            /* output number of H */
  921|      0|                            nVal = curNumH;
  922|      0|                            if (nCtMode & CT_MODE_ABC_NUMBERS)
  ------------------
  |  |   54|      0|#define CT_MODE_ABC_NUMBERS       2
  ------------------
  |  Branch (922:33): [True: 0, False: 0]
  ------------------
  923|      0|                            {
  924|      0|                                len += MakeDecNumber( szValue + len, ( int )sizeof( szValue ) - len, NULL, nVal );
  925|      0|                            }
  926|      0|                            else
  927|      0|                            {
  928|      0|                                pH = nVal > 0 ? "H" : "h";
  ------------------
  |  Branch (928:38): [True: 0, False: 0]
  ------------------
  929|      0|                                nVal = abs( nVal );
  930|      0|                                if (nVal > 1)
  ------------------
  |  Branch (930:37): [True: 0, False: 0]
  ------------------
  931|      0|                                {
  932|      0|                                    len += MakeDecNumber( szValue + len, ( int )sizeof( szValue ) - len, pH, nVal );
  933|      0|                                }
  934|      0|                                else
  935|      0|                                {
  936|      0|                                    strcpy( szValue + len, pH );
  937|      0|                                    len++;
  938|      0|                                }
  939|      0|                            }
  940|      0|                        }
  941|       |                        /* add to the output */
  942|      0|                        if (len > 0)
  ------------------
  |  Branch (942:29): [True: 0, False: 0]
  ------------------
  943|      0|                        {
  944|      0|                            inchi_strbuf_printf( strbuf, "%-s", szValue );
  945|      0|                            bNext++;
  946|      0|                        }
  947|       |                        /*
  948|       |                        if ( 0 <= len && nLen+len < nLen_szLinearCT ) {
  949|       |                            if ( len ) {
  950|       |                                strcpy( szLinearCT+nLen, szValue );
  951|       |                                nLen += len;
  952|       |                                bNext ++;
  953|       |                            }
  954|       |                        } else {
  955|       |                            bOvfl = 1;
  956|       |                            break;
  957|       |                        }*/
  958|      0|                    }
  959|      0|                    else
  960|      0|                    {
  961|      0|                        j++;
  962|      0|                    }
  963|      0|                }
  964|      0|            }
  965|      0|            if (nNumH != nInitNumH)
  ------------------
  |  Branch (965:17): [True: 0, False: 0]
  ------------------
  966|      0|            {
  967|      0|                inchi_free( nNumH );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  968|      0|            }
  969|      0|        }
  970|      0|        else
  971|      0|        {
  972|      0|            iFirst = 0;
  973|      0|            for (i = iFirst + 1; i <= nLenCT/* && nLen < nLen_szLinearCT*/; i++)
  ------------------
  |  Branch (973:34): [True: 0, False: 0]
  ------------------
  974|      0|            {
  975|      0|                if (i < nLenCT && LinearCT[i] == LinearCT[iFirst])
  ------------------
  |  Branch (975:21): [True: 0, False: 0]
  |  Branch (975:35): [True: 0, False: 0]
  ------------------
  976|      0|                {
  977|      0|                    continue;
  978|      0|                }
  979|       |                /* output identical values located at i = iFirst..i-1 */
  980|      0|                if (LinearCT[iFirst])
  ------------------
  |  Branch (980:21): [True: 0, False: 0]
  ------------------
  981|      0|                { /* output only non-zero values */
  982|       |                  /* first canonical number */
  983|      0|                    nVal = LinearCT[iFirst];
  984|      0|                    iFirst++;
  985|      0|                    if (nCtMode & CT_MODE_ABC_NUMBERS)
  ------------------
  |  |   54|      0|#define CT_MODE_ABC_NUMBERS       2
  ------------------
  |  Branch (985:25): [True: 0, False: 0]
  ------------------
  986|      0|                    {
  987|      0|                        len = MakeAbcNumber( szValue, ( int )sizeof( szValue ), NULL, iFirst );
  988|      0|                    }
  989|      0|                    else
  990|      0|                    {
  991|      0|                        len = MakeDecNumber( szValue, ( int )sizeof( szValue ), bNext ? ITEM_DELIMETER : NULL, iFirst );
  ------------------
  |  |   45|      0|#define ITEM_DELIMETER    ","
  ------------------
  |  Branch (991:81): [True: 0, False: 0]
  ------------------
  992|      0|                    }
  993|      0|                    if (iFirst < i)
  ------------------
  |  Branch (993:25): [True: 0, False: 0]
  ------------------
  994|      0|                    {
  995|       |                        /* output last canonical number */
  996|      0|                        if (nCtMode & CT_MODE_ABC_NUMBERS)
  ------------------
  |  |   54|      0|#define CT_MODE_ABC_NUMBERS       2
  ------------------
  |  Branch (996:29): [True: 0, False: 0]
  ------------------
  997|      0|                        {
  998|      0|                            len += MakeAbcNumber( szValue + len, ( int )sizeof( szValue ), NULL, i );
  999|      0|                        }
 1000|      0|                        else
 1001|      0|                        {
 1002|      0|                            len += MakeDecNumber( szValue + len, ( int )sizeof( szValue ) - len, "-", i );
 1003|      0|                        }
 1004|      0|                    }
 1005|       |                    /* output number of H */
 1006|      0|                    if (nCtMode & CT_MODE_ABC_NUMBERS)
  ------------------
  |  |   54|      0|#define CT_MODE_ABC_NUMBERS       2
  ------------------
  |  Branch (1006:25): [True: 0, False: 0]
  ------------------
 1007|      0|                    {
 1008|      0|                        len += MakeDecNumber( szValue + len, ( int )sizeof( szValue ) - len, NULL, nVal );
 1009|      0|                    }
 1010|      0|                    else
 1011|      0|                    {
 1012|      0|                        pH = nVal > 0 ? "H" : "h";
  ------------------
  |  Branch (1012:30): [True: 0, False: 0]
  ------------------
 1013|      0|                        nVal = abs( nVal );
 1014|      0|                        if (nVal > 1)
  ------------------
  |  Branch (1014:29): [True: 0, False: 0]
  ------------------
 1015|      0|                        {
 1016|      0|                            len += MakeDecNumber( szValue + len, ( int )sizeof( szValue ) - len, pH, nVal );
 1017|      0|                        }
 1018|      0|                        else
 1019|      0|                        {
 1020|      0|                            strcpy( szValue + len, pH );
 1021|      0|                            len++;
 1022|      0|                        }
 1023|      0|                    }
 1024|      0|                    if (0 <= len/* && nLen+len < nLen_szLinearCT*/)
  ------------------
  |  Branch (1024:25): [True: 0, False: 0]
  ------------------
 1025|      0|                    {
 1026|      0|                        if (len)
  ------------------
  |  Branch (1026:29): [True: 0, False: 0]
  ------------------
 1027|      0|                        {
 1028|      0|                            inchi_strbuf_printf( strbuf, "%-s", szValue );
 1029|       |                                        /*strcpy( szLinearCT+nLen, szValue );
 1030|       |                                        nLen += len;*/
 1031|      0|                            bNext++;
 1032|      0|                        }
 1033|      0|                    }
 1034|      0|                    else
 1035|      0|                    {
 1036|      0|                        bOvfl = 1;
 1037|      0|                        break;
 1038|      0|                    }
 1039|      0|                }
 1040|      0|                iFirst = i;
 1041|      0|            }
 1042|      0|        }
 1043|     39|    }
 1044|      0|    *bOverflow |= bOvfl;
 1045|       |
 1046|      0|    nLen = strbuf->nUsedLength - nUsedLength0;
 1047|      0|    return nLen;
 1048|       |
 1049|     39|#undef INIT_MIN_NUM_H
 1050|     39|#undef INIT_MAX_NUM_H
 1051|     39|#undef INIT_LEN_NUM_H
 1052|     39|}
MakeTautString:
 1111|     39|{
 1112|       |    /*  produce output string; */
 1113|     39|    int nUsedLength0 = 0, nLen = 0, len, i, bOvfl = *bOverflow;
 1114|     39|    char szValue[2048];
 1115|     39|    const char *p;
 1116|     39|    int   nValue, nGroupLen, iGroupOutputCount, bCompressed;
 1117|       |    /*  make tautomer string */
 1118|     39|    if (!nLenCT || !LinearCT || !*LinearCT)
  ------------------
  |  Branch (1118:9): [True: 0, False: 39]
  |  Branch (1118:20): [True: 0, False: 39]
  |  Branch (1118:33): [True: 0, False: 39]
  ------------------
 1119|      0|    {
 1120|      0|        return nLen;
 1121|      0|    }
 1122|       |
 1123|     39|    nUsedLength0 = strbuf->nUsedLength;
 1124|       |
 1125|     39|    bCompressed = ( nCtMode & CT_MODE_ABC_NUMBERS );
  ------------------
  |  |   54|     39|#define CT_MODE_ABC_NUMBERS       2
  ------------------
 1126|     39|    if (!bCompressed && !bOvfl && bAddDelim)
  ------------------
  |  Branch (1126:9): [True: 39, False: 0]
  |  Branch (1126:25): [True: 39, False: 0]
  |  Branch (1126:35): [True: 0, False: 39]
  ------------------
 1127|      0|    {
 1128|      0|        inchi_strbuf_printf( strbuf, "%s", COMMA_EXTRA_SPACE );
  ------------------
  |  |   47|      0|#define COMMA_EXTRA_SPACE ","
  ------------------
 1129|       |        /*if ( nLen_szLinearCT > 1+LEN_EXTRA_SPACE ) {
 1130|       |            strcpy( szLinearCT, COMMA_EXTRA_SPACE);
 1131|       |            nLen += 1+LEN_EXTRA_SPACE;
 1132|       |        } else {
 1133|       |            bOvfl = 1;
 1134|       |        }*/
 1135|      0|    }
 1136|     39|    LinearCT++; /*  bypass number of tautomeric groups */
 1137|     39|    nLenCT--;
 1138|       |
 1139|     39|    if (!bOvfl)
  ------------------
  |  Branch (1139:9): [True: 39, False: 0]
  ------------------
 1140|     39|    {
 1141|  56.6k|        for (i = nGroupLen = iGroupOutputCount = 0; i < nLenCT/* && nLen < nLen_szLinearCT*/; i++)
  ------------------
  |  Branch (1141:53): [True: 56.6k, False: 39]
  ------------------
 1142|  56.6k|        {
 1143|  56.6k|            nValue = (int) LinearCT[i];
 1144|  56.6k|            if (nGroupLen == iGroupOutputCount)
  ------------------
  |  Branch (1144:17): [True: 1.41k, False: 55.2k]
  ------------------
 1145|  1.41k|            {
 1146|  1.41k|                nGroupLen = nValue;
 1147|  1.41k|                iGroupOutputCount = 0;
 1148|       |                /* group delimiter (uncompressed) */
 1149|  1.41k|                if (!bCompressed)
  ------------------
  |  Branch (1149:21): [True: 1.41k, False: 0]
  ------------------
 1150|  1.41k|                {
 1151|  1.41k|                    if (!i)
  ------------------
  |  Branch (1151:25): [True: 39, False: 1.37k]
  ------------------
 1152|     39|                    {
 1153|     39|                        strcpy( szValue, "(" );
 1154|     39|                        len = 1;
 1155|     39|                    }
 1156|  1.37k|                    else
 1157|  1.37k|                    {
 1158|  1.37k|                        strcpy( szValue, ")(" );
 1159|  1.37k|                        len = 2;
 1160|  1.37k|                    }
 1161|  1.41k|                }
 1162|      0|                else
 1163|      0|                {
 1164|      0|                    len = 0;
 1165|      0|                }
 1166|  1.41k|            }
 1167|  55.2k|            else
 1168|  55.2k|            {
 1169|  55.2k|                if (bCompressed && iGroupOutputCount >= INCHI_T_NUM_MOVABLE)
  ------------------
  |  |  752|      0|#define INCHI_T_NUM_MOVABLE  2
  ------------------
  |  Branch (1169:21): [True: 0, False: 55.2k]
  |  Branch (1169:36): [True: 0, False: 0]
  ------------------
 1170|      0|                {
 1171|       |                    /*  compressed canon number in Abc */
 1172|      0|                    len = MakeAbcNumber( szValue, ( int )sizeof( szValue ), NULL, nValue );
 1173|      0|                    iGroupOutputCount++;
 1174|      0|                }
 1175|  55.2k|                else
 1176|  55.2k|                {
 1177|       |                    /*  always output number of hydrogen atoms as a decimal */
 1178|       |                    /*  output leading space if: */
 1179|       |                    /*  (a) this is the first output value in compressed mode (i==1 && bCompressed) */
 1180|       |                    /*  (b) this is not the first output value in non-compressed mode ( iGroupOutputCount && !bCompressed) */
 1181|  55.2k|                    if (bCompressed)
  ------------------
  |  Branch (1181:25): [True: 0, False: 55.2k]
  ------------------
 1182|      0|                    {
 1183|      0|                        p = NULL;
 1184|      0|                        len = 0;
 1185|      0|                        switch (iGroupOutputCount)
  ------------------
  |  Branch (1185:33): [True: 0, False: 0]
  ------------------
 1186|      0|                        {
 1187|      0|                            case 0:
  ------------------
  |  Branch (1187:29): [True: 0, False: 0]
  ------------------
 1188|      0|                                len = MakeDecNumber( szValue, ( int )sizeof( szValue ), ( i == 1 ) ? ITEM_DELIMETER : NULL, nValue );
  ------------------
  |  |   45|      0|#define ITEM_DELIMETER    ","
  ------------------
  |  Branch (1188:89): [True: 0, False: 0]
  ------------------
 1189|      0|                                break;
 1190|      0|                            case 1:
  ------------------
  |  Branch (1190:29): [True: 0, False: 0]
  ------------------
 1191|      0|                                p = "-";
 1192|      0|                                break;
 1193|      0|                            case 2:
  ------------------
  |  Branch (1193:29): [True: 0, False: 0]
  ------------------
 1194|      0|                                p = "+";
 1195|      0|                                break;
 1196|      0|                        }
 1197|      0|                        if (p)
  ------------------
  |  Branch (1197:29): [True: 0, False: 0]
  ------------------
 1198|      0|                        {
 1199|      0|                            switch (nValue)
 1200|      0|                            {
 1201|      0|                                case 0:
  ------------------
  |  Branch (1201:33): [True: 0, False: 0]
  ------------------
 1202|      0|                                    len = 0;
 1203|      0|                                    break;
 1204|      0|                                case 1:
  ------------------
  |  Branch (1204:33): [True: 0, False: 0]
  ------------------
 1205|      0|                                    strcpy( szValue, p );
 1206|      0|                                    len = (int) strlen( szValue );
 1207|      0|                                    break;
 1208|      0|                                default:
  ------------------
  |  Branch (1208:33): [True: 0, False: 0]
  ------------------
 1209|      0|                                    len = MakeDecNumber( szValue, ( int )sizeof( szValue ), p, nValue );
 1210|      0|                                    break;
 1211|      0|                            }
 1212|      0|                        }
 1213|      0|                    }
 1214|  55.2k|                    else
 1215|  55.2k|                    {
 1216|  55.2k|                        if (iGroupOutputCount >= INCHI_T_NUM_MOVABLE)
  ------------------
  |  |  752|  55.2k|#define INCHI_T_NUM_MOVABLE  2
  ------------------
  |  Branch (1216:29): [True: 52.3k, False: 2.83k]
  ------------------
 1217|  52.3k|                        {
 1218|       |                            /*  canonical number of the atom in the tautomeric group */
 1219|  52.3k|                            len = MakeDecNumber( szValue, ( int )sizeof( szValue ), ITEM_DELIMETER, nValue );
  ------------------
  |  |   45|  52.3k|#define ITEM_DELIMETER    ","
  ------------------
 1220|  52.3k|                        }
 1221|  2.83k|                        else
 1222|  2.83k|                        {
 1223|  2.83k|                            p = NULL;
 1224|  2.83k|                            len = 0;
 1225|  2.83k|                            if (nValue)
  ------------------
  |  Branch (1225:33): [True: 27, False: 2.80k]
  ------------------
 1226|     27|                            {
 1227|     27|                                switch (iGroupOutputCount)
  ------------------
  |  Branch (1227:41): [True: 0, False: 27]
  ------------------
 1228|     27|                                {
 1229|      0|                                    case 0:
  ------------------
  |  Branch (1229:37): [True: 0, False: 27]
  ------------------
 1230|      0|                                        p = "H";
 1231|      0|                                        break;
 1232|     27|                                    case 1:
  ------------------
  |  Branch (1232:37): [True: 27, False: 0]
  ------------------
 1233|     27|                                        p = "-";
 1234|     27|                                        break;
 1235|      0|                                    case 2:
  ------------------
  |  Branch (1235:37): [True: 0, False: 27]
  ------------------
 1236|      0|                                        p = "+";
 1237|      0|                                        break;
 1238|     27|                                }
 1239|     27|                                if (p)
  ------------------
  |  Branch (1239:37): [True: 27, False: 0]
  ------------------
 1240|     27|                                {
 1241|       |                                    /*  number of hydrogens */
 1242|     27|                                    if (nValue == 1)
  ------------------
  |  Branch (1242:41): [True: 27, False: 0]
  ------------------
 1243|     27|                                    {
 1244|     27|                                        strcpy( szValue, p );
 1245|     27|                                        len = (int) strlen( szValue );
 1246|     27|                                    }
 1247|      0|                                    else
 1248|      0|                                    {
 1249|      0|                                        len = MakeDecNumber( szValue, ( int )sizeof( szValue ), p, nValue );
 1250|      0|                                    }
 1251|     27|                                }
 1252|     27|                            }
 1253|  2.83k|                        }
 1254|  55.2k|                    }
 1255|  55.2k|                    iGroupOutputCount++;
 1256|  55.2k|                }
 1257|  55.2k|            }
 1258|       |
 1259|  56.6k|            if (len > 0)
  ------------------
  |  Branch (1259:17): [True: 53.8k, False: 2.80k]
  ------------------
 1260|  53.8k|            {
 1261|  53.8k|                inchi_strbuf_printf( strbuf, "%s", szValue );
 1262|  53.8k|            }
 1263|       |            /*if ( 0 <= len && nLen+len < nLen_szLinearCT ) {
 1264|       |                if ( len ) {
 1265|       |                    strcpy( szLinearCT+nLen, szValue );
 1266|       |                    nLen += len;
 1267|       |                }
 1268|       |            } else {
 1269|       |                bOvfl = 1;
 1270|       |                break;
 1271|       |            }*/
 1272|  56.6k|        }
 1273|       |
 1274|     39|        if (!bOvfl && !bCompressed && i)
  ------------------
  |  Branch (1274:13): [True: 39, False: 0]
  |  Branch (1274:23): [True: 39, False: 0]
  |  Branch (1274:39): [True: 39, False: 0]
  ------------------
 1275|     39|        {
 1276|     39|            inchi_strbuf_printf( strbuf, ")" );
 1277|       |            /*if ( nLen + 1 < nLen_szLinearCT ) {
 1278|       |                strcpy( szLinearCT+nLen, ")" );
 1279|       |                nLen ++;
 1280|       |            } else {
 1281|       |                bOvfl = 1;
 1282|       |            }*/
 1283|     39|        }
 1284|     39|    }
 1285|     39|    *bOverflow |= bOvfl;
 1286|       |
 1287|     39|    nLen = strbuf->nUsedLength - nUsedLength0;
 1288|       |
 1289|     39|    return nLen;
 1290|     39|}
MakeIsoAtomString:
 1567|     14|{
 1568|       |    /*  produce output string; */
 1569|     14|    int nUsedLength0 = 0, nLen = 0, len, tot_len, ret, i, j, bOvfl = *bOverflow;
 1570|     14|    char szValue[2048];
 1571|     14|    char *p;
 1572|     14|    int   nValue;
 1573|     14|    int   bAbcNumbers = ( nCtMode & CT_MODE_ABC_NUMBERS );
  ------------------
  |  |   54|     14|#define CT_MODE_ABC_NUMBERS       2
  ------------------
 1574|     14|    static const char letter[] = "itdh";
 1575|     14|    static const char *h[] = { "T", "D", "H" };
 1576|     14|    static const char *sign[] = { "-", "+" };
 1577|       |
 1578|     14|    nUsedLength0 = strbuf->nUsedLength;
 1579|       |
 1580|     14|    if (!bOvfl)
  ------------------
  |  Branch (1580:9): [True: 14, False: 0]
  ------------------
 1581|     14|    {
 1582|  8.04k|        for (i = 0; i < nNumberOfIsotopicAtoms/* && nLen < nLen_szLinearCT*/; i++)
  ------------------
  |  Branch (1582:21): [True: 8.03k, False: 14]
  ------------------
 1583|  8.03k|        {
 1584|  8.03k|            p = szValue;
 1585|  8.03k|            tot_len = 0;
 1586|  48.1k|            for (j = 0; j < 5; j++)
  ------------------
  |  Branch (1586:25): [True: 40.1k, False: 8.03k]
  ------------------
 1587|  40.1k|            {
 1588|  40.1k|                len = 0;
 1589|  40.1k|                switch (j)
  ------------------
  |  Branch (1589:25): [True: 0, False: 40.1k]
  ------------------
 1590|  40.1k|                {
 1591|  8.03k|                    case 0:
  ------------------
  |  Branch (1591:21): [True: 8.03k, False: 32.1k]
  ------------------
 1592|  8.03k|                        nValue = (int) IsotopicAtom[i].nAtomNumber;
 1593|  8.03k|                        break;
 1594|  8.03k|                    case 1:
  ------------------
  |  Branch (1594:21): [True: 8.03k, False: 32.1k]
  ------------------
 1595|  8.03k|                        nValue = (int) IsotopicAtom[i].nIsoDifference;
 1596|  8.03k|                        break;
 1597|  8.03k|                    case 2:
  ------------------
  |  Branch (1597:21): [True: 8.03k, False: 32.1k]
  ------------------
 1598|  8.03k|                        nValue = (int) IsotopicAtom[i].nNum_T;
 1599|  8.03k|                        break;
 1600|  8.03k|                    case 3:
  ------------------
  |  Branch (1600:21): [True: 8.03k, False: 32.1k]
  ------------------
 1601|  8.03k|                        nValue = (int) IsotopicAtom[i].nNum_D;
 1602|  8.03k|                        break;
 1603|  8.03k|                    case 4:
  ------------------
  |  Branch (1603:21): [True: 8.03k, False: 32.1k]
  ------------------
 1604|  8.03k|                        nValue = (int) IsotopicAtom[i].nNum_H;
 1605|  8.03k|                        break;
 1606|  40.1k|                }
 1607|  40.1k|                if (!j)
  ------------------
  |  Branch (1607:21): [True: 8.03k, False: 32.1k]
  ------------------
 1608|  8.03k|                {
 1609|       |                    /*  atom canonical number */
 1610|  8.03k|                    len = ( bAbcNumbers ? MakeAbcNumber : MakeDecNumber )
  ------------------
  |  Branch (1610:29): [True: 0, False: 8.03k]
  ------------------
 1611|  8.03k|                        ( p, ( int )sizeof( szValue ) - tot_len,
 1612|  8.03k|                          bAbcNumbers ? NULL : ( i ? ITEM_DELIMETER : EXTRA_SPACE ), nValue
  ------------------
  |  |   45|  8.01k|#define ITEM_DELIMETER    ","
  ------------------
                                        bAbcNumbers ? NULL : ( i ? ITEM_DELIMETER : EXTRA_SPACE ), nValue
  ------------------
  |  |   46|     14|#define EXTRA_SPACE       ""
  ------------------
  |  Branch (1612:27): [True: 0, False: 8.03k]
  |  Branch (1612:50): [True: 8.01k, False: 14]
  ------------------
 1613|  8.03k|                        );
 1614|  8.03k|                }
 1615|  32.1k|                else
 1616|  32.1k|                {
 1617|  32.1k|                    if (bAbcNumbers)
  ------------------
  |  Branch (1617:25): [True: 0, False: 32.1k]
  ------------------
 1618|      0|                    {
 1619|       |                        /*  Abc output */
 1620|      0|                        switch (j)
  ------------------
  |  Branch (1620:33): [True: 0, False: 0]
  ------------------
 1621|      0|                        {
 1622|      0|                            case 1: /* nIsoDifference */
  ------------------
  |  Branch (1622:29): [True: 0, False: 0]
  ------------------
 1623|      0|                                len = MakeDecNumber( p, ( int )sizeof( szValue ) - tot_len, NULL, nValue );
 1624|      0|                                break;
 1625|      0|                            case 2: /* nNum_T */
  ------------------
  |  Branch (1625:29): [True: 0, False: 0]
  ------------------
 1626|      0|                            case 3: /* nNum_D */
  ------------------
  |  Branch (1626:29): [True: 0, False: 0]
  ------------------
 1627|      0|                            case 4: /* nNum_H */
  ------------------
  |  Branch (1627:29): [True: 0, False: 0]
  ------------------
 1628|      0|                                if (nValue)
  ------------------
  |  Branch (1628:37): [True: 0, False: 0]
  ------------------
 1629|      0|                                {
 1630|      0|                                    if (( int )sizeof( szValue ) - tot_len > 1)
  ------------------
  |  Branch (1630:41): [True: 0, False: 0]
  ------------------
 1631|      0|                                    {
 1632|      0|                                        p[len++] = letter[j - 1];
 1633|      0|                                        if (1 == nValue)
  ------------------
  |  Branch (1633:45): [True: 0, False: 0]
  ------------------
 1634|      0|                                        {
 1635|      0|                                            p[len] = '\0';
 1636|      0|                                        }
 1637|      0|                                        else
 1638|      0|                                        {
 1639|      0|                                            ret = MakeDecNumber( p + len, ( int )sizeof( szValue ) - tot_len - len, NULL, nValue );
 1640|      0|                                            len = ( ret >= 0 ) ? len + ret : ret;
  ------------------
  |  Branch (1640:51): [True: 0, False: 0]
  ------------------
 1641|      0|                                        }
 1642|      0|                                    }
 1643|      0|                                    else
 1644|      0|                                    {
 1645|      0|                                        len = -1; /* overflow */
 1646|      0|                                    }
 1647|      0|                                }
 1648|      0|                        }
 1649|      0|                    }
 1650|  32.1k|                    else
 1651|  32.1k|                    {
 1652|  32.1k|                        if (nValue)
  ------------------
  |  Branch (1652:29): [True: 8.10k, False: 24.0k]
  ------------------
 1653|  8.10k|                        {
 1654|  8.10k|                            if (j == 1)
  ------------------
  |  Branch (1654:33): [True: 6.78k, False: 1.31k]
  ------------------
 1655|  6.78k|                            {
 1656|       |                                /*  Decimal output */
 1657|       |                                /*  signed isotopic mass difference */
 1658|  6.78k|                                int subtract = ( nValue > 0 );
 1659|       |                                /*  (n = mass difference) > 0 corresponds to nValue = n+1 */
 1660|       |                                /*  subtract 1 from it so that mass difference for 35Cl or 12C is zero */
 1661|  6.78k|                                len = MakeDecNumber( p, ( int )sizeof( szValue ) - tot_len, sign[nValue >= 0], abs( nValue - subtract ) );
 1662|  6.78k|                            }
 1663|  1.31k|                            else
 1664|  1.31k|                            {
 1665|       |                                /*  hydrogen isotope */
 1666|  1.31k|                                if (nValue != 1)
  ------------------
  |  Branch (1666:37): [True: 505, False: 812]
  ------------------
 1667|    505|                                {
 1668|    505|                                    len = MakeDecNumber( p, ( int )sizeof( szValue ) - tot_len, h[j - 2], nValue );
 1669|    505|                                }
 1670|    812|                                else
 1671|    812|                                {
 1672|    812|                                    if (( int )sizeof( szValue ) - tot_len > 1)
  ------------------
  |  Branch (1672:41): [True: 812, False: 0]
  ------------------
 1673|    812|                                    {
 1674|    812|                                        strcpy( p, h[j - 2] );
 1675|    812|                                        len = 1;
 1676|    812|                                    }
 1677|      0|                                    else
 1678|      0|                                    {
 1679|      0|                                        len = -1; /*  overflow */
 1680|      0|                                    }
 1681|    812|                                }
 1682|  1.31k|                            }
 1683|  8.10k|                        }
 1684|  24.0k|                        else
 1685|  24.0k|                        {
 1686|  24.0k|                            continue; /*  do not write zeroes */
 1687|  24.0k|                        }
 1688|  32.1k|                    }
 1689|  32.1k|                }
 1690|  16.1k|                if (len < 0)
  ------------------
  |  Branch (1690:21): [True: 0, False: 16.1k]
  ------------------
 1691|      0|                {
 1692|      0|                    bOvfl = 1;
 1693|      0|                    break;
 1694|      0|                }
 1695|  16.1k|                tot_len += len;
 1696|  16.1k|                p += len;
 1697|  16.1k|            }
 1698|  8.03k|            inchi_strbuf_printf( strbuf, "%s", szValue );
 1699|       |            /*if ( nLen+tot_len < nLen_szLinearCT )
 1700|       |            {
 1701|       |                memcpy( szLinearCT+nLen, szValue, tot_len+1 );
 1702|       |                nLen += tot_len;
 1703|       |            }
 1704|       |            else
 1705|       |            {
 1706|       |                bOvfl = 1;
 1707|       |                break;
 1708|       |            }*/
 1709|  8.03k|        }
 1710|     14|    }
 1711|     14|    *bOverflow |= bOvfl;
 1712|       |
 1713|     14|    nLen = strbuf->nUsedLength - nUsedLength0;
 1714|       |
 1715|     14|    return nLen;
 1716|     14|}
inchi_strtol:
 2187|   296k|{
 2188|   296k|    if (base == ALPHA_BASE) {
  ------------------
  |  |   96|   296k|#define ALPHA_BASE  27
  ------------------
  |  Branch (2188:9): [True: 0, False: 296k]
  ------------------
 2189|      0|        return abctol(str, (char **)p); /* cast deliberately discards const qualifier */
 2190|      0|    }
 2191|   296k|    else {
 2192|   296k|        return strtol(str, (char **)p, base); /* cast deliberately discards const qualifier */
 2193|   296k|    }
 2194|   296k|}
MakeDecNumber:
 2223|  67.7k|{
 2224|  67.7k|#define DECIMAL_BASE     10
 2225|  67.7k|#define DECIMAL_MINUS    '-'
 2226|  67.7k|#define DECIMAL_ZERO_VAL '0'
 2227|  67.7k|#define DECIMAL_ONE      '1'
 2228|  67.7k|#define DECIMAL_ZERO     '0'
 2229|       |
 2230|  67.7k|    char *p = szString;
 2231|  67.7k|    char *q;
 2232|  67.7k|    int  nChar;
 2233|       |
 2234|  67.7k|    if (nStringLen < 2)
  ------------------
  |  Branch (2234:9): [True: 0, False: 67.7k]
  ------------------
 2235|      0|    {
 2236|      0|        return -1;
 2237|      0|    }
 2238|   135k|    while (szLeadingDelim && *szLeadingDelim && --nStringLen)
  ------------------
  |  Branch (2238:12): [True: 135k, False: 86]
  |  Branch (2238:30): [True: 67.6k, False: 67.7k]
  |  Branch (2238:49): [True: 67.6k, False: 0]
  ------------------
 2239|  67.6k|    {
 2240|  67.6k|        *p++ = *szLeadingDelim++;
 2241|  67.6k|    }
 2242|  67.7k|    if (nStringLen < 2)
  ------------------
  |  Branch (2242:9): [True: 0, False: 67.7k]
  ------------------
 2243|      0|    {
 2244|      0|        return -1;
 2245|      0|    }
 2246|  67.7k|    if (!nValue)
  ------------------
  |  Branch (2246:9): [True: 921, False: 66.8k]
  ------------------
 2247|    921|    {
 2248|    921|        *p++ = DECIMAL_ZERO_VAL;  /*  zero value (cannot use 0) */
  ------------------
  |  | 2226|    921|#define DECIMAL_ZERO_VAL '0'
  ------------------
 2249|    921|        *p = '\0';
 2250|    921|        return (int) ( p - szString );
 2251|    921|    }
 2252|  66.8k|    if (nValue < 0)
  ------------------
  |  Branch (2252:9): [True: 0, False: 66.8k]
  ------------------
 2253|      0|    {
 2254|      0|        *p++ = DECIMAL_MINUS;
  ------------------
  |  | 2225|      0|#define DECIMAL_MINUS    '-'
  ------------------
 2255|      0|        nStringLen--;
 2256|      0|        nValue = -nValue;
 2257|      0|    }
 2258|   152k|    for (q = p; nValue && --nStringLen; nValue /= DECIMAL_BASE)
  ------------------
  |  | 2224|  85.2k|#define DECIMAL_BASE     10
  ------------------
  |  Branch (2258:17): [True: 85.2k, False: 66.8k]
  |  Branch (2258:27): [True: 85.2k, False: 0]
  ------------------
 2259|  85.2k|    {
 2260|  85.2k|        if (nChar = nValue % DECIMAL_BASE)
  ------------------
  |  | 2224|  85.2k|#define DECIMAL_BASE     10
  ------------------
  |  Branch (2260:13): [True: 78.1k, False: 7.08k]
  ------------------
 2261|  78.1k|        {
 2262|  78.1k|            nChar = DECIMAL_ONE + nChar - 1;
  ------------------
  |  | 2227|  78.1k|#define DECIMAL_ONE      '1'
  ------------------
 2263|  78.1k|        }
 2264|  7.08k|        else
 2265|  7.08k|        {
 2266|  7.08k|            nChar = DECIMAL_ZERO;
  ------------------
  |  | 2228|  7.08k|#define DECIMAL_ZERO     '0'
  ------------------
 2267|  7.08k|        }
 2268|  85.2k|        *q++ = nChar;
 2269|  85.2k|    }
 2270|  66.8k|    if (nStringLen <= 0)
  ------------------
  |  Branch (2270:9): [True: 0, False: 66.8k]
  ------------------
 2271|      0|    {
 2272|      0|        return -1;
 2273|      0|    }
 2274|  66.8k|    *q = '\0';
 2275|  66.8k|    mystrrev( p );
 2276|       |
 2277|  66.8k|    return (int) ( q - szString );
 2278|       |
 2279|  66.8k|#undef DECIMAL_BASE
 2280|  66.8k|#undef DECIMAL_MINUS
 2281|  66.8k|#undef DECIMAL_ZERO_VAL
 2282|  66.8k|#undef DECIMAL_ONE
 2283|  66.8k|#undef DECIMAL_ZERO
 2284|  66.8k|}

str_HillFormula:
   59|     80|{
   60|     80|    int          i, ii, nUsedLength0;
   61|     80|    INCHI_SORT   *is, *is0;
   62|     80|    INChI        *pINChI, *pINChI_Prev;
   63|     80|    int          mult, eq2prev, bNext;
   64|       |
   65|     80|    nUsedLength0 = strbuf->nUsedLength;
   66|       |
   67|     80|    if (!( is0 = pINChISort ))
  ------------------
  |  Branch (67:9): [True: 0, False: 80]
  ------------------
   68|      0|    {
   69|      0|        return nUsedLength0;
   70|      0|    }
   71|     80|    i = 0;
   72|     80|    pINChI_Prev = ( 0 <= ( ii = GET_II( bOutType, is0 ) ) ) ? is0->pINChI[ii] : NULL;
  ------------------
  |  |   73|     80|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  585|     80|#define OUT_N1              0    /* non-tautomeric only */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (73:22): [True: 0, False: 80]
  |  |  ------------------
  |  |   74|     80|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  586|    160|#define OUT_T1              1    /* tautomeric if present otherwise non-tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  588|    160|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   63|     80|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|     80|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|     80|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (63:20): [True: 80, False: 0]
  |  |  |  |  |  Branch (63:43): [True: 80, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|     80|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   65|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (65:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (65:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (74:23): [True: 0, False: 80]
  |  |  |  Branch (74:36): [True: 80, False: 0]
  |  |  ------------------
  |  |   75|     80|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  590|      0|#define OUT_NN              4    /* only non-taut representations: non-taut else tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (75:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   76|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  587|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   68|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (68:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (76:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (72:19): [True: 80, False: 0]
  ------------------
   73|     80|    mult = 0;
   74|     80|    bNext = 0;
   75|       |
   76|       |    /* For each connected component */
   77|  1.29k|    for (i++; i <= num_components; i++)
  ------------------
  |  Branch (77:15): [True: 1.21k, False: 80]
  ------------------
   78|  1.21k|    {
   79|       |
   80|  1.21k|        pINChI = ( i < num_components &&
  ------------------
  |  Branch (80:20): [True: 1.13k, False: 80]
  ------------------
   81|  1.21k|            ( is = is0 + i, 0 <= ( ii = GET_II( bOutType, is ) ) ) )
  ------------------
  |  |   73|  1.13k|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  585|  1.13k|#define OUT_N1              0    /* non-tautomeric only */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (73:22): [True: 0, False: 1.13k]
  |  |  ------------------
  |  |   74|  1.13k|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  586|  2.26k|#define OUT_T1              1    /* tautomeric if present otherwise non-tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  588|  2.26k|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   63|  1.13k|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|  1.13k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|  1.13k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (63:20): [True: 1.13k, False: 0]
  |  |  |  |  |  Branch (63:43): [True: 1.13k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|  1.13k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   65|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (65:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (65:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (74:23): [True: 0, False: 1.13k]
  |  |  |  Branch (74:36): [True: 1.13k, False: 0]
  |  |  ------------------
  |  |   75|  1.13k|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  590|      0|#define OUT_NN              4    /* only non-taut representations: non-taut else tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (75:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   76|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  587|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   68|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (68:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (76:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (81:13): [True: 1.13k, False: 0]
  ------------------
   82|  1.21k|            ? is->pINChI[ii]
   83|  1.21k|            : NULL;
   84|       |
   85|  1.21k|        eq2prev = bUseMulipliers &&
  ------------------
  |  Branch (85:19): [True: 1.21k, False: 0]
  ------------------
   86|  1.21k|            pINChI &&
  ------------------
  |  Branch (86:13): [True: 1.13k, False: 80]
  ------------------
   87|  1.21k|            pINChI_Prev &&
  ------------------
  |  Branch (87:13): [True: 1.13k, False: 0]
  ------------------
   88|  1.21k|            pINChI->szHillFormula &&
  ------------------
  |  Branch (88:13): [True: 1.13k, False: 0]
  ------------------
   89|  1.21k|            pINChI_Prev->szHillFormula &&
  ------------------
  |  Branch (89:13): [True: 1.13k, False: 0]
  ------------------
   90|  1.21k|            pINChI->szHillFormula[0] &&
  ------------------
  |  Branch (90:13): [True: 1.13k, False: 0]
  ------------------
   91|  1.21k|            !strcmp( pINChI_Prev->szHillFormula, pINChI->szHillFormula );
  ------------------
  |  Branch (91:13): [True: 1.04k, False: 88]
  ------------------
   92|       |
   93|  1.21k|        if (eq2prev)
  ------------------
  |  Branch (93:13): [True: 1.04k, False: 168]
  ------------------
   94|  1.04k|        {
   95|  1.04k|            mult++; /* mult = (number of non-empty equal items)-1 */
   96|  1.04k|            continue;
   97|  1.04k|        }
   98|    168|        else
   99|    168|        {
  100|    168|            int ok;
  101|    168|            if (bNext++)
  ------------------
  |  Branch (101:17): [True: 88, False: 80]
  ------------------
  102|     88|            {
  103|     88|                MakeDelim( ".", strbuf, bOverflow );
  104|     88|            }
  105|       |
  106|    168|            ok = pINChI_Prev &&
  ------------------
  |  Branch (106:18): [True: 168, False: 0]
  ------------------
  107|    168|                pINChI_Prev->szHillFormula &&
  ------------------
  |  Branch (107:17): [True: 168, False: 0]
  ------------------
  108|    168|                pINChI_Prev->szHillFormula[0];
  ------------------
  |  Branch (108:17): [True: 168, False: 0]
  ------------------
  109|       |
  110|    168|            if (ok)
  ------------------
  |  Branch (110:17): [True: 168, False: 0]
  ------------------
  111|    168|            {
  112|    168|                MakeMult( mult + 1, "", strbuf, 0, bOverflow );
  113|    168|                MakeHillFormulaString( pINChI_Prev->szHillFormula,
  114|    168|                    strbuf,
  115|    168|                    bOverflow );
  116|    168|            }
  117|    168|        }
  118|    168|        pINChI_Prev = pINChI;
  119|    168|        mult = 0; /* we do not know whether the item is empty */
  120|    168|    }
  121|       |
  122|     80|    return ( strbuf->nUsedLength - nUsedLength0 );
  123|     80|}
str_Connections:
  225|     80|{
  226|     80|    int          i, ii, nUsedLength0;
  227|     80|    INCHI_SORT   *is, *is0;
  228|     80|    INChI        *pINChI, *pINChI_Prev;
  229|     80|    int          mult, eq2prev, bNext, nNumEmpty;
  230|       |
  231|     80|    nUsedLength0 = strbuf->nUsedLength;
  232|     80|    if (!( is0 = pINChISort ))
  ------------------
  |  Branch (232:9): [True: 0, False: 80]
  ------------------
  233|      0|    {
  234|      0|        return nUsedLength0;
  235|      0|    }
  236|     80|    i = 0;
  237|     80|    pINChI_Prev = ( 0 <= ( ii = GET_II( bOutType, is0 ) ) ) ? is0->pINChI[ii] : NULL;
  ------------------
  |  |   73|     80|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  585|     80|#define OUT_N1              0    /* non-tautomeric only */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (73:22): [True: 0, False: 80]
  |  |  ------------------
  |  |   74|     80|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  586|    160|#define OUT_T1              1    /* tautomeric if present otherwise non-tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  588|    160|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   63|     80|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|     80|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|     80|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (63:20): [True: 80, False: 0]
  |  |  |  |  |  Branch (63:43): [True: 80, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|     80|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   65|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (65:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (65:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (74:23): [True: 0, False: 80]
  |  |  |  Branch (74:36): [True: 80, False: 0]
  |  |  ------------------
  |  |   75|     80|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  590|      0|#define OUT_NN              4    /* only non-taut representations: non-taut else tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (75:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   76|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  587|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   68|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (68:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (76:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (237:19): [True: 80, False: 0]
  ------------------
  238|     80|    is = NULL;
  239|     80|    mult = 0;
  240|     80|    bNext = 0;
  241|     80|    nNumEmpty = 0;
  242|       |
  243|       |    /* For each connected component...    */
  244|  1.29k|    for (i++; i <= num_components; i++)
  ------------------
  |  Branch (244:15): [True: 1.21k, False: 80]
  ------------------
  245|  1.21k|    {
  246|  1.21k|        pINChI = ( i < num_components && ( is = is0 + i, 0 <= ( ii = GET_II( bOutType, is ) ) ) ) ? is->pINChI[ii] : NULL;
  ------------------
  |  |   73|  1.13k|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  585|  1.13k|#define OUT_N1              0    /* non-tautomeric only */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (73:22): [True: 0, False: 1.13k]
  |  |  ------------------
  |  |   74|  1.13k|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  586|  2.26k|#define OUT_T1              1    /* tautomeric if present otherwise non-tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  588|  2.26k|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   63|  1.13k|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|  1.13k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|  1.13k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (63:20): [True: 1.13k, False: 0]
  |  |  |  |  |  Branch (63:43): [True: 1.13k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|  1.13k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   65|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (65:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (65:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (74:23): [True: 0, False: 1.13k]
  |  |  |  Branch (74:36): [True: 1.13k, False: 0]
  |  |  ------------------
  |  |   75|  1.13k|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  590|      0|#define OUT_NN              4    /* only non-taut representations: non-taut else tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (75:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   76|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  587|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   68|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (68:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (76:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (246:20): [True: 1.13k, False: 80]
  |  Branch (246:42): [True: 1.13k, False: 0]
  ------------------
  247|  1.21k|        eq2prev = bUseMulipliers                                &&
  ------------------
  |  Branch (247:19): [True: 1.21k, False: 0]
  ------------------
  248|  1.21k|            pINChI && pINChI_Prev && pINChI->lenConnTable > 1   &&
  ------------------
  |  Branch (248:13): [True: 1.13k, False: 80]
  |  Branch (248:23): [True: 1.13k, False: 0]
  |  Branch (248:38): [True: 0, False: 1.13k]
  ------------------
  249|  1.21k|            pINChI_Prev->lenConnTable == pINChI->lenConnTable   &&
  ------------------
  |  Branch (249:13): [True: 0, False: 0]
  ------------------
  250|  1.21k|            !memcmp( pINChI_Prev->nConnTable, pINChI->nConnTable,
  ------------------
  |  Branch (250:13): [True: 0, False: 0]
  ------------------
  251|      0|                pINChI_Prev->lenConnTable * sizeof( pINChI->nConnTable[0] ) );
  252|  1.21k|        if (eq2prev)
  ------------------
  |  Branch (252:13): [True: 0, False: 1.21k]
  ------------------
  253|      0|        {
  254|      0|            mult++; /* mult = (number of non-empty equal items)-1 */
  255|      0|            continue;
  256|      0|        }
  257|  1.21k|        else
  258|  1.21k|        {
  259|  1.21k|            if (pINChI_Prev)
  ------------------
  |  Branch (259:17): [True: 1.21k, False: 0]
  ------------------
  260|  1.21k|            {
  261|  1.21k|                if (bNext++)
  ------------------
  |  Branch (261:21): [True: 1.13k, False: 80]
  ------------------
  262|  1.13k|                {
  263|  1.13k|                    MakeDelim( sCompDelim, strbuf, bOverflow );
  264|  1.13k|                }
  265|  1.21k|                if (pINChI_Prev && pINChI_Prev->lenConnTable > 1)
  ------------------
  |  Branch (265:21): [True: 1.21k, False: 0]
  |  Branch (265:36): [True: 3, False: 1.21k]
  ------------------
  266|      3|                {
  267|      3|                    MakeMult( mult + 1, "*", strbuf, 0, bOverflow );
  268|      3|                    MakeCtStringNew( pCG, pINChI_Prev->nConnTable,
  269|      3|                        pINChI_Prev->lenConnTable,
  270|      3|                        0, NULL,
  271|      3|                        pINChI_Prev->nNumberOfAtoms,
  272|      3|                        strbuf, ATOM_MODE, bOverflow );
  273|      3|                }
  274|  1.21k|                else
  275|  1.21k|                {
  276|  1.21k|                    nNumEmpty++;
  277|  1.21k|                }
  278|  1.21k|            }
  279|  1.21k|        }
  280|  1.21k|        pINChI_Prev = pINChI;
  281|  1.21k|        mult = 0; /* we do not know whether the item is empty */
  282|  1.21k|    }
  283|     80|    if (nNumEmpty == num_components && strbuf->nUsedLength > nUsedLength0)
  ------------------
  |  Branch (283:9): [True: 77, False: 3]
  |  Branch (283:40): [True: 2, False: 75]
  ------------------
  284|      2|    {
  285|      2|        strbuf->nUsedLength = nUsedLength0;
  286|      2|        strbuf->pStr[strbuf->nUsedLength] = '\0';
  287|      2|    }
  288|       |    /*
  289|       |    if ( nNumEmpty == num_components && tot_len > tot_len_inp ) {
  290|       |    tot_len = tot_len_inp;
  291|       |    strbuf->pStr[tot_len] = '\0';
  292|       |    }
  293|       |    */
  294|       |
  295|     80|    return ( strbuf->nUsedLength - nUsedLength0 );
  296|     80|}
str_H_atoms:
  310|     39|{
  311|     39|    int          i, j, ii, len_H, nUsedLength0;
  312|     39|    INCHI_SORT   *is, *is0;
  313|     39|    INChI        *pINChI, *pINChI_Prev;
  314|     39|    int          mult, eq2prev, bNext, bNotEmpty, nNumEmpty;
  315|       |
  316|     39|    nNumEmpty = 0;
  317|     39|    is0 = pINChISort;
  318|     39|    is = NULL;
  319|     39|    i = 0;
  320|     39|    pINChI_Prev = ( 0 <= ( ii = GET_II( bOutType, is0 ) ) ) ? is0->pINChI[ii] : NULL;
  ------------------
  |  |   73|     39|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  585|     39|#define OUT_N1              0    /* non-tautomeric only */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (73:22): [True: 0, False: 39]
  |  |  ------------------
  |  |   74|     39|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  586|     78|#define OUT_T1              1    /* tautomeric if present otherwise non-tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  588|     78|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   63|     39|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|     39|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|     39|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (63:20): [True: 39, False: 0]
  |  |  |  |  |  Branch (63:43): [True: 39, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|     39|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   65|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (65:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (65:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (74:23): [True: 0, False: 39]
  |  |  |  Branch (74:36): [True: 39, False: 0]
  |  |  ------------------
  |  |   75|     39|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  590|      0|#define OUT_NN              4    /* only non-taut representations: non-taut else tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (75:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   76|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  587|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   68|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (68:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (76:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (320:19): [True: 39, False: 0]
  ------------------
  321|     39|    mult = 0;
  322|     39|    bNext = 0;
  323|     39|    nUsedLength0 = strbuf->nUsedLength;
  324|       |
  325|       |    /* For each connected component...    */
  326|     78|    for (i++; i <= num_components; i++)
  ------------------
  |  Branch (326:15): [True: 39, False: 39]
  ------------------
  327|     39|    {
  328|       |
  329|     39|        pINChI = ( i < num_components && ( is = is0 + i, 0 <= ( ii = GET_II( bOutType, is ) ) ) ) ? is->pINChI[ii] : NULL;
  ------------------
  |  |   73|      0|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  585|      0|#define OUT_N1              0    /* non-tautomeric only */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (73:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   74|      0|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  586|      0|#define OUT_T1              1    /* tautomeric if present otherwise non-tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  588|      0|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   63|      0|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (63:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (63:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   65|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (65:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (65:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (74:23): [True: 0, False: 0]
  |  |  |  Branch (74:36): [True: 0, False: 0]
  |  |  ------------------
  |  |   75|      0|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  590|      0|#define OUT_NN              4    /* only non-taut representations: non-taut else tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (75:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   76|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  587|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   68|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (68:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (76:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (329:20): [True: 0, False: 39]
  |  Branch (329:42): [True: 0, False: 0]
  ------------------
  330|       |        /*========== compare to previous ============*/
  331|     39|        eq2prev = bUseMulipliers &&
  ------------------
  |  Branch (331:19): [True: 39, False: 0]
  ------------------
  332|     39|            pINChI && pINChI_Prev && ( pINChI->nNumberOfAtoms > 0 || pINChI->lenTautomer > 1 ) &&
  ------------------
  |  Branch (332:13): [True: 0, False: 39]
  |  Branch (332:23): [True: 0, False: 0]
  |  Branch (332:40): [True: 0, False: 0]
  |  Branch (332:70): [True: 0, False: 0]
  ------------------
  333|     39|            pINChI_Prev->nNumberOfAtoms == pINChI->nNumberOfAtoms &&
  ------------------
  |  Branch (333:13): [True: 0, False: 0]
  ------------------
  334|     39|            ( !pINChI_Prev->nNumberOfAtoms || !memcmp( pINChI_Prev->nNum_H, pINChI->nNum_H,
  ------------------
  |  Branch (334:15): [True: 0, False: 0]
  |  Branch (334:47): [True: 0, False: 0]
  ------------------
  335|      0|                pINChI_Prev->nNumberOfAtoms * sizeof( pINChI->nNum_H[0] ) ) ) &&
  336|     39|            !CompareTautNonIsoPartOfINChI( pINChI_Prev, pINChI );
  ------------------
  |  Branch (336:13): [True: 0, False: 0]
  ------------------
  337|       |
  338|     39|        if (eq2prev && pINChI_Prev->lenTautomer <= 1)
  ------------------
  |  Branch (338:13): [True: 0, False: 39]
  |  Branch (338:24): [True: 0, False: 0]
  ------------------
  339|      0|        {
  340|       |            /* make sure it is not empty */
  341|      0|            eq2prev = 0;
  342|      0|            for (j = 0; j < pINChI_Prev->nNumberOfAtoms; j++)
  ------------------
  |  Branch (342:25): [True: 0, False: 0]
  ------------------
  343|      0|            {
  344|      0|                if (pINChI_Prev->nNum_H[j])
  ------------------
  |  Branch (344:21): [True: 0, False: 0]
  ------------------
  345|      0|                {
  346|      0|                    eq2prev = 1;
  347|      0|                    break;
  348|      0|                }
  349|      0|            }
  350|      0|        }
  351|     39|        if (eq2prev)
  ------------------
  |  Branch (351:13): [True: 0, False: 39]
  ------------------
  352|      0|        {
  353|      0|            mult++; /* mult = (number of non-empty equal items)-1 */
  354|      0|            continue;
  355|      0|        }
  356|     39|        else
  357|     39|        {
  358|     39|            if (pINChI_Prev)
  ------------------
  |  Branch (358:17): [True: 39, False: 0]
  ------------------
  359|     39|            {
  360|       |                /* delimiter */
  361|     39|                if (bNext++)
  ------------------
  |  Branch (361:21): [True: 0, False: 39]
  ------------------
  362|      0|                {
  363|      0|                    MakeDelim( sCompDelim, strbuf, bOverflow );
  364|      0|                }
  365|       |                /* verify non-empty */
  366|     39|                bNotEmpty = 0;
  367|     39|                if (pINChI_Prev)
  ------------------
  |  Branch (367:21): [True: 39, False: 0]
  ------------------
  368|     39|                {
  369|     39|                    bNotEmpty = ( pINChI_Prev->lenTautomer > 1 );
  370|     39|                    if (!bNotEmpty)
  ------------------
  |  Branch (370:25): [True: 0, False: 39]
  ------------------
  371|      0|                    {
  372|      0|                        for (j = 0; j < pINChI_Prev->nNumberOfAtoms; j++)
  ------------------
  |  Branch (372:37): [True: 0, False: 0]
  ------------------
  373|      0|                        {
  374|      0|                            if (pINChI_Prev->nNum_H[j])
  ------------------
  |  Branch (374:33): [True: 0, False: 0]
  ------------------
  375|      0|                            {
  376|      0|                                bNotEmpty = 1;
  377|      0|                                break;
  378|      0|                            }
  379|      0|                        }
  380|      0|                    }
  381|     39|                }
  382|     39|                if (bNotEmpty)
  ------------------
  |  Branch (382:21): [True: 39, False: 0]
  ------------------
  383|     39|                {
  384|     39|                    MakeMult( mult + 1, "*", strbuf, 0, bOverflow );
  385|       |                    /* H-atoms */
  386|     39|                    len_H = MakeHString( 0, pINChI_Prev->nNum_H, pINChI_Prev->nNumberOfAtoms,
  387|     39|                        strbuf, ATOM_MODE, bOverflow );
  388|       |                    /*  tautomeric groups */
  389|     39|                    MakeTautString( pINChI_Prev->nTautomer, pINChI_Prev->lenTautomer, ( 0 != len_H ),
  390|     39|                        strbuf, TAUT_MODE, bOverflow );
  391|     39|                }
  392|      0|                else
  393|      0|                {
  394|      0|                    nNumEmpty++;
  395|      0|                }
  396|     39|            }
  397|     39|        }
  398|     39|        pINChI_Prev = pINChI;
  399|     39|        mult = 0; /* we do not know whether the item is empty */
  400|     39|    }
  401|     39|    if (nNumEmpty == num_components && strbuf->nUsedLength > nUsedLength0)
  ------------------
  |  Branch (401:9): [True: 0, False: 39]
  |  Branch (401:40): [True: 0, False: 0]
  ------------------
  402|      0|    {
  403|      0|        strbuf->nUsedLength = nUsedLength0;
  404|      0|        strbuf->pStr[nUsedLength0] = '\0';
  405|      0|    }
  406|       |    /*
  407|       |    if ( nNumEmpty == num_components && tot_len > tot_len_inp ) {
  408|       |    tot_len = tot_len_inp;
  409|       |    strbuf->pStr[tot_len] = '\0';
  410|       |    }
  411|       |    */
  412|       |
  413|     39|    return ( strbuf->nUsedLength - nUsedLength0 );
  414|     39|}
str_Charge2:
  429|      3|{
  430|      3|    int          i, ii, ii2, nUsedLength0;
  431|      3|    INCHI_SORT   *is, *is2, *is0, *is20;
  432|      3|    INChI        *pINChI, *pINChI_Prev, *pINChI_Taut, *pINChI_Taut_Prev;
  433|      3|    int         nTotalCharge, nTotalCharge_Prev, nTotalCharge_Taut, nTotalCharge_Taut_Prev;
  434|      3|    int          mult, eq2prev, eq2taut, eq2tautPrev, bNext;
  435|      3|    const char  *pPrevEquStr, *pCurrEquStr;
  436|      3|    int         multPrevEquStr;
  437|      3|    pINChI_Taut = NULL;
  438|      3|    pINChI_Prev = NULL;
  439|      3|    pINChI_Taut_Prev = NULL;
  440|      3|    mult = 0;
  441|      3|    bNext = 0;
  442|      3|    is = NULL;
  443|      3|    is2 = NULL;
  444|      3|    is0 = pINChISort;
  445|      3|    is20 = bSecondNonTautPass ? pINChISort2 : NULL;
  ------------------
  |  Branch (445:12): [True: 0, False: 3]
  ------------------
  446|      3|    eq2taut = 0; /* may be non-zero only on the 2nd (non-taut) pass */
  447|      3|    eq2tautPrev = 1; /* pINChI_Prev (previous pINChI) does not exist */
  448|      3|    pPrevEquStr = NULL; /*, *pCurrEquStr;*/
  449|      3|    multPrevEquStr = 0;
  450|      3|    nUsedLength0 = strbuf->nUsedLength;
  451|       |
  452|       |    /* For each connected component...    */
  453|      9|    for (i = 0; i <= num_components; i++)
  ------------------
  |  Branch (453:17): [True: 6, False: 3]
  ------------------
  454|      6|    {
  455|       |
  456|       |        /* 1st (taut) pass: bOutType=OUT_TN  ; 2nd (non-taut pass) bOutType=OUT_NT */
  457|      6|        pINChI = ( i < num_components && ( is = is0 + i, 0 <= ( ii = GET_II( bOutType, is ) ) ) ) ? is->pINChI[ii] : NULL;
  ------------------
  |  |   73|      3|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  585|      3|#define OUT_N1              0    /* non-tautomeric only */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (73:22): [True: 0, False: 3]
  |  |  ------------------
  |  |   74|      3|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  586|      6|#define OUT_T1              1    /* tautomeric if present otherwise non-tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  588|      6|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   63|      3|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      3|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      3|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (63:20): [True: 3, False: 0]
  |  |  |  |  |  Branch (63:43): [True: 3, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      3|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   65|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (65:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (65:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (74:23): [True: 0, False: 3]
  |  |  |  Branch (74:36): [True: 3, False: 0]
  |  |  ------------------
  |  |   75|      3|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  590|      0|#define OUT_NN              4    /* only non-taut representations: non-taut else tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (75:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   76|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  587|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   68|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (68:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (76:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (457:20): [True: 3, False: 3]
  |  Branch (457:42): [True: 3, False: 0]
  ------------------
  458|       |        /*================ compare sp3 to previous =====================*/
  459|      6|        if (bSecondNonTautPass)
  ------------------
  |  Branch (459:13): [True: 0, False: 6]
  ------------------
  460|      0|        {
  461|       |            /* component that was output on the 1st pass */
  462|      0|            pINChI_Taut = ( i < num_components && ( is2 = is20 + i, 0 <= ( ii2 = GET_II( OUT_T1, is2 ) ) ) ) ? is2->pINChI[ii2] : NULL;
  ------------------
  |  |   73|      0|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  585|      0|#define OUT_N1              0    /* non-tautomeric only */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (73:22): [Folded - Ignored]
  |  |  ------------------
  |  |   74|      0|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  586|      0|#define OUT_T1              1    /* tautomeric if present otherwise non-tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  588|      0|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   63|      0|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (63:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (63:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   65|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (65:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (65:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (74:23): [Folded - Ignored]
  |  |  |  Branch (74:36): [Folded - Ignored]
  |  |  ------------------
  |  |   75|      0|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  590|      0|#define OUT_NN              4    /* only non-taut representations: non-taut else tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (75:22): [Folded - Ignored]
  |  |  ------------------
  |  |   76|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  587|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   68|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (68:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (76:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (462:29): [True: 0, False: 0]
  |  Branch (462:51): [True: 0, False: 0]
  ------------------
  463|      0|        }
  464|       |        /*========= if bSecondNonTautPass then compare non-iso non-taut stereo to non-iso taut ========*/
  465|      6|        eq2taut = 0;
  466|      6|        if (!eq2taut && bSecondNonTautPass && bOmitRepetitions)
  ------------------
  |  Branch (466:13): [True: 6, False: 0]
  |  Branch (466:25): [True: 0, False: 6]
  |  Branch (466:47): [True: 0, False: 0]
  ------------------
  467|      0|        {
  468|      0|            eq2taut = pINChI && pINChI_Taut && !pINChI_Taut->bDeleted &&
  ------------------
  |  Branch (468:23): [True: 0, False: 0]
  |  Branch (468:33): [True: 0, False: 0]
  |  Branch (468:48): [True: 0, False: 0]
  ------------------
  469|      0|                ( nTotalCharge = pINChI->nTotalCharge ) && ( nTotalCharge_Taut = pINChI_Taut->nTotalCharge ) &&
  ------------------
  |  Branch (469:17): [True: 0, False: 0]
  |  Branch (469:60): [True: 0, False: 0]
  ------------------
  470|      0|                nTotalCharge == nTotalCharge_Taut;
  ------------------
  |  Branch (470:17): [True: 0, False: 0]
  ------------------
  471|      0|            eq2taut = eq2taut ? ( iiEQU | iitNONTAUT ) : 0;
  ------------------
  |  |   86|      0|#define iiEQU         0x0008  /* equivalence info */
  ------------------
                          eq2taut = eq2taut ? ( iiEQU | iitNONTAUT ) : 0;
  ------------------
  |  |   93|      0|#define iitNONTAUT   0x0020  /* Non-tautomeric */
  ------------------
  |  Branch (471:23): [True: 0, False: 0]
  ------------------
  472|      0|        }
  473|      6|        if (eq2taut)
  ------------------
  |  Branch (473:13): [True: 0, False: 6]
  ------------------
  474|      0|        {
  475|       |            /* we may be here only in case of the second (non-taut) pass */
  476|       |            /* current non-taut stereo has been found to be same as tautomeric */
  477|      0|            if (pINChI_Prev && pINChI_Prev->nNumberOfAtoms)
  ------------------
  |  Branch (477:17): [True: 0, False: 0]
  |  Branch (477:32): [True: 0, False: 0]
  ------------------
  478|      0|            {
  479|       |                /* previous component exists; output it */
  480|      0|                if (bNext++)
  ------------------
  |  Branch (480:21): [True: 0, False: 0]
  ------------------
  481|      0|                {
  482|      0|                    MakeDelim( sCompDelim, strbuf, bOverflow );
  483|      0|                }
  484|      0|                if (nTotalCharge_Prev = pINChI_Prev->nTotalCharge)
  ------------------
  |  Branch (484:21): [True: 0, False: 0]
  ------------------
  485|      0|                {
  486|      0|                    MakeMult( mult + 1, "*", strbuf, 0, bOverflow );
  487|      0|                    inchi_strbuf_printf( strbuf, "%+d", nTotalCharge_Prev );
  488|      0|                }
  489|      0|            }
  490|      0|            else
  491|      0|            {
  492|      0|                if (pINChI_Taut_Prev && pINChI_Taut_Prev->nNumberOfAtoms && !pINChI_Taut_Prev->bDeleted)
  ------------------
  |  Branch (492:21): [True: 0, False: 0]
  |  Branch (492:41): [True: 0, False: 0]
  |  Branch (492:77): [True: 0, False: 0]
  ------------------
  493|      0|                {
  494|       |                    /* previous non-taut component exists only in taut list */
  495|      0|                    if (bNext++)
  ------------------
  |  Branch (495:25): [True: 0, False: 0]
  ------------------
  496|      0|                    {
  497|      0|                        MakeDelim( sCompDelim, strbuf, bOverflow );
  498|      0|                    }
  499|      0|                }
  500|      0|            }
  501|       |            /* we have found pINChI->nTotalCharge same as in pINChI_Taut */
  502|       |            /* output this (current) equivalence as '*', that is, same as tautomeric */
  503|       |            /* that was printed on the 1st pass. */
  504|       |
  505|      0|            pCurrEquStr = EquString( eq2taut );
  506|      0|            if (multPrevEquStr && pPrevEquStr)
  ------------------
  |  Branch (506:17): [True: 0, False: 0]
  |  Branch (506:35): [True: 0, False: 0]
  ------------------
  507|      0|            {
  508|      0|                if (pCurrEquStr && !strcmp( pCurrEquStr, pPrevEquStr ))
  ------------------
  |  Branch (508:21): [True: 0, False: 0]
  |  Branch (508:36): [True: 0, False: 0]
  ------------------
  509|      0|                {
  510|      0|                    multPrevEquStr++;
  511|      0|                }
  512|      0|                else
  513|      0|                {
  514|       |                    /* new EqStr is different; output it */
  515|      0|                    if (bNext++)
  ------------------
  |  Branch (515:25): [True: 0, False: 0]
  ------------------
  516|      0|                    {
  517|      0|                        MakeDelim( sCompDelim, strbuf, bOverflow );
  518|      0|                    }
  519|      0|                    MakeEqStr( pPrevEquStr, multPrevEquStr, strbuf, bOverflow );
  520|      0|                    pPrevEquStr = pCurrEquStr;
  521|      0|                    multPrevEquStr = 1;
  522|      0|                }
  523|      0|            }
  524|      0|            else
  525|      0|            {
  526|      0|                pPrevEquStr = pCurrEquStr;
  527|      0|                multPrevEquStr = 1;
  528|      0|            }
  529|       |
  530|      0|            pINChI_Prev = NULL; /* pINChI_Prev sp2 does not exist since */
  531|      0|            pINChI_Taut_Prev = NULL; /* pINChI has just been printed */
  532|      0|            mult = 0;
  533|      0|            eq2tautPrev = 1;     /* pINChI_Prev sp2 does not exist */
  534|      0|        }
  535|      6|        else
  536|      6|        {
  537|      6|            if (eq2tautPrev)
  ------------------
  |  Branch (537:17): [True: 3, False: 3]
  ------------------
  538|      3|            {
  539|       |                /* at this point pINChI_Prev does not exist; however, pINChI */
  540|       |                /*might have been discovered and it is different from pINChI_Taut */
  541|      3|                if (multPrevEquStr && pPrevEquStr)
  ------------------
  |  Branch (541:21): [True: 0, False: 3]
  |  Branch (541:39): [True: 0, False: 0]
  ------------------
  542|      0|                {
  543|       |                    /* new EqStr is different; output it */
  544|      0|                    if (bNext++)
  ------------------
  |  Branch (544:25): [True: 0, False: 0]
  ------------------
  545|      0|                    {
  546|      0|                        MakeDelim( sCompDelim, strbuf, bOverflow );
  547|      0|                    }
  548|      0|                    MakeEqStr( pPrevEquStr, multPrevEquStr, strbuf, bOverflow );
  549|      0|                    pPrevEquStr = NULL;
  550|      0|                    multPrevEquStr = 0;
  551|      0|                }
  552|      3|                eq2tautPrev = 0;
  553|      3|                pINChI_Prev = pINChI;
  554|      3|                pINChI_Taut_Prev = pINChI_Taut;
  555|      3|                mult = 0;
  556|      3|            }
  557|      3|            else
  558|      3|            {
  559|       |                /* check whether pINChI and pINChI_Prev have non-zero identical stereo sp3 */
  560|       |                /*================ compare sp3 to previous =====================*/
  561|      3|                eq2prev = bUseMulipliers &&
  ------------------
  |  Branch (561:27): [True: 3, False: 0]
  ------------------
  562|      3|                    pINChI && pINChI_Prev &&
  ------------------
  |  Branch (562:21): [True: 0, False: 3]
  |  Branch (562:31): [True: 0, False: 0]
  ------------------
  563|      3|                    ( nTotalCharge = pINChI->nTotalCharge ) && ( nTotalCharge_Prev = pINChI_Prev->nTotalCharge ) &&
  ------------------
  |  Branch (563:21): [True: 0, False: 0]
  |  Branch (563:64): [True: 0, False: 0]
  ------------------
  564|      3|                    nTotalCharge == nTotalCharge_Prev;
  ------------------
  |  Branch (564:21): [True: 0, False: 0]
  ------------------
  565|      3|                if (eq2prev)
  ------------------
  |  Branch (565:21): [True: 0, False: 3]
  ------------------
  566|      0|                {
  567|      0|                    mult++; /* mult = (number of non-empty equal items)-1 */
  568|      0|                    continue;
  569|      0|                }
  570|      3|                else
  571|      3|                {
  572|      3|                    if (bNext++)
  ------------------
  |  Branch (572:25): [True: 0, False: 3]
  ------------------
  573|      0|                    {
  574|      0|                        MakeDelim( sCompDelim, strbuf, bOverflow );
  575|      0|                    }
  576|      3|                    if (pINChI_Prev && pINChI_Prev->nNumberOfAtoms)
  ------------------
  |  Branch (576:25): [True: 3, False: 0]
  |  Branch (576:40): [True: 3, False: 0]
  ------------------
  577|      3|                    {
  578|      3|                        if (nTotalCharge_Prev = pINChI_Prev->nTotalCharge)
  ------------------
  |  Branch (578:29): [True: 3, False: 0]
  ------------------
  579|      3|                        {
  580|       |                            /* pINChI_Prev exists and has charge info */
  581|      3|                            MakeMult( mult + 1, "*", strbuf, 0, bOverflow );
  582|      3|                            inchi_strbuf_printf( strbuf, "%+d", nTotalCharge_Prev );
  583|      3|                        }
  584|       |                        /* else charge is not present in pINChI_Prev */
  585|      3|                    }
  586|      0|                    else
  587|      0|                    {
  588|      0|                        if (bSecondNonTautPass && pINChI_Taut_Prev && pINChI_Taut_Prev->nNumberOfAtoms && !pINChI_Taut_Prev->bDeleted)
  ------------------
  |  Branch (588:29): [True: 0, False: 0]
  |  Branch (588:51): [True: 0, False: 0]
  |  Branch (588:71): [True: 0, False: 0]
  |  Branch (588:107): [True: 0, False: 0]
  ------------------
  589|      0|                        {
  590|      0|                            if (nTotalCharge_Taut_Prev = pINChI_Taut_Prev->nTotalCharge)
  ------------------
  |  Branch (590:33): [True: 0, False: 0]
  ------------------
  591|      0|                            {
  592|       |                                /* since pINChI_Prev does not exist, pINChI_Taut_Prev is non-tautomeric */
  593|       |                                /* and it has charge info. This info has already been printed in the main section */
  594|       |                                /*
  595|       |                                tot_len += MakeDelim( sIdenticalValues, strbuf, bOverflow);
  596|       |                                */
  597|      0|                                ; /* pINChI_Taut_Prev sp3 info was output in the main stereo section */
  598|      0|                            }
  599|      0|                            else
  600|      0|                            {
  601|      0|                                ; /* pINChI_Taut_Prev exists and has not sp3 info */
  602|      0|                            }
  603|      0|                        }
  604|       |#if ( bRELEASE_VERSION != 1 && defined(_DEBUG) )
  605|       |                        else
  606|       |                        {
  607|       |                            int stop = 1;   /* <BRKPT> */
  608|       |                        }
  609|       |#endif
  610|      0|                    }
  611|      3|                }
  612|      3|                pINChI_Prev = pINChI;
  613|      3|                pINChI_Taut_Prev = pINChI_Taut;
  614|      3|                mult = 0; /* we do not know whether the item is empty */
  615|      3|            }
  616|      6|        }
  617|      6|    }
  618|       |
  619|      3|    return ( strbuf->nUsedLength - nUsedLength0 );
  620|      3|}
str_IsoAtoms:
 1248|     14|{
 1249|     14|    int          i, ii, ii2, nUsedLength0;
 1250|     14|    INCHI_SORT   *is, *is2, *is0, *is20;
 1251|     14|    INChI        *pINChI, *pINChI_Prev, *pINChI_Taut, *pINChI_Taut_Prev;
 1252|     14|    int          mult, eq2prev, eq2taut, eq2tautPrev, bNext;
 1253|     14|    const char  *pPrevEquStr, *pCurrEquStr;
 1254|     14|    int         multPrevEquStr;
 1255|     14|    pINChI_Taut = NULL;
 1256|     14|    pINChI_Prev = NULL;
 1257|     14|    pINChI_Taut_Prev = NULL;
 1258|     14|    mult = 0;
 1259|     14|    bNext = 0;
 1260|     14|    is = NULL;
 1261|     14|    is2 = NULL;
 1262|     14|    is0 = pINChISort;
 1263|     14|    is20 = bSecondNonTautPass ? pINChISort2 : NULL;
  ------------------
  |  Branch (1263:12): [True: 0, False: 14]
  ------------------
 1264|     14|    eq2taut = 0; /* may be non-zero only on the 2nd (non-taut) pass */
 1265|     14|    eq2tautPrev = 1; /* pINChI_Prev (previous pINChI) does not exist */
 1266|     14|    pPrevEquStr = NULL; /*, *pCurrEquStr;*/
 1267|     14|    multPrevEquStr = 0;
 1268|     14|    nUsedLength0 = strbuf->nUsedLength;
 1269|       |
 1270|       |    /* For each connected component...    */
 1271|     42|    for (i = 0; i <= num_components; i++)
  ------------------
  |  Branch (1271:17): [True: 28, False: 14]
  ------------------
 1272|     28|    {
 1273|       |
 1274|       |        /* 1st (taut) pass: bOutType=OUT_TN  ; 2nd (non-taut pass) bOutType=OUT_NT */
 1275|     28|        pINChI = ( i < num_components && ( is = is0 + i, 0 <= ( ii = GET_II( bOutType, is ) ) ) ) ? is->pINChI[ii] : NULL;
  ------------------
  |  |   73|     14|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  585|     14|#define OUT_N1              0    /* non-tautomeric only */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (73:22): [True: 0, False: 14]
  |  |  ------------------
  |  |   74|     14|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  586|     28|#define OUT_T1              1    /* tautomeric if present otherwise non-tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  588|     28|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   63|     14|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|     14|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|     14|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (63:20): [True: 14, False: 0]
  |  |  |  |  |  Branch (63:43): [True: 14, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|     14|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   65|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (65:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (65:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (74:23): [True: 0, False: 14]
  |  |  |  Branch (74:36): [True: 14, False: 0]
  |  |  ------------------
  |  |   75|     14|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  590|      0|#define OUT_NN              4    /* only non-taut representations: non-taut else tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (75:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   76|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  587|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   68|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (68:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (76:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1275:20): [True: 14, False: 14]
  |  Branch (1275:42): [True: 14, False: 0]
  ------------------
 1276|       |        /*================ compare isotopic info to previous component =====================*/
 1277|     28|        if (bSecondNonTautPass)
  ------------------
  |  Branch (1277:13): [True: 0, False: 28]
  ------------------
 1278|      0|        {
 1279|       |            /* component that was output on the 1st pass */
 1280|      0|            pINChI_Taut = ( i < num_components && ( is2 = is20 + i, 0 <= ( ii2 = GET_II( OUT_T1, is2 ) ) ) ) ? is2->pINChI[ii2] : NULL;
  ------------------
  |  |   73|      0|#define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  585|      0|#define OUT_N1              0    /* non-tautomeric only */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define GET_II(M,S) ((M==OUT_N1)?              (HAS_TN(S)? TAUT_YES : HAS_NN(S)? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (73:22): [Folded - Ignored]
  |  |  ------------------
  |  |   74|      0|                     (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  586|      0|#define OUT_T1              1    /* tautomeric if present otherwise non-tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  588|      0|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   63|      0|#define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_T(S)  (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (63:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (63:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |   65|      0|#define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_N(S)  (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (65:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (65:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_T1 || M==OUT_TN)? (HAS_T(S) ? TAUT_YES : HAS_N(S) ? TAUT_NON : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (74:23): [Folded - Ignored]
  |  |  |  Branch (74:36): [Folded - Ignored]
  |  |  ------------------
  |  |   75|      0|                     (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  590|      0|#define OUT_NN              4    /* only non-taut representations: non-taut else tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |   70|      0|#define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TN(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && !S->pINChI[TAUT_YES]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (70:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (70:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NN)?              (HAS_NN(S)? TAUT_NON : HAS_TN(S)? TAUT_YES : -1): \
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (75:22): [Folded - Ignored]
  |  |  ------------------
  |  |   76|      0|                     (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  587|      0|#define OUT_NT              2    /* only non-taut representations of tautomeric */
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   68|      0|#define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_TT(S) (S->pINChI[TAUT_YES] && S->pINChI[TAUT_YES]->nNumberOfAtoms && S->pINChI[TAUT_YES]->lenTautomer>0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (68:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (68:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |   72|      0|#define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |               #define HAS_NN(S) (S->pINChI[TAUT_NON] && S->pINChI[TAUT_NON]->nNumberOfAtoms && !S->pINChI[TAUT_NON]->lenTautomer)
  |  |  |  |  ------------------
  |  |  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (72:20): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (72:82): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                    (M==OUT_NT)?              ((HAS_TT(S) && HAS_NN(S))       ? TAUT_NON : -1) : -1)
  |  |  ------------------
  |  |  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  |  |  ------------------
  |  |  |  Branch (76:22): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (1280:29): [True: 0, False: 0]
  |  Branch (1280:51): [True: 0, False: 0]
  ------------------
 1281|      0|        }
 1282|       |        /*========= if bSecondNonTautPass then compare iso non-taut to taut non-iso ========*/
 1283|     28|        eq2taut = 0;
 1284|     28|        if (!eq2taut && bSecondNonTautPass && bOmitRepetitions)
  ------------------
  |  Branch (1284:13): [True: 28, False: 0]
  |  Branch (1284:25): [True: 0, False: 28]
  |  Branch (1284:47): [True: 0, False: 0]
  ------------------
 1285|      0|        {
 1286|      0|            eq2taut = Eql_INChI_Isotopic( pINChI, pINChI_Taut );
 1287|      0|            eq2taut = eq2taut ? ( iiNUMB | iitNONTAUT ) : 0;
  ------------------
  |  |   85|      0|#define iiNUMB        0x0004  /* numbering or inverted stereo numbering */
  ------------------
                          eq2taut = eq2taut ? ( iiNUMB | iitNONTAUT ) : 0;
  ------------------
  |  |   93|      0|#define iitNONTAUT   0x0020  /* Non-tautomeric */
  ------------------
  |  Branch (1287:23): [True: 0, False: 0]
  ------------------
 1288|      0|        }
 1289|     28|        if (eq2taut)
  ------------------
  |  Branch (1289:13): [True: 0, False: 28]
  ------------------
 1290|      0|        {
 1291|       |            /* we may be here only in case of the second (non-taut) pass */
 1292|       |            /* current non-taut isotopic info has been found to be same as current tautomeric */
 1293|      0|            if (pINChI_Prev && pINChI_Prev->nNumberOfAtoms)
  ------------------
  |  Branch (1293:17): [True: 0, False: 0]
  |  Branch (1293:32): [True: 0, False: 0]
  ------------------
 1294|      0|            {
 1295|       |                /* previous component exists; output it */
 1296|      0|                if (bNext++)
  ------------------
  |  Branch (1296:21): [True: 0, False: 0]
  ------------------
 1297|      0|                {
 1298|      0|                    MakeDelim( sCompDelim, strbuf, bOverflow );
 1299|      0|                }
 1300|      0|                if (pINChI_Prev && ( pINChI_Prev->nNumberOfIsotopicAtoms > 0 ||
  ------------------
  |  Branch (1300:21): [True: 0, False: 0]
  |  Branch (1300:38): [True: 0, False: 0]
  ------------------
 1301|      0|                    pINChI_Prev->nNumberOfIsotopicTGroups > 0 ))
  ------------------
  |  Branch (1301:21): [True: 0, False: 0]
  ------------------
 1302|      0|                {
 1303|       |                    /* non-empty item */
 1304|      0|                    MakeMult( mult + 1, "*", strbuf, 0, bOverflow );
 1305|       |                    /*  Isotopic atoms */
 1306|      0|                    if (pINChI_Prev->nNumberOfIsotopicAtoms > 0/* && nStrLen-tot_len > 2*/ && !*bOverflow)
  ------------------
  |  Branch (1306:25): [True: 0, False: 0]
  |  Branch (1306:95): [True: 0, False: 0]
  ------------------
 1307|      0|                    { /* dereferenced bOverflow 2004-06-07 */
 1308|      0|                        MakeIsoAtomString( pINChI_Prev->IsotopicAtom,
 1309|      0|                            pINChI_Prev->nNumberOfIsotopicAtoms,
 1310|      0|                            strbuf,
 1311|      0|                            TAUT_MODE, bOverflow );
 1312|      0|                    }
 1313|       |                    /*  Isotopic tautomeric groups */
 1314|      0|                    if (pINChI_Prev->nNumberOfIsotopicTGroups > 0 &&
  ------------------
  |  Branch (1314:25): [True: 0, False: 0]
  ------------------
 1315|       |                        /*nStrLen-tot_len > 3 && */
 1316|      0|                        !*bOverflow)
  ------------------
  |  Branch (1316:25): [True: 0, False: 0]
  ------------------
 1317|      0|                    {
 1318|      0|                        MakeDelim( bAbcNumbers ? ITEM_DELIMETER : "(", strbuf, bOverflow );
  ------------------
  |  |   45|      0|#define ITEM_DELIMETER    ","
  ------------------
  |  Branch (1318:36): [True: 0, False: 0]
  ------------------
 1319|      0|                        MakeIsoTautString( pINChI_Prev->IsotopicTGroup, pINChI_Prev->nNumberOfIsotopicTGroups,
 1320|      0|                            strbuf, TAUT_MODE, bOverflow );
 1321|      0|                        if (!bAbcNumbers)
  ------------------
  |  Branch (1321:29): [True: 0, False: 0]
  ------------------
 1322|      0|                        {
 1323|      0|                            MakeDelim( ")", strbuf, bOverflow );
 1324|      0|                        }
 1325|      0|                    }
 1326|      0|                }
 1327|      0|            }
 1328|      0|            else
 1329|      0|            {
 1330|      0|                if (pINChI_Taut_Prev && pINChI_Taut_Prev->nNumberOfAtoms)
  ------------------
  |  Branch (1330:21): [True: 0, False: 0]
  |  Branch (1330:41): [True: 0, False: 0]
  ------------------
 1331|      0|                {
 1332|       |                    /* previous non-taut component exists only in taut list */
 1333|      0|                    if (bNext++)
  ------------------
  |  Branch (1333:25): [True: 0, False: 0]
  ------------------
 1334|      0|                    {
 1335|      0|                        MakeDelim( sCompDelim, strbuf, bOverflow );
 1336|      0|                    }
 1337|      0|                }
 1338|      0|            }
 1339|       |            /* we have found pINChI isotopic info to be same as in pINChI_Taut */
 1340|       |            /* output this (current) equivalence as '*', that is, same as tautomeric */
 1341|       |            /* that was printed on the 1st pass. */
 1342|      0|            pCurrEquStr = EquString( eq2taut );
 1343|      0|            if (multPrevEquStr && pPrevEquStr)
  ------------------
  |  Branch (1343:17): [True: 0, False: 0]
  |  Branch (1343:35): [True: 0, False: 0]
  ------------------
 1344|      0|            {
 1345|      0|                if (pCurrEquStr && !strcmp( pCurrEquStr, pPrevEquStr ))
  ------------------
  |  Branch (1345:21): [True: 0, False: 0]
  |  Branch (1345:36): [True: 0, False: 0]
  ------------------
 1346|      0|                {
 1347|      0|                    multPrevEquStr++;
 1348|      0|                }
 1349|      0|                else
 1350|      0|                {
 1351|       |                    /* new EqStr is different; output it */
 1352|      0|                    if (bNext++)
  ------------------
  |  Branch (1352:25): [True: 0, False: 0]
  ------------------
 1353|      0|                    {
 1354|      0|                        MakeDelim( sCompDelim, strbuf, bOverflow );
 1355|      0|                    }
 1356|      0|                    MakeEqStr( pPrevEquStr, multPrevEquStr, strbuf, bOverflow );
 1357|      0|                    pPrevEquStr = pCurrEquStr;
 1358|      0|                    multPrevEquStr = 1;
 1359|      0|                }
 1360|      0|            }
 1361|      0|            else
 1362|      0|            {
 1363|      0|                pPrevEquStr = pCurrEquStr;
 1364|      0|                multPrevEquStr = 1;
 1365|      0|            }
 1366|      0|            pINChI_Prev = NULL; /* pINChI_Prev isotopic info does not exist since */
 1367|      0|            pINChI_Taut_Prev = NULL; /* pINChI has just been printed */
 1368|      0|            mult = 0;
 1369|      0|            eq2tautPrev = 1;     /* pINChI_Prev isotopic info does not exist */
 1370|      0|        }
 1371|     28|        else
 1372|     28|            if (eq2tautPrev)
  ------------------
  |  Branch (1372:17): [True: 14, False: 14]
  ------------------
 1373|     14|            {
 1374|       |                /* at this point pINChI_Prev does not exist; however, pINChI */
 1375|       |                /* might have been discovered and it is different from pINChI_Taut */
 1376|     14|                if (multPrevEquStr && pPrevEquStr)
  ------------------
  |  Branch (1376:21): [True: 0, False: 14]
  |  Branch (1376:39): [True: 0, False: 0]
  ------------------
 1377|      0|                {
 1378|       |                    /* new EqStr is different; output it */
 1379|      0|                    if (bNext++)
  ------------------
  |  Branch (1379:25): [True: 0, False: 0]
  ------------------
 1380|      0|                    {
 1381|      0|                        MakeDelim( sCompDelim, strbuf, bOverflow );
 1382|      0|                    }
 1383|      0|                    MakeEqStr( pPrevEquStr, multPrevEquStr, strbuf, bOverflow );
 1384|      0|                    pPrevEquStr = NULL;
 1385|      0|                    multPrevEquStr = 0;
 1386|      0|                }
 1387|     14|                eq2tautPrev = 0;
 1388|     14|                pINChI_Prev = pINChI;
 1389|     14|                pINChI_Taut_Prev = pINChI_Taut;
 1390|     14|                mult = 0;
 1391|     14|            }
 1392|     14|            else
 1393|     14|            {
 1394|       |                /*================ compare iso composition to previous =====================*/
 1395|       |                /* check whether pINChI and pINChI_Prev have non-zero identical isotopic info */
 1396|     14|                eq2prev = bUseMulipliers && Eql_INChI_Isotopic( pINChI, pINChI_Prev );
  ------------------
  |  Branch (1396:27): [True: 14, False: 0]
  |  Branch (1396:45): [True: 0, False: 14]
  ------------------
 1397|     14|                if (eq2prev)
  ------------------
  |  Branch (1397:21): [True: 0, False: 14]
  ------------------
 1398|      0|                {
 1399|      0|                    mult++; /* mult = (number of non-empty equal items)-1 */
 1400|      0|                    continue;
 1401|      0|                }
 1402|     14|                else
 1403|     14|                {
 1404|       |                    /* pINChI isotopic info is either different or empty. Output pINChI_Prev anyway */
 1405|     14|                    if (bNext++)
  ------------------
  |  Branch (1405:25): [True: 0, False: 14]
  ------------------
 1406|      0|                    {
 1407|      0|                        MakeDelim( sCompDelim, strbuf, bOverflow );
 1408|      0|                    }
 1409|     14|                    if (pINChI_Prev && pINChI_Prev->nNumberOfAtoms)
  ------------------
  |  Branch (1409:25): [True: 14, False: 0]
  |  Branch (1409:40): [True: 14, False: 0]
  ------------------
 1410|     14|                    {
 1411|     14|                        if (( pINChI_Prev->nNumberOfIsotopicAtoms > 0 ||
  ------------------
  |  Branch (1411:31): [True: 14, False: 0]
  ------------------
 1412|     14|                              pINChI_Prev->nNumberOfIsotopicTGroups > 0 ))
  ------------------
  |  Branch (1412:31): [True: 0, False: 0]
  ------------------
 1413|     14|                        {
 1414|       |                            /* pINChI_Prev exists and has isotopic info */
 1415|     14|                            MakeMult( mult + 1, "*", strbuf, 0, bOverflow );
 1416|       |                            /*  Isotopic atoms */
 1417|     14|                            if (pINChI_Prev->nNumberOfIsotopicAtoms > 0 &&
  ------------------
  |  Branch (1417:33): [True: 14, False: 0]
  ------------------
 1418|       |                                /*nStrLen-tot_len > 2 && */
 1419|     14|                                !*bOverflow)
  ------------------
  |  Branch (1419:33): [True: 14, False: 0]
  ------------------
 1420|     14|                            {
 1421|     14|                                MakeIsoAtomString( pINChI_Prev->IsotopicAtom,
 1422|     14|                                    pINChI_Prev->nNumberOfIsotopicAtoms,
 1423|     14|                                    strbuf, TAUT_MODE, bOverflow );
 1424|     14|                            }
 1425|       |                            /*  Isotopic tautomeric groups */
 1426|     14|                            if (pINChI_Prev->nNumberOfIsotopicTGroups > 0 &&
  ------------------
  |  Branch (1426:33): [True: 0, False: 14]
  ------------------
 1427|       |                                /*nStrLen-tot_len > 3 && */
 1428|     14|                                !*bOverflow)
  ------------------
  |  Branch (1428:33): [True: 0, False: 0]
  ------------------
 1429|      0|                            {
 1430|      0|                                MakeDelim( bAbcNumbers ? ITEM_DELIMETER : "(", strbuf, bOverflow );
  ------------------
  |  |   45|      0|#define ITEM_DELIMETER    ","
  ------------------
  |  Branch (1430:44): [True: 0, False: 0]
  ------------------
 1431|      0|                                MakeIsoTautString( pINChI_Prev->IsotopicTGroup, pINChI_Prev->nNumberOfIsotopicTGroups,
 1432|      0|                                    strbuf, TAUT_MODE, bOverflow );
 1433|      0|                                if (!bAbcNumbers)
  ------------------
  |  Branch (1433:37): [True: 0, False: 0]
  ------------------
 1434|      0|                                {
 1435|      0|                                    MakeDelim( ")", strbuf, bOverflow );
 1436|      0|                                }
 1437|      0|                            }
 1438|     14|                        }
 1439|       |                        /* else isotopic info is not present in pINChI_Prev */
 1440|     14|                    }
 1441|      0|                    else
 1442|      0|                    {
 1443|      0|                        if (bSecondNonTautPass && pINChI_Taut_Prev && pINChI_Taut_Prev->nNumberOfAtoms)
  ------------------
  |  Branch (1443:29): [True: 0, False: 0]
  |  Branch (1443:51): [True: 0, False: 0]
  |  Branch (1443:71): [True: 0, False: 0]
  ------------------
 1444|      0|                        {
 1445|      0|                            if (( pINChI_Taut_Prev->nNumberOfIsotopicAtoms > 0 ||
  ------------------
  |  Branch (1445:35): [True: 0, False: 0]
  ------------------
 1446|      0|                                  pINChI_Taut_Prev->nNumberOfIsotopicTGroups > 0 ))
  ------------------
  |  Branch (1446:35): [True: 0, False: 0]
  ------------------
 1447|      0|                            {
 1448|       |                                /* since pINChI_Prev does not exist, pINChI_Taut_Prev is non-tautomeric */
 1449|       |                                /* and it has non-trivial isotopic info */
 1450|       |                                /*
 1451|       |                                tot_len += MakeDelim( sIdenticalValues, strbuf, bOverflow);
 1452|       |                                */
 1453|      0|                                ;/* pINChI_Taut_Prev isotopic info was output in the main isotopic section */
 1454|      0|                            }
 1455|      0|                            else
 1456|      0|                            {
 1457|      0|                                ; /* pINChI_Taut_Prev exists and has not isotopic info */
 1458|      0|                            }
 1459|      0|                        }
 1460|       |#if ( bRELEASE_VERSION != 1 && defined(_DEBUG) )
 1461|       |                        else
 1462|       |                        {
 1463|       |                            int stop = 1;   /* <BRKPT> */
 1464|       |                        }
 1465|       |#endif
 1466|      0|                    }
 1467|     14|                }
 1468|       |                /* Fix17: moved here 2004-10-08 */
 1469|     14|                pINChI_Prev = pINChI;
 1470|     14|                pINChI_Taut_Prev = pINChI_Taut;
 1471|     14|                mult = 0; /* we do not know whether the item is empty */
 1472|     14|            }
 1473|       |        /* Fix17: moved from here 2004-10-08
 1474|       |        pINChI_Prev = pINChI;
 1475|       |        pINChI_Taut_Prev = pINChI_Taut;
 1476|       |        mult = 0;
 1477|       |        */
 1478|     28|    }
 1479|       |
 1480|     14|    return ( strbuf->nUsedLength - nUsedLength0 );
 1481|     14|}

ReadWriteInChI:
  623|    454|{
  624|    454|    InpInChI OneInput;
  625|    454|    char    *strHdr = NULL;
  626|    454|    char    *szCurHdr = NULL;
  627|    454|    int num_components[INCHI_NUM];
  628|    454|    int bReqNonTaut = ( 0 != ( ( ip_inp->nMode & REQ_MODE_BASIC ) &&
  ------------------
  |  |   43|    454|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
  |  Branch (628:32): [True: 0, False: 454]
  ------------------
  629|    454|        ( ip_inp->nMode & REQ_MODE_TAUT ) ) );
  ------------------
  |  |   44|      0|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
  |  Branch (629:9): [True: 0, False: 0]
  ------------------
  630|       |    /*
  631|       |    int bReqRecmet  = (0 != ((ip->bTautFlags & TG_FLAG_RECONNECT_COORD) &&
  632|       |    (ip->bTautFlags & TG_FLAG_DISCONNECT_COORD)));
  633|       |    */
  634|    454|    int bReqStereo = ( 0 != ( ip_inp->nMode & REQ_MODE_STEREO ) );
  ------------------
  |  |   47|    454|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
  635|    454|    int bHasSomeReconnected = 0, bHasSomeFixedH = 0, bHasMetal = 0;
  636|    454|    int nModeFlagsStereo = 0, bTautFlags = 0; /* InChI creation flags modifications derived from current InChI */
  637|    454|    MODE_PIXH nModeProtonIsoExchgH[INCHI_NUM];
  638|       |
  639|    454|    NORM_CANON_FLAGS ncFlags;
  640|    454|    NORM_CANON_FLAGS *pncFlags = &ncFlags;
  641|    454|    INPUT_PARMS ip_cur, *ip;
  642|    454|    STRUCT_DATA sd_cur, *sd;
  643|       |
  644|    454|    int  pState, bStereoType;
  645|    454|    int  bReqProtonsForEachComponent = 0;
  646|    454|    int  bReqSplitOutputInChI = 0;
  647|    454|    SEGM_LINE Line;
  648|    454|    SEGM_LINE *pLine = &Line;
  649|    454|    long          ulProcessingTime = 0;
  650|    454|    inchiTime     ulTStart;
  651|    454|    long          num_processed = 0, num_errors = 0;
  652|    454|    int  bPlainTabbedOutput;
  653|    454|    const char *pTAB;
  654|       |
  655|    454|    long num_inp = 0;
  656|       |
  657|    454|    int read_inchi_ok = 0;
  658|    454|    int end_of_data_reached = 0;
  659|    454|    int treat_save_opt = 0;
  660|    454|    int input_is_stdinchi = 0;
  661|    454|    int input_has_save_opt = 0;
  662|    454|    unsigned char input_save_opt_bits = 0;
  663|    454|    unsigned char save_opt_bits = 0;
  664|       |
  665|    454|    const int       bInChI2Structure = 0 != ( ip_inp->bReadInChIOptions & READ_INCHI_TO_STRUCTURE );
  ------------------
  |  |  988|    454|#define READ_INCHI_TO_STRUCTURE          0x00000008
  ------------------
  666|    454|    const int       bInChI2InChI = 0 != ( ip_inp->bReadInChIOptions & READ_INCHI_OUTPUT_INCHI );
  ------------------
  |  |  985|    454|#define READ_INCHI_OUTPUT_INCHI          0x00000001
  ------------------
  667|    454|    const int       bReadCoord = bInChI2Structure;
  668|       |
  669|    454|    int  nMessageLen = MAX_MSG_LEN;
  ------------------
  |  |  444|    454|#define MAX_MSG_LEN 512
  ------------------
  670|    454|    char szMessage[MAX_MSG_LEN];
  671|    454|    int  nInitLenMessage;
  672|    454|    int invalid_opt = 0;
  673|    454|    int      j, nErr, iINChI;
  674|       |
  675|    454|    int treat_mismatch_as_error = ip_inp->bINChIOutputOptions2 & INCHI_OUT_MISMATCH_AS_ERROR;
  ------------------
  |  |  178|    454|#define INCHI_OUT_MISMATCH_AS_ERROR      0x0002 /* v. 1.05 */
  ------------------
  676|    454|    int output_error_inchi = ip_inp->bINChIOutputOptions2 & INCHI_OUT_INCHI_GEN_ERROR;
  ------------------
  |  |  177|    454|#define INCHI_OUT_INCHI_GEN_ERROR        0x0001 /* v. 1.05 */
  ------------------
  677|       |
  678|    454|    int ret = 0;
  679|    454|    int nReadStatus = RI_ERR_EOL;
  ------------------
  |  |   46|    454|#define RI_ERR_EOL     (-4)
  ------------------
  680|       |
  681|    454|    INCHI_IOSTREAM *pRealOut = pOut;
  682|       |    /* temporary output buffer pTmpOut may be used    */
  683|       |    /* locally instead of legal pOut to capture        */
  684|       |    /* InChI string which may then be recognised    */
  685|       |    /* as erratic (whence should not be finally        */
  686|       |    /* printed)        */
  687|    454|    INCHI_IOSTREAM tmpoutputstr;
  688|    454|    INCHI_IOSTREAM *pTmpOut = &tmpoutputstr;
  689|    454|    if (bInChI2Structure)
  ------------------
  |  Branch (689:9): [True: 227, False: 227]
  ------------------
  690|    227|    {
  691|    227|        inchi_ios_init( pTmpOut, INCHI_IOS_TYPE_STRING, NULL );
  ------------------
  |  | 1011|    227|#define INCHI_IOS_TYPE_STRING 1
  ------------------
  692|    227|        if (pTmpOut->s.pStr)
  ------------------
  |  Branch (692:13): [True: 0, False: 227]
  ------------------
  693|      0|            pRealOut = pTmpOut;
  694|    227|    }
  695|       |
  696|    454|    memset( szMessage, 0, sizeof( szMessage ) );
  697|    454|    memset( &OneInput, 0, sizeof( OneInput ) );
  698|    454|    memset( pLine, 0, sizeof( pLine[0] ) );
  699|    454|    if (szMsg)
  ------------------
  |  Branch (699:9): [True: 454, False: 0]
  ------------------
  700|    454|        szMsg[0] = '\0';
  701|       |
  702|    454|    OneInput.polymer = NULL;    /* v. 1.05 added */
  703|    454|    OneInput.v3000 = NULL;
  704|       |
  705|       |
  706|       |    /* Read input, InChI by InChI*/
  707|    454|    while (nReadStatus != RI_ERR_EOF)
  ------------------
  |  |   47|    454|#define RI_ERR_EOF     (0)
  ------------------
  |  Branch (707:12): [True: 454, False: 0]
  ------------------
  708|    454|    {
  709|  1.36k|        for (iINChI = 0; iINChI < INCHI_NUM; iINChI++)
  ------------------
  |  |  574|  1.36k|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (709:26): [True: 908, False: 454]
  ------------------
  710|    908|        {
  711|  2.72k|            for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  578|  2.72k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (711:25): [True: 1.81k, False: 908]
  ------------------
  712|  1.81k|            {
  713|  1.81k|                if (OneInput.nNumProtons[iINChI][j].pNumProtons)
  ------------------
  |  Branch (713:21): [True: 0, False: 1.81k]
  ------------------
  714|      0|                {
  715|      0|                    inchi_free( OneInput.nNumProtons[iINChI][j].pNumProtons );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  716|      0|                    OneInput.nNumProtons[iINChI][j].pNumProtons = NULL;
  717|      0|                }
  718|  1.81k|            }
  719|    908|        }
  720|       |
  721|    454|        memset( &OneInput, 0, sizeof( OneInput ) );
  722|    454|        memset( pncFlags, 0, sizeof( *pncFlags ) );
  723|    454|        bStereoType = 0;
  724|    454|        ip_cur = *ip_inp;
  725|    454|        ip = &ip_cur;
  726|    454|        sd_cur = *sd_inp;
  727|    454|        sd = &sd_cur;
  728|       |
  729|    454|        bReqSplitOutputInChI =
  730|    454|            0 != ( ip->bReadInChIOptions & READ_INCHI_SPLIT_OUTPUT );
  ------------------
  |  |  986|    454|#define READ_INCHI_SPLIT_OUTPUT          0x00000002
  ------------------
  731|    454|        bReqProtonsForEachComponent =
  732|    454|            bReqSplitOutputInChI &&
  ------------------
  |  Branch (732:13): [True: 0, False: 454]
  ------------------
  733|    454|            0 != ( READ_INCHI_KEEP_BALANCE_P & ip->bReadInChIOptions );
  ------------------
  |  |  987|      0|#define READ_INCHI_KEEP_BALANCE_P        0x00000004
  ------------------
  |  Branch (733:13): [True: 0, False: 0]
  ------------------
  734|    454|        bPlainTabbedOutput =
  735|    454|            0 != ( ip->bINChIOutputOptions & INCHI_OUT_TABBED_OUTPUT );
  ------------------
  |  |  167|    454|#define INCHI_OUT_TABBED_OUTPUT         0x0400   /* tab-delimited (only for plain text)     */
  ------------------
  736|       |
  737|    454|        pTAB =
  738|    454|#if ( defined(TARGET_API_LIB) || defined(TARGET_LIB_FOR_WINCHI) )
  739|    454|            "\n";
  740|       |#else
  741|       |            bPlainTabbedOutput ? "\t" : "\n";
  742|       |#endif
  743|       |
  744|       |
  745|    454|        if (bInChI2Structure)
  ------------------
  |  Branch (745:13): [True: 227, False: 227]
  ------------------
  746|    227|        {
  747|    227|            bReqStereo = 1;
  748|    227|            bReqSplitOutputInChI = 1;
  749|    227|            bReqProtonsForEachComponent = bReqNonTaut;
  750|    227|            ip->bTautFlags |= ( TG_FLAG_DISCONNECT_COORD | TG_FLAG_RECONNECT_COORD );
  ------------------
  |  |  934|    227|#define TG_FLAG_DISCONNECT_COORD         0x00000080   /* find "coord. centers" and disconnect them */
  ------------------
                          ip->bTautFlags |= ( TG_FLAG_DISCONNECT_COORD | TG_FLAG_RECONNECT_COORD );
  ------------------
  |  |  935|    227|#define TG_FLAG_RECONNECT_COORD          0x00000100   /* reconnect disconnected "coord. centers" */
  ------------------
  751|    227|            ip->nMode |= ( REQ_MODE_BASIC | REQ_MODE_TAUT | REQ_MODE_STEREO | REQ_MODE_ISO_STEREO | REQ_MODE_ISO );
  ------------------
  |  |   43|    227|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
                          ip->nMode |= ( REQ_MODE_BASIC | REQ_MODE_TAUT | REQ_MODE_STEREO | REQ_MODE_ISO_STEREO | REQ_MODE_ISO );
  ------------------
  |  |   44|    227|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
                          ip->nMode |= ( REQ_MODE_BASIC | REQ_MODE_TAUT | REQ_MODE_STEREO | REQ_MODE_ISO_STEREO | REQ_MODE_ISO );
  ------------------
  |  |   47|    227|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
                          ip->nMode |= ( REQ_MODE_BASIC | REQ_MODE_TAUT | REQ_MODE_STEREO | REQ_MODE_ISO_STEREO | REQ_MODE_ISO );
  ------------------
  |  |   48|    227|#define REQ_MODE_ISO_STEREO         0x000020    /* IS   */
  ------------------
                          ip->nMode |= ( REQ_MODE_BASIC | REQ_MODE_TAUT | REQ_MODE_STEREO | REQ_MODE_ISO_STEREO | REQ_MODE_ISO );
  ------------------
  |  |   45|    227|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
  752|       |            /* bReqRecmet  = 1; */
  753|    227|#if ( bRELEASE_VERSION == 1 )
  754|    227|            bReqNonTaut = 1; /* bReqNonTaut=0 ignores Fixed-H layer in input InChI, for testing only */
  755|    227|#endif
  756|       |            /* polymer stuff added */
  757|    227|            if (pInp->type == INCHI_IOS_TYPE_STRING)
  ------------------
  |  | 1011|    227|#define INCHI_IOS_TYPE_STRING 1
  ------------------
  |  Branch (757:17): [True: 227, False: 0]
  ------------------
  758|    227|            {
  759|    227|                int res;
  760|       |
  761|    227|                if (ip_inp->lMolfileNumber)
  ------------------
  |  Branch (761:21): [True: 0, False: 227]
  ------------------
  762|       |                    /* get here from inchi-1 main emulation mode */
  763|      0|                    num_inp = ip_inp->lMolfileNumber - 1;
  764|       |
  765|    227|                res = DetectAndExposePolymerInternals( pInp );
  766|       |                /* proceed silently for now, errs mist be uncovered further on conversion */
  767|    227|            }
  768|    227|        }
  769|       |
  770|    454|        InchiTimeGet( &ulTStart );
  771|       |
  772|       |        /* Read InChI string */
  773|    454|        nReadStatus = InChILine2Data( pInp, pLine, &strHdr, &pState, &nErr,
  774|    454|                                      OneInput.pInpInChI, OneInput.nNumComponents,
  775|    454|                                      OneInput.nNumProtons, OneInput.s,
  776|    454|                                      bReadCoord, bInChI2Structure, ip_inp->nMode,
  777|    454|                                      &input_is_stdinchi, &input_has_save_opt,
  778|    454|                                      &input_save_opt_bits,
  779|    454|                                      &OneInput.polymer, &OneInput.v3000 );
  780|       |
  781|    454|        ulProcessingTime += InchiTimeElapsed( ic, &ulTStart );
  782|       |
  783|       |#if 0
  784|       |        if (!bInChI2Structure && OneInput.polymer)
  785|       |        {
  786|       |            /* inchi2inchi for polymers: for now skip */
  787|       |            pState == IST_MOBILE_H_POLYMER;
  788|       |            nReadStatus = -2;
  789|       |        }
  790|       |#endif
  791|       |
  792|       |
  793|    454|        end_of_data_reached = nReadStatus == RI_ERR_EOL || nReadStatus == RI_ERR_EOF;
  ------------------
  |  |   46|    908|#define RI_ERR_EOL     (-4)
  ------------------
                      end_of_data_reached = nReadStatus == RI_ERR_EOL || nReadStatus == RI_ERR_EOF;
  ------------------
  |  |   47|    835|#define RI_ERR_EOF     (0)
  ------------------
  |  Branch (793:31): [True: 73, False: 381]
  |  Branch (793:60): [True: 130, False: 251]
  ------------------
  794|       |
  795|    454|        if (!bInChI2Structure)
  ------------------
  |  Branch (795:13): [True: 227, False: 227]
  ------------------
  796|    227|        {
  797|       |            /* i2i, disable polymer related */
  798|    227|            if (OneInput.polymer)
  ------------------
  |  Branch (798:17): [True: 64, False: 163]
  ------------------
  799|     64|            {
  800|     64|                pState = IST_MOBILE_H_POLYMER;
  801|     64|                nErr = RI_ERR_PROGR;
  ------------------
  |  |   45|     64|#define RI_ERR_PROGR   (-3)
  ------------------
  802|     64|            }
  803|    227|        }
  804|       |
  805|    454|        read_inchi_ok = end_of_data_reached && !nErr;
  ------------------
  |  Branch (805:25): [True: 203, False: 251]
  |  Branch (805:48): [True: 175, False: 28]
  ------------------
  806|       |
  807|       |        /* then uncommented... commented out 2020-07-10 (potentially dangerous change, needs testing (TODO: i2s for InChI=1// )*/
  808|    454|        read_inchi_ok = read_inchi_ok && 
  ------------------
  |  Branch (808:25): [True: 175, False: 279]
  ------------------
  809|    454|            (OneInput.nNumComponents[INCHI_BAS][TAUT_YES] + OneInput.nNumComponents[INCHI_BAS][TAUT_NON]);
  ------------------
  |  |  575|    175|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          (OneInput.nNumComponents[INCHI_BAS][TAUT_YES] + OneInput.nNumComponents[INCHI_BAS][TAUT_NON]);
  ------------------
  |  |  580|    175|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                          (OneInput.nNumComponents[INCHI_BAS][TAUT_YES] + OneInput.nNumComponents[INCHI_BAS][TAUT_NON]);
  ------------------
  |  |  575|    175|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          (OneInput.nNumComponents[INCHI_BAS][TAUT_YES] + OneInput.nNumComponents[INCHI_BAS][TAUT_NON]);
  ------------------
  |  |  579|    175|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (809:13): [True: 168, False: 7]
  ------------------
  810|       |        
  811|       |#if ALLOW_EMPTY_INCHI_AS_INPUT!=1
  812|       |        /* no empty InChI allowed */
  813|       |        read_inchi_ok = read_inchi_ok &&
  814|       |            ( OneInput.nNumComponents[INCHI_BAS][TAUT_YES] +
  815|       |              OneInput.nNumComponents[INCHI_BAS][TAUT_NON] );
  816|       |#endif
  817|       |#ifdef TARGET_EXE_STANDALONE
  818|       |        /*  inchi-1: we currently disable conversion of polymeric InChI (inchi2struct)
  819|       |        to anything but SDF (would it be necessary in the future?)                */
  820|       |        if (OneInput.polymer &&
  821|       |            bInChI2Structure &&
  822|       |            !(ip_inp->bINChIOutputOptions & INCHI_OUT_SDFILE_ONLY))
  823|       |        {
  824|       |            read_inchi_ok = 0;
  825|       |            nErr = RI_ERR_PROGR;
  826|       |        }
  827|       |#endif
  828|       |
  829|    454|        if (!read_inchi_ok)
  ------------------
  |  Branch (829:13): [True: 286, False: 168]
  ------------------
  830|    286|        {
  831|    286|            TreatErrorsInReadInChIString( nReadStatus, nErr, pState, ip_inp, pRealOut, pLog,
  832|    286|                                          &num_inp, &num_errors, &num_processed,
  833|    286|                                          &strHdr, &szCurHdr, &OneInput );
  834|    286|            if (nReadStatus == RI_ERR_SYNTAX || nReadStatus == RI_ERR_PROGR)
  ------------------
  |  |   44|    572|#define RI_ERR_SYNTAX  (-2)
  ------------------
                          if (nReadStatus == RI_ERR_SYNTAX || nReadStatus == RI_ERR_PROGR)
  ------------------
  |  |   45|     38|#define RI_ERR_PROGR   (-3)
  ------------------
  |  Branch (834:17): [True: 248, False: 38]
  |  Branch (834:49): [True: 3, False: 35]
  ------------------
  835|    251|            {
  836|    251|                ret = nReadStatus;
  837|    251|            }
  838|    286|        }
  839|    168|        else
  840|    168|        {
  841|       |            /* InChI has been successfully read */
  842|    168|            ret = 0;
  843|    168|            num_inp++;
  844|    168|            ip->lMolfileNumber = num_inp;
  845|    168|            bHasSomeReconnected = 0;
  846|    168|            bHasSomeFixedH = 0;
  847|       |
  848|    168|            if (pRealOut == pTmpOut)
  ------------------
  |  Branch (848:17): [True: 0, False: 168]
  ------------------
  849|      0|            {
  850|      0|                inchi_ios_reset( pRealOut );
  851|       |                /*inchi_ios_close( pRealOut );
  852|       |                inchi_ios_init( pRealOut, INCHI_IOS_TYPE_STRING, NULL );*/
  853|      0|            }
  854|       |            /* inchi_ios_print( pRealOut, ""); */
  855|       |
  856|       |            /* Does not allow conversion non-standard->standard */
  857|       |            /* (force target to be non-standard also)           */
  858|    168|            if (ip_inp->bINChIOutputOptions & INCHI_OUT_STDINCHI)
  ------------------
  |  |  173|    168|#define INCHI_OUT_STDINCHI 0x4000
  ------------------
  |  Branch (858:17): [True: 168, False: 0]
  ------------------
  859|    168|            {
  860|    168|                if (!input_is_stdinchi)
  ------------------
  |  Branch (860:21): [True: 168, False: 0]
  ------------------
  861|    168|                {
  862|       |                    /* Input InChI is a non-standard one  */
  863|    168|                    ip->bINChIOutputOptions &= ~INCHI_OUT_STDINCHI;
  ------------------
  |  |  173|    168|#define INCHI_OUT_STDINCHI 0x4000
  ------------------
  864|       |                    /*
  865|       |                    if (szCurHdr && szCurHdr[0])
  866|       |                    inchi_ios_eprint( pLog, "Warning: forced conversion to non-standard InChI for non-std input, %s\n", szCurHdr );
  867|       |                    else
  868|       |                    inchi_ios_eprint( pLog, "Warning: forced conversion to non-standard InChI for non-std input, Structure %ld\n", num_inp );
  869|       |                    */
  870|    168|                }
  871|    168|            }
  872|       |
  873|       |
  874|    168|            treat_save_opt = ip->bINChIOutputOptions & INCHI_OUT_SAVEOPT;
  ------------------
  |  |  174|    168|#define INCHI_OUT_SAVEOPT  0x8000
  ------------------
  875|       |
  876|    168|            if (treat_save_opt)
  ------------------
  |  Branch (876:17): [True: 0, False: 168]
  ------------------
  877|      0|            {
  878|      0|                PrepareSaveOptBits( ip, pLog, num_inp, szCurHdr,
  879|      0|                                    input_has_save_opt,
  880|      0|                                    input_save_opt_bits,
  881|      0|                                    &save_opt_bits );
  882|      0|            }
  883|       |
  884|       |#ifndef TARGET_API_LIB
  885|       |            /*
  886|       |            inchi_ios_eprint(stderr, "%ld: %s\r", num_inp, strHdr? strHdr : "");
  887|       |            inchi_ios_eprint(pLog,  "%ld: %s\n", num_inp, strHdr? strHdr : "");
  888|       |            */
  889|       |
  890|       |            if (!ip->bNoStructLabels &&
  891|       |                 !( bInChI2Structure && ( ip->bINChIOutputOptions & INCHI_OUT_SDFILE_ONLY ) )
  892|       |                 )
  893|       |            {
  894|       |                /* Added 2nd item: Do not output this extra line into the output SDfile. 2008-11-17 DCh */
  895|       |                if (strHdr && strstr( strHdr, "Structure:" ))
  896|       |                {
  897|       |                    inchi_ios_print( pRealOut, "%s%s", strHdr, pTAB ); /* output header */
  898|       |#if ( FIX_DALKE_BUGS == 1 )
  899|       |#else
  900|       |                    sprintf( szMessage, "%s (%ld)", strHdr ? strHdr : "", num_inp );
  901|       |#endif
  902|       |                }
  903|       |                else
  904|       |                {
  905|       |                    if (bInChI2Structure)    inchi_ios_print( pRealOut, "Structure: %ld. (%s)%s",
  906|       |                                                              num_inp, strHdr ? strHdr : "No struct name",
  907|       |                                                              pTAB ); /* output header */
  908|       |#if ( FIX_DALKE_BUGS == 1 )
  909|       |#else
  910|       |                    sprintf( szMessage, "Structure: %ld. (%s)%s", num_inp, strHdr ? strHdr : "No struct name", pTAB );
  911|       |#endif
  912|       |                }
  913|       |                if (strHdr && strHdr[0])
  914|       |                {
  915|       |                    strncpy( ip->szSdfDataHeader, strHdr, sizeof( ip->szSdfDataHeader ) );
  916|       |                    ip->szSdfDataHeader[sizeof( ip->szSdfDataHeader ) - 1] = '\0';
  917|       |                    ip->pSdfLabel = NULL;
  918|       |                    ip->pSdfValue = ip->szSdfDataHeader;
  919|       |                }
  920|       |                else
  921|       |                {
  922|       |                    ip->pSdfValue = NULL;
  923|       |                    ip->szSdfDataHeader[0] = '\0';
  924|       |                }
  925|       |            }
  926|       |
  927|       |#if ( FIX_DALKE_BUGS == 1 )
  928|       |            sprintf( szMessage, "%ld: %.400s", num_inp, strHdr ? strHdr : "" );
  929|       |#else
  930|       |            sprintf( szMessage, "%ld: %s", num_inp, strHdr ? strHdr : "" );
  931|       |#endif
  932|       |#endif
  933|       |
  934|    168|            nInitLenMessage = (int) strlen( szMessage );
  935|    168|            if (strHdr)
  ------------------
  |  Branch (935:17): [True: 0, False: 168]
  ------------------
  936|      0|            {
  937|      0|                szCurHdr = strHdr;
  938|      0|                strHdr = NULL;
  939|      0|            }
  940|    168|            if (szCurHdr && ip && ip->first_struct_number > 0)
  ------------------
  |  Branch (940:17): [True: 0, False: 168]
  |  Branch (940:29): [True: 0, False: 0]
  |  Branch (940:35): [True: 0, False: 0]
  ------------------
  941|      0|            {
  942|       |                /* Check whether the structure should be skipped */
  943|      0|                static const char szStruct[] = "Structure:";
  944|      0|                char *pStrNum = strstr( szCurHdr, szStruct );
  945|      0|                long cur_struct_number;
  946|      0|                if (pStrNum)
  ------------------
  |  Branch (946:21): [True: 0, False: 0]
  ------------------
  947|      0|                {
  948|      0|                    pStrNum += sizeof( szStruct ) - 1; /* -1 takes care of the string terminal zero */
  949|      0|                    cur_struct_number = inchi_strtol( pStrNum, NULL, 10 );
  950|      0|                    if (cur_struct_number)
  ------------------
  |  Branch (950:25): [True: 0, False: 0]
  ------------------
  951|      0|                    {
  952|      0|                        OneInput.num_inp = cur_struct_number;
  953|      0|                    }
  954|       |                    /* Process request to bypass first several InChIs */
  955|      0|                    if (cur_struct_number > 0 && cur_struct_number < ip->first_struct_number)
  ------------------
  |  Branch (955:25): [True: 0, False: 0]
  |  Branch (955:50): [True: 0, False: 0]
  ------------------
  956|      0|                    {
  957|       |
  958|       |#if ( !defined(TARGET_API_LIB) && !defined(TARGET_EXE_STANDALONE) )
  959|       |                        inchi_fprintf( stderr, "Skipping %s\r", szMessage );
  960|       |#endif
  961|      0|                        FreeInpInChI( &OneInput );
  962|      0|                        if (szCurHdr)
  ------------------
  |  Branch (962:29): [True: 0, False: 0]
  ------------------
  963|      0|                        {
  964|      0|                            inchi_free( szCurHdr );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  965|      0|                            szCurHdr = NULL;
  966|      0|                        }
  967|      0|                        INCHI_HEAPCHK
  968|      0|                            continue;
  969|      0|                    }
  970|      0|                }
  971|      0|            }
  972|       |
  973|    168|            num_processed++;
  974|       |
  975|       |            /* In case of splitting InChI into separate components */
  976|       |            /* decide whether to keep /p in each component or      */
  977|       |            /* output /p and /i/h as a separate component          */
  978|       |            /* Note: if InChI is not to be splitted DO NOT create  */
  979|       |            /* a separate component for /p, /i/h: it would be a bug*/
  980|       |
  981|    168|            InchiTimeGet( &ulTStart );
  982|       |
  983|       |            INCHI_HEAPCHK
  984|       |
  985|    168|            ret = SetProtonsAndXchgIsoH( bInChI2Structure, bReqSplitOutputInChI,
  986|    168|                                             bReqProtonsForEachComponent, bReqNonTaut, bReqStereo,
  987|    168|                                             num_components, nModeProtonIsoExchgH, &OneInput );
  988|    168|            INCHI_HEAPCHK
  989|       |
  990|    168|                if (ret < 0)
  ------------------
  |  Branch (990:21): [True: 0, False: 168]
  ------------------
  991|      0|                {
  992|      0|                    num_errors++;
  993|      0|                    goto exit_error;
  994|      0|                }
  995|       |
  996|    168|            sd->num_components[INCHI_BAS] = num_components[INCHI_BAS];
  ------------------
  |  |  575|    168|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          sd->num_components[INCHI_BAS] = num_components[INCHI_BAS];
  ------------------
  |  |  575|    168|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  997|    168|            sd->num_components[INCHI_REC] = num_components[INCHI_REC];
  ------------------
  |  |  576|    168|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                          sd->num_components[INCHI_REC] = num_components[INCHI_REC];
  ------------------
  |  |  576|    168|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  998|       |
  999|       |            /* Do we have reconnected InChI ? */
 1000|    168|            if (( OneInput.nNumComponents[INCHI_REC][TAUT_YES] ||
  ------------------
  |  |  576|    168|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                          if (( OneInput.nNumComponents[INCHI_REC][TAUT_YES] ||
  ------------------
  |  |  580|    168|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1000:19): [True: 0, False: 168]
  ------------------
 1001|    168|                  OneInput.nNumComponents[INCHI_REC][TAUT_NON] ) &&
  ------------------
  |  |  576|    168|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                                OneInput.nNumComponents[INCHI_REC][TAUT_NON] ) &&
  ------------------
  |  |  579|    168|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1001:19): [True: 0, False: 168]
  ------------------
 1002|    168|                  ( ip->bTautFlags & TG_FLAG_RECONNECT_COORD ) &&
  ------------------
  |  |  935|      0|#define TG_FLAG_RECONNECT_COORD          0x00000100   /* reconnect disconnected "coord. centers" */
  ------------------
  |  Branch (1002:19): [True: 0, False: 0]
  ------------------
 1003|    168|                 ( ip->bTautFlags & TG_FLAG_DISCONNECT_COORD )
  ------------------
  |  |  934|      0|#define TG_FLAG_DISCONNECT_COORD         0x00000080   /* find "coord. centers" and disconnect them */
  ------------------
  |  Branch (1003:18): [True: 0, False: 0]
  ------------------
 1004|    168|                 )
 1005|      0|            {
 1006|       |                /* needed for InChI string output to include reconnected InChI */
 1007|      0|                sd->bTautFlagsDone[0] |= TG_FLAG_DISCONNECT_COORD_DONE;
  ------------------
  |  |  972|      0|#define TG_FLAG_DISCONNECT_COORD_DONE    0x00000100   /* found and disconnected "coord. centers" */
  ------------------
 1008|      0|                bHasSomeReconnected = 1;
 1009|      0|            }
 1010|       |
 1011|       |            /* Do we have fixed H InChI ? */
 1012|    168|            if (bReqNonTaut &&
  ------------------
  |  Branch (1012:17): [True: 88, False: 80]
  ------------------
 1013|       |                 /*OneInput.nNumComponents[bHasSomeReconnected?INCHI_REC:INCHI_BAS][TAUT_NON]*/
 1014|    168|                ( OneInput.nNumComponents[INCHI_REC][TAUT_NON] ||
  ------------------
  |  |  576|     88|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                              ( OneInput.nNumComponents[INCHI_REC][TAUT_NON] ||
  ------------------
  |  |  579|     88|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1014:19): [True: 0, False: 88]
  ------------------
 1015|     88|                  OneInput.nNumComponents[INCHI_BAS][TAUT_NON] ))
  ------------------
  |  |  575|     88|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                                OneInput.nNumComponents[INCHI_BAS][TAUT_NON] ))
  ------------------
  |  |  579|     88|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1015:19): [True: 20, False: 68]
  ------------------
 1016|     20|            {
 1017|     20|                bHasSomeFixedH = 1;
 1018|     20|            }
 1019|       |
 1020|    168|            ulProcessingTime += InchiTimeElapsed( ic, &ulTStart );
 1021|       |
 1022|    168|            invalid_opt = ( !bInChI2Structure && !bInChI2InChI ) ||
  ------------------
  |  Branch (1022:29): [True: 80, False: 88]
  |  Branch (1022:50): [True: 0, False: 80]
  ------------------
 1023|    168|                ( bInChI2Structure  &&  bInChI2InChI );
  ------------------
  |  Branch (1023:19): [True: 88, False: 80]
  |  Branch (1023:41): [True: 0, False: 88]
  ------------------
 1024|       |
 1025|    168|            if (invalid_opt)
  ------------------
  |  Branch (1025:17): [True: 0, False: 168]
  ------------------
 1026|      0|            {
 1027|      0|                inchi_ios_eprint( pLog, "\nWrong command line options: expected Inch2Struct or Inchi2Inchi\n", num_inp );
 1028|      0|                break;
 1029|      0|            }
 1030|       |
 1031|       |            /* InChI --> Structure */
 1032|    168|            else if (bInChI2Structure)
  ------------------
  |  Branch (1032:22): [True: 88, False: 80]
  ------------------
 1033|     88|            {
 1034|     88|                char *result_string;
 1035|       |
 1036|     88|                if (OneInput.polymer && OneInput.polymer->n)
  ------------------
  |  Branch (1036:21): [True: 8, False: 80]
  |  Branch (1036:41): [True: 8, False: 0]
  ------------------
 1037|      8|                {
 1038|      8|                    OneInput.valid_polymer = 1;
 1039|      8|                }
 1040|       |
 1041|     88|                ret = ConvertInChI2Struct( ip_inp, ip, &OneInput,
 1042|     88|                                           at, num_at,
 1043|     88|                                           polymer, v3000,
 1044|     88|                                           pRealOut, pLog,
 1045|     88|                                           sd, num_components, nModeProtonIsoExchgH,
 1046|     88|                                           &szCurHdr, szMsg, nMsgLen, szMessage,
 1047|     88|                                           nInitLenMessage, nMessageLen,
 1048|     88|                                           input_is_stdinchi, bHasSomeReconnected,
 1049|     88|                                           bHasSomeFixedH, bHasMetal,
 1050|     88|                                           nModeFlagsStereo, bTautFlags, bReqNonTaut,
 1051|     88|                                           WarningFlags, num_inp, &num_errors,
 1052|     88|                                           save_opt_bits, &ulTStart, &ulProcessingTime,
 1053|     88|                                           ic, pCG );
 1054|       |
 1055|     88|                result_string = pRealOut->s.pStr;
 1056|     88|                if (ret == 0)        /* no problems */
  ------------------
  |  Branch (1056:21): [True: 31, False: 57]
  ------------------
 1057|     31|                {
 1058|     31|                    ;
 1059|     31|                }
 1060|     57|                else if (ret > 0)
  ------------------
  |  Branch (1060:26): [True: 0, False: 57]
  ------------------
 1061|      0|                {
 1062|       |                    /* error */
 1063|      0|                    if (output_error_inchi)
  ------------------
  |  Branch (1063:25): [True: 0, False: 0]
  ------------------
 1064|      0|                    {
 1065|       |                        /* emit error string */
 1066|      0|                        inchi_ios_eprint( pRealOut, "InChI creation Error!\n" );
 1067|      0|                    }
 1068|      0|                }
 1069|     57|                else if (ret < 0)
  ------------------
  |  Branch (1069:26): [True: 57, False: 0]
  ------------------
 1070|     57|                {
 1071|       |                    /* error or a mismatch possibly treated as error */
 1072|     57|                    if (ret != RI_ERR_MISMATCH)
  ------------------
  |  |   49|     57|#define RI_ERR_MISMATCH (-9)
  ------------------
  |  Branch (1072:25): [True: 57, False: 0]
  ------------------
 1073|     57|                    {
 1074|     57|                        goto exit_error;
 1075|     57|                    }
 1076|      0|                    else
 1077|      0|                    {
 1078|      0|                        if (!treat_mismatch_as_error)
  ------------------
  |  Branch (1078:29): [True: 0, False: 0]
  ------------------
 1079|      0|                        {
 1080|       |                            /* ignore mismatch, print InChI as usual */
 1081|      0|                            if (result_string)
  ------------------
  |  Branch (1081:33): [True: 0, False: 0]
  ------------------
 1082|      0|                            {
 1083|      0|                                inchi_ios_eprint( pRealOut, "%-s\n", result_string );
 1084|      0|                            }
 1085|      0|                        }
 1086|      0|                        else
 1087|      0|                        {
 1088|       |                            /* concider mismatch an error */
 1089|      0|                            if (!output_error_inchi)
  ------------------
  |  Branch (1089:33): [True: 0, False: 0]
  ------------------
 1090|      0|                            {
 1091|      0|                                ;    /* print nothing for now*/
 1092|      0|                            }
 1093|      0|                            else
 1094|      0|                            {
 1095|       |                                /* emit err string instead of InChI */
 1096|      0|                                if (result_string)
  ------------------
  |  Branch (1096:37): [True: 0, False: 0]
  ------------------
 1097|      0|                                {
 1098|       |                                    /* try to preserve header if any */
 1099|      0|                                    char *pi = strstr( result_string, "InChI=" );
 1100|      0|                                    if (pi)
  ------------------
  |  Branch (1100:41): [True: 0, False: 0]
  ------------------
 1101|      0|                                    {
 1102|      0|                                        int np = pi - result_string;
 1103|      0|                                        if (np)
  ------------------
  |  Branch (1103:45): [True: 0, False: 0]
  ------------------
 1104|      0|                                            result_string[np - 1] = '\0';
 1105|      0|                                        inchi_ios_eprint( pRealOut, "%-s\n", result_string );
 1106|      0|                                    }
 1107|      0|                                }
 1108|      0|                                inchi_ios_eprint( pRealOut, "InChICreationError!\n" ); /* emit err string  */
 1109|      0|                            }
 1110|      0|                        }
 1111|      0|                        FreeInpInChI( &OneInput );
 1112|      0|                        if (strHdr)
  ------------------
  |  Branch (1112:29): [True: 0, False: 0]
  ------------------
 1113|      0|                        {
 1114|      0|                            inchi_free( strHdr );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1115|      0|                            strHdr = NULL;
 1116|      0|                        }
 1117|      0|                        if (szCurHdr)
  ------------------
  |  Branch (1117:29): [True: 0, False: 0]
  ------------------
 1118|      0|                        {
 1119|      0|                            inchi_free( szCurHdr );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1120|      0|                            szCurHdr = NULL;
 1121|      0|                        }
 1122|      0|                        INCHI_HEAPCHK
 1123|      0|                            continue;
 1124|      0|                    }
 1125|     57|                }
 1126|     88|            }    /* ( bInChI2Structure )  */
 1127|       |
 1128|       |
 1129|       |            /* InChI --> InChI */
 1130|     80|            else if (bInChI2InChI)
  ------------------
  |  Branch (1130:22): [True: 80, False: 0]
  ------------------
 1131|     80|            {
 1132|     80|                ret = ConvertInChI2InChI( ip, &OneInput, pRealOut, pLog, sd,
 1133|     80|                                          num_components, nModeProtonIsoExchgH,
 1134|     80|                                          &szCurHdr, num_inp, &num_errors,
 1135|     80|                                          save_opt_bits, &ulTStart,
 1136|     80|                                          &ulProcessingTime, ic, pCG );
 1137|     80|            }
 1138|       |
 1139|    111|            if (nReadStatus == RI_ERR_EOF)
  ------------------
  |  |   47|    111|#define RI_ERR_EOF     (0)
  ------------------
  |  Branch (1139:17): [True: 76, False: 35]
  ------------------
 1140|       |#if ( FIX_ONE_LINE_INCHI_INPUT_CONVERSION_ISSUE==1 && defined(TARGET_EXE_STANDALONE) && !defined(TARGET_API_LIB) )
 1141|       |            {
 1142|       |                inchi_ios_flush(pRealOut);
 1143|       |                inchi_ios_flush2(pLog, stderr);
 1144|       |                break;
 1145|       |            }
 1146|       |#else
 1147|     76|                break;
 1148|    111|#endif
 1149|    111|        } /* InChI has been successfully read */
 1150|       |
 1151|       |
 1152|       |#ifdef TARGET_EXE_STANDALONE
 1153|       |#ifndef TARGET_API_LIB
 1154|       |        inchi_ios_flush( pRealOut );
 1155|       |        inchi_ios_flush2( pLog, stderr );
 1156|       |#endif
 1157|       |#endif
 1158|    321|#ifdef TARGET_API_LIB
 1159|    321|        break;  /* exit after the 1st structure */
 1160|    454|#endif
 1161|    454|    } /* while */
 1162|       |
 1163|    454|exit_error:
 1164|    454|    FreeInpInChI( &OneInput );
 1165|    454|    if (strHdr)
  ------------------
  |  Branch (1165:9): [True: 0, False: 454]
  ------------------
 1166|      0|    {
 1167|      0|        inchi_free( strHdr );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1168|      0|        strHdr = NULL;
 1169|      0|    }
 1170|    454|    if (pLine->str)
  ------------------
  |  Branch (1170:9): [True: 454, False: 0]
  ------------------
 1171|    454|    {
 1172|    454|        inchi_free( pLine->str );
  ------------------
  |  | 1136|    454|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 454, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1173|    454|    }
 1174|    454|    if (szCurHdr)
  ------------------
  |  Branch (1174:9): [True: 0, False: 454]
  ------------------
 1175|      0|    {
 1176|      0|        inchi_free( szCurHdr );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1177|      0|        szCurHdr = NULL;
 1178|      0|    }
 1179|       |
 1180|       |    INCHI_HEAPCHK
 1181|       |
 1182|    454|    if (sd_inp)
  ------------------
  |  Branch (1182:9): [True: 454, False: 0]
  ------------------
 1183|    454|    {
 1184|    454|        sd_inp->ulStructTime = ulProcessingTime;
 1185|    454|        sd_inp->fPtrStart = num_processed;
 1186|    454|        sd_inp->fPtrEnd = num_errors;
 1187|    454|    }
 1188|    454|    if (pRealOut == pTmpOut)
  ------------------
  |  Branch (1188:9): [True: 0, False: 454]
  ------------------
 1189|      0|    {
 1190|      0|        inchi_ios_close( pTmpOut );
 1191|      0|    }
 1192|       |
 1193|    454|    return ret;
 1194|    454|}
CountStereoTypes:
 1634|   109k|{
 1635|   109k|    INChI_Stereo *Stereo;
 1636|   109k|    int           i, ret;
 1637|   109k|    AT_NUMB       nAtNumber;
 1638|   109k|    U_CHAR        el_number;
 1639|       |
 1640|   109k|    if (!pInChI->nNumberOfAtoms || pInChI->bDeleted)
  ------------------
  |  Branch (1640:9): [True: 53.8k, False: 55.5k]
  |  Branch (1640:36): [True: 68, False: 55.4k]
  ------------------
 1641|  53.8k|    {
 1642|  53.8k|        return 0; /* no InChI */
 1643|  53.8k|    }
 1644|  55.4k|    Stereo = ( pInChI->StereoIsotopic &&
  ------------------
  |  Branch (1644:16): [True: 16, False: 55.4k]
  ------------------
 1645|  55.4k|        ( pInChI->StereoIsotopic->nNumberOfStereoBonds +
  ------------------
  |  Branch (1645:9): [True: 0, False: 16]
  ------------------
 1646|     16|          pInChI->StereoIsotopic->nNumberOfStereoCenters ) ) ? pInChI->StereoIsotopic :
 1647|  55.4k|          ( pInChI->Stereo &&
  ------------------
  |  Branch (1647:13): [True: 257, False: 55.2k]
  ------------------
 1648|  55.4k|        ( pInChI->Stereo->nNumberOfStereoBonds +
  ------------------
  |  Branch (1648:9): [True: 0, False: 257]
  ------------------
 1649|    257|          pInChI->Stereo->nNumberOfStereoCenters ) ) ? pInChI->Stereo : NULL;
 1650|  55.4k|    if (!Stereo)
  ------------------
  |  Branch (1650:9): [True: 55.4k, False: 0]
  ------------------
 1651|  55.4k|    {
 1652|  55.4k|        return 1; /* No Stereo */
 1653|  55.4k|    }
 1654|       |
 1655|       |    /* count SB and cumulenes */
 1656|      0|    for (i = 0; i < Stereo->nNumberOfStereoBonds; i++)
  ------------------
  |  Branch (1656:17): [True: 0, False: 0]
  ------------------
 1657|      0|    {
 1658|      0|        if (ATOM_PARITY_WELL_DEF( Stereo->b_parity[i] ))
  ------------------
  |  |  287|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  265|      0|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  264|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (287:38): [True: 0, False: 0]
  |  |  |  Branch (287:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1659|      0|        {
 1660|      0|            ( *num_known_SB )++;
 1661|      0|        }
 1662|      0|        else
 1663|      0|        {
 1664|      0|            ( *num_unk_und_SB )++;
 1665|      0|        }
 1666|      0|    }
 1667|       |    /* count SC and allenes */
 1668|      0|    for (i = 0; i < Stereo->nNumberOfStereoCenters; i++)
  ------------------
  |  Branch (1668:17): [True: 0, False: 0]
  ------------------
 1669|      0|    {
 1670|      0|        if (!( nAtNumber = Stereo->nNumber[i] ) || nAtNumber > pInChI->nNumberOfAtoms)
  ------------------
  |  Branch (1670:13): [True: 0, False: 0]
  |  Branch (1670:52): [True: 0, False: 0]
  ------------------
 1671|      0|        {
 1672|      0|            return RI_ERR_PROGR; /* wrong data, should never happen */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1673|      0|        }
 1674|      0|        if (ATOM_PARITY_WELL_DEF( Stereo->t_parity[i] ))
  ------------------
  |  |  287|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  265|      0|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  264|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (287:38): [True: 0, False: 0]
  |  |  |  Branch (287:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1675|      0|        {
 1676|      0|            ( *num_known_SC )++;
 1677|      0|        }
 1678|      0|        else
 1679|      0|        {
 1680|      0|            ( *num_unk_und_SC )++;
 1681|      0|        }
 1682|      0|        el_number = pInChI->nAtom[nAtNumber - 1];
 1683|      0|        if (el_number != EL_NUMBER_P && el_number != EL_NUMBER_AS)
  ------------------
  |  |   48|      0|#define EL_NUMBER_P ((U_CHAR) 15)
  ------------------
                      if (el_number != EL_NUMBER_P && el_number != EL_NUMBER_AS)
  ------------------
  |  |   51|      0|#define EL_NUMBER_AS ((U_CHAR) 33)
  ------------------
  |  Branch (1683:13): [True: 0, False: 0]
  |  Branch (1683:41): [True: 0, False: 0]
  ------------------
 1684|      0|        {
 1685|      0|            continue;
 1686|      0|        }
 1687|      0|        ret = GetNumNeighborsFromInchi( pInChI, nAtNumber );
 1688|      0|        if (ret < 0)
  ------------------
  |  Branch (1688:13): [True: 0, False: 0]
  ------------------
 1689|      0|        {
 1690|      0|            return ret;
 1691|      0|        }
 1692|      0|        if (3 == ret)
  ------------------
  |  Branch (1692:13): [True: 0, False: 0]
  ------------------
 1693|      0|        {
 1694|      0|            *num_SC_PIII += ( EL_NUMBER_P == el_number );
  ------------------
  |  |   48|      0|#define EL_NUMBER_P ((U_CHAR) 15)
  ------------------
 1695|      0|            *num_SC_AsIII += ( EL_NUMBER_AS == el_number );
  ------------------
  |  |   51|      0|#define EL_NUMBER_AS ((U_CHAR) 33)
  ------------------
 1696|      0|        }
 1697|      0|    }
 1698|       |
 1699|      0|    return 2; /* Has Stereo */
 1700|      0|}
bInpInchiComponentExists:
 1708|    304|{
 1709|    304|    if (INCHI_BAS != iInChI   && iInChI != INCHI_REC ||
  ------------------
  |  |  575|    304|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                  if (INCHI_BAS != iInChI   && iInChI != INCHI_REC ||
  ------------------
  |  |  576|    304|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (1709:9): [True: 0, False: 304]
  |  Branch (1709:34): [True: 0, False: 0]
  ------------------
 1710|    304|         TAUT_NON != bMobileH && TAUT_YES != bMobileH || k < 0)
  ------------------
  |  |  579|    304|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                       TAUT_NON != bMobileH && TAUT_YES != bMobileH || k < 0)
  ------------------
  |  |  580|    304|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1710:10): [True: 304, False: 0]
  |  Branch (1710:34): [True: 0, False: 304]
  |  Branch (1710:58): [True: 0, False: 304]
  ------------------
 1711|      0|    {
 1712|      0|        return 0;
 1713|      0|    }
 1714|       |
 1715|    304|    return ( k < pOneInput->nNumComponents[iInChI][bMobileH] &&
  ------------------
  |  Branch (1715:14): [True: 304, False: 0]
  ------------------
 1716|    304|             pOneInput->pInpInChI[iInChI][bMobileH] &&
  ------------------
  |  Branch (1716:14): [True: 304, False: 0]
  ------------------
 1717|    304|             pOneInput->pInpInChI[iInChI][bMobileH][k].nNumberOfAtoms > 0 &&
  ------------------
  |  Branch (1717:14): [True: 304, False: 0]
  ------------------
 1718|    304|             !pOneInput->pInpInChI[iInChI][bMobileH][k].bDeleted );
  ------------------
  |  Branch (1718:14): [True: 290, False: 14]
  ------------------
 1719|    304|}
bRevInchiComponentExists:
 1746|   109k|{
 1747|   109k|    if (!pStruct || /*!pStruct->at2 ||*/ !pStruct->num_atoms ||
  ------------------
  |  Branch (1747:9): [True: 0, False: 109k]
  |  Branch (1747:42): [True: 0, False: 109k]
  ------------------
 1748|   109k|         INCHI_BAS != iInChI   && iInChI != INCHI_REC ||
  ------------------
  |  |  575|   109k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                       INCHI_BAS != iInChI   && iInChI != INCHI_REC ||
  ------------------
  |  |  576|   163k|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (1748:10): [True: 54.6k, False: 54.6k]
  |  Branch (1748:35): [True: 0, False: 54.6k]
  ------------------
 1749|   109k|         TAUT_NON != bMobileH && TAUT_YES != bMobileH || k < 0)
  ------------------
  |  |  579|   109k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                       TAUT_NON != bMobileH && TAUT_YES != bMobileH || k < 0)
  ------------------
  |  |  580|   109k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1749:10): [True: 109k, False: 0]
  |  Branch (1749:34): [True: 0, False: 109k]
  |  Branch (1749:58): [True: 0, False: 109k]
  ------------------
 1750|      0|    {
 1751|      0|        return 0;
 1752|      0|    }
 1753|       |
 1754|   109k|    return ( k < pStruct->RevInChI.num_components[iInChI] &&
  ------------------
  |  Branch (1754:14): [True: 54.6k, False: 54.6k]
  ------------------
 1755|   109k|             pStruct->RevInChI.pINChI[iInChI] &&
  ------------------
  |  Branch (1755:14): [True: 54.6k, False: 0]
  ------------------
 1756|   109k|             pStruct->RevInChI.pINChI[iInChI][k][bMobileH] &&
  ------------------
  |  Branch (1756:14): [True: 54.6k, False: 0]
  ------------------
 1757|   109k|             pStruct->RevInChI.pINChI[iInChI][k][bMobileH]->nNumberOfAtoms > 0 &&
  ------------------
  |  Branch (1757:14): [True: 54.6k, False: 0]
  ------------------
 1758|   109k|             !pStruct->RevInChI.pINChI[iInChI][k][bMobileH]->bDeleted );
  ------------------
  |  Branch (1758:14): [True: 54.6k, False: 1]
  ------------------
 1759|   109k|}
DetectInpInchiCreationOptions:
 1790|     88|{
 1791|     88|    int ret = 0, bHasStereo;
 1792|     88|    int nModeFlagsValue = 0, bTautFlagsValue; /* stereo flags */
 1793|     88|    int iInChI, iMobileH, bIso, k, max_components, num_components;
 1794|     88|    INChI *pInChI;
 1795|     88|    int num_known_SB /*Stereo Bonds & Cumulenes >C==C==C==C< */;
 1796|     88|    int num_known_SC /* Stereo Centers & Allenes >C=C=C< */;
 1797|     88|    int num_unk_und_SB, num_unk_und_SC;
 1798|     88|    int num_SC_PIII, num_SC_AsIII; /* has Phosphine or Arsine stereo center(s) */
 1799|       |
 1800|     88|    *bHasReconnected = *bHasFixedH = *nModeFlagsStereo = *bTautFlagsStereo = 0;
 1801|     88|    nModeFlagsValue = bTautFlagsValue = bHasStereo = 0;
 1802|     88|    num_known_SB = num_known_SC = num_unk_und_SB = num_unk_und_SC = num_SC_PIII = num_SC_AsIII = 0;
 1803|     88|    *bHasMetal = 0;
 1804|       |
 1805|    264|    for (iInChI = 0; iInChI < INCHI_NUM; iInChI++)
  ------------------
  |  |  574|    264|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1805:22): [True: 176, False: 88]
  ------------------
 1806|    176|    {
 1807|    528|        for (iMobileH = 0; iMobileH < TAUT_NUM; iMobileH++)
  ------------------
  |  |  578|    528|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1807:28): [True: 352, False: 176]
  ------------------
 1808|    352|        {
 1809|  1.05k|            for (bIso = 1; !nModeFlagsValue && 0 <= bIso; bIso--)
  ------------------
  |  Branch (1809:28): [True: 1.05k, False: 0]
  |  Branch (1809:48): [True: 704, False: 352]
  ------------------
 1810|    704|            {
 1811|    704|                switch (pOneInput->s[iInChI][iMobileH][bIso])
  ------------------
  |  Branch (1811:25): [True: 704, False: 0]
  ------------------
 1812|    704|                {
 1813|      0|                    case 1: /* SABS */
  ------------------
  |  Branch (1813:21): [True: 0, False: 704]
  ------------------
 1814|      0|                        nModeFlagsValue |= REQ_MODE_STEREO | REQ_MODE_ISO_STEREO;
  ------------------
  |  |   47|      0|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
                                      nModeFlagsValue |= REQ_MODE_STEREO | REQ_MODE_ISO_STEREO;
  ------------------
  |  |   48|      0|#define REQ_MODE_ISO_STEREO         0x000020    /* IS   */
  ------------------
 1815|      0|                        break;
 1816|      0|                    case 2:
  ------------------
  |  Branch (1816:21): [True: 0, False: 704]
  ------------------
 1817|      0|                        nModeFlagsValue |= REQ_MODE_STEREO | REQ_MODE_ISO_STEREO | REQ_MODE_RELATIVE_STEREO;
  ------------------
  |  |   47|      0|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
                                      nModeFlagsValue |= REQ_MODE_STEREO | REQ_MODE_ISO_STEREO | REQ_MODE_RELATIVE_STEREO;
  ------------------
  |  |   48|      0|#define REQ_MODE_ISO_STEREO         0x000020    /* IS   */
  ------------------
                                      nModeFlagsValue |= REQ_MODE_STEREO | REQ_MODE_ISO_STEREO | REQ_MODE_RELATIVE_STEREO;
  ------------------
  |  |   54|      0|#define REQ_MODE_RELATIVE_STEREO    0x000200    /* REL All Relative Stereo */
  ------------------
 1818|      0|                        break;
 1819|      0|                    case 3:
  ------------------
  |  Branch (1819:21): [True: 0, False: 704]
  ------------------
 1820|      0|                        nModeFlagsValue |= REQ_MODE_STEREO | REQ_MODE_ISO_STEREO | REQ_MODE_RACEMIC_STEREO;
  ------------------
  |  |   47|      0|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
                                      nModeFlagsValue |= REQ_MODE_STEREO | REQ_MODE_ISO_STEREO | REQ_MODE_RACEMIC_STEREO;
  ------------------
  |  |   48|      0|#define REQ_MODE_ISO_STEREO         0x000020    /* IS   */
  ------------------
                                      nModeFlagsValue |= REQ_MODE_STEREO | REQ_MODE_ISO_STEREO | REQ_MODE_RACEMIC_STEREO;
  ------------------
  |  |   56|      0|#define REQ_MODE_RACEMIC_STEREO     0x000400    /* RAC All Racemic Stereo */
  ------------------
 1821|    704|                }
 1822|    704|            }
 1823|       |
 1824|    352|            max_components = pOneInput->pInpInChI[iInChI][iMobileH] ?
  ------------------
  |  Branch (1824:30): [True: 108, False: 244]
  ------------------
 1825|    244|                pOneInput->nNumComponents[iInChI][iMobileH] : 0;
 1826|       |
 1827|   109k|            for (k = num_components = 0; k < max_components; k++)
  ------------------
  |  Branch (1827:42): [True: 109k, False: 352]
  ------------------
 1828|   109k|            {
 1829|   109k|                pInChI = pOneInput->pInpInChI[iInChI][iMobileH] + k;
 1830|   109k|                ret = CountStereoTypes( pInChI,
 1831|   109k|                                        &num_known_SB, &num_known_SC,
 1832|   109k|                                        &num_unk_und_SB, &num_unk_und_SC,
 1833|   109k|                                        &num_SC_PIII, &num_SC_AsIII );
 1834|   109k|                if (ret < 0)
  ------------------
  |  Branch (1834:21): [True: 0, False: 109k]
  ------------------
 1835|      0|                {
 1836|      0|                    return ret; /* error */
 1837|      0|                }
 1838|   109k|                bHasStereo += ( ret == 2 );
 1839|   109k|                if (( ret > 0 ))
  ------------------
  |  Branch (1839:21): [True: 55.4k, False: 53.8k]
  ------------------
 1840|  55.4k|                {
 1841|       |                    /* ret == 0 => Empty InChI, 1=> No Stereo, 2=> Has Stereo */
 1842|  55.4k|                    num_components++;
 1843|  55.4k|                    *bHasReconnected |= ( iInChI == INCHI_REC );
  ------------------
  |  |  576|  55.4k|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1844|  55.4k|                    *bHasFixedH |= ( iMobileH == TAUT_NON );
  ------------------
  |  |  579|  55.4k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 1845|  55.4k|                }
 1846|   109k|                *bHasMetal |= bInChIHasReconnectedMetal( pInChI );
 1847|   109k|            }
 1848|    352|        }
 1849|    176|    }
 1850|       |
 1851|     88|    if (( nModeFlagsValue & REQ_MODE_RELATIVE_STEREO ) && ( nModeFlagsValue & REQ_MODE_RACEMIC_STEREO ))
  ------------------
  |  |   54|     88|#define REQ_MODE_RELATIVE_STEREO    0x000200    /* REL All Relative Stereo */
  ------------------
                  if (( nModeFlagsValue & REQ_MODE_RELATIVE_STEREO ) && ( nModeFlagsValue & REQ_MODE_RACEMIC_STEREO ))
  ------------------
  |  |   56|      0|#define REQ_MODE_RACEMIC_STEREO     0x000400    /* RAC All Racemic Stereo */
  ------------------
  |  Branch (1851:9): [True: 0, False: 88]
  |  Branch (1851:59): [True: 0, False: 0]
  ------------------
 1852|      0|    {
 1853|      0|        return RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 1854|      0|    }
 1855|     88|    if (bHasStereo && !nModeFlagsValue) /* REQ_MODE_SB_IGN_ALL_UU | REQ_MODE_SC_IGN_ALL_UU*/
  ------------------
  |  Branch (1855:9): [True: 0, False: 88]
  |  Branch (1855:23): [True: 0, False: 0]
  ------------------
 1856|      0|    {
 1857|       |        /* inversion does not change the stereo or no stereo at all */
 1858|      0|        nModeFlagsValue = REQ_MODE_STEREO | REQ_MODE_ISO_STEREO; /* Abs */
  ------------------
  |  |   47|      0|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
                      nModeFlagsValue = REQ_MODE_STEREO | REQ_MODE_ISO_STEREO; /* Abs */
  ------------------
  |  |   48|      0|#define REQ_MODE_ISO_STEREO         0x000020    /* IS   */
  ------------------
 1859|      0|    }
 1860|       |
 1861|     88|    if (!num_known_SB && num_unk_und_SB)
  ------------------
  |  Branch (1861:9): [True: 88, False: 0]
  |  Branch (1861:26): [True: 0, False: 88]
  ------------------
 1862|      0|    {
 1863|      0|        ; /* full SUU option or SB part of it */
 1864|      0|    }
 1865|     88|    else
 1866|     88|    {
 1867|     88|        nModeFlagsValue |= REQ_MODE_SB_IGN_ALL_UU; /* ignore Unknown/Undefind SB if no well-defined SB exist */
  ------------------
  |  |   60|     88|#define REQ_MODE_SB_IGN_ALL_UU      0x001000    /* IAUSC Ignore stereobonds if All Undef/Unknown */
  ------------------
 1868|     88|    }
 1869|       |
 1870|     88|    if (!num_known_SC && num_unk_und_SC)
  ------------------
  |  Branch (1870:9): [True: 88, False: 0]
  |  Branch (1870:26): [True: 0, False: 88]
  ------------------
 1871|      0|    {
 1872|      0|        ; /* full SUU option or SB part of it */
 1873|      0|    }
 1874|     88|    else
 1875|     88|    {
 1876|     88|        nModeFlagsValue |= REQ_MODE_SC_IGN_ALL_UU; /* ignore Unknown/Undefind SC if no well-defined SB exist */
  ------------------
  |  |   58|     88|#define REQ_MODE_SC_IGN_ALL_UU      0x000800    /* IAUSC Ignore stereocenters if All Undef/Unknown */
  ------------------
 1877|     88|    }
 1878|       |    /* Phosphine and Arsine Stereo */
 1879|     88|    if (num_SC_PIII)
  ------------------
  |  Branch (1879:9): [True: 0, False: 88]
  ------------------
 1880|      0|    {
 1881|      0|        bTautFlagsValue |= TG_FLAG_PHOSPHINE_STEREO;
  ------------------
  |  |  944|      0|#define TG_FLAG_PHOSPHINE_STEREO         0x00008000   /* add phosphine sp3 stereo */
  ------------------
 1882|      0|    }
 1883|       |    /* Phosphine and Arsine Stereo */
 1884|     88|    if (num_SC_AsIII)
  ------------------
  |  Branch (1884:9): [True: 0, False: 88]
  ------------------
 1885|      0|    {
 1886|      0|        bTautFlagsValue |= TG_FLAG_ARSINE_STEREO;
  ------------------
  |  |  945|      0|#define TG_FLAG_ARSINE_STEREO            0x00010000   /* add arsine sp3 stereo */
  ------------------
 1887|      0|    }
 1888|       |
 1889|     88|    *nModeFlagsStereo = nModeFlagsValue;
 1890|     88|    *bTautFlagsStereo = bTautFlagsValue;
 1891|       |
 1892|     88|    return 0;
 1893|     88|}
InChILine2Data:
 2263|    454|{
 2264|    454|    int iINChI, i, j, k, m, len1, len2, ret2 = 0, retAux = 0, stateAux = 0;
 2265|    454|    int ret, tot_charge[INCHI_NUM][TAUT_NUM];
 2266|    454|    int i1, i2, i3;
 2267|    454|    int kc;
 2268|    454|    NUM_ELEM *num_elem[INCHI_NUM][TAUT_NUM];
 2269|       |
 2270|       |
 2271|    454|#if ( FIX_I2I_STEREOCONVERSION_BUG == 1 )
 2272|       |    /* (2008-03-06)   1=> Fix bug of i2i conversion SAbs-->(SRel||Srac) */
 2273|       |    /*                    (converter does not placed proper stereo to output) */
 2274|       |
 2275|       |    /* set new stereo type as requested by conversion option */
 2276|    454|    int target_stereo_type = 1;
 2277|    454|    if (nMode & REQ_MODE_RELATIVE_STEREO)
  ------------------
  |  |   54|    454|#define REQ_MODE_RELATIVE_STEREO    0x000200    /* REL All Relative Stereo */
  ------------------
  |  Branch (2277:9): [True: 0, False: 454]
  ------------------
 2278|      0|    {
 2279|      0|        target_stereo_type = 2;
 2280|      0|    }
 2281|    454|    else if (nMode & REQ_MODE_RACEMIC_STEREO)
  ------------------
  |  |   56|    454|#define REQ_MODE_RACEMIC_STEREO     0x000400    /* RAC All Racemic Stereo */
  ------------------
  |  Branch (2281:14): [True: 0, False: 454]
  ------------------
 2282|      0|    {
 2283|      0|        target_stereo_type = 3;
 2284|      0|    }
 2285|    454|#endif
 2286|       |
 2287|    454|    memset( num_elem, 0, sizeof( num_elem ) );
 2288|       |
 2289|    454|    ret = ReadInChILine( pInp, pLine, pStr, pState, pInpInChI, 
 2290|    454|                         nNumComponents, nNumProtons, s, bStdFormat,
 2291|    454|                         input_has_save_opt, input_save_opt_bits,
 2292|    454|                         bInchi2Struct, ppolymer, pv3000 );
 2293|       |
 2294|    454|#if ( FIX_I2I_STEREOCONVERSION_BUG == 1 )
 2295|       |    /* modify stereo type for layers as requested */
 2296|    454|    if (target_stereo_type > 1)
  ------------------
  |  Branch (2296:9): [True: 0, False: 454]
  ------------------
 2297|      0|    {
 2298|      0|        for (i1 = 0; i1 < INCHI_NUM; i1++)
  ------------------
  |  |  574|      0|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (2298:22): [True: 0, False: 0]
  ------------------
 2299|      0|        {
 2300|      0|            for (i2 = 0; i2 < TAUT_NUM; i2++)
  ------------------
  |  |  578|      0|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (2300:26): [True: 0, False: 0]
  ------------------
 2301|      0|            {
 2302|      0|                for (i3 = 0; i3 < 2; i3++)
  ------------------
  |  Branch (2302:30): [True: 0, False: 0]
  ------------------
 2303|      0|                {
 2304|      0|                    if (s[i1][i2][i3] != 0)
  ------------------
  |  Branch (2304:25): [True: 0, False: 0]
  ------------------
 2305|      0|                    {
 2306|      0|                        if (target_stereo_type != 1)
  ------------------
  |  Branch (2306:29): [True: 0, False: 0]
  ------------------
 2307|      0|                        {
 2308|       |                            /* do not allow conversion SRel=>SAbs, SRac=>SAbs */
 2309|      0|                            s[i1][i2][i3] = target_stereo_type;
 2310|      0|                        }
 2311|      0|                    }
 2312|      0|                }
 2313|      0|            }
 2314|      0|        }
 2315|      0|    }
 2316|    454|#endif
 2317|       |
 2318|    454|    *nErr = 0;
 2319|       |
 2320|    454|    if (( ret == RI_ERR_EOL ) &&
  ------------------
  |  |   46|    454|#define RI_ERR_EOL     (-4)
  ------------------
  |  Branch (2320:9): [True: 73, False: 381]
  ------------------
 2321|    454|         nNumComponents[INCHI_BAS][TAUT_YES]
  ------------------
  |  |  575|     73|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                       nNumComponents[INCHI_BAS][TAUT_YES]
  ------------------
  |  |  580|     73|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2321:10): [True: 66, False: 7]
  ------------------
 2322|     73|         + nNumComponents[INCHI_BAS][TAUT_NON] && bReadCoord)
  ------------------
  |  |  575|     73|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                       + nNumComponents[INCHI_BAS][TAUT_NON] && bReadCoord)
  ------------------
  |  |  579|     73|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (2322:51): [True: 42, False: 24]
  ------------------
 2323|     42|    {
 2324|     42|        retAux = ReadInChICoord( pInp, pLine, &stateAux, pInpInChI, nNumComponents );
 2325|     42|    }
 2326|       |
 2327|    454|    if (( ret == RI_ERR_EOL || ret == RI_ERR_EOF ) &&
  ------------------
  |  |   46|    908|#define RI_ERR_EOL     (-4)
  ------------------
                  if (( ret == RI_ERR_EOL || ret == RI_ERR_EOF ) &&
  ------------------
  |  |   47|    381|#define RI_ERR_EOF     (0)
  ------------------
  |  Branch (2327:11): [True: 73, False: 381]
  |  Branch (2327:32): [True: 130, False: 251]
  ------------------
 2328|    454|         nNumComponents[INCHI_BAS][TAUT_YES]
  ------------------
  |  |  575|    203|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                       nNumComponents[INCHI_BAS][TAUT_YES]
  ------------------
  |  |  580|    203|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2328:10): [True: 196, False: 7]
  ------------------
 2329|    203|         + nNumComponents[INCHI_BAS][TAUT_NON])
  ------------------
  |  |  575|    203|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                       + nNumComponents[INCHI_BAS][TAUT_NON])
  ------------------
  |  |  579|    203|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 2330|    196|    {
 2331|       |        /* post-processing: add omitted layers */
 2332|    196|        *pState = IST_MATERIAL_BALANCE_ERROR;
 2333|    532|        for (iINChI = 0; iINChI < INCHI_NUM; iINChI++)
  ------------------
  |  |  574|    532|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (2333:26): [True: 364, False: 168]
  ------------------
 2334|    364|        {
 2335|  1.09k|            for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  578|  1.09k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (2335:25): [True: 728, False: 364]
  ------------------
 2336|    728|            {
 2337|       |                /* for Mobile/Fixed H (j) ... */
 2338|    728|                int bIsotopic, bStereoType, bStereoTypeAlt;
 2339|    728|                int nMH2FH_AltInv = 0, nFH2iFH_AltInv = 0 /*, niMH2iFH_AltInv=0, nMH2iMH_AltInv=0*/;
 2340|    728|                int jAlt = ALT_TAUT( j );
  ------------------
  |  |  582|    728|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  580|    728|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (582:29): [True: 0, False: 728]
  |  |  ------------------
  ------------------
 2341|    728|                INCHI_MODE  nFlags = 0, nFlagsAlt = 0;
 2342|       |                /* get stereo type: ABS, REL, RAC, or nothing */
 2343|    728|                tot_charge[iINChI][j] = 0;
 2344|  2.18k|                for (bIsotopic = bStereoType = bStereoTypeAlt = 0; bIsotopic < 2; bIsotopic++)
  ------------------
  |  Branch (2344:68): [True: 1.45k, False: 728]
  ------------------
 2345|  1.45k|                {
 2346|  1.45k|                    if (!bStereoType || bStereoType < s[iINChI][j][bIsotopic])
  ------------------
  |  Branch (2346:25): [True: 1.45k, False: 0]
  |  Branch (2346:41): [True: 0, False: 0]
  ------------------
 2347|  1.45k|                    {
 2348|  1.45k|                        bStereoType = s[iINChI][j][bIsotopic];
 2349|  1.45k|                    }
 2350|  1.45k|                    if (!bStereoTypeAlt || bStereoTypeAlt < s[iINChI][jAlt][bIsotopic])
  ------------------
  |  Branch (2350:25): [True: 1.45k, False: 0]
  |  Branch (2350:44): [True: 0, False: 0]
  ------------------
 2351|  1.45k|                    {
 2352|  1.45k|                        bStereoTypeAlt = s[iINChI][jAlt][bIsotopic];
 2353|  1.45k|                    }
 2354|  1.45k|                    nFlags = bStereoType == 2 ? INCHI_FLAG_REL_STEREO : bStereoType == 3 ? INCHI_FLAG_RAC_STEREO : 0;
  ------------------
  |  |  149|      0|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                  nFlags = bStereoType == 2 ? INCHI_FLAG_REL_STEREO : bStereoType == 3 ? INCHI_FLAG_RAC_STEREO : 0;
  ------------------
  |  |  150|      0|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (2354:30): [True: 0, False: 1.45k]
  |  Branch (2354:73): [True: 0, False: 1.45k]
  ------------------
 2355|  1.45k|                    nFlagsAlt = bStereoTypeAlt == 2 ? INCHI_FLAG_REL_STEREO : bStereoTypeAlt == 3 ? INCHI_FLAG_RAC_STEREO : 0;
  ------------------
  |  |  149|      0|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                  nFlagsAlt = bStereoTypeAlt == 2 ? INCHI_FLAG_REL_STEREO : bStereoTypeAlt == 3 ? INCHI_FLAG_RAC_STEREO : 0;
  ------------------
  |  |  150|      0|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (2355:33): [True: 0, False: 1.45k]
  |  Branch (2355:79): [True: 0, False: 1.45k]
  ------------------
 2356|  1.45k|                }
 2357|       |                /* set stereo type to each component */
 2358|       |                /* add missing nNum_H and nConnTable */
 2359|    728|                if (nNumComponents[iINChI][j])
  ------------------
  |  Branch (2359:21): [True: 264, False: 464]
  ------------------
 2360|    264|                {
 2361|    264|                    num_elem[iINChI][j] = (NUM_ELEM *) inchi_calloc( nElDataLen + 1, sizeof( num_elem[0][0][0] ) );
  ------------------
  |  | 1133|    264|#define inchi_calloc   calloc
  ------------------
 2362|    264|                    if (!num_elem[iINChI][j])
  ------------------
  |  Branch (2362:25): [True: 0, False: 264]
  ------------------
 2363|      0|                    {
 2364|      0|                        ret2 = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 2365|      0|                        goto exit_function;
 2366|      0|                    }
 2367|    264|                }
 2368|   140k|                for (k = 0; k < nNumComponents[iINChI][j]; k++)
  ------------------
  |  Branch (2368:29): [True: 140k, False: 728]
  ------------------
 2369|   140k|                {
 2370|       |                    /* for each component k ... */
 2371|   140k|                    if (pInpInChI[iINChI][j])
  ------------------
  |  Branch (2371:25): [True: 140k, False: 0]
  ------------------
 2372|   140k|                    {
 2373|   140k|                        INChI *pInChI = &pInpInChI[iINChI][j][k];
 2374|   140k|                        INChI *pInChI_Alt = ( k < nNumComponents[iINChI][jAlt] &&
  ------------------
  |  Branch (2374:47): [True: 137k, False: 2.80k]
  ------------------
 2375|   140k|                                              pInpInChI[iINChI][jAlt] &&
  ------------------
  |  Branch (2375:47): [True: 137k, False: 0]
  ------------------
 2376|       |                                              /*pInpInChI[iINChI][jAlt]->nNumberOfAtoms)? pInpInChI[iINChI][jAlt]:NULL;*/ /* 2007-09-25 DT */
 2377|   140k|                                              pInpInChI[iINChI][jAlt][k].nNumberOfAtoms ) ? &pInpInChI[iINChI][jAlt][k] : NULL;
  ------------------
  |  Branch (2377:47): [True: 137k, False: 0]
  ------------------
 2378|   140k|                        if (nFlags)
  ------------------
  |  Branch (2378:29): [True: 0, False: 140k]
  ------------------
 2379|      0|                        {
 2380|      0|                            pInChI->nFlags |= nFlags;
 2381|      0|                        }
 2382|   140k|                        else
 2383|   140k|                        {
 2384|   140k|                            if (j == TAUT_NON && !nFlags && nFlagsAlt)
  ------------------
  |  |  579|   280k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (2384:33): [True: 68.7k, False: 71.5k]
  |  Branch (2384:50): [True: 68.7k, False: 0]
  |  Branch (2384:61): [True: 0, False: 68.7k]
  ------------------
 2385|      0|                            {
 2386|      0|                                pInChI->nFlags |= nFlagsAlt;
 2387|      0|                            }
 2388|   140k|                        }
 2389|       |                        /**** add empty immobile H (nNum_H) if it is missing ****/
 2390|   140k|                        if (!pInChI->nNum_H &&
  ------------------
  |  Branch (2390:29): [True: 14, False: 140k]
  ------------------
 2391|   140k|                             !( pInChI->nNum_H = (S_CHAR *) inchi_calloc( pInChI->nNumberOfAtoms + 1, sizeof( pInChI->nNum_H[0] ) ) ))
  ------------------
  |  | 1133|     14|#define inchi_calloc   calloc
  ------------------
  |  Branch (2391:30): [True: 0, False: 14]
  ------------------
 2392|      0|                        {
 2393|      0|                            ret2 = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 2394|      0|                            goto exit_function;
 2395|      0|                        }
 2396|       |                        /**** add single atom nConnTable if it is missing ****/
 2397|   140k|                        if (!pInChI->nConnTable)
  ------------------
  |  Branch (2397:29): [True: 68.7k, False: 71.5k]
  ------------------
 2398|  68.7k|                        {
 2399|  68.7k|                            AT_NUMB *pCT;
 2400|  68.7k|                            int      lenCT;
 2401|  68.7k|                            if (j == TAUT_NON && k < nNumComponents[iINChI][TAUT_YES] &&
  ------------------
  |  |  579|   137k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                                          if (j == TAUT_NON && k < nNumComponents[iINChI][TAUT_YES] &&
  ------------------
  |  |  580|  68.7k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2401:33): [True: 68.7k, False: 10]
  |  Branch (2401:50): [True: 68.7k, False: 0]
  ------------------
 2402|  68.7k|                                ( pCT = pInpInChI[iINChI][TAUT_YES][k].nConnTable ) &&
  ------------------
  |  |  580|  68.7k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2402:33): [True: 68.7k, False: 0]
  ------------------
 2403|  68.7k|                                 ( lenCT = pInpInChI[iINChI][TAUT_YES][k].lenConnTable ) > 0)
  ------------------
  |  |  580|  68.7k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2403:34): [True: 68.7k, False: 0]
  ------------------
 2404|  68.7k|                            {
 2405|  68.7k|                                if (!( pInChI->nConnTable = (AT_NUMB *) inchi_calloc( lenCT + 1, sizeof( pInChI->nConnTable[0] ) ) ))
  ------------------
  |  | 1133|  68.7k|#define inchi_calloc   calloc
  ------------------
  |  Branch (2405:37): [True: 0, False: 68.7k]
  ------------------
 2406|      0|                                {
 2407|      0|                                    ret2 = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 2408|      0|                                    goto exit_function;
 2409|      0|                                }
 2410|  68.7k|                                memcpy( pInChI->nConnTable, pCT, lenCT * sizeof( pInChI->nConnTable[0] ) );
 2411|  68.7k|                                pInChI->lenConnTable = lenCT;
 2412|  68.7k|                            }
 2413|     10|                            else
 2414|     10|                            {
 2415|     10|                                if (j == TAUT_YES && pInChI->nNumberOfAtoms > 1)
  ------------------
  |  |  580|     20|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2415:37): [True: 10, False: 0]
  |  Branch (2415:54): [True: 0, False: 10]
  ------------------
 2416|      0|                                {
 2417|      0|                                    *pState = IST_MOBILE_H_CONNECTIONS + ( iINChI == INCHI_REC ? IST_HAPPENED_IN_RECMET : 0 );
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                                                  *pState = IST_MOBILE_H_CONNECTIONS + ( iINChI == INCHI_REC ? IST_HAPPENED_IN_RECMET : 0 );
  ------------------
  |  |  363|      0|#define IST_HAPPENED_IN_RECMET   100
  ------------------
  |  Branch (2417:76): [True: 0, False: 0]
  ------------------
 2418|      0|                                    ret2 = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 2419|      0|                                    goto exit_function;
 2420|      0|                                }
 2421|     10|                                if (!( pInChI->nConnTable = (AT_NUMB *) inchi_calloc( pInChI->nNumberOfAtoms + 1, sizeof( pInChI->nConnTable[0] ) ) ))
  ------------------
  |  | 1133|     10|#define inchi_calloc   calloc
  ------------------
  |  Branch (2421:37): [True: 0, False: 10]
  ------------------
 2422|      0|                                {
 2423|      0|                                    ret2 = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 2424|      0|                                    goto exit_function;
 2425|      0|                                }
 2426|     10|                                pInChI->lenConnTable = 1;
 2427|     10|                                pInChI->nConnTable[0] = 1;
 2428|     10|                            }
 2429|  68.7k|                        }
 2430|  71.5k|                        else
 2431|  71.5k|                        {
 2432|  71.5k|                            if (pInChI->nConnTable && !pInChI->lenConnTable && pInChI->nNumberOfAtoms == 1)
  ------------------
  |  Branch (2432:33): [True: 71.5k, False: 0]
  |  Branch (2432:55): [True: 0, False: 71.5k]
  |  Branch (2432:80): [True: 0, False: 0]
  ------------------
 2433|      0|                            {
 2434|      0|                                pInChI->nConnTable[0] = 1;
 2435|      0|                                pInChI->lenConnTable = 1;
 2436|      0|                            }
 2437|  71.5k|                        }
 2438|       |                        /**** copy charge: Mobile H --> Fixed H; ****/
 2439|   140k|                        if (j == TAUT_NON)
  ------------------
  |  |  579|   140k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (2439:29): [True: 68.7k, False: 71.5k]
  ------------------
 2440|  68.7k|                        {
 2441|       |                            /*
 2442|       |                            if ( pInChI->nTotalCharge == NO_VALUE_INT )
 2443|       |                            {
 2444|       |                            pInChI->nTotalCharge = 0;
 2445|       |                            }
 2446|       |                            else
 2447|       |                            */
 2448|  68.7k|                            if (!pInChI->nTotalCharge && k < nNumComponents[iINChI][TAUT_YES])
  ------------------
  |  |  580|  53.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2448:33): [True: 53.8k, False: 14.8k]
  |  Branch (2448:58): [True: 53.8k, False: 0]
  ------------------
 2449|  53.8k|                            {
 2450|  53.8k|                                INChI *pAltInChI = &pInpInChI[iINChI][TAUT_YES][k]; /* Mobile H InChI */
  ------------------
  |  |  580|  53.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2451|  53.8k|                                if (pAltInChI->nTotalCharge && pAltInChI->nTotalCharge != NO_VALUE_INT)
  ------------------
  |  |   51|      4|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2451:37): [True: 4, False: 53.8k]
  |  Branch (2451:64): [True: 4, False: 0]
  ------------------
 2452|      4|                                {
 2453|      4|                                    pInChI->nTotalCharge = pAltInChI->nTotalCharge;
 2454|      4|                                }
 2455|  53.8k|                            }
 2456|  68.7k|                        }
 2457|       |                        /***** Fixed H: add pInChI->nNum_H_fixed to pInChI->nNum_H ****/
 2458|   140k|                        if (j == TAUT_NON && pInChI->nNum_H && pInChI->nNum_H_fixed)
  ------------------
  |  |  579|   280k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (2458:29): [True: 68.7k, False: 71.5k]
  |  Branch (2458:46): [True: 68.7k, False: 0]
  |  Branch (2458:64): [True: 0, False: 68.7k]
  ------------------
 2459|      0|                        {
 2460|      0|                            for (m = 0; m < pInChI->nNumberOfAtoms; m++)
  ------------------
  |  Branch (2460:41): [True: 0, False: 0]
  ------------------
 2461|      0|                            {
 2462|      0|                                pInChI->nNum_H[m] += pInChI->nNum_H_fixed[m];
 2463|      0|                            }
 2464|      0|                        }
 2465|       |                        /***** copy isotopic atoms: Mobile H --> Fixed H ******/
 2466|   140k|                        if (j == TAUT_YES && pInChI->nNumberOfIsotopicAtoms &&
  ------------------
  |  |  580|   280k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2466:29): [True: 71.5k, False: 68.7k]
  |  Branch (2466:46): [True: 28, False: 71.4k]
  ------------------
 2467|   140k|                             k < nNumComponents[iINChI][TAUT_NON])
  ------------------
  |  |  579|     28|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (2467:30): [True: 4, False: 24]
  ------------------
 2468|      4|                        {
 2469|      4|                            INChI *pAltInChI = &pInpInChI[iINChI][TAUT_NON][k]; /* Fixed H InChI */
  ------------------
  |  |  579|      4|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 2470|       |
 2471|      4|                            if (!pAltInChI->nNumberOfIsotopicAtoms)
  ------------------
  |  Branch (2471:33): [True: 4, False: 0]
  ------------------
 2472|      4|                            {
 2473|      4|                                ret2 = CopySegment( pAltInChI, pInChI, CPY_ISO_AT, 0, 0 );
 2474|      4|                                if (ret2 < 0)
  ------------------
  |  Branch (2474:37): [True: 0, False: 4]
  ------------------
 2475|      0|                                {
 2476|      0|                                    goto exit_function;
 2477|      0|                                }
 2478|      4|                            }
 2479|      4|                        }
 2480|       |                        /**** copy coordinates: Mobile H --> Fixed H ******/
 2481|   140k|                        if (j == TAUT_YES && pInChI->IsotopicTGroup &&
  ------------------
  |  |  580|   280k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2481:29): [True: 71.5k, False: 68.7k]
  |  Branch (2481:46): [True: 0, False: 71.5k]
  ------------------
 2482|   140k|                             k < nNumComponents[iINChI][TAUT_NON])
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (2482:30): [True: 0, False: 0]
  ------------------
 2483|      0|                        {
 2484|      0|                            INChI *pAltInChI = &pInpInChI[iINChI][TAUT_NON][k]; /* Fixed H InChI */
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 2485|       |
 2486|      0|                            if (!pAltInChI->IsotopicTGroup)
  ------------------
  |  Branch (2486:33): [True: 0, False: 0]
  ------------------
 2487|      0|                            {
 2488|      0|                                XYZ_COORD *pxyz = (XYZ_COORD *) inchi_calloc( pInChI->nNumberOfAtoms, sizeof( pxyz[0] ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 2489|      0|                                if (pxyz)
  ------------------
  |  Branch (2489:37): [True: 0, False: 0]
  ------------------
 2490|      0|                                {
 2491|      0|                                    memcpy( pxyz, pInChI->IsotopicTGroup, pInChI->nNumberOfAtoms * sizeof( pxyz[0] ) );
 2492|      0|                                    pAltInChI->IsotopicTGroup = (INChI_IsotopicTGroup *) pxyz;
 2493|      0|                                }
 2494|      0|                                else
 2495|      0|                                {
 2496|      0|                                    ret2 = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 2497|      0|                                    goto exit_function;
 2498|      0|                                }
 2499|      0|                            }
 2500|      0|                        }
 2501|       |
 2502|       |                        /********************************************************
 2503|       |                        *                                                      *
 2504|       |                        *            Restore omitted stereo seqments           *
 2505|       |                        *                                                      *
 2506|       |                        * order of restoring:                                  *
 2507|       |                        *                                                      *
 2508|       |                        * 1. Fixed H            (F) -> (FI) Isotopic Fixed H   *
 2509|       |                        * 2. Mobile H           (M) -> (F)  Fixed H            *
 2510|       |                        * 3. Isotopic Mobile H (MI) -> (FI) Isotopic Fixed H   *
 2511|       |                        * 4. Mobile H           (M) -> (MI) Isotopic Mobile H  *
 2512|       |                        *                                                      *
 2513|       |                        ********************************************************/
 2514|       |
 2515|       |                        /***** (4) copy stereo: Mobile H --> isotopic Mobile H ******/
 2516|   140k|                        if (j == TAUT_YES)
  ------------------
  |  |  580|   140k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2516:29): [True: 71.5k, False: 68.7k]
  ------------------
 2517|  71.5k|                        {
 2518|  71.5k|                            int bIso = pInChI->nNumberOfIsotopicAtoms ||
  ------------------
  |  Branch (2518:40): [True: 28, False: 71.4k]
  ------------------
 2519|  71.5k|                                ( pInChI->StereoIsotopic &&
  ------------------
  |  Branch (2519:35): [True: 0, False: 71.4k]
  ------------------
 2520|  71.4k|                                  pInChI->StereoIsotopic->nNumberOfStereoCenters
  ------------------
  |  Branch (2520:35): [True: 0, False: 0]
  ------------------
 2521|      0|                                  + pInChI->StereoIsotopic->nNumberOfStereoBonds ) ||
 2522|  71.5k|                                pInChI_Alt && pInChI_Alt->nNumberOfIsotopicAtoms;
  ------------------
  |  Branch (2522:33): [True: 68.7k, False: 2.78k]
  |  Branch (2522:47): [True: 46, False: 68.6k]
  ------------------
 2523|       |
 2524|       |                            /* non-isotopic Mobile H => isotopic Mobile H */
 2525|  71.5k|                            if (bIso)
  ------------------
  |  Branch (2525:33): [True: 74, False: 71.4k]
  ------------------
 2526|     74|                            {
 2527|     74|                                if (pInChI->Stereo && pInChI->Stereo->nNumberOfStereoCenters &&
  ------------------
  |  Branch (2527:37): [True: 0, False: 74]
  |  Branch (2527:55): [True: 0, False: 0]
  ------------------
 2528|     74|                                    ( !pInChI->StereoIsotopic || !pInChI->StereoIsotopic->t_parity ))
  ------------------
  |  Branch (2528:39): [True: 0, False: 0]
  |  Branch (2528:66): [True: 0, False: 0]
  ------------------
 2529|      0|                                {
 2530|      0|                                    if (0 > ( ret2 = CopySegment( pInChI, pInChI, CPY_SP3, 1, 0 ) ) ||
  ------------------
  |  Branch (2530:41): [True: 0, False: 0]
  ------------------
 2531|      0|                                        ( !pInChI->StereoIsotopic->nCompInv2Abs || NO_VALUE_INT == pInChI->StereoIsotopic->nCompInv2Abs ) &&
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2531:43): [True: 0, False: 0]
  |  Branch (2531:84): [True: 0, False: 0]
  ------------------
 2532|      0|                                         0 > ( ret2 = CopySegment( pInChI, pInChI, CPY_SP3_M, 1, 0 ) ))
  ------------------
  |  Branch (2532:42): [True: 0, False: 0]
  ------------------
 2533|      0|                                    {
 2534|      0|                                        goto exit_function;
 2535|      0|                                    }
 2536|      0|                                    if (( nFlags & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ))
  ------------------
  |  |  149|      0|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                  if (( nFlags & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ))
  ------------------
  |  |  150|      0|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (2536:41): [True: 0, False: 0]
  ------------------
 2537|      0|                                    {
 2538|      0|                                        if (pInChI->Stereo->nCompInv2Abs == NO_VALUE_INT)
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2538:45): [True: 0, False: 0]
  ------------------
 2539|      0|                                        {
 2540|      0|                                            pInChI->Stereo->nCompInv2Abs = s[iINChI][j][0] > 0 ? 2 : 0;
  ------------------
  |  Branch (2540:76): [True: 0, False: 0]
  ------------------
 2541|      0|                                        }
 2542|      0|                                        if (pInChI->StereoIsotopic->nCompInv2Abs == NO_VALUE_INT)
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2542:45): [True: 0, False: 0]
  ------------------
 2543|      0|                                        {
 2544|      0|                                            pInChI->StereoIsotopic->nCompInv2Abs = s[iINChI][j][1] > 0 ? 2 : 0;
  ------------------
  |  Branch (2544:84): [True: 0, False: 0]
  ------------------
 2545|      0|                                        }
 2546|      0|                                    }
 2547|      0|                                }
 2548|     74|                                else
 2549|     74|                                {
 2550|       |                                    /* copy sp3 inversion info: non-isotopic Mobile H => isotopic Mobile H  */
 2551|     74|                                    if (pInChI->Stereo && pInChI->Stereo->nNumberOfStereoCenters &&
  ------------------
  |  Branch (2551:41): [True: 0, False: 74]
  |  Branch (2551:59): [True: 0, False: 0]
  ------------------
 2552|     74|                                         pInChI->StereoIsotopic && pInChI->StereoIsotopic->nNumberOfStereoCenters &&
  ------------------
  |  Branch (2552:42): [True: 0, False: 0]
  |  Branch (2552:68): [True: 0, False: 0]
  ------------------
 2553|     74|                                         pInChI->Stereo->nCompInv2Abs)
  ------------------
  |  Branch (2553:42): [True: 0, False: 0]
  ------------------
 2554|      0|                                    {
 2555|      0|                                        if (( nFlags & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ) &&
  ------------------
  |  |  149|      0|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                      if (( nFlags & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ) &&
  ------------------
  |  |  150|      0|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (2555:45): [True: 0, False: 0]
  ------------------
 2556|      0|                                             pInChI->Stereo->nCompInv2Abs == NO_VALUE_INT &&
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2556:46): [True: 0, False: 0]
  ------------------
 2557|      0|                                             pInChI->StereoIsotopic->nCompInv2Abs == NO_VALUE_INT)
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2557:46): [True: 0, False: 0]
  ------------------
 2558|      0|                                        {
 2559|      0|                                            pInChI->Stereo->nCompInv2Abs = s[iINChI][j][0] > 0 ? 2 : 0;
  ------------------
  |  Branch (2559:76): [True: 0, False: 0]
  ------------------
 2560|      0|                                            pInChI->StereoIsotopic->nCompInv2Abs = s[iINChI][j][1] > 0 ? 2 : 0;
  ------------------
  |  Branch (2560:84): [True: 0, False: 0]
  ------------------
 2561|      0|                                        }
 2562|      0|                                        else
 2563|      0|                                        {
 2564|      0|                                            if (!pInChI->StereoIsotopic->nCompInv2Abs || NO_VALUE_INT == pInChI->StereoIsotopic->nCompInv2Abs)
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2564:49): [True: 0, False: 0]
  |  Branch (2564:90): [True: 0, False: 0]
  ------------------
 2565|      0|                                            {
 2566|      0|                                                pInChI->StereoIsotopic->nCompInv2Abs = pInChI->Stereo->nCompInv2Abs;
 2567|      0|                                            }
 2568|      0|                                        }
 2569|      0|                                    }
 2570|     74|                                }
 2571|     74|                            }
 2572|  71.5k|                            if (bIso &&
  ------------------
  |  Branch (2572:33): [True: 74, False: 71.4k]
  ------------------
 2573|  71.5k|                                 pInChI->Stereo && pInChI->Stereo->nNumberOfStereoBonds &&
  ------------------
  |  Branch (2573:34): [True: 0, False: 74]
  |  Branch (2573:52): [True: 0, False: 0]
  ------------------
 2574|  71.5k|                                 ( !pInChI->StereoIsotopic || !pInChI->StereoIsotopic->b_parity ))
  ------------------
  |  Branch (2574:36): [True: 0, False: 0]
  |  Branch (2574:63): [True: 0, False: 0]
  ------------------
 2575|      0|                            {
 2576|      0|                                if (0 > ( ret2 = CopySegment( pInChI, pInChI, CPY_SP2, 1, 0 ) ))
  ------------------
  |  Branch (2576:37): [True: 0, False: 0]
  ------------------
 2577|      0|                                {
 2578|      0|                                    goto exit_function;
 2579|      0|                                }
 2580|      0|                            }
 2581|  71.5k|                        }
 2582|       |                        /***** (0) set nCompInv2Abs to Fixed-H *********************************/
 2583|   140k|                        if (j == TAUT_NON)
  ------------------
  |  |  579|   140k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (2583:29): [True: 68.7k, False: 71.5k]
  ------------------
 2584|  68.7k|                        {
 2585|  68.7k|                            if (pInChI->Stereo && pInChI->Stereo->nNumberOfStereoCenters &&
  ------------------
  |  Branch (2585:33): [True: 0, False: 68.7k]
  |  Branch (2585:51): [True: 0, False: 0]
  ------------------
 2586|  68.7k|                                 pInChI->Stereo->nCompInv2Abs == NO_VALUE_INT)
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2586:34): [True: 0, False: 0]
  ------------------
 2587|      0|                            {
 2588|       |                                /* case of /sN and /t... in non-isotopic Mobile-H, no /s in non-isotopic Fixed-H */
 2589|      0|                                if (!s[iINChI][j][0] && s[iINChI][jAlt][0] > 0 &&  /* /sN is not present in F and is present in M */
  ------------------
  |  Branch (2589:37): [True: 0, False: 0]
  |  Branch (2589:57): [True: 0, False: 0]
  ------------------
 2590|      0|                                     pInChI_Alt && pInChI_Alt->Stereo && pInChI_Alt->Stereo->nNumberOfStereoCenters)
  ------------------
  |  Branch (2590:38): [True: 0, False: 0]
  |  Branch (2590:52): [True: 0, False: 0]
  |  Branch (2590:74): [True: 0, False: 0]
  ------------------
 2591|      0|                                {
 2592|       |                                    /* inherit from Mobile-H */
 2593|       |                                    /* /s1 in M and MI; /m1 or /m0 in MI; /m. in M; no /m in F. Inherit MI->FI. Added 10-15-2007 */
 2594|      0|                                    if (pInChI_Alt->Stereo->nCompInv2Abs == 0 &&                    /*  M: /m. ; means no /m for this component */
  ------------------
  |  Branch (2594:41): [True: 0, False: 0]
  ------------------
 2595|      0|                                         pInChI->Stereo->nCompInv2Abs == NO_VALUE_INT &&         /*  F: no /m segment for all components */
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2595:42): [True: 0, False: 0]
  ------------------
 2596|      0|                                         pInChI_Alt->StereoIsotopic &&                               /*  MI: present */
  ------------------
  |  Branch (2596:42): [True: 0, False: 0]
  ------------------
 2597|      0|                                         pInChI_Alt->StereoIsotopic->nCompInv2Abs != 0 &&
  ------------------
  |  Branch (2597:42): [True: 0, False: 0]
  ------------------
 2598|      0|                                         pInChI_Alt->StereoIsotopic->nCompInv2Abs != NO_VALUE_INT && /* MI:    /m0 or /m1  */
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2598:42): [True: 0, False: 0]
  ------------------
 2599|      0|                                         !s[iINChI][j][0] && !s[iINChI][j][1] &&                     /* F, FI: no /s       */
  ------------------
  |  Branch (2599:42): [True: 0, False: 0]
  |  Branch (2599:62): [True: 0, False: 0]
  ------------------
 2600|      0|                                         s[iINChI][jAlt][0] == 1 && s[iINChI][jAlt][1] == 1          /* M, MI: /s1 and /s1 */
  ------------------
  |  Branch (2600:42): [True: 0, False: 0]
  |  Branch (2600:69): [True: 0, False: 0]
  ------------------
 2601|      0|                                         )
 2602|      0|                                    {
 2603|       |                                        /* copy /m from MI to FI */
 2604|      0|                                        if (0 > ( ret2 = CopySegment( pInChI, pInChI_Alt, CPY_SP3_M, 1, 1 ) ))
  ------------------
  |  Branch (2604:45): [True: 0, False: 0]
  ------------------
 2605|      0|                                        {
 2606|      0|                                            goto exit_function;
 2607|      0|                                        }
 2608|      0|                                    }
 2609|      0|                                    else
 2610|      0|                                    {
 2611|       |                                        /* the following if(){...} was added to fix m1 bug 2007-09-25 DT */
 2612|      0|                                        if (pInChI_Alt->Stereo->nCompInv2Abs != NO_VALUE_INT && s[iINChI][jAlt][0] == 1)
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2612:45): [True: 0, False: 0]
  |  Branch (2612:97): [True: 0, False: 0]
  ------------------
 2613|      0|                                        {
 2614|      0|                                            pInChI->Stereo->nCompInv2Abs = pInChI_Alt->Stereo->nCompInv2Abs;
 2615|      0|                                        }
 2616|      0|                                        else
 2617|      0|                                        {
 2618|       |                                            /* M and MI contain /sN and /sN, N=2,3. Added 10-15-2007 */
 2619|      0|                                            if (pInChI_Alt->Stereo->nCompInv2Abs == NO_VALUE_INT &&
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2619:49): [True: 0, False: 0]
  ------------------
 2620|      0|                                                 pInChI->Stereo->nCompInv2Abs == NO_VALUE_INT &&
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2620:50): [True: 0, False: 0]
  ------------------
 2621|      0|                                                 !s[iINChI][j][0] && !s[iINChI][j][1] &&
  ------------------
  |  Branch (2621:50): [True: 0, False: 0]
  |  Branch (2621:70): [True: 0, False: 0]
  ------------------
 2622|      0|                                                 ( s[iINChI][jAlt][0] & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ) &&
  ------------------
  |  |  149|      0|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                               ( s[iINChI][jAlt][0] & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ) &&
  ------------------
  |  |  150|      0|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (2622:50): [True: 0, False: 0]
  ------------------
 2623|      0|                                                 ( s[iINChI][jAlt][1] & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ))
  ------------------
  |  |  149|      0|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                               ( s[iINChI][jAlt][1] & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ))
  ------------------
  |  |  150|      0|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (2623:50): [True: 0, False: 0]
  ------------------
 2624|      0|                                            {
 2625|      0|                                                int bIso = pInChI->nNumberOfIsotopicAtoms ||
  ------------------
  |  Branch (2625:60): [True: 0, False: 0]
  ------------------
 2626|      0|                                                    ( pInChI->StereoIsotopic &&
  ------------------
  |  Branch (2626:55): [True: 0, False: 0]
  ------------------
 2627|      0|                                                      pInChI->StereoIsotopic->nNumberOfStereoCenters
  ------------------
  |  Branch (2627:55): [True: 0, False: 0]
  ------------------
 2628|      0|                                                      + pInChI->StereoIsotopic->nNumberOfStereoBonds ) ||
 2629|      0|                                                    pInChI_Alt && pInChI_Alt->nNumberOfIsotopicAtoms;
  ------------------
  |  Branch (2629:53): [True: 0, False: 0]
  |  Branch (2629:67): [True: 0, False: 0]
  ------------------
 2630|      0|                                                if (bIso)
  ------------------
  |  Branch (2630:53): [True: 0, False: 0]
  ------------------
 2631|      0|                                                {
 2632|      0|                                                    if (!pInChI_Alt->StereoIsotopic &&  /* create zero/NULL-initialized pInChI_Alt->StereoIsotopic */
  ------------------
  |  Branch (2632:57): [True: 0, False: 0]
  ------------------
 2633|      0|                                                         0 > ( ret2 = CopySegment( pInChI_Alt, pInChI_Alt, CPY_SP3_M, 1, -1 ) ))
  ------------------
  |  Branch (2633:58): [True: 0, False: 0]
  ------------------
 2634|      0|                                                    {
 2635|      0|                                                        goto exit_function;
 2636|      0|                                                    }
 2637|      0|                                                    pInChI_Alt->StereoIsotopic->nCompInv2Abs = 2;  /* MI: /m1 or /m0 */
 2638|      0|                                                    pInChI_Alt->Stereo->nCompInv2Abs = 0;  /* M:  /m. ; no /m for this component */
 2639|      0|                                                    pInChI->Stereo->nCompInv2Abs = NO_VALUE_INT + 1; /* FI: Stereo->CompInv2Abs=0, StereoIsotopic->CompInv2Abs=1 or -1 */
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
 2640|      0|                                                }
 2641|      0|                                                else
 2642|      0|                                                {
 2643|      0|                                                    pInChI->Stereo->nCompInv2Abs = 2; /* F:  /m1 or /m0, omitted from InChI as a repetition */
 2644|      0|                                                    pInChI_Alt->Stereo->nCompInv2Abs = 2; /* M:  /m1 or /m0; in Srel/SRac case the value = 2 */
 2645|      0|                                                }
 2646|      0|                                            }
 2647|      0|                                            else
 2648|      0|                                            {
 2649|      0|                                                pInChI->Stereo->nCompInv2Abs = 2;         /* F:  /m1 or /m0, omitted from InChI as a repetition */
 2650|      0|                                                pInChI_Alt->Stereo->nCompInv2Abs = 2;     /* M:  /m1 or /m0; in Srel/SRac case the value = 2 */
 2651|      0|                                            }
 2652|      0|                                        }
 2653|      0|                                    }
 2654|      0|                                }
 2655|      0|                                else
 2656|      0|                                {
 2657|       |                                    /* case of /sN in Isotopic Fixed-H only, /t... in Fixed-H, no /m (2007-08-27 DT) */
 2658|      0|                                    if (!s[iINChI][j][0] && !s[iINChI][jAlt][0] && /* /sN in Fixed-H isotopic only */
  ------------------
  |  Branch (2658:41): [True: 0, False: 0]
  |  Branch (2658:61): [True: 0, False: 0]
  ------------------
 2659|      0|                                        ( nFlags & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ) &&
  ------------------
  |  |  149|      0|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                      ( nFlags & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ) &&
  ------------------
  |  |  150|      0|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (2659:41): [True: 0, False: 0]
  ------------------
 2660|      0|                                         !( pInChI->StereoIsotopic && pInChI->StereoIsotopic->nNumberOfStereoCenters ) &&
  ------------------
  |  Branch (2660:45): [True: 0, False: 0]
  |  Branch (2660:71): [True: 0, False: 0]
  ------------------
 2661|       |                                         /*!(pInChI_Alt && pInChI_Alt->Stereo && pInChI_Alt->Stereo->nNumberOfStereoCenters) &&*/
 2662|      0|                                         !( pInChI_Alt && pInChI_Alt->StereoIsotopic && pInChI_Alt->StereoIsotopic->nNumberOfStereoCenters ))
  ------------------
  |  Branch (2662:45): [True: 0, False: 0]
  |  Branch (2662:59): [True: 0, False: 0]
  |  Branch (2662:89): [True: 0, False: 0]
  ------------------
 2663|      0|                                    {
 2664|      0|                                        pInChI->Stereo->nCompInv2Abs = NO_VALUE_INT + 1; /* Stereo->CompInv2Abs=0, StereoIsotopic->CompInv2Abs=1 or -1 */
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
 2665|      0|                                    }
 2666|      0|                                    else
 2667|      0|                                    {
 2668|      0|                                        pInChI->Stereo->nCompInv2Abs = s[iINChI][j][0] > 0 ? 2 : 0;
  ------------------
  |  Branch (2668:72): [True: 0, False: 0]
  ------------------
 2669|      0|                                    }
 2670|      0|                                }
 2671|      0|                            }
 2672|  68.7k|                        }
 2673|       |
 2674|       |                        /***** (1) copy stereo: non-isotopic Fixed H --> isotopic Fixed H ******/
 2675|   140k|                        if (j == TAUT_NON)
  ------------------
  |  |  579|   140k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (2675:29): [True: 68.7k, False: 71.5k]
  ------------------
 2676|  68.7k|                        {
 2677|  68.7k|                            int bIso = pInChI->nNumberOfIsotopicAtoms ||
  ------------------
  |  Branch (2677:40): [True: 46, False: 68.6k]
  ------------------
 2678|  68.7k|                                ( pInChI->StereoIsotopic &&
  ------------------
  |  Branch (2678:35): [True: 53.8k, False: 14.8k]
  ------------------
 2679|  68.6k|                                  pInChI->StereoIsotopic->nNumberOfStereoCenters
  ------------------
  |  Branch (2679:35): [True: 0, False: 53.8k]
  ------------------
 2680|  53.8k|                                  + pInChI->StereoIsotopic->nNumberOfStereoBonds ) ||
 2681|  68.7k|                                pInChI_Alt && pInChI_Alt->nNumberOfIsotopicAtoms;
  ------------------
  |  Branch (2681:33): [True: 68.6k, False: 0]
  |  Branch (2681:47): [True: 4, False: 68.6k]
  ------------------
 2682|       |                            /* non-isotopic Fixed H => isotopic Fixed H */
 2683|  68.7k|                            if (bIso)
  ------------------
  |  Branch (2683:33): [True: 50, False: 68.6k]
  ------------------
 2684|     50|                            {
 2685|     50|                                if (pInChI->Stereo && pInChI->Stereo->nNumberOfStereoCenters &&
  ------------------
  |  Branch (2685:37): [True: 0, False: 50]
  |  Branch (2685:55): [True: 0, False: 0]
  ------------------
 2686|     50|                                    ( !pInChI->StereoIsotopic || !pInChI->StereoIsotopic->t_parity ))
  ------------------
  |  Branch (2686:39): [True: 0, False: 0]
  |  Branch (2686:66): [True: 0, False: 0]
  ------------------
 2687|      0|                                {
 2688|       |                                    /* -- replaced 2007-08-27 by (aaa), see below -- DT
 2689|       |                                    if ( 0 > (ret2 = CopySegment( pInChI, pInChI, CPY_SP3, 1, 0)) ||
 2690|       |                                    !(pInChI->StereoIsotopic->nCompInv2Abs || NO_VALUE_INT == pInChI->StereoIsotopic->nCompInv2Abs) &&
 2691|       |                                    0 > (ret2 = CopySegment( pInChI, pInChI, CPY_SP3_M, 1, 0))) {
 2692|       |                                    goto exit_function;
 2693|       |                                    }
 2694|       |                                    */
 2695|       |                                    /*----------- replacement (aaa) begin 2007-08-27 DT */
 2696|      0|                                    if (0 > ( ret2 = CopySegment( pInChI, pInChI, CPY_SP3, 1, 0 ) ))
  ------------------
  |  Branch (2696:41): [True: 0, False: 0]
  ------------------
 2697|      0|                                    {
 2698|      0|                                        goto exit_function;
 2699|      0|                                    }
 2700|      0|                                    if (pInChI->Stereo->nCompInv2Abs == NO_VALUE_INT + 1)
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2700:41): [True: 0, False: 0]
  ------------------
 2701|      0|                                    {
 2702|      0|                                        pInChI->Stereo->nCompInv2Abs = 0;
 2703|      0|                                        pInChI->StereoIsotopic->nCompInv2Abs = 2;
 2704|      0|                                    }
 2705|      0|                                    else
 2706|      0|                                    {
 2707|      0|                                        if (!( pInChI->StereoIsotopic->nCompInv2Abs || NO_VALUE_INT == pInChI->StereoIsotopic->nCompInv2Abs ) &&
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2707:48): [True: 0, False: 0]
  |  Branch (2707:88): [True: 0, False: 0]
  ------------------
 2708|      0|                                             0 > ( ret2 = CopySegment( pInChI, pInChI, CPY_SP3_M, 1, 0 ) ))
  ------------------
  |  Branch (2708:46): [True: 0, False: 0]
  ------------------
 2709|      0|                                        {
 2710|      0|                                            goto exit_function;
 2711|      0|                                        }
 2712|      0|                                    }
 2713|       |                                    /*----------- replacement (aaa) end 2007-08-27 DT */
 2714|      0|                                    if (( nFlags & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ))
  ------------------
  |  |  149|      0|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                  if (( nFlags & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ))
  ------------------
  |  |  150|      0|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (2714:41): [True: 0, False: 0]
  ------------------
 2715|      0|                                    {
 2716|      0|                                        if (pInChI->Stereo->nCompInv2Abs == NO_VALUE_INT)
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2716:45): [True: 0, False: 0]
  ------------------
 2717|      0|                                        {
 2718|      0|                                            pInChI->Stereo->nCompInv2Abs = s[iINChI][j][0] > 0 ? 2 : 0;
  ------------------
  |  Branch (2718:76): [True: 0, False: 0]
  ------------------
 2719|      0|                                        }
 2720|      0|                                        if (pInChI->StereoIsotopic->nCompInv2Abs == NO_VALUE_INT)
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2720:45): [True: 0, False: 0]
  ------------------
 2721|      0|                                        {
 2722|      0|                                            pInChI->StereoIsotopic->nCompInv2Abs = s[iINChI][j][1] > 0 ? 2 : 0;
  ------------------
  |  Branch (2722:84): [True: 0, False: 0]
  ------------------
 2723|      0|                                        }
 2724|      0|                                    }
 2725|       |#ifdef NEVER
 2726|       |                                    if (( nFlags & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ) &&
 2727|       |                                         !s[iINChI][j][0] && s[iINChI][j][0] > 0)
 2728|       |                                    {
 2729|       |                                        /* copied Rel/Rac stereo to Iso; /s is in Iso /s is not in non-Iso */
 2730|       |                                        /* this means all difference in stereo is in inversion */
 2731|       |                                        if (pInChI->Stereo->nCompInv2Abs == NO_VALUE_INT &&
 2732|       |                                             pInChI->StereoIsotopic->nCompInv2Abs == NO_VALUE_INT)
 2733|       |                                        {
 2734|       |                                            pInChI->Stereo->nCompInv2Abs = 0;         /* missing */
 2735|       |                                            pInChI->StereoIsotopic->nCompInv2Abs = 2; /* unusual value */
 2736|       |                                        }
 2737|       |                                    }
 2738|       |#endif
 2739|      0|                                }
 2740|     50|                                else
 2741|     50|                                {
 2742|       |                                    /* copy sp3 inversion info: non-isotopic Fixed H --> isotopic Fixed H  */
 2743|     50|                                    if (pInChI->Stereo && pInChI->Stereo->nNumberOfStereoCenters &&
  ------------------
  |  Branch (2743:41): [True: 0, False: 50]
  |  Branch (2743:59): [True: 0, False: 0]
  ------------------
 2744|     50|                                         pInChI->StereoIsotopic && pInChI->StereoIsotopic->nNumberOfStereoCenters &&
  ------------------
  |  Branch (2744:42): [True: 0, False: 0]
  |  Branch (2744:68): [True: 0, False: 0]
  ------------------
 2745|     50|                                         pInChI->Stereo->nCompInv2Abs)
  ------------------
  |  Branch (2745:42): [True: 0, False: 0]
  ------------------
 2746|      0|                                    {
 2747|      0|                                        if (( nFlags & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ) &&
  ------------------
  |  |  149|      0|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                      if (( nFlags & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ) &&
  ------------------
  |  |  150|      0|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (2747:45): [True: 0, False: 0]
  ------------------
 2748|      0|                                             pInChI->Stereo->nCompInv2Abs == NO_VALUE_INT &&
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2748:46): [True: 0, False: 0]
  ------------------
 2749|      0|                                             pInChI->StereoIsotopic->nCompInv2Abs == NO_VALUE_INT)
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2749:46): [True: 0, False: 0]
  ------------------
 2750|      0|                                        {
 2751|      0|                                            pInChI->Stereo->nCompInv2Abs = s[iINChI][j][0] > 0 ? 2 : 0;
  ------------------
  |  Branch (2751:76): [True: 0, False: 0]
  ------------------
 2752|      0|                                            pInChI->StereoIsotopic->nCompInv2Abs = s[iINChI][j][1] > 0 ? 2 : 0;
  ------------------
  |  Branch (2752:84): [True: 0, False: 0]
  ------------------
 2753|      0|                                        }
 2754|      0|                                        else
 2755|      0|                                        {
 2756|      0|                                            if (!pInChI->StereoIsotopic->nCompInv2Abs || NO_VALUE_INT == pInChI->StereoIsotopic->nCompInv2Abs)
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2756:49): [True: 0, False: 0]
  |  Branch (2756:90): [True: 0, False: 0]
  ------------------
 2757|      0|                                            {
 2758|      0|                                                pInChI->StereoIsotopic->nCompInv2Abs = pInChI->Stereo->nCompInv2Abs;
 2759|      0|                                            }
 2760|      0|                                        }
 2761|      0|                                    }
 2762|     50|                                }
 2763|     50|                            }
 2764|  68.7k|                            if (bIso &&
  ------------------
  |  Branch (2764:33): [True: 50, False: 68.6k]
  ------------------
 2765|  68.7k|                                 pInChI->Stereo && pInChI->Stereo->nNumberOfStereoBonds &&
  ------------------
  |  Branch (2765:34): [True: 0, False: 50]
  |  Branch (2765:52): [True: 0, False: 0]
  ------------------
 2766|  68.7k|                                 ( !pInChI->StereoIsotopic || !pInChI->StereoIsotopic->b_parity ))
  ------------------
  |  Branch (2766:36): [True: 0, False: 0]
  |  Branch (2766:63): [True: 0, False: 0]
  ------------------
 2767|      0|                            {
 2768|      0|                                if (0 > ( ret2 = CopySegment( pInChI, pInChI, CPY_SP2, 1, 0 ) ))
  ------------------
  |  Branch (2768:37): [True: 0, False: 0]
  ------------------
 2769|      0|                                {
 2770|      0|                                    goto exit_function;
 2771|      0|                                }
 2772|      0|                            }
 2773|  68.7k|                        }
 2774|       |
 2775|       |                        /***** copy stereo: Mobile H --> Fixed H ******/
 2776|   140k|                        if (j == TAUT_NON && k < nNumComponents[iINChI][TAUT_YES])
  ------------------
  |  |  579|   280k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                                      if (j == TAUT_NON && k < nNumComponents[iINChI][TAUT_YES])
  ------------------
  |  |  580|  68.7k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2776:29): [True: 68.7k, False: 71.5k]
  |  Branch (2776:46): [True: 68.7k, False: 0]
  ------------------
 2777|  68.7k|                        {
 2778|  68.7k|                            INChI *pAltInChI = &pInpInChI[iINChI][TAUT_YES][k]; /* Mobile H InChI */
  ------------------
  |  |  580|  68.7k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2779|  68.7k|                            int bIso = pInChI->nNumberOfIsotopicAtoms ||
  ------------------
  |  Branch (2779:40): [True: 46, False: 68.6k]
  ------------------
 2780|  68.7k|                                ( pInChI->StereoIsotopic &&
  ------------------
  |  Branch (2780:35): [True: 53.8k, False: 14.8k]
  ------------------
 2781|  68.6k|                                  pInChI->StereoIsotopic->nNumberOfStereoCenters
  ------------------
  |  Branch (2781:35): [True: 0, False: 53.8k]
  ------------------
 2782|  53.8k|                                  + pInChI->StereoIsotopic->nNumberOfStereoBonds ) ||
 2783|  68.7k|                                pAltInChI && (
  ------------------
  |  Branch (2783:33): [True: 68.6k, False: 0]
  ------------------
 2784|  68.6k|                                    pAltInChI->nNumberOfIsotopicAtoms ||
  ------------------
  |  Branch (2784:37): [True: 4, False: 68.6k]
  ------------------
 2785|  68.6k|                                    ( pAltInChI->StereoIsotopic &&
  ------------------
  |  Branch (2785:39): [True: 0, False: 68.6k]
  ------------------
 2786|  68.6k|                                      pAltInChI->StereoIsotopic->nNumberOfStereoCenters
  ------------------
  |  Branch (2786:39): [True: 0, False: 0]
  ------------------
 2787|      0|                                      + pAltInChI->StereoIsotopic->nNumberOfStereoBonds ) );
 2788|  68.7k|                            int bNo_InChI_t = ( !pInChI->Stereo || !pInChI->Stereo->t_parity );
  ------------------
  |  Branch (2788:49): [True: 68.7k, False: 0]
  |  Branch (2788:68): [True: 0, False: 0]
  ------------------
 2789|  68.7k|                            int bNo_InChI_m = ( !pInChI->Stereo || NO_VALUE_INT == pInChI->Stereo->nCompInv2Abs );
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2789:49): [True: 68.7k, False: 0]
  |  Branch (2789:68): [True: 0, False: 0]
  ------------------
 2790|       |
 2791|       |                            /* (2) non-isotopic Mobile H => non-isotopic Fixed H */
 2792|  68.7k|                            if (pAltInChI->Stereo && pAltInChI->Stereo->nNumberOfStereoCenters &&
  ------------------
  |  Branch (2792:33): [True: 0, False: 68.7k]
  |  Branch (2792:54): [True: 0, False: 0]
  ------------------
 2793|  68.7k|                                ( !pInChI->Stereo || !pInChI->Stereo->t_parity ))
  ------------------
  |  Branch (2793:35): [True: 0, False: 0]
  |  Branch (2793:54): [True: 0, False: 0]
  ------------------
 2794|      0|                            {
 2795|      0|#if ( FIX_I2I_STEREOCONVERSION_BUG2 == 1 )
 2796|       |                                /* (2008-04-02)   1=> Fix bug of i2i conversion SAbs-->(SRel||Srac) */
 2797|       |                                /*                    (converter skipped empty '/t' or sometimes produced an excess one */
 2798|       |
 2799|       |                                /* check whether t stereo is actually present */
 2800|      0|                                int bHave_t_stereo = 1;
 2801|      0|                                if (pInChI->Stereo)
  ------------------
  |  Branch (2801:37): [True: 0, False: 0]
  ------------------
 2802|      0|                                    bHave_t_stereo = pInChI->Stereo->nNumberOfStereoCenters;
 2803|       |                                /* account for stereobonds present */
 2804|      0|                                if (bHave_t_stereo < 1)
  ------------------
  |  Branch (2804:37): [True: 0, False: 0]
  ------------------
 2805|      0|                                    if (pInChI->Stereo->nNumberOfStereoBonds > 0)
  ------------------
  |  Branch (2805:41): [True: 0, False: 0]
  ------------------
 2806|      0|                                        bHave_t_stereo = 1;
 2807|       |                                /* copy stereo anyway ... */
 2808|      0|#endif
 2809|      0|                                if (0 > ( ret2 = CopySegment( pInChI, pAltInChI, CPY_SP3, 0, 0 ) ) ||
  ------------------
  |  Branch (2809:37): [True: 0, False: 0]
  ------------------
 2810|      0|                                    ( !pInChI->Stereo->nCompInv2Abs || NO_VALUE_INT == pInChI->Stereo->nCompInv2Abs ) &&
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2810:39): [True: 0, False: 0]
  |  Branch (2810:72): [True: 0, False: 0]
  ------------------
 2811|      0|                                     0 > ( ret2 = CopySegment( pInChI, pAltInChI, CPY_SP3_M, 0, 0 ) ))
  ------------------
  |  Branch (2811:38): [True: 0, False: 0]
  ------------------
 2812|      0|                                {
 2813|      0|                                    goto exit_function;
 2814|      0|                                }
 2815|       |
 2816|      0|#if ( FIX_I2I_STEREOCONVERSION_BUG2 == 1 )
 2817|       |                                /* ... correct just copied stereo if applicable */
 2818|      0|                                if (( s[iINChI][j][0] < 1 ) &&
  ------------------
  |  Branch (2818:37): [True: 0, False: 0]
  ------------------
 2819|      0|                                    ( bHave_t_stereo < 1 ) &&
  ------------------
  |  Branch (2819:37): [True: 0, False: 0]
  ------------------
 2820|      0|                                     ( pAltInChI->Stereo->nNumberOfStereoCenters > 0 ) &&
  ------------------
  |  Branch (2820:38): [True: 0, False: 0]
  ------------------
 2821|      0|                                     ( s[iINChI][jAlt][0] < 1 ))
  ------------------
  |  Branch (2821:38): [True: 0, False: 0]
  ------------------
 2822|      0|                                {
 2823|       |                                    /* (2010-02-28) if not all stereo centers are unknown/undefined */
 2824|       |                                    /*  at which condition stereo still should present .. */
 2825|      0|                                    int all_UU = 1;
 2826|      0|                                    for (kc = 0; kc < pAltInChI->Stereo->nNumberOfStereoCenters; kc++)
  ------------------
  |  Branch (2826:50): [True: 0, False: 0]
  ------------------
 2827|      0|                                    {
 2828|      0|                                        if (( pAltInChI->Stereo->t_parity[kc] != AB_PARITY_UNKN ) &&
  ------------------
  |  |  249|      0|#define AB_PARITY_UNKN   3  /* 3 => user marked as unknown parity */
  ------------------
  |  Branch (2828:45): [True: 0, False: 0]
  ------------------
 2829|      0|                                            ( pAltInChI->Stereo->t_parity[kc] != AB_PARITY_UNDF ))
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2829:45): [True: 0, False: 0]
  ------------------
 2830|      0|                                        {
 2831|      0|                                            all_UU = 0;
 2832|      0|                                            break;
 2833|      0|                                        }
 2834|      0|                                    }
 2835|      0|                                    if (!all_UU)
  ------------------
  |  Branch (2835:41): [True: 0, False: 0]
  ------------------
 2836|      0|                                        pInChI->Stereo->nNumberOfStereoCenters = 0;
 2837|      0|                                }
 2838|      0|#endif
 2839|       |
 2840|       |                                /* in case of missing nCompInv2Abs, 2005-05-10 */
 2841|      0|                                if (( pInChI->Stereo->nCompInv2Abs == NO_VALUE_INT ) &&
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2841:37): [True: 0, False: 0]
  ------------------
 2842|      0|                                    ( nFlagsAlt & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ))
  ------------------
  |  |  149|      0|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                  ( nFlagsAlt & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ))
  ------------------
  |  |  150|      0|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (2842:37): [True: 0, False: 0]
  ------------------
 2843|      0|                                {
 2844|      0|                                    if (s[iINChI][jAlt][0] > 0 && s[iINChI][j][0] > 0)
  ------------------
  |  Branch (2844:41): [True: 0, False: 0]
  |  Branch (2844:67): [True: 0, False: 0]
  ------------------
 2845|      0|                                    {
 2846|       |                                        /* suppose once in a while only non-taut stereo changes if inverted */
 2847|      0|                                        pAltInChI->Stereo->nCompInv2Abs = ( ++nMH2FH_AltInv ) % 2 ? 2 : 0;
  ------------------
  |  Branch (2847:75): [True: 0, False: 0]
  ------------------
 2848|      0|                                        pInChI->Stereo->nCompInv2Abs = 2;
 2849|      0|                                    }
 2850|      0|                                    else
 2851|      0|                                    {
 2852|       |                                        /* Mobile-H: /t.. /sN; Mobile-H isotopic: /sN (n=2 or 3), not /t...; Fixed-H layer is present, has no /t, no /i/t */
 2853|       |                                        /* Mobile-H /sN was caused by another component that would have same /mN in all layers */
 2854|       |                                        /* therefore, in case of Abs. Stereo, Mobile-H stereo isotopic stereo would have /m1 */
 2855|       |                                        /* In case of Rel/Rac stereo, since no /m1 could occur in Mobile-H isotopic, */
 2856|       |                                        /* no pAltInChI->StereoIsotopic or pInChI->StereoIsotopic have been created yet. */
 2857|       |                                        /* added 10-11-2007 to fix i2i bug for Rel/Rac stereo */
 2858|      0|                                        if (nNumComponents[iINChI][j] > 1 &&
  ------------------
  |  Branch (2858:45): [True: 0, False: 0]
  ------------------
 2859|      0|                                             bNo_InChI_t && bNo_InChI_m /* no /t... or /mN in Fixed-H  */ && !nFlags &&
  ------------------
  |  Branch (2859:46): [True: 0, False: 0]
  |  Branch (2859:61): [True: 0, False: 0]
  |  Branch (2859:110): [True: 0, False: 0]
  ------------------
 2860|      0|                                             !( pAltInChI->StereoIsotopic && pAltInChI->StereoIsotopic->t_parity ) &&
  ------------------
  |  Branch (2860:49): [True: 0, False: 0]
  |  Branch (2860:78): [True: 0, False: 0]
  ------------------
 2861|      0|                                             !( pInChI->StereoIsotopic    && pInChI->StereoIsotopic->t_parity ) &&
  ------------------
  |  Branch (2861:49): [True: 0, False: 0]
  |  Branch (2861:78): [True: 0, False: 0]
  ------------------
 2862|      0|                                             s[iINChI][j][0] == 0 && s[iINChI][j][1] == 0 &&
  ------------------
  |  Branch (2862:46): [True: 0, False: 0]
  |  Branch (2862:70): [True: 0, False: 0]
  ------------------
 2863|       |                                             /* /sN, N=2 or 3 only in Mobile-H AND Mobile-H isotopic */
 2864|      0|                                             ( s[iINChI][jAlt][0] & ( ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ) ) &&
  ------------------
  |  |  149|      0|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                           ( s[iINChI][jAlt][0] & ( ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ) ) &&
  ------------------
  |  |  150|      0|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (2864:46): [True: 0, False: 0]
  ------------------
 2865|      0|                                             ( s[iINChI][jAlt][1] & ( ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ) ))
  ------------------
  |  |  149|      0|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                           ( s[iINChI][jAlt][1] & ( ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ) ))
  ------------------
  |  |  150|      0|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (2865:46): [True: 0, False: 0]
  ------------------
 2866|      0|                                        {
 2867|      0|                                            if (bIso)
  ------------------
  |  Branch (2867:49): [True: 0, False: 0]
  ------------------
 2868|      0|                                            {
 2869|       |                                                /* create two zero/NULL-initialized isotopic stereo if they do not exist */
 2870|      0|                                                if (!pInChI->StereoIsotopic && 0 > ( ret2 = CopySegment( pInChI, pAltInChI, CPY_SP3_M, 1, -1 ) )
  ------------------
  |  Branch (2870:53): [True: 0, False: 0]
  |  Branch (2870:80): [True: 0, False: 0]
  ------------------
 2871|       |                                                     /* -- the following will be created later, in TAUT_YES part of the code -- */
 2872|      0|                                                     || !pAltInChI->StereoIsotopic && 0 > ( ret2 = CopySegment( pAltInChI, pAltInChI, CPY_SP3_M, 1, -1 ) ))
  ------------------
  |  Branch (2872:57): [True: 0, False: 0]
  |  Branch (2872:87): [True: 0, False: 0]
  ------------------
 2873|      0|                                                {
 2874|      0|                                                    goto exit_function;
 2875|      0|                                                }
 2876|       |                                                /* same value = 2 for MI and FI; here we assign only FI */
 2877|      0|                                                pInChI->StereoIsotopic->nCompInv2Abs = 2;
 2878|      0|                                                pInChI->Stereo->nCompInv2Abs = 0;
 2879|       |                                                /* -- the following will NOT be assigned later, in TAUT_YES part of the code -- */
 2880|      0|                                                pAltInChI->StereoIsotopic->nCompInv2Abs = 2;
 2881|      0|                                                pAltInChI->Stereo->nCompInv2Abs = 0;
 2882|       |                                                /* */
 2883|      0|                                            }
 2884|      0|                                            else
 2885|      0|                                            {
 2886|      0|                                                if (NO_VALUE_INT == pInChI->Stereo->nCompInv2Abs &&
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2886:53): [True: 0, False: 0]
  ------------------
 2887|      0|                                                     NO_VALUE_INT == pAltInChI->Stereo->nCompInv2Abs)
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2887:54): [True: 0, False: 0]
  ------------------
 2888|      0|                                                {
 2889|      0|                                                    pInChI->Stereo->nCompInv2Abs = 2;
 2890|      0|                                                    pAltInChI->Stereo->nCompInv2Abs = 2;
 2891|      0|                                                }
 2892|      0|                                            }
 2893|      0|                                        }
 2894|      0|                                        else
 2895|      0|                                        {
 2896|      0|                                            if (( s[iINChI][jAlt][0] > 0 || s[iINChI][j][0] > 0 ) && s[iINChI][j][0] >= 0)
  ------------------
  |  Branch (2896:51): [True: 0, False: 0]
  |  Branch (2896:77): [True: 0, False: 0]
  |  Branch (2896:102): [True: 0, False: 0]
  ------------------
 2897|      0|                                            {
 2898|      0|                                                pInChI->Stereo->nCompInv2Abs = 2;
 2899|      0|                                            }
 2900|      0|                                            else
 2901|      0|                                            {
 2902|       |                                                /* Mobile-H: /t..., no /sN; Mobile-H isotopic: /s2 or /s3, not /t; Fixed-H layer is present, has no /t, no /i/t */
 2903|       |                                                /* therefore, in case of Abs. Stereo, Mobile-H stereo isotopic stereo would have /m1 */
 2904|       |                                                /* In case of Rel/Rac stereo, since no /m1 could occur in Mobile-H isotopic, */
 2905|       |                                                /* no pAltInChI->StereoIsotopic or pInChI->StereoIsotopic have been created yet. */
 2906|       |                                                /* added 10-10-2007 to fix i2i bug for Rel/Rac stereo */
 2907|      0|                                                if (bIso && bNo_InChI_t && bNo_InChI_m /* no /t... or /mN in Fixed-H  */ && !nFlags &&
  ------------------
  |  Branch (2907:53): [True: 0, False: 0]
  |  Branch (2907:61): [True: 0, False: 0]
  |  Branch (2907:76): [True: 0, False: 0]
  |  Branch (2907:125): [True: 0, False: 0]
  ------------------
 2908|      0|                                                     !( pAltInChI->StereoIsotopic && pAltInChI->StereoIsotopic->t_parity ) &&
  ------------------
  |  Branch (2908:57): [True: 0, False: 0]
  |  Branch (2908:86): [True: 0, False: 0]
  ------------------
 2909|      0|                                                     !( pInChI->StereoIsotopic    && pInChI->StereoIsotopic->t_parity ) &&
  ------------------
  |  Branch (2909:57): [True: 0, False: 0]
  |  Branch (2909:86): [True: 0, False: 0]
  ------------------
 2910|      0|                                                     s[iINChI][jAlt][0] == 0 && s[iINChI][j][0] == 0 && s[iINChI][j][1] == 0 &&
  ------------------
  |  Branch (2910:54): [True: 0, False: 0]
  |  Branch (2910:81): [True: 0, False: 0]
  |  Branch (2910:105): [True: 0, False: 0]
  ------------------
 2911|       |                                                     /* /sN, N=2 or 3 only in Mobile-H isotopic */
 2912|      0|                                                     ( s[iINChI][jAlt][1] & ( ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ) ))
  ------------------
  |  |  149|      0|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                                   ( s[iINChI][jAlt][1] & ( ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ) ))
  ------------------
  |  |  150|      0|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (2912:54): [True: 0, False: 0]
  ------------------
 2913|      0|                                                {
 2914|       |                                                    /* create two zero/NULL-initialized isotopic stereo if they do not exist */
 2915|      0|                                                    if (!pInChI->StereoIsotopic && 0 > ( ret2 = CopySegment( pInChI, pAltInChI, CPY_SP3_M, 1, -1 ) )
  ------------------
  |  Branch (2915:57): [True: 0, False: 0]
  |  Branch (2915:84): [True: 0, False: 0]
  ------------------
 2916|       |                                                         /* -- the following will be created later, in TAUT_YES part of the code -- */
 2917|      0|                                                         /*|| !pAltInChI->StereoIsotopic && 0 > (ret2 = CopySegment( pAltInChI, pAltInChI, CPY_SP3_M, 1, -1))*/)
 2918|      0|                                                    {
 2919|      0|                                                        goto exit_function;
 2920|      0|                                                    }
 2921|       |                                                    /* same value = 2 for MI and FI; here we assign only FI */
 2922|      0|                                                    pInChI->StereoIsotopic->nCompInv2Abs = 2;
 2923|      0|                                                    pInChI->Stereo->nCompInv2Abs = 0;
 2924|       |                                                    /* -- the following will be assigned later, in TAUT_YES part of the code -- */
 2925|       |                                                    /*
 2926|       |                                                    pAltInChI->StereoIsotopic->nCompInv2Abs = 2;
 2927|       |                                                    pAltInChI->Stereo->nCompInv2Abs = 0;
 2928|       |                                                    */
 2929|      0|                                                }
 2930|      0|                                                else
 2931|      0|                                                {
 2932|      0|                                                    pInChI->Stereo->nCompInv2Abs = 0;
 2933|      0|                                                }
 2934|      0|                                            }
 2935|      0|                                        }
 2936|      0|                                    }
 2937|      0|                                    if (!( pInChI->nFlags & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ))
  ------------------
  |  |  149|      0|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                  if (!( pInChI->nFlags & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ))
  ------------------
  |  |  150|      0|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (2937:41): [True: 0, False: 0]
  ------------------
 2938|      0|                                    {
 2939|      0|                                        pInChI->nFlags |= ( ( nFlagsAlt | nFlags ) & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) );
  ------------------
  |  |  149|      0|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                      pInChI->nFlags |= ( ( nFlagsAlt | nFlags ) & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) );
  ------------------
  |  |  150|      0|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
 2940|      0|                                    }
 2941|      0|                                }
 2942|      0|                            }
 2943|  68.7k|                            else
 2944|  68.7k|                            {
 2945|       |                                /* copy sp3 inversion info: non-isotopic Mobile H => non-isotopic Fixed H  */
 2946|  68.7k|                                if (pAltInChI->Stereo && pAltInChI->Stereo->nNumberOfStereoCenters &&
  ------------------
  |  Branch (2946:37): [True: 0, False: 68.7k]
  |  Branch (2946:58): [True: 0, False: 0]
  ------------------
 2947|  68.7k|                                     pInChI->Stereo && pInChI->Stereo->nNumberOfStereoCenters &&
  ------------------
  |  Branch (2947:38): [True: 0, False: 0]
  |  Branch (2947:56): [True: 0, False: 0]
  ------------------
 2948|  68.7k|                                     pAltInChI->Stereo->nCompInv2Abs &&
  ------------------
  |  Branch (2948:38): [True: 0, False: 0]
  ------------------
 2949|  68.7k|                                     ( !pInChI->Stereo->nCompInv2Abs || NO_VALUE_INT == pInChI->Stereo->nCompInv2Abs ))
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2949:40): [True: 0, False: 0]
  |  Branch (2949:73): [True: 0, False: 0]
  ------------------
 2950|      0|                                {
 2951|      0|                                    if (!( nFlagsAlt && !nFlags ) || NO_VALUE_INT == pInChI->Stereo->nCompInv2Abs)
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2951:44): [True: 0, False: 0]
  |  Branch (2951:57): [True: 0, False: 0]
  |  Branch (2951:70): [True: 0, False: 0]
  ------------------
 2952|      0|                                    {
 2953|       |                                        /* ??? */
 2954|      0|                                        pInChI->Stereo->nCompInv2Abs = pAltInChI->Stereo->nCompInv2Abs;
 2955|      0|                                    }
 2956|      0|                                }
 2957|  68.7k|                            }
 2958|       |
 2959|       |                            /* use same rule to copy stereobonds */
 2960|  68.7k|                            if (pAltInChI->Stereo && pAltInChI->Stereo->nNumberOfStereoBonds &&
  ------------------
  |  Branch (2960:33): [True: 0, False: 68.7k]
  |  Branch (2960:54): [True: 0, False: 0]
  ------------------
 2961|  68.7k|                                ( !pInChI->Stereo || !pInChI->Stereo->b_parity ))
  ------------------
  |  Branch (2961:35): [True: 0, False: 0]
  |  Branch (2961:54): [True: 0, False: 0]
  ------------------
 2962|      0|                            {
 2963|      0|                                if (0 > ( ret2 = CopySegment( pInChI, pAltInChI, CPY_SP2, 0, 0 ) ))
  ------------------
  |  Branch (2963:37): [True: 0, False: 0]
  ------------------
 2964|      0|                                {
 2965|      0|                                    goto exit_function;
 2966|      0|                                }
 2967|      0|                            }
 2968|       |                            /* (3) isotopic Mobile H -> isotopic Fixed H */
 2969|       |                            /* if !FH_Stereo && !MH_Stereo && MH_IsoStereo!=NULL && FH_IsoStereo==NULL */
 2970|  68.7k|                            if (bIso)
  ------------------
  |  Branch (2970:33): [True: 50, False: 68.6k]
  ------------------
 2971|     50|                            {
 2972|     50|                                if (!( pInChI->Stereo && pInChI->Stereo->t_parity ) &&                                    /* !FH_Stereo */
  ------------------
  |  Branch (2972:40): [True: 0, False: 50]
  |  Branch (2972:58): [True: 0, False: 0]
  ------------------
 2973|     50|                                     !( pAltInChI->Stereo && pAltInChI->Stereo->t_parity ) &&                              /* !MH_Stereo */
  ------------------
  |  Branch (2973:41): [True: 0, False: 50]
  |  Branch (2973:62): [True: 0, False: 0]
  ------------------
 2974|     50|                                     ( pAltInChI->StereoIsotopic && pAltInChI->StereoIsotopic->nNumberOfStereoCenters ) && /*  MH_IsoStereo */
  ------------------
  |  Branch (2974:40): [True: 0, False: 50]
  |  Branch (2974:69): [True: 0, False: 0]
  ------------------
 2975|     50|                                     ( !pInChI->StereoIsotopic || !pInChI->StereoIsotopic->t_parity ))
  ------------------
  |  Branch (2975:40): [True: 0, False: 0]
  |  Branch (2975:67): [True: 0, False: 0]
  ------------------
 2976|      0|                                {
 2977|       |                                    /* !FH_IsoStereo */
 2978|       |                                    /* copy sp3 iso stereo MI->FI (/t) and, if FH nCompInv2Abs (/m) is missing, copy it, too, MI->FI */
 2979|      0|                                    if (0 > ( ret2 = CopySegment( pInChI, pAltInChI, CPY_SP3, 1, 1 ) ) ||
  ------------------
  |  Branch (2979:41): [True: 0, False: 0]
  ------------------
 2980|      0|                                        ( !pInChI->StereoIsotopic->nCompInv2Abs || NO_VALUE_INT == pInChI->StereoIsotopic->nCompInv2Abs ) &&
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2980:43): [True: 0, False: 0]
  |  Branch (2980:84): [True: 0, False: 0]
  ------------------
 2981|      0|                                         0 > ( ret2 = CopySegment( pInChI, pAltInChI, CPY_SP3_M, 1, 1 ) ))
  ------------------
  |  Branch (2981:42): [True: 0, False: 0]
  ------------------
 2982|      0|                                    {
 2983|      0|                                        goto exit_function;
 2984|      0|                                    }
 2985|       |                                    /* in case of missing nCompInv2Abs, Relative or Racemic stereo 2005-05-10 */
 2986|      0|                                    if (pInChI->StereoIsotopic->nCompInv2Abs == NO_VALUE_INT &&
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (2986:41): [True: 0, False: 0]
  ------------------
 2987|      0|                                        ( nFlagsAlt & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ))
  ------------------
  |  |  149|      0|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                      ( nFlagsAlt & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ))
  ------------------
  |  |  150|      0|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (2987:41): [True: 0, False: 0]
  ------------------
 2988|      0|                                    {
 2989|      0|                                        pInChI->StereoIsotopic->nCompInv2Abs = s[iINChI][jAlt][1] > 0 ? 2 : 0;
  ------------------
  |  Branch (2989:80): [True: 0, False: 0]
  ------------------
 2990|      0|                                        if (!( pInChI->nFlags & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ))
  ------------------
  |  |  149|      0|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                      if (!( pInChI->nFlags & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ))
  ------------------
  |  |  150|      0|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (2990:45): [True: 0, False: 0]
  ------------------
 2991|      0|                                        {
 2992|      0|                                            pInChI->nFlags |= ( nFlagsAlt & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) );
  ------------------
  |  |  149|      0|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                          pInChI->nFlags |= ( nFlagsAlt & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) );
  ------------------
  |  |  150|      0|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
 2993|      0|                                        }
 2994|      0|                                    }
 2995|      0|                                }
 2996|     50|                                else
 2997|     50|                                {
 2998|       |                                    /* copy sp3 inversion info only: isotopic Mobile H -> isotopic Fixed H  */
 2999|     50|                                    if (!( pInChI->Stereo && pInChI->Stereo->t_parity ) &&                                     /* !FH_Stereo    /t */
  ------------------
  |  Branch (2999:44): [True: 0, False: 50]
  |  Branch (2999:62): [True: 0, False: 0]
  ------------------
 3000|     50|                                         !( pAltInChI->Stereo && pAltInChI->Stereo->t_parity ) &&                               /* !MH_Stereo    /t */
  ------------------
  |  Branch (3000:45): [True: 0, False: 50]
  |  Branch (3000:66): [True: 0, False: 0]
  ------------------
 3001|     50|                                         ( pAltInChI->StereoIsotopic && pAltInChI->StereoIsotopic->nNumberOfStereoCenters ) &&  /*  MH_IsoStereo /t */
  ------------------
  |  Branch (3001:44): [True: 0, False: 50]
  |  Branch (3001:73): [True: 0, False: 0]
  ------------------
 3002|     50|                                         ( pInChI->StereoIsotopic && pInChI->StereoIsotopic->nNumberOfStereoCenters ) &&        /*  FH_IsoStereo /t */
  ------------------
  |  Branch (3002:44): [True: 0, False: 0]
  |  Branch (3002:70): [True: 0, False: 0]
  ------------------
 3003|     50|                                         pAltInChI->StereoIsotopic->nCompInv2Abs &&                                           /*  MH_IsoStereo /m */
  ------------------
  |  Branch (3003:42): [True: 0, False: 0]
  ------------------
 3004|     50|                                         ( !pInChI->StereoIsotopic->nCompInv2Abs || NO_VALUE_INT == pInChI->StereoIsotopic->nCompInv2Abs ))
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (3004:44): [True: 0, False: 0]
  |  Branch (3004:85): [True: 0, False: 0]
  ------------------
 3005|      0|                                    {
 3006|       |                                        /*  !FH_IsoStereo /m */
 3007|       |                                        /* added 02-09-2006 */
 3008|      0|                                        if (0 > ( ret2 = CopySegment( pInChI, pAltInChI, CPY_SP3_M, 1, 1 ) ))
  ------------------
  |  Branch (3008:45): [True: 0, False: 0]
  ------------------
 3009|      0|                                        {
 3010|      0|                                            goto exit_function;
 3011|      0|                                        }
 3012|      0|                                    }
 3013|     50|                                }
 3014|       |                                /* use same rule to copy stereobonds */
 3015|     50|                                if (!( pInChI->Stereo && pInChI->Stereo->b_parity ) &&
  ------------------
  |  Branch (3015:40): [True: 0, False: 50]
  |  Branch (3015:58): [True: 0, False: 0]
  ------------------
 3016|     50|                                     !( pAltInChI->Stereo && pAltInChI->Stereo->b_parity ) &&
  ------------------
  |  Branch (3016:41): [True: 0, False: 50]
  |  Branch (3016:62): [True: 0, False: 0]
  ------------------
 3017|     50|                                     ( pAltInChI->StereoIsotopic && pAltInChI->StereoIsotopic->nNumberOfStereoBonds ) &&
  ------------------
  |  Branch (3017:40): [True: 0, False: 50]
  |  Branch (3017:69): [True: 0, False: 0]
  ------------------
 3018|     50|                                     ( !pInChI->StereoIsotopic || !pInChI->StereoIsotopic->b_parity ))
  ------------------
  |  Branch (3018:40): [True: 0, False: 0]
  |  Branch (3018:67): [True: 0, False: 0]
  ------------------
 3019|      0|                                {
 3020|      0|                                    if (0 > ( ret2 = CopySegment( pInChI, pAltInChI, CPY_SP2, 1, 1 ) ))
  ------------------
  |  Branch (3020:41): [True: 0, False: 0]
  ------------------
 3021|      0|                                    {
 3022|      0|                                        goto exit_function;
 3023|      0|                                    }
 3024|      0|                                }
 3025|       |
 3026|       |                                /* (4) Copy Fixed-H -> isotopic Fixed-H */
 3027|       |                                /* if FH_Stereo && !MH_IsoStereo && && !FH_IsoStereo */
 3028|     50|                                if (( pInChI->Stereo && pInChI->Stereo->nNumberOfStereoCenters ) &&              /* FH_Stereo     /t */
  ------------------
  |  Branch (3028:39): [True: 0, False: 50]
  |  Branch (3028:57): [True: 0, False: 0]
  ------------------
 3029|     50|                                     !( pAltInChI->StereoIsotopic && pAltInChI->StereoIsotopic->t_parity ) &&     /* !MH_IsoStereo /t */
  ------------------
  |  Branch (3029:41): [True: 0, False: 0]
  |  Branch (3029:70): [True: 0, False: 0]
  ------------------
 3030|     50|                                     !( pInChI->StereoIsotopic && pInChI->StereoIsotopic->t_parity ))
  ------------------
  |  Branch (3030:41): [True: 0, False: 0]
  |  Branch (3030:67): [True: 0, False: 0]
  ------------------
 3031|      0|                                {
 3032|       |                                    /* !FH_IsoStereo /t */
 3033|       |
 3034|       |                                    /* added 10-10-2007 DT: copy MH_Iso /m => FH_Iso /m to fix i2i bug for Abs stereo */
 3035|       |                                    /* InChI string contains: MH(/t...), MH_Iso(/mN, no /t), FH(no /t /m), FH_Iso(no /t /m) */
 3036|      0|                                    if (pAltInChI->StereoIsotopic && pAltInChI->StereoIsotopic->nCompInv2Abs && /* MH_IsoStereo /m */
  ------------------
  |  Branch (3036:41): [True: 0, False: 0]
  |  Branch (3036:70): [True: 0, False: 0]
  ------------------
 3037|      0|                                         bNo_InChI_t &&
  ------------------
  |  Branch (3037:42): [True: 0, False: 0]
  ------------------
 3038|      0|                                         NO_VALUE_INT != pAltInChI->StereoIsotopic->nCompInv2Abs &&              /* undef FH_IsoStereo /m */
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (3038:42): [True: 0, False: 0]
  ------------------
 3039|      0|                                         !( pInChI->StereoIsotopic && NO_VALUE_INT != pInChI->StereoIsotopic->nCompInv2Abs ))
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (3039:45): [True: 0, False: 0]
  |  Branch (3039:71): [True: 0, False: 0]
  ------------------
 3040|      0|                                    {
 3041|      0|                                        if (0 > ( ret2 = CopySegment( pInChI, pAltInChI, CPY_SP3_M, 1, 1 ) ))
  ------------------
  |  Branch (3041:45): [True: 0, False: 0]
  ------------------
 3042|      0|                                        {
 3043|      0|                                            goto exit_function;
 3044|      0|                                        }
 3045|      0|                                    }
 3046|       |
 3047|       |                                    /* added 05-09-2006: copy sp3 FH=>FH_Iso */
 3048|      0|                                    if (0 > ( ret2 = CopySegment( pInChI, pInChI, CPY_SP3, 1, 0 ) ) ||
  ------------------
  |  Branch (3048:41): [True: 0, False: 0]
  ------------------
 3049|      0|                                        ( !pInChI->StereoIsotopic->nCompInv2Abs || NO_VALUE_INT == pInChI->StereoIsotopic->nCompInv2Abs ) &&
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (3049:43): [True: 0, False: 0]
  |  Branch (3049:84): [True: 0, False: 0]
  ------------------
 3050|      0|                                         0 > ( ret2 = CopySegment( pInChI, pInChI, CPY_SP3_M, 1, 0 ) ))
  ------------------
  |  Branch (3050:42): [True: 0, False: 0]
  ------------------
 3051|      0|                                    {
 3052|      0|                                        goto exit_function;
 3053|      0|                                    }
 3054|       |
 3055|       |                                    /* in case of missing nCompInv2Abs, Relative or Racemic stereo, /sN in Fixed-H, 2005-05-10 */
 3056|      0|                                    if (pInChI->StereoIsotopic->nCompInv2Abs == NO_VALUE_INT &&
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (3056:41): [True: 0, False: 0]
  ------------------
 3057|      0|                                        ( nFlags & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ))
  ------------------
  |  |  149|      0|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                      ( nFlags & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ))
  ------------------
  |  |  150|      0|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (3057:41): [True: 0, False: 0]
  ------------------
 3058|      0|                                    {
 3059|      0|                                        if (s[iINChI][j][0] > 0 && s[iINChI][j][1] > 0)
  ------------------
  |  Branch (3059:45): [True: 0, False: 0]
  |  Branch (3059:68): [True: 0, False: 0]
  ------------------
 3060|      0|                                        {
 3061|       |                                            /* suppose once in a while only non-taut stereo changes if inverted */
 3062|      0|                                            pInChI->StereoIsotopic->nCompInv2Abs = 2;
 3063|      0|                                            pInChI->Stereo->nCompInv2Abs = ( ++nFH2iFH_AltInv ) % 2 ? 2 : 0;
  ------------------
  |  Branch (3063:76): [True: 0, False: 0]
  ------------------
 3064|      0|                                        }
 3065|      0|                                        else
 3066|      0|                                        {
 3067|      0|                                            if (( s[iINChI][j][0] > 0 || s[iINChI][j][1] > 0 ) && s[iINChI][j][1] >= 0) /* ??? != NO_VALUE_INT ??? */
  ------------------
  |  Branch (3067:51): [True: 0, False: 0]
  |  Branch (3067:74): [True: 0, False: 0]
  |  Branch (3067:99): [True: 0, False: 0]
  ------------------
 3068|      0|                                            {
 3069|      0|                                                pInChI->StereoIsotopic->nCompInv2Abs = 2;
 3070|      0|                                            }
 3071|      0|                                            else
 3072|      0|                                            {
 3073|      0|                                                pInChI->StereoIsotopic->nCompInv2Abs = 0;
 3074|      0|                                            }
 3075|      0|                                        }
 3076|      0|                                        if (!( pInChI->nFlags & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ))
  ------------------
  |  |  149|      0|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                      if (!( pInChI->nFlags & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) ))
  ------------------
  |  |  150|      0|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (3076:45): [True: 0, False: 0]
  ------------------
 3077|      0|                                        {
 3078|      0|                                            pInChI->nFlags |= ( nFlags & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) );
  ------------------
  |  |  149|      0|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                                          pInChI->nFlags |= ( nFlags & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) );
  ------------------
  |  |  150|      0|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
 3079|      0|                                        }
 3080|      0|                                    }
 3081|      0|                                }
 3082|     50|                                else
 3083|     50|                                {
 3084|       |                                    /* copy sp3 inversion info only: Fixed-H -> isotopic Fixed H  */
 3085|     50|                                    if (( pInChI->Stereo && pInChI->Stereo->t_parity ) &&
  ------------------
  |  Branch (3085:43): [True: 0, False: 50]
  |  Branch (3085:61): [True: 0, False: 0]
  ------------------
 3086|     50|                                         !( pAltInChI->StereoIsotopic && pAltInChI->StereoIsotopic->t_parity ) &&
  ------------------
  |  Branch (3086:45): [True: 0, False: 0]
  |  Branch (3086:74): [True: 0, False: 0]
  ------------------
 3087|     50|                                         ( pAltInChI->StereoIsotopic && pAltInChI->StereoIsotopic->nNumberOfStereoCenters ) &&
  ------------------
  |  Branch (3087:44): [True: 0, False: 0]
  |  Branch (3087:73): [True: 0, False: 0]
  ------------------
 3088|     50|                                         ( pInChI->StereoIsotopic && pInChI->StereoIsotopic->nNumberOfStereoCenters ) &&
  ------------------
  |  Branch (3088:44): [True: 0, False: 0]
  |  Branch (3088:70): [True: 0, False: 0]
  ------------------
 3089|     50|                                         pInChI->Stereo->nCompInv2Abs &&
  ------------------
  |  Branch (3089:42): [True: 0, False: 0]
  ------------------
 3090|     50|                                         ( !pInChI->StereoIsotopic->nCompInv2Abs || NO_VALUE_INT == pInChI->StereoIsotopic->nCompInv2Abs ))
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (3090:44): [True: 0, False: 0]
  |  Branch (3090:85): [True: 0, False: 0]
  ------------------
 3091|      0|                                    {
 3092|       |                                        /* added 05-09-2006 */
 3093|      0|                                        if (0 > ( ret2 = CopySegment( pInChI, pInChI, CPY_SP3_M, 1, 0 ) ))
  ------------------
  |  Branch (3093:45): [True: 0, False: 0]
  ------------------
 3094|      0|                                        {
 3095|      0|                                            goto exit_function;
 3096|      0|                                        }
 3097|      0|                                    }
 3098|     50|                                }
 3099|     50|                            }
 3100|  68.7k|                            if (bIso &&
  ------------------
  |  Branch (3100:33): [True: 50, False: 68.6k]
  ------------------
 3101|  68.7k|                                 !( pInChI->Stereo && pInChI->Stereo->nNumberOfStereoBonds ) &&
  ------------------
  |  Branch (3101:37): [True: 0, False: 50]
  |  Branch (3101:55): [True: 0, False: 0]
  ------------------
 3102|  68.7k|                                 !( pAltInChI->Stereo && pAltInChI->Stereo->nNumberOfStereoBonds ) &&
  ------------------
  |  Branch (3102:37): [True: 0, False: 50]
  |  Branch (3102:58): [True: 0, False: 0]
  ------------------
 3103|  68.7k|                                 ( pAltInChI->StereoIsotopic && pAltInChI->StereoIsotopic->nNumberOfStereoBonds ) &&
  ------------------
  |  Branch (3103:36): [True: 0, False: 50]
  |  Branch (3103:65): [True: 0, False: 0]
  ------------------
 3104|  68.7k|                                 ( !pInChI->StereoIsotopic || !pInChI->StereoIsotopic->b_parity ))
  ------------------
  |  Branch (3104:36): [True: 0, False: 0]
  |  Branch (3104:63): [True: 0, False: 0]
  ------------------
 3105|      0|                            {
 3106|      0|                                if (0 > ( ret2 = CopySegment( pInChI, pAltInChI, CPY_SP2, 1, 1 ) ))
  ------------------
  |  Branch (3106:37): [True: 0, False: 0]
  ------------------
 3107|      0|                                {
 3108|      0|                                    goto exit_function;
 3109|      0|                                }
 3110|      0|                            }
 3111|  68.7k|                        }
 3112|   140k|                    }
 3113|   140k|                } /* end of component cycle (k) */
 3114|    728|            } /* end of Mobile/Fixed H cycle (j) */
 3115|       |
 3116|       |              /**** replace NO_VALUE_INT with zeroes in all Mobile & Fixed H components ****/
 3117|  1.09k|            for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  578|  1.09k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (3117:25): [True: 728, False: 364]
  ------------------
 3118|    728|            {
 3119|   140k|                for (k = 0; k < nNumComponents[iINChI][j]; k++)
  ------------------
  |  Branch (3119:29): [True: 140k, False: 728]
  ------------------
 3120|   140k|                {
 3121|   140k|                    if (pInpInChI[iINChI][j])
  ------------------
  |  Branch (3121:25): [True: 140k, False: 0]
  ------------------
 3122|   140k|                    {
 3123|   140k|                        INChI *pInChI = &pInpInChI[iINChI][j][k];
 3124|   140k|                        if (pInChI->nTotalCharge == NO_VALUE_INT)
  ------------------
  |  |   51|   140k|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (3124:29): [True: 14.8k, False: 125k]
  ------------------
 3125|  14.8k|                        {
 3126|  14.8k|                            pInChI->nTotalCharge = 0;
 3127|  14.8k|                        }
 3128|   140k|                        if (pInChI->Stereo && pInChI->StereoIsotopic &&
  ------------------
  |  Branch (3128:29): [True: 258, False: 139k]
  |  Branch (3128:47): [True: 0, False: 258]
  ------------------
 3129|   140k|                             pInChI->StereoIsotopic->nCompInv2Abs == NO_VALUE_INT)
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (3129:30): [True: 0, False: 0]
  ------------------
 3130|      0|                        {
 3131|      0|                            if (pInChI->Stereo->nNumberOfStereoCenters &&
  ------------------
  |  Branch (3131:33): [True: 0, False: 0]
  ------------------
 3132|      0|                                 pInChI->Stereo->nCompInv2Abs != NO_VALUE_INT)
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (3132:34): [True: 0, False: 0]
  ------------------
 3133|      0|                            {
 3134|      0|                                pInChI->StereoIsotopic->nCompInv2Abs = pInChI->Stereo->nCompInv2Abs;
 3135|      0|                            }
 3136|      0|                        }
 3137|       |                        /* Add special nCompInv2Abs=2 to force /s2 or /s3 in InChI output */
 3138|   140k|                        if (pInChI->Stereo && pInChI->Stereo->nCompInv2Abs == NO_VALUE_INT)
  ------------------
  |  |   51|    258|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (3138:29): [True: 258, False: 139k]
  |  Branch (3138:47): [True: 258, False: 0]
  ------------------
 3139|    258|                        {
 3140|    258|                            if (pInChI->nFlags & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) &&
  ------------------
  |  |  149|    258|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                          if (pInChI->nFlags & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) &&
  ------------------
  |  |  150|    258|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (3140:33): [True: 0, False: 258]
  ------------------
 3141|    258|                                 pInChI->Stereo->nNumberOfStereoCenters)
  ------------------
  |  Branch (3141:34): [True: 0, False: 0]
  ------------------
 3142|      0|                            {
 3143|      0|                                pInChI->Stereo->nCompInv2Abs = ( s[iINChI][j][0] > 0 /*|| s[iINChI][j][1]>0*/ ) ? 2 : 0; /* we do not know the real value */
  ------------------
  |  Branch (3143:64): [True: 0, False: 0]
  ------------------
 3144|      0|                            }
 3145|    258|                            else
 3146|    258|                            {
 3147|    258|                                pInChI->Stereo->nCompInv2Abs = 0;
 3148|    258|                            }
 3149|    258|                        }
 3150|   140k|                        if (pInChI->StereoIsotopic && pInChI->StereoIsotopic->nCompInv2Abs == NO_VALUE_INT)
  ------------------
  |  |   51|  53.8k|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (3150:29): [True: 53.8k, False: 86.3k]
  |  Branch (3150:55): [True: 53.8k, False: 0]
  ------------------
 3151|  53.8k|                        {
 3152|  53.8k|                            if (pInChI->nFlags & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) &&
  ------------------
  |  |  149|  53.8k|#define INCHI_FLAG_REL_STEREO           0x0002   /* requested relative stereo               */
  ------------------
                                          if (pInChI->nFlags & ( INCHI_FLAG_REL_STEREO | INCHI_FLAG_RAC_STEREO ) &&
  ------------------
  |  |  150|  53.8k|#define INCHI_FLAG_RAC_STEREO           0x0004   /* requested racemic stereo                */
  ------------------
  |  Branch (3152:33): [True: 0, False: 53.8k]
  ------------------
 3153|  53.8k|                                 pInChI->StereoIsotopic->nNumberOfStereoCenters)
  ------------------
  |  Branch (3153:34): [True: 0, False: 0]
  ------------------
 3154|      0|                            {
 3155|      0|                                pInChI->StereoIsotopic->nCompInv2Abs = s[iINChI][j][1] > 0 ? 2 : 0; /* we do not know the real value */
  ------------------
  |  Branch (3155:72): [True: 0, False: 0]
  ------------------
 3156|      0|                            }
 3157|  53.8k|                            else
 3158|  53.8k|                            {
 3159|  53.8k|                                pInChI->StereoIsotopic->nCompInv2Abs = 0;
 3160|  53.8k|                            }
 3161|  53.8k|                        }
 3162|       |                        /* added 02-07-2006 */
 3163|   140k|                        if (pInChI->Stereo && pInChI->Stereo->nCompInv2Abs == NO_VALUE_INT ||
  ------------------
  |  |   51|   140k|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (3163:29): [True: 258, False: 139k]
  |  Branch (3163:47): [True: 0, False: 258]
  ------------------
 3164|   140k|                             pInChI->StereoIsotopic && pInChI->StereoIsotopic->nCompInv2Abs == NO_VALUE_INT)
  ------------------
  |  |   51|  53.8k|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (3164:30): [True: 53.8k, False: 86.3k]
  |  Branch (3164:56): [True: 0, False: 53.8k]
  ------------------
 3165|      0|                        {
 3166|      0|                            ret2 = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 3167|      0|                            goto exit_function;
 3168|      0|                        }
 3169|   140k|                        if (!pInChI->bDeleted && pInChI->nNumberOfAtoms)
  ------------------
  |  Branch (3169:29): [True: 140k, False: 0]
  |  Branch (3169:50): [True: 140k, False: 0]
  ------------------
 3170|   140k|                        {
 3171|   140k|                            tot_charge[iINChI][j] += pInChI->nTotalCharge;
 3172|  68.3M|                            for (m = 0; m < pInChI->nNumberOfAtoms; m++)
  ------------------
  |  Branch (3172:41): [True: 68.2M, False: 140k]
  ------------------
 3173|  68.2M|                            {
 3174|  68.2M|                                if (pInChI->nAtom[m] < EL_NUMBER_H || pInChI->nAtom[m] > nElDataLen)
  ------------------
  |  |   41|   136M|#define EL_NUMBER_H ((U_CHAR) 1)
  ------------------
  |  Branch (3174:37): [True: 0, False: 68.2M]
  |  Branch (3174:71): [True: 0, False: 68.2M]
  ------------------
 3175|      0|                                {
 3176|      0|                                    ret2 = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 3177|      0|                                    goto exit_function;
 3178|      0|                                }
 3179|       |                                /* all atoms except H */
 3180|  68.2M|                                if (pInChI->nAtom[m] > EL_NUMBER_H)
  ------------------
  |  |   41|  68.2M|#define EL_NUMBER_H ((U_CHAR) 1)
  ------------------
  |  Branch (3180:37): [True: 68.2M, False: 9.90k]
  ------------------
 3181|  68.2M|                                {
 3182|  68.2M|                                    num_elem[iINChI][j][pInChI->nAtom[m]].num++;
 3183|  68.2M|                                }
 3184|  68.2M|                            }
 3185|   140k|                            if (0 > ( ret2 = GetInChINumH( pInChI, &m ) ))
  ------------------
  |  Branch (3185:33): [True: 0, False: 140k]
  ------------------
 3186|      0|                            {
 3187|      0|                                goto exit_function;
 3188|      0|                            }
 3189|   140k|                            num_elem[iINChI][j][EL_NUMBER_H].num += m;
  ------------------
  |  |   41|   140k|#define EL_NUMBER_H ((U_CHAR) 1)
  ------------------
 3190|   140k|                        }
 3191|   140k|                    }
 3192|   140k|                }
 3193|    728|            }
 3194|       |
 3195|  1.09k|            for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  578|  1.09k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (3195:25): [True: 728, False: 364]
  ------------------
 3196|    728|            {
 3197|   140k|                for (k = 0; k < nNumComponents[iINChI][j]; k++)
  ------------------
  |  Branch (3197:29): [True: 140k, False: 728]
  ------------------
 3198|   140k|                {
 3199|   140k|                    if (pInpInChI[iINChI][j])
  ------------------
  |  Branch (3199:25): [True: 140k, False: 0]
  ------------------
 3200|   140k|                    {
 3201|   140k|                        INChI *pInChI = &pInpInChI[iINChI][j][k];
 3202|   140k|                        if (pInChI->Stereo && !pInChI->Stereo->nNumberOfStereoCenters)
  ------------------
  |  Branch (3202:29): [True: 258, False: 139k]
  |  Branch (3202:47): [True: 258, False: 0]
  ------------------
 3203|    258|                        {
 3204|    258|                            pInChI->Stereo->nCompInv2Abs = 0;
 3205|    258|                        }
 3206|   140k|                        if (pInChI->StereoIsotopic && !pInChI->StereoIsotopic->nNumberOfStereoCenters)
  ------------------
  |  Branch (3206:29): [True: 53.8k, False: 86.3k]
  |  Branch (3206:55): [True: 53.8k, False: 0]
  ------------------
 3207|  53.8k|                        {
 3208|  53.8k|                            pInChI->StereoIsotopic->nCompInv2Abs = 0;
 3209|  53.8k|                        }
 3210|   140k|                    }
 3211|   140k|                }
 3212|    728|            }
 3213|       |
 3214|    364|#if ( FIX_I2I_STEREOCONVERSION_BUG3 == 1 )
 3215|       |            /* (2008-04-10)   1=> Fix bug of i2i conversion */
 3216|       |            /* (missed repeating /s in FI after F for multi-component case) */
 3217|    364|            if (nNumComponents[iINChI][TAUT_NON] > 1)                     /* if multi-component */
  ------------------
  |  |  579|    364|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (3217:17): [True: 34, False: 330]
  ------------------
 3218|     34|            {
 3219|     34|                if (!s[iINChI][TAUT_YES][0] && !s[iINChI][TAUT_YES][1])/* if no /s in M, MI */
  ------------------
  |  |  580|     34|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                              if (!s[iINChI][TAUT_YES][0] && !s[iINChI][TAUT_YES][1])/* if no /s in M, MI */
  ------------------
  |  |  580|     34|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3219:21): [True: 34, False: 0]
  |  Branch (3219:48): [True: 34, False: 0]
  ------------------
 3220|     34|                {
 3221|     34|                    if (( s[iINChI][TAUT_NON][0] > 1 ) && ( s[iINChI][TAUT_NON][1] > 1 ))     /* if /srel/srac in both F, FI */
  ------------------
  |  |  579|     34|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                                  if (( s[iINChI][TAUT_NON][0] > 1 ) && ( s[iINChI][TAUT_NON][1] > 1 ))     /* if /srel/srac in both F, FI */
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (3221:25): [True: 0, False: 34]
  |  Branch (3221:59): [True: 0, False: 0]
  ------------------
 3222|      0|                    {
 3223|      0|                        if (s[iINChI][TAUT_NON][0] == s[iINChI][TAUT_NON][1])  /* if same stereo in F and FI */
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                                      if (s[iINChI][TAUT_NON][0] == s[iINChI][TAUT_NON][1])  /* if same stereo in F and FI */
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (3223:29): [True: 0, False: 0]
  ------------------
 3224|      0|                        {
 3225|       |                            /* we assume that at least one component in F has no actual stereo */
 3226|       |                            /* and place deliberately 0 to appropriate place */
 3227|      0|                            for (k = 0; k < nNumComponents[iINChI][TAUT_NON]; k++)
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (3227:41): [True: 0, False: 0]
  ------------------
 3228|      0|                            {
 3229|      0|                                INChI *pInChI = &pInpInChI[iINChI][TAUT_NON][k];
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 3230|      0|                                if (pInChI->Stereo->nCompInv2Abs != 0)
  ------------------
  |  Branch (3230:37): [True: 0, False: 0]
  ------------------
 3231|      0|                                {
 3232|      0|                                    pInChI->Stereo->nCompInv2Abs = 0;
 3233|      0|                                    goto fini;
 3234|      0|                                }
 3235|      0|                            }
 3236|      0|                        }
 3237|      0|                    }
 3238|     34|                }
 3239|     34|            }
 3240|    364|        fini:;
 3241|    364|#endif
 3242|    364|            if (num_elem[iINChI][TAUT_YES])
  ------------------
  |  |  580|    364|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3242:17): [True: 196, False: 168]
  ------------------
 3243|    196|            {
 3244|    196|                tot_charge[iINChI][TAUT_YES] += nNumProtons[iINChI][TAUT_YES].nNumRemovedProtons;
  ------------------
  |  |  580|    196|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                              tot_charge[iINChI][TAUT_YES] += nNumProtons[iINChI][TAUT_YES].nNumRemovedProtons;
  ------------------
  |  |  580|    196|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3245|    196|                num_elem[iINChI][TAUT_YES][EL_NUMBER_H].num += nNumProtons[iINChI][TAUT_YES].nNumRemovedProtons;
  ------------------
  |  |  580|    196|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                              num_elem[iINChI][TAUT_YES][EL_NUMBER_H].num += nNumProtons[iINChI][TAUT_YES].nNumRemovedProtons;
  ------------------
  |  |   41|    196|#define EL_NUMBER_H ((U_CHAR) 1)
  ------------------
                              num_elem[iINChI][TAUT_YES][EL_NUMBER_H].num += nNumProtons[iINChI][TAUT_YES].nNumRemovedProtons;
  ------------------
  |  |  580|    196|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3246|    196|            }
 3247|       |
 3248|       |            /**** Count H and isotopic H in Mobile and Fixed H represntations of components */
 3249|       |            /* if at least one component has Fixed-H layer then all components have Fixed-H */
 3250|       |            /* layer; those whose Fixed-H layer is empty have Fixed-H layer same as Mobile-H layer */
 3251|    364|            if (nNumComponents[iINChI][TAUT_NON])
  ------------------
  |  |  579|    364|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (3251:17): [True: 68, False: 296]
  ------------------
 3252|     68|            {
 3253|       |                /* only if both Mobile and Fixed H exist */
 3254|     68|                int nFormulaH[TAUT_NUM], nNumH[TAUT_NUM], nCharge[TAUT_NUM], nNumIsotopicH[TAUT_NUM][NUM_H_ISOTOPES];
 3255|     68|                int nRemovedCharge, nRemovedH, nRemovedIsotopicH[NUM_H_ISOTOPES], nFoundRemovedIsoH;
 3256|     68|                int nTotRemovedProtons, nTotRemovedIsotopicH[NUM_H_ISOTOPES], bExists[TAUT_NUM];
 3257|     68|                INChI *pInChI[TAUT_NUM];
 3258|     68|                nTotRemovedProtons = 0;
 3259|     68|                memset( nTotRemovedIsotopicH, 0, sizeof( nTotRemovedIsotopicH ) );
 3260|     68|                len2 = inchi_max( nNumComponents[iINChI][TAUT_YES], nNumComponents[iINChI][TAUT_NON] );
  ------------------
  |  |  166|     68|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 68]
  |  |  ------------------
  ------------------
 3261|       |
 3262|  53.9k|                for (k = 0; k < len2; k++)
  ------------------
  |  Branch (3262:29): [True: 53.8k, False: 50]
  ------------------
 3263|  53.8k|                {
 3264|       |                    /* k is a component index */
 3265|   161k|                    for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  578|   161k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (3265:33): [True: 107k, False: 53.8k]
  ------------------
 3266|   107k|                    {
 3267|       |                        /* j is 0=TAUT_NON or 1=TAUT_YES */
 3268|   107k|                        pInChI[j] = NULL; /* initialization 2006-03 */
 3269|   107k|                        bExists[j] = ( k < nNumComponents[iINChI][j] ) &&
  ------------------
  |  Branch (3269:38): [True: 107k, False: 0]
  ------------------
 3270|   107k|                            pInpInChI[iINChI][j][k].nNumberOfAtoms &&
  ------------------
  |  Branch (3270:29): [True: 107k, False: 0]
  ------------------
 3271|   107k|                            !pInpInChI[iINChI][j][k].bDeleted;
  ------------------
  |  Branch (3271:29): [True: 107k, False: 0]
  ------------------
 3272|   107k|                    }
 3273|  53.8k|                    if (!bExists[TAUT_NON])
  ------------------
  |  |  579|  53.8k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (3273:25): [True: 0, False: 53.8k]
  ------------------
 3274|      0|                    {
 3275|       |                        /* TAUT_YES does not exist for a proton (H+) in TAUT_NON */
 3276|      0|                        ret2 = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 3277|      0|                        goto exit_function;
 3278|      0|                    }
 3279|       |                    /* at this point at least one of Mobile[k] and Fixed[k] real InChI exists */
 3280|       |                    /* initialize for counting removed protons and isotopic H from kth  Mobile-H component */
 3281|   161k|                    for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  578|   161k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (3281:33): [True: 107k, False: 53.8k]
  ------------------
 3282|   107k|                    {
 3283|   107k|                        if (bExists[j])
  ------------------
  |  Branch (3283:29): [True: 107k, False: 0]
  ------------------
 3284|   107k|                        {
 3285|   107k|                            pInChI[j] = &pInpInChI[iINChI][j][k];  /* BC: reading uninit memory (fixed?) */
 3286|   107k|                        }
 3287|   107k|                        nFormulaH[j] = 0;
 3288|   107k|                        nNumH[j] = 0;
 3289|   107k|                        nCharge[j] = 0;
 3290|   431k|                        for (m = 0; m < NUM_H_ISOTOPES; m++)
  ------------------
  |  |  100|   431k|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (3290:37): [True: 323k, False: 107k]
  ------------------
 3291|   323k|                        {
 3292|   323k|                            nNumIsotopicH[j][m] = 0;
 3293|   323k|                        }
 3294|   107k|                    }
 3295|       |                    /* extract number of H, isotopic H, and charge */
 3296|   161k|                    for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  578|   161k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (3296:33): [True: 107k, False: 53.8k]
  ------------------
 3297|   107k|                    {
 3298|   107k|                        if (!bExists[j])
  ------------------
  |  Branch (3298:29): [True: 0, False: 107k]
  ------------------
 3299|      0|                        {
 3300|      0|                            continue;
 3301|      0|                        }
 3302|   107k|                        if (0 >( ret2 = GetInChIFormulaNumH( pInChI[j], &nFormulaH[j] ) ) ||
  ------------------
  |  Branch (3302:29): [True: 0, False: 107k]
  ------------------
 3303|   107k|                             0 > ( ret2 = GetInChINumH( pInChI[j], &nNumH[j] ) ) ||
  ------------------
  |  Branch (3303:30): [True: 0, False: 107k]
  ------------------
 3304|   107k|                             0 > ( ret2 = GetInChIIsoH( pInChI[j], nNumIsotopicH[j] ) ))
  ------------------
  |  Branch (3304:30): [True: 0, False: 107k]
  ------------------
 3305|      0|                        {
 3306|      0|                            goto exit_function;
 3307|      0|                        }
 3308|   107k|                        nCharge[j] = pInChI[j]->nTotalCharge;
 3309|   107k|                    }
 3310|   161k|                    for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  578|   161k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (3310:33): [True: 107k, False: 53.8k]
  ------------------
 3311|   107k|                    {
 3312|   107k|                        if (!bExists[j])
  ------------------
  |  Branch (3312:29): [True: 0, False: 107k]
  ------------------
 3313|      0|                        {
 3314|      0|                            continue;
 3315|      0|                        }
 3316|   107k|                        if (nFormulaH[j] != nNumH[j])
  ------------------
  |  Branch (3316:29): [True: 18, False: 107k]
  ------------------
 3317|     18|                        {
 3318|     18|                            ret2 = RI_ERR_SYNTAX;
  ------------------
  |  |   44|     18|#define RI_ERR_SYNTAX  (-2)
  ------------------
 3319|     18|                            goto exit_function;
 3320|     18|                        }
 3321|   107k|                    }
 3322|  53.8k|                    nFoundRemovedIsoH = 0;
 3323|  53.8k|                    nRemovedCharge = nCharge[TAUT_NON] - nCharge[TAUT_YES];
  ------------------
  |  |  579|  53.8k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                                  nRemovedCharge = nCharge[TAUT_NON] - nCharge[TAUT_YES];
  ------------------
  |  |  580|  53.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3324|  53.8k|                    nRemovedH = nNumH[TAUT_NON] - nNumH[TAUT_YES];
  ------------------
  |  |  579|  53.8k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                                  nRemovedH = nNumH[TAUT_NON] - nNumH[TAUT_YES];
  ------------------
  |  |  580|  53.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3325|   215k|                    for (m = 0; m < NUM_H_ISOTOPES; m++)
  ------------------
  |  |  100|   215k|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (3325:33): [True: 161k, False: 53.8k]
  ------------------
 3326|   161k|                    {
 3327|   161k|                        nFoundRemovedIsoH += 0 != ( nRemovedIsotopicH[m] = nNumIsotopicH[TAUT_NON][m] -
  ------------------
  |  |  579|   161k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 3328|   161k|                                                    nNumIsotopicH[TAUT_YES][m] );
  ------------------
  |  |  580|   161k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3329|   161k|                    }
 3330|  53.8k|                    if (nRemovedCharge != nRemovedH)
  ------------------
  |  Branch (3330:25): [True: 0, False: 53.8k]
  ------------------
 3331|      0|                    {
 3332|      0|                        ret2 = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 3333|      0|                        goto exit_function;
 3334|      0|                    }
 3335|  53.8k|                    if (nRemovedCharge || nFoundRemovedIsoH)
  ------------------
  |  Branch (3335:25): [True: 0, False: 53.8k]
  |  Branch (3335:43): [True: 10, False: 53.8k]
  ------------------
 3336|     10|                    {
 3337|     10|                        COMPONENT_REM_PROTONS *pNumProtons;
 3338|     10|                        if (!nNumProtons[iINChI][TAUT_YES].pNumProtons)
  ------------------
  |  |  580|     10|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3338:29): [True: 10, False: 0]
  ------------------
 3339|     10|                        {
 3340|       |                            /* allocate only if needed */
 3341|     10|                            nNumProtons[iINChI][TAUT_YES].pNumProtons =
  ------------------
  |  |  580|     10|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3342|     10|                                (COMPONENT_REM_PROTONS *) inchi_calloc( len2,
  ------------------
  |  | 1133|     10|#define inchi_calloc   calloc
  ------------------
 3343|     10|                                                                        sizeof( nNumProtons[0][0].pNumProtons[0] ) );
 3344|     10|                            if (!nNumProtons[iINChI][TAUT_YES].pNumProtons)
  ------------------
  |  |  580|     10|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3344:33): [True: 0, False: 10]
  ------------------
 3345|      0|                            {
 3346|      0|                                ret2 = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 3347|      0|                                goto exit_function;
 3348|      0|                            }
 3349|     10|                        }
 3350|     10|                        pNumProtons = nNumProtons[iINChI][TAUT_YES].pNumProtons + k;
  ------------------
  |  |  580|     10|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3351|     10|                        pNumProtons->nNumRemovedProtons = nRemovedH;
 3352|     10|                        nTotRemovedProtons += nRemovedH;
 3353|     40|                        for (m = 0; m < NUM_H_ISOTOPES; m++)
  ------------------
  |  |  100|     40|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (3353:37): [True: 30, False: 10]
  ------------------
 3354|     30|                        {
 3355|     30|                            pNumProtons->nNumRemovedIsotopicH[m] = nRemovedIsotopicH[m];
 3356|     30|                            nTotRemovedIsotopicH[m] += nRemovedIsotopicH[m];
 3357|     30|                        }
 3358|       |                        /* make sure the Mobile-H InChI has nTautomer */
 3359|     10|                        if (pInChI[TAUT_YES] && bExists[TAUT_YES])
  ------------------
  |  |  580|     10|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                                      if (pInChI[TAUT_YES] && bExists[TAUT_YES])
  ------------------
  |  |  580|     10|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3359:29): [True: 10, False: 0]
  |  Branch (3359:49): [True: 10, False: 0]
  ------------------
 3360|     10|                        {
 3361|     10|                            if (!pInChI[TAUT_YES]->lenTautomer)
  ------------------
  |  |  580|     10|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3361:33): [True: 10, False: 0]
  ------------------
 3362|     10|                            {
 3363|     10|                                pInChI[TAUT_YES]->lenTautomer = 1;
  ------------------
  |  |  580|     10|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3364|     10|                            }
 3365|     10|                            if (!pInChI[TAUT_YES]->nTautomer)
  ------------------
  |  |  580|     10|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3365:33): [True: 10, False: 0]
  ------------------
 3366|     10|                            {
 3367|     10|                                pInChI[TAUT_YES]->nTautomer = (AT_NUMB *) inchi_calloc( pInChI[TAUT_YES]->lenTautomer, sizeof( pInChI[0]->nTautomer[0] ) );
  ------------------
  |  |  580|     10|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                                              pInChI[TAUT_YES]->nTautomer = (AT_NUMB *) inchi_calloc( pInChI[TAUT_YES]->lenTautomer, sizeof( pInChI[0]->nTautomer[0] ) );
  ------------------
  |  | 1133|     10|#define inchi_calloc   calloc
  ------------------
                                              pInChI[TAUT_YES]->nTautomer = (AT_NUMB *) inchi_calloc( pInChI[TAUT_YES]->lenTautomer, sizeof( pInChI[0]->nTautomer[0] ) );
  ------------------
  |  |  580|     10|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3368|     10|                            }
 3369|     10|                        }
 3370|     10|                    }
 3371|  53.8k|                }
 3372|     50|                if (nNumProtons[iINChI][TAUT_YES].pNumProtons)
  ------------------
  |  |  580|     50|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3372:21): [True: 10, False: 40]
  ------------------
 3373|     10|                {
 3374|       |                    /* check consistency */
 3375|       |#if ( FIX_ISO_FIXEDH_BUG_READ == 1 )
 3376|       |                    int iso_diff[NUM_H_ISOTOPES], iso_diff_tot = 0;
 3377|       |#endif
 3378|     10|                    if (nTotRemovedProtons != nNumProtons[iINChI][TAUT_YES].nNumRemovedProtons)
  ------------------
  |  |  580|     10|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3378:25): [True: 0, False: 10]
  ------------------
 3379|      0|                    {
 3380|      0|                        ret2 = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 3381|      0|                        goto exit_function;
 3382|      0|                    }
 3383|       |#if ( FIX_ISO_FIXEDH_BUG_READ == 1 )
 3384|       |                    for (m = 0; m < NUM_H_ISOTOPES; m++)
 3385|       |                    {
 3386|       |                        iso_diff[m] = nNumProtons[iINChI][TAUT_YES].nNumRemovedIsotopicH[m] - nTotRemovedIsotopicH[m];
 3387|       |                        if (iso_diff[m] < 0)
 3388|       |                        {
 3389|       |                            ret2 = RI_ERR_SYNTAX;
 3390|       |                            goto exit_function;
 3391|       |                        }
 3392|       |                        else
 3393|       |                        {
 3394|       |                            /* InChI-1.02b bug: nTotRemovedIsotopicH[m] < nNumProtons[iINChI][TAUT_YES].nNumRemovedIsotopicH[m] */
 3395|       |                            /* in non-tautomeric components where D(+) or T(+) was removed from -NH(+)= or =OH(+)           */
 3396|       |                            iso_diff_tot += iso_diff[m];
 3397|       |                        }
 3398|       |                    }
 3399|       |                    if (iso_diff_tot)
 3400|       |                    {
 3401|       |                        if (0 > bIsoMayBeArranged( bInchi2Struct, iso_diff, nNumProtons, pInpInChI, nNumComponents, iINChI ))
 3402|       |                        {
 3403|       |                            ret2 = RI_ERR_SYNTAX;
 3404|       |                            goto exit_function;
 3405|       |                        }
 3406|       |                    }
 3407|       |#else
 3408|     10|                    for (m = 0; m < NUM_H_ISOTOPES; m++)
  ------------------
  |  |  100|     10|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (3408:33): [True: 10, False: 0]
  ------------------
 3409|     10|                    {
 3410|     10|                        if (nTotRemovedIsotopicH[m] != nNumProtons[iINChI][TAUT_YES].nNumRemovedIsotopicH[m])
  ------------------
  |  |  580|     10|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3410:29): [True: 10, False: 0]
  ------------------
 3411|     10|                        {
 3412|     10|                            ret2 = RI_ERR_SYNTAX;
  ------------------
  |  |   44|     10|#define RI_ERR_SYNTAX  (-2)
  ------------------
 3413|     10|                            goto exit_function;
 3414|     10|                        }
 3415|     10|                    }
 3416|     10|#endif
 3417|     10|                }
 3418|     50|            }
 3419|       |
 3420|       |            /* make Mobile H and Fixed H InChI arrays have same length */
 3421|    336|            len2 = len1 = 0;
 3422|    336|            if (nNumComponents[iINChI][TAUT_YES] < nNumComponents[iINChI][TAUT_NON])
  ------------------
  |  |  580|    336|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                          if (nNumComponents[iINChI][TAUT_YES] < nNumComponents[iINChI][TAUT_NON])
  ------------------
  |  |  579|    336|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (3422:17): [True: 0, False: 336]
  ------------------
 3423|      0|            {
 3424|      0|                j = TAUT_YES; /* less components in Mobile-H layer */
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3425|      0|                len2 = nNumComponents[iINChI][TAUT_NON];
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 3426|      0|                len1 = nNumComponents[iINChI][TAUT_YES];
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3427|      0|            }
 3428|    336|            else
 3429|    336|                if (nNumComponents[iINChI][TAUT_YES] > nNumComponents[iINChI][TAUT_NON])
  ------------------
  |  |  580|    336|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                              if (nNumComponents[iINChI][TAUT_YES] > nNumComponents[iINChI][TAUT_NON])
  ------------------
  |  |  579|    336|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (3429:21): [True: 128, False: 208]
  ------------------
 3430|    128|                {
 3431|    128|                    j = TAUT_NON;  /* less components in Fixed-H layer */
  ------------------
  |  |  579|    128|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 3432|    128|                    len2 = nNumComponents[iINChI][TAUT_YES];
  ------------------
  |  |  580|    128|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3433|    128|                    len1 = nNumComponents[iINChI][TAUT_NON];
  ------------------
  |  |  579|    128|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 3434|    128|                }
 3435|       |            /* always len1 <= len2; if Mobile-H and Fixed-H have same number of components then len1=len2=0  */
 3436|    336|            if (len2 && len1)
  ------------------
  |  Branch (3436:17): [True: 128, False: 208]
  |  Branch (3436:25): [True: 0, False: 128]
  ------------------
 3437|      0|            {
 3438|      0|                INChI *pInChI = (INChI *) inchi_calloc( len2, sizeof( pInChI[0] ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 3439|      0|                if (!pInChI)
  ------------------
  |  Branch (3439:21): [True: 0, False: 0]
  ------------------
 3440|      0|                {
 3441|      0|                    ret2 = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 3442|      0|                    goto exit_function;
 3443|      0|                }
 3444|      0|                memcpy( pInChI, pInpInChI[iINChI][j], len1 * sizeof( pInChI[0] ) );
 3445|      0|                inchi_free( pInpInChI[iINChI][j] );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3446|      0|                pInpInChI[iINChI][j] = pInChI;
 3447|      0|                nNumComponents[iINChI][j] = len2;
 3448|      0|                for (; len1 < len2; len1++)
  ------------------
  |  Branch (3448:24): [True: 0, False: 0]
  ------------------
 3449|      0|                {
 3450|      0|                    if (j == TAUT_YES)
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3450:25): [True: 0, False: 0]
  ------------------
 3451|      0|                    {
 3452|       |                        /* mark added to Mobile H layer components as deleted protons */
 3453|      0|                        if (0 >( ret2 = nFillOutProtonMobileH( pInpInChI[iINChI][j] + len1 ) ))
  ------------------
  |  Branch (3453:29): [True: 0, False: 0]
  ------------------
 3454|      0|                        {
 3455|      0|                            goto exit_function;
 3456|      0|                        }
 3457|      0|                        if (0 > ( ret2 = nProtonCopyIsotopicInfo( pInpInChI[iINChI][j] + len1/* to */,
  ------------------
  |  Branch (3457:29): [True: 0, False: 0]
  ------------------
 3458|      0|                                                                  pInpInChI[iINChI][TAUT_NON] + len1/* from */ ) ))
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 3459|      0|                        {
 3460|      0|                            goto exit_function;
 3461|      0|                        }
 3462|      0|                    }
 3463|      0|                    else
 3464|      0|                    {
 3465|       |                        /* mark added to Fixed H layer components as empty deleted */
 3466|       |                        /* this should not happen */
 3467|      0|                        pInChI[len1].bDeleted = 1;
 3468|      0|                    }
 3469|      0|                }
 3470|      0|            }
 3471|    336|        } /* end of iINChI cycle */
 3472|       |
 3473|       |          /* check balances */
 3474|    504|        for (iINChI = 0; iINChI < INCHI_NUM; iINChI++)
  ------------------
  |  |  574|    504|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (3474:26): [True: 336, False: 168]
  ------------------
 3475|    336|        {
 3476|    840|            for (i = iINChI; i < INCHI_NUM; i++)
  ------------------
  |  |  574|    840|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (3476:30): [True: 504, False: 336]
  ------------------
 3477|    504|            {
 3478|  1.51k|                for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  578|  1.51k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (3478:29): [True: 1.00k, False: 504]
  ------------------
 3479|  1.00k|                {
 3480|  2.52k|                    for (k = j; k < TAUT_NUM; k++)
  ------------------
  |  |  578|  2.52k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (3480:33): [True: 1.51k, False: 1.00k]
  ------------------
 3481|  1.51k|                    {
 3482|  1.51k|                        if (( iINChI != i || j != k ) && num_elem[iINChI][j] && num_elem[i][k])
  ------------------
  |  Branch (3482:31): [True: 504, False: 1.00k]
  |  Branch (3482:46): [True: 336, False: 672]
  |  Branch (3482:58): [True: 288, False: 552]
  |  Branch (3482:81): [True: 40, False: 248]
  ------------------
 3483|     40|                        {
 3484|     40|                            if (tot_charge[iINChI][j] != tot_charge[i][k])
  ------------------
  |  Branch (3484:33): [True: 0, False: 40]
  ------------------
 3485|      0|                            {
 3486|      0|                                ret2 = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 3487|      0|                                goto exit_function;
 3488|      0|                            }
 3489|  4.96k|                            for (m = 0; m <= nElDataLen; m++)
  ------------------
  |  Branch (3489:41): [True: 4.92k, False: 40]
  ------------------
 3490|  4.92k|                            {
 3491|  4.92k|                                if (num_elem[iINChI][j][m].num != num_elem[i][k][m].num)
  ------------------
  |  Branch (3491:37): [True: 0, False: 4.92k]
  ------------------
 3492|      0|                                {
 3493|      0|                                    ret2 = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 3494|      0|                                    goto exit_function;
 3495|      0|                                }
 3496|  4.92k|                            }
 3497|       |                            /*
 3498|       |                            if ( memcmp( num_elem[iINChI], num_elem[i][k], (nElDataLen+1)*sizeof(num_elem[0][0][0]) ) {
 3499|       |                            ret2 = RI_ERR_SYNTAX;
 3500|       |                            goto exit_function;
 3501|       |                            }
 3502|       |                            */
 3503|     40|                        }
 3504|  1.51k|                    }
 3505|  1.00k|                }
 3506|    504|            }
 3507|    336|        }
 3508|       |
 3509|    168|    }
 3510|    258|    else
 3511|    258|    {
 3512|    258|        ret2 = ret;
 3513|    258|    }
 3514|       |
 3515|    454|exit_function:
 3516|       |
 3517|  1.36k|    for (i = 0; i < INCHI_NUM; i++)
  ------------------
  |  |  574|  1.36k|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (3517:17): [True: 908, False: 454]
  ------------------
 3518|    908|    {
 3519|  2.72k|        for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  578|  2.72k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (3519:21): [True: 1.81k, False: 908]
  ------------------
 3520|  1.81k|        {
 3521|  1.81k|            if (num_elem[i][j])
  ------------------
  |  Branch (3521:17): [True: 264, False: 1.55k]
  ------------------
 3522|    264|            {
 3523|    264|                inchi_free( num_elem[i][j] );
  ------------------
  |  | 1136|    264|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 264, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3524|    264|                num_elem[i][j] = NULL;
 3525|    264|            }
 3526|  1.81k|        }
 3527|    908|    }
 3528|    454|    *nErr = ( ret2 < 0 && ret2 != RI_ERR_EOL ) ? ret2 : 0;
  ------------------
  |  |   46|    286|#define RI_ERR_EOL     (-4)
  ------------------
  |  Branch (3528:15): [True: 286, False: 168]
  |  Branch (3528:27): [True: 279, False: 7]
  ------------------
 3529|       |
 3530|    454|    return ret;
 3531|    454|}
ReadInChICoord:
 4574|     42|{
 4575|     42|    int     c;
 4576|     42|    int     fst;
 4577|     42|    int     ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|     42|#define RI_ERR_ALLOC   (-1)
  ------------------
 4578|     42|    int     bMobileH = TAUT_YES;
  ------------------
  |  |  580|     42|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4579|     42|    int     bReconn = INCHI_BAS;
  ------------------
  |  |  575|     42|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 4580|     42|    int     state = -1;
 4581|     42|    int     prev_state = -1;
 4582|     42|    int     nLenXYZ = 0;
 4583|     42|    int     bAbc = -1;   /* initially undefined */
 4584|     42|    const char
 4585|     42|        szToken[] = INCHI_TOKEN;
  ------------------
  |  |  298|     42|#define INCHI_TOKEN "/\n\r\t\\"
  ------------------
 4586|     42|    XYZ_COORD
 4587|     42|        *pXYZ = NULL;
 4588|       |
 4589|     42|    *pState = 0;
 4590|     42|    INCHI_HEAPCHK
 4591|       |
 4592|       |        /* Get "InChI=1/" */
 4593|     42|        if (pLine->len)
  ------------------
  |  Branch (4593:13): [True: 0, False: 42]
  ------------------
 4594|      0|        {
 4595|      0|            c = pLine->c;
 4596|      0|        }
 4597|     42|        else
 4598|     42|        {
 4599|     42|            c = nGetInChISegment( pInp, pLine, szToken );
 4600|     42|        }
 4601|     42|    if (c == RI_ERR_EOF && !pLine->len && !pLine->str[0])
  ------------------
  |  |   47|     84|#define RI_ERR_EOF     (0)
  ------------------
  |  Branch (4601:9): [True: 42, False: 0]
  |  Branch (4601:28): [True: 39, False: 3]
  |  Branch (4601:43): [True: 39, False: 0]
  ------------------
 4602|     39|    {
 4603|     39|        ret = c;
 4604|     39|        pLine->len = 0;
 4605|     39|        goto exit_error;
 4606|     39|    }
 4607|      3|    if (pLine->len == 0 || c != SEG_END && c != RI_ERR_EOF && !INCHI_INP_EOL( c ))
  ------------------
  |  |  294|      6|#define SEG_END '/'
  ------------------
                  if (pLine->len == 0 || c != SEG_END && c != RI_ERR_EOF && !INCHI_INP_EOL( c ))
  ------------------
  |  |   47|      6|#define RI_ERR_EOF     (0)
  ------------------
                  if (pLine->len == 0 || c != SEG_END && c != RI_ERR_EOF && !INCHI_INP_EOL( c ))
  ------------------
  |  |  296|      0|#define INCHI_INP_EOL(X) ((X)=='\n' || (X)=='\r' || (X)=='\t')
  |  |  ------------------
  |  |  |  Branch (296:27): [True: 0, False: 0]
  |  |  |  Branch (296:40): [True: 0, False: 0]
  |  |  |  Branch (296:53): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (4607:9): [True: 0, False: 3]
  |  Branch (4607:28): [True: 3, False: 0]
  |  Branch (4607:44): [True: 0, False: 3]
  ------------------
 4608|      0|    {
 4609|      0|        *pState = -1;
 4610|      0|        pLine->len = 0;
 4611|      0|        ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 4612|      0|        goto exit_error;
 4613|      0|    }
 4614|      3|    if (memcmp( pLine->str, "AuxInfo=", 8 ))
  ------------------
  |  Branch (4614:9): [True: 3, False: 0]
  ------------------
 4615|      3|    {
 4616|      3|        *pState = -1;
 4617|      3|        return c;
 4618|      3|    }
 4619|       |
 4620|      0|    state = AST_VERSION;
 4621|      0|    ret = 1; /* means read the next segment */
 4622|      0|    do
 4623|      0|    {
 4624|       |        /* Read the next segment up to the '/' */
 4625|      0|        INCHI_HEAPCHK
 4626|      0|            if (ret < 0)
  ------------------
  |  Branch (4626:17): [True: 0, False: 0]
  ------------------
 4627|      0|            {
 4628|      0|                *pState = prev_state;
 4629|      0|                break;
 4630|      0|            }
 4631|      0|        prev_state = state + ( bReconn ? IST_HAPPENED_IN_RECMET : 0 );
  ------------------
  |  |  363|      0|#define IST_HAPPENED_IN_RECMET   100
  ------------------
  |  Branch (4631:32): [True: 0, False: 0]
  ------------------
 4632|      0|        if (0 < ret)
  ------------------
  |  Branch (4632:13): [True: 0, False: 0]
  ------------------
 4633|      0|        {
 4634|       |            /* read next segment */
 4635|      0|            if (c != RI_ERR_EOF && c != SEG_END)
  ------------------
  |  |   47|      0|#define RI_ERR_EOF     (0)
  ------------------
                          if (c != RI_ERR_EOF && c != SEG_END)
  ------------------
  |  |  294|      0|#define SEG_END '/'
  ------------------
  |  Branch (4635:17): [True: 0, False: 0]
  |  Branch (4635:36): [True: 0, False: 0]
  ------------------
 4636|      0|            {
 4637|       |                /* abnormal reading result; should not happen */
 4638|      0|                while (c != RI_ERR_EOF && !INCHI_INP_EOL( c ))
  ------------------
  |  |   47|      0|#define RI_ERR_EOF     (0)
  ------------------
                              while (c != RI_ERR_EOF && !INCHI_INP_EOL( c ))
  ------------------
  |  |  296|      0|#define INCHI_INP_EOL(X) ((X)=='\n' || (X)=='\r' || (X)=='\t')
  |  |  ------------------
  |  |  |  Branch (296:27): [True: 0, False: 0]
  |  |  |  Branch (296:40): [True: 0, False: 0]
  |  |  |  Branch (296:53): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (4638:24): [True: 0, False: 0]
  ------------------
 4639|      0|                {
 4640|       |                    /* bypass to the end of line or file */
 4641|      0|                    c = getInChIChar( pInp );
 4642|      0|                }
 4643|      0|                ret = ( c == RI_ERR_EOF ) ? RI_ERR_EOF : RI_ERR_EOL; /* end of line */
  ------------------
  |  |   47|      0|#define RI_ERR_EOF     (0)
  ------------------
                              ret = ( c == RI_ERR_EOF ) ? RI_ERR_EOF : RI_ERR_EOL; /* end of line */
  ------------------
  |  |   47|      0|#define RI_ERR_EOF     (0)
  ------------------
                              ret = ( c == RI_ERR_EOF ) ? RI_ERR_EOF : RI_ERR_EOL; /* end of line */
  ------------------
  |  |   46|      0|#define RI_ERR_EOL     (-4)
  ------------------
  |  Branch (4643:23): [True: 0, False: 0]
  ------------------
 4644|      0|                pLine->len = 0;
 4645|      0|                pLine->c = ret;
 4646|      0|                break;
 4647|      0|            }
 4648|      0|            if (c == RI_ERR_EOF)
  ------------------
  |  |   47|      0|#define RI_ERR_EOF     (0)
  ------------------
  |  Branch (4648:17): [True: 0, False: 0]
  ------------------
 4649|      0|            {
 4650|      0|                ret = RI_ERR_EOF; /* end of line */
  ------------------
  |  |   47|      0|#define RI_ERR_EOF     (0)
  ------------------
 4651|      0|                break;
 4652|      0|            }
 4653|      0|            if (c == SEG_END)
  ------------------
  |  |  294|      0|#define SEG_END '/'
  ------------------
  |  Branch (4653:17): [True: 0, False: 0]
  ------------------
 4654|      0|            {
 4655|      0|                c = nGetInChISegment( pInp, pLine, szToken );
 4656|      0|            }
 4657|      0|            if (c < 0)
  ------------------
  |  Branch (4657:17): [True: 0, False: 0]
  ------------------
 4658|      0|            {
 4659|      0|                goto exit_error; /* error */
 4660|      0|            }
 4661|      0|            if (!pLine->len)
  ------------------
  |  Branch (4661:17): [True: 0, False: 0]
  ------------------
 4662|      0|            {
 4663|      0|                ret = RI_ERR_EOL; /* end of line */
  ------------------
  |  |   46|      0|#define RI_ERR_EOL     (-4)
  ------------------
 4664|      0|                break;
 4665|      0|            }
 4666|      0|            fst = UCINT pLine->str[0];
  ------------------
  |  |  116|      0|#define UCINT  (int)(unsigned char)
  ------------------
 4667|      0|        }
 4668|       |
 4669|       |        /* Process the seqment */
 4670|      0|        switch (state)
  ------------------
  |  Branch (4670:17): [True: 0, False: 0]
  ------------------
 4671|      0|        {
 4672|      0|            case AST_VERSION:
  ------------------
  |  Branch (4672:13): [True: 0, False: 0]
  ------------------
 4673|       |                /* Mobile H */
 4674|      0|                bMobileH = TAUT_YES;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4675|      0|                ret = ParseAuxSegmentVersion( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state );
 4676|      0|                state = AST_MOBILE_H_NUMBERS;
 4677|      0|                break;
 4678|      0|            case AST_MOBILE_H_NUMBERS:
  ------------------
  |  Branch (4678:13): [True: 0, False: 0]
  ------------------
 4679|      0|                ret = ParseAuxSegmentNumbers( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state, &bAbc );
 4680|      0|                state = AST_MOBILE_H_ATOM_EQ;
 4681|      0|                break;
 4682|      0|            case AST_MOBILE_H_ATOM_EQ:
  ------------------
  |  Branch (4682:13): [True: 0, False: 0]
  ------------------
 4683|      0|                ret = ParseAuxSegmentAtomEqu( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state );
 4684|      0|                state = AST_MOBILE_H_GROUP_EQ;
 4685|      0|                break;
 4686|      0|            case AST_MOBILE_H_GROUP_EQ:
  ------------------
  |  Branch (4686:13): [True: 0, False: 0]
  ------------------
 4687|      0|                ret = ParseAuxSegmentGroupEqu( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state );
 4688|      0|                state = AST_MOBILE_H_SP3_INV;
 4689|      0|                break;
 4690|      0|            case AST_MOBILE_H_SP3_INV:
  ------------------
  |  Branch (4690:13): [True: 0, False: 0]
  ------------------
 4691|      0|                ret = ParseAuxSegmentSp3Inv( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state );
 4692|      0|                state = AST_MOBILE_H_SP3_INV_NUMBERS;
 4693|      0|                break;
 4694|      0|            case AST_MOBILE_H_SP3_INV_NUMBERS:
  ------------------
  |  Branch (4694:13): [True: 0, False: 0]
  ------------------
 4695|      0|                ret = ParseAuxSegmentSp3InvNumbers( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state );
 4696|      0|                state = AST_MOBILE_H_ISO_LAYER_FORK;
 4697|      0|                break;
 4698|       |
 4699|      0|            case AST_MOBILE_H_ISO_LAYER_FORK:
  ------------------
  |  Branch (4699:13): [True: 0, False: 0]
  ------------------
 4700|      0|                if (!memcmp( pLine->str, "I:", 2 ))
  ------------------
  |  Branch (4700:21): [True: 0, False: 0]
  ------------------
 4701|      0|                {
 4702|      0|                    state = AST_MOBILE_H_ISO_NUMBERS;
 4703|      0|                }
 4704|      0|                else if (!inchi_memicmp( pLine->str, "F:", 2 ))
  ------------------
  |  Branch (4704:26): [True: 0, False: 0]
  ------------------
 4705|      0|                {
 4706|      0|                    state = AST_FIXED_H_NUMBERS;
 4707|      0|                    bMobileH = TAUT_NON;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4708|      0|                }
 4709|      0|                else if ( /*bReconn == INCHI_BAS &&*/ !inchi_memicmp( pLine->str, "CRV:", 4 ))
  ------------------
  |  Branch (4709:55): [True: 0, False: 0]
  ------------------
 4710|      0|                {
 4711|      0|                    state = AST_REVERSE_INFO_CRV;
 4712|      0|                }
 4713|      0|                else
 4714|      0|                    if (bReconn == INCHI_BAS && !inchi_memicmp( pLine->str, "rA:", 3 ))
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (4714:25): [True: 0, False: 0]
  |  Branch (4714:49): [True: 0, False: 0]
  ------------------
 4715|      0|                    {
 4716|      0|                        state = AST_REVERSE_INFO_ATOMS;
 4717|      0|                    }
 4718|      0|                    else if (bReconn == INCHI_BAS && !inchi_memicmp( pLine->str, "R:", 3 ))
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (4718:30): [True: 0, False: 0]
  |  Branch (4718:54): [True: 0, False: 0]
  ------------------
 4719|      0|                    {
 4720|      0|                        ret = 1;  /* read the next segment */
 4721|      0|                        state = AST_VERSION;
 4722|      0|                        bMobileH = TAUT_YES;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4723|      0|                        bReconn = INCHI_REC;
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 4724|      0|                    }
 4725|      0|                    else
 4726|      0|                    {
 4727|      0|                        ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 4728|      0|                    }
 4729|      0|                break;
 4730|       |
 4731|       |                /* Mobile H, isotopic */
 4732|      0|            case AST_MOBILE_H_ISO_NUMBERS:
  ------------------
  |  Branch (4732:13): [True: 0, False: 0]
  ------------------
 4733|      0|                ret = ParseAuxSegmentNumbers( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state, &bAbc );
 4734|      0|                state = AST_MOBILE_H_ISO_ATOM_EQ;
 4735|      0|                break;
 4736|      0|            case AST_MOBILE_H_ISO_ATOM_EQ:
  ------------------
  |  Branch (4736:13): [True: 0, False: 0]
  ------------------
 4737|      0|                ret = ParseAuxSegmentAtomEqu( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state );
 4738|      0|                state = AST_MOBILE_H_ISO_GROUP_EQ;
 4739|      0|                break;
 4740|      0|            case AST_MOBILE_H_ISO_GROUP_EQ:
  ------------------
  |  Branch (4740:13): [True: 0, False: 0]
  ------------------
 4741|      0|                ret = ParseAuxSegmentGroupEqu( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state );
 4742|      0|                state = AST_MOBILE_H_ISO_SP3_INV;
 4743|      0|                break;
 4744|      0|            case AST_MOBILE_H_ISO_SP3_INV:
  ------------------
  |  Branch (4744:13): [True: 0, False: 0]
  ------------------
 4745|      0|                ret = ParseAuxSegmentSp3Inv( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state );
 4746|      0|                state = AST_MOBILE_H_ISO_SP3_INV_NUMBERS;
 4747|      0|                break;
 4748|      0|            case AST_MOBILE_H_ISO_SP3_INV_NUMBERS:
  ------------------
  |  Branch (4748:13): [True: 0, False: 0]
  ------------------
 4749|      0|                ret = ParseAuxSegmentSp3InvNumbers( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state );
 4750|      0|                state = AST_FIXED_H_LAYER_FORK;
 4751|      0|                break;
 4752|       |
 4753|      0|            case AST_FIXED_H_LAYER_FORK:
  ------------------
  |  Branch (4753:13): [True: 0, False: 0]
  ------------------
 4754|      0|                if (!inchi_memicmp( pLine->str, "F:", 2 ))
  ------------------
  |  Branch (4754:21): [True: 0, False: 0]
  ------------------
 4755|      0|                {
 4756|      0|                    state = AST_FIXED_H_NUMBERS;
 4757|      0|                    bMobileH = TAUT_NON;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 4758|      0|                }
 4759|      0|                else if ( /*bReconn == INCHI_BAS &&*/ !inchi_memicmp( pLine->str, "CRV:", 4 ))
  ------------------
  |  Branch (4759:55): [True: 0, False: 0]
  ------------------
 4760|      0|                {
 4761|      0|                    state = AST_REVERSE_INFO_CRV;
 4762|      0|                }
 4763|      0|                else if (bReconn == INCHI_BAS && !inchi_memicmp( pLine->str, "rA:", 3 ))
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (4763:26): [True: 0, False: 0]
  |  Branch (4763:50): [True: 0, False: 0]
  ------------------
 4764|      0|                {
 4765|      0|                    state = AST_REVERSE_INFO_ATOMS;
 4766|      0|                }
 4767|      0|                else if (bReconn == INCHI_BAS && !inchi_memicmp( pLine->str, "R:", 3 ))
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (4767:26): [True: 0, False: 0]
  |  Branch (4767:50): [True: 0, False: 0]
  ------------------
 4768|      0|                {
 4769|      0|                    ret = 1;  /* read the next segment */
 4770|      0|                    state = AST_VERSION;
 4771|      0|                    bMobileH = TAUT_YES;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4772|      0|                    bReconn = INCHI_REC;
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 4773|      0|                }
 4774|      0|                else
 4775|      0|                {
 4776|      0|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 4777|      0|                }
 4778|      0|                break;
 4779|       |
 4780|      0|            case AST_FIXED_H_NUMBERS:
  ------------------
  |  Branch (4780:13): [True: 0, False: 0]
  ------------------
 4781|      0|                ret = ParseAuxSegmentNumbers( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state, &bAbc );
 4782|      0|                state = AST_FIXED_H_ATOM_EQ;
 4783|      0|                break;
 4784|      0|            case AST_FIXED_H_ATOM_EQ:
  ------------------
  |  Branch (4784:13): [True: 0, False: 0]
  ------------------
 4785|      0|                ret = ParseAuxSegmentAtomEqu( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state );
 4786|      0|                state = AST_FIXED_H_SP3_INV;
 4787|      0|                break;
 4788|      0|            case AST_FIXED_H_SP3_INV:
  ------------------
  |  Branch (4788:13): [True: 0, False: 0]
  ------------------
 4789|      0|                ret = ParseAuxSegmentSp3Inv( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state );
 4790|      0|                state = AST_FIXED_H_SP3_INV_NUMBERS;
 4791|      0|                break;
 4792|      0|            case AST_FIXED_H_SP3_INV_NUMBERS:
  ------------------
  |  Branch (4792:13): [True: 0, False: 0]
  ------------------
 4793|      0|                ret = ParseAuxSegmentSp3InvNumbers( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state );
 4794|      0|                state = AST_FIXED_H_ISO_LAYER_FORK;
 4795|      0|                break;
 4796|       |
 4797|      0|            case AST_FIXED_H_ISO_LAYER_FORK:
  ------------------
  |  Branch (4797:13): [True: 0, False: 0]
  ------------------
 4798|      0|                if (!memcmp( pLine->str, "I:", 2 ))
  ------------------
  |  Branch (4798:21): [True: 0, False: 0]
  ------------------
 4799|      0|                {
 4800|      0|                    state = AST_FIXED_H_ISO_NUMBERS;
 4801|      0|                }
 4802|      0|                else if ( /*bReconn == INCHI_BAS &&*/ !inchi_memicmp( pLine->str, "CRV:", 4 ))
  ------------------
  |  Branch (4802:55): [True: 0, False: 0]
  ------------------
 4803|      0|                {
 4804|      0|                    state = AST_REVERSE_INFO_CRV;
 4805|      0|                }
 4806|      0|                else if (bReconn == INCHI_BAS && !inchi_memicmp( pLine->str, "rA:", 3 ))
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (4806:26): [True: 0, False: 0]
  |  Branch (4806:50): [True: 0, False: 0]
  ------------------
 4807|      0|                {
 4808|      0|                    state = AST_REVERSE_INFO_ATOMS;
 4809|      0|                }
 4810|      0|                else if (bReconn == INCHI_BAS && !inchi_memicmp( pLine->str, "R:", 3 ))
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (4810:26): [True: 0, False: 0]
  |  Branch (4810:50): [True: 0, False: 0]
  ------------------
 4811|      0|                {
 4812|      0|                    ret = 1;  /* read the next segment */
 4813|      0|                    state = AST_VERSION;
 4814|      0|                    bMobileH = TAUT_YES;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4815|      0|                    bReconn = INCHI_REC;
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 4816|      0|                }
 4817|      0|                else
 4818|      0|                {
 4819|      0|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 4820|      0|                }
 4821|      0|                break;
 4822|       |
 4823|      0|            case AST_FIXED_H_ISO_NUMBERS:
  ------------------
  |  Branch (4823:13): [True: 0, False: 0]
  ------------------
 4824|      0|                ret = ParseAuxSegmentNumbers( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state, &bAbc );
 4825|      0|                state = AST_FIXED_H_ISO_ATOM_EQ;
 4826|      0|                break;
 4827|      0|            case AST_FIXED_H_ISO_ATOM_EQ:
  ------------------
  |  Branch (4827:13): [True: 0, False: 0]
  ------------------
 4828|      0|                ret = ParseAuxSegmentAtomEqu( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state );
 4829|      0|                state = AST_FIXED_H_SP3_INV;
 4830|      0|                break;
 4831|      0|            case AST_FIXED_H_ISO_SP3_INV:
  ------------------
  |  Branch (4831:13): [True: 0, False: 0]
  ------------------
 4832|      0|                ret = ParseAuxSegmentSp3Inv( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state );
 4833|      0|                state = AST_FIXED_H_ISO_SP3_INV_NUMBERS;
 4834|      0|                break;
 4835|      0|            case AST_FIXED_H_ISO_SP3_INV_NUMBERS:
  ------------------
  |  Branch (4835:13): [True: 0, False: 0]
  ------------------
 4836|      0|                ret = ParseAuxSegmentSp3InvNumbers( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state );
 4837|      0|                state = AST_REVERSE_INFO_CRV;
 4838|      0|                break;
 4839|      0|            case AST_REVERSE_INFO_CRV:
  ------------------
  |  Branch (4839:13): [True: 0, False: 0]
  ------------------
 4840|      0|                ret = ParseAuxSegmentReverseCRV( pLine->str, state );
 4841|       |                /* state = (bReconn == INCHI_BAS)? AST_REVERSE_INFO_ATOMS : AST_RECONNECTED_LAYER_FORK;*/
 4842|      0|                state = AST_REVERSE_INFO_ATOMS;
 4843|      0|                break;
 4844|      0|            case AST_REVERSE_INFO_ATOMS:
  ------------------
  |  Branch (4844:13): [True: 0, False: 0]
  ------------------
 4845|      0|                ret = ParseAuxSegmentReverseAtoms( pLine->str, state );
 4846|      0|                state = AST_REVERSE_INFO_BONDS;
 4847|      0|                break;
 4848|      0|            case AST_REVERSE_INFO_BONDS:
  ------------------
  |  Branch (4848:13): [True: 0, False: 0]
  ------------------
 4849|      0|                ret = ParseAuxSegmentReverseBonds( pLine->str, state );
 4850|      0|                state = AST_REVERSE_INFO_XYZ;
 4851|      0|                break;
 4852|      0|            case AST_REVERSE_INFO_XYZ:
  ------------------
  |  Branch (4852:13): [True: 0, False: 0]
  ------------------
 4853|      0|                ret = ParseAuxSegmentReverseXYZ( pLine->str, &pXYZ, state );
 4854|      0|                state = AST_RECONNECTED_LAYER_FORK;
 4855|      0|                if (ret > 0)
  ------------------
  |  Branch (4855:21): [True: 0, False: 0]
  ------------------
 4856|      0|                {
 4857|      0|                    nLenXYZ = ret - 1;
 4858|      0|                }
 4859|      0|                break;
 4860|      0|            case AST_RECONNECTED_LAYER_FORK:
  ------------------
  |  Branch (4860:13): [True: 0, False: 0]
  ------------------
 4861|      0|                if (bReconn == INCHI_BAS && !inchi_memicmp( pLine->str, "R:", 3 ))
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (4861:21): [True: 0, False: 0]
  |  Branch (4861:45): [True: 0, False: 0]
  ------------------
 4862|      0|                {
 4863|      0|                    ret = 1;  /* read the next segment */
 4864|      0|                    state = AST_VERSION;
 4865|      0|                    bMobileH = TAUT_YES;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 4866|      0|                    bReconn = INCHI_REC;
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 4867|      0|                }
 4868|      0|                else
 4869|      0|                {
 4870|      0|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 4871|      0|                }
 4872|      0|                break;
 4873|      0|        }
 4874|      0|    } while (c >= 0);
  ------------------
  |  Branch (4874:14): [True: 0, False: 0]
  ------------------
 4875|       |
 4876|      0|    ret = AddAuxSegmentCoord( ret, pXYZ, nLenXYZ, pInpInChI, nNumComponents );
 4877|       |
 4878|     39|exit_error:
 4879|     39|    if (pXYZ)
  ------------------
  |  Branch (4879:9): [True: 0, False: 39]
  ------------------
 4880|      0|    {
 4881|      0|        inchi_free( pXYZ );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4882|      0|    }
 4883|     39|    if (ret >= 0 || c == RI_ERR_EOF || c == RI_ERR_EOL)
  ------------------
  |  |   47|     39|#define RI_ERR_EOF     (0)
  ------------------
                  if (ret >= 0 || c == RI_ERR_EOF || c == RI_ERR_EOL)
  ------------------
  |  |   46|      0|#define RI_ERR_EOL     (-4)
  ------------------
  |  Branch (4883:9): [True: 39, False: 0]
  |  Branch (4883:21): [True: 0, False: 0]
  |  Branch (4883:40): [True: 0, False: 0]
  ------------------
 4884|     39|    {
 4885|     39|        pLine->len = 0;
 4886|     39|    }
 4887|       |
 4888|     39|    return ret;
 4889|      0|}
ParseSegmentReadDelimitedNumbers:
 7767|  1.37k|{
 7768|  1.37k|    const char *p, *pStart;
 7769|  1.37k|    int num, curr_atom = 0;
 7770|       |
 7771|  1.37k|    *ret = 1;
 7772|       |
 7773|  1.37k|    if (!str)
  ------------------
  |  Branch (7773:9): [True: 0, False: 1.37k]
  ------------------
 7774|      0|    {
 7775|      0|        *ret = -1;
 7776|      0|        return NULL;
 7777|      0|    }
 7778|       |
 7779|  1.37k|    pStart = (char *) ( str + 1 );
 7780|  1.37k|    p = pStart;
 7781|  1.37k|    while (*pStart)
  ------------------
  |  Branch (7781:12): [True: 1.37k, False: 0]
  ------------------
 7782|  1.37k|    {
 7783|  2.91k|        for (p = pStart, curr_atom = 0; p < pEnd && *p != c_stop; curr_atom++)
  ------------------
  |  Branch (7783:41): [True: 2.91k, False: 0]
  |  Branch (7783:53): [True: 2.74k, False: 171]
  ------------------
 7784|  2.74k|        {
 7785|  2.74k|            num = (AT_NUMB) inchi_strtol(  p, &p, 10 );
 7786|  2.74k|#if ( CHECK_STRTOL_ATNUMB==1 )
 7787|  2.74k|            if (num>MAX_ATOMS || num<0)
  ------------------
  |  |   43|  5.49k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (7787:17): [True: 1, False: 2.74k]
  |  Branch (7787:34): [True: 0, False: 2.74k]
  ------------------
 7788|      1|            {
 7789|      1|                *ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      1|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7790|      1|                return p;
 7791|      1|            }
 7792|  2.74k|#endif
 7793|  2.74k|            {
 7794|  2.74k|                if (0 != IntArray_Append( numlist, num ))
  ------------------
  |  Branch (7794:21): [True: 0, False: 2.74k]
  ------------------
 7795|      0|                {
 7796|      0|                    *ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7797|      0|                    return p;
 7798|      0|                }
 7799|  2.74k|            }
 7800|  2.74k|            if (*p == c_delim)
  ------------------
  |  Branch (7800:17): [True: 1.54k, False: 1.20k]
  ------------------
 7801|  1.54k|            {
 7802|  1.54k|                p++;
 7803|  1.54k|            }
 7804|  1.20k|            else if (*p == c_stop)
  ------------------
  |  Branch (7804:22): [True: 1.20k, False: 3]
  ------------------
 7805|  1.20k|            {
 7806|  1.20k|                return p;
 7807|  1.20k|            }
 7808|      3|            else
 7809|      3|            {
 7810|      3|                *ret = -1; return NULL;
 7811|      3|            }
 7812|  2.74k|        }
 7813|    171|        if (*p == c_stop)
  ------------------
  |  Branch (7813:13): [True: 171, False: 0]
  ------------------
 7814|    171|        {
 7815|    171|            return p;
 7816|    171|        }
 7817|    171|    }
 7818|       |
 7819|      0|    return p;
 7820|  1.37k|}
insertions_sort_AT_NUMB:
10218|     64|{
10219|     64|    AT_NUMB *i, *j, *pk, tmp;
10220|     64|    int  k, num_trans = 0;
10221|    260|    for (k = 1, pk = base; k < num; k++, pk++)
  ------------------
  |  Branch (10221:28): [True: 196, False: 64]
  ------------------
10222|    196|    {
10223|    528|        for (j = ( i = pk ) + 1, tmp = *j; j > base && *i > tmp; j = i, i--)
  ------------------
  |  Branch (10223:44): [True: 496, False: 32]
  |  Branch (10223:56): [True: 332, False: 164]
  ------------------
10224|    332|        {
10225|    332|            *j = *i;
10226|    332|            num_trans++;
10227|    332|        }
10228|    196|        *j = tmp;
10229|    196|    }
10230|       |
10231|     64|    return num_trans;
10232|     64|}
TreatErrorsInReadInChIString:
10564|    286|{
10565|    286|    int bInChI2Struct = ( ip->bReadInChIOptions & READ_INCHI_TO_STRUCTURE ) && ip->nInputType == INPUT_INCHI;
  ------------------
  |  |  988|    286|#define READ_INCHI_TO_STRUCTURE          0x00000008
  ------------------
  |  Branch (10565:25): [True: 139, False: 147]
  |  Branch (10565:80): [True: 139, False: 0]
  ------------------
10566|       |
10567|       |    /* InChI could not be read */
10568|    286|    if (nReadStatus == RI_ERR_EOF && nErr == 0 && pState == 0) /* && !(*pstrHdr) )  */
  ------------------
  |  |   47|    572|#define RI_ERR_EOF     (0)
  ------------------
  |  Branch (10568:9): [True: 10, False: 276]
  |  Branch (10568:38): [True: 0, False: 10]
  |  Branch (10568:51): [True: 0, False: 0]
  ------------------
10569|      0|    {
10570|       |        /*if ( !(*pstrHdr) ) */
10571|      0|        ;/*inchi_ios_eprint( pLog, "\nEnd of file detected after structure %ld.    \n", *num_inp );*/
10572|      0|    }
10573|    286|    else
10574|    286|    {
10575|       |        /* Output InChI parsing error message */
10576|    286|        char szHdrSimulation[128];
10577|    286|        char szMsg2[1024];
10578|    286|        ( *num_inp )++;
10579|    286|        sprintf( szHdrSimulation, "Structure: %ld", *num_inp );
10580|    286|        getInchiStateReadErr( pState, szMsg2 );
10581|       |
10582|       |#ifdef TARGET_EXE_STANDALONE
10583|       |        if (pOneInput->polymer &&
10584|       |             bInChI2Struct &&
10585|       |             !( ip->bINChIOutputOptions & INCHI_OUT_SDFILE_ONLY ))
10586|       |        {
10587|       |            inchi_ios_eprint( pLog, "%s Skipping polymer InChI (only conversion to Molfile is available, use OutputSDF option)\n",
10588|       |                              *pstrHdr ? *pstrHdr : szHdrSimulation );
10589|       |        }
10590|       |        else
10591|       |#endif
10592|    286|        {
10593|    286|            if (!bInChI2Struct &&
  ------------------
  |  Branch (10593:17): [True: 147, False: 139]
  ------------------
10594|    286|                ( pState == IST_MOBILE_H_POLYMER && !ip->bPolymers ))
  ------------------
  |  Branch (10594:19): [True: 64, False: 83]
  |  Branch (10594:53): [True: 64, False: 0]
  ------------------
10595|     64|            {
10596|       |                /* TO DO: implement InChI2InChI for polymers in a way similar to InChI2Struct
10597|       |                thru an external (to ReadWriteInchi) loop                                */
10598|     64|                inchi_ios_eprint( pLog, "%s Skipping polymer InChI for conversion of InChI to InChI\n",
10599|     64|                                  *pstrHdr ? *pstrHdr : szHdrSimulation );
  ------------------
  |  Branch (10599:35): [True: 0, False: 64]
  ------------------
10600|     64|            }
10601|    222|            else
10602|    222|            {
10603|    222|                inchi_ios_eprint( pLog, "\n%s %s (%d) in %s (%d)\n",
10604|    222|                                  *pstrHdr ? *pstrHdr : szHdrSimulation,
  ------------------
  |  Branch (10604:35): [True: 0, False: 222]
  ------------------
10605|    222|                                  getInchiErrName( nErr ), nErr,
10606|    222|                                  szMsg2, pState );
10607|    222|            }
10608|    286|        }
10609|       |
10610|    286|        if (ip->bINChIOutputOptions2 & INCHI_OUT_INCHI_GEN_ERROR)
  ------------------
  |  |  177|    286|#define INCHI_OUT_INCHI_GEN_ERROR        0x0001 /* v. 1.05 */
  ------------------
  |  Branch (10610:13): [True: 0, False: 286]
  ------------------
10611|      0|        {
10612|      0|            if (!(ip->bINChIOutputOptions & INCHI_OUT_SDFILE_ONLY))
  ------------------
  |  |  161|      0|#define INCHI_OUT_SDFILE_ONLY           0x0010   /* save input data in a Molfile instead of creating INChI */
  ------------------
  |  Branch (10612:17): [True: 0, False: 0]
  ------------------
10613|      0|            {
10614|      0|                inchi_ios_eprint(pOut, "%s\n", *pstrHdr ? *pstrHdr : szHdrSimulation);
  ------------------
  |  Branch (10614:48): [True: 0, False: 0]
  ------------------
10615|      0|                if (ip->bINChIOutputOptions & INCHI_OUT_STDINCHI)
  ------------------
  |  |  173|      0|#define INCHI_OUT_STDINCHI 0x4000
  ------------------
  |  Branch (10615:21): [True: 0, False: 0]
  ------------------
10616|      0|                {
10617|      0|                    inchi_ios_eprint(pOut, "InChI=1S//\n");
10618|      0|                }
10619|      0|                else
10620|      0|                {
10621|      0|                    inchi_ios_eprint(pOut, "InChI=1//\n");
10622|      0|                }   
10623|      0|            }
10624|      0|        }
10625|       |
10626|    286|        if ( 0 != (ip->bReadInChIOptions & READ_INCHI_TO_STRUCTURE) )
  ------------------
  |  |  988|    286|#define READ_INCHI_TO_STRUCTURE          0x00000008
  ------------------
  |  Branch (10626:14): [True: 139, False: 147]
  ------------------
10627|       |
10628|    139|        ( *num_errors )++;
10629|    286|        ( *num_processed )++;
10630|    286|    }
10631|    286|    if (*pstrHdr)
  ------------------
  |  Branch (10631:9): [True: 0, False: 286]
  ------------------
10632|      0|    {
10633|      0|        inchi_free( *pstrHdr );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
10634|      0|        *pstrHdr = NULL;
10635|      0|    }
10636|    286|    if (*pszCurHdr)
  ------------------
  |  Branch (10636:9): [True: 0, False: 286]
  ------------------
10637|      0|    {
10638|      0|        inchi_free( *pszCurHdr );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
10639|      0|        *pszCurHdr = NULL;
10640|      0|    }
10641|       |
10642|    286|    FreeInpInChI( pOneInput );
10643|       |
10644|    286|    return;
10645|    286|}
ConvertInChI2InChI:
10669|     80|{
10670|     80|    int ret, tmp;
10671|       |
10672|     80|    InchiTimeGet( pulTStart );
10673|       |
10674|     80|    tmp = ip->bNoStructLabels;
10675|     80|    ip->bNoStructLabels = 1;
10676|     80|    INCHI_HEAPCHK
10677|     80|        ip->pSdfValue = NULL;
10678|     80|    ip->pSdfLabel = NULL;
10679|       |
10680|     80|#if ( FIX_DALKE_BUGS == 1 )
10681|     80|    SetHillFormFromInChI( pOneInput );
10682|     80|#endif
10683|       |
10684|     80|    ret = OutputInChIAsRequested( pCG, pOut, pLog, ip, sd,
10685|     80|                                  pOneInput, num_components,
10686|     80|                                  nModeProtonIsoExchgH,
10687|     80|                                  num_inp, save_opt_bits );
10688|       |
10689|       |#if ( !defined(TARGET_API_LIB) && defined(TARGET_EXE_STANDALONE) )
10690|       |
10691|       |    /* Calculate InChIKey if requested */
10692|       |    /* However, do not calculate/write it if this function is called from within dll */
10693|       |    {
10694|       |        char ik_string[256];    /* Resulting InChIKey string */
10695|       |        int ik_ret = 0;           /* InChIKey-calc result code */
10696|       |        int xhash1, xhash2;
10697|       |        char szXtra1[65], szXtra2[65];
10698|       |
10699|       |        inchi_ios_flush2( pLog, stderr );
10700|       |
10701|       |        /* post-1.02b addition - correctly treat tabbed output with InChIKey */
10702|       |        if (ip->bINChIOutputOptions & INCHI_OUT_TABBED_OUTPUT)
10703|       |        {
10704|       |            if (ip->bCalcInChIHash != INCHIHASH_NONE)
10705|       |            {
10706|       |                if (pOut->s.pStr)
10707|       |                {
10708|       |                    if (pOut->s.nUsedLength > 0)
10709|       |                    {
10710|       |                        if (pOut->s.pStr[pOut->s.nUsedLength - 1] == '\n')
10711|       |                        {    /* replace LF with TAB */
10712|       |                            pOut->s.pStr[pOut->s.nUsedLength - 1] = '\t';
10713|       |                        }
10714|       |                    }
10715|       |                }
10716|       |            }
10717|       |        }
10718|       |
10719|       |        if (ip->bCalcInChIHash == INCHIHASH_NONE)
10720|       |        {
10721|       |            /* inchi_ios_flush(pOut); */
10722|       |        }
10723|       |        else
10724|       |        {
10725|       |            char *buf = NULL;
10726|       |            size_t slen = pOut->s.nUsedLength;
10727|       |            extract_inchi_substring( &buf, pOut->s.pStr, slen );
10728|       |
10729|       |            if (NULL != buf)
10730|       |            {
10731|       |                xhash1 = xhash2 = 0;
10732|       |                if (( ip->bCalcInChIHash == INCHIHASH_KEY_XTRA1 ) ||
10733|       |                    ( ip->bCalcInChIHash == INCHIHASH_KEY_XTRA1_XTRA2 ))
10734|       |                {
10735|       |                    xhash1 = 1;
10736|       |                }
10737|       |                if (( ip->bCalcInChIHash == INCHIHASH_KEY_XTRA2 ) ||
10738|       |                    ( ip->bCalcInChIHash == INCHIHASH_KEY_XTRA1_XTRA2 ))
10739|       |                {
10740|       |                    xhash2 = 1;
10741|       |                }
10742|       |
10743|       |                ik_ret = GetINCHIKeyFromINCHI( buf,
10744|       |                                               xhash1,
10745|       |                                               xhash2,
10746|       |                                               ik_string,
10747|       |                                               szXtra1,
10748|       |                                               szXtra2 );
10749|       |                inchi_free( buf );
10750|       |            }
10751|       |            else
10752|       |            {
10753|       |                ik_ret = INCHIKEY_NOT_ENOUGH_MEMORY;
10754|       |            }
10755|       |
10756|       |
10757|       |            if (ik_ret == INCHIKEY_OK)
10758|       |            {
10759|       |                inchi_ios_print( pOut, "InChIKey=%-s\n", ik_string );
10760|       |            }
10761|       |            else
10762|       |            {
10763|       |                inchi_ios_print( pLog, "Warning (Could not compute InChIKey: ", num_inp );
10764|       |                switch (ik_ret)
10765|       |                {
10766|       |                    case INCHIKEY_UNKNOWN_ERROR:
10767|       |                        inchi_ios_print( pLog, "unresolved error)" );
10768|       |                        break;
10769|       |                    case INCHIKEY_EMPTY_INPUT:
10770|       |                        inchi_ios_print( pLog, "got an empty string)" );
10771|       |                        break;
10772|       |                    case INCHIKEY_INVALID_INCHI_PREFIX:
10773|       |                    case INCHIKEY_INVALID_INCHI:
10774|       |                    case INCHIKEY_INVALID_STD_INCHI:
10775|       |                        inchi_ios_print( pLog, "no valid InChI string found)" );
10776|       |                        break;
10777|       |                    case INCHIKEY_NOT_ENOUGH_MEMORY:
10778|       |                        inchi_ios_print( pLog, "not enough memory to treat the string)" );
10779|       |                        break;
10780|       |                    default:inchi_ios_print( pLog, "internal program error)" );
10781|       |                        break;
10782|       |                }
10783|       |
10784|       |                inchi_ios_print( pLog, " structure #%-lu.\n", num_inp );
10785|       |                if (ip->bINChIOutputOptions & INCHI_OUT_TABBED_OUTPUT)
10786|       |                {
10787|       |                    inchi_ios_print( pOut, "\n" );
10788|       |                }
10789|       |            } /* if (ip->bCalcInChIHash!=INCHIHASH_NONE) */
10790|       |
10791|       |            inchi_ios_flush( pOut );
10792|       |            inchi_ios_flush2( pLog, stderr );
10793|       |        }
10794|       |    } /* Calculate InChIKey if requested */
10795|       |#endif
10796|       |
10797|     80|    ip->bNoStructLabels = tmp;
10798|       |
10799|       |#ifndef TARGET_API_LIB
10800|       |    if (ret < 0)
10801|       |    {
10802|       |
10803|       |        if (*pszCurHdr && ( *pszCurHdr )[0])
10804|       |        {
10805|       |            inchi_ios_eprint( pLog, "Error %d creating InChI string %s\n", ret, *pszCurHdr );
10806|       |        }
10807|       |        else
10808|       |        {
10809|       |            inchi_ios_eprint( pLog, "Error %d creating InChI string, Structure %ld\n", ret, num_inp );
10810|       |        }
10811|       |        if (ip->bINChIOutputOptions2 & INCHI_OUT_INCHI_GEN_ERROR)
10812|       |        {/* inchi_ios_eprint( pOut, "InChICreationError!\n"); *//* emit err string */
10813|       |            if (ip->bINChIOutputOptions & INCHI_OUT_STDINCHI)
10814|       |            {
10815|       |                inchi_ios_eprint( pOut, "InChI=1S//\n" );
10816|       |            }
10817|       |            else
10818|       |            {
10819|       |                inchi_ios_eprint( pOut, "InChI=1//\n" );
10820|       |            }
10821|       |        }
10822|       |
10823|       |        ( *num_errors )++;
10824|       |    }
10825|       |
10826|       |#if ( !defined(TARGET_API_LIB) && !defined(TARGET_EXE_STANDALONE) )
10827|       |    else
10828|       |        if (*pszCurHdr && ( *pszCurHdr )[0])
10829|       |        {
10830|       |            inchi_fprintf( stderr, "%s\r", *pszCurHdr );
10831|       |        }
10832|       |#endif
10833|       |#endif
10834|       |
10835|       |
10836|     80|    if (*pszCurHdr)
  ------------------
  |  Branch (10836:9): [True: 0, False: 80]
  ------------------
10837|      0|    {
10838|      0|        inchi_free( *pszCurHdr );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
10839|      0|        *pszCurHdr = NULL;
10840|      0|    }
10841|       |
10842|       |    INCHI_HEAPCHK
10843|       |
10844|     80|        *ulProcessingTime += InchiTimeElapsed( ic, pulTStart );
10845|       |
10846|     80|    return ret;
10847|     80|}
ConvertInChI2Struct:
10887|     88|{
10888|     88|    int ret, i, j;
10889|     88|    SRM srm; /* rules how to handle bonds to metal atoms */
10890|     88|    StrFromINChI *pStruct[INCHI_NUM][TAUT_NUM];
10891|       |
10892|     88|    int bINChIOutputOptions =
10893|     88|#if ( I2S_MODIFY_OUTPUT != 1 )
10894|     88|        0;
10895|       |#else
10896|       |        /* transfer user's InChI output options to serialization 10-12-2007 */
10897|       |        ip_inp->bINChIOutputOptions &
10898|       |        (
10899|       |            INCHI_OUT_NO_AUX_INFO |   /* do not output Aux Info */
10900|       |            INCHI_OUT_SHORT_AUX_INFO |   /* output short version of Aux Info */
10901|       |            INCHI_OUT_ONLY_AUX_INFO |   /* output only Aux Info */
10902|       |                                        /* INCHI_OUT_EMBED_REC             |*/   /* embed reconnected INChI into disconnected INChI */
10903|       |            INCHI_OUT_SDFILE_ONLY |   /* save input data in a Molfile instead of creating INChI */
10904|       |            INCHI_OUT_PLAIN_TEXT |   /* output plain text INChI */
10905|       |            INCHI_OUT_PLAIN_TEXT_COMMENTS |   /* output plain text annotation */
10906|       |                                              /* INCHI_OUT_WINCHI_WINDOW         |*/   /* output into wINChI text window */
10907|       |            INCHI_OUT_TABBED_OUTPUT |   /* tab-delimited (only for plain text) */
10908|       |            INCHI_OUT_SDFILE_ATOMS_DT |   /* SDfile output H isotopes as D and T */
10909|       |            INCHI_OUT_SDFILE_SPLIT |   /* Split SDfile into components */
10910|       |            0
10911|       |            );
10912|       |#endif
10913|       |
10914|       |    /* Preliminaries */
10915|     88|    InchiTimeGet( pulTStart );
10916|       |
10917|     88|    if (input_is_stdinchi)
  ------------------
  |  Branch (10917:9): [True: 0, False: 88]
  ------------------
10918|      0|    {
10919|      0|        if (ip_inp->bINChIOutputOptions & INCHI_OUT_STDINCHI)
  ------------------
  |  |  173|      0|#define INCHI_OUT_STDINCHI 0x4000
  ------------------
  |  Branch (10919:13): [True: 0, False: 0]
  ------------------
10920|      0|        {
10921|      0|            bINChIOutputOptions |= INCHI_OUT_STDINCHI;
  ------------------
  |  |  173|      0|#define INCHI_OUT_STDINCHI 0x4000
  ------------------
10922|      0|        }
10923|      0|    }
10924|     88|    else
10925|     88|    {
10926|     88|        if (ip_inp->bINChIOutputOptions & INCHI_OUT_SAVEOPT)
  ------------------
  |  |  174|     88|#define INCHI_OUT_SAVEOPT  0x8000
  ------------------
  |  Branch (10926:13): [True: 0, False: 88]
  ------------------
10927|      0|        {
10928|      0|            bINChIOutputOptions |= INCHI_OUT_SAVEOPT;
  ------------------
  |  |  174|      0|#define INCHI_OUT_SAVEOPT  0x8000
  ------------------
10929|      0|        }
10930|     88|    }
10931|       |
10932|     88|    memset( pStruct, 0, sizeof( pStruct ) );
10933|       |
10934|     88|    SetUpSrm( &srm );    /* structure restore parms */
10935|       |
10936|       |    /* Eliminate Fixed-H InChI that are exactly same as the corresponding Mobile-H structures */
10937|     88|    RemoveFixHInChIIdentical2MobH( pOneInput );
10938|       |
10939|       |    /* Recheck layers after thee elimination; get optional stereo flags */
10940|     88|    ret = DetectInpInchiCreationOptions( pOneInput, &bHasSomeReconnected,
10941|     88|                                         &bHasMetal, &bHasSomeFixedH,
10942|     88|                                         &nModeFlagsStereo, &bTautFlags );
10943|     88|    if (ret < 0)
  ------------------
  |  Branch (10943:9): [True: 0, False: 88]
  ------------------
10944|      0|    {
10945|      0|        AddOneMsg( szMessage, (int) strlen( szMessage ), nMessageLen,
10946|      0|                   "Error in detecting input InChI options", "; " );
10947|      0|        ( *num_errors )++;
10948|      0|        goto dealloc;
10949|      0|    }
10950|       |
10951|     88|    if (bHasSomeFixedH && !bReqNonTaut)
  ------------------
  |  Branch (10951:9): [True: 20, False: 68]
  |  Branch (10951:27): [True: 0, False: 20]
  ------------------
10952|      0|    {
10953|      0|        bHasSomeFixedH = 0;
10954|      0|    }
10955|       |
10956|       |    /* Set stereo flags */
10957|     88|    ip->nMode &= ~( REQ_MODE_STEREO |
  ------------------
  |  |   47|     88|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
10958|     88|                    REQ_MODE_ISO_STEREO |
  ------------------
  |  |   48|     88|#define REQ_MODE_ISO_STEREO         0x000020    /* IS   */
  ------------------
10959|     88|                    REQ_MODE_RELATIVE_STEREO |
  ------------------
  |  |   54|     88|#define REQ_MODE_RELATIVE_STEREO    0x000200    /* REL All Relative Stereo */
  ------------------
10960|     88|                    REQ_MODE_RACEMIC_STEREO |
  ------------------
  |  |   56|     88|#define REQ_MODE_RACEMIC_STEREO     0x000400    /* RAC All Racemic Stereo */
  ------------------
10961|     88|                    REQ_MODE_CHIR_FLG_STEREO |
  ------------------
  |  |   62|     88|#define REQ_MODE_CHIR_FLG_STEREO    0x002000    /* SUCF  If Chiral flag then Abs otherwise Rel stereo */
  ------------------
10962|     88|                    REQ_MODE_SB_IGN_ALL_UU |
  ------------------
  |  |   60|     88|#define REQ_MODE_SB_IGN_ALL_UU      0x001000    /* IAUSC Ignore stereobonds if All Undef/Unknown */
  ------------------
10963|     88|                    REQ_MODE_SC_IGN_ALL_UU );
  ------------------
  |  |   58|     88|#define REQ_MODE_SC_IGN_ALL_UU      0x000800    /* IAUSC Ignore stereocenters if All Undef/Unknown */
  ------------------
10964|       |
10965|     88|    ip->nMode |= nModeFlagsStereo;
10966|       |
10967|       |    /* Remove Phosphine and Arsine Stereo Flags */
10968|     88|    ip->bTautFlags &= ~TG_FLAG_PHOSPHINE_STEREO;
  ------------------
  |  |  944|     88|#define TG_FLAG_PHOSPHINE_STEREO         0x00008000   /* add phosphine sp3 stereo */
  ------------------
10969|     88|    ip->bTautFlags &= ~TG_FLAG_ARSINE_STEREO;
  ------------------
  |  |  945|     88|#define TG_FLAG_ARSINE_STEREO            0x00010000   /* add arsine sp3 stereo */
  ------------------
10970|     88|    ip->bTautFlags &= ~TG_FLAG_FIX_SP3_BUG;
  ------------------
  |  |  947|     88|#define TG_FLAG_FIX_SP3_BUG              0x00040000   /* fix sp3 stereo bug: overlapping 2D stereo bond & coordinate scaling */
  ------------------
10971|       |
10972|     88|    ip->bTautFlags |= bTautFlags;
10973|       |
10974|       |    /* Mark Disconnected InChI components that are exactly came as Reconnected ones */
10975|       |    /* Disconnected will have a negative number of the reconnected component */
10976|       |    /* Reconnected will have a positive number of the disconnected component */
10977|       |
10978|     88|    MarkDisconectedIdenticalToReconnected( pOneInput );
10979|       |
10980|       |    /*****************************************************************************/
10981|       |    /* Pay attention to:                                                         */
10982|       |    /* 1) .nLink < 0 in Disonnected which means InChI is same as in Reconnected  */
10983|       |    /*    The component in Reconnected has .nLink pointing to the Disconnected;  */
10984|       |    /*    each .nLink = (1+component index) or -(1+component index)              */
10985|       |    /*    In the future .nLink>0 in Disconnected shall point to the Reconnectrd  */
10986|       |    /*    component from which it was created                                    */
10987|       |    /* 2) Currently reversed structures from Disconnected components are created */
10988|       |    /*    and abandoned if Reconnected layer exists                              */
10989|       |    /* 3) Connect/disconnect H depends on the presence of atom/bond parity       */
10990|       |    /*    The combined Mobile/Fixed-H parity should be set for Fixed-H components*/
10991|       |    /* 4) No comparison of the Disconnected layer is done if Reconnected exists  */
10992|       |    /* 5) Reading InChI was not fully tested in case one component has stereo in */
10993|       |    /*    both Mobile-H and Fixed-H layers while another component has stereo    */
10994|       |    /*    only in Mobile-H layer                                                 */
10995|       |    /*****************************************************************************/
10996|       |
10997|       |
10998|       |    /* Main conversion InChI->Structure for each component and  */
10999|       |    /* after that pStruct[iRec][iMobH][iComponent].at2 is the structure,      */
11000|       |    /* pStruct[iRec][iMobH][iComponent].RevInChI full InChI for the structure */
11001|       |    /* In case of both Fixed-H and Mobile-H layers the results are in iMobH=0 */
11002|       |    /* In case of only Mobile-H/Main layer the results are in iMobH=1         */
11003|       |
11004|     88|    ulProcessingTime += InchiTimeElapsed( ic, pulTStart );
11005|       |
11006|     88|    sd->ulStructTime = 0;
11007|       |
11008|     88|    ret = AllInchiToStructure( ic, pCG, ip, sd, num_inp, *pszCurHdr, &srm, bHasSomeFixedH, pStruct, pOneInput );
11009|       |
11010|     88|    ulProcessingTime += sd->ulStructTime;
11011|     88|    InchiTimeGet( pulTStart );
11012|       |
11013|       |    /* ret < 0 is error code; ret > 0 is number of errors */
11014|       |    /* in pStruct[iInchiRec][iMobileH][iComponent].nError */
11015|     88|    if (ret)
  ------------------
  |  Branch (11015:9): [True: 57, False: 31]
  ------------------
11016|     57|    {
11017|     57|#if ( FIX_GAF_2019_1==1 )
11018|     57|        if (ret > 0)
  ------------------
  |  Branch (11018:13): [True: 57, False: 0]
  ------------------
11019|     57|        {
11020|     57|            ret = RI_ERR_PROGR;
  ------------------
  |  |   45|     57|#define RI_ERR_PROGR   (-3)
  ------------------
11021|     57|        }
11022|     57|#endif
11023|       |        /* conversion error */
11024|     57|        ( *num_errors )++;
11025|     57|        goto dealloc;
11026|     57|    }
11027|       |
11028|       |    /* Attempt to fix the numumber of removed protons in case of Mobile-H */
11029|     31|    if (!pOneInput->nNumProtons[INCHI_BAS][TAUT_YES].pNumProtons &&
  ------------------
  |  |  575|     31|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                  if (!pOneInput->nNumProtons[INCHI_BAS][TAUT_YES].pNumProtons &&
  ------------------
  |  |  580|     31|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (11029:9): [True: 31, False: 0]
  ------------------
11030|     31|         !pOneInput->nNumProtons[INCHI_REC][TAUT_YES].pNumProtons)
  ------------------
  |  |  576|     31|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                       !pOneInput->nNumProtons[INCHI_REC][TAUT_YES].pNumProtons)
  ------------------
  |  |  580|     31|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (11030:10): [True: 31, False: 0]
  ------------------
11031|     31|    {
11032|     31|        ret = AddProtonAndIsoHBalanceToMobHStruct( ic, pCG, ip, sd, num_inp, bHasSomeFixedH, *pszCurHdr, pStruct, pOneInput );
11033|       |
11034|     31|        if (ret < 0)
  ------------------
  |  Branch (11034:13): [True: 0, False: 31]
  ------------------
11035|      0|        {
11036|      0|            AddOneMsg( szMessage, (int) strlen( szMessage ), nMessageLen, "Add/Remove protons error", "; " );
11037|      0|            ( *num_errors )++;
11038|      0|            goto dealloc;
11039|      0|        }
11040|     31|    }
11041|       |
11042|       |    /* Compare InChI from the Reversed Structure to the original input InChI    */
11043|     31|    ret = CompareAllOrigInchiToRevInChI( pStruct, pOneInput, bHasSomeFixedH, num_inp, *pszCurHdr );
11044|     31|    if (ret < 0)
  ------------------
  |  Branch (11044:9): [True: 0, False: 31]
  ------------------
11045|      0|    {
11046|      0|        AddOneMsg( szMessage, (int) strlen( szMessage ), nMessageLen, "InChI compare error", "; " );
11047|      0|        ( *num_errors )++;
11048|      0|        goto dealloc;
11049|      0|    }
11050|       |
11051|       |    /* Compare disconnected versions */
11052|     31|    ret = CompareAllDisconnectedOrigInchiToRevInChI( pStruct, pOneInput,
11053|     31|                                                     bHasSomeFixedH, num_inp, *pszCurHdr );
11054|     31|    if (ret < 0)
  ------------------
  |  Branch (11054:9): [True: 0, False: 31]
  ------------------
11055|      0|    {
11056|      0|        AddOneMsg( szMessage, (int) strlen( szMessage ), nMessageLen, "InChI compare2 error", "; " );
11057|      0|        ( *num_errors )++;
11058|      0|        goto dealloc;
11059|      0|    }
11060|       |
11061|     31|    if (WarningFlags)
  ------------------
  |  Branch (11061:9): [True: 31, False: 0]
  ------------------
11062|     31|    {
11063|     93|        for (i = 0; i < 2; i++)
  ------------------
  |  Branch (11063:21): [True: 62, False: 31]
  ------------------
11064|     62|        {
11065|    186|            for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  578|    186|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (11065:25): [True: 124, False: 62]
  ------------------
11066|    124|            {
11067|    124|                WarningFlags[i][j] = (unsigned long) pOneInput->CompareInchiFlags[i][j];
11068|    124|            }
11069|     62|        }
11070|     31|    }
11071|       |
11072|     31|    ulProcessingTime += InchiTimeElapsed( ic, pulTStart );
11073|       |
11074|       |#ifndef COMPILE_ANSI_ONLY
11075|       |    ret = DisplayStructureComponents( pCG, ip, sd, num_inp, *pszCurHdr, &srm, bReqNonTaut, pStruct, pOneInput );
11076|       |    if (ret < 0)
11077|       |    {
11078|       |        AddOneMsg( szMessage, (int) strlen( szMessage ), nMessageLen, "Display structure error", "; " );
11079|       |    }
11080|       |#endif
11081|       |
11082|       |
11083|     31|    InchiTimeGet( pulTStart );
11084|       |
11085|     31|    ret = MergeStructureComponents( ip, sd, num_inp, *pszCurHdr, &srm, bReqNonTaut, pStruct, pOneInput );
11086|       |
11087|     31|    ulProcessingTime += InchiTimeElapsed( ic, pulTStart );
11088|       |
11089|     31|    if (ret < 0)
  ------------------
  |  Branch (11089:9): [True: 0, False: 31]
  ------------------
11090|      0|    {
11091|      0|        AddOneMsg( szMessage, (int) strlen( szMessage ), nMessageLen, "Merge Components error", "; " );
11092|      0|        ( *num_errors )++;
11093|      0|        goto dealloc;
11094|      0|    }
11095|       |
11096|       |
11097|     31|#ifdef TARGET_API_LIB
11098|       |    /*------------- for debug only -------------------
11099|       |    InchiTimeGet(&ulTStart);
11100|       |    ret = OutputInChIOutOfStrFromINChI( ic, pCG,
11101|       |    ip, sd, num_inp, 0,
11102|       |    pOut, pLog, &OneInput,
11103|       |    save_opt_bits);
11104|       |    ulProcessingTime += InchiTimeElapsed( ic, pulTStart);
11105|       |    if ( ret < 0 )
11106|       |    {
11107|       |    AddOneMsg(szMessage, (int)strlen(szMessage), nMessageLen, "Restored structure to InChI conversion failed", "; ");
11108|       |    goto dealloc;
11109|       |    }
11110|       |    -------------------------------------------------*/
11111|     31|    if (at && num_at)
  ------------------
  |  Branch (11111:9): [True: 31, False: 0]
  |  Branch (11111:15): [True: 31, False: 0]
  ------------------
11112|     31|    {
11113|     31|        *at = pOneInput->atom;
11114|     31|        *num_at = pOneInput->num_atoms;
11115|     31|        pOneInput->atom = NULL;
11116|     31|        *polymer = pOneInput->polymer;
11117|     31|        pOneInput->polymer = NULL;
11118|     31|        *v3000 = pOneInput->v3000;
11119|     31|        pOneInput->v3000 = NULL;
11120|     31|    }
11121|       |#else
11122|       |
11123|       |    InchiTimeGet( pulTStart );
11124|       |
11125|       |    ret = OutputInChIOutOfStrFromINChI( ic, pCG, ip, sd, num_inp, bINChIOutputOptions,
11126|       |                                        pOut, NULL, pOneInput, bHasSomeFixedH, save_opt_bits );
11127|       |
11128|       |    ulProcessingTime += InchiTimeElapsed( ic, pulTStart );
11129|       |
11130|       |    if (ret < 0)
11131|       |    {
11132|       |        AddOneMsg( szMessage, (int) strlen( szMessage ), nMessageLen, "Restored structure to InChI conversion error", "; " );
11133|       |        ( *num_errors )++;
11134|       |        goto dealloc;
11135|       |    }
11136|       |#endif
11137|       |
11138|     31|    if (szMessage)
  ------------------
  |  Branch (11138:9): [True: 31, False: 0]
  ------------------
11139|     31|    {
11140|     31|        int len, retcomp = 0, retcomp1 = 0;
11141|     31|        InchiTimeGet( pulTStart );
11142|     31|        retcomp = FillOutCompareMessage( szMessage, nMessageLen, pOneInput->CompareInchiFlags[0] );
11143|       |
11144|     31|        if (pOneInput->CompareInchiFlags[1][0] || pOneInput->CompareInchiFlags[1][1])
  ------------------
  |  Branch (11144:13): [True: 0, False: 31]
  |  Branch (11144:51): [True: 0, False: 31]
  ------------------
11145|      0|        {
11146|      0|            AddOneMsg( szMessage, (int) strlen( szMessage ), nMessageLen, "Disconnected: ", "; " );
11147|      0|            retcomp1 = FillOutCompareMessage( szMessage, nMessageLen, pOneInput->CompareInchiFlags[1] );
11148|      0|        }
11149|       |        /* add a metal warning */
11150|     31|        if (bHasMetal && nInitLenMessage < ( len = (int) strlen( szMessage ) ))
  ------------------
  |  Branch (11150:13): [True: 0, False: 31]
  |  Branch (11150:26): [True: 0, False: 0]
  ------------------
11151|      0|        {
11152|      0|            char szMetal[] = " (Metal compound)";
11153|      0|            int shift;
11154|      0|            if (len + ( int )sizeof( szMetal ) > nMessageLen)
  ------------------
  |  Branch (11154:17): [True: 0, False: 0]
  ------------------
11155|      0|            {
11156|      0|                len = nMessageLen - ( int )sizeof( szMetal );
11157|      0|            }
11158|      0|            shift = nInitLenMessage + ( int )sizeof( szMetal ) - 1;
11159|      0|            memmove( szMessage + shift, szMessage + nInitLenMessage, ( len - nInitLenMessage ) * sizeof( szMessage[0] ) );
11160|      0|            memcpy( szMessage + nInitLenMessage, szMetal, sizeof( szMetal ) - sizeof( szMessage[0] ) );
11161|      0|            szMessage[shift + len - nInitLenMessage] = '\0';
11162|      0|        }
11163|       |
11164|     31|        retcomp = inchi_min( retcomp, retcomp1 );
  ------------------
  |  |  167|     31|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 18, False: 13]
  |  |  ------------------
  ------------------
11165|       |
11166|     31|        if (retcomp < 0 &&
  ------------------
  |  Branch (11166:13): [True: 18, False: 13]
  ------------------
11167|     31|            ( ip_inp->bINChIOutputOptions2 & INCHI_OUT_MISMATCH_AS_ERROR )
  ------------------
  |  |  178|     18|#define INCHI_OUT_MISMATCH_AS_ERROR      0x0002 /* v. 1.05 */
  ------------------
  |  Branch (11167:13): [True: 0, False: 18]
  ------------------
11168|     31|             )
11169|      0|        {
11170|      0|            ret = RI_ERR_MISMATCH;
  ------------------
  |  |   49|      0|#define RI_ERR_MISMATCH (-9)
  ------------------
11171|       |            /* AddOneMsg(szMessage, (int)strlen(szMessage), nMessageLen, "* Treated as error by user supplied option", "; "); */
11172|      0|            ( *num_errors )++;
11173|      0|            goto dealloc;
11174|      0|        }
11175|       |
11176|     31|        ulProcessingTime += InchiTimeElapsed( ic, pulTStart );
11177|     31|    }
11178|       |
11179|     31|    ret = 0;
11180|       |
11181|     88|dealloc:
11182|       |    /* Deallocate */
11183|     88|    if (ret)
  ------------------
  |  Branch (11183:9): [True: 57, False: 31]
  ------------------
11184|     57|    {
11185|     57|        if (ret < 0)
  ------------------
  |  Branch (11185:13): [True: 57, False: 0]
  ------------------
11186|     57|        {
11187|     57|            if (ret == CT_USER_QUIT_ERR)
  ------------------
  |  |   60|     57|#define CT_USER_QUIT_ERR     (CT_ERR_FIRST-13)  /*(-30013) */
  |  |  ------------------
  |  |  |  |   46|     57|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (11187:17): [True: 0, False: 57]
  ------------------
11188|      0|            {
11189|      0|                AddOneMsg( szMessage, (int) strlen( szMessage ), nMessageLen, "*Terminated by the user*", "; " );
11190|      0|            }
11191|     57|            else
11192|     57|            {
11193|     57|                AddOneMsg( szMessage, (int) strlen( szMessage ), nMessageLen, "*Conversion failed*", "; " );
11194|     57|            }
11195|     57|        }
11196|      0|        else
11197|      0|        {
11198|      0|            int iRec, iMob, iComp, nComp, len;
11199|      0|            char szTemp[128];
11200|      0|            AddOneMsg( szMessage, (int) strlen( szMessage ), nMessageLen, "*Conversion failed on component(s)", "; " );
11201|      0|            len = (int) strlen( szMessage );
11202|      0|            for (iRec = 0; iRec < INCHI_NUM; iRec++)
  ------------------
  |  |  574|      0|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (11202:28): [True: 0, False: 0]
  ------------------
11203|      0|            {
11204|      0|                for (iMob = bHasSomeFixedH ? TAUT_NON : TAUT_YES; iMob < TAUT_NUM; iMob++)
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                              for (iMob = bHasSomeFixedH ? TAUT_NON : TAUT_YES; iMob < TAUT_NUM; iMob++)
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                              for (iMob = bHasSomeFixedH ? TAUT_NON : TAUT_YES; iMob < TAUT_NUM; iMob++)
  ------------------
  |  |  578|      0|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (11204:29): [True: 0, False: 0]
  |  Branch (11204:67): [True: 0, False: 0]
  ------------------
11205|      0|                {
11206|      0|                    nComp = pOneInput->nNumComponents[iRec][iMob];
11207|      0|                    if (!pStruct[iRec][iMob])
  ------------------
  |  Branch (11207:25): [True: 0, False: 0]
  ------------------
11208|      0|                    {
11209|      0|                        continue;
11210|      0|                    }
11211|      0|                    for (iComp = 0; iComp < nComp; iComp++)
  ------------------
  |  Branch (11211:37): [True: 0, False: 0]
  ------------------
11212|      0|                    {
11213|      0|                        if (pStruct[iRec][iMob][iComp].nError)
  ------------------
  |  Branch (11213:29): [True: 0, False: 0]
  ------------------
11214|      0|                        {
11215|      0|                            char *szFormula = pOneInput->pInpInChI[iRec][iMob][iComp].szHillFormula;
11216|      0|                            sprintf( szTemp,
11217|      0|#if ( FIX_DALKE_BUGS == 1 )
11218|      0|                                     " %s%s%d(%.96s)",
11219|       |#else
11220|       |                                     " %s%s%d(%s)",
11221|       |#endif
11222|      0|                                     !bHasSomeReconnected ? "" : iRec ? "R" : "D",
  ------------------
  |  Branch (11222:38): [True: 0, False: 0]
  |  Branch (11222:66): [True: 0, False: 0]
  ------------------
11223|      0|                                     !bHasSomeFixedH ? "" : iMob ? "M" : "F",
  ------------------
  |  Branch (11223:38): [True: 0, False: 0]
  |  Branch (11223:61): [True: 0, False: 0]
  ------------------
11224|      0|                                     iComp + 1, szFormula ? szFormula : "???" );
  ------------------
  |  Branch (11224:49): [True: 0, False: 0]
  ------------------
11225|      0|                            AddOneMsg( szMessage, (int) strlen( szMessage ), nMessageLen, szTemp, NULL );
11226|      0|                        }
11227|      0|                    }
11228|      0|                }
11229|      0|            }
11230|      0|        } /* if ( ret > 0 ) */
11231|     57|    } /* if ( ret ) */
11232|       |
11233|       |
11234|     88|    InchiTimeGet( pulTStart );
11235|       |
11236|       |    /* Print one structure report */
11237|     88|    if (szMsg && nMsgLen > 1)
  ------------------
  |  Branch (11237:9): [True: 88, False: 0]
  |  Branch (11237:18): [True: 88, False: 0]
  ------------------
11238|     88|    {
11239|     88|        int len = inchi_min( (int) strlen( szMessage ), nMsgLen - 1 );
  ------------------
  |  |  167|     88|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 88, False: 0]
  |  |  ------------------
  ------------------
11240|     88|        if (len > 0)
  ------------------
  |  Branch (11240:13): [True: 75, False: 13]
  ------------------
11241|     75|        {
11242|     75|            memcpy( szMsg, szMessage, len );
11243|     75|            szMsg[len] = '\0';
11244|     75|        }
11245|     13|        else
11246|     13|        {
11247|     13|            szMsg[0] = '\0';
11248|     13|        }
11249|     88|    }
11250|       |
11251|     88|    if (nInitLenMessage < (int) strlen( szMessage ))
  ------------------
  |  Branch (11251:9): [True: 75, False: 13]
  ------------------
11252|     75|    {
11253|     75|        inchi_ios_eprint( pLog, "%s\n", szMessage );
11254|     75|    }
11255|       |#ifndef TARGET_API_LIB
11256|       |    else
11257|       |    {
11258|       |        /*^^^inchi_ios_eprint( stderr, "%s\r", szMessage );*/
11259|       |        inchi_fprintf( stderr, "%s\r", szMessage );
11260|       |    }
11261|       |#endif
11262|       |
11263|     88|    FreeStrFromINChI( pStruct, pOneInput->nNumComponents );
11264|     88|    FreeInpInChI( pOneInput );
11265|     88|    if (*pszCurHdr)
  ------------------
  |  Branch (11265:9): [True: 0, False: 88]
  ------------------
11266|      0|    {
11267|      0|        inchi_free( *pszCurHdr );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
11268|      0|        *pszCurHdr = NULL;
11269|      0|    }
11270|       |
11271|       |    INCHI_HEAPCHK
11272|       |
11273|     88|        ulProcessingTime += InchiTimeElapsed( ic, pulTStart );
11274|       |
11275|     88|    return ret;
11276|     31|}
DetectAndExposePolymerInternals:
11281|    227|{
11282|    227|    int  i, j, elindex, ret = 0, nheavy = 0,
11283|    227|        nstars = 0, zlen = 0, star0 = 0, i_last_sym,
11284|    227|        slen = 0, i2 = 0, ninsert = 0, kinsert, lead_pos, nc, ntimes;
11285|    227|    const char *p, *pz, *pz2, *pr, *pend, *q;
11286|    227|    char prev_layer_symbol = '0';
11287|    227|    char element[3], *tmpstr = NULL, *edited_s = NULL;
11288|    227|    int  *insert_pos = NULL;    /* inserts go before insert_pos[k] */
11289|    227|    char *s = NULL, *s2 = NULL;
11290|    227|    int  slength;
11291|       |
11292|    227|    slength = is->s.nUsedLength;
11293|    227|    s = (char *) inchi_calloc( 2 * slength + 32, sizeof( char ) );
  ------------------
  |  | 1133|    227|#define inchi_calloc   calloc
  ------------------
11294|    227|    if (!s)
  ------------------
  |  Branch (11294:9): [True: 0, False: 227]
  ------------------
11295|      0|    {
11296|      0|        goto endf;
11297|      0|    }
11298|       |
11299|       |    /* Remove but save a tail (AuxInfo, InChIKey, etc.) if any */
11300|    227|    strcpy( s, is->s.pStr );
11301|   950k|    for (i = 0; i < slength; i++)
  ------------------
  |  Branch (11301:17): [True: 950k, False: 206]
  ------------------
11302|   950k|    {
11303|   950k|        if (isspace( UCINT s[i] ))
11304|     21|        {
11305|     21|            i2 = i;
11306|     21|            break;
11307|     21|        }
11308|   950k|    }
11309|    227|    if (i2)
  ------------------
  |  Branch (11309:9): [True: 21, False: 206]
  ------------------
11310|     21|    {
11311|     21|        s2 = (char *) inchi_calloc( slength - i2 + 2, sizeof( char ) );
  ------------------
  |  | 1133|     21|#define inchi_calloc   calloc
  ------------------
11312|     21|        if (!s2) goto endf;
  ------------------
  |  Branch (11312:13): [True: 0, False: 21]
  ------------------
11313|     21|        strcpy( s2, s + i2 );
11314|     21|        s[i2] = '\0';
11315|     21|    }
11316|       |
11317|    227|    i_last_sym = strlen( s ) - 1;
11318|    227|    p = strstr( s, "InChI=1" );
11319|    227|    if (!p)
  ------------------
  |  Branch (11319:9): [True: 0, False: 227]
  ------------------
11320|      0|    {
11321|      0|        goto endf;
11322|      0|    }
11323|       |
11324|    227|    pz = strstr( p, "/z" );
11325|    227|    if (!pz)
  ------------------
  |  Branch (11325:9): [True: 123, False: 104]
  ------------------
11326|    123|    {
11327|    123|        goto endf;
11328|    123|    }
11329|    104|    pz++;
11330|       |
11331|       |    /* Check formula */
11332|    104|    p = strchr( p, '/' );
11333|    104|    p++;
11334|    104|    pend = strchr( p, '/' );
11335|    104|    ntimes = 1;
11336|    232|    while (p != pend)
  ------------------
  |  Branch (11336:12): [True: 132, False: 100]
  ------------------
11337|    132|    {
11338|    132|        if (isdigit( *p ))
11339|     33|        {
11340|     33|            ntimes = (int) inchi_strtol( p, &q, 10 );
11341|     33|#if ( CHECK_STRTOL_ATNUMB==1 )
11342|     33|            if (ntimes>MAX_ATOMS || ntimes<0)
  ------------------
  |  |   43|     66|#define MAX_ATOMS  32766
  ------------------
  |  Branch (11342:17): [True: 0, False: 33]
  |  Branch (11342:37): [True: 0, False: 33]
  ------------------
11343|      0|            {
11344|      0|#if (FIX_GAF_2020_25607 == 1)
11345|      0|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
11346|      0|                goto endf;
11347|       |#else
11348|       |                return RI_ERR_SYNTAX; /* syntax error */
11349|       |#endif
11350|      0|            }
11351|     33|#endif
11352|     33|            p = q;
11353|     33|        }
11354|     99|        else
11355|     99|        {
11356|     99|            if (*p == '.')
  ------------------
  |  Branch (11356:17): [True: 0, False: 99]
  ------------------
11357|      0|            {
11358|      0|                ntimes = 1;
11359|      0|            }
11360|     99|        }
11361|       |
11362|    132|        if (!isupper( UCINT *p ))
  ------------------
  |  Branch (11362:13): [True: 3, False: 129]
  ------------------
11363|      3|        {
11364|      3|            ret = -1;
11365|      3|            goto endf;
11366|      3|        }
11367|       |
11368|    129|        j = 0;
11369|    129|        element[j++] = *p++;
11370|    129|        if (*p && islower( UCINT *p ))
  ------------------
  |  Branch (11370:13): [True: 129, False: 0]
  ------------------
11371|     28|        {
11372|     28|            element[j++] = *p++;
11373|     28|        }
11374|    129|        element[j++] = '\0';
11375|    129|        if (*p && isdigit( UCINT *p ))
  ------------------
  |  Branch (11375:13): [True: 129, False: 0]
  ------------------
11376|     39|        {
11377|     39|            elindex = (int) inchi_strtol( p, &q, 10 );
11378|     39|#if ( CHECK_STRTOL_ATNUMB==1 )
11379|     39|            if (elindex>MAX_ATOMS || elindex<0)
  ------------------
  |  |   43|     78|#define MAX_ATOMS  32766
  ------------------
  |  Branch (11379:17): [True: 0, False: 39]
  |  Branch (11379:38): [True: 0, False: 39]
  ------------------
11380|      0|            {
11381|      0|#if (FIX_GAF_2020_25607 == 1)
11382|      0|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
11383|      0|                goto endf;
11384|       |#else
11385|       |                return RI_ERR_SYNTAX; /* syntax error */
11386|       |#endif
11387|       |
11388|      0|            }
11389|     39|#endif
11390|     39|            p = q;
11391|     39|        }
11392|     90|        else
11393|     90|        {
11394|     90|            elindex = 1;
11395|     90|        }
11396|    129|        if (!elindex)
  ------------------
  |  Branch (11396:13): [True: 0, False: 129]
  ------------------
11397|      0|        {
11398|      0|            ret = -1;
11399|      0|            goto endf;
11400|      0|        }
11401|    129|#if ( FIX_GAF_2019_2==1 )
11402|    129|        if (ERR_ELEM == get_periodic_table_number(element))
  ------------------
  |  Branch (11402:13): [True: 1, False: 128]
  ------------------
11403|      1|        {
11404|      1|            ret = -1;
11405|      1|            goto endf;
11406|      1|        }
11407|    128|#endif        
11408|    128|        if (element[0] != 'H' || element[1])
  ------------------
  |  Branch (11408:13): [True: 124, False: 4]
  |  Branch (11408:34): [True: 0, False: 4]
  ------------------
11409|    124|        {
11410|    124|            nheavy += ntimes*elindex;
11411|    124|        }
11412|       |
11413|    128|        if (*p == '.')
  ------------------
  |  Branch (11413:13): [True: 0, False: 128]
  ------------------
11414|      0|        {
11415|      0|            p++;
11416|      0|        }
11417|    128|    }
11418|       |
11419|    100|#if ( FIX_GAF_2019_2==1 )
11420|    100|    insert_pos = (int *)inchi_calloc(is->s.nUsedLength + 1, sizeof(int));
  ------------------
  |  | 1133|    100|#define inchi_calloc   calloc
  ------------------
11421|       |#else
11422|       |    /* max num of insert positions is 2 in formulas + Npolymeric units, the latter may not be > nheavy */
11423|       |    insert_pos = (int *)inchi_calloc(nheavy + 32, sizeof(int));
11424|       |#endif
11425|    100|    if (!insert_pos)
  ------------------
  |  Branch (11425:9): [True: 0, False: 100]
  ------------------
11426|      0|    {
11427|      0|        ret = -2;
11428|      0|        goto endf;
11429|      0|    }
11430|       |
11431|    100|    ninsert = 0;
11432|    100|    if (pend)
  ------------------
  |  Branch (11432:9): [True: 100, False: 0]
  ------------------
11433|    100|    {
11434|    100|        insert_pos[ninsert] = (int) ( pend - s );
11435|    100|    }
11436|      0|    else
11437|      0|    {
11438|      0|        insert_pos[ninsert] = i_last_sym;
11439|      0|    }
11440|    100|    ninsert++;
11441|       |
11442|       |    /* Check hidden stars */
11443|    100|    lead_pos = (int) ( pz - s );
11444|    100|    pend = strchr( pz, '/' );
11445|    100|    if (pend)
  ------------------
  |  Branch (11445:9): [True: 31, False: 69]
  ------------------
11446|     31|    {
11447|     31|        zlen = (int) ( pend - pz );
11448|     31|    }
11449|     69|    else
11450|     69|    {
11451|     69|        zlen = (int) strlen( pz );
11452|     69|    }
11453|    100|    tmpstr = (char *) inchi_calloc( zlen + 32, sizeof( char ) );
  ------------------
  |  | 1133|    100|#define inchi_calloc   calloc
  ------------------
11454|    100|    if (!tmpstr)
  ------------------
  |  Branch (11454:9): [True: 0, False: 100]
  ------------------
11455|      0|    {
11456|      0|        ret = -2;
11457|      0|        goto endf;
11458|      0|    }
11459|    100|    memcpy( tmpstr, pz, zlen );
11460|       |
11461|    100|    ret = DetectHiddenPolymerStuff( tmpstr, zlen, &ninsert, insert_pos, lead_pos, &nstars );
11462|    100|    if (ret)
  ------------------
  |  Branch (11462:9): [True: 0, False: 100]
  ------------------
11463|      0|    {
11464|      0|        goto endf;
11465|      0|    }
11466|    100|    if (!nstars)
  ------------------
  |  Branch (11466:9): [True: 29, False: 71]
  ------------------
11467|     29|    {
11468|     29|        goto endf;
11469|     29|    }
11470|       |
11471|       |    /* Have second '/z' ? */
11472|     71|    pr = strstr( s, "/r" );
11473|     71|    if (pr)
  ------------------
  |  Branch (11473:9): [True: 33, False: 38]
  ------------------
11474|     33|    {
11475|     33|        pr++;
11476|       |
11477|     33|        pend = strchr( pr, '/' );
11478|     33|        if (pend)
  ------------------
  |  Branch (11478:13): [True: 33, False: 0]
  ------------------
11479|     33|        {
11480|     33|            insert_pos[ninsert] = (int) ( pend - s );
11481|     33|        }
11482|      0|        else
11483|      0|        {
11484|      0|            insert_pos[ninsert] = i_last_sym;
11485|      0|        }
11486|     33|        ninsert++;
11487|       |
11488|     33|        pz2 = strstr( pr, "/z" );
11489|     33|        if (pz2)
  ------------------
  |  Branch (11489:13): [True: 31, False: 2]
  ------------------
11490|     31|        {
11491|     31|            pz2++;
11492|     31|            lead_pos = (int) ( pz2 - s );
11493|     31|            pend = strchr( pz2, '/' );
11494|     31|            if (pend)
  ------------------
  |  Branch (11494:17): [True: 9, False: 22]
  ------------------
11495|      9|            {
11496|      9|                zlen = (int) ( pend - pz2 );
11497|      9|            }
11498|     22|            else
11499|     22|            {
11500|     22|                zlen = (int) strlen( pz2 );
11501|     22|            }
11502|     31|            if (tmpstr)
  ------------------
  |  Branch (11502:17): [True: 31, False: 0]
  ------------------
11503|     31|            {
11504|     31|                inchi_free( tmpstr );
  ------------------
  |  | 1136|     31|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 31, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
11505|     31|            }
11506|     31|            tmpstr = (char *) inchi_calloc( zlen + 32, sizeof( char ) );
  ------------------
  |  | 1133|     31|#define inchi_calloc   calloc
  ------------------
11507|     31|            if (!tmpstr)
  ------------------
  |  Branch (11507:17): [True: 0, False: 31]
  ------------------
11508|      0|            {
11509|      0|                ret = -2;
11510|      0|                goto endf;
11511|      0|            }
11512|     31|            memcpy( tmpstr, pz2, zlen );
11513|       |
11514|     31|            nstars = 0;
11515|     31|            ret = DetectHiddenPolymerStuff( tmpstr, zlen, &ninsert, insert_pos, lead_pos, &nstars );
11516|     31|            if (ret)
  ------------------
  |  Branch (11516:17): [True: 0, False: 31]
  ------------------
11517|      0|            {
11518|      0|                goto endf;
11519|      0|            }
11520|     31|        }
11521|     33|    }
11522|       |
11523|     71|    slen = (int) strlen( s );
11524|     71|    edited_s = (char *) inchi_calloc( slen * 100 + 32 * 10 * ninsert, sizeof( char ) ); /* high reservation */
  ------------------
  |  | 1133|     71|#define inchi_calloc   calloc
  ------------------
11525|     71|    if (!edited_s)
  ------------------
  |  Branch (11525:9): [True: 0, False: 71]
  ------------------
11526|      0|    {
11527|      0|        ret = -2;
11528|      0|        goto endf;
11529|      0|    }
11530|       |
11531|       |    /* Edits */
11532|     71|    nc = 0;
11533|     71|    kinsert = 0;
11534|     71|    star0 = nheavy + 1;
11535|   201k|    for (i = 0; i < slen; i++)
  ------------------
  |  Branch (11535:17): [True: 201k, False: 0]
  ------------------
11536|   201k|    {
11537|   201k|        if (kinsert < ninsert && i == insert_pos[kinsert])
  ------------------
  |  Branch (11537:13): [True: 189k, False: 11.4k]
  |  Branch (11537:34): [True: 52.9k, False: 136k]
  ------------------
11538|  52.9k|        {
11539|  52.9k|            if (kinsert == 0 || prev_layer_symbol == 'r')
  ------------------
  |  Branch (11539:17): [True: 71, False: 52.8k]
  |  Branch (11539:33): [True: 4, False: 52.8k]
  ------------------
11540|     75|            {
11541|     75|                sprintf( tmpstr, ".%dZz", nstars );
11542|     75|                star0 = nheavy + 1;            /* reset star numbers pool */
11543|     75|                prev_layer_symbol = '0';    /* avoid printing ';' also */
11544|     75|            }
11545|  52.8k|            else
11546|  52.8k|            {
11547|  52.8k|                sprintf( tmpstr, "%d,%d-", star0, star0 + 1 );
11548|  52.8k|                star0 += 2;
11549|  52.8k|            }
11550|  52.9k|            kinsert++;
11551|   643k|            for (j = 0; j < (int) strlen( tmpstr ); j++)
  ------------------
  |  Branch (11551:25): [True: 590k, False: 52.9k]
  ------------------
11552|   590k|            {
11553|   590k|                edited_s[nc] = tmpstr[j];
11554|   590k|                nc++;
11555|   590k|            }
11556|  52.9k|        }
11557|       |
11558|   201k|        if (i == i_last_sym)
  ------------------
  |  Branch (11558:13): [True: 71, False: 201k]
  ------------------
11559|     71|        {
11560|     71|            edited_s[nc++] = s[i];
11561|     71|        }
11562|       |
11563|   201k|        if (s[i] == '/' || i == i_last_sym)
  ------------------
  |  Branch (11563:13): [True: 4.55k, False: 196k]
  |  Branch (11563:28): [True: 54, False: 196k]
  ------------------
11564|  4.61k|        {
11565|  4.61k|            if (prev_layer_symbol != '0' &&
  ------------------
  |  Branch (11565:17): [True: 4.46k, False: 146]
  ------------------
11566|  4.61k|                 prev_layer_symbol != 'f' &&
  ------------------
  |  Branch (11566:18): [True: 4.18k, False: 282]
  ------------------
11567|  4.61k|                 prev_layer_symbol != 'z' &&
  ------------------
  |  Branch (11567:18): [True: 3.77k, False: 406]
  ------------------
11568|  4.61k|                 prev_layer_symbol != 'p' &&
  ------------------
  |  Branch (11568:18): [True: 3.26k, False: 516]
  ------------------
11569|  4.61k|                 prev_layer_symbol != 'r' &&
  ------------------
  |  Branch (11569:18): [True: 2.83k, False: 427]
  ------------------
11570|  4.61k|                 prev_layer_symbol != 's'
  ------------------
  |  Branch (11570:18): [True: 2.47k, False: 358]
  ------------------
11571|  4.61k|                 )
11572|  2.47k|            {
11573|  2.47k|                char addon = ';';
11574|  2.47k|                if (prev_layer_symbol == 'm')
  ------------------
  |  Branch (11574:21): [True: 1.51k, False: 962]
  ------------------
11575|  1.51k|                {
11576|  1.51k|                    addon = '.';
11577|  1.51k|                }
11578|   904k|                for (j = 0; j < nstars; j++)
  ------------------
  |  Branch (11578:29): [True: 901k, False: 2.47k]
  ------------------
11579|   901k|                {
11580|   901k|                    edited_s[nc++] = addon;
11581|   901k|                }
11582|  2.47k|            }
11583|  2.13k|            else if (prev_layer_symbol == 'f')
  ------------------
  |  Branch (11583:22): [True: 282, False: 1.85k]
  ------------------
11584|    282|            {
11585|    282|                if (s[i - 1] != 'f' && s[i - 2] != '/')
  ------------------
  |  Branch (11585:21): [True: 132, False: 150]
  |  Branch (11585:40): [True: 132, False: 0]
  ------------------
11586|    132|                {
11587|    132|                    sprintf( tmpstr, ".%dZz", nstars );
11588|    662|                    for (j = 0; j < (int) strlen( tmpstr ); j++)
  ------------------
  |  Branch (11588:33): [True: 530, False: 132]
  ------------------
11589|    530|                    {
11590|    530|                        edited_s[nc] = tmpstr[j];
11591|    530|                        nc++;
11592|    530|                    }
11593|    132|                }
11594|    282|            }
11595|       |
11596|  4.61k|            if (i != i_last_sym)
  ------------------
  |  Branch (11596:17): [True: 4.54k, False: 71]
  ------------------
11597|  4.54k|            {
11598|  4.54k|                prev_layer_symbol = s[i + 1];
11599|  4.54k|            }
11600|     71|            else
11601|     71|            {
11602|     71|                break;
11603|     71|            }
11604|  4.61k|        }
11605|   201k|        edited_s[nc] = s[i];
11606|   201k|        nc++;
11607|   201k|    }
11608|     71|    edited_s[nc] = '\0';
11609|     71|    inchi_strbuf_close( &is->s );
11610|     71|    inchi_ios_print( is, "%-s%-s\n", edited_s, s2 ? s2 : "" );
  ------------------
  |  Branch (11610:48): [True: 0, False: 71]
  ------------------
11611|       |
11612|    227|endf:
11613|    227|    if (s)
  ------------------
  |  Branch (11613:9): [True: 227, False: 0]
  ------------------
11614|    227|    {
11615|    227|        inchi_free( s );
  ------------------
  |  | 1136|    227|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 227, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
11616|    227|    }
11617|    227|    if (s2)
  ------------------
  |  Branch (11617:9): [True: 21, False: 206]
  ------------------
11618|     21|    {
11619|     21|        inchi_free( s2 );
  ------------------
  |  | 1136|     21|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 21, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
11620|     21|    }
11621|    227|    if (edited_s)
  ------------------
  |  Branch (11621:9): [True: 71, False: 156]
  ------------------
11622|     71|    {
11623|     71|        inchi_free( edited_s );
  ------------------
  |  | 1136|     71|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 71, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
11624|     71|    }
11625|    227|    if (tmpstr)
  ------------------
  |  Branch (11625:9): [True: 100, False: 127]
  ------------------
11626|    100|    {
11627|    100|        inchi_free( tmpstr );
  ------------------
  |  | 1136|    100|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 100, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
11628|    100|    }
11629|    227|    if (insert_pos)
  ------------------
  |  Branch (11629:9): [True: 100, False: 127]
  ------------------
11630|    100|    {
11631|    100|        inchi_free( insert_pos );
  ------------------
  |  | 1136|    100|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 100, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
11632|    100|    }
11633|       |
11634|    227|    return ret;
11635|     71|}
DetectHiddenPolymerStuff:
11645|    131|{
11646|    131|    char c;
11647|    131|    int  opened, skip, i, i0, closed, ret = 0;
11648|       |
11649|    131|    *nstars = opened = skip = i0 = 0;
11650|    131|    closed = 1;
11651|   316k|    for (i = 0; i < tmpstrlen; i++)
  ------------------
  |  Branch (11651:17): [True: 316k, False: 131]
  ------------------
11652|   316k|    {
11653|   316k|        c = tmpstr[i];
11654|       |
11655|   316k|        if (c == '(')
  ------------------
  |  Branch (11655:13): [True: 100k, False: 215k]
  ------------------
11656|   100k|        {
11657|   100k|            if (!closed)
  ------------------
  |  Branch (11657:17): [True: 0, False: 100k]
  ------------------
11658|      0|            {
11659|      0|                ret = -3; goto endf;
11660|      0|            }
11661|   100k|            opened = 1;
11662|   100k|            skip = 0;
11663|   100k|            i0 = i;
11664|   100k|        }
11665|   215k|        else if (c == ')')
  ------------------
  |  Branch (11665:18): [True: 92.5k, False: 123k]
  ------------------
11666|  92.5k|        {
11667|  92.5k|            if (!opened)
  ------------------
  |  Branch (11667:17): [True: 0, False: 92.5k]
  ------------------
11668|      0|            {
11669|      0|                ret = -3; goto endf;
11670|      0|            }
11671|  92.5k|            if (!skip)
  ------------------
  |  Branch (11671:17): [True: 92.2k, False: 243]
  ------------------
11672|  92.2k|            {
11673|  92.2k|                ( *nstars ) += 2;
11674|  92.2k|                insert_pos[( *ninsert )] = i0 + 1 + insert_lead_offset;
11675|  92.2k|                ( *ninsert )++;
11676|  92.2k|            }
11677|  92.5k|            opened = 0;
11678|  92.5k|        }
11679|   123k|        else if (c == '-')
  ------------------
  |  Branch (11679:18): [True: 25.8k, False: 97.2k]
  ------------------
11680|  25.8k|        {
11681|  25.8k|            skip = 1;
11682|  25.8k|        }
11683|   316k|    }
11684|       |
11685|    131|endf:
11686|    131|    return ret;
11687|    131|}
ichiread.c:bInChIHasReconnectedMetal:
 1898|   109k|{
 1899|   109k|    int i;
 1900|   109k|    if (pInChI && !pInChI->bDeleted && pInChI->nNumberOfAtoms && pInChI->nAtom)
  ------------------
  |  Branch (1900:9): [True: 109k, False: 0]
  |  Branch (1900:19): [True: 109k, False: 68]
  |  Branch (1900:40): [True: 55.4k, False: 53.8k]
  |  Branch (1900:66): [True: 55.4k, False: 0]
  ------------------
 1901|  55.4k|    {
 1902|   695k|        for (i = 0; i < pInChI->nNumberOfAtoms; i++)
  ------------------
  |  Branch (1902:21): [True: 640k, False: 54.8k]
  ------------------
 1903|   640k|        {
 1904|   640k|            if (is_el_a_metal( (int) pInChI->nAtom[i] ))
  ------------------
  |  Branch (1904:17): [True: 786, False: 640k]
  ------------------
 1905|    786|            {
 1906|    786|                if (pInChI->nNumberOfAtoms > 1 || pInChI->nNum_H && pInChI->nNum_H[0])
  ------------------
  |  Branch (1906:21): [True: 647, False: 139]
  |  Branch (1906:51): [True: 139, False: 0]
  |  Branch (1906:69): [True: 0, False: 139]
  ------------------
 1907|    647|                {
 1908|    647|                    return 1;
 1909|    647|                }
 1910|    786|            }
 1911|   640k|        }
 1912|  55.4k|    }
 1913|       |
 1914|   108k|    return 0;
 1915|   109k|}
ichiread.c:SetProtonsAndXchgIsoH:
 1927|    168|{
 1928|    168|    int      j, k, k1, ret2 = 0, iINChI;
 1929|    168|    int  bAvailableProtonsForEachComponent, bAvailableProtonsTotal;
 1930|       |
 1931|       |    INCHI_HEAPCHK
 1932|       |
 1933|    168|        num_components[INCHI_BAS] = num_components[INCHI_REC] = 0;
  ------------------
  |  |  575|    168|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                      num_components[INCHI_BAS] = num_components[INCHI_REC] = 0;
  ------------------
  |  |  576|    168|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1934|       |
 1935|    504|    for (iINChI = 0; iINChI < INCHI_NUM; iINChI++)
  ------------------
  |  |  574|    504|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1935:22): [True: 336, False: 168]
  ------------------
 1936|    336|    {
 1937|    336|        nModeProtonIsoExchgH[iINChI] = MODE_PIXH_UNDEFINED;
 1938|       |        /* are totals of /p and/or /i/h available ? */
 1939|    336|        bAvailableProtonsTotal = 0 != OneInput->nNumProtons[iINChI][TAUT_YES].nNumRemovedProtons;
  ------------------
  |  |  580|    336|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1940|  1.34k|        for (k1 = 0; k1 < NUM_H_ISOTOPES; k1++)
  ------------------
  |  |  100|  1.34k|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (1940:22): [True: 1.00k, False: 336]
  ------------------
 1941|  1.00k|        {
 1942|  1.00k|            bAvailableProtonsTotal |= 0 != OneInput->nNumProtons[iINChI][TAUT_YES].nNumRemovedIsotopicH[k1];
  ------------------
  |  |  580|  1.00k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1943|  1.00k|        }
 1944|       |        /* are /p and/or /i/h available for each component ? */
 1945|    336|        bAvailableProtonsForEachComponent = ( NULL != OneInput->nNumProtons[iINChI][TAUT_YES].pNumProtons );
  ------------------
  |  |  580|    336|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1946|       |
 1947|       |        /* decision: add /p to each component, add total to the 1st, add total as one more component */
 1948|       |        /* In case of bInChI2Structure just keep totals if not available for each component */
 1949|       |
 1950|    336|        if (bInChI2Structure)
  ------------------
  |  Branch (1950:13): [True: 176, False: 160]
  ------------------
 1951|    176|        {
 1952|    176|            nModeProtonIsoExchgH[iINChI] = bAvailableProtonsForEachComponent ?
  ------------------
  |  Branch (1952:44): [True: 0, False: 176]
  ------------------
 1953|      0|                MODE_PIXH_ADD_TO_EACH :
 1954|    176|                MODE_PIXH_KEEP_TOTALS;
 1955|    176|        }
 1956|    160|        else
 1957|    160|        {
 1958|    160|            if (!bReqSplitOutputInChI)
  ------------------
  |  Branch (1958:17): [True: 160, False: 0]
  ------------------
 1959|    160|            {
 1960|    160|                nModeProtonIsoExchgH[iINChI] = bAvailableProtonsForEachComponent ?
  ------------------
  |  Branch (1960:48): [True: 0, False: 160]
  ------------------
 1961|      0|                    MODE_PIXH_ADD_TO_EACH :
 1962|    160|                    MODE_PIXH_ADD_TO_FIRST;
 1963|    160|            }
 1964|      0|            else
 1965|      0|            {
 1966|      0|                if (!bAvailableProtonsForEachComponent)
  ------------------
  |  Branch (1966:21): [True: 0, False: 0]
  ------------------
 1967|      0|                {
 1968|      0|                    nModeProtonIsoExchgH[iINChI] = bAvailableProtonsTotal ?
  ------------------
  |  Branch (1968:52): [True: 0, False: 0]
  ------------------
 1969|      0|                        MODE_PIXH_ADD_A_PIXH_COMPONENT :
 1970|      0|                        MODE_PIXH_ADD_TO_FIRST;
 1971|      0|                }
 1972|      0|                else
 1973|      0|                {
 1974|       |                    /* bAvailableProtonsForEachComponent && bReqSplitOutputInChI */
 1975|      0|                    if (bReqProtonsForEachComponent)
  ------------------
  |  Branch (1975:25): [True: 0, False: 0]
  ------------------
 1976|      0|                    {
 1977|      0|                        nModeProtonIsoExchgH[iINChI] = MODE_PIXH_ADD_TO_EACH;
 1978|      0|                    }
 1979|      0|                    else
 1980|      0|                    {
 1981|      0|                        nModeProtonIsoExchgH[iINChI] = bReqNonTaut ?
  ------------------
  |  Branch (1981:56): [True: 0, False: 0]
  ------------------
 1982|      0|                            MODE_PIXH_ADD_TO_EACH :
 1983|      0|                            MODE_PIXH_ADD_A_PIXH_COMPONENT;
 1984|      0|                    }
 1985|      0|                }
 1986|      0|            }
 1987|    160|        }
 1988|       |
 1989|       |        /* remove unneeded data: protons for each component */
 1990|    336|        if (bAvailableProtonsForEachComponent &&
  ------------------
  |  Branch (1990:13): [True: 0, False: 336]
  ------------------
 1991|    336|             nModeProtonIsoExchgH[iINChI] != MODE_PIXH_ADD_TO_EACH)
  ------------------
  |  Branch (1991:14): [True: 0, False: 0]
  ------------------
 1992|      0|        {
 1993|      0|            inchi_free( OneInput->nNumProtons[iINChI][TAUT_YES].pNumProtons );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1994|      0|            OneInput->nNumProtons[iINChI][TAUT_YES].pNumProtons = NULL;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1995|      0|            bAvailableProtonsForEachComponent = 0;
 1996|      0|        }
 1997|       |        /* remove unneeded data: total protons all components */
 1998|    336|        if (bAvailableProtonsTotal && nModeProtonIsoExchgH[iINChI] == MODE_PIXH_ADD_TO_EACH)
  ------------------
  |  Branch (1998:13): [True: 0, False: 336]
  |  Branch (1998:39): [True: 0, False: 0]
  ------------------
 1999|      0|        {
 2000|      0|            OneInput->nNumProtons[iINChI][TAUT_YES].nNumRemovedProtons = 0;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2001|      0|            for (k1 = 0; k1 < NUM_H_ISOTOPES; k1++)
  ------------------
  |  |  100|      0|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (2001:26): [True: 0, False: 0]
  ------------------
 2002|      0|            {
 2003|      0|                OneInput->nNumProtons[iINChI][TAUT_YES].nNumRemovedIsotopicH[k1] = 0;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2004|      0|            }
 2005|      0|            bAvailableProtonsTotal = 0;
 2006|      0|        }
 2007|       |        /* remove unneeded data: Fixed-H InChI; no protons data exist for Fixed-H */
 2008|    336|        if (!bReqNonTaut && OneInput->nNumComponents[iINChI][TAUT_NON])
  ------------------
  |  |  579|    160|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (2008:13): [True: 160, False: 176]
  |  Branch (2008:29): [True: 20, False: 140]
  ------------------
 2009|     20|        {
 2010|     20|            j = TAUT_NON;
  ------------------
  |  |  579|     20|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 2011|     40|            for (k = 0; k < OneInput->nNumComponents[iINChI][j]; k++)
  ------------------
  |  Branch (2011:25): [True: 20, False: 20]
  ------------------
 2012|     20|            {
 2013|     20|                Free_INChI_Members( &OneInput->pInpInChI[iINChI][j][k] );
 2014|     20|            }
 2015|     20|            inchi_free( OneInput->pInpInChI[iINChI][j] );
  ------------------
  |  | 1136|     20|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 20, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2016|     20|            OneInput->pInpInChI[iINChI][j] = NULL;
 2017|     20|            OneInput->nNumComponents[iINChI][j] = 0;
 2018|     20|        }
 2019|       |#ifdef NEVER
 2020|       |        /* remove unneeded data: Mobile-H InChI ????? */
 2021|       |        if (bReqNonTaut && OneInput->nNumComponents[iINChI][TAUT_NON])
 2022|       |        {
 2023|       |            j = TAUT_YES;
 2024|       |            for (k = 0; k < OneInput->nNumComponents[iINChI][j]; k++)
 2025|       |            {
 2026|       |                Free_INChI_Members( &OneInput->pInpInChI[iINChI][j][k] );
 2027|       |            }
 2028|       |            inchi_free( OneInput->pInpInChI[iINChI][j] );
 2029|       |            OneInput->pInpInChI[iINChI][j] = NULL;
 2030|       |            OneInput->nNumComponents[iINChI][j] = 0;
 2031|       |            nModeProtonIsoExchgH[iINChI] = MODE_PIXH_UNDEFINED;
 2032|       |            if (OneInput->nNumProtons[iINChI][TAUT_YES].pNumProtons)
 2033|       |            {
 2034|       |                inchi_free( OneInput->nNumProtons[iINChI][TAUT_YES].pNumProtons );
 2035|       |                OneInput->nNumProtons[iINChI][TAUT_YES].pNumProtons = NULL;
 2036|       |            }
 2037|       |        }
 2038|       |#endif
 2039|       |        /* add one more component containing only /p and /i/h */
 2040|    336|        if (nModeProtonIsoExchgH[iINChI] == MODE_PIXH_ADD_A_PIXH_COMPONENT &&
  ------------------
  |  Branch (2040:13): [True: 0, False: 336]
  ------------------
 2041|    336|             OneInput->nNumComponents[iINChI][TAUT_YES] ||
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2041:14): [True: 0, False: 0]
  ------------------
 2042|       |             /* always add one deleted component if no non-taut InChI is available */
 2043|    336|             bInChI2Structure && !bAvailableProtonsForEachComponent &&
  ------------------
  |  Branch (2043:14): [True: 176, False: 160]
  |  Branch (2043:34): [True: 176, False: 0]
  ------------------
 2044|    336|             !OneInput->nNumComponents[iINChI][TAUT_NON] &&
  ------------------
  |  |  579|    176|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (2044:14): [True: 156, False: 20]
  ------------------
 2045|    336|             OneInput->nNumComponents[iINChI][TAUT_YES])
  ------------------
  |  |  580|    156|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2045:14): [True: 68, False: 88]
  ------------------
 2046|     68|        {
 2047|     68|            int nPrevLen, nLen = 0;
 2048|     68|            j = TAUT_YES;
  ------------------
  |  |  580|     68|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2049|     68|            nPrevLen = OneInput->nNumComponents[iINChI][j];
 2050|  1.67k|            for (k = 0; k < nPrevLen; k++)
  ------------------
  |  Branch (2050:25): [True: 1.61k, False: 68]
  ------------------
 2051|  1.61k|            {
 2052|  1.61k|                nLen += !OneInput->pInpInChI[iINChI][j][k].bDeleted;
 2053|  1.61k|            }
 2054|     68|            if (nLen == nPrevLen)
  ------------------
  |  Branch (2054:17): [True: 68, False: 0]
  ------------------
 2055|     68|            {
 2056|       |                /* add one more component */
 2057|     68|                INChI *pInChI = (INChI *) inchi_calloc( nLen + 1, sizeof( *pInChI ) );
  ------------------
  |  | 1133|     68|#define inchi_calloc   calloc
  ------------------
 2058|     68|                if (!pInChI)
  ------------------
  |  Branch (2058:21): [True: 0, False: 68]
  ------------------
 2059|      0|                {
 2060|      0|                    ret2 = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 2061|      0|                    goto exit_error;
 2062|      0|                }
 2063|     68|                memcpy( pInChI, OneInput->pInpInChI[iINChI][j], nLen * sizeof( *pInChI ) );
 2064|     68|                inchi_free( OneInput->pInpInChI[iINChI][j] );
  ------------------
  |  | 1136|     68|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 68, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2065|     68|                OneInput->pInpInChI[iINChI][j] = pInChI;
 2066|     68|            }
 2067|     68|            OneInput->nNumComponents[iINChI][j] = nLen + 1;
 2068|       |
 2069|     68|            for (k = nLen; k < nPrevLen; k++)
  ------------------
  |  Branch (2069:28): [True: 0, False: 68]
  ------------------
 2070|      0|            {
 2071|      0|                Free_INChI_Members( &OneInput->pInpInChI[iINChI][j][k] );
 2072|      0|                memset( &OneInput->pInpInChI[iINChI][j][k], 0, sizeof( OneInput->pInpInChI[iINChI][j][k] ) );
 2073|      0|            }
 2074|       |            /* mark the last component as a proton */
 2075|     68|            if (0 >( ret2 = nFillOutProtonMobileH( OneInput->pInpInChI[iINChI][j] + nLen ) ))
  ------------------
  |  Branch (2075:17): [True: 0, False: 68]
  ------------------
 2076|      0|            {
 2077|      0|                goto exit_error;
 2078|      0|            }
 2079|     68|        }
 2080|    336|        INCHI_HEAPCHK
 2081|       |
 2082|       |            /* remove unneeded Stereo and/or Fixed H */
 2083|    336|            if (!bReqStereo)
  ------------------
  |  Branch (2083:17): [True: 0, False: 336]
  ------------------
 2084|      0|            {
 2085|      0|                for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  578|      0|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (2085:29): [True: 0, False: 0]
  ------------------
 2086|      0|                {
 2087|      0|                    for (k = 0; k < OneInput->nNumComponents[iINChI][j]; k++)
  ------------------
  |  Branch (2087:33): [True: 0, False: 0]
  ------------------
 2088|      0|                    {
 2089|      0|                        if (OneInput->pInpInChI[iINChI][j][k].Stereo)
  ------------------
  |  Branch (2089:29): [True: 0, False: 0]
  ------------------
 2090|      0|                        {
 2091|      0|                            Free_INChI_Stereo( OneInput->pInpInChI[iINChI][j][k].Stereo );
 2092|      0|                            inchi_free( OneInput->pInpInChI[iINChI][j][k].Stereo );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2093|      0|                            OneInput->pInpInChI[iINChI][j][k].Stereo = NULL;
 2094|      0|                        }
 2095|      0|                        if (OneInput->pInpInChI[iINChI][j][k].StereoIsotopic)
  ------------------
  |  Branch (2095:29): [True: 0, False: 0]
  ------------------
 2096|      0|                        {
 2097|      0|                            Free_INChI_Stereo( OneInput->pInpInChI[iINChI][j][k].StereoIsotopic );
 2098|      0|                            inchi_free( OneInput->pInpInChI[iINChI][j][k].StereoIsotopic );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2099|      0|                            OneInput->pInpInChI[iINChI][j][k].StereoIsotopic = NULL;
 2100|      0|                        }
 2101|      0|                        INCHI_HEAPCHK
 2102|      0|                    }
 2103|      0|                }
 2104|      0|            }
 2105|       |
 2106|    336|    }
 2107|       |
 2108|    168|    num_components[INCHI_BAS] = inchi_max( OneInput->nNumComponents[INCHI_BAS][TAUT_YES],
  ------------------
  |  |  575|    168|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                  num_components[INCHI_BAS] = inchi_max( OneInput->nNumComponents[INCHI_BAS][TAUT_YES],
  ------------------
  |  |  166|    168|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 148, False: 20]
  |  |  ------------------
  ------------------
 2109|    168|                                           OneInput->nNumComponents[INCHI_BAS][TAUT_NON] );
 2110|    168|    num_components[INCHI_REC] = inchi_max( OneInput->nNumComponents[INCHI_REC][TAUT_YES],
  ------------------
  |  |  576|    168|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                  num_components[INCHI_REC] = inchi_max( OneInput->nNumComponents[INCHI_REC][TAUT_YES],
  ------------------
  |  |  166|    168|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 168]
  |  |  ------------------
  ------------------
 2111|    168|                                           OneInput->nNumComponents[INCHI_REC][TAUT_NON] );
 2112|       |
 2113|    168|exit_error:
 2114|    168|    return ret2;
 2115|    168|}
ichiread.c:GetInChINumH:
 2159|   249k|{
 2160|   249k|    int i, j, nNumTautGroups, iTautGroup, nTautGroupLen, lenTautomer;
 2161|   249k|    *nNumH = 0;
 2162|  69.9M|    for (i = 0; i < pInChI->nNumberOfAtoms; i++)
  ------------------
  |  Branch (2162:17): [True: 69.7M, False: 249k]
  ------------------
 2163|  69.7M|    {
 2164|  69.7M|        *nNumH += ( pInChI->nAtom[i] == EL_NUMBER_H ); /* bridging H */
  ------------------
  |  |   41|  69.7M|#define EL_NUMBER_H ((U_CHAR) 1)
  ------------------
 2165|  69.7M|        *nNumH += pInChI->nNum_H[i];
 2166|  69.7M|    }
 2167|       |    /* earlier nNum_H_fixed[] should have been added to pInChI->nNum_H[] */
 2168|       |    /*
 2169|       |    if ( pInChI->nNum_H_fixed ) {
 2170|       |    for ( i = 0; i < pInChI->nNumberOfAtoms; i ++ ) {
 2171|       |    *nNumH += pInChI->nNum_H_fixed[i];
 2172|       |    }
 2173|       |    }
 2174|       |    */
 2175|   249k|    if (pInChI->lenTautomer > 3 && pInChI->nTautomer)
  ------------------
  |  Branch (2175:9): [True: 160, False: 249k]
  |  Branch (2175:36): [True: 160, False: 0]
  ------------------
 2176|    160|    {
 2177|    160|        lenTautomer = pInChI->lenTautomer;
 2178|    160|        j = 0;
 2179|    160|        nNumTautGroups = pInChI->nTautomer[j++];
 2180|  5.96k|        for (iTautGroup = 0; j < lenTautomer && iTautGroup < nNumTautGroups; iTautGroup++, j += nTautGroupLen)
  ------------------
  |  Branch (2180:30): [True: 5.80k, False: 160]
  |  Branch (2180:49): [True: 5.80k, False: 0]
  ------------------
 2181|  5.80k|        {
 2182|  5.80k|            nTautGroupLen = pInChI->nTautomer[j] + 1;
 2183|  5.80k|            *nNumH += pInChI->nTautomer[j + 1];
 2184|  5.80k|        }
 2185|    160|        if (iTautGroup != nNumTautGroups || j != lenTautomer)
  ------------------
  |  Branch (2185:13): [True: 0, False: 160]
  |  Branch (2185:45): [True: 0, False: 160]
  ------------------
 2186|      0|        {
 2187|      0|            return RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 2188|      0|        }
 2189|    160|    }
 2190|   249k|    if (pInChI->nNum_H_fixed && ( pInChI->lenTautomer || pInChI->nTautomer ))
  ------------------
  |  Branch (2190:9): [True: 2, False: 249k]
  |  Branch (2190:35): [True: 0, False: 2]
  |  Branch (2190:58): [True: 0, False: 2]
  ------------------
 2191|      0|    {
 2192|      0|        return RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 2193|      0|    }
 2194|       |
 2195|   249k|    return 0;
 2196|   249k|}
ichiread.c:GetInChIFormulaNumH:
 2120|   109k|{  /* get number of H including bridging hydrogen atoms */
 2121|   109k|    const char *p, *q;
 2122|   109k|    *nNumH = 0;
 2123|   109k|    if (pInChI->szHillFormula)
  ------------------
  |  Branch (2123:9): [True: 109k, False: 0]
  ------------------
 2124|   109k|    {
 2125|   143k|        for (p = strchr( pInChI->szHillFormula, 'H' ); p; p = strchr( p, 'H' ))
  ------------------
  |  Branch (2125:56): [True: 33.7k, False: 109k]
  ------------------
 2126|  33.7k|        {
 2127|  33.7k|            p++;
 2128|  33.7k|            if (!islower( UCINT *p ))
  ------------------
  |  Branch (2128:17): [True: 33.7k, False: 0]
  ------------------
 2129|  33.7k|            {
 2130|       |                /* found hydrogen in the formula */
 2131|  33.7k|                if (isdigit( UCINT *p ))
 2132|  19.9k|                {
 2133|  19.9k|#if ( CHECK_STRTOL_ATNUMB==1 )
 2134|  19.9k|                    int delta = (int)inchi_strtol(p, &q, 10);
 2135|  19.9k|                    if (delta>MAX_ATOMS || delta<0)
  ------------------
  |  |   43|  39.8k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (2135:25): [True: 0, False: 19.9k]
  |  Branch (2135:44): [True: 0, False: 19.9k]
  ------------------
 2136|      0|                    {
 2137|      0|                        return RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 2138|      0|                    }
 2139|  19.9k|                    *nNumH += delta;
 2140|       |#else
 2141|       |                    *nNumH += (int)inchi_strtol(p, &q, 10);
 2142|       |#endif
 2143|  19.9k|                    p = q;
 2144|  19.9k|                }
 2145|  13.8k|                else
 2146|  13.8k|                {
 2147|  13.8k|                    *nNumH += 1;
 2148|  13.8k|                }
 2149|  33.7k|            }
 2150|  33.7k|        }
 2151|   109k|    }
 2152|       |
 2153|   109k|    return 0;
 2154|   109k|}
ichiread.c:GetInChIIsoH:
 2201|   107k|{
 2202|   107k|    int i;
 2203|   431k|    for (i = 0; i < NUM_H_ISOTOPES; i++)
  ------------------
  |  |  100|   431k|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (2203:17): [True: 323k, False: 107k]
  ------------------
 2204|   323k|    {
 2205|   323k|        nNumIsotopicH[i] = 0;
 2206|   323k|    }
 2207|   110k|    for (i = 0; i < pInChI->nNumberOfIsotopicAtoms; i++)
  ------------------
  |  Branch (2207:17): [True: 3.01k, False: 107k]
  ------------------
 2208|  3.01k|    {
 2209|  3.01k|        if (pInChI->IsotopicAtom[i].nIsoDifference > 0 &&
  ------------------
  |  Branch (2209:13): [True: 356, False: 2.65k]
  ------------------
 2210|  3.01k|             pInChI->IsotopicAtom[i].nIsoDifference <= NUM_H_ISOTOPES)
  ------------------
  |  |  100|    356|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (2210:14): [True: 256, False: 100]
  ------------------
 2211|    256|        {
 2212|    256|            if (!pInChI->nAtom ||
  ------------------
  |  Branch (2212:17): [True: 0, False: 256]
  ------------------
 2213|    256|                 !pInChI->IsotopicAtom[i].nAtomNumber ||
  ------------------
  |  Branch (2213:18): [True: 0, False: 256]
  ------------------
 2214|    256|                 pInChI->IsotopicAtom[i].nAtomNumber > pInChI->nNumberOfAtoms)
  ------------------
  |  Branch (2214:18): [True: 0, False: 256]
  ------------------
 2215|      0|            {
 2216|      0|                return RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 2217|      0|            }
 2218|    256|            if (pInChI->nAtom[pInChI->IsotopicAtom[i].nAtomNumber - 1] == (AT_NUMB) EL_NUMBER_H)
  ------------------
  |  |   41|    256|#define EL_NUMBER_H ((U_CHAR) 1)
  ------------------
  |  Branch (2218:17): [True: 0, False: 256]
  ------------------
 2219|      0|            {
 2220|       |                /* isotopic H in connection table */
 2221|      0|                nNumIsotopicH[pInChI->IsotopicAtom[i].nIsoDifference - 1] ++;
 2222|      0|            }
 2223|    256|        }
 2224|  3.01k|        nNumIsotopicH[0] += pInChI->IsotopicAtom[i].nNum_H;
 2225|  3.01k|        nNumIsotopicH[1] += pInChI->IsotopicAtom[i].nNum_D;
 2226|  3.01k|        nNumIsotopicH[2] += pInChI->IsotopicAtom[i].nNum_T;
 2227|  3.01k|    }
 2228|       |
 2229|   107k|    return 0;
 2230|   107k|}
ichiread.c:ReadInChILine:
 4909|    454|{
 4910|    454|    int   c, fst, ret = RI_ERR_ALLOC, len;
  ------------------
  |  |   43|    454|#define RI_ERR_ALLOC   (-1)
  ------------------
 4911|    454|    int   bMobileH = TAUT_YES, bReconn = INCHI_BAS;
  ------------------
  |  |  580|    454|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  int   bMobileH = TAUT_YES, bReconn = INCHI_BAS;
  ------------------
  |  |  575|    454|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 4912|    454|    const char szToken[] = INCHI_TOKEN;
  ------------------
  |  |  298|    454|#define INCHI_TOKEN "/\n\r\t\\"
  ------------------
 4913|    454|    char *p;
 4914|    454|    int  state = -1, prev_state = -1;
 4915|    454|    int  bAbc = -1;                    /* -1=> undefined, 0=> decimal, 1=> abc (compressed) */
 4916|       |
 4917|    454|    const int len_std_prefix = 8;
 4918|    454|    size_t k = 0;
 4919|    454|    unsigned char let1 = 0, let2 = 0;
 4920|    454|    const char a2p[] = "ABCDEFGHIJKLMNOP";
 4921|       |
 4922|    454|    int na_total = 0;                /* whole struct, without explH */
 4923|    454|    int nb_total = 0;                /* whole struct, without explH */
 4924|    454|#if ( DISABLE_READ_COMPRESSED_INCHI==1 )
 4925|    454|    bAbc = 0;
 4926|       |    /* We do not support compressed InChI explicitly */
 4927|       |    /* Parsing compressed InChI easily fails on fake/fuzzing inputs */
 4928|    454|#endif
 4929|       |    /* memset( pLine, 0, sizeof( pLine[0] ) ); */
 4930|    454|    *pState = 0;
 4931|       |
 4932|    454|next_line:
 4933|    454|    INCHI_HEAPCHK
 4934|       |    /* Got "InChI=1/" */
 4935|    454|    if (pLine->len)
  ------------------
  |  Branch (4935:9): [True: 0, False: 454]
  ------------------
 4936|      0|    {
 4937|      0|        c = pLine->c;
 4938|      0|    }
 4939|    454|    else
 4940|    454|    {
 4941|    454|        INCHI_HEAPCHK
 4942|    454|            c = nGetInChISegment( pInp, pLine, szToken );
 4943|    454|        INCHI_HEAPCHK
 4944|    454|    }
 4945|    454|    if (c == RI_ERR_EOF && !pLine->len && !pLine->str[0])
  ------------------
  |  |   47|    908|#define RI_ERR_EOF     (0)
  ------------------
  |  Branch (4945:9): [True: 0, False: 454]
  |  Branch (4945:28): [True: 0, False: 0]
  |  Branch (4945:43): [True: 0, False: 0]
  ------------------
 4946|      0|    {
 4947|      0|        ret = c;
 4948|      0|        goto exit_function;
 4949|      0|    }
 4950|    454|    INCHI_HEAPCHK
 4951|       |
 4952|    454|        if (pLine->len == 0 || c != SEG_END && c != RI_ERR_EOF || !( p = strstr( pLine->str, "InChI=1" ) ))
  ------------------
  |  |  294|    908|#define SEG_END '/'
  ------------------
                      if (pLine->len == 0 || c != SEG_END && c != RI_ERR_EOF || !( p = strstr( pLine->str, "InChI=1" ) ))
  ------------------
  |  |   47|    454|#define RI_ERR_EOF     (0)
  ------------------
  |  Branch (4952:13): [True: 0, False: 454]
  |  Branch (4952:32): [True: 0, False: 454]
  |  Branch (4952:48): [True: 0, False: 0]
  |  Branch (4952:67): [True: 0, False: 454]
  ------------------
 4953|      0|        {
 4954|      0|            if (pLine->str && pLine->str == strstr( pLine->str, "Structure" ))
  ------------------
  |  Branch (4954:17): [True: 0, False: 0]
  |  Branch (4954:31): [True: 0, False: 0]
  ------------------
 4955|      0|            {
 4956|      0|                if (*pStr)
  ------------------
  |  Branch (4956:21): [True: 0, False: 0]
  ------------------
 4957|      0|                {
 4958|      0|                    INCHI_HEAPCHK
 4959|      0|                        inchi_free( *pStr );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4960|      0|                }
 4961|      0|                *pStr = pLine->str;
 4962|       |                /* bypass to the end of the 'Structure nnn' line */
 4963|      0|                memset( pLine, 0, sizeof( pLine[0] ) );
 4964|      0|                while (c && !INCHI_INP_EOL( c ))
  ------------------
  |  |  296|      0|#define INCHI_INP_EOL(X) ((X)=='\n' || (X)=='\r' || (X)=='\t')
  |  |  ------------------
  |  |  |  Branch (296:27): [True: 0, False: 0]
  |  |  |  Branch (296:40): [True: 0, False: 0]
  |  |  |  Branch (296:53): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (4964:24): [True: 0, False: 0]
  ------------------
 4965|      0|                {
 4966|      0|                    c = getInChIChar( pInp );
 4967|      0|                }
 4968|      0|                goto next_line;
 4969|      0|            }
 4970|       |            /* bypass to the end of unrecognized line */
 4971|      0|            while (c != RI_ERR_EOF && !INCHI_INP_EOL( c ))
  ------------------
  |  |   47|      0|#define RI_ERR_EOF     (0)
  ------------------
                          while (c != RI_ERR_EOF && !INCHI_INP_EOL( c ))
  ------------------
  |  |  296|      0|#define INCHI_INP_EOL(X) ((X)=='\n' || (X)=='\r' || (X)=='\t')
  |  |  ------------------
  |  |  |  Branch (296:27): [True: 0, False: 0]
  |  |  |  Branch (296:40): [True: 0, False: 0]
  |  |  |  Branch (296:53): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (4971:20): [True: 0, False: 0]
  ------------------
 4972|      0|            {
 4973|      0|                c = getInChIChar( pInp );
 4974|      0|            }
 4975|      0|            pLine->len = 0;
 4976|      0|            INCHI_HEAPCHK
 4977|      0|            goto next_line;
 4978|      0|        }
 4979|       |
 4980|       |
 4981|       |    /* Check if got a standard InChI */
 4982|    454|    if (( pLine->len == len_std_prefix ) && ( pLine->str[len_std_prefix - 1] == 'S' ))
  ------------------
  |  Branch (4982:9): [True: 0, False: 454]
  |  Branch (4982:45): [True: 0, False: 0]
  ------------------
 4983|      0|    {
 4984|      0|        *bStdFormat = 1;
 4985|      0|    }
 4986|    454|    else
 4987|    454|    {
 4988|    454|        *bStdFormat = 0;
 4989|    454|    }
 4990|       |
 4991|    454|    state = IST_MOBILE_H_FORMULA;
 4992|    454|    ret = 1; /* means read the next segment */
 4993|    454|    do
 4994|  4.29k|    {
 4995|       |        /* read the next segment up to the '/' */
 4996|  4.29k|        INCHI_HEAPCHK
 4997|  4.29k|            if (ret < 0)
  ------------------
  |  Branch (4997:17): [True: 251, False: 4.03k]
  ------------------
 4998|    251|            {
 4999|    251|                *pState = prev_state;
 5000|    251|                break;
 5001|    251|            }
 5002|  4.03k|        prev_state = state + ( bReconn ? IST_HAPPENED_IN_RECMET : 0 );
  ------------------
  |  |  363|     40|#define IST_HAPPENED_IN_RECMET   100
  ------------------
  |  Branch (5002:32): [True: 40, False: 3.99k]
  ------------------
 5003|  4.03k|        if (0 < ret)
  ------------------
  |  Branch (5003:13): [True: 1.28k, False: 2.75k]
  ------------------
 5004|  1.28k|        {
 5005|       |            /* read next segment */
 5006|  1.28k|            if (c != RI_ERR_EOF && c != SEG_END)
  ------------------
  |  |   47|  2.57k|#define RI_ERR_EOF     (0)
  ------------------
                          if (c != RI_ERR_EOF && c != SEG_END)
  ------------------
  |  |  294|  1.16k|#define SEG_END '/'
  ------------------
  |  Branch (5006:17): [True: 1.16k, False: 126]
  |  Branch (5006:36): [True: 50, False: 1.11k]
  ------------------
 5007|     50|            {
 5008|       |                /* abnormal reading result; should not happen */
 5009|       |                /* unless we got backslash-SaveOpt */
 5010|     50|                if (c == '\\')
  ------------------
  |  Branch (5010:21): [True: 10, False: 40]
  ------------------
 5011|     10|                {
 5012|       |                    /* May be SaveOpt */
 5013|     10|                    *input_has_save_opt = 1;
 5014|     10|                }
 5015|     50|                k = 0;
 5016|  12.1k|                while (c != RI_ERR_EOF && !INCHI_INP_EOL( c ))
  ------------------
  |  |   47|  24.3k|#define RI_ERR_EOF     (0)
  ------------------
                              while (c != RI_ERR_EOF && !INCHI_INP_EOL( c ))
  ------------------
  |  |  296|  12.1k|#define INCHI_INP_EOL(X) ((X)=='\n' || (X)=='\r' || (X)=='\t')
  |  |  ------------------
  |  |  |  Branch (296:27): [True: 42, False: 12.1k]
  |  |  |  Branch (296:40): [True: 0, False: 12.1k]
  |  |  |  Branch (296:53): [True: 4, False: 12.1k]
  |  |  ------------------
  ------------------
  |  Branch (5016:24): [True: 12.1k, False: 4]
  ------------------
 5017|  12.1k|                {
 5018|       |                    /* bypass to the end of line or file */
 5019|  12.1k|                    c = getInChIChar( pInp );
 5020|  12.1k|                    k++;
 5021|  12.1k|                    if (k == 1)
  ------------------
  |  Branch (5021:25): [True: 10, False: 12.1k]
  ------------------
 5022|     10|                    {
 5023|     10|                        let1 = c;
 5024|     10|                    }
 5025|  12.1k|                    else
 5026|  12.1k|                    {
 5027|  12.1k|                        if (k == 2)
  ------------------
  |  Branch (5027:29): [True: 10, False: 12.0k]
  ------------------
 5028|     10|                        {
 5029|     10|                            let2 = c;
 5030|     10|                        }
 5031|  12.1k|                    }
 5032|  12.1k|                }
 5033|     50|                if (k != 3)
  ------------------
  |  Branch (5033:21): [True: 50, False: 0]
  ------------------
 5034|     50|                {
 5035|       |                    /* not a valid SaveOpt which must be of two chars */
 5036|     50|                    *input_has_save_opt = 0;
 5037|     50|                    let1 = let2 = '\0';
 5038|     50|                }
 5039|      0|                else
 5040|      0|                {
 5041|       |                    /* may be SaveOpt - analyze the content */
 5042|      0|                    if (( let2 >= 'A' ) && ( let2 <= 'D' ))        /* letter-2 OK */
  ------------------
  |  Branch (5042:25): [True: 0, False: 0]
  |  Branch (5042:44): [True: 0, False: 0]
  ------------------
 5043|      0|                    {
 5044|      0|                        *input_has_save_opt = 0;
 5045|      0|                        *input_save_opt_bits = 0;
 5046|      0|                        for (k = 0; k < 16; k++)
  ------------------
  |  Branch (5046:37): [True: 0, False: 0]
  ------------------
 5047|      0|                        {
 5048|      0|                            if (a2p[k] == let1)                    /* letter-1 OK */
  ------------------
  |  Branch (5048:33): [True: 0, False: 0]
  ------------------
 5049|      0|                            {
 5050|      0|                                *input_save_opt_bits = (unsigned char) k;
 5051|      0|                                *input_has_save_opt = 1;
 5052|      0|                                break;
 5053|      0|                            }
 5054|      0|                        }
 5055|      0|                        if (*input_has_save_opt)
  ------------------
  |  Branch (5055:29): [True: 0, False: 0]
  ------------------
 5056|      0|                        {
 5057|      0|                            if (let2 == 'B' || let2 == 'D')
  ------------------
  |  Branch (5057:33): [True: 0, False: 0]
  |  Branch (5057:48): [True: 0, False: 0]
  ------------------
 5058|      0|                            {
 5059|      0|                                *input_save_opt_bits |= SAVE_OPT_15T;
  ------------------
  |  |  188|      0|#define SAVE_OPT_15T    0x0020
  ------------------
 5060|      0|                            }
 5061|      0|                            if (let2 == 'C' || let2 == 'D')
  ------------------
  |  Branch (5061:33): [True: 0, False: 0]
  |  Branch (5061:48): [True: 0, False: 0]
  ------------------
 5062|      0|                            {
 5063|      0|                                *input_save_opt_bits |= SAVE_OPT_KET;
  ------------------
  |  |  187|      0|#define SAVE_OPT_KET    0x0010
  ------------------
 5064|      0|                            }
 5065|      0|                        }
 5066|      0|                    }
 5067|      0|                }
 5068|       |
 5069|     50|                ret = ( c == RI_ERR_EOF ) ? RI_ERR_EOF : RI_ERR_EOL; /* end of line */
  ------------------
  |  |   47|     50|#define RI_ERR_EOF     (0)
  ------------------
                              ret = ( c == RI_ERR_EOF ) ? RI_ERR_EOF : RI_ERR_EOL; /* end of line */
  ------------------
  |  |   47|      4|#define RI_ERR_EOF     (0)
  ------------------
                              ret = ( c == RI_ERR_EOF ) ? RI_ERR_EOF : RI_ERR_EOL; /* end of line */
  ------------------
  |  |   46|     96|#define RI_ERR_EOL     (-4)
  ------------------
  |  Branch (5069:23): [True: 4, False: 46]
  ------------------
 5070|     50|                pLine->len = 0;
 5071|     50|                pLine->c = ret;
 5072|     50|                break; /* exit */
 5073|     50|            }
 5074|  1.23k|            if (c == RI_ERR_EOF)
  ------------------
  |  |   47|  1.23k|#define RI_ERR_EOF     (0)
  ------------------
  |  Branch (5074:17): [True: 126, False: 1.11k]
  ------------------
 5075|    126|            {
 5076|    126|                ret = RI_ERR_EOF; /* end of line */
  ------------------
  |  |   47|    126|#define RI_ERR_EOF     (0)
  ------------------
 5077|    126|                break;
 5078|    126|            }
 5079|  1.11k|            if (c == SEG_END)
  ------------------
  |  |  294|  1.11k|#define SEG_END '/'
  ------------------
  |  Branch (5079:17): [True: 1.11k, False: 0]
  ------------------
 5080|  1.11k|            {
 5081|  1.11k|                c = nGetInChISegment( pInp, pLine, szToken );
 5082|  1.11k|            }
 5083|  1.11k|            if (c < 0)
  ------------------
  |  Branch (5083:17): [True: 0, False: 1.11k]
  ------------------
 5084|      0|            {
 5085|      0|                goto exit_error; /* error */
 5086|      0|            }
 5087|  1.11k|            if (!pLine->len)
  ------------------
  |  Branch (5087:17): [True: 27, False: 1.08k]
  ------------------
 5088|     27|            {
 5089|     27|                ret = RI_ERR_EOL; /* end of line */
  ------------------
  |  |   46|     27|#define RI_ERR_EOL     (-4)
  ------------------
 5090|     27|                break;
 5091|     27|            }
 5092|  1.08k|            fst = UCINT pLine->str[0];
  ------------------
  |  |  116|  1.08k|#define UCINT  (int)(unsigned char)
  ------------------
 5093|       |
 5094|       |            /*
 5095|       |            if ( fst == 'z' )
 5096|       |            {
 5097|       |            ret = RI_ERR_EOL;
 5098|       |            break;
 5099|       |            }*/
 5100|  1.08k|        }
 5101|       |        /* process the seqment */
 5102|  3.83k|        switch (state)
  ------------------
  |  Branch (5102:17): [True: 0, False: 3.83k]
  ------------------
 5103|  3.83k|        {
 5104|       |            /* Mobile H, M */                /* /  */
 5105|    453|            case IST_MOBILE_H_FORMULA:
  ------------------
  |  Branch (5105:13): [True: 453, False: 3.38k]
  ------------------
 5106|    453|                bMobileH = TAUT_YES;
  ------------------
  |  |  580|    453|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5107|    453|#if ( FIX_GAF_2019_2==1 )
 5108|       |                /* hack: pass state in na_total (will be updated in ParseSegmentFormula anyway) */
 5109|    453|                na_total = state;
 5110|    453|#endif
 5111|    453|                ret = ParseSegmentFormula( pLine->str, bMobileH, pInpInChI[bReconn],
 5112|    453|                                           nNumComponents[bReconn], &na_total );
 5113|    453|                state = IST_MOBILE_H_CONNECTIONS;
 5114|    453|                break;
 5115|    396|            case IST_MOBILE_H_CONNECTIONS:   /* /c */
  ------------------
  |  Branch (5115:13): [True: 396, False: 3.44k]
  ------------------
 5116|    396|                ret = ParseSegmentConnections( pLine->str, bMobileH, &pInpInChI[bReconn][bMobileH],
 5117|    396|                                               &nNumComponents[bReconn][bMobileH], &bAbc, &nb_total );
 5118|    396|                state = IST_MOBILE_H;
 5119|    396|                break;
 5120|    366|            case IST_MOBILE_H:               /* /h */
  ------------------
  |  Branch (5120:13): [True: 366, False: 3.47k]
  ------------------
 5121|    366|                ret = ParseSegmentMobileH( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], &bAbc );
 5122|    366|                state = IST_MOBILE_H_CHARGE;
 5123|    366|                break;
 5124|    284|            case IST_MOBILE_H_CHARGE:        /* /q */
  ------------------
  |  Branch (5124:13): [True: 284, False: 3.55k]
  ------------------
 5125|    284|                ret = ParseSegmentCharge( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn] );
 5126|    284|                state = IST_MOBILE_H_PROTONS;
 5127|    284|                break;
 5128|    278|            case IST_MOBILE_H_PROTONS:       /* /p */
  ------------------
  |  Branch (5128:13): [True: 278, False: 3.55k]
  ------------------
 5129|    278|                ret = ParseSegmentProtons( pLine->str, bMobileH, nNumProtons[bReconn], nNumComponents[bReconn] );
 5130|    278|                state = IST_MOBILE_H_POLYMER;
 5131|    278|                break;
 5132|    278|            case IST_MOBILE_H_POLYMER:       /* /z */
  ------------------
  |  Branch (5132:13): [True: 278, False: 3.55k]
  ------------------
 5133|    278|                ret = ParseSegmentPolymer( pLine->str, bMobileH,
 5134|    278|                                           nNumProtons[bReconn], nNumComponents[bReconn],
 5135|    278|                                           na_total, nb_total, bInchi2Struct, ppPolymer, ppV3000 );
 5136|    278|                if (*ppPolymer)
  ------------------
  |  Branch (5136:21): [True: 126, False: 152]
  ------------------
 5137|    126|                    ( *ppPolymer )->is_in_reconn = bReconn;
 5138|    278|                state = IST_MOBILE_H_SP2;
 5139|    278|                break;
 5140|    153|            case IST_MOBILE_H_SP2:           /* /b */
  ------------------
  |  Branch (5140:13): [True: 153, False: 3.68k]
  ------------------
 5141|    153|                ret = ParseSegmentSp2( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state, &bAbc );
 5142|    153|                state = IST_MOBILE_H_SP3;
 5143|    153|                break;
 5144|    151|            case IST_MOBILE_H_SP3:         /* t */
  ------------------
  |  Branch (5144:13): [True: 151, False: 3.68k]
  ------------------
 5145|    151|                ret = ParseSegmentSp3( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state, &bAbc );
 5146|    151|                state = IST_MOBILE_H_SP3_M;
 5147|    151|                break;
 5148|    151|            case IST_MOBILE_H_SP3_M:       /* /m */
  ------------------
  |  Branch (5148:13): [True: 151, False: 3.68k]
  ------------------
 5149|    151|                ret = ParseSegmentSp3m( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state );
 5150|    151|                state = IST_MOBILE_H_SP3_S;
 5151|    151|                break;
 5152|    151|            case IST_MOBILE_H_SP3_S:       /* /s */
  ------------------
  |  Branch (5152:13): [True: 151, False: 3.68k]
  ------------------
 5153|    151|                ret = ParseSegmentSp3s( pLine->str, bMobileH, pInpInChI[bReconn], s[bReconn], nNumComponents[bReconn], state );
 5154|    151|                state = IST_MOBILE_H_ISO_LAYER_FORK;
 5155|    151|                break;
 5156|    151|            case IST_MOBILE_H_ISO_LAYER_FORK:
  ------------------
  |  Branch (5156:13): [True: 151, False: 3.68k]
  ------------------
 5157|       |                /* find layer type after M */
 5158|    151|                ret = 0;
 5159|    151|                switch (pLine->str[0])
 5160|    151|                {
 5161|     67|                    case 'i':
  ------------------
  |  Branch (5161:21): [True: 67, False: 84]
  ------------------
 5162|     67|                        state = IST_MOBILE_H_ISO_ATOMS;  /* MI */
 5163|     67|                        break;
 5164|     76|                    case 'f':
  ------------------
  |  Branch (5164:21): [True: 76, False: 75]
  ------------------
 5165|     76|                        state = IST_FIXED_H_FORMULA; /* F */
 5166|     76|                        break;
 5167|      8|                    case 'r':
  ------------------
  |  Branch (5167:21): [True: 8, False: 143]
  ------------------
 5168|      8|                        state = IST_RECONNECTED_FORMULA; /* reconnected */
 5169|      8|                        break;
 5170|      0|                    default:
  ------------------
  |  Branch (5170:21): [True: 0, False: 151]
  ------------------
 5171|      0|                        ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5172|    151|                }
 5173|    151|                if (INCHI_INP_EOL( c ) && ret == 0 && !pLine->str[1])
  ------------------
  |  |  296|    302|#define INCHI_INP_EOL(X) ((X)=='\n' || (X)=='\r' || (X)=='\t')
  |  |  ------------------
  |  |  |  Branch (296:27): [True: 0, False: 151]
  |  |  |  Branch (296:40): [True: 0, False: 151]
  |  |  |  Branch (296:53): [True: 0, False: 151]
  |  |  ------------------
  ------------------
  |  Branch (5173:43): [True: 0, False: 0]
  |  Branch (5173:55): [True: 0, False: 0]
  ------------------
 5174|      0|                {
 5175|      0|                    prev_state = state + ( bReconn ? IST_HAPPENED_IN_RECMET : 0 );
  ------------------
  |  |  363|      0|#define IST_HAPPENED_IN_RECMET   100
  ------------------
  |  Branch (5175:44): [True: 0, False: 0]
  ------------------
 5176|      0|                    ret = RI_ERR_SYNTAX; /* empty layer /i or /f or /r at the end of InChI line */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5177|      0|                }
 5178|    151|                else
 5179|    151|                {
 5180|    151|                    if (!ret && state != IST_MOBILE_H_ISO_ATOMS)
  ------------------
  |  Branch (5180:25): [True: 151, False: 0]
  |  Branch (5180:33): [True: 84, False: 67]
  ------------------
 5181|     84|                    {
 5182|     84|                        len = (int) strlen( pLine->str );
 5183|     84|                        if (len > 1)
  ------------------
  |  Branch (5183:29): [True: 30, False: 54]
  ------------------
 5184|     30|                        {
 5185|     30|                            memmove( pLine->str, pLine->str + 1, len );
 5186|     30|                        }
 5187|     54|                        else
 5188|     54|                        {
 5189|     54|                            ret = 1; /* read the next segment */
 5190|     54|                        }
 5191|     84|                    }
 5192|    151|                }
 5193|    151|                break;
 5194|       |                /* Mobile H, isotopic, MI */
 5195|     67|            case IST_MOBILE_H_ISO_ATOMS:   /* i */
  ------------------
  |  Branch (5195:13): [True: 67, False: 3.76k]
  ------------------
 5196|     67|                ret = ParseSegmentIsoAtoms( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state, &bAbc );
 5197|     67|                state = IST_MOBILE_H_ISO_EXCH_H;
 5198|     67|                break;
 5199|     17|            case IST_MOBILE_H_ISO_EXCH_H:  /* /i/h */
  ------------------
  |  Branch (5199:13): [True: 17, False: 3.81k]
  ------------------
 5200|     17|                ret = ParseSegmentIsoExchgH( pLine->str, bMobileH, nNumProtons[bReconn], nNumComponents[bReconn], state, &bAbc );
 5201|     17|                state = IST_MOBILE_H_ISO_SP2;
 5202|     17|                break;
 5203|     17|            case IST_MOBILE_H_ISO_SP2:         /* /i/b */
  ------------------
  |  Branch (5203:13): [True: 17, False: 3.81k]
  ------------------
 5204|     17|                ret = ParseSegmentSp2( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state, &bAbc );
 5205|     17|                state = IST_MOBILE_H_ISO_SP3;
 5206|     17|                break;
 5207|     17|            case IST_MOBILE_H_ISO_SP3:         /* /i/t */
  ------------------
  |  Branch (5207:13): [True: 17, False: 3.81k]
  ------------------
 5208|     17|                ret = ParseSegmentSp3( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state, &bAbc );
 5209|     17|                state = IST_MOBILE_H_ISO_SP3_M;
 5210|     17|                break;
 5211|     15|            case IST_MOBILE_H_ISO_SP3_M:       /* /i/m */
  ------------------
  |  Branch (5211:13): [True: 15, False: 3.82k]
  ------------------
 5212|     15|                ret = ParseSegmentSp3m( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state );
 5213|     15|                state = IST_MOBILE_H_ISO_SP3_S;
 5214|     15|                break;
 5215|     15|            case IST_MOBILE_H_ISO_SP3_S:       /* /i/s */
  ------------------
  |  Branch (5215:13): [True: 15, False: 3.82k]
  ------------------
 5216|     15|                ret = ParseSegmentSp3s( pLine->str, bMobileH, pInpInChI[bReconn], s[bReconn], nNumComponents[bReconn], state );
 5217|     15|                state = IST_FIXED_H_LAYER_FORK;
 5218|     15|                break;
 5219|     13|            case IST_FIXED_H_LAYER_FORK:
  ------------------
  |  Branch (5219:13): [True: 13, False: 3.82k]
  ------------------
 5220|       |                /* find layer type after MI */
 5221|     13|                ret = 0;
 5222|     13|                switch (pLine->str[0])
 5223|     13|                {
 5224|     11|                    case 'f':
  ------------------
  |  Branch (5224:21): [True: 11, False: 2]
  ------------------
 5225|     11|                        state = IST_FIXED_H_FORMULA; /* F */
 5226|     11|                        break;
 5227|      0|                    case 'r':
  ------------------
  |  Branch (5227:21): [True: 0, False: 13]
  ------------------
 5228|      0|                        state = IST_RECONNECTED_FORMULA; /* reconnected */
 5229|      0|                        break;
 5230|      2|                    default:
  ------------------
  |  Branch (5230:21): [True: 2, False: 11]
  ------------------
 5231|      2|                        ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      2|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5232|     13|                }
 5233|     13|                if (INCHI_INP_EOL( c ) && ret == 0 && !pLine->str[1])
  ------------------
  |  |  296|     26|#define INCHI_INP_EOL(X) ((X)=='\n' || (X)=='\r' || (X)=='\t')
  |  |  ------------------
  |  |  |  Branch (296:27): [True: 0, False: 13]
  |  |  |  Branch (296:40): [True: 0, False: 13]
  |  |  |  Branch (296:53): [True: 2, False: 11]
  |  |  ------------------
  ------------------
  |  Branch (5233:43): [True: 2, False: 0]
  |  Branch (5233:55): [True: 0, False: 2]
  ------------------
 5234|      0|                {
 5235|      0|                    prev_state = state + ( bReconn ? IST_HAPPENED_IN_RECMET : 0 );
  ------------------
  |  |  363|      0|#define IST_HAPPENED_IN_RECMET   100
  ------------------
  |  Branch (5235:44): [True: 0, False: 0]
  ------------------
 5236|      0|                    ret = RI_ERR_SYNTAX; /* empty layer /f or /r at the end of InChI line */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5237|      0|                }
 5238|     13|                else
 5239|     13|                {
 5240|     13|                    if (!ret)
  ------------------
  |  Branch (5240:25): [True: 11, False: 2]
  ------------------
 5241|     11|                    {
 5242|     11|                        len = (int) strlen( pLine->str );
 5243|     11|                        if (len > 1)
  ------------------
  |  Branch (5243:29): [True: 5, False: 6]
  ------------------
 5244|      5|                        {
 5245|      5|                            memmove( pLine->str, pLine->str + 1, len );
 5246|      5|                        }
 5247|      6|                        else
 5248|      6|                        {
 5249|      6|                            ret = 1; /* read the next segment */
 5250|      6|                        }
 5251|     11|                    }
 5252|     13|                }
 5253|     13|                break;
 5254|       |
 5255|       |            /* Fixed H, F */
 5256|     85|            case IST_FIXED_H_FORMULA:
  ------------------
  |  Branch (5256:13): [True: 85, False: 3.75k]
  ------------------
 5257|     85|                bMobileH = TAUT_NON;
  ------------------
  |  |  579|     85|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 5258|     85|#if ( FIX_GAF_2019_2==1 )
 5259|       |                /* hack: pass state in na_total (will be updated in ParseSegmentFormula anyway) */
 5260|     85|                na_total = state;
 5261|     85|#endif
 5262|     85|                ret = ParseSegmentFormula( pLine->str, bMobileH, pInpInChI[bReconn],
 5263|     85|                                           nNumComponents[bReconn], &na_total );
 5264|     85|                state = IST_FIXED_H;
 5265|     85|                break;
 5266|     80|            case IST_FIXED_H:               /* /f/h */
  ------------------
  |  Branch (5266:13): [True: 80, False: 3.75k]
  ------------------
 5267|     80|                ret = ParseSegmentMobileH( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], &bAbc );
 5268|     80|                state = IST_FIXED_H_CHARGE;
 5269|     80|                break;
 5270|     72|            case IST_FIXED_H_CHARGE:        /* /f/q */
  ------------------
  |  Branch (5270:13): [True: 72, False: 3.76k]
  ------------------
 5271|     72|                ret = ParseSegmentCharge( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn] );
 5272|     72|                state = IST_FIXED_H_SP2;
 5273|     72|                break;
 5274|     54|            case IST_FIXED_H_SP2:           /* /f/b */
  ------------------
  |  Branch (5274:13): [True: 54, False: 3.78k]
  ------------------
 5275|     54|                ret = ParseSegmentSp2( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state, &bAbc );
 5276|     54|                state = IST_FIXED_H_SP3;
 5277|     54|                break;
 5278|     54|            case IST_FIXED_H_SP3:         /* /f/t */
  ------------------
  |  Branch (5278:13): [True: 54, False: 3.78k]
  ------------------
 5279|     54|                ret = ParseSegmentSp3( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state, &bAbc );
 5280|     54|                state = IST_FIXED_H_SP3_M;
 5281|     54|                break;
 5282|     54|            case IST_FIXED_H_SP3_M:       /* /f/m */
  ------------------
  |  Branch (5282:13): [True: 54, False: 3.78k]
  ------------------
 5283|     54|                ret = ParseSegmentSp3m( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state );
 5284|     54|                state = IST_FIXED_H_SP3_S;
 5285|     54|                break;
 5286|     54|            case IST_FIXED_H_SP3_S:       /* /f/s */
  ------------------
  |  Branch (5286:13): [True: 54, False: 3.78k]
  ------------------
 5287|     54|                ret = ParseSegmentSp3s( pLine->str, bMobileH, pInpInChI[bReconn], s[bReconn], nNumComponents[bReconn], state );
 5288|     54|                state = IST_FIXED_H_PERMUTATION;
 5289|     54|                break;
 5290|     54|            case IST_FIXED_H_PERMUTATION:  /* /f/o */
  ------------------
  |  Branch (5290:13): [True: 54, False: 3.78k]
  ------------------
 5291|     54|                ret = ParseSegmentPerm( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state, &bAbc );
 5292|     54|                state = IST_FIXED_H_ISO_LAYER_FORK;
 5293|     54|                break;
 5294|     54|            case IST_FIXED_H_ISO_LAYER_FORK:
  ------------------
  |  Branch (5294:13): [True: 54, False: 3.78k]
  ------------------
 5295|       |                /* find layer type after M */
 5296|     54|                ret = 0;
 5297|     54|                switch (pLine->str[0])
 5298|     54|                {
 5299|     54|                    case 'i':
  ------------------
  |  Branch (5299:21): [True: 54, False: 0]
  ------------------
 5300|     54|                        state = IST_FIXED_H_ISO_ATOMS;  /* FI */
 5301|     54|                        break;
 5302|      0|                    case 'r':
  ------------------
  |  Branch (5302:21): [True: 0, False: 54]
  ------------------
 5303|      0|                        state = IST_RECONNECTED_FORMULA; /* reconnected */
 5304|      0|                        break;
 5305|      0|                    default:
  ------------------
  |  Branch (5305:21): [True: 0, False: 54]
  ------------------
 5306|      0|                        ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5307|     54|                }
 5308|     54|                if (INCHI_INP_EOL( c ) && ret == 0 && !pLine->str[1])
  ------------------
  |  |  296|    108|#define INCHI_INP_EOL(X) ((X)=='\n' || (X)=='\r' || (X)=='\t')
  |  |  ------------------
  |  |  |  Branch (296:27): [True: 0, False: 54]
  |  |  |  Branch (296:40): [True: 0, False: 54]
  |  |  |  Branch (296:53): [True: 0, False: 54]
  |  |  ------------------
  ------------------
  |  Branch (5308:43): [True: 0, False: 0]
  |  Branch (5308:55): [True: 0, False: 0]
  ------------------
 5309|      0|                {
 5310|      0|                    prev_state = state + ( bReconn ? IST_HAPPENED_IN_RECMET : 0 );
  ------------------
  |  |  363|      0|#define IST_HAPPENED_IN_RECMET   100
  ------------------
  |  Branch (5310:44): [True: 0, False: 0]
  ------------------
 5311|      0|                    ret = RI_ERR_SYNTAX; /* empty layer /i or /r at the end of InChI line */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5312|      0|                }
 5313|     54|                else
 5314|     54|                {
 5315|     54|                    if (!ret && state != IST_FIXED_H_ISO_ATOMS)
  ------------------
  |  Branch (5315:25): [True: 54, False: 0]
  |  Branch (5315:33): [True: 0, False: 54]
  ------------------
 5316|      0|                    {
 5317|      0|                        len = (int) strlen( pLine->str );
 5318|      0|                        if (len > 1)
  ------------------
  |  Branch (5318:29): [True: 0, False: 0]
  ------------------
 5319|      0|                        {
 5320|      0|                            memmove( pLine->str, pLine->str + 1, len );
 5321|      0|                        }
 5322|      0|                        else
 5323|      0|                        {
 5324|      0|                            ret = 1; /* read the next segment */
 5325|      0|                        }
 5326|      0|                    }
 5327|     54|                }
 5328|     54|                break;
 5329|       |
 5330|       |            /* Fixed H, isotopic, FI */
 5331|     54|            case IST_FIXED_H_ISO_ATOMS:   /* /f/i */
  ------------------
  |  Branch (5331:13): [True: 54, False: 3.78k]
  ------------------
 5332|     54|                ret = ParseSegmentIsoAtoms( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state, &bAbc );
 5333|     54|                state = IST_FIXED_H_ISO_SP2;
 5334|     54|                break;
 5335|     36|            case IST_FIXED_H_ISO_SP2:         /* /f/i/b */
  ------------------
  |  Branch (5335:13): [True: 36, False: 3.80k]
  ------------------
 5336|     36|                ret = ParseSegmentSp2( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state, &bAbc );
 5337|     36|                state = IST_FIXED_H_ISO_SP3;
 5338|     36|                break;
 5339|     36|            case IST_FIXED_H_ISO_SP3:         /* /f/i/t */
  ------------------
  |  Branch (5339:13): [True: 36, False: 3.80k]
  ------------------
 5340|     36|                ret = ParseSegmentSp3( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state, &bAbc );
 5341|     36|                state = IST_FIXED_H_ISO_SP3_M;
 5342|     36|                break;
 5343|     36|            case IST_FIXED_H_ISO_SP3_M:       /* /f/i/m */
  ------------------
  |  Branch (5343:13): [True: 36, False: 3.80k]
  ------------------
 5344|     36|                ret = ParseSegmentSp3m( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state );
 5345|     36|                state = IST_FIXED_H_ISO_SP3_S;
 5346|     36|                break;
 5347|     36|            case IST_FIXED_H_ISO_SP3_S:       /* /f/i/s */
  ------------------
  |  Branch (5347:13): [True: 36, False: 3.80k]
  ------------------
 5348|     36|                ret = ParseSegmentSp3s( pLine->str, bMobileH, pInpInChI[bReconn], s[bReconn], nNumComponents[bReconn], state );
 5349|     36|                state = IST_FIXED_H_ISO_PERMUTATION;
 5350|     36|                break;
 5351|     32|            case IST_FIXED_H_ISO_PERMUTATION:  /* /f/i/o */
  ------------------
  |  Branch (5351:13): [True: 32, False: 3.80k]
  ------------------
 5352|     32|                ret = ParseSegmentPerm( pLine->str, bMobileH, pInpInChI[bReconn], nNumComponents[bReconn], state, &bAbc );
 5353|     32|                state = IST_RECONNECTED_LAYER_FORK;
 5354|     32|                break;
 5355|     32|            case IST_RECONNECTED_LAYER_FORK:
  ------------------
  |  Branch (5355:13): [True: 32, False: 3.80k]
  ------------------
 5356|       |                /* find layer type after FI */
 5357|     32|                ret = 0;
 5358|     32|                switch (pLine->str[0])
 5359|     32|                {
 5360|     32|                    case 'r':
  ------------------
  |  Branch (5360:21): [True: 32, False: 0]
  ------------------
 5361|     32|                        state = IST_RECONNECTED_FORMULA; /* reconnected */
 5362|     32|                        break;
 5363|      0|                    default:
  ------------------
  |  Branch (5363:21): [True: 0, False: 32]
  ------------------
 5364|      0|                        ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5365|     32|                }
 5366|     32|                if (INCHI_INP_EOL( c ) && ret == 0 && !pLine->str[1])
  ------------------
  |  |  296|     64|#define INCHI_INP_EOL(X) ((X)=='\n' || (X)=='\r' || (X)=='\t')
  |  |  ------------------
  |  |  |  Branch (296:27): [True: 0, False: 32]
  |  |  |  Branch (296:40): [True: 0, False: 32]
  |  |  |  Branch (296:53): [True: 0, False: 32]
  |  |  ------------------
  ------------------
  |  Branch (5366:43): [True: 0, False: 0]
  |  Branch (5366:55): [True: 0, False: 0]
  ------------------
 5367|      0|                {
 5368|      0|                    prev_state = state + ( bReconn ? IST_HAPPENED_IN_RECMET : 0 );
  ------------------
  |  |  363|      0|#define IST_HAPPENED_IN_RECMET   100
  ------------------
  |  Branch (5368:44): [True: 0, False: 0]
  ------------------
 5369|      0|                    ret = RI_ERR_SYNTAX; /* empty layer /r at the end of InChI line */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5370|      0|                }
 5371|     32|                else
 5372|     32|                {
 5373|     32|                    if (!ret)
  ------------------
  |  Branch (5373:25): [True: 32, False: 0]
  ------------------
 5374|     32|                    {
 5375|     32|                        len = (int) strlen( pLine->str );
 5376|     32|                        if (len > 1)
  ------------------
  |  Branch (5376:29): [True: 0, False: 32]
  ------------------
 5377|      0|                        {
 5378|      0|                            memmove( pLine->str, pLine->str + 1, len );
 5379|      0|                        }
 5380|     32|                        else
 5381|     32|                        {
 5382|     32|                            ret = 1; /* read the next segment */
 5383|     32|                        }
 5384|     32|                    }
 5385|     32|                }
 5386|     32|                break;
 5387|     40|            case IST_RECONNECTED_FORMULA:
  ------------------
  |  Branch (5387:13): [True: 40, False: 3.79k]
  ------------------
 5388|     40|#if ( FIX_GAF_2019_1==1 )
 5389|     40|                if (bReconn == INCHI_REC)
  ------------------
  |  |  576|     40|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (5389:21): [True: 0, False: 40]
  ------------------
 5390|      0|                {
 5391|       |                    /* reconnected layer may appear only once */
 5392|      0|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5393|      0|                    break;
 5394|      0|                }
 5395|     40|#endif
 5396|     40|                bReconn = INCHI_REC;
  ------------------
  |  |  576|     40|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 5397|     40|                bMobileH = TAUT_YES;
  ------------------
  |  |  580|     40|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5398|     40|                state = IST_MOBILE_H_FORMULA;
 5399|     40|                break;
 5400|  3.83k|        }
 5401|  3.83k|    } while (c >= 0);
  ------------------
  |  Branch (5401:14): [True: 3.83k, False: 0]
  ------------------
 5402|       |
 5403|    454|exit_function:;
 5404|    454|exit_error:;
 5405|       |
 5406|       |    INCHI_HEAPCHK
 5407|       |
 5408|    454|        if (ret >= 0 || c == RI_ERR_EOF || c == RI_ERR_EOL)
  ------------------
  |  |   47|    778|#define RI_ERR_EOF     (0)
  ------------------
                      if (ret >= 0 || c == RI_ERR_EOF || c == RI_ERR_EOL)
  ------------------
  |  |   46|    186|#define RI_ERR_EOL     (-4)
  ------------------
  |  Branch (5408:13): [True: 130, False: 324]
  |  Branch (5408:25): [True: 138, False: 186]
  |  Branch (5408:44): [True: 0, False: 186]
  ------------------
 5409|    268|        {
 5410|    268|            pLine->len = 0;
 5411|    268|        }
 5412|       |
 5413|    454|    return ret;
 5414|    454|}
ichiread.c:ParseSegmentFormula:
 9515|    538|{
 9516|    538|    int i, j, mpy_component, mpy_atom, len, el_number;
 9517|    538|    int nNumComponents = 0, iComponent, nNumAtoms, nNumAtomsAndH, iAtom, nNumH, nAltMobileH = ALT_TAUT( bMobileH );
  ------------------
  |  |  582|    538|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  580|    538|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (582:29): [True: 0, False: 538]
  |  |  ------------------
  ------------------
 9518|    538|    const char *p, *q, *e, *pStart, *pEnd;
 9519|    538|    INChI *pInChI;
 9520|    538|    char szEl[3];
 9521|    538|#if ( FIX_GAF_2019_2==1 )
 9522|       |    /* hack: state passed in *na_total (will be updated in ParseSegmentFormula anyway) */
 9523|    538|    int state = *na_total;
 9524|    538|#endif
 9525|    538|    nNumAtoms = -999; /* impossible value */
 9526|    538|    *na_total = 0;
 9527|       |
 9528|       |    /* Pass 1. Count components */
 9529|       |    
 9530|    538|    pStart = (char  *) str;
 9531|  2.80k|    while (1)
  ------------------
  |  Branch (9531:12): [Folded - Ignored]
  ------------------
 9532|  2.80k|    {
 9533|  2.80k|        if (!( pEnd = strchr( pStart, '.' ) ))
  ------------------
  |  Branch (9533:13): [True: 521, False: 2.28k]
  ------------------
 9534|    521|        {
 9535|    521|            pEnd = pStart + strlen( pStart );
 9536|    521|        }
 9537|  2.80k|        p = pStart;
 9538|  2.80k|        if (isdigit( *p ))
 9539|    462|        {
 9540|    462|            mpy_component = (int) inchi_strtol( p, &q, 10 );
 9541|    462|            p = q;
 9542|    462|        }
 9543|  2.34k|        else
 9544|  2.34k|        {
 9545|  2.34k|            mpy_component = 1;
 9546|  2.34k|        }
 9547|  2.80k|        if (!mpy_component)
  ------------------
  |  Branch (9547:13): [True: 0, False: 2.80k]
  ------------------
 9548|      0|        {
 9549|      0|            break;
 9550|      0|        }
 9551|  2.80k|        if (!isupper( UCINT *p ))
  ------------------
  |  Branch (9551:13): [True: 111, False: 2.69k]
  ------------------
 9552|    111|        {
 9553|    111|            break; /* not a formula layer */
 9554|    111|        }
 9555|  2.69k|        if (pEnd == p)
  ------------------
  |  Branch (9555:13): [True: 0, False: 2.69k]
  ------------------
 9556|      0|        {
 9557|      0|            break; /* zero length formula */
 9558|      0|        }
 9559|  2.69k|        nNumComponents += mpy_component;
 9560|  2.69k|        if (*pEnd)
  ------------------
  |  Branch (9560:13): [True: 2.26k, False: 427]
  ------------------
 9561|  2.26k|        {
 9562|  2.26k|            pStart = pEnd + 1;
 9563|  2.26k|        }
 9564|    427|        else
 9565|    427|        {
 9566|    427|            break;
 9567|    427|        }
 9568|  2.69k|    }
 9569|    538|    pnNumComponents[bMobileH] = nNumComponents;
 9570|    538|#if ( FIX_GAF_2019_1==1 )
 9571|    538|    if (nNumComponents > MAX_ATOMS)
  ------------------
  |  |   43|    538|#define MAX_ATOMS  32766
  ------------------
  |  Branch (9571:9): [True: 0, False: 538]
  ------------------
 9572|      0|    {
 9573|      0|        pnNumComponents[bMobileH] = 0;
 9574|      0|        return RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9575|      0|    }
 9576|       |    /*    pnNumComponents was not reset to 0 which results
 9577|       |    in attempt then to free() garbage at
 9578|       |    Free_INChI_Stereo ( <-- Free_INChI_Members <-- FreeInpInChI ) */
 9579|       |#elif ( FIX_DALKE_BUGS == 1 )
 9580|       |    if (nNumComponents > MAX_ATOMS)
 9581|       |    {
 9582|       |        return RI_ERR_SYNTAX; /* syntax error */
 9583|       |    }
 9584|       |#endif
 9585|       |    /* exit or error check */
 9586|    538|    if (!nNumComponents)
  ------------------
  |  Branch (9586:9): [True: 99, False: 439]
  ------------------
 9587|     99|    {
 9588|     99|#if ( FIX_GAF_2019_2==1 )
 9589|     99|        int low_case = 0;
 9590|     99|        if (*pStart)
  ------------------
  |  Branch (9590:13): [True: 99, False: 0]
  ------------------
 9591|     99|        {
 9592|     99|            low_case = islower(UCINT *pStart);
 9593|     99|        }
 9594|     99|        if (!*pStart || low_case) {
  ------------------
  |  Branch (9594:13): [True: 0, False: 99]
  |  Branch (9594:25): [True: 84, False: 15]
  ------------------
 9595|     84|            if (low_case)
  ------------------
  |  Branch (9595:17): [True: 84, False: 0]
  ------------------
 9596|     84|            {
 9597|     84|                if (state == IST_MOBILE_H_FORMULA)
  ------------------
  |  Branch (9597:21): [True: 4, False: 80]
  ------------------
 9598|      4|                {
 9599|      4|                    if (*pStart != 'q' && *pStart != 'p')
  ------------------
  |  Branch (9599:25): [True: 2, False: 2]
  |  Branch (9599:43): [True: 2, False: 0]
  ------------------
 9600|      2|                    {
 9601|      2|                        return RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      2|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9602|      2|                    }
 9603|      4|                }
 9604|       |                /*
 9605|       |                else if (state == IST_FIXED_H_FORMULA)
 9606|       |                {
 9607|       |                if (*pStart != 'h' &&  *pStart != 'i' && *pStart != 'b' && *pStart != 'q' && *pStart != 'p')
 9608|       |                {
 9609|       |                return RI_ERR_SYNTAX;
 9610|       |                }
 9611|       |                }*/
 9612|     84|            }
 9613|       |#else
 9614|       |        if (!*pStart || islower(UCINT *pStart)) {
 9615|       |#endif
 9616|       |
 9617|     82|            INCHI_HEAPCHK
 9618|     82|                if (bMobileH == TAUT_NON && 0 < ( nNumComponents = pnNumComponents[nAltMobileH] ))
  ------------------
  |  |  579|    164|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (9618:21): [True: 80, False: 2]
  |  Branch (9618:45): [True: 80, False: 0]
  ------------------
 9619|     80|                {
 9620|       |                    /* allocate InChI */
 9621|     80|                    if (!( pInChI = (INChI *) inchi_calloc( nNumComponents, sizeof( INChI ) ) ))
  ------------------
  |  | 1133|     80|#define inchi_calloc   calloc
  ------------------
  |  Branch (9621:25): [True: 0, False: 80]
  ------------------
 9622|      0|                    {
 9623|      0|                        return RI_ERR_ALLOC; /* alloc failure */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 9624|      0|                    }
 9625|     80|                    pInpInChI[bMobileH] = pInChI;
 9626|     80|                    pnNumComponents[bMobileH] = nNumComponents;
 9627|  91.4k|                    for (i = 0; i < nNumComponents; i++)
  ------------------
  |  Branch (9627:33): [True: 91.3k, False: 80]
  ------------------
 9628|  91.3k|                    {
 9629|       |                        /* copy number of atoms */
 9630|  91.3k|                        len = pInpInChI[bMobileH][i].nNumberOfAtoms = pInpInChI[nAltMobileH][i].nNumberOfAtoms;
 9631|       |                        /* copy atoms */
 9632|  91.3k|                        len = ( len + 1 ) * sizeof( pInpInChI[0][0].nAtom[0] );
 9633|  91.3k|                        if (pInpInChI[bMobileH][i].nAtom)
  ------------------
  |  Branch (9633:29): [True: 0, False: 91.3k]
  ------------------
 9634|      0|                        {
 9635|      0|                            inchi_free( pInpInChI[bMobileH][i].nAtom );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 9636|      0|                        }
 9637|  91.3k|                        if (pInpInChI[bMobileH][i].nAtom = (U_CHAR *) inchi_malloc( ( len + 1 ) * sizeof( pInpInChI[0][0].nAtom[0] ) ))
  ------------------
  |  | 1130|  91.3k|#define inchi_malloc   malloc
  ------------------
  |  Branch (9637:29): [True: 91.3k, False: 0]
  ------------------
 9638|  91.3k|                        {
 9639|  91.3k|                            memcpy( pInpInChI[bMobileH][i].nAtom, pInpInChI[nAltMobileH][i].nAtom, len );
 9640|  91.3k|                            pInpInChI[bMobileH][i].nAtom[len] = 0;
 9641|  91.3k|                        }
 9642|      0|                        else
 9643|      0|                        {
 9644|      0|                            return RI_ERR_ALLOC; /* alloc failure */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 9645|      0|                        }
 9646|       |                        /* copy Hill formula */
 9647|  91.3k|                        len = (int) strlen( pInpInChI[nAltMobileH][i].szHillFormula ) + 1;
 9648|  91.3k|                        if (pInpInChI[bMobileH][i].szHillFormula)
  ------------------
  |  Branch (9648:29): [True: 0, False: 91.3k]
  ------------------
 9649|      0|                        {
 9650|      0|                            inchi_free( pInpInChI[bMobileH][i].szHillFormula );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 9651|      0|                        }
 9652|  91.3k|                        if (pInpInChI[bMobileH][i].szHillFormula = (char *) inchi_malloc( inchi_max( len, 2 ) ))
  ------------------
  |  | 1130|  91.3k|#define inchi_malloc   malloc
  ------------------
                                      if (pInpInChI[bMobileH][i].szHillFormula = (char *) inchi_malloc( inchi_max( len, 2 ) ))
  ------------------
  |  |  166|  91.3k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 91.3k, False: 12]
  |  |  ------------------
  ------------------
  |  Branch (9652:29): [True: 91.3k, False: 0]
  ------------------
 9653|  91.3k|                        {
 9654|  91.3k|                            memcpy( pInpInChI[bMobileH][i].szHillFormula, pInpInChI[nAltMobileH][i].szHillFormula, len );
 9655|  91.3k|                        }
 9656|      0|                        else
 9657|      0|                        {
 9658|      0|                            return RI_ERR_ALLOC; /* alloc failure */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 9659|      0|                        }
 9660|  91.3k|                    }
 9661|     80|                }
 9662|      2|                else
 9663|      2|                {
 9664|      2|                    if (bMobileH == TAUT_YES)
  ------------------
  |  |  580|      2|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (9664:25): [True: 2, False: 0]
  ------------------
 9665|      2|                    {
 9666|      2|                        int ret;
 9667|       |                        /* allocate InChI */
 9668|      2|                        nNumComponents = 1;
 9669|       |                        /* InChI */
 9670|      2|                        pnNumComponents[bMobileH] = nNumComponents;
 9671|      2|                        if (!( pInChI = (INChI *) inchi_calloc( nNumComponents, sizeof( INChI ) ) ))
  ------------------
  |  | 1133|      2|#define inchi_calloc   calloc
  ------------------
  |  Branch (9671:29): [True: 0, False: 2]
  ------------------
 9672|      0|                        {
 9673|      0|                            return RI_ERR_ALLOC; /* alloc failure */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 9674|      0|                        }
 9675|      2|                        pInpInChI[bMobileH] = pInChI;
 9676|      2|                        ret = nFillOutProtonMobileH( pInChI );
 9677|      2|                        if (ret < 0)
  ------------------
  |  Branch (9677:29): [True: 0, False: 2]
  ------------------
 9678|      0|                        {
 9679|      0|                            return ret;
 9680|      0|                        }
 9681|      2|                    }
 9682|      2|                }
 9683|     82|            return 0;
 9684|     82|        }
 9685|     15|        return RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|     15|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9686|     99|    }
 9687|       |
 9688|    439|    if (*pEnd)
  ------------------
  |  Branch (9688:9): [True: 6, False: 433]
  ------------------
 9689|      6|    {
 9690|      6|        return RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      6|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9691|      6|    }
 9692|       |
 9693|       |    /* allocate InChI */
 9694|    433|    if (!( pInpInChI[bMobileH] = (INChI *) inchi_calloc( nNumComponents, sizeof( INChI ) ) ))
  ------------------
  |  | 1133|    433|#define inchi_calloc   calloc
  ------------------
  |  Branch (9694:9): [True: 0, False: 433]
  ------------------
 9695|      0|    {
 9696|      0|        return RI_ERR_ALLOC; /* alloc failure */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 9697|      0|    }
 9698|    433|    pInChI = pInpInChI[bMobileH];
 9699|       |
 9700|       |    /* Pass 2. Count elements, save formulas and elements */
 9701|    433|    pStart = (char  *) str;
 9702|    433|    iComponent = 0;
 9703|  2.25k|    while (1)
  ------------------
  |  Branch (9703:12): [Folded - Ignored]
  ------------------
 9704|  2.25k|    {
 9705|  2.25k|        if (!( pEnd = strchr( pStart, '.' ) ))
  ------------------
  |  Branch (9705:13): [True: 427, False: 1.82k]
  ------------------
 9706|    427|        {
 9707|    427|            pEnd = pStart + strlen( pStart );
 9708|    427|        }
 9709|  2.25k|        p = pStart;
 9710|  2.25k|        if (isdigit( UCINT *p ))
 9711|    410|        {
 9712|    410|            mpy_component = (int) inchi_strtol( p, &q, 10 );
 9713|    410|#if ( CHECK_STRTOL_ATNUMB==1 )
 9714|    410|            if (mpy_component>MAX_ATOMS || mpy_component<0)
  ------------------
  |  |   43|    820|#define MAX_ATOMS  32766
  ------------------
  |  Branch (9714:17): [True: 0, False: 410]
  |  Branch (9714:44): [True: 0, False: 410]
  ------------------
 9715|      0|            {
 9716|      0|                return RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9717|      0|            }
 9718|    410|#endif
 9719|    410|            p = q;
 9720|    410|        }
 9721|  1.84k|        else
 9722|  1.84k|        {
 9723|  1.84k|            mpy_component = 1;
 9724|  1.84k|        }
 9725|  2.25k|#if ( FIX_DALKE_BUGS == 1 )
 9726|  2.25k|        if (iComponent + mpy_component > MAX_ATOMS)
  ------------------
  |  |   43|  2.25k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (9726:13): [True: 0, False: 2.25k]
  ------------------
 9727|      0|        {
 9728|      0|#if ( FIX_GAF_2019_1==1 )
 9729|      0|            nNumComponents = 0;
 9730|      0|#endif
 9731|      0|            return RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9732|      0|        }
 9733|  2.25k|#endif
 9734|  2.25k|        len = (int) ( pEnd - p );
 9735|   249k|        for (i = 0; i < mpy_component; i++)
  ------------------
  |  Branch (9735:21): [True: 247k, False: 2.23k]
  ------------------
 9736|   247k|        {
 9737|   247k|            if (iComponent + i >= nNumComponents)
  ------------------
  |  Branch (9737:17): [True: 2, False: 247k]
  ------------------
 9738|      2|            {
 9739|      2|                return RI_ERR_SYNTAX;
  ------------------
  |  |   44|      2|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9740|      2|            }
 9741|   247k|            if (pInChI[iComponent + i].szHillFormula)
  ------------------
  |  Branch (9741:17): [True: 0, False: 247k]
  ------------------
 9742|      0|            {
 9743|      0|                inchi_free( pInChI[iComponent + i].szHillFormula );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 9744|      0|            }
 9745|   247k|            pInChI[iComponent + i].szHillFormula = (char*) inchi_malloc( inchi_max( len, 1 ) + 1 );
  ------------------
  |  | 1130|   247k|#define inchi_malloc   malloc
  ------------------
                          pInChI[iComponent + i].szHillFormula = (char*) inchi_malloc( inchi_max( len, 1 ) + 1 );
  ------------------
  |  |  166|   247k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 246k, False: 902]
  |  |  ------------------
  ------------------
 9746|   247k|            memcpy( pInChI[iComponent].szHillFormula, p, len );
 9747|   247k|            pInChI[iComponent + i].szHillFormula[len] = '\0';
 9748|   247k|            if (!i)
  ------------------
  |  Branch (9748:17): [True: 2.25k, False: 244k]
  ------------------
 9749|  2.25k|            {
 9750|       |                /* Pass 2.1 Parse formula and count atoms except H */
 9751|  2.25k|                nNumAtoms = 0;
 9752|  2.25k|                nNumH = 0;
 9753|  2.25k|                nNumAtomsAndH = 0;
 9754|  2.25k|                e = pInChI[iComponent].szHillFormula;
 9755|  25.5k|                while (*e)
  ------------------
  |  Branch (9755:24): [True: 23.3k, False: 2.23k]
  ------------------
 9756|  23.3k|                {
 9757|  23.3k|                    if (!isupper( UCINT *e ))
  ------------------
  |  Branch (9757:25): [True: 17, False: 23.3k]
  ------------------
 9758|     17|                    {
 9759|     17|                        return RI_ERR_SYNTAX;
  ------------------
  |  |   44|     17|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9760|     17|                    }
 9761|  23.3k|                    j = 0;
 9762|  23.3k|                    szEl[j++] = *e++;
 9763|  23.3k|                    if (*e && islower( UCINT *e ))
  ------------------
  |  Branch (9763:25): [True: 22.1k, False: 1.20k]
  ------------------
 9764|  1.08k|                        szEl[j++] = *e++;
 9765|  23.3k|                    szEl[j++] = '\0';
 9766|  23.3k|                    if (*e && isdigit( UCINT *e ))
  ------------------
  |  Branch (9766:25): [True: 21.6k, False: 1.74k]
  ------------------
 9767|  12.0k|                    {
 9768|  12.0k|                        mpy_atom = (int) inchi_strtol( e, &q, 10 );
 9769|  12.0k|#if ( CHECK_STRTOL_ATNUMB==1 )
 9770|  12.0k|                        if (mpy_atom>MAX_ATOMS || mpy_atom<0)
  ------------------
  |  |   43|  24.0k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (9770:29): [True: 4, False: 12.0k]
  |  Branch (9770:51): [True: 0, False: 12.0k]
  ------------------
 9771|      4|                        {
 9772|      4|                            return RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      4|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9773|      4|                        }
 9774|  12.0k|#endif
 9775|  12.0k|                        e = q;
 9776|  12.0k|                    }
 9777|  11.3k|                    else
 9778|  11.3k|                    {
 9779|  11.3k|                        mpy_atom = 1;
 9780|  11.3k|                    }
 9781|  23.3k|                    if (!mpy_atom)
  ------------------
  |  Branch (9781:25): [True: 0, False: 23.3k]
  ------------------
 9782|      0|                    {
 9783|      0|                        return RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9784|      0|                    }
 9785|  23.3k|                    if (szEl[0] == 'H' && !szEl[1])
  ------------------
  |  Branch (9785:25): [True: 19.6k, False: 3.73k]
  |  Branch (9785:43): [True: 19.2k, False: 334]
  ------------------
 9786|  19.2k|                    {
 9787|  19.2k|                        nNumH += mpy_atom;
 9788|  19.2k|                        continue; /* ignore H in counting number of atoms */
 9789|  19.2k|                    }
 9790|  4.07k|                    nNumAtoms += mpy_atom;
 9791|  4.07k|                }
 9792|  2.23k|#if ( FIX_DALKE_BUGS == 1 )
 9793|  2.23k|                if (nNumAtoms > MAX_ATOMS)
  ------------------
  |  |   43|  2.23k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (9793:21): [True: 0, False: 2.23k]
  ------------------
 9794|      0|                {
 9795|      0|                    return RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9796|      0|                }
 9797|  2.23k|#endif
 9798|  2.23k|                ( *na_total ) += mpy_component * nNumAtoms;
 9799|       |
 9800|  2.23k|                nNumAtomsAndH = nNumAtoms ? nNumAtoms : ( nNumH > 0 );
  ------------------
  |  Branch (9800:33): [True: 2.21k, False: 14]
  ------------------
 9801|  2.23k|                pInChI[iComponent + i].nNumberOfAtoms = nNumAtomsAndH;
 9802|  2.23k|                if (pInChI[iComponent + i].nAtom)
  ------------------
  |  Branch (9802:21): [True: 0, False: 2.23k]
  ------------------
 9803|      0|                {
 9804|      0|                    inchi_free( pInChI[iComponent + i].nAtom );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 9805|      0|                }
 9806|  2.23k|                pInChI[iComponent + i].nAtom = (U_CHAR *) inchi_malloc( ( nNumAtomsAndH + 1 ) * sizeof( pInChI[0].nAtom[0] ) );
  ------------------
  |  | 1130|  2.23k|#define inchi_malloc   malloc
  ------------------
 9807|  2.23k|                if (!pInChI[iComponent + i].nAtom)
  ------------------
  |  Branch (9807:21): [True: 0, False: 2.23k]
  ------------------
 9808|      0|                {
 9809|      0|                    return RI_ERR_ALLOC; /* failed allocation */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 9810|      0|                }
 9811|       |                /* Pass 2.2 Store elements; this assumes no bridging H. Bridging H will be found in connection table, /c */
 9812|  2.23k|                iAtom = 0;
 9813|  2.23k|                if (nNumAtoms > 0)
  ------------------
  |  Branch (9813:21): [True: 2.21k, False: 14]
  ------------------
 9814|  2.21k|                {
 9815|  2.21k|                    e = pInChI[iComponent + i].szHillFormula;
 9816|  14.8k|                    while (*e)
  ------------------
  |  Branch (9816:28): [True: 12.6k, False: 2.21k]
  ------------------
 9817|  12.6k|                    {
 9818|  12.6k|                        if (!isupper( UCINT *e ))
  ------------------
  |  Branch (9818:29): [True: 0, False: 12.6k]
  ------------------
 9819|      0|                        {
 9820|      0|                            return RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9821|      0|                        }
 9822|  12.6k|                        j = 0;
 9823|  12.6k|                        szEl[j++] = *e++;
 9824|  12.6k|                        if (*e && islower( UCINT *e ))
  ------------------
  |  Branch (9824:29): [True: 11.4k, False: 1.19k]
  ------------------
 9825|  1.07k|                            szEl[j++] = *e++;
 9826|  12.6k|                        szEl[j++] = '\0';
 9827|  12.6k|                        if (*e && isdigit( UCINT *e ))
  ------------------
  |  Branch (9827:29): [True: 10.9k, False: 1.73k]
  ------------------
 9828|  5.83k|                        {
 9829|  5.83k|                            mpy_atom = (int) inchi_strtol( e, &q, 10 );
 9830|  5.83k|#if ( CHECK_STRTOL_ATNUMB==1 )
 9831|  5.83k|                            if (mpy_atom>MAX_ATOMS || mpy_atom<0)
  ------------------
  |  |   43|  11.6k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (9831:33): [True: 0, False: 5.83k]
  |  Branch (9831:55): [True: 0, False: 5.83k]
  ------------------
 9832|      0|                            {
 9833|      0|                                return RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9834|      0|                            }
 9835|  5.83k|#endif
 9836|  5.83k|                            e = q;
 9837|  5.83k|                        }
 9838|  6.83k|                        else
 9839|  6.83k|                        {
 9840|  6.83k|                            mpy_atom = 1;
 9841|  6.83k|                        }
 9842|  12.6k|                        if (!mpy_atom)
  ------------------
  |  Branch (9842:29): [True: 0, False: 12.6k]
  ------------------
 9843|      0|                        {
 9844|      0|                            return RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9845|      0|                        }
 9846|  12.6k|                        if (szEl[0] == 'H' && !szEl[1])
  ------------------
  |  Branch (9846:29): [True: 8.95k, False: 3.71k]
  |  Branch (9846:47): [True: 8.62k, False: 332]
  ------------------
 9847|  8.62k|                            continue; /* ignore H */
 9848|  4.04k|                        el_number = get_periodic_table_number( szEl );
 9849|  4.04k|                        if (el_number == ERR_ELEM)
  ------------------
  |  Branch (9849:29): [True: 2, False: 4.04k]
  ------------------
 9850|      2|                        {
 9851|      2|                            return RI_ERR_SYNTAX; /* wrong element */
  ------------------
  |  |   44|      2|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9852|      2|                        }
 9853|  1.69M|                        while (mpy_atom--)
  ------------------
  |  Branch (9853:32): [True: 1.69M, False: 4.04k]
  ------------------
 9854|  1.69M|                        {
 9855|  1.69M|                            if (iAtom >= nNumAtoms)
  ------------------
  |  Branch (9855:33): [True: 0, False: 1.69M]
  ------------------
 9856|      0|                            {
 9857|      0|                                return RI_ERR_PROGR; /* program error */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 9858|      0|                            }
 9859|  1.69M|                            pInChI[iComponent + i].nAtom[iAtom++] = (U_CHAR) el_number;
 9860|  1.69M|                        }
 9861|  4.04k|                    }
 9862|  2.21k|                }
 9863|     14|                else
 9864|     14|                {
 9865|     14|                    if (nNumH > 0)
  ------------------
  |  Branch (9865:25): [True: 14, False: 0]
  ------------------
 9866|     14|                    {
 9867|     14|                        pInChI[iComponent + i].nAtom[iAtom++] = EL_NUMBER_H;
  ------------------
  |  |   41|     14|#define EL_NUMBER_H ((U_CHAR) 1)
  ------------------
 9868|     14|                        nNumAtoms = 1;
 9869|     14|                    }
 9870|     14|                }
 9871|  2.23k|                pInChI[iComponent + i].nAtom[iAtom] = '\0';
 9872|  2.23k|                if (nNumAtoms != iAtom)
  ------------------
  |  Branch (9872:21): [True: 0, False: 2.23k]
  ------------------
 9873|      0|                {
 9874|      0|                    return RI_ERR_PROGR; /* program error */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 9875|      0|                }
 9876|  2.23k|            }
 9877|   244k|            else
 9878|   244k|            {
 9879|       |                /* Copy duplicated formula */
 9880|   244k|                strcpy( pInChI[iComponent + i].szHillFormula, pInChI[iComponent].szHillFormula );
 9881|       |                /* Copy atoms in the duplicated formula */
 9882|   244k|                pInChI[iComponent + i].nNumberOfAtoms = nNumAtoms;
 9883|   244k|                if (pInChI[iComponent + i].nAtom)
  ------------------
  |  Branch (9883:21): [True: 0, False: 244k]
  ------------------
 9884|      0|                {
 9885|      0|                    inchi_free( pInChI[iComponent + i].nAtom );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 9886|      0|                }
 9887|   244k|                pInChI[iComponent + i].nAtom = (U_CHAR *) inchi_malloc( nNumAtoms + 1 );
  ------------------
  |  | 1130|   244k|#define inchi_malloc   malloc
  ------------------
 9888|   244k|                if (!pInChI[iComponent + i].nAtom)
  ------------------
  |  Branch (9888:21): [True: 0, False: 244k]
  ------------------
 9889|      0|                {
 9890|      0|                    return RI_ERR_ALLOC; /* failed allocation */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 9891|      0|                }
 9892|   244k|                memcpy( pInChI[iComponent + i].nAtom, pInChI[iComponent].nAtom, nNumAtoms + 1 );
 9893|   244k|            }
 9894|   247k|        }
 9895|  2.23k|        iComponent += i;
 9896|  2.23k|        if (*pEnd)
  ------------------
  |  Branch (9896:13): [True: 1.82k, False: 408]
  ------------------
 9897|  1.82k|        {
 9898|  1.82k|            if (*pEnd != '.')
  ------------------
  |  Branch (9898:17): [True: 0, False: 1.82k]
  ------------------
 9899|      0|            {
 9900|      0|                return RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9901|      0|            }
 9902|  1.82k|            pStart = pEnd + 1;
 9903|  1.82k|        }
 9904|    408|        else
 9905|    408|        {
 9906|    408|            break;
 9907|    408|        }
 9908|  2.23k|    }
 9909|       |
 9910|    408|    if (iComponent != nNumComponents)
  ------------------
  |  Branch (9910:9): [True: 0, False: 408]
  ------------------
 9911|      0|    {
 9912|      0|        return RI_ERR_PROGR; /* program error */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 9913|      0|    }
 9914|    408|    if (bMobileH == TAUT_NON)
  ------------------
  |  |  579|    408|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (9914:9): [True: 4, False: 404]
  ------------------
 9915|      4|    {
 9916|       |        /* at this point the exact number of atoms including bridging H is known from TAUT_YES */
 9917|      8|        for (i = 0; i < nNumComponents && i < pnNumComponents[nAltMobileH]; i++)
  ------------------
  |  Branch (9917:21): [True: 4, False: 4]
  |  Branch (9917:43): [True: 4, False: 0]
  ------------------
 9918|      4|        {
 9919|      4|            if (pInpInChI[bMobileH][i].nNumberOfAtoms < ( len = pInpInChI[nAltMobileH][i].nNumberOfAtoms ))
  ------------------
  |  Branch (9919:17): [True: 4, False: 0]
  ------------------
 9920|      4|            {
 9921|       |                /* there are bridging H in this component */
 9922|      4|                if (pInpInChI[nAltMobileH][i].nAtom)
  ------------------
  |  Branch (9922:21): [True: 4, False: 0]
  ------------------
 9923|      4|                {
 9924|      4|                    U_CHAR *nAtom = (U_CHAR *) inchi_malloc( ( len + 1 ) * sizeof( nAtom[0] ) );
  ------------------
  |  | 1130|      4|#define inchi_malloc   malloc
  ------------------
 9925|      4|                    if (!nAtom)
  ------------------
  |  Branch (9925:25): [True: 0, False: 4]
  ------------------
 9926|      0|                    {
 9927|      0|                        return RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 9928|      0|                    }
 9929|      4|                    memcpy( nAtom, pInpInChI[nAltMobileH][i].nAtom, len * sizeof( nAtom[0] ) );
 9930|      4|                    nAtom[len] = 0;
 9931|      4|                    if (pInpInChI[bMobileH][i].nAtom)
  ------------------
  |  Branch (9931:25): [True: 4, False: 0]
  ------------------
 9932|      4|                    {
 9933|      4|                        inchi_free( pInpInChI[bMobileH][i].nAtom );
  ------------------
  |  | 1136|      4|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 4, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 9934|      4|                    }
 9935|      4|                    pInpInChI[bMobileH][i].nAtom = nAtom;
 9936|      4|                }
 9937|      4|                pInpInChI[bMobileH][i].nNumberOfAtoms = len;
 9938|      4|            }
 9939|      4|        }
 9940|      4|    }
 9941|       |
 9942|    408|    return nNumComponents + 1;
 9943|    408|}
ichiread.c:ParseSegmentConnections:
 8794|    396|{
 8795|    396|#define LAST_AT_LEN 256
 8796|       |    /* Pass 1: count bonds and find actual numbers of  atom */
 8797|    396|    int i, j, k, m, c, mpy_component;
 8798|    396|    int nNumComponents, iComponent, nNumAtoms, nNumBonds, lenConnTable, iBond;
 8799|    396|    const char *p, *q, *pStart, *pEnd;
 8800|    396|    AT_NUMB last_atom[LAST_AT_LEN], curAtom, maxAtom;
 8801|    396|    int  num_open, state, ret, base;
 8802|    396|    INChI *pInChI = *pInpInChI;
 8803|    396|    LINKED_BONDS LB;
 8804|    396|    LINKED_BONDS *pLB = &LB; /* a list of linked lists of bonds, for each atom */
 8805|    396|    AT_NUMB neighbor[MAXVAL];
 8806|    396|    int bPrevVersion = -1;
 8807|       |
 8808|    396|    *nb_total = 0;
 8809|    396|    iComponent = 0;
 8810|    396|    if (str[0] != 'c')
  ------------------
  |  Branch (8810:9): [True: 356, False: 40]
  ------------------
 8811|    356|    {
 8812|    356|        if (!pInChI && !*pnNumComponents)
  ------------------
  |  Branch (8812:13): [True: 0, False: 356]
  |  Branch (8812:24): [True: 0, False: 0]
  ------------------
 8813|      0|        {
 8814|      0|            int lenFormula = 1;
 8815|       |            /* component has no formula; allocate InChI */
 8816|      0|            lenConnTable = 0;
 8817|      0|            nNumComponents = 1;
 8818|       |            /* allocate InChI */
 8819|      0|            if (!( pInChI = *pInpInChI = (INChI *) inchi_calloc( nNumComponents, sizeof( INChI ) ) ))
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  |  Branch (8819:17): [True: 0, False: 0]
  ------------------
 8820|      0|            {
 8821|      0|                return RI_ERR_ALLOC; /* alloc failure */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 8822|      0|            }
 8823|       |            /* allocate empty formula */
 8824|      0|            pInChI[iComponent].szHillFormula = (char *) inchi_calloc( lenFormula + 1, sizeof( pInChI[0].szHillFormula[0] ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 8825|      0|            if (!pInChI[iComponent].szHillFormula)
  ------------------
  |  Branch (8825:17): [True: 0, False: 0]
  ------------------
 8826|      0|            {
 8827|      0|                ret = RI_ERR_ALLOC; /* allocation failure */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 8828|      0|                goto exit_function;
 8829|      0|            }
 8830|       |            /* allocate empty connection table */
 8831|      0|            pInChI[iComponent].nConnTable = (AT_NUMB *) inchi_calloc( lenConnTable + 1, sizeof( pInChI[0].nConnTable[0] ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 8832|      0|            if (!pInChI[iComponent].nConnTable)
  ------------------
  |  Branch (8832:17): [True: 0, False: 0]
  ------------------
 8833|      0|            {
 8834|      0|                ret = RI_ERR_ALLOC; /* allocation failure */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 8835|      0|                goto exit_function;
 8836|      0|            }
 8837|      0|            pInChI[iComponent].lenConnTable = lenConnTable;
 8838|      0|            *pnNumComponents = nNumComponents;
 8839|      0|        }
 8840|    356|        else
 8841|    356|        {
 8842|    356|            lenConnTable = 1;
 8843|    356|            nNumComponents = *pnNumComponents;
 8844|   246k|            for (i = 0; i < nNumComponents; i++)
  ------------------
  |  Branch (8844:25): [True: 246k, False: 356]
  ------------------
 8845|   246k|            {
 8846|       |                /* allocate 1 atom connection table */
 8847|   246k|                if (pInChI[i].nConnTable)
  ------------------
  |  Branch (8847:21): [True: 2, False: 246k]
  ------------------
 8848|      2|                {
 8849|      2|                    inchi_free( pInChI[i].nConnTable );
  ------------------
  |  | 1136|      2|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 2, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 8850|      2|                }
 8851|   246k|                pInChI[i].nConnTable = (AT_NUMB *) inchi_calloc( lenConnTable + 1, sizeof( pInChI[0].nConnTable[0] ) );
  ------------------
  |  | 1133|   246k|#define inchi_calloc   calloc
  ------------------
 8852|   246k|                if (!pInChI[i].nConnTable)
  ------------------
  |  Branch (8852:21): [True: 0, False: 246k]
  ------------------
 8853|      0|                {
 8854|      0|                    ret = RI_ERR_ALLOC; /* allocation failure */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 8855|      0|                    goto exit_function;
 8856|      0|                }
 8857|   246k|                pInChI[i].nConnTable[0] = 1;
 8858|   246k|                pInChI[i].lenConnTable = lenConnTable;
 8859|   246k|            }
 8860|    356|        }
 8861|    356|        return 0;
 8862|    356|    }
 8863|       |
 8864|       |    /* Pass 1. Re-Count atoms, count bonds */
 8865|       |    
 8866|     40|    pStart = (char  *) str + 1;
 8867|     40|    nNumComponents = *pnNumComponents;
 8868|     40|#if (FIX_DALKE_BUGS == 1)
 8869|       |    /* prevent crash on too many components */
 8870|     40|    if (nNumComponents > MAX_ATOMS)
  ------------------
  |  |   43|     40|#define MAX_ATOMS  32766
  ------------------
  |  Branch (8870:9): [True: 0, False: 40]
  ------------------
 8871|      0|    {
 8872|      0|        ret = RI_ERR_SYNTAX; /* syntax error: extra component */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8873|      0|        goto exit_function;
 8874|      0|    }
 8875|     40|#endif
 8876|     40|    memset( pLB, 0, sizeof( pLB[0] ) );
 8877|       |
 8878|     42|    while (1)
  ------------------
  |  Branch (8878:12): [Folded - Ignored]
  ------------------
 8879|     42|    {
 8880|       |        /* cycle over components */
 8881|     42|        if (!( pEnd = strchr( pStart, ';' ) ))
  ------------------
  |  Branch (8881:13): [True: 34, False: 8]
  ------------------
 8882|     34|        {
 8883|     34|            pEnd = pStart + strlen( pStart );
 8884|     34|        }
 8885|     42|        if (( p = strchr( pStart, '*' ) ) && p < pEnd)
  ------------------
  |  Branch (8885:13): [True: 8, False: 34]
  |  Branch (8885:46): [True: 8, False: 0]
  ------------------
 8886|      8|        {
 8887|      8|            mpy_component = (int) inchi_strtol( pStart, &q, 10 );
 8888|      8|#if ( CHECK_STRTOL_ATNUMB==1 )
 8889|      8|            if (mpy_component>MAX_ATOMS || mpy_component<0)
  ------------------
  |  |   43|     16|#define MAX_ATOMS  32766
  ------------------
  |  Branch (8889:17): [True: 0, False: 8]
  |  Branch (8889:44): [True: 0, False: 8]
  ------------------
 8890|      0|            {
 8891|      0|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8892|      0|                goto exit_function;
 8893|      0|            }
 8894|      8|#endif
 8895|      8|            if (p != q
  ------------------
  |  Branch (8895:17): [True: 0, False: 8]
  ------------------
 8896|      8|#if (FIX_DALKE_BUGS == 1)
 8897|      8|                 || !isdigit( UCINT *pStart )
  ------------------
  |  Branch (8897:21): [True: 0, False: 8]
  ------------------
 8898|      8|#endif
 8899|      8|                 )
 8900|      0|            {
 8901|      0|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8902|      0|                goto exit_function;
 8903|      0|            }
 8904|      8|            p++;
 8905|      8|        }
 8906|     34|        else
 8907|     34|        {
 8908|     34|            mpy_component = 1;
 8909|     34|            p = pStart;
 8910|     34|        }
 8911|     42|#if (FIX_DALKE_BUGS == 1)
 8912|     42|        if (iComponent + mpy_component > MAX_ATOMS)
  ------------------
  |  |   43|     42|#define MAX_ATOMS  32766
  ------------------
  |  Branch (8912:13): [True: 0, False: 42]
  ------------------
 8913|      0|        {
 8914|      0|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8915|      0|            goto exit_function;
 8916|      0|        }
 8917|     42|#endif
 8918|     42|        pStart = p;
 8919|       |        /* Pass 1.1 parse a component */
 8920|     42|        num_open = 0;
 8921|     42|        memset( last_atom, 0, sizeof( last_atom ) );
 8922|     42|        state = '\0';   /* initial state */
 8923|     42|        maxAtom = 0;
 8924|     42|        nNumBonds = 0;
 8925|     42|        curAtom = 0;
 8926|     42|        if (p < pEnd && *pbAbc == -1)
  ------------------
  |  Branch (8926:13): [True: 38, False: 4]
  |  Branch (8926:25): [True: 0, False: 38]
  ------------------
 8927|      0|        {
 8928|       |            /* check if compressed InChI */
 8929|      0|            *pbAbc = isupper( UCINT *p ) ? 1 : 0;
 8930|      0|        }
 8931|     42|        base = *pbAbc ? ALPHA_BASE : 10;
  ------------------
  |  |   96|      0|#define ALPHA_BASE  27
  ------------------
  |  Branch (8931:16): [True: 0, False: 42]
  ------------------
 8932|       |
 8933|     42|        if (*pbAbc == 1)
  ------------------
  |  Branch (8933:13): [True: 0, False: 42]
  ------------------
 8934|      0|        {
 8935|      0|            nNumAtoms = 1;
 8936|      0|            while (p < pEnd)
  ------------------
  |  Branch (8936:20): [True: 0, False: 0]
  ------------------
 8937|      0|            {
 8938|      0|                if (*p == '-')
  ------------------
  |  Branch (8938:21): [True: 0, False: 0]
  ------------------
 8939|      0|                {
 8940|      0|                    if (bPrevVersion == -1)
  ------------------
  |  Branch (8940:25): [True: 0, False: 0]
  ------------------
 8941|      0|                    {
 8942|       |                        /* previous InChI version */
 8943|      0|                        bPrevVersion = 1;
 8944|      0|                    }
 8945|      0|                    else
 8946|      0|                        if (bPrevVersion != 1)
  ------------------
  |  Branch (8946:29): [True: 0, False: 0]
  ------------------
 8947|      0|                        {
 8948|      0|                            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8949|      0|                            goto exit_function;
 8950|      0|                        }
 8951|      0|                    nNumAtoms--;
 8952|      0|                    p++;
 8953|      0|                }
 8954|      0|                if (isdigit( UCINT *p ))
 8955|      0|                {
 8956|      0|                    if (bPrevVersion == -1)
  ------------------
  |  Branch (8956:25): [True: 0, False: 0]
  ------------------
 8957|      0|                    {
 8958|       |                        /* curreny InChI, version 1 */
 8959|      0|                        bPrevVersion = 0;
 8960|      0|                    }
 8961|      0|                    else
 8962|      0|                        if (bPrevVersion != 0)
  ------------------
  |  Branch (8962:29): [True: 0, False: 0]
  ------------------
 8963|      0|                        {
 8964|      0|                            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8965|      0|                            goto exit_function;
 8966|      0|                        }
 8967|      0|                    nNumAtoms -= inchi_strtol( p, &p, 10 ); /* bypass digits */
 8968|      0|                }
 8969|      0|                if (*p != '-' && ( curAtom = (AT_NUMB) inchi_strtol( p, &q, base ) ))
  ------------------
  |  Branch (8969:21): [True: 0, False: 0]
  |  Branch (8969:34): [True: 0, False: 0]
  ------------------
 8970|      0|                {
 8971|      0|                    nNumAtoms++;
 8972|      0|                    nNumBonds++;
 8973|      0|                    p = q;
 8974|      0|                    if (maxAtom < curAtom)
  ------------------
  |  Branch (8974:25): [True: 0, False: 0]
  ------------------
 8975|      0|                        maxAtom = curAtom;
 8976|      0|                }
 8977|      0|                else
 8978|      0|                {
 8979|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8980|      0|                    goto exit_function;
 8981|      0|                }
 8982|      0|            }
 8983|      0|            if (maxAtom < nNumAtoms && nNumBonds)
  ------------------
  |  Branch (8983:17): [True: 0, False: 0]
  |  Branch (8983:40): [True: 0, False: 0]
  ------------------
 8984|      0|            {
 8985|      0|                maxAtom = nNumAtoms;
 8986|      0|            }
 8987|      0|        }
 8988|     42|        else
 8989|     42|        {
 8990|  35.2k|            while (p < pEnd)
  ------------------
  |  Branch (8990:20): [True: 35.1k, False: 38]
  ------------------
 8991|  35.1k|            {
 8992|       |                /* atom number */
 8993|  35.1k|                c = UCINT *p++;
  ------------------
  |  |  116|  35.1k|#define UCINT  (int)(unsigned char)
  ------------------
 8994|  35.1k|                switch (c)
 8995|  35.1k|                {
 8996|  1.41k|                    case '(':
  ------------------
  |  Branch (8996:21): [True: 1.41k, False: 33.7k]
  ------------------
 8997|  2.82k|                    case ')':
  ------------------
  |  Branch (8997:21): [True: 1.41k, False: 33.7k]
  ------------------
 8998|  2.83k|                    case ',':
  ------------------
  |  Branch (8998:21): [True: 6, False: 35.1k]
  ------------------
 8999|  17.5k|                    case '-':
  ------------------
  |  Branch (8999:21): [True: 14.7k, False: 20.4k]
  ------------------
 9000|  17.5k|                        if (state != 'N')
  ------------------
  |  Branch (9000:29): [True: 0, False: 17.5k]
  ------------------
 9001|      0|                        {
 9002|      0|                            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9003|      0|                            goto exit_function;
 9004|      0|                        }
 9005|  17.5k|                        state = c;
 9006|  17.5k|                        num_open += ( c == '(' ) - ( c == ')' );
 9007|  17.5k|                        if (num_open < 0)
  ------------------
  |  Branch (9007:29): [True: 0, False: 17.5k]
  ------------------
 9008|      0|                        {
 9009|      0|                            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9010|      0|                            goto exit_function;
 9011|      0|                        }
 9012|  17.5k|                        break;
 9013|  17.6k|                    default:
  ------------------
  |  Branch (9013:21): [True: 17.6k, False: 17.5k]
  ------------------
 9014|  17.6k|                        if (isdigit( c ) && ( curAtom = (AT_NUMB) inchi_strtol( p - 1, &q, 10 ) ))
  ------------------
  |  Branch (9014:45): [True: 17.6k, False: 2]
  ------------------
 9015|  17.6k|                        {
 9016|  17.6k|                            p = q;
 9017|  17.6k|                            switch (state)
 9018|  17.6k|                            {
 9019|  1.41k|                                case '(':
  ------------------
  |  Branch (9019:33): [True: 1.41k, False: 16.1k]
  ------------------
 9020|  2.82k|                                case ')':
  ------------------
  |  Branch (9020:33): [True: 1.40k, False: 16.1k]
  ------------------
 9021|  2.82k|                                case ',':
  ------------------
  |  Branch (9021:33): [True: 6, False: 17.5k]
  ------------------
 9022|  17.5k|                                case '-':
  ------------------
  |  Branch (9022:33): [True: 14.7k, False: 2.86k]
  ------------------
 9023|  17.5k|                                    nNumBonds++;
 9024|  17.6k|                                case '\0':
  ------------------
  |  Branch (9024:33): [True: 38, False: 17.5k]
  ------------------
 9025|  17.6k|                                    if (maxAtom < curAtom)
  ------------------
  |  Branch (9025:41): [True: 97, False: 17.5k]
  ------------------
 9026|     97|                                        maxAtom = curAtom;
 9027|  17.6k|                                    state = 'N';
 9028|  17.6k|                                    break;
 9029|      0|                                default:
  ------------------
  |  Branch (9029:33): [True: 0, False: 17.6k]
  ------------------
 9030|      0|                                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9031|      0|                                    goto exit_function;
 9032|  17.6k|                            }
 9033|  17.6k|                        }
 9034|      4|                        else
 9035|      4|                        {
 9036|      4|                            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      4|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9037|      4|                            goto exit_function;
 9038|      4|                        }
 9039|  17.6k|                        break;
 9040|  35.1k|                }
 9041|  35.1k|            }
 9042|     38|            if (num_open)
  ------------------
  |  Branch (9042:17): [True: 0, False: 38]
  ------------------
 9043|      0|            {
 9044|      0|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9045|      0|                goto exit_function;
 9046|       |                /* syntax error: parentheses do not match */
 9047|      0|            }
 9048|     38|        }
 9049|     38|        ( *nb_total ) += nNumBonds;
 9050|       |
 9051|       |        /* Save the results and allocate memory */
 9052|     38|        nNumAtoms = (int) maxAtom; /* 0 if empty connection table and no bonds present */
 9053|     38|        lenConnTable = nNumAtoms + nNumBonds;
 9054|       |
 9055|       |        /* connection table format: At1[,Neigh11,Neigh12,...],At2[,Neigh21,Neigh22,...],AtN[NeighN1,NeighN2,...] */
 9056|       |        /* where AtK > NeighK1 > NeighK2,...; At(K) < At(K+1); the length = num.atoms + num.bonds */
 9057|    146|        for (i = 0; i < mpy_component; i++)
  ------------------
  |  Branch (9057:21): [True: 108, False: 38]
  ------------------
 9058|    108|        {
 9059|    108|#if ( FIX_GAF_2019_2==1 )
 9060|    108|            if ((iComponent + i > nNumComponents - 1) || (iComponent + i<0))
  ------------------
  |  Branch (9060:17): [True: 0, False: 108]
  |  Branch (9060:58): [True: 0, False: 108]
  ------------------
 9061|      0|            {
 9062|      0|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9063|      0|                goto exit_function;
 9064|      0|            }
 9065|    108|            if (pInChI[iComponent + i].nNumberOfAtoms <= 0 || pInChI[iComponent + i].nNumberOfAtoms > MAX_ATOMS)
  ------------------
  |  |   43|    108|#define MAX_ATOMS  32766
  ------------------
  |  Branch (9065:17): [True: 0, False: 108]
  |  Branch (9065:63): [True: 0, False: 108]
  ------------------
 9066|      0|            {
 9067|      0|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9068|      0|                goto exit_function;
 9069|      0|            }
 9070|    108|#endif
 9071|       |            /* check number of atoms: the difference may be due to bridging H */
 9072|    108|            if (( j = pInChI[iComponent + i].nNumberOfAtoms ) < nNumAtoms)
  ------------------
  |  Branch (9072:17): [True: 40, False: 68]
  ------------------
 9073|     40|            {
 9074|       |                /* reallocate */
 9075|     40|                U_CHAR *nAtomTmp = (U_CHAR *) inchi_malloc( nNumAtoms + 1 );
  ------------------
  |  | 1130|     40|#define inchi_malloc   malloc
  ------------------
 9076|     40|                if (!nAtomTmp)
  ------------------
  |  Branch (9076:21): [True: 0, False: 40]
  ------------------
 9077|      0|                {
 9078|      0|                    ret = RI_ERR_ALLOC; /* allocation failure */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 9079|      0|                    goto exit_function;
 9080|      0|                }
 9081|     40|                memcpy( nAtomTmp, pInChI[iComponent + i].nAtom, sizeof( nAtomTmp[0] )*j );
 9082|  79.4k|                while (j < nNumAtoms)
  ------------------
  |  Branch (9082:24): [True: 79.3k, False: 40]
  ------------------
 9083|  79.3k|                {
 9084|  79.3k|                    nAtomTmp[j++] = EL_NUMBER_H; /* bridging H */
  ------------------
  |  |   41|  79.3k|#define EL_NUMBER_H ((U_CHAR) 1)
  ------------------
 9085|  79.3k|                }
 9086|     40|                nAtomTmp[j] = '\0';
 9087|     40|                INCHI_HEAPCHK
 9088|     40|                    if (pInChI[iComponent + i].nAtom)
  ------------------
  |  Branch (9088:25): [True: 40, False: 0]
  ------------------
 9089|     40|                    {
 9090|     40|                        inchi_free( pInChI[iComponent + i].nAtom );
  ------------------
  |  | 1136|     40|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 40, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 9091|     40|                    }
 9092|     40|                pInChI[iComponent + i].nAtom = nAtomTmp;
 9093|     40|                pInChI[iComponent + i].nNumberOfAtoms = nNumAtoms;
 9094|     40|            }
 9095|     68|            else
 9096|     68|            {
 9097|     68|                if (j > nNumAtoms && ( lenConnTable || j != 1 ))
  ------------------
  |  Branch (9097:21): [True: 4, False: 64]
  |  Branch (9097:40): [True: 0, False: 4]
  |  Branch (9097:56): [True: 0, False: 4]
  ------------------
 9098|      0|                {
 9099|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9100|      0|                    goto exit_function;
 9101|      0|                }
 9102|     68|            }
 9103|       |            /* allocate connection table */
 9104|    108|            if (pInChI[iComponent + i].nConnTable)
  ------------------
  |  Branch (9104:17): [True: 0, False: 108]
  ------------------
 9105|      0|            {
 9106|      0|                inchi_free( pInChI[iComponent + i].nConnTable );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 9107|      0|            }
 9108|    108|            if (!nNumAtoms && !nNumBonds && !lenConnTable)
  ------------------
  |  Branch (9108:17): [True: 4, False: 104]
  |  Branch (9108:31): [True: 4, False: 0]
  |  Branch (9108:45): [True: 4, False: 0]
  ------------------
 9109|      4|            {
 9110|      4|                lenConnTable = 1;  /* one atom, no bonds */
 9111|      4|            }
 9112|    108|            pInChI[iComponent + i].nConnTable = (AT_NUMB *) inchi_calloc( lenConnTable + 1, sizeof( pInChI[0].nConnTable[0] ) );
  ------------------
  |  | 1133|    108|#define inchi_calloc   calloc
  ------------------
 9113|    108|            if (!pInChI[iComponent + i].nConnTable)
  ------------------
  |  Branch (9113:17): [True: 0, False: 108]
  ------------------
 9114|      0|            {
 9115|      0|                ret = RI_ERR_ALLOC; /* allocation failure */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 9116|      0|                goto exit_function;
 9117|      0|            }
 9118|    108|            pInChI[iComponent + i].lenConnTable = lenConnTable;
 9119|    108|        }
 9120|       |
 9121|       |        /* Pass 1.2 parse a component and extract the bonds */
 9122|     38|        num_open = 0;
 9123|     38|        memset( last_atom, 0, sizeof( last_atom ) );
 9124|     38|        state = '\0';   /* initial state */
 9125|     38|        iBond = 0;
 9126|     38|        p = pStart;
 9127|     38|        pLB->len = 0;
 9128|       |
 9129|     38|        if (*pbAbc == 1)
  ------------------
  |  Branch (9129:13): [True: 0, False: 38]
  ------------------
 9130|      0|        {
 9131|       |            /* compressed */
 9132|      0|            int num_neigh;
 9133|      0|            num_open = 0;
 9134|      0|            last_atom[num_open] = 2;
 9135|      0|            while (p < pEnd)
  ------------------
  |  Branch (9135:20): [True: 0, False: 0]
  ------------------
 9136|      0|            {
 9137|      0|                if (last_atom[num_open] > maxAtom)
  ------------------
  |  Branch (9137:21): [True: 0, False: 0]
  ------------------
 9138|      0|                {
 9139|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9140|      0|                    goto exit_function;
 9141|      0|                }
 9142|      0|                if (isupper( UCINT *p ))
 9143|      0|                {
 9144|      0|                    curAtom = (AT_NUMB) inchi_strtol( p, &q, base );
 9145|      0|                    if (ret = AddLinkedBond( last_atom[num_open], curAtom, (AT_NUMB) nNumAtoms, pLB ))
  ------------------
  |  Branch (9145:25): [True: 0, False: 0]
  ------------------
 9146|      0|                    {
 9147|      0|                        goto exit_function;
 9148|      0|                    }
 9149|      0|                    p = q;
 9150|      0|                    if (bPrevVersion == 1)
  ------------------
  |  Branch (9150:25): [True: 0, False: 0]
  ------------------
 9151|      0|                    {
 9152|      0|                        while (p < pEnd && *p == '-')
  ------------------
  |  Branch (9152:32): [True: 0, False: 0]
  |  Branch (9152:44): [True: 0, False: 0]
  ------------------
 9153|      0|                        {
 9154|      0|                            p++;
 9155|      0|                            if (curAtom = (AT_NUMB) inchi_strtol( p, &q, base ))
  ------------------
  |  Branch (9155:33): [True: 0, False: 0]
  ------------------
 9156|      0|                            {
 9157|      0|                                if (ret = AddLinkedBond( last_atom[num_open], curAtom, (AT_NUMB) nNumAtoms, pLB ))
  ------------------
  |  Branch (9157:37): [True: 0, False: 0]
  ------------------
 9158|      0|                                {
 9159|      0|                                    goto exit_function;
 9160|      0|                                }
 9161|      0|                                p = q;
 9162|      0|                            }
 9163|      0|                            else
 9164|      0|                            {
 9165|      0|                                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9166|      0|                                goto exit_function;
 9167|      0|                            }
 9168|      0|                        }
 9169|      0|                    }
 9170|      0|                    else
 9171|      0|                    {
 9172|      0|                        if (bPrevVersion == 0 && isdigit( *p ))
  ------------------
  |  Branch (9172:29): [True: 0, False: 0]
  ------------------
 9173|      0|                        {
 9174|      0|                            num_neigh = (int) inchi_strtol( p, &q, 10 );
 9175|      0|                            p = q;
 9176|      0|                            while (num_neigh-- && p < pEnd)
  ------------------
  |  Branch (9176:36): [True: 0, False: 0]
  |  Branch (9176:51): [True: 0, False: 0]
  ------------------
 9177|      0|                            {
 9178|      0|                                if (curAtom = (AT_NUMB) inchi_strtol( p, &q, base ))
  ------------------
  |  Branch (9178:37): [True: 0, False: 0]
  ------------------
 9179|      0|                                {
 9180|      0|                                    if (ret = AddLinkedBond( last_atom[num_open], curAtom, (AT_NUMB) nNumAtoms, pLB ))
  ------------------
  |  Branch (9180:41): [True: 0, False: 0]
  ------------------
 9181|      0|                                    {
 9182|      0|                                        goto exit_function;
 9183|      0|                                    }
 9184|      0|                                    p = q;
 9185|      0|                                }
 9186|      0|                                else
 9187|      0|                                {
 9188|      0|                                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9189|      0|                                    goto exit_function;
 9190|      0|                                }
 9191|      0|                            }
 9192|      0|                        }
 9193|      0|                    }
 9194|      0|                    last_atom[num_open] ++;
 9195|      0|                }
 9196|      0|                else
 9197|      0|                {
 9198|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9199|      0|                    goto exit_function;
 9200|      0|                }
 9201|      0|            }
 9202|      0|        }
 9203|     38|        else
 9204|     38|        {
 9205|  33.3k|            while (p < pEnd)
  ------------------
  |  Branch (9205:20): [True: 33.2k, False: 32]
  ------------------
 9206|  33.2k|            {
 9207|       |                /* each atom number except the first means a new bond */
 9208|  33.2k|                c = UCINT *p++;
  ------------------
  |  |  116|  33.2k|#define UCINT  (int)(unsigned char)
  ------------------
 9209|  33.2k|                switch (c)
 9210|  33.2k|                {
 9211|  1.22k|                    case '(':
  ------------------
  |  Branch (9211:21): [True: 1.22k, False: 32.0k]
  ------------------
 9212|  1.93k|                    case ')':
  ------------------
  |  Branch (9212:21): [True: 712, False: 32.5k]
  ------------------
 9213|  1.94k|                    case ',':
  ------------------
  |  Branch (9213:21): [True: 6, False: 33.2k]
  ------------------
 9214|  16.6k|                    case '-':
  ------------------
  |  Branch (9214:21): [True: 14.6k, False: 18.6k]
  ------------------
 9215|  16.6k|                        switch (state)
 9216|  16.6k|                        {
 9217|  16.6k|                            case 'N':
  ------------------
  |  Branch (9217:29): [True: 16.6k, False: 0]
  ------------------
 9218|  16.6k|                                state = c;
 9219|  16.6k|                                break;
 9220|      0|                            default:
  ------------------
  |  Branch (9220:29): [True: 0, False: 16.6k]
  ------------------
 9221|      0|                                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9222|      0|                                goto exit_function;
 9223|  16.6k|                        }
 9224|  16.6k|                        break;
 9225|  16.6k|                    default:
  ------------------
  |  Branch (9225:21): [True: 16.6k, False: 16.6k]
  ------------------
 9226|  16.6k|                        if (isdigit( c ) && ( curAtom = (AT_NUMB) inchi_strtol( p - 1, &q, 10 ) ))
  ------------------
  |  Branch (9226:45): [True: 16.6k, False: 0]
  ------------------
 9227|  16.6k|                        {
 9228|  16.6k|                            p = q;
 9229|  16.6k|                            switch (state)
 9230|  16.6k|                            {
 9231|     34|                                case '\0':
  ------------------
  |  Branch (9231:33): [True: 34, False: 16.6k]
  ------------------
 9232|     34|                                    last_atom[num_open] = curAtom;
 9233|     34|                                    state = 'N';
 9234|     34|                                    break;
 9235|  1.22k|                                case '(':
  ------------------
  |  Branch (9235:33): [True: 1.22k, False: 15.4k]
  ------------------
 9236|  1.22k|                                    if (ret = AddLinkedBond( last_atom[num_open], curAtom, (AT_NUMB) nNumAtoms, pLB ))
  ------------------
  |  Branch (9236:41): [True: 0, False: 1.22k]
  ------------------
 9237|      0|                                    {
 9238|      0|                                        goto exit_function;
 9239|      0|                                    }
 9240|  1.22k|                                    if (++num_open >= LAST_AT_LEN)
  ------------------
  |  | 8795|  1.22k|#define LAST_AT_LEN 256
  ------------------
  |  Branch (9240:41): [True: 2, False: 1.22k]
  ------------------
 9241|      2|                                    {
 9242|      2|                                        ret = RI_ERR_PROGR; /* program error: buffer overflow */
  ------------------
  |  |   45|      2|#define RI_ERR_PROGR   (-3)
  ------------------
 9243|      2|                                        goto exit_function;
 9244|      2|                                    }
 9245|  1.22k|                                    last_atom[num_open] = curAtom;
 9246|  1.22k|                                    state = 'N';
 9247|  1.22k|                                    break;
 9248|       |
 9249|    708|                                case ')':
  ------------------
  |  Branch (9249:33): [True: 708, False: 15.9k]
  ------------------
 9250|    708|                                    if (!num_open)
  ------------------
  |  Branch (9250:41): [True: 0, False: 708]
  ------------------
 9251|      0|                                    {
 9252|      0|                                        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9253|      0|                                        goto exit_function;
 9254|      0|                                    }
 9255|    708|                                    if (ret = AddLinkedBond( last_atom[--num_open], curAtom, (AT_NUMB) nNumAtoms, pLB ))
  ------------------
  |  Branch (9255:41): [True: 0, False: 708]
  ------------------
 9256|      0|                                    {
 9257|      0|                                        goto exit_function;
 9258|      0|                                    }
 9259|    708|                                    last_atom[num_open] = curAtom;
 9260|    708|                                    state = 'N';
 9261|    708|                                    break;
 9262|       |
 9263|      6|                                case ',':
  ------------------
  |  Branch (9263:33): [True: 6, False: 16.6k]
  ------------------
 9264|      6|                                    if (!num_open)
  ------------------
  |  Branch (9264:41): [True: 4, False: 2]
  ------------------
 9265|      4|                                    {
 9266|      4|                                        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      4|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9267|      4|                                        goto exit_function;
 9268|      4|                                    }
 9269|      2|                                    if (ret = AddLinkedBond( last_atom[num_open - 1], curAtom, (AT_NUMB) nNumAtoms, pLB ))
  ------------------
  |  Branch (9269:41): [True: 0, False: 2]
  ------------------
 9270|      0|                                    {
 9271|      0|                                        goto exit_function;
 9272|      0|                                    }
 9273|      2|                                    last_atom[num_open] = curAtom;
 9274|      2|                                    state = 'N';
 9275|      2|                                    break;
 9276|  14.6k|                                case '-':
  ------------------
  |  Branch (9276:33): [True: 14.6k, False: 1.97k]
  ------------------
 9277|  14.6k|                                    if (ret = AddLinkedBond( last_atom[num_open], curAtom, (AT_NUMB) nNumAtoms, pLB ))
  ------------------
  |  Branch (9277:41): [True: 0, False: 14.6k]
  ------------------
 9278|      0|                                    {
 9279|      0|                                        goto exit_function;
 9280|      0|                                    }
 9281|  14.6k|                                    last_atom[num_open] = curAtom;
 9282|  14.6k|                                    state = 'N';
 9283|  14.6k|                                    break;
 9284|      0|                                default:
  ------------------
  |  Branch (9284:33): [True: 0, False: 16.6k]
  ------------------
 9285|      0|                                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9286|      0|                                    goto exit_function;
 9287|  16.6k|                            }
 9288|  16.6k|                        }
 9289|      0|                        else
 9290|      0|                        {
 9291|      0|                            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9292|      0|                            goto exit_function;
 9293|      0|                        }
 9294|  16.6k|                        break;
 9295|  33.2k|                }
 9296|  33.2k|            }
 9297|     38|        }
 9298|       |
 9299|       |        /* Store the bonds in connection table */
 9300|     32|        if (lenConnTable > 1)
  ------------------
  |  Branch (9300:13): [True: 28, False: 4]
  ------------------
 9301|     28|        {
 9302|     76|            for (i = 0, m = 0; i < nNumAtoms; i++)
  ------------------
  |  Branch (9302:32): [True: 68, False: 8]
  ------------------
 9303|     68|            {
 9304|     68|                k = 0;
 9305|       |
 9306|     68|                if (!pLB->pBond)
  ------------------
  |  Branch (9306:21): [True: 0, False: 68]
  ------------------
 9307|      0|                {
 9308|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9309|      0|                    goto exit_function;
 9310|      0|                }
 9311|       |
 9312|     68|                if (j = pLB->pBond[i + 1].prev)
  ------------------
  |  Branch (9312:21): [True: 68, False: 0]
  ------------------
 9313|     68|                {
 9314|    422|                    while (k < MAXVAL)
  ------------------
  |  |   98|    422|#define MAXVAL                   20 /* max number of bonds per atom                 */
  ------------------
  |  Branch (9314:28): [True: 414, False: 8]
  ------------------
 9315|    414|                    {
 9316|    414|                        neighbor[k++] = pLB->pBond[j].neigh;
 9317|    414|                        if (j == i + 1)
  ------------------
  |  Branch (9317:29): [True: 60, False: 354]
  ------------------
 9318|     60|                            break;
 9319|    354|                        j = pLB->pBond[j].prev;
 9320|    354|                    }
 9321|     68|                }
 9322|     68|                if (j != i + 1)
  ------------------
  |  Branch (9322:21): [True: 8, False: 60]
  ------------------
 9323|      8|                {
 9324|      8|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      8|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9325|      8|                    goto exit_function;
 9326|      8|                }
 9327|       |
 9328|       |                /* sort the neighbors */
 9329|       |
 9330|     60|                insertions_sort_AT_NUMB( neighbor, k );
 9331|       |
 9332|     60|                if (m == pInChI[iComponent].lenConnTable)
  ------------------
  |  Branch (9332:21): [True: 0, False: 60]
  ------------------
 9333|      0|                {
 9334|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9335|      0|                    goto exit_function;
 9336|      0|                }
 9337|       |                
 9338|     60|#if ( FIX_GAF_2020_25726==1 )
 9339|    100|                for (j = 1; j < k ; j++)
  ------------------
  |  Branch (9339:29): [True: 52, False: 48]
  ------------------
 9340|     52|                {
 9341|     52|                    if (neighbor[j] == neighbor[j - 1])
  ------------------
  |  Branch (9341:25): [True: 12, False: 40]
  ------------------
 9342|     12|                    {
 9343|     12|                        ret = RI_ERR_SYNTAX; /* syntax error - same nbr twice, i.e. multiple bond between same atoms */
  ------------------
  |  |   44|     12|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9344|     12|                        goto exit_function;
 9345|     12|                    }
 9346|     52|                }
 9347|     48|#endif
 9348|     48|                pInChI[iComponent].nConnTable[m++] = i + 1; /* atom number */
 9349|     88|                for (j = 0; j < k && (int) neighbor[j] <= i; j++)
  ------------------
  |  Branch (9349:29): [True: 74, False: 14]
  |  Branch (9349:38): [True: 40, False: 34]
  ------------------
 9350|     40|                {
 9351|     40|                    if (m == pInChI[iComponent].lenConnTable)
  ------------------
  |  Branch (9351:25): [True: 0, False: 40]
  ------------------
 9352|      0|                    {
 9353|      0|                        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9354|      0|                        goto exit_function;
 9355|      0|                    }
 9356|     40|                    pInChI[iComponent].nConnTable[m++] = neighbor[j];
 9357|     40|                }
 9358|     48|            }
 9359|      8|            if (m != lenConnTable)
  ------------------
  |  Branch (9359:17): [True: 0, False: 8]
  ------------------
 9360|      0|            {
 9361|      0|                ret = RI_ERR_PROGR; /* program error */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 9362|      0|                goto exit_function;
 9363|      0|            }
 9364|      8|        }
 9365|      4|        else
 9366|      4|        {
 9367|      4|            pInChI[iComponent].nConnTable[0] = 1; /* single atom */
 9368|      4|        }
 9369|       |
 9370|       |        /* Duplicate if needed */
 9371|     12|        for (i = 1; i < mpy_component; i++)
  ------------------
  |  Branch (9371:21): [True: 0, False: 12]
  ------------------
 9372|      0|        {
 9373|       |            /*
 9374|       |            if ( pInChI[iComponent+i].nConnTable ) {
 9375|       |            inchi_free( pInChI[iComponent+i].nConnTable );
 9376|       |            }
 9377|       |            pInChI[iComponent+i].nConnTable = (AT_NUMB *)inchi_calloc( lenConnTable+1, sizeof(pInChI[0].nConnTable[0]) );
 9378|       |            if ( !pInChI[iComponent+i].nConnTable ) {
 9379|       |            ret = RI_ERR_ALLOC;
 9380|       |            goto exit_function;
 9381|       |            }
 9382|       |            */
 9383|      0|            if (!pInChI[iComponent + i].nConnTable || pInChI[iComponent + i].lenConnTable != lenConnTable)
  ------------------
  |  Branch (9383:17): [True: 0, False: 0]
  |  Branch (9383:55): [True: 0, False: 0]
  ------------------
 9384|      0|            {
 9385|      0|                ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 9386|      0|                goto exit_function;
 9387|      0|            }
 9388|      0|            memcpy( pInChI[iComponent + i].nConnTable, pInChI[iComponent].nConnTable, lenConnTable * sizeof( pInChI[0].nConnTable[0] ) );
 9389|      0|        }
 9390|       |        /* prepare for the next connection table */
 9391|     12|        iComponent += i;
 9392|     12|        if (*pEnd)
  ------------------
  |  Branch (9392:13): [True: 4, False: 8]
  ------------------
 9393|      4|            pStart = pEnd + 1;
 9394|      8|        else
 9395|      8|            break;
 9396|       |        /* We must check if we have already read as many components as we have in the fragment. */
 9397|       |        /* If yes, then we break, because anything else that might follow cannot be useful information. */
 9398|       |        /* There are files with a trailing ";" that would cause a problem (memory allocation bug) if we did not do this. */
 9399|      4|        if (iComponent == nNumComponents)
  ------------------
  |  Branch (9399:13): [True: 2, False: 2]
  ------------------
 9400|      2|            break;
 9401|      4|    }
 9402|     10|    ret = iComponent;
 9403|       |
 9404|     40|exit_function:
 9405|       |
 9406|     40|    if (pLB->pBond)
  ------------------
  |  Branch (9406:9): [True: 34, False: 6]
  ------------------
 9407|     34|    {
 9408|     34|        INCHI_HEAPCHK
 9409|     34|            inchi_free( pLB->pBond );
  ------------------
  |  | 1136|     34|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 34, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 9410|     34|    }
 9411|       |
 9412|     40|    return ret;
 9413|     10|#undef LAST_AT_LEN
 9414|     10|}
ichiread.c:AddLinkedBond:
10374|  16.6k|{
10375|  16.6k|    int nReqLen = inchi_max( 2 * num_at + 2, pLB->len + 2 );
  ------------------
  |  |  166|  16.6k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 2.02k, False: 14.6k]
  |  |  ------------------
  ------------------
10376|  16.6k|    AT_NUMB prev;
10377|  16.6k|#if ( FIX_GAF_2019_2==1 )
10378|  16.6k|    {
10379|  16.6k|        if (at2>num_at || at1>num_at || at1<0 || at2<0 || num_at>MAX_ATOMS)
  ------------------
  |  |   43|  16.6k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (10379:13): [True: 0, False: 16.6k]
  |  Branch (10379:27): [True: 0, False: 16.6k]
  |  Branch (10379:41): [True: 0, False: 16.6k]
  |  Branch (10379:50): [True: 0, False: 16.6k]
  |  Branch (10379:59): [True: 0, False: 16.6k]
  ------------------
10380|      0|        {
10381|      0|            return RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
10382|      0|        }
10383|  16.6k|    }
10384|  16.6k|#endif
10385|  16.6k|    if (pLB->len_alloc <= nReqLen)
  ------------------
  |  Branch (10385:9): [True: 153, False: 16.4k]
  ------------------
10386|    153|    {
10387|       |        /*int nNewLen = nReqLen + (nReqLen + LINKED_BOND_ADD - 1)%LINKED_BOND_ADD + LINKED_BOND_ADD;*/
10388|    153|        int nNewLen = nReqLen - nReqLen%LINKED_BOND_ADD + 2 * LINKED_BOND_ADD;
  ------------------
  |  |   91|    153|#define LINKED_BOND_ADD  128
  ------------------
                      int nNewLen = nReqLen - nReqLen%LINKED_BOND_ADD + 2 * LINKED_BOND_ADD;
  ------------------
  |  |   91|    153|#define LINKED_BOND_ADD  128
  ------------------
10389|    153|        ONE_LINKED_BOND *pBond = (ONE_LINKED_BOND *) inchi_calloc( nNewLen, sizeof( pBond[0] ) );
  ------------------
  |  | 1133|    153|#define inchi_calloc   calloc
  ------------------
10390|    153|        if (!pBond)
  ------------------
  |  Branch (10390:13): [True: 0, False: 153]
  ------------------
10391|      0|        {
10392|      0|            return RI_ERR_ALLOC; /* allocation error */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
10393|      0|        }
10394|    153|        if (pLB->pBond && pLB->len)
  ------------------
  |  Branch (10394:13): [True: 119, False: 34]
  |  Branch (10394:27): [True: 119, False: 0]
  ------------------
10395|    119|        {
10396|    119|            memcpy( pBond, pLB->pBond, pLB->len * sizeof( pBond[0] ) );
10397|    119|        }
10398|    153|        if (pLB->pBond)
  ------------------
  |  Branch (10398:13): [True: 119, False: 34]
  ------------------
10399|    119|            inchi_free( pLB->pBond );
  ------------------
  |  | 1136|    119|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 119, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
10400|    153|        pLB->pBond = pBond;
10401|    153|        pLB->len_alloc = nNewLen;
10402|    153|    }
10403|  16.6k|    if (!pLB->len)
  ------------------
  |  Branch (10403:9): [True: 34, False: 16.5k]
  ------------------
10404|     34|    {
10405|     34|        pLB->len = num_at + 1;
10406|     34|        memset( pLB->pBond, 0, ( num_at + 1 ) * sizeof( pLB->pBond[0] ) );
10407|     34|    }
10408|       |
10409|  16.6k|    prev = pLB->pBond[at1].prev; /* position of the last neighbor of at1 in the pLB->pBond */
10410|  16.6k|    if (!prev)
  ------------------
  |  Branch (10410:9): [True: 34, False: 16.5k]
  ------------------
10411|     34|    {
10412|     34|        pLB->pBond[at1].neigh = at2;
10413|     34|        pLB->pBond[at1].prev = at1;
10414|     34|    }
10415|  16.5k|    else
10416|  16.5k|    {
10417|  16.5k|        pLB->pBond[pLB->len].neigh = at2;
10418|  16.5k|        pLB->pBond[pLB->len].prev = prev;
10419|  16.5k|        pLB->pBond[at1].prev = pLB->len++;
10420|  16.5k|    }
10421|       |
10422|  16.6k|    prev = pLB->pBond[at2].prev; /* position of the last neighbor of at2 in the pLB->pBond */
10423|  16.6k|    if (!prev)
  ------------------
  |  Branch (10423:9): [True: 197, False: 16.4k]
  ------------------
10424|    197|    {
10425|    197|        pLB->pBond[at2].neigh = at1;
10426|    197|        pLB->pBond[at2].prev = at2;
10427|    197|    }
10428|  16.4k|    else
10429|  16.4k|    {
10430|  16.4k|        pLB->pBond[pLB->len].neigh = at1;
10431|  16.4k|        pLB->pBond[pLB->len].prev = prev;
10432|  16.4k|        pLB->pBond[at2].prev = pLB->len++;
10433|  16.4k|    }
10434|       |
10435|  16.6k|    return 0;
10436|  16.6k|}
ichiread.c:ParseSegmentMobileH:
 8016|    446|{
 8017|    446|#define nNum_H( ICOMPONENT ) ((bMobileH==TAUT_YES)? pInChI[ICOMPONENT].nNum_H : pInChI[ICOMPONENT].nNum_H_fixed)
 8018|       |
 8019|       |    /* Pass 1: count bonds and find actual numbers of  atom */
 8020|       |
 8021|    446|    int i, mpy_component, num_H, num_Minus, val, num_Atoms, numCtAtoms, tg_alloc_len, len, len2;
 8022|    446|    int num_H_component, num_H_formula, num_taut_H_component, num_H_InChI, ret2;
 8023|    446|    int nNumComponents, iComponent, nNumBonds, lenTautomer, tg_pos_Tautomer, iTGroup;
 8024|    446|    const char *p, *q, *h, *t, *p1, *pTaut, *pStart, *pEnd;
 8025|    446|    AT_NUMB curAtom, nxtAtom;
 8026|    446|    int  num_open, state, ret, nAltMobileH = ALT_TAUT( bMobileH );
  ------------------
  |  |  582|    446|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  580|    446|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (582:29): [True: 0, False: 446]
  |  |  ------------------
  ------------------
 8027|    446|    INChI *pInChI = pInpInChI[bMobileH];
 8028|    446|    INChI *pAltInChI = pInpInChI[nAltMobileH];
 8029|    446|    int  base = 10;
 8030|       |
 8031|    446|    num_H = -999;          /* impossible value */
 8032|    446|    num_Minus = -999;      /* impossible value */
 8033|    446|    tg_pos_Tautomer = -999; /* impossible value */
 8034|       |
 8035|       |                            /* number of immobile H is always allocated; immobile H are present in M layer only */
 8036|    446|    nNumComponents = pnNumComponents[bMobileH];
 8037|   338k|    for (i = 0; i < nNumComponents; i++)
  ------------------
  |  Branch (8037:17): [True: 337k, False: 446]
  ------------------
 8038|   337k|    {
 8039|   337k|        len = pInChI[i].nNumberOfAtoms;
 8040|   337k|        if (bMobileH == TAUT_NON && i < pnNumComponents[nAltMobileH])
  ------------------
  |  |  579|   675k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (8040:13): [True: 91.3k, False: 246k]
  |  Branch (8040:37): [True: 91.3k, False: 0]
  ------------------
 8041|  91.3k|        {
 8042|  91.3k|            if (len < pAltInChI[i].nNumberOfAtoms)
  ------------------
  |  Branch (8042:17): [True: 0, False: 91.3k]
  ------------------
 8043|      0|            {
 8044|      0|                len = pAltInChI[i].nNumberOfAtoms;
 8045|      0|                if (pInChI[i].nNum_H)
  ------------------
  |  Branch (8045:21): [True: 0, False: 0]
  ------------------
 8046|      0|                {
 8047|      0|                    inchi_free( pInChI[i].nNum_H );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 8048|      0|                    pInChI[i].nNum_H = NULL;
 8049|      0|                }
 8050|      0|            }
 8051|  91.3k|        }
 8052|   337k|        len++;
 8053|   337k|        if (!pInChI[i].nNum_H && /* allocate immobile H segment if it has not been allocated yet */
  ------------------
  |  Branch (8053:13): [True: 337k, False: 2]
  ------------------
 8054|   337k|             !( pInChI[i].nNum_H = (S_CHAR *) inchi_calloc( len, sizeof( pInChI[0].nNum_H[0] ) ) ))
  ------------------
  |  | 1133|   337k|#define inchi_calloc   calloc
  ------------------
  |  Branch (8054:14): [True: 0, False: 337k]
  ------------------
 8055|      0|        {
 8056|      0|            ret = RI_ERR_ALLOC; /* allocation error */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 8057|      0|            goto exit_function;
 8058|      0|        }
 8059|       |        /* copy immobile H from Mobile-H layer to Fixed-H layer */
 8060|   337k|        if (bMobileH == TAUT_NON && i < pnNumComponents[nAltMobileH])
  ------------------
  |  |  579|   675k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (8060:13): [True: 91.3k, False: 246k]
  |  Branch (8060:37): [True: 91.3k, False: 0]
  ------------------
 8061|  91.3k|        {
 8062|  91.3k|            memcpy( pInChI[i].nNum_H, pAltInChI[i].nNum_H, ( len - 1 ) * sizeof( pInChI[0].nNum_H[0] ) );
 8063|  91.3k|        }
 8064|   337k|    }
 8065|       |
 8066|    446|    if (str[0] != 'h')
  ------------------
  |  Branch (8066:9): [True: 326, False: 120]
  ------------------
 8067|    326|    {
 8068|    326|        return 0;
 8069|    326|    }
 8070|       |
 8071|       |    /* Read Hydrogen info in 1 pass */
 8072|       |    
 8073|    120|    pStart = (char  *) str + 1;
 8074|    120|    iComponent = 0;
 8075|    120|    nNumComponents = pnNumComponents[bMobileH];
 8076|       |
 8077|  1.64k|    while (1)
  ------------------
  |  Branch (8077:12): [Folded - Ignored]
  ------------------
 8078|  1.64k|    {
 8079|       |        /* cycle over components */
 8080|  1.64k|        if (!( pEnd = strchr( pStart, ';' ) ))
  ------------------
  |  Branch (8080:13): [True: 114, False: 1.53k]
  ------------------
 8081|    114|        {
 8082|    114|            pEnd = pStart + strlen( pStart );
 8083|    114|        }
 8084|  1.64k|        if (( p = strchr( pStart, '*' ) ) && p < pEnd)
  ------------------
  |  Branch (8084:13): [True: 1.53k, False: 114]
  |  Branch (8084:46): [True: 772, False: 762]
  ------------------
 8085|    772|        {
 8086|    772|            mpy_component = (int) inchi_strtol( pStart, &q, 10 );
 8087|    772|#if ( CHECK_STRTOL_ATNUMB==1 )
 8088|    772|            if (mpy_component>MAX_ATOMS || mpy_component<0)
  ------------------
  |  |   43|  1.54k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (8088:17): [True: 0, False: 772]
  |  Branch (8088:44): [True: 0, False: 772]
  ------------------
 8089|      0|            {
 8090|      0|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8091|      0|                goto exit_function;
 8092|      0|        }
 8093|    772|#endif
 8094|    772|#if ( FIX_DALKE_BUGS == 1 )
 8095|    772|            if (p != q || !isdigit( UCINT *pStart )) /* prevent non-positive multipliers */
  ------------------
  |  Branch (8095:17): [True: 6, False: 766]
  |  Branch (8095:27): [True: 0, False: 766]
  ------------------
 8096|       |#else
 8097|       |            if (p != q)
 8098|       |#endif
 8099|      6|            {
 8100|      6|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      6|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8101|      6|                goto exit_function;
 8102|      6|            }
 8103|    766|            p++;
 8104|    766|        }
 8105|    876|        else
 8106|    876|        {
 8107|    876|            mpy_component = 1;
 8108|    876|            p = pStart;
 8109|    876|        }
 8110|  1.64k|        pStart = p;
 8111|       |        /* Pass 1.1 parse a component */
 8112|  1.64k|        num_open = 0;
 8113|  1.64k|        state = '\0';   /* initial state */
 8114|  1.64k|        nNumBonds = 0;
 8115|  1.64k|        curAtom = 0;
 8116|  1.64k|        numCtAtoms = pInChI[iComponent].nNumberOfAtoms;
 8117|  1.64k|        if (bMobileH == TAUT_NON && iComponent < pnNumComponents[nAltMobileH])
  ------------------
  |  |  579|  3.28k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (8117:13): [True: 8, False: 1.63k]
  |  Branch (8117:37): [True: 8, False: 0]
  ------------------
 8118|      8|        {
 8119|      8|            numCtAtoms = pAltInChI[iComponent].nNumberOfAtoms;
 8120|      8|        }
 8121|       |
 8122|  1.64k|        if (p < pEnd && *pbAbc == -1)
  ------------------
  |  Branch (8122:13): [True: 112, False: 1.53k]
  |  Branch (8122:25): [True: 0, False: 112]
  ------------------
 8123|      0|        {
 8124|       |            /* check if compressed InChI */
 8125|      0|            *pbAbc = ( *p == ',' || isupper( UCINT *p ) ) ? 1 : 0;
  ------------------
  |  Branch (8125:24): [True: 0, False: 0]
  ------------------
 8126|      0|        }
 8127|  1.64k|        base = ( *pbAbc == 1 ) ? ALPHA_BASE : 10;
  ------------------
  |  |   96|      0|#define ALPHA_BASE  27
  ------------------
  |  Branch (8127:16): [True: 0, False: 1.64k]
  ------------------
 8128|       |
 8129|       |        /* immobile H */
 8130|  1.64k|        t = pTaut = ( *pbAbc == 1 ) ? strchr( p, ',' ) : strchr( p, '(' ); /* locate the first tautomer group character */
  ------------------
  |  Branch (8130:21): [True: 0, False: 1.64k]
  ------------------
 8131|       |
 8132|  1.64k|        if (t && bMobileH == TAUT_NON)
  ------------------
  |  |  579|     96|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (8132:13): [True: 96, False: 1.54k]
  |  Branch (8132:18): [True: 2, False: 94]
  ------------------
 8133|      2|        {
 8134|      2|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      2|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8135|      2|            goto exit_function;
 8136|      2|        }
 8137|  1.64k|        if (!pTaut || pTaut > pEnd)
  ------------------
  |  Branch (8137:13): [True: 1.54k, False: 94]
  |  Branch (8137:23): [True: 2, False: 92]
  ------------------
 8138|  1.54k|        {
 8139|  1.54k|            pTaut = pEnd;
 8140|  1.54k|            t = NULL; /* found no tautomeric group for this component */
 8141|  1.54k|        }
 8142|  3.28k|        for (i = 0; i < mpy_component; i++)
  ------------------
  |  Branch (8142:21): [True: 1.64k, False: 1.64k]
  ------------------
 8143|  1.64k|        {
 8144|  1.64k|            if (bMobileH == TAUT_NON)
  ------------------
  |  |  579|  1.64k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (8144:17): [True: 6, False: 1.64k]
  ------------------
 8145|      6|            {
 8146|       |                /* allocate nNum_H_fixed */
 8147|      6|                if (pInChI[iComponent + i].nNum_H_fixed)
  ------------------
  |  Branch (8147:21): [True: 0, False: 6]
  ------------------
 8148|      0|                {
 8149|      0|                    ret = RI_ERR_PROGR; /* program error */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 8150|      0|                    goto exit_function;
 8151|      0|                }
 8152|      6|                if (iComponent + i < pnNumComponents[nAltMobileH])
  ------------------
  |  Branch (8152:21): [True: 6, False: 0]
  ------------------
 8153|      6|                {
 8154|      6|                    len = inchi_max( pInChI[iComponent + i].nNumberOfAtoms, pAltInChI[iComponent + i].nNumberOfAtoms ) + 1;
  ------------------
  |  |  166|      6|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 6]
  |  |  ------------------
  ------------------
 8155|      6|                }
 8156|      0|                else
 8157|      0|                {
 8158|      0|                    len = pInChI[iComponent + i].nNumberOfAtoms + 1;
 8159|      0|                }
 8160|      6|                pInChI[iComponent + i].nNum_H_fixed = (S_CHAR *) inchi_calloc( len, sizeof( pInChI[0].nNum_H_fixed[0] ) );
  ------------------
  |  | 1133|      6|#define inchi_calloc   calloc
  ------------------
 8161|      6|                if (!pInChI[iComponent + i].nNum_H_fixed)
  ------------------
  |  Branch (8161:21): [True: 0, False: 6]
  ------------------
 8162|      0|                {
 8163|      0|                    ret = RI_ERR_ALLOC; /* allocation error */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 8164|      0|                    goto exit_function;
 8165|      0|                }
 8166|       |                /* compare nAtom */
 8167|      6|                if (iComponent + i < pnNumComponents[nAltMobileH])
  ------------------
  |  Branch (8167:21): [True: 6, False: 0]
  ------------------
 8168|      6|                {
 8169|      6|                    len2 = inchi_min( pInChI[iComponent + i].nNumberOfAtoms, pAltInChI[iComponent + i].nNumberOfAtoms );
  ------------------
  |  |  167|      6|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 6]
  |  |  ------------------
  ------------------
 8170|      6|                    if (pInChI[iComponent + i].nAtom && len2)
  ------------------
  |  Branch (8170:25): [True: 6, False: 0]
  |  Branch (8170:57): [True: 6, False: 0]
  ------------------
 8171|      6|                    {
 8172|       |                        /* check */
 8173|      6|                        if (memcmp( pInChI[iComponent + i].nAtom, pAltInChI[iComponent + i].nAtom, len2 * sizeof( pInChI[0].nAtom[0] ) ))
  ------------------
  |  Branch (8173:29): [True: 0, False: 6]
  ------------------
 8174|      0|                        {
 8175|      0|                            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8176|      0|                            goto exit_function;
 8177|      0|                        }
 8178|      6|                    }
 8179|       |                    /* allocate and copy atom if bridging H are present */
 8180|      6|                    if (pInChI[iComponent + i].nNumberOfAtoms < pAltInChI[iComponent + i].nNumberOfAtoms)
  ------------------
  |  Branch (8180:25): [True: 0, False: 6]
  ------------------
 8181|      0|                    {
 8182|      0|                        if (pInChI[iComponent + i].nAtom)
  ------------------
  |  Branch (8182:29): [True: 0, False: 0]
  ------------------
 8183|      0|                            inchi_free( pInChI[iComponent + i].nAtom );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 8184|      0|                        if (!( pInChI[iComponent + i].nAtom = (U_CHAR *) inchi_calloc( len, sizeof( pInChI[0].nAtom[0] ) ) ))
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  |  Branch (8184:29): [True: 0, False: 0]
  ------------------
 8185|      0|                        {
 8186|      0|                            ret = RI_ERR_ALLOC; /* allocation error */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 8187|      0|                            goto exit_function;
 8188|      0|                        }
 8189|      0|                        if (len > 1)
  ------------------
  |  Branch (8189:29): [True: 0, False: 0]
  ------------------
 8190|      0|                        {
 8191|      0|                            memcpy( pInChI[iComponent + i].nAtom, pAltInChI[iComponent + i].nAtom, ( len - 1 ) * sizeof( pInChI[0].nAtom[0] ) );
 8192|      0|                        }
 8193|       |                        /* correct number of atoms including bridging H */
 8194|      0|                        pInChI[iComponent + i].nNumberOfAtoms = pAltInChI[iComponent + i].nNumberOfAtoms;
 8195|      0|                    }
 8196|      6|                }
 8197|      6|            }
 8198|  1.64k|        }
 8199|       |
 8200|  1.64k|        if (*pbAbc == 1)
  ------------------
  |  Branch (8200:13): [True: 0, False: 1.64k]
  ------------------
 8201|      0|        {
 8202|       |            /* read numbers of H: XnYn... or XYn... */
 8203|      0|            p = pStart;
 8204|      0|            tg_alloc_len = 0;
 8205|      0|            num_H_component = num_taut_H_component = 0;
 8206|      0|            while (p < pTaut)
  ------------------
  |  Branch (8206:20): [True: 0, False: 0]
  ------------------
 8207|      0|            {
 8208|       |                /* syntax check: atom number */
 8209|      0|                if (!*p || !isupper( UCINT *p ))
  ------------------
  |  Branch (8209:21): [True: 0, False: 0]
  |  Branch (8209:28): [True: 0, False: 0]
  ------------------
 8210|      0|                {
 8211|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8212|      0|                    goto exit_function;
 8213|      0|                }
 8214|      0|                if (curAtom = nxtAtom = (int) inchi_strtol( p, &q, base ))
  ------------------
  |  Branch (8214:21): [True: 0, False: 0]
  ------------------
 8215|      0|                {
 8216|      0|                    p = q;
 8217|      0|                    if (isupper( UCINT *p ))
 8218|      0|                    {
 8219|      0|                        nxtAtom = (int) inchi_strtol( p, &q, base );
 8220|      0|#if ( CHECK_STRTOL_ATNUMB==1 )
 8221|      0|                        if (nxtAtom>MAX_ATOMS || nxtAtom<0)
  ------------------
  |  |   43|      0|#define MAX_ATOMS  32766
  ------------------
  |  Branch (8221:29): [True: 0, False: 0]
  |  Branch (8221:50): [True: 0, False: 0]
  ------------------
 8222|      0|                        {
 8223|      0|                            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8224|      0|                            goto exit_function;
 8225|      0|                        }
 8226|      0|#endif
 8227|      0|                        p = q;
 8228|      0|                    }
 8229|      0|                }
 8230|      0|                if (curAtom > nxtAtom || nxtAtom > numCtAtoms || p > pTaut)
  ------------------
  |  Branch (8230:21): [True: 0, False: 0]
  |  Branch (8230:42): [True: 0, False: 0]
  |  Branch (8230:66): [True: 0, False: 0]
  ------------------
 8231|      0|                {
 8232|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8233|      0|                    goto exit_function;
 8234|      0|                }
 8235|       |                /* number of H, may be negative */
 8236|      0|                if (!( num_H = (int) inchi_strtol( p, &q, 10 ) ) || q > pTaut)
  ------------------
  |  Branch (8236:21): [True: 0, False: 0]
  |  Branch (8236:69): [True: 0, False: 0]
  ------------------
 8237|      0|                {
 8238|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8239|      0|                    goto exit_function;
 8240|      0|                }
 8241|      0|                p = q;
 8242|       |                /* set number of H */
 8243|      0|                for (i = curAtom; i <= nxtAtom; i++)
  ------------------
  |  Branch (8243:35): [True: 0, False: 0]
  ------------------
 8244|      0|                {
 8245|      0|                    nNum_H( iComponent )[i - 1] = num_H;
  ------------------
  |  | 8017|      0|#define nNum_H( ICOMPONENT ) ((bMobileH==TAUT_YES)? pInChI[ICOMPONENT].nNum_H : pInChI[ICOMPONENT].nNum_H_fixed)
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (8017:31): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 8246|      0|                    num_H_component += num_H;
 8247|      0|                }
 8248|      0|            }
 8249|      0|            if (p != pTaut)
  ------------------
  |  Branch (8249:17): [True: 0, False: 0]
  ------------------
 8250|      0|            {
 8251|      0|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8252|      0|                goto exit_function;
 8253|      0|            }
 8254|      0|        }
 8255|  1.64k|        else
 8256|  1.64k|        {
 8257|       |            /* read numbers of H: 1-2,3H2,4,5H3 */
 8258|  1.64k|            p = pStart;
 8259|  1.64k|            tg_alloc_len = 0;
 8260|  1.64k|            num_H_component = num_taut_H_component = 0;
 8261|  1.64k|#if ( FIX_GAF_2019_1==1 )
 8262|  1.64k|            {
 8263|  1.64k|                char invalid;
 8264|  1.64k|                const char *str1 = str + 1;
 8265|  1.64k|                if (bMobileH == TAUT_NON)    /* FixedH layer "/h"*/
  ------------------
  |  |  579|  1.64k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (8265:21): [True: 6, False: 1.63k]
  ------------------
 8266|      6|                {
 8267|      6|                    invalid = str1[strspn(str1, "0123456789hDHT-,;()*")];
 8268|      6|                }
 8269|  1.63k|                else                        /* Main layer (mobileH) "/h"*/
 8270|  1.63k|                {
 8271|  1.63k|                    invalid = str1[strspn(str1, "0123456789DHT-,;()*")];
 8272|  1.63k|                }
 8273|  1.64k|                if (invalid != '\0')
  ------------------
  |  Branch (8273:21): [True: 4, False: 1.63k]
  ------------------
 8274|      4|                {
 8275|      4|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      4|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8276|      4|                    goto exit_function;
 8277|      4|                }
 8278|  1.64k|            }
 8279|  1.63k|#endif
 8280|  2.76k|            while (p < pTaut)
  ------------------
  |  Branch (8280:20): [True: 1.13k, False: 1.63k]
  ------------------
 8281|  1.13k|            {
 8282|       |                /* syntax check: atom number */
 8283|  1.13k|                if (!*p || !isdigit( UCINT *p ))
  ------------------
  |  Branch (8283:21): [True: 0, False: 1.13k]
  |  Branch (8283:28): [True: 2, False: 1.13k]
  ------------------
 8284|      2|                {
 8285|      2|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      2|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8286|      2|                    goto exit_function;
 8287|      2|                }
 8288|       |                /* number of H */
 8289|  1.13k|                h = p + strcspn( p, "Hh" );
 8290|       |                /*h = strchr( p, 'H' );*/
 8291|  1.13k|                if (!*h || h >= pTaut)
  ------------------
  |  Branch (8291:21): [True: 0, False: 1.13k]
  |  Branch (8291:28): [True: 0, False: 1.13k]
  ------------------
 8292|      0|                {
 8293|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8294|      0|                    goto exit_function;
 8295|       |                    /*
 8296|       |                    p = pTaut;
 8297|       |                    h = NULL;
 8298|       |                    break; */ /* no more H found */
 8299|      0|                }
 8300|  1.13k|                num_H = ( *h == 'H' ) ? 1 : ( *h == 'h' ) ? -1 : 0;
  ------------------
  |  Branch (8300:25): [True: 646, False: 488]
  |  Branch (8300:45): [True: 488, False: 0]
  ------------------
 8301|  1.13k|                if (!num_H)
  ------------------
  |  Branch (8301:21): [True: 0, False: 1.13k]
  ------------------
 8302|      0|                {
 8303|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8304|      0|                    goto exit_function;
 8305|      0|                }
 8306|  1.13k|                if (h[1] && isdigit( UCINT h[1] ))
  ------------------
  |  Branch (8306:21): [True: 1.11k, False: 16]
  ------------------
 8307|      8|                {
 8308|      8|                    num_H *= (int) inchi_strtol( h + 1, &p1, 10 );
 8309|      8|                }
 8310|  1.12k|                else
 8311|  1.12k|                {
 8312|  1.12k|                    p1 = h + 1; /* next set of immobile H */
 8313|  1.12k|                }
 8314|  1.13k|                if (*p1 == ',')
  ------------------
  |  Branch (8314:21): [True: 1.11k, False: 18]
  ------------------
 8315|  1.11k|                {
 8316|  1.11k|                    p1++;  /* next H-subsegment; otherwise (H or ; or end of the segment */
 8317|  1.11k|                }
 8318|       |                /* list of atoms that have num_H */
 8319|  2.39k|                while (p < h)
  ------------------
  |  Branch (8319:24): [True: 1.26k, False: 1.13k]
  ------------------
 8320|  1.26k|                {
 8321|  1.26k|                    if (!*p || !isdigit( UCINT *p ))
  ------------------
  |  Branch (8321:25): [True: 0, False: 1.26k]
  |  Branch (8321:32): [True: 0, False: 1.26k]
  ------------------
 8322|      0|                    {
 8323|      0|                        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8324|      0|                        goto exit_function;
 8325|      0|                    }
 8326|  1.26k|                    nxtAtom = curAtom = (int) inchi_strtol( p, &q, 10 );
 8327|  1.26k|                    if (*q == '-')
  ------------------
  |  Branch (8327:25): [True: 60, False: 1.20k]
  ------------------
 8328|     60|                    {
 8329|     60|                        nxtAtom = (int) inchi_strtol( q + 1, &q, 10 );
 8330|     60|#if ( CHECK_STRTOL_ATNUMB==1 )
 8331|     60|                        if (nxtAtom>MAX_ATOMS || nxtAtom<0)
  ------------------
  |  |   43|    120|#define MAX_ATOMS  32766
  ------------------
  |  Branch (8331:29): [True: 0, False: 60]
  |  Branch (8331:50): [True: 0, False: 60]
  ------------------
 8332|      0|                        {
 8333|      0|                            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8334|      0|                            goto exit_function;
 8335|      0|                        }
 8336|     60|#endif
 8337|     60|                    }
 8338|       |                    /* consitency check */
 8339|  1.26k|                    if (!curAtom || curAtom > numCtAtoms ||
  ------------------
  |  Branch (8339:25): [True: 0, False: 1.26k]
  |  Branch (8339:37): [True: 2, False: 1.26k]
  ------------------
 8340|  1.26k|                         nxtAtom < curAtom || nxtAtom > numCtAtoms)
  ------------------
  |  Branch (8340:26): [True: 0, False: 1.26k]
  |  Branch (8340:47): [True: 0, False: 1.26k]
  ------------------
 8341|      2|                    {
 8342|      2|                        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      2|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8343|      2|                        goto exit_function;
 8344|      2|                    }
 8345|       |                    /* set number of H */
 8346|  2.52k|                    for (i = curAtom; i <= nxtAtom; i++)
  ------------------
  |  Branch (8346:39): [True: 1.26k, False: 1.26k]
  ------------------
 8347|  1.26k|                    {
 8348|  1.26k|                        nNum_H( iComponent )[i - 1] = num_H;
  ------------------
  |  | 8017|  1.26k|#define nNum_H( ICOMPONENT ) ((bMobileH==TAUT_YES)? pInChI[ICOMPONENT].nNum_H : pInChI[ICOMPONENT].nNum_H_fixed)
  |  |  ------------------
  |  |  |  |  580|  1.26k|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (8017:31): [True: 12, False: 1.25k]
  |  |  ------------------
  ------------------
 8349|  1.26k|                        num_H_component += num_H;
 8350|  1.26k|                    }
 8351|       |                    /* move to the next atom number if any */
 8352|  1.26k|                    p = q;
 8353|  1.26k|                    if (*p == ',')
  ------------------
  |  Branch (8353:25): [True: 130, False: 1.13k]
  ------------------
 8354|    130|                    {
 8355|    130|                        p++;
 8356|    130|                    }
 8357|  1.26k|                }
 8358|       |
 8359|  1.13k|                if (p == h)
  ------------------
  |  Branch (8359:21): [True: 1.13k, False: 0]
  ------------------
 8360|  1.13k|                {
 8361|  1.13k|                    p = p1;
 8362|  1.13k|                }
 8363|      0|                else
 8364|      0|                {
 8365|      0|                    if (p == pTaut)
  ------------------
  |  Branch (8365:25): [True: 0, False: 0]
  ------------------
 8366|      0|                    {
 8367|      0|                        break;
 8368|      0|                    }
 8369|      0|                    else
 8370|      0|                    {
 8371|      0|                        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8372|      0|                        goto exit_function;
 8373|      0|                    }
 8374|      0|                }
 8375|  1.13k|            }
 8376|  1.63k|        }
 8377|       |
 8378|       |        INCHI_HEAPCHK
 8379|       |            /* ) -> (, H, N, [-, N,], AtNum,... AtNum) */
 8380|  1.63k|            lenTautomer = 0;
 8381|  1.63k|        if (p = t)
  ------------------
  |  Branch (8381:13): [True: 88, False: 1.54k]
  ------------------
 8382|     88|        {
 8383|     88|            if (*pbAbc == 1)
  ------------------
  |  Branch (8383:17): [True: 0, False: 88]
  ------------------
 8384|      0|            {
 8385|       |                /* tautomeric groups: pass 1 */
 8386|      0|                iTGroup = 0;
 8387|      0|                state = ')';  /* init as if the prev. t-group just ended */
 8388|      0|                num_Atoms = 0;
 8389|       |                /* Tautomeric info storage */
 8390|       |                /* NumGroups; ((NumAt+2, NumH, Num(-), At1..AtNumAt),...); {INCHI_T_NUM_MOVABLE = 2} */
 8391|       |                /* Allocated length: [5*nNumberOfAtoms/2+1], see Alloc_INChI(...) */
 8392|      0|                if (*p == ',')
  ------------------
  |  Branch (8392:21): [True: 0, False: 0]
  ------------------
 8393|      0|                { /* start t-group */
 8394|      0|                    p++;
 8395|      0|                }
 8396|      0|                else
 8397|      0|                {
 8398|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8399|      0|                    goto exit_function;
 8400|      0|                }
 8401|      0|                while (p < pEnd)
  ------------------
  |  Branch (8401:24): [True: 0, False: 0]
  ------------------
 8402|      0|                {
 8403|       |                    /* start t-group */
 8404|      0|                    if (!isdigit( UCINT *p ) || !( num_H = (int) inchi_strtol( p, &q, 10 ) ) || q > pEnd)
  ------------------
  |  Branch (8404:25): [True: 0, False: 0]
  |  Branch (8404:49): [True: 0, False: 0]
  |  Branch (8404:97): [True: 0, False: 0]
  ------------------
 8405|      0|                    {
 8406|      0|                        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8407|      0|                        goto exit_function;
 8408|      0|                    }
 8409|      0|                    p = q;
 8410|      0|                    num_Minus = 0;
 8411|      0|                    if (*p == '-')
  ------------------
  |  Branch (8411:25): [True: 0, False: 0]
  ------------------
 8412|      0|                    {
 8413|      0|                        p++;
 8414|      0|                        if (isdigit( UCINT *p ))
 8415|      0|                        {
 8416|      0|                            num_Minus = (int) inchi_strtol( p, &q, 10 );
 8417|      0|                            p = q;
 8418|      0|                        }
 8419|      0|                        else
 8420|      0|                        {
 8421|      0|                            num_Minus = 1;
 8422|      0|                        }
 8423|      0|                    }
 8424|      0|                    if (p >= pEnd)
  ------------------
  |  Branch (8424:25): [True: 0, False: 0]
  ------------------
 8425|      0|                    {
 8426|      0|                        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8427|      0|                        goto exit_function;
 8428|      0|                    }
 8429|      0|                    if (!tg_alloc_len)
  ------------------
  |  Branch (8429:25): [True: 0, False: 0]
  ------------------
 8430|      0|                    {
 8431|       |                        /*
 8432|       |                        --- header ---
 8433|       |                        [num_t_groups]
 8434|       |                        --- one t-group: ---
 8435|       |                        [len=group length no including this value]
 8436|       |                        [num_H]
 8437|       |                        [num_(-)]
 8438|       |                        [Endpoint(1),...,Endpoint(len-2)]
 8439|       |                        --- next t-group ---
 8440|       |                        ...
 8441|       |
 8442|       |                        Max. size = 1 + 3*max_num_t_groups + max_num_endpoints
 8443|       |
 8444|       |                        max_num_t_groups  = num_at/2
 8445|       |                        max_num_endpoints = num_at
 8446|       |
 8447|       |                        Max. size = 1 + 3*(num_at/2) + num_at = 1 + (5*num_at)/2
 8448|       |                        5 = 3 + INCHI_T_NUM_MOVABLE = 3 + num_types_of_attachments
 8449|       |
 8450|       |                        This does not include zero termination!
 8451|       |
 8452|       |                        */
 8453|      0|                        tg_alloc_len = ( ( 3 + INCHI_T_NUM_MOVABLE )*pInChI[iComponent].nNumberOfAtoms ) / 2 + 1;
  ------------------
  |  |  752|      0|#define INCHI_T_NUM_MOVABLE  2
  ------------------
 8454|      0|                        for (i = 0; i < mpy_component; i++)
  ------------------
  |  Branch (8454:37): [True: 0, False: 0]
  ------------------
 8455|      0|                        {
 8456|      0|                            pInChI[iComponent + i].nTautomer = (AT_NUMB*) inchi_calloc( tg_alloc_len + 1, sizeof( pInChI->nTautomer[0] ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 8457|      0|                            if (!pInChI[iComponent + i].nTautomer)
  ------------------
  |  Branch (8457:33): [True: 0, False: 0]
  ------------------
 8458|      0|                            {
 8459|      0|                                ret = RI_ERR_ALLOC; /* allocation error */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 8460|      0|                                goto exit_function;
 8461|      0|                            }
 8462|      0|                            pInChI[iComponent + i].lenTautomer = 0;
 8463|      0|                        }
 8464|      0|                        tg_pos_Tautomer = 1; /* number atoms (NumAt+2) position */
 8465|      0|                    }
 8466|      0|                    else
 8467|      0|                    {
 8468|       |                        /* next t-group */
 8469|      0|                        tg_pos_Tautomer = lenTautomer;
 8470|      0|                    }
 8471|      0|                    if (tg_pos_Tautomer + 3 >= tg_alloc_len)
  ------------------
  |  Branch (8471:25): [True: 0, False: 0]
  ------------------
 8472|      0|                    {
 8473|      0|                        ret = RI_ERR_PROGR; /* wrong tautomer array length */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 8474|      0|                        goto exit_function;
 8475|      0|                    }
 8476|      0|                    pInChI[iComponent].nTautomer[tg_pos_Tautomer + 1] = num_H;
 8477|      0|                    pInChI[iComponent].nTautomer[tg_pos_Tautomer + 2] = num_Minus;
 8478|      0|                    lenTautomer = tg_pos_Tautomer + 3; /* first atom number position */
 8479|      0|                    num_taut_H_component += num_H;
 8480|       |
 8481|      0|                    while (p < pEnd && isupper( UCINT *p ))
  ------------------
  |  Branch (8481:28): [True: 0, False: 0]
  ------------------
 8482|      0|                    {
 8483|       |                        /* read list of tautomeric atoms */
 8484|      0|                        val = (int) inchi_strtol( p, &q, base );
 8485|      0|                        if (lenTautomer >= tg_alloc_len || val > numCtAtoms)
  ------------------
  |  Branch (8485:29): [True: 0, False: 0]
  |  Branch (8485:60): [True: 0, False: 0]
  ------------------
 8486|      0|                        {
 8487|      0|                            ret = RI_ERR_PROGR; /* wrong tautomer array length */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 8488|      0|                            goto exit_function;
 8489|      0|                        }
 8490|      0|                        num_Atoms++;
 8491|      0|                        pInChI[iComponent].nTautomer[lenTautomer++] = val;
 8492|      0|                        p = q;
 8493|      0|                    }
 8494|      0|                    if (!num_Atoms || p < pEnd && !isdigit( UCINT *p ))
  ------------------
  |  Branch (8494:25): [True: 0, False: 0]
  |  Branch (8494:39): [True: 0, False: 0]
  |  Branch (8494:51): [True: 0, False: 0]
  ------------------
 8495|      0|                    {
 8496|      0|                        ret = RI_ERR_PROGR; /* wrong tautomer array length */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 8497|      0|                        goto exit_function;
 8498|      0|                    }
 8499|      0|                    iTGroup++;
 8500|      0|                    pInChI[iComponent].nTautomer[tg_pos_Tautomer] = lenTautomer - tg_pos_Tautomer - 1; /* length of the rest of the t-group */
 8501|      0|                    pInChI[iComponent].lenTautomer = lenTautomer;
 8502|      0|                }
 8503|      0|                if (!iTGroup || p != pEnd)
  ------------------
  |  Branch (8503:21): [True: 0, False: 0]
  |  Branch (8503:33): [True: 0, False: 0]
  ------------------
 8504|      0|                {
 8505|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8506|      0|                    goto exit_function;
 8507|      0|                }
 8508|      0|                pInChI[iComponent].nTautomer[0] = iTGroup;
 8509|      0|            }
 8510|     88|            else
 8511|     88|            {
 8512|       |                /* tautomeric groups: pass 1 */
 8513|     88|                iTGroup = 0;
 8514|     88|                state = ')';  /* init as if the prev. t-group just ended */
 8515|     88|                num_Atoms = 0;
 8516|       |                /* Tautomeric info storage */
 8517|       |                /* NumGroups; ((NumAt+2, NumH, Num(-), At1..AtNumAt),...); {INCHI_T_NUM_MOVABLE = 2} */
 8518|       |                /* Allocated length: [5*nNumberOfAtoms/2+1], see Alloc_INChI(...) */
 8519|   223k|                while (p < pEnd)
  ------------------
  |  Branch (8519:24): [True: 223k, False: 82]
  ------------------
 8520|   223k|                {
 8521|       |                    /* t-group */
 8522|   223k|                    switch (*p)
 8523|   223k|                    {
 8524|  3.14k|                        case '(': /* start t-group */
  ------------------
  |  Branch (8524:25): [True: 3.14k, False: 220k]
  ------------------
 8525|  3.14k|                            switch (state)
 8526|  3.14k|                            {
 8527|  3.14k|                                case ')':
  ------------------
  |  Branch (8527:33): [True: 3.14k, False: 0]
  ------------------
 8528|  3.14k|                                    state = *p++;
 8529|  3.14k|                                    num_H = 0;
 8530|  3.14k|                                    num_Minus = 0;
 8531|  3.14k|                                    continue;
 8532|      0|                                default:
  ------------------
  |  Branch (8532:33): [True: 0, False: 3.14k]
  ------------------
 8533|      0|                                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8534|      0|                                    goto exit_function;
 8535|  3.14k|                            }
 8536|  3.14k|                        case ')': /* end t-group */
  ------------------
  |  Branch (8536:25): [True: 3.14k, False: 220k]
  ------------------
 8537|  3.14k|                            switch (state)
 8538|  3.14k|                            {
 8539|  3.14k|                                case 'A': /* previuos was atom number */
  ------------------
  |  Branch (8539:33): [True: 3.14k, False: 1]
  ------------------
 8540|  3.14k|                                    if (!tg_alloc_len)
  ------------------
  |  Branch (8540:41): [True: 0, False: 3.14k]
  ------------------
 8541|      0|                                    {
 8542|      0|                                        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8543|      0|                                        goto exit_function;
 8544|      0|                                    }
 8545|  3.14k|                                    iTGroup++;
 8546|  3.14k|                                    state = *p++;
 8547|  3.14k|                                    pInChI[iComponent].nTautomer[tg_pos_Tautomer] = lenTautomer - tg_pos_Tautomer - 1; /* length of the rest of the t-group */
 8548|  3.14k|                                    pInChI[iComponent].lenTautomer = lenTautomer;
 8549|  3.14k|                                    continue;
 8550|      1|                                default:
  ------------------
  |  Branch (8550:33): [True: 1, False: 3.14k]
  ------------------
 8551|      1|                                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      1|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8552|      1|                                    goto exit_function;
 8553|  3.14k|                            }
 8554|  3.14k|                        case 'H': /* number of H */
  ------------------
  |  Branch (8554:25): [True: 3.14k, False: 220k]
  ------------------
 8555|  3.14k|                            switch (state)
 8556|  3.14k|                            {
 8557|  3.14k|                                case '(':
  ------------------
  |  Branch (8557:33): [True: 3.14k, False: 0]
  ------------------
 8558|  3.14k|                                    state = *p++;
 8559|  3.14k|                                    num_H = 1;
 8560|  3.14k|                                    continue;
 8561|      0|                                default:
  ------------------
  |  Branch (8561:33): [True: 0, False: 3.14k]
  ------------------
 8562|      0|                                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8563|      0|                                    goto exit_function;
 8564|  3.14k|                            }
 8565|    198|                        case '-':  /* number of (-) */
  ------------------
  |  Branch (8565:25): [True: 198, False: 223k]
  ------------------
 8566|    198|                            switch (state)
 8567|    198|                            {
 8568|     56|                                case 'N': /* previous was number of H */
  ------------------
  |  Branch (8568:33): [True: 56, False: 142]
  ------------------
 8569|    196|                                case 'H': /* previous was H */
  ------------------
  |  Branch (8569:33): [True: 140, False: 58]
  ------------------
 8570|    196|                                    state = *p++;
 8571|    196|                                    num_Minus = 1;
 8572|    196|                                    continue;
 8573|      2|                                default:
  ------------------
  |  Branch (8573:33): [True: 2, False: 196]
  ------------------
 8574|      2|                                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      2|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8575|      2|                                    goto exit_function;
 8576|    198|                            }
 8577|   105k|                        case ',':
  ------------------
  |  Branch (8577:25): [True: 105k, False: 118k]
  ------------------
 8578|   105k|                            switch (state)
 8579|   105k|                            {
 8580|  2.91k|                                case 'N': /* previous was number of H */
  ------------------
  |  Branch (8580:33): [True: 2.91k, False: 102k]
  ------------------
 8581|  2.95k|                                case 'H': /* previous was H */
  ------------------
  |  Branch (8581:33): [True: 32, False: 105k]
  ------------------
 8582|  3.14k|                                case '-': /* previuos was - */
  ------------------
  |  Branch (8582:33): [True: 192, False: 105k]
  ------------------
 8583|  3.14k|                                case 'M': /* previous was number of (-) */
  ------------------
  |  Branch (8583:33): [True: 2, False: 105k]
  ------------------
 8584|       |                                          /* the next must be the first tautomeric atom number; save num_H & num_Minus */
 8585|  3.14k|                                    if (num_H <= 0 && num_Minus <= 0)
  ------------------
  |  Branch (8585:41): [True: 0, False: 3.14k]
  |  Branch (8585:55): [True: 0, False: 0]
  ------------------
 8586|      0|                                    {
 8587|      0|                                        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8588|      0|                                        goto exit_function;
 8589|      0|                                    }
 8590|  3.14k|                                    if (!tg_alloc_len)
  ------------------
  |  Branch (8590:41): [True: 85, False: 3.06k]
  ------------------
 8591|     85|                                    {
 8592|       |                                        /*
 8593|       |                                        --- header ---
 8594|       |                                        [num_t_groups]
 8595|       |                                        --- one t-group: ---
 8596|       |                                        [len=group length no including this value]
 8597|       |                                        [num_H]
 8598|       |                                        [num_(-)]
 8599|       |                                        [Endpoint(1),...,Endpoint(len-2)]
 8600|       |                                        --- next t-group ---
 8601|       |                                        ...
 8602|       |
 8603|       |                                        Max. size = 1 + 3*max_num_t_groups + max_num_endpoints
 8604|       |
 8605|       |                                        max_num_t_groups  = num_at/2
 8606|       |                                        max_num_endpoints = num_at
 8607|       |
 8608|       |                                        Max. size = 1 + 3*(num_at/2) + num_at = 1 + (5*num_at)/2
 8609|       |                                        5 = 3 + INCHI_T_NUM_MOVABLE = 3 + num_types_of_attachments
 8610|       |
 8611|       |                                        This does not include zero termination!
 8612|       |
 8613|       |                                        */
 8614|     85|                                        tg_alloc_len = ( ( 3 + INCHI_T_NUM_MOVABLE )*pInChI[iComponent].nNumberOfAtoms ) / 2 + 1;
  ------------------
  |  |  752|     85|#define INCHI_T_NUM_MOVABLE  2
  ------------------
 8615|    170|                                        for (i = 0; i < mpy_component; i++)
  ------------------
  |  Branch (8615:53): [True: 85, False: 85]
  ------------------
 8616|     85|                                        {
 8617|     85|                                            pInChI[iComponent + i].nTautomer = (AT_NUMB*) inchi_calloc( tg_alloc_len + 1, sizeof( pInChI->nTautomer[0] ) );
  ------------------
  |  | 1133|     85|#define inchi_calloc   calloc
  ------------------
 8618|     85|                                            if (!pInChI[iComponent + i].nTautomer)
  ------------------
  |  Branch (8618:49): [True: 0, False: 85]
  ------------------
 8619|      0|                                            {
 8620|      0|                                                ret = RI_ERR_ALLOC; /* allocation error */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 8621|      0|                                                goto exit_function;
 8622|      0|                                            }
 8623|     85|                                            pInChI[iComponent + i].lenTautomer = 0;
 8624|     85|                                        }
 8625|     85|                                        tg_pos_Tautomer = 1; /* number atoms (NumAt+2) position */
 8626|     85|                                    }
 8627|  3.06k|                                    else
 8628|  3.06k|                                    {
 8629|       |                                        /* next t-group */
 8630|  3.06k|                                        tg_pos_Tautomer = lenTautomer;
 8631|  3.06k|                                    }
 8632|  3.14k|                                    if (tg_pos_Tautomer + 3 >= tg_alloc_len)
  ------------------
  |  Branch (8632:41): [True: 1, False: 3.14k]
  ------------------
 8633|      1|                                    {
 8634|      1|                                        ret = RI_ERR_PROGR; /* wrong tautomer array length */
  ------------------
  |  |   45|      1|#define RI_ERR_PROGR   (-3)
  ------------------
 8635|      1|                                        goto exit_function;
 8636|      1|                                    }
 8637|  3.14k|                                    pInChI[iComponent].nTautomer[tg_pos_Tautomer + 1] = num_H;
 8638|  3.14k|                                    pInChI[iComponent].nTautomer[tg_pos_Tautomer + 2] = num_Minus;
 8639|  3.14k|                                    lenTautomer = tg_pos_Tautomer + 3; /* first atom number position */
 8640|  3.14k|                                    num_taut_H_component += num_H;
 8641|  3.14k|                                    state = *p++;
 8642|  3.14k|                                    continue;
 8643|   102k|                                case 'A':
  ------------------
  |  Branch (8643:33): [True: 102k, False: 3.14k]
  ------------------
 8644|       |                                    /* previuos was atom number */
 8645|   102k|                                    state = *p++;
 8646|   102k|                                    continue;
 8647|      0|                                default:
  ------------------
  |  Branch (8647:33): [True: 0, False: 105k]
  ------------------
 8648|      0|                                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8649|      0|                                    goto exit_function;
 8650|   105k|                            }
 8651|   108k|                        default:
  ------------------
  |  Branch (8651:25): [True: 108k, False: 115k]
  ------------------
 8652|   108k|                            if (isdigit( UCINT *p ))
 8653|   108k|                            {
 8654|   108k|                                val = (int) inchi_strtol( p, &q, 10 );
 8655|   108k|                                if (val <= 0)
  ------------------
  |  Branch (8655:37): [True: 0, False: 108k]
  ------------------
 8656|      0|                                {
 8657|      0|                                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8658|      0|                                    goto exit_function;
 8659|      0|                                }
 8660|   108k|                                p = q;
 8661|   108k|                                switch (state)
 8662|   108k|                                {
 8663|  2.97k|                                    case 'H':
  ------------------
  |  Branch (8663:37): [True: 2.97k, False: 105k]
  ------------------
 8664|  2.97k|                                        num_H = val;
 8665|  2.97k|                                        state = 'N';
 8666|  2.97k|                                        continue;
 8667|      4|                                    case '-':
  ------------------
  |  Branch (8667:37): [True: 4, False: 108k]
  ------------------
 8668|      4|                                        num_Minus = val;
 8669|      4|                                        state = 'M';
 8670|      4|                                        continue;
 8671|   105k|                                    case ',':
  ------------------
  |  Branch (8671:37): [True: 105k, False: 2.98k]
  ------------------
 8672|   105k|                                        if (lenTautomer >= tg_alloc_len || val > numCtAtoms)
  ------------------
  |  Branch (8672:45): [True: 0, False: 105k]
  |  Branch (8672:76): [True: 0, False: 105k]
  ------------------
 8673|      0|                                        {
 8674|      0|                                            ret = RI_ERR_PROGR; /* wrong tautomer array length */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 8675|      0|                                            goto exit_function;
 8676|      0|                                        }
 8677|   105k|                                        num_Atoms++;
 8678|   105k|                                        pInChI[iComponent].nTautomer[lenTautomer++] = val;
 8679|   105k|                                        state = 'A';
 8680|   105k|                                        continue;
 8681|      2|                                    default:
  ------------------
  |  Branch (8681:37): [True: 2, False: 108k]
  ------------------
 8682|      2|                                        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      2|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8683|      2|                                        goto exit_function;
 8684|   108k|                                }
 8685|   108k|                            }
 8686|      0|                            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8687|      0|                            goto exit_function;
 8688|   223k|                    }
 8689|   223k|                }
 8690|     82|                if (!iTGroup || state != ')')
  ------------------
  |  Branch (8690:21): [True: 0, False: 82]
  |  Branch (8690:33): [True: 0, False: 82]
  ------------------
 8691|      0|                {
 8692|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8693|      0|                    goto exit_function;
 8694|      0|                }
 8695|     82|                pInChI[iComponent].nTautomer[0] = iTGroup;
 8696|     82|            }
 8697|     88|        }
 8698|       |        /* check num_H in components; for bMobileH=TAUT_NON, pInChI->nNum_H_fixed[] has not been added to pInChI->nNum_H[] yet */
 8699|  1.62k|        if (0 > ( ret2 = GetInChIFormulaNumH( pInChI + iComponent, &num_H_formula ) ) ||
  ------------------
  |  Branch (8699:13): [True: 0, False: 1.62k]
  ------------------
 8700|  1.62k|             0 > ( ret2 = GetInChINumH( pInChI + iComponent, &num_H_InChI ) ))
  ------------------
  |  Branch (8700:14): [True: 0, False: 1.62k]
  ------------------
 8701|      0|        {
 8702|      0|            ret = ret2;
 8703|      0|            goto exit_function;
 8704|      0|        }
 8705|  1.62k|        if (num_H_formula != num_H_InChI + ( bMobileH == TAUT_NON ? num_H_component : 0 ))
  ------------------
  |  |  579|  1.62k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (8705:13): [True: 6, False: 1.62k]
  |  Branch (8705:46): [True: 2, False: 1.62k]
  ------------------
 8706|      6|        {
 8707|      6|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      6|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8708|      6|            goto exit_function;
 8709|      6|        }
 8710|       |
 8711|       |        /* duplicate according to multiplication */
 8712|  1.62k|        for (i = 1; i < mpy_component; i++)
  ------------------
  |  Branch (8712:21): [True: 8, False: 1.62k]
  ------------------
 8713|      8|        {
 8714|      8|#if ( FIX_GAF_2019_2==1 )
 8715|      8|            if ((iComponent + i> nNumComponents - 1) || (iComponent + i<0))
  ------------------
  |  Branch (8715:17): [True: 0, False: 8]
  |  Branch (8715:57): [True: 0, False: 8]
  ------------------
 8716|      0|            {
 8717|      0|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8718|      0|                goto exit_function;
 8719|      0|            }
 8720|      8|            if ((pInChI[iComponent + i].nNumberOfAtoms <= 0) || (pInChI[iComponent + i].nNumberOfAtoms>MAX_ATOMS))
  ------------------
  |  |   43|      8|#define MAX_ATOMS  32766
  ------------------
  |  Branch (8720:17): [True: 0, False: 8]
  |  Branch (8720:65): [True: 0, False: 8]
  ------------------
 8721|      0|            {
 8722|      0|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8723|      0|                goto exit_function;
 8724|      0|            }
 8725|      8|#endif
 8726|      8|            memcpy( nNum_H( iComponent + i ), nNum_H( iComponent ), pInChI[iComponent + i].nNumberOfAtoms * sizeof( nNum_H( 0 )[0] ) );
  ------------------
  |  | 8017|      8|#define nNum_H( ICOMPONENT ) ((bMobileH==TAUT_YES)? pInChI[ICOMPONENT].nNum_H : pInChI[ICOMPONENT].nNum_H_fixed)
  |  |  ------------------
  |  |  |  |  580|      8|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (8017:31): [True: 8, False: 0]
  |  |  ------------------
  ------------------
                          memcpy( nNum_H( iComponent + i ), nNum_H( iComponent ), pInChI[iComponent + i].nNumberOfAtoms * sizeof( nNum_H( 0 )[0] ) );
  ------------------
  |  | 8017|      8|#define nNum_H( ICOMPONENT ) ((bMobileH==TAUT_YES)? pInChI[ICOMPONENT].nNum_H : pInChI[ICOMPONENT].nNum_H_fixed)
  |  |  ------------------
  |  |  |  |  580|      8|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (8017:31): [True: 8, False: 0]
  |  |  ------------------
  ------------------
                          memcpy( nNum_H( iComponent + i ), nNum_H( iComponent ), pInChI[iComponent + i].nNumberOfAtoms * sizeof( nNum_H( 0 )[0] ) );
  ------------------
  |  | 8017|      8|#define nNum_H( ICOMPONENT ) ((bMobileH==TAUT_YES)? pInChI[ICOMPONENT].nNum_H : pInChI[ICOMPONENT].nNum_H_fixed)
  |  |  ------------------
  |  |  |  |  580|      8|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (8017:31): [True: 0, False: 8]
  |  |  ------------------
  ------------------
 8727|       |            /*
 8728|       |            memcpy( pInChI[iComponent+i].nNum_H, pInChI[iComponent].nNum_H,
 8729|       |            pInChI[iComponent+i].nNumberOfAtoms * sizeof(pInChI[0].nNum_H[0]) );
 8730|       |            */
 8731|      8|            if (pInChI[iComponent + i].nTautomer && pInChI[iComponent].nTautomer && pInChI[iComponent].lenTautomer)
  ------------------
  |  Branch (8731:17): [True: 0, False: 8]
  |  Branch (8731:53): [True: 0, False: 0]
  |  Branch (8731:85): [True: 0, False: 0]
  ------------------
 8732|      0|            {
 8733|      0|                memcpy( pInChI[iComponent + i].nTautomer, pInChI[iComponent].nTautomer,
 8734|      0|                        pInChI[iComponent].lenTautomer * sizeof( pInChI[0].nTautomer[0] ) );
 8735|      0|                pInChI[iComponent + i].lenTautomer = pInChI[iComponent].lenTautomer;
 8736|      0|            }
 8737|       |            /* check num_H in components */
 8738|      8|            if (0 > ( ret2 = GetInChIFormulaNumH( pInChI + iComponent + i, &num_H_formula ) ) ||
  ------------------
  |  Branch (8738:17): [True: 0, False: 8]
  ------------------
 8739|      8|                 0 > ( ret2 = GetInChINumH( pInChI + iComponent + i, &num_H_InChI ) ))
  ------------------
  |  Branch (8739:18): [True: 0, False: 8]
  ------------------
 8740|      0|            {
 8741|      0|                ret = ret2;
 8742|      0|                goto exit_function;
 8743|      0|            }
 8744|      8|            if (num_H_formula != num_H_InChI + ( bMobileH == TAUT_NON ? num_H_component : 0 ))
  ------------------
  |  |  579|      8|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (8744:17): [True: 0, False: 8]
  |  Branch (8744:50): [True: 0, False: 8]
  ------------------
 8745|      0|            {
 8746|      0|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8747|      0|                goto exit_function;
 8748|      0|            }
 8749|      8|        }
 8750|       |
 8751|       |        /* prepare for the next component */
 8752|  1.62k|        iComponent += i;
 8753|  1.62k|        if (*pEnd)
  ------------------
  |  Branch (8753:13): [True: 1.53k, False: 88]
  ------------------
 8754|  1.53k|        {
 8755|  1.53k|#if (FIX_DALKE_BUGS == 1)
 8756|       |            /* prevent crash on extra trailing ';' */
 8757|  1.53k|            if (iComponent >= nNumComponents)
  ------------------
  |  Branch (8757:17): [True: 4, False: 1.52k]
  ------------------
 8758|      4|            {
 8759|      4|                ret = RI_ERR_SYNTAX; /* syntax error: extra component */
  ------------------
  |  |   44|      4|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8760|      4|                goto exit_function;
 8761|      4|            }
 8762|  1.52k|#endif
 8763|  1.52k|            pStart = pEnd + 1;
 8764|  1.52k|        }
 8765|     88|        else
 8766|     88|        {
 8767|     88|            break;
 8768|     88|        }
 8769|  1.62k|    }
 8770|       |
 8771|     88|    if (nNumComponents != iComponent)
  ------------------
  |  Branch (8771:9): [True: 0, False: 88]
  ------------------
 8772|      0|    {
 8773|      0|        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 8774|      0|        goto exit_function;
 8775|      0|    }
 8776|     88|    ret = iComponent + 1;
 8777|       |
 8778|    120|exit_function:
 8779|    120|    INCHI_HEAPCHK
 8780|       |
 8781|    120|        return ret;
 8782|     88|}
ichiread.c:ParseSegmentCharge:
 7830|    356|{
 7831|       |    /* Pass 1: count bonds and find actual numbers of  atom */
 7832|    356|    int i, mpy_component, val;
 7833|    356|    int nNumComponents, iComponent;
 7834|    356|    const char *p, *q, *t, *pStart, *pEnd;
 7835|    356|    int  ret;
 7836|    356|    INChI *pInChI = pInpInChI[bMobileH];
 7837|    356|    const char   mult_type[] = "mnMNe";
 7838|       |
 7839|    356|    if (str[0] != 'q')
  ------------------
  |  Branch (7839:9): [True: 328, False: 28]
  ------------------
 7840|    328|    {
 7841|    328|        return 0;
 7842|    328|    }
 7843|       |
 7844|     28|    pStart = (char  *) str + 1;
 7845|     28|    iComponent = 0;
 7846|     28|    nNumComponents = ppnNumComponents[bMobileH];
 7847|       |
 7848|     28|    if (!*pStart && bMobileH == TAUT_NON)
  ------------------
  |  |  579|     18|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (7848:9): [True: 18, False: 10]
  |  Branch (7848:21): [True: 18, False: 0]
  ------------------
 7849|     18|    {
 7850|  14.8k|        for (i = 0; i < nNumComponents; i++)
  ------------------
  |  Branch (7850:21): [True: 14.8k, False: 18]
  ------------------
 7851|  14.8k|        {
 7852|  14.8k|            pInChI[i].nTotalCharge = NO_VALUE_INT;
  ------------------
  |  |   51|  14.8k|#define NO_VALUE_INT    9999
  ------------------
 7853|  14.8k|        }
 7854|     18|        return nNumComponents + 1;
 7855|     18|    }
 7856|       |
 7857|    274|    while (1)
  ------------------
  |  Branch (7857:12): [Folded - Ignored]
  ------------------
 7858|    274|    {
 7859|       |        /* cycle over components */
 7860|    274|        if (!( pEnd = strchr( pStart, ';' ) ))
  ------------------
  |  Branch (7860:13): [True: 10, False: 264]
  ------------------
 7861|     10|        {
 7862|     10|            pEnd = pStart + strlen( pStart );
 7863|     10|        }
 7864|       |
 7865|    274|        if (( isdigit( UCINT *pStart ) &&
 7866|    274|              0 < ( val = (int) inchi_strtol( pStart, &q, 10 ) ) ||
  ------------------
  |  Branch (7866:15): [True: 0, False: 0]
  ------------------
 7867|    274|              ( q = pStart, val = 1 ) ) &&
  ------------------
  |  Branch (7867:15): [True: 274, False: 0]
  ------------------
 7868|    274|              ( t = strchr((char *)mult_type, *q)) && q + 1 == pEnd)
  ------------------
  |  Branch (7868:15): [True: 0, False: 274]
  |  Branch (7868:55): [True: 0, False: 0]
  ------------------
 7869|      0|        {
 7870|       |            /* process the abbreviation */
 7871|       |
 7872|      0|            switch (bMobileH)
 7873|      0|            {
 7874|      0|                case TAUT_YES:
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (7874:17): [True: 0, False: 0]
  ------------------
 7875|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7876|      0|                    goto exit_function;
 7877|      0|                case TAUT_NON:
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (7877:17): [True: 0, False: 0]
  ------------------
 7878|      0|                    if (*q != 'm' ||
  ------------------
  |  Branch (7878:25): [True: 0, False: 0]
  ------------------
 7879|      0|                         iComponent + val > nNumComponents ||
  ------------------
  |  Branch (7879:26): [True: 0, False: 0]
  ------------------
 7880|      0|                         iComponent + val > ppnNumComponents[TAUT_YES])
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (7880:26): [True: 0, False: 0]
  ------------------
 7881|      0|                    {
 7882|       |
 7883|      0|                        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7884|      0|                        goto exit_function;
 7885|      0|                    }
 7886|      0|                    for (i = 0; i < val; i++)
  ------------------
  |  Branch (7886:33): [True: 0, False: 0]
  ------------------
 7887|      0|                    {
 7888|       |                        /* avoid 0 which means "omitted" */
 7889|      0|                        pInChI[iComponent + i].nTotalCharge = pInpInChI[TAUT_YES][iComponent + i].nTotalCharge ?
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (7889:63): [True: 0, False: 0]
  ------------------
 7890|      0|                            pInpInChI[TAUT_YES][iComponent + i].nTotalCharge :
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 7891|      0|                            NO_VALUE_INT;
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
 7892|      0|                    }
 7893|      0|                    mpy_component = val;
 7894|      0|                    goto end_main_cycle;
 7895|      0|                default:
  ------------------
  |  Branch (7895:17): [True: 0, False: 0]
  ------------------
 7896|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7897|      0|                    goto exit_function;
 7898|      0|            }
 7899|      0|        }
 7900|    274|        else
 7901|    274|        {
 7902|    274|            if (( p = strchr( pStart, '*' ) ) && p < pEnd)
  ------------------
  |  Branch (7902:17): [True: 2, False: 272]
  |  Branch (7902:50): [True: 2, False: 0]
  ------------------
 7903|      2|            {
 7904|      2|                mpy_component = (int) inchi_strtol( pStart, &q, 10 );
 7905|      2|#if ( CHECK_STRTOL_ATNUMB==1 )
 7906|      2|                if (mpy_component>MAX_ATOMS || mpy_component<0)
  ------------------
  |  |   43|      4|#define MAX_ATOMS  32766
  ------------------
  |  Branch (7906:21): [True: 0, False: 2]
  |  Branch (7906:48): [True: 2, False: 0]
  ------------------
 7907|      2|                {
 7908|      2|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      2|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7909|      2|                    goto exit_function;
 7910|      2|                }
 7911|      0|#endif
 7912|      0|                if (p != q)
  ------------------
  |  Branch (7912:21): [True: 0, False: 0]
  ------------------
 7913|      0|                {
 7914|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7915|      0|                    goto exit_function;
 7916|      0|                }
 7917|      0|                p++;
 7918|      0|            }
 7919|    272|            else
 7920|    272|            {
 7921|    272|                mpy_component = 1;
 7922|    272|                p = pStart;
 7923|    272|            }
 7924|    274|        }
 7925|    272|#if ( FIX_DALKE_BUGS == 1 )
 7926|    272|        if (mpy_component + iComponent > nNumComponents || mpy_component <= 0)
  ------------------
  |  Branch (7926:13): [True: 0, False: 272]
  |  Branch (7926:60): [True: 0, False: 272]
  ------------------
 7927|      0|        {
 7928|      0|            ret = RI_ERR_SYNTAX; /* syntax error: too many components in charge layer */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7929|      0|            goto exit_function;
 7930|      0|        }
 7931|    272|#endif
 7932|    272|        pStart = p;
 7933|    272|        if (pStart < pEnd)
  ------------------
  |  Branch (7933:13): [True: 266, False: 6]
  ------------------
 7934|    266|        {
 7935|    266|            if (pStart[0] == '+' && isdigit( UCINT pStart[1] ))
  ------------------
  |  Branch (7935:17): [True: 0, False: 266]
  ------------------
 7936|      0|            {
 7937|      0|                val = (int) inchi_strtol( pStart + 1, &q, 10 );
 7938|      0|                pStart = q;
 7939|      0|            }
 7940|    266|            else
 7941|    266|            {
 7942|    266|                if (pStart[0] == '-' && isdigit( UCINT pStart[1] ))
  ------------------
  |  Branch (7942:21): [True: 266, False: 0]
  ------------------
 7943|    266|                {
 7944|    266|                    val = -(int) inchi_strtol( pStart + 1, &q, 10 );
 7945|    266|                    pStart = q;
 7946|    266|                }
 7947|      0|                else
 7948|      0|                {
 7949|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7950|      0|                    goto exit_function;
 7951|      0|                }
 7952|    266|            }
 7953|    266|#if ( FIX_DALKE_BUGS == 1 )
 7954|    266|            if (val < -256 || val > 256)
  ------------------
  |  Branch (7954:17): [True: 0, False: 266]
  |  Branch (7954:31): [True: 0, False: 266]
  ------------------
 7955|      0|            {
 7956|      0|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7957|      0|                goto exit_function;
 7958|      0|            }
 7959|    266|#endif
 7960|    266|            if (!val)
  ------------------
  |  Branch (7960:17): [True: 132, False: 134]
  ------------------
 7961|    132|            {
 7962|    132|                if (pStart != pEnd)
  ------------------
  |  Branch (7962:21): [True: 0, False: 132]
  ------------------
 7963|      0|                {
 7964|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7965|      0|                    goto exit_function;
 7966|      0|                }
 7967|    132|                if (bMobileH == TAUT_NON)
  ------------------
  |  |  579|    132|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (7967:21): [True: 0, False: 132]
  ------------------
 7968|      0|                {
 7969|      0|                    val = NO_VALUE_INT;  /* avoid 0 which means "omitted" */
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
 7970|      0|                }
 7971|    132|            }
 7972|    266|        }
 7973|      6|        else
 7974|      6|        {
 7975|      6|            val = NO_VALUE_INT;
  ------------------
  |  |   51|      6|#define NO_VALUE_INT    9999
  ------------------
 7976|      6|        }
 7977|    544|        for (i = 0; i < mpy_component; i++)
  ------------------
  |  Branch (7977:21): [True: 272, False: 272]
  ------------------
 7978|    272|        {
 7979|    272|            pInChI[iComponent + i].nTotalCharge = val;
 7980|    272|        }
 7981|       |
 7982|    272|    end_main_cycle:
 7983|    272|        iComponent += mpy_component;
 7984|    272|        if (*pEnd)
  ------------------
  |  Branch (7984:13): [True: 264, False: 8]
  ------------------
 7985|    264|        {
 7986|    264|            pStart = pEnd + 1;
 7987|    264|            continue;
 7988|    264|        }
 7989|      8|        else
 7990|      8|        {
 7991|      8|            break;
 7992|      8|        }
 7993|    272|    }
 7994|       |
 7995|      8|    if (nNumComponents != iComponent)
  ------------------
  |  Branch (7995:9): [True: 2, False: 6]
  ------------------
 7996|      2|    {
 7997|      2|        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      2|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7998|      2|        goto exit_function;
 7999|      2|    }
 8000|      6|    ret = iComponent + 1;
 8001|       |
 8002|     10|exit_function:
 8003|       |
 8004|     10|    return ret;
 8005|      6|}
ichiread.c:ParseSegmentProtons:
 7247|    278|{
 7248|       |    /* Pass 1: count bonds and find actual numbers of  atom */
 7249|    278|    int val;
 7250|    278|    const char *q, *pStart, *pEnd;
 7251|    278|    int  ret;
 7252|       |
 7253|    278|    if (str[0] != 'p')
  ------------------
  |  Branch (7253:9): [True: 278, False: 0]
  ------------------
 7254|    278|    {
 7255|    278|        return 0;
 7256|    278|    }
 7257|       |
 7258|      0|    pStart = (char  *) str + 1;
 7259|       |
 7260|      0|    while (1)
  ------------------
  |  Branch (7260:12): [Folded - Ignored]
  ------------------
 7261|      0|    {
 7262|       |        /* cycle over components */
 7263|      0|        if (!( pEnd = strchr( pStart, ';' ) ))
  ------------------
  |  Branch (7263:13): [True: 0, False: 0]
  ------------------
 7264|      0|        {
 7265|      0|            pEnd = pStart + strlen( pStart );
 7266|      0|        }
 7267|       |
 7268|      0|        if (pStart[0] == '+' && isdigit( UCINT pStart[1] ))
  ------------------
  |  Branch (7268:13): [True: 0, False: 0]
  ------------------
 7269|      0|        {
 7270|      0|            val = (int) inchi_strtol( pStart + 1, &q, 10 );
 7271|      0|        }
 7272|      0|        else
 7273|      0|        {
 7274|      0|            if (pStart[0] == '-' && isdigit( UCINT pStart[1] ))
  ------------------
  |  Branch (7274:17): [True: 0, False: 0]
  ------------------
 7275|      0|            {
 7276|      0|                val = -(int) inchi_strtol( pStart + 1, &q, 10 );
 7277|      0|            }
 7278|      0|            else
 7279|      0|            {
 7280|      0|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7281|      0|                goto exit_function;
 7282|      0|            }
 7283|      0|        }
 7284|      0|        if (!val)
  ------------------
  |  Branch (7284:13): [True: 0, False: 0]
  ------------------
 7285|      0|        {
 7286|      0|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7287|      0|            goto exit_function;
 7288|      0|        }
 7289|      0|        nNumProtons[bMobileH].nNumRemovedProtons = val;
 7290|      0|        if (*pEnd || q != pEnd)
  ------------------
  |  Branch (7290:13): [True: 0, False: 0]
  |  Branch (7290:22): [True: 0, False: 0]
  ------------------
 7291|      0|        {
 7292|      0|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7293|      0|            goto exit_function;
 7294|      0|        }
 7295|      0|        else
 7296|      0|        {
 7297|      0|            break;
 7298|      0|        }
 7299|      0|    }
 7300|      0|    ret = 1;
 7301|       |
 7302|      0|exit_function:
 7303|       |
 7304|      0|    return ret;
 7305|      0|}
ichiread.c:ParseSegmentPolymer:
 7320|    278|{
 7321|    278|    const char  *p, *q, *pStart, *pEnd, *p0;
 7322|    278|    char  comma = ',', dot = '.', dash = '-', lt_par = '(', rt_par = ')';
 7323|    278|    int         iunit, val, ret, prev, is_range;
 7324|    278|    int         curr_atom, type = -1, subtype = -1, conn = -1;
 7325|    278|    AT_NUMB     num_atom;
 7326|    278|    INT_ARRAY   alist;
 7327|    278|    OAD_Polymer *pd = NULL;
 7328|       |
 7329|    278|    if (str[0] != 'z')
  ------------------
  |  Branch (7329:9): [True: 152, False: 126]
  ------------------
 7330|    152|    {
 7331|    152|        return 0;
 7332|    152|    }
 7333|       |
 7334|    126|    if (IntArray_Alloc( &alist, 4 ))
  ------------------
  |  Branch (7334:9): [True: 0, False: 126]
  ------------------
 7335|      0|    {
 7336|      0|        return RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 7337|      0|    }
 7338|       |
 7339|    126|    if (*ppPolymer)
  ------------------
  |  Branch (7339:9): [True: 0, False: 126]
  ------------------
 7340|      0|    {
 7341|      0|        OAD_Polymer_Free( *ppPolymer );
 7342|      0|    }
 7343|       |
 7344|    126|    pd = *ppPolymer = (OAD_Polymer *)
 7345|    126|    inchi_calloc( 1, sizeof( OAD_Polymer ) );
  ------------------
  |  | 1133|    126|#define inchi_calloc   calloc
  ------------------
 7346|    126|    ( *ppPolymer )->pzz = NULL;
 7347|       |
 7348|    126|    if (!pd)
  ------------------
  |  Branch (7348:9): [True: 0, False: 126]
  ------------------
 7349|      0|    {
 7350|      0|        ret = RI_ERR_ALLOC; goto exit_function;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 7351|      0|    }
 7352|       |
 7353|       |
 7354|    126|    if (!bInchi2Struct)
  ------------------
  |  Branch (7354:9): [True: 64, False: 62]
  ------------------
 7355|     64|    {
 7356|     64|        ret = RI_ERR_SYNTAX; goto exit_function;
  ------------------
  |  |   44|     64|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7357|     64|    }
 7358|       |
 7359|       |    /* Count units */
 7360|     62|    pd->n = 1;
 7361|     62|    p = (char  *) str + 1;
 7362|  22.2k|    while (p = strchr( p, ';' ))
  ------------------
  |  Branch (7362:12): [True: 22.2k, False: 62]
  ------------------
 7363|  22.2k|    {
 7364|  22.2k|        p++;
 7365|  22.2k|        pd->n++;
 7366|  22.2k|    }
 7367|     62|    pd->units = (OAD_PolymerUnit**)
 7368|     62|    inchi_calloc( pd->n, sizeof( OAD_PolymerUnit * ) );
  ------------------
  |  | 1133|     62|#define inchi_calloc   calloc
  ------------------
 7369|     62|    if (!pd->units)
  ------------------
  |  Branch (7369:9): [True: 0, False: 62]
  ------------------
 7370|      0|    {
 7371|      0|        ret = RI_ERR_ALLOC; goto exit_function;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 7372|      0|    }
 7373|       |
 7374|     62|    pStart = (char  *) str;
 7375|     62|    pStart++;
 7376|     62|    if (!pStart)
  ------------------
  |  Branch (7376:9): [True: 0, False: 62]
  ------------------
 7377|      0|    {
 7378|      0|        ret = RI_ERR_PROGR; goto exit_function;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 7379|      0|    }
 7380|       |
 7381|     62|    iunit = 0;
 7382|  21.5k|    while (*pStart)
  ------------------
  |  Branch (7382:12): [True: 21.5k, False: 21]
  ------------------
 7383|  21.5k|    {
 7384|  21.5k|        OAD_PolymerUnit *unit = NULL;
 7385|       |
 7386|  21.5k|        if (*pStart == ';')
  ------------------
  |  Branch (7386:13): [True: 832, False: 20.7k]
  ------------------
 7387|    832|        {
 7388|    832|            pStart++;
 7389|    832|        }
 7390|       |
 7391|  21.5k|        if (!( pEnd = strchr( pStart, ';' ) ))
  ------------------
  |  Branch (7391:13): [True: 30, False: 21.5k]
  ------------------
 7392|     30|        {
 7393|     30|            pEnd = pStart + strlen( pStart );
 7394|     30|        }
 7395|  21.5k|        if (!isdigit( UCINT pStart[0] ))
  ------------------
  |  Branch (7395:13): [True: 26, False: 21.5k]
  ------------------
 7396|     26|        {
 7397|     26|            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|     26|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7398|     26|            goto exit_function;
 7399|     26|        }
 7400|  21.5k|        val = (int)inchi_strtol( pStart + 0, &q, 10 );
 7401|  21.5k|        type = val / 100;
 7402|  21.5k|        subtype = (val - (type * 100)) / 10;
 7403|  21.5k|        conn = (val - (type * 100 + subtype * 10));      
 7404|  21.5k|        if (*q != '-')
  ------------------
  |  Branch (7404:13): [True: 4, False: 21.5k]
  ------------------
 7405|      4|        {
 7406|      4|            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      4|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7407|      4|            goto exit_function;
 7408|      4|        }
 7409|       |
 7410|  21.5k|#if ( FIX_GAF_2020_25741==1 )
 7411|  21.5k|        {
 7412|  21.5k|            int valid_unit = 0;
 7413|  21.5k|            if (type == POLYMER_STY_NON || type == POLYMER_STY_SRU || type == POLYMER_STY_MON ||
  ------------------
  |  |  178|  43.0k|#define POLYMER_STY_NON     0
  ------------------
                          if (type == POLYMER_STY_NON || type == POLYMER_STY_SRU || type == POLYMER_STY_MON ||
  ------------------
  |  |  179|  23.1k|#define POLYMER_STY_SRU     1   /* structure-based unit or copolymer subunit                        */
  ------------------
                          if (type == POLYMER_STY_NON || type == POLYMER_STY_SRU || type == POLYMER_STY_MON ||
  ------------------
  |  |  180|  22.6k|#define POLYMER_STY_MON     2   /* source-based    polymer unit or copolymer subunit                    */
  ------------------
  |  Branch (7413:17): [True: 19.9k, False: 1.59k]
  |  Branch (7413:44): [True: 422, False: 1.17k]
  |  Branch (7413:71): [True: 733, False: 437]
  ------------------
 7414|  21.5k|                type == POLYMER_STY_COP || type == POLYMER_STY_MOD || type == POLYMER_STY_CRO ||
  ------------------
  |  |  181|  21.9k|#define POLYMER_STY_COP     3   /* copolymer unit embedding >1 subunits                                */
  ------------------
                              type == POLYMER_STY_COP || type == POLYMER_STY_MOD || type == POLYMER_STY_CRO ||
  ------------------
  |  |  183|  21.7k|#define POLYMER_STY_MOD     4   /* copolymer subunit only, designates chemical modification of SRU    */
  ------------------
                              type == POLYMER_STY_COP || type == POLYMER_STY_MOD || type == POLYMER_STY_CRO ||
  ------------------
  |  |  184|  21.6k|#define POLYMER_STY_CRO     5   /* copolymer subunit only, designates cross-linked version of SRU    */
  ------------------
  |  Branch (7414:17): [True: 261, False: 176]
  |  Branch (7414:44): [True: 89, False: 87]
  |  Branch (7414:71): [True: 79, False: 8]
  ------------------
 7415|  21.5k|                type == POLYMER_STY_MER)
  ------------------
  |  |  185|      8|#define POLYMER_STY_MER     6   /* copolymer subunit only, source-based with no homopolymerize        */
  ------------------
  |  Branch (7415:17): [True: 5, False: 3]
  ------------------
 7416|  21.5k|            {
 7417|  21.5k|                if (subtype == POLYMER_SST_NON || subtype == POLYMER_SST_ALT ||
  ------------------
  |  |  187|  43.0k|#define POLYMER_SST_NON     0
  ------------------
                              if (subtype == POLYMER_SST_NON || subtype == POLYMER_SST_ALT ||
  ------------------
  |  |  188|  24.6k|#define POLYMER_SST_ALT     1
  ------------------
  |  Branch (7417:21): [True: 18.3k, False: 3.15k]
  |  Branch (7417:51): [True: 283, False: 2.87k]
  ------------------
 7418|  21.5k|                    subtype == POLYMER_SST_RAN || subtype == POLYMER_SST_BLK)
  ------------------
  |  |  189|  24.3k|#define POLYMER_SST_RAN     2
  ------------------
                                  subtype == POLYMER_SST_RAN || subtype == POLYMER_SST_BLK)
  ------------------
  |  |  190|     97|#define POLYMER_SST_BLK     3
  ------------------
  |  Branch (7418:21): [True: 2.77k, False: 97]
  |  Branch (7418:51): [True: 97, False: 0]
  ------------------
 7419|  21.5k|                {
 7420|  21.5k|                    if (conn == POLYMER_CONN_NON || conn == POLYMER_CONN_HT ||
  ------------------
  |  |  192|  43.0k|#define POLYMER_CONN_NON    0
  ------------------
                                  if (conn == POLYMER_CONN_NON || conn == POLYMER_CONN_HT ||
  ------------------
  |  |  193|  30.3k|#define POLYMER_CONN_HT     1
  ------------------
  |  Branch (7420:25): [True: 12.6k, False: 8.83k]
  |  Branch (7420:53): [True: 3.92k, False: 4.91k]
  ------------------
 7421|  21.5k|                        conn == POLYMER_CONN_HH || conn == POLYMER_CONN_EU)
  ------------------
  |  |  194|  26.4k|#define POLYMER_CONN_HH     2
  ------------------
                                      conn == POLYMER_CONN_HH || conn == POLYMER_CONN_EU)
  ------------------
  |  |  195|    320|#define POLYMER_CONN_EU     3
  ------------------
  |  Branch (7421:25): [True: 4.59k, False: 320]
  |  Branch (7421:52): [True: 320, False: 0]
  ------------------
 7422|  21.5k|                    {
 7423|  21.5k|                        valid_unit = 1;
 7424|  21.5k|                    }
 7425|  21.5k|                }
 7426|  21.5k|            }
 7427|  21.5k|            if (!valid_unit)
  ------------------
  |  Branch (7427:17): [True: 3, False: 21.5k]
  ------------------
 7428|      3|            {
 7429|      3|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      3|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7430|      3|                goto exit_function;
 7431|      3|            }
 7432|  21.5k|        }
 7433|  21.5k|#endif
 7434|       |
 7435|  21.5k|        q++;
 7436|  21.5k|        prev = 0;
 7437|  21.5k|        is_range = 0;
 7438|  40.4k|        for (p = q, curr_atom = 0; p < pEnd && *p != '('; curr_atom++)
  ------------------
  |  Branch (7438:36): [True: 19.6k, False: 20.7k]
  |  Branch (7438:48): [True: 18.9k, False: 727]
  ------------------
 7439|  18.9k|        {
 7440|  18.9k|            num_atom = (AT_NUMB) inchi_strtol( p, &p, 10 );
 7441|  18.9k|#if ( ( CHECK_STRTOL_ATNUMB==1 ) || ( FIX_GAF_2019_2==1 ) )
 7442|  18.9k|            if (num_atom>na_total || num_atom<0)
  ------------------
  |  Branch (7442:17): [True: 3, False: 18.9k]
  |  Branch (7442:38): [True: 0, False: 18.9k]
  ------------------
 7443|      3|            {
 7444|      3|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      3|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7445|      3|                goto exit_function;
 7446|      3|            }
 7447|  18.9k|#endif
 7448|  18.9k|            if (!num_atom || num_atom > na_total)
  ------------------
  |  Branch (7448:17): [True: 1, False: 18.9k]
  |  Branch (7448:30): [True: 0, False: 18.9k]
  ------------------
 7449|      1|            {
 7450|      1|                ret = RI_ERR_SYNTAX; goto exit_function;
  ------------------
  |  |   44|      1|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7451|      1|            }
 7452|  18.9k|            if (is_range)
  ------------------
  |  Branch (7452:17): [True: 2.73k, False: 16.2k]
  ------------------
 7453|  2.73k|            {
 7454|  2.73k|                int a;
 7455|  3.50k|                for (a = prev + 1; a <= num_atom; a++)
  ------------------
  |  Branch (7455:36): [True: 770, False: 2.73k]
  ------------------
 7456|    770|                {
 7457|    770|                    if (0 != IntArray_Append( &alist, a ))
  ------------------
  |  Branch (7457:25): [True: 0, False: 770]
  ------------------
 7458|      0|                    {
 7459|      0|                        ret = RI_ERR_ALLOC; goto exit_function;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 7460|      0|                    }
 7461|    770|                }
 7462|  2.73k|                is_range = 0;
 7463|  2.73k|                prev = 0;
 7464|  2.73k|            }
 7465|  16.2k|            else
 7466|  16.2k|            {
 7467|  16.2k|                if (0 != IntArray_Append( &alist, num_atom ))
  ------------------
  |  Branch (7467:21): [True: 0, False: 16.2k]
  ------------------
 7468|      0|                {
 7469|      0|                    ret = RI_ERR_ALLOC; goto exit_function;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 7470|      0|                }
 7471|  16.2k|                prev = num_atom;
 7472|  16.2k|            }
 7473|  18.9k|            if (*p == '-')
  ------------------
  |  Branch (7473:17): [True: 3.16k, False: 15.7k]
  ------------------
 7474|  3.16k|            {
 7475|  3.16k|                p++;
 7476|  3.16k|                is_range = 1;
 7477|  3.16k|            }
 7478|  15.7k|            else if (*p == ',')
  ------------------
  |  Branch (7478:22): [True: 9, False: 15.7k]
  ------------------
 7479|      9|            {
 7480|      9|                p++;
 7481|      9|            }
 7482|  18.9k|        }
 7483|       |
 7484|  21.5k|        if (alist.used)
  ------------------
  |  Branch (7484:13): [True: 16.2k, False: 5.29k]
  ------------------
 7485|  16.2k|        {
 7486|  16.2k|            unit = OAD_PolymerUnit_New( 4,          /* maxatoms             */
 7487|  16.2k|                                        0,          /* maxbonds=0 for now   */
 7488|  16.2k|                                        iunit + 1,  /* id                   */
 7489|  16.2k|                                        iunit + 1,  /* label                */
 7490|  16.2k|                                        type,
 7491|  16.2k|                                        subtype,
 7492|  16.2k|                                        conn,
 7493|  16.2k|                                        "",         /* smt                  */
 7494|  16.2k|                                        alist.used,
 7495|  16.2k|                                        &alist,
 7496|  16.2k|                                        0,          /* blist.used           */
 7497|  16.2k|                                        NULL,       /* &blist               */
 7498|  16.2k|                                        0,          /* nlinks             */
 7499|       |                                        NULL        /* **links            */
 7500|  16.2k|            );
 7501|       |
 7502|  16.2k|            if (!unit)
  ------------------
  |  Branch (7502:17): [True: 0, False: 16.2k]
  ------------------
 7503|      0|            {
 7504|      0|                ret = RI_ERR_ALLOC; goto exit_function;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 7505|      0|            }
 7506|  16.2k|            pd->units[iunit] = unit;
 7507|  16.2k|            IntArray_Reset( &alist );
 7508|  16.2k|            iunit++;
 7509|  16.2k|        }
 7510|       |
 7511|  21.5k|        if (*p == lt_par)
  ------------------
  |  Branch (7511:13): [True: 727, False: 20.7k]
  ------------------
 7512|    727|        {
 7513|       |            /* Structure-based representn, read crossing bonds information */
 7514|    727|            const int nothing = 0, endgroups = 1, stars = 2, stars_ring = 3, stars_bond = 4, stars_atom = 5;
 7515|    727|            int have = nothing;
 7516|    727|            int res, ib, err = 0;
 7517|    727|            INT_ARRAY numlist;
 7518|       |
 7519|    727|            if (IntArray_Alloc( &numlist, 4 ))
  ------------------
  |  Branch (7519:17): [True: 0, False: 727]
  ------------------
 7520|      0|            {
 7521|      0|                ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 7522|      0|                goto exit_function;
 7523|      0|            }
 7524|       |
 7525|    727|            p0 = p;
 7526|  2.32k|            while (*( ++p ))
  ------------------
  |  Branch (7526:20): [True: 2.32k, False: 0]
  ------------------
 7527|  2.32k|            {
 7528|  2.32k|                if (*p == '-')
  ------------------
  |  Branch (7528:21): [True: 1, False: 2.32k]
  ------------------
 7529|      1|                {
 7530|      1|                    have = endgroups; break;
 7531|      1|                }
 7532|  2.32k|                if (*p == ',')
  ------------------
  |  Branch (7532:21): [True: 726, False: 1.60k]
  ------------------
 7533|    726|                {
 7534|    726|                    have = stars; break;
 7535|    726|                }
 7536|  2.32k|            }
 7537|    727|            if (have == stars)
  ------------------
  |  Branch (7537:17): [True: 726, False: 1]
  ------------------
 7538|    726|            {
 7539|  3.16k|                while (*( ++p ))
  ------------------
  |  Branch (7539:24): [True: 3.16k, False: 0]
  ------------------
 7540|  3.16k|                {
 7541|  3.16k|                    if (*p == ',')
  ------------------
  |  Branch (7541:25): [True: 474, False: 2.69k]
  ------------------
 7542|    474|                    {
 7543|    474|                        have = stars_ring; break;
 7544|    474|                    }
 7545|  2.69k|                    if (*p == '.')
  ------------------
  |  Branch (7545:25): [True: 175, False: 2.51k]
  ------------------
 7546|    175|                    {
 7547|    175|                        have = stars_bond; break;
 7548|    175|                    }
 7549|  2.51k|                    if (*p == ')')
  ------------------
  |  Branch (7549:25): [True: 77, False: 2.44k]
  ------------------
 7550|     77|                    {
 7551|     77|                        have = stars_atom; break;
 7552|     77|                    }
 7553|  2.51k|                }
 7554|    726|            }
 7555|    727|            p = p0;
 7556|       |
 7557|    727|            unit->cyclizable = CLOSING_SRU_NOT_APPLICABLE;
  ------------------
  |  |   51|    727|#define CLOSING_SRU_NOT_APPLICABLE 0
  ------------------
 7558|    727|            if (have == endgroups)
  ------------------
  |  Branch (7558:17): [True: 1, False: 726]
  ------------------
 7559|      1|            {
 7560|       |                /* Read end groups notation */
 7561|      1|                p = ParseSegmentReadDelimitedNumbers( p, pEnd, &numlist, dash, comma, &res );
 7562|      1|                if (res == 1 && numlist.used == 2)
  ------------------
  |  Branch (7562:21): [True: 0, False: 1]
  |  Branch (7562:33): [True: 0, False: 0]
  ------------------
 7563|      0|                {
 7564|      0|                    p = ParseSegmentReadDelimitedNumbers( p, pEnd, &numlist, dash, rt_par, &res );
 7565|      0|                }
 7566|      1|                if (res == 1 && numlist.used == 4)
  ------------------
  |  Branch (7566:21): [True: 0, False: 1]
  |  Branch (7566:33): [True: 0, False: 0]
  ------------------
 7567|      0|                {
 7568|      0|                    pStart = p + 1;
 7569|      0|                    unit->nb = 2;
 7570|      0|                    unit->blist = (int *) inchi_calloc( 2 * unit->nb, sizeof( int ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 7571|      0|                    if (!unit->blist)
  ------------------
  |  Branch (7571:25): [True: 0, False: 0]
  ------------------
 7572|      0|                    {
 7573|      0|                        ret = RI_ERR_ALLOC; IntArray_Free( &numlist ); goto exit_function;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 7574|      0|                    }
 7575|      0|                    unit->blist[0] = numlist.item[0];    unit->blist[1] = numlist.item[1];
 7576|      0|                    unit->blist[2] = numlist.item[2];    unit->blist[3] = numlist.item[3];
 7577|      0|                    unit->cap1 = numlist.item[0]; /* just for GAF check belows */
 7578|      0|                    unit->cap2 = numlist.item[2];
 7579|      0|                    IntArray_Free( &numlist );
 7580|      0|                    continue;
 7581|      0|                }
 7582|      1|            }
 7583|    726|            else if (have == stars_ring ||
  ------------------
  |  Branch (7583:22): [True: 474, False: 252]
  ------------------
 7584|    726|                      have == stars_bond ||
  ------------------
  |  Branch (7584:23): [True: 175, False: 77]
  ------------------
 7585|    726|                      have == stars_atom)
  ------------------
  |  Branch (7585:23): [True: 77, False: 0]
  ------------------
 7586|    726|            {
 7587|       |                /* Read star atoms - frame shiftable bonds notation */
 7588|    726|                IntArray_Reset( &numlist );
 7589|    726|                p = ParseSegmentReadDelimitedNumbers( p, pEnd, &numlist, comma, dash, &res );
 7590|    726|                if (res != 1 || numlist.used != 2)
  ------------------
  |  Branch (7590:21): [True: 0, False: 726]
  |  Branch (7590:33): [True: 0, False: 726]
  ------------------
 7591|      0|                {
 7592|      0|                    ret = RI_ERR_SYNTAX; IntArray_Free( &numlist ); goto exit_function;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7593|      0|                }
 7594|       |                /* OK, we got star atom numbers */
 7595|    726|                if (have == stars_ring)
  ------------------
  |  Branch (7595:21): [True: 474, False: 252]
  ------------------
 7596|    474|                {
 7597|    474|                    p = ParseSegmentReadDelimitedNumbers( p, pEnd, &numlist, comma, rt_par, &res );
 7598|    474|                    if (res != 1 || numlist.used < 4)
  ------------------
  |  Branch (7598:25): [True: 3, False: 471]
  |  Branch (7598:37): [True: 0, False: 471]
  ------------------
 7599|      3|                    {
 7600|      3|                        ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      3|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7601|      3|                        IntArray_Free( &numlist );
 7602|      3|                        goto exit_function;
 7603|      3|                    }
 7604|    471|                    unit->cyclizable = CLOSING_SRU_RING;
  ------------------
  |  |   52|    471|#define CLOSING_SRU_RING 1
  ------------------
 7605|    471|                    unit->nbkbonds = ( numlist.used - 2 ) / 2;
 7606|    471|                }
 7607|    252|                else if (have == stars_bond)
  ------------------
  |  Branch (7607:26): [True: 175, False: 77]
  ------------------
 7608|    175|                {
 7609|    175|                    p = ParseSegmentReadDelimitedNumbers( p, pEnd, &numlist, dot, rt_par, &res );
 7610|    175|                    if (res != 1 || numlist.used < 4)
  ------------------
  |  Branch (7610:25): [True: 0, False: 175]
  |  Branch (7610:37): [True: 0, False: 175]
  ------------------
 7611|      0|                    {
 7612|      0|                        ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7613|      0|                        IntArray_Free( &numlist );
 7614|      0|                        goto exit_function;
 7615|      0|                    }
 7616|    175|                    unit->cyclizable = CLOSING_SRU_HIGHER_ORDER_BOND;
  ------------------
  |  |   53|    175|#define CLOSING_SRU_HIGHER_ORDER_BOND 2
  ------------------
 7617|    175|                    unit->nbkbonds = 1;
 7618|    175|                }
 7619|     77|                else if (have == stars_atom)
  ------------------
  |  Branch (7619:26): [True: 77, False: 0]
  ------------------
 7620|     77|                {
 7621|     77|                    int num = inchi_strtol(  ++p,  &p, 10 );
 7622|     77|#if ( ( CHECK_STRTOL_ATNUMB==1 ) || ( FIX_GAF_2019_2==1 ) )
 7623|     77|                    if (num>na_total || num<0)
  ------------------
  |  Branch (7623:25): [True: 0, False: 77]
  |  Branch (7623:41): [True: 0, False: 77]
  ------------------
 7624|      0|                    {
 7625|      0|                        IntArray_Free(&numlist);
 7626|      0|                        ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7627|      0|                        goto exit_function;
 7628|      0|                    }
 7629|     77|#endif
 7630|     77|                    if (*p != rt_par)
  ------------------
  |  Branch (7630:25): [True: 1, False: 76]
  ------------------
 7631|      1|                    {
 7632|      1|                        ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      1|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7633|      1|                        IntArray_Free( &numlist );
 7634|      1|                        goto exit_function;
 7635|      1|                    }
 7636|     76|                    IntArray_Append( &numlist, num );
 7637|     76|                    unit->cyclizable = CLOSING_SRU_DIRADICAL;
  ------------------
  |  |   54|     76|#define CLOSING_SRU_DIRADICAL 3
  ------------------
 7638|     76|                    unit->nbkbonds = 1;
 7639|     76|                }
 7640|    726|            }
 7641|      0|            else
 7642|      0|            {
 7643|      0|                ret = RI_ERR_SYNTAX;  IntArray_Free( &numlist );  goto exit_function;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7644|      0|            }
 7645|       |
 7646|    723|            unit->cap1 = numlist.item[0];
 7647|    723|            unit->cap2 = numlist.item[1];
 7648|       |
 7649|    723|            if (unit->bkbonds)
  ------------------
  |  Branch (7649:17): [True: 0, False: 723]
  ------------------
 7650|      0|            {
 7651|      0|                imat_free(unit->maxbkbonds, unit->bkbonds);
 7652|      0|                unit->bkbonds = NULL;
 7653|      0|            }
 7654|    723|            unit->maxbkbonds = inchi_max( unit->maxbkbonds, unit->nbkbonds );
  ------------------
  |  |  166|    723|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 723]
  |  |  ------------------
  ------------------
 7655|    723|            err = imat_new( unit->maxbkbonds, 2, &( unit->bkbonds ) );
 7656|  1.44k|            for (ib = 0; ib < unit->nbkbonds; ib++)
  ------------------
  |  Branch (7656:26): [True: 722, False: 723]
  ------------------
 7657|    722|            {
 7658|    722|                unit->bkbonds[ib][0] = numlist.item[ib * 2 + 2];
 7659|    722|                if (numlist.used != 3)
  ------------------
  |  Branch (7659:21): [True: 646, False: 76]
  ------------------
 7660|    646|                {
 7661|    646|                    unit->bkbonds[ib][1] = numlist.item[ib * 2 + 3];
 7662|    646|                }
 7663|     76|                else
 7664|     76|                {
 7665|     76|                    unit->bkbonds[ib][1] = unit->bkbonds[ib][0];
 7666|     76|                }
 7667|    722|            }
 7668|    723|            if (unit->nbkbonds > 0)
  ------------------
  |  Branch (7668:17): [True: 722, False: 1]
  ------------------
 7669|    722|            {
 7670|       |                /*unit->cyclizable = 1;*/
 7671|    722|                unit->cap1 = numlist.item[0];
 7672|    722|                unit->cap2 = numlist.item[1];
 7673|    722|            }
 7674|       |
 7675|    723|            pStart = p + 1;
 7676|    723|            IntArray_Free( &numlist );
 7677|    723|            continue;
 7678|    727|        }
 7679|       |
 7680|  20.7k|        if (*p == ';')
  ------------------
  |  Branch (7680:13): [True: 20.7k, False: 17]
  ------------------
 7681|  20.7k|        {
 7682|  20.7k|            p++;
 7683|  20.7k|        }
 7684|  20.7k|        q = p;
 7685|  20.7k|        pStart = p;
 7686|  20.7k|    }
 7687|       |
 7688|     21|    pd->really_do_frame_shift = 1;
 7689|     21|    pd->frame_shift_scheme = FSS_STARS_CYCLED;
 7690|     21|    pd->treat = POLYMERS_MODERN;
  ------------------
  |  | 1198|     21|#define POLYMERS_MODERN 1	/* current (1.06) way to treat polymers with Zz			*/
  ------------------
 7691|     21|    pd->is_in_reconn = 0;
 7692|       |
 7693|       |    /*OAD_Polymer_DebugTrace( pd );*/
 7694|       |
 7695|     21|    ret = pd->n;
 7696|       |
 7697|    126|exit_function:
 7698|       |
 7699|    126|    IntArray_Free( &alist );
 7700|    126|    if (ret == RI_ERR_ALLOC || ret == RI_ERR_SYNTAX || ret == RI_ERR_PROGR)
  ------------------
  |  |   43|    252|#define RI_ERR_ALLOC   (-1)
  ------------------
                  if (ret == RI_ERR_ALLOC || ret == RI_ERR_SYNTAX || ret == RI_ERR_PROGR)
  ------------------
  |  |   44|    252|#define RI_ERR_SYNTAX  (-2)
  ------------------
                  if (ret == RI_ERR_ALLOC || ret == RI_ERR_SYNTAX || ret == RI_ERR_PROGR)
  ------------------
  |  |   45|     21|#define RI_ERR_PROGR   (-3)
  ------------------
  |  Branch (7700:9): [True: 0, False: 126]
  |  Branch (7700:32): [True: 105, False: 21]
  |  Branch (7700:56): [True: 0, False: 21]
  ------------------
 7701|    105|    {
 7702|       |        /*FreeExtOrigAtData( pd, pv );*/
 7703|    105|    }
 7704|     21|#if ( FIX_GAF_2019_2==1 )
 7705|     21|    else
 7706|     21|    {
 7707|     21|        if (pd)
  ------------------
  |  Branch (7707:13): [True: 21, False: 0]
  ------------------
 7708|     21|        {
 7709|     21|            int iu, ipsb, maxats = na_total + pd->n_pzz;
 7710|  15.5k|            for (iu = 0; iu < pd->n; iu++)
  ------------------
  |  Branch (7710:26): [True: 15.5k, False: 9]
  ------------------
 7711|  15.5k|            {
 7712|  15.5k|                int astar1, astar2;
 7713|  15.5k|#if ( FIX_OSS_FUZZ_25604==1 )
 7714|  15.5k|                if (NULL == pd->units[iu])
  ------------------
  |  Branch (7714:21): [True: 12, False: 15.5k]
  ------------------
 7715|     12|                {
 7716|     12|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|     12|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7717|     12|                    break;
 7718|     12|                }
 7719|  15.5k|#endif
 7720|  15.5k|                astar1 = pd->units[iu]->cap1;
 7721|  15.5k|                astar2 = pd->units[iu]->cap2;
 7722|  15.5k|                if (0 == pd->units[iu]->nb)
  ------------------
  |  Branch (7722:21): [True: 15.5k, False: 0]
  ------------------
 7723|  15.5k|                {
 7724|  15.5k|                    continue;
 7725|  15.5k|                }
 7726|      0|                if (ret == RI_ERR_SYNTAX)
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
  |  Branch (7726:21): [True: 0, False: 0]
  ------------------
 7727|      0|                {
 7728|      0|                    break;
 7729|      0|                }
 7730|      0|                if (astar1>maxats || astar1 <= 0 || astar2>maxats || astar2 <= 0)
  ------------------
  |  Branch (7730:21): [True: 0, False: 0]
  |  Branch (7730:38): [True: 0, False: 0]
  |  Branch (7730:53): [True: 0, False: 0]
  |  Branch (7730:70): [True: 0, False: 0]
  ------------------
 7731|      0|                {
 7732|      0|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7733|      0|                    break;
 7734|      0|                }
 7735|      0|                for (ipsb = 0; ipsb < pd->units[iu]->nbkbonds; ipsb++)
  ------------------
  |  Branch (7735:32): [True: 0, False: 0]
  ------------------
 7736|      0|                {
 7737|      0|                    int a1psb, a2psb;
 7738|      0|                    a1psb = pd->units[iu]->bkbonds[ipsb][0];
 7739|      0|                    a2psb = pd->units[iu]->bkbonds[ipsb][1];
 7740|      0|                    if (a1psb>maxats || a1psb <= 0 || a2psb>maxats || a2psb <= 0)
  ------------------
  |  Branch (7740:25): [True: 0, False: 0]
  |  Branch (7740:41): [True: 0, False: 0]
  |  Branch (7740:55): [True: 0, False: 0]
  |  Branch (7740:71): [True: 0, False: 0]
  ------------------
 7741|      0|                    {
 7742|      0|                        ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7743|      0|                        break;
 7744|      0|                    }
 7745|      0|                }
 7746|      0|            }
 7747|     21|        }
 7748|     21|    }
 7749|    126|#endif
 7750|       |
 7751|    126|    return ret;
 7752|     21|}
ichiread.c:ParseSegmentSp2:
 6721|    260|{
 6722|       |    /* Pass 1: count bonds and find actual numbers of  atom */
 6723|    260|    int i, mpy_component, val;
 6724|    260|    int nNumComponents, iComponent, len, iBond;
 6725|    260|    AT_NUMB nAtom1, nAtom2;
 6726|    260|    int     bondParity;
 6727|    260|    const char *p, *q, *t, *pStart, *pEnd, *r;
 6728|    260|    int  ret = 0;
 6729|    260|    INChI *pInChI = pInpInChI[bMobileH];
 6730|    260|    INChI *pInChIFrom = NULL;
 6731|       |    /*
 6732|       |    INChI_Stereo *Stereo = NULL;
 6733|       |    INChI_Stereo *StereoOther = NULL;
 6734|       |    */
 6735|    260|    INChI_Stereo **pStereo = NULL;
 6736|       |
 6737|    260|    const char   mult_type[] = "mnMNe";
 6738|    260|    const char   parity_type[] = "-+u?";
 6739|    260|    int   bIsoTo, bIsoFrom, nCpyType = CPY_SP2;
 6740|    260|    int   bIso = ( state == IST_MOBILE_H_ISO_SP2 || state == IST_FIXED_H_ISO_SP2 );
  ------------------
  |  Branch (6740:20): [True: 17, False: 243]
  |  Branch (6740:53): [True: 36, False: 207]
  ------------------
 6741|    260|    int   base = 10;
 6742|       |
 6743|    260|    if (!bIso && state != IST_MOBILE_H_SP2 && state != IST_FIXED_H_SP2)
  ------------------
  |  Branch (6743:9): [True: 207, False: 53]
  |  Branch (6743:18): [True: 54, False: 153]
  |  Branch (6743:47): [True: 0, False: 54]
  ------------------
 6744|      0|    {
 6745|      0|        return RI_ERR_PROGR; /* program error */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 6746|      0|    }
 6747|       |
 6748|    260|    if (str[0] != 'b')
  ------------------
  |  Branch (6748:9): [True: 255, False: 5]
  ------------------
 6749|    255|    {
 6750|    255|        return 0;
 6751|    255|    }
 6752|       |
 6753|      5|    pStart = (char  *) str + 1;
 6754|      5|    iComponent = 0;
 6755|      5|    nNumComponents = ppnNumComponents[bMobileH];
 6756|       |
 6757|      5|    if (!*pStart)
  ------------------
  |  Branch (6757:9): [True: 2, False: 3]
  ------------------
 6758|      2|    {
 6759|       |        /* create empty sp3 segment which means no sp3  */
 6760|      6|        for (iComponent = 0; iComponent < nNumComponents; iComponent++)
  ------------------
  |  Branch (6760:30): [True: 4, False: 2]
  ------------------
 6761|      4|        {
 6762|      4|            INChI *pIsoInChI = &pInChI[iComponent];
 6763|      4|            pStereo = bIso ? &pIsoInChI->StereoIsotopic : &pIsoInChI->Stereo;
  ------------------
  |  Branch (6763:23): [True: 0, False: 4]
  ------------------
 6764|      4|            if (*pStereo && ( pStereo[0]->b_parity || pStereo[0]->nNumberOfStereoBonds ||
  ------------------
  |  Branch (6764:17): [True: 0, False: 4]
  |  Branch (6764:31): [True: 0, False: 0]
  |  Branch (6764:55): [True: 0, False: 0]
  ------------------
 6765|      0|                              pStereo[0]->nBondAtom1 || pStereo[0]->nBondAtom2 ))
  ------------------
  |  Branch (6765:31): [True: 0, False: 0]
  |  Branch (6765:57): [True: 0, False: 0]
  ------------------
 6766|      0|            {
 6767|      0|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6768|      0|                goto exit_function;
 6769|      0|            }
 6770|       |            /* allocate empty sp3 stereo */
 6771|      4|            ret = CopySegment( pIsoInChI, NULL, CPY_SP2, bIso, -1 );
 6772|      4|            if (ret < 0)
  ------------------
  |  Branch (6772:17): [True: 0, False: 4]
  ------------------
 6773|      0|            {
 6774|      0|                goto exit_function;
 6775|      0|            }
 6776|      4|        }
 6777|      2|        ret = nNumComponents + 1;
 6778|      2|        goto exit_function;
 6779|      2|    }
 6780|       |
 6781|      3|    while (1)
  ------------------
  |  Branch (6781:12): [Folded - Ignored]
  ------------------
 6782|      3|    {
 6783|       |        /* Cycle over components */
 6784|      3|        if (!( pEnd = strchr( pStart, ';' ) ))
  ------------------
  |  Branch (6784:13): [True: 3, False: 0]
  ------------------
 6785|      3|        {
 6786|      3|            pEnd = pStart + strlen( pStart );
 6787|      3|        }
 6788|       |
 6789|      3|        if (( isdigit( *pStart ) &&
 6790|      3|              0 < ( val = (int) inchi_strtol( pStart, &q, 10 ) ) ||
  ------------------
  |  Branch (6790:15): [True: 1, False: 0]
  ------------------
 6791|      3|              ( q = pStart, val = 1 ) ) &&
  ------------------
  |  Branch (6791:15): [True: 2, False: 0]
  ------------------
 6792|      3|              ( t = strchr((char *)mult_type, *q)) && q + 1 == pEnd)
  ------------------
  |  Branch (6792:15): [True: 0, False: 3]
  |  Branch (6792:55): [True: 0, False: 0]
  ------------------
 6793|      0|        {
 6794|       |            /* process the abbreviation */
 6795|      0|            ret = 0;
 6796|      0|#if (FIX_DALKE_BUGS == 1)
 6797|      0|            if (iComponent + val > nNumComponents)
  ------------------
  |  Branch (6797:17): [True: 0, False: 0]
  ------------------
 6798|      0|            {
 6799|      0|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6800|      0|                goto exit_function;
 6801|      0|            }
 6802|      0|#endif
 6803|      0|            switch (bMobileH)
 6804|      0|            {
 6805|      0|                case TAUT_YES:
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (6805:17): [True: 0, False: 0]
  ------------------
 6806|      0|                    switch (state)
 6807|      0|                    {
 6808|      0|                        case IST_MOBILE_H_ISO_SP2:
  ------------------
  |  Branch (6808:25): [True: 0, False: 0]
  ------------------
 6809|      0|                            if (*q == 'm')
  ------------------
  |  Branch (6809:33): [True: 0, False: 0]
  ------------------
 6810|      0|                            {
 6811|       |                                /* copy from mobile H to isotopic mobile H */
 6812|      0|                                pInChIFrom = pInChI;
 6813|      0|                                bIsoTo = 1;
 6814|      0|                                bIsoFrom = 0;
 6815|      0|                            }
 6816|      0|                            else
 6817|      0|                            {
 6818|      0|                                if (*q == 'e')
  ------------------
  |  Branch (6818:37): [True: 0, False: 0]
  ------------------
 6819|      0|                                {
 6820|       |                                    /* copy from mobile H to isotopic mobile H */
 6821|      0|                                    pInChIFrom = pInChI;
 6822|      0|                                    bIsoTo = 1;
 6823|      0|                                    bIsoFrom = -1; /* empty */
 6824|      0|                                }
 6825|      0|                                else
 6826|      0|                                {
 6827|      0|                                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6828|      0|                                }
 6829|      0|                            }
 6830|      0|                            break;
 6831|      0|                        default:
  ------------------
  |  Branch (6831:25): [True: 0, False: 0]
  ------------------
 6832|      0|                            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6833|      0|                            break;
 6834|      0|                    }
 6835|      0|                    break;
 6836|      0|                case TAUT_NON:
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (6836:17): [True: 0, False: 0]
  ------------------
 6837|      0|                    switch (state)
 6838|      0|                    {
 6839|      0|                        case IST_FIXED_H_SP2:
  ------------------
  |  Branch (6839:25): [True: 0, False: 0]
  ------------------
 6840|      0|                            if (*q == 'm')
  ------------------
  |  Branch (6840:33): [True: 0, False: 0]
  ------------------
 6841|      0|                            {
 6842|       |                                /* copy from mobile H to fixed H */
 6843|      0|#if ( FIX_GAF_2019_2==1 )
 6844|      0|                                int inum = ALT_TAUT(bMobileH);
  ------------------
  |  |  582|      0|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (582:29): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 6845|      0|                                pInChIFrom = pInpInChI[inum];
 6846|       |#else
 6847|       |                                pInChIFrom = pInpInChI[ALT_TAUT(bMobileH)];
 6848|       |#endif
 6849|      0|                                bIsoTo = 0;
 6850|      0|                                bIsoFrom = 0;
 6851|      0|                            }
 6852|      0|                            else
 6853|      0|                            {
 6854|      0|                                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6855|      0|                            }
 6856|      0|                            break;
 6857|      0|                        case IST_FIXED_H_ISO_SP2:
  ------------------
  |  Branch (6857:25): [True: 0, False: 0]
  ------------------
 6858|      0|                            if (*q == 'm')
  ------------------
  |  Branch (6858:33): [True: 0, False: 0]
  ------------------
 6859|      0|                            {
 6860|       |                                /* copy from mobile H to fixed isotopic H */
 6861|      0|                                pInChIFrom = pInpInChI[ALT_TAUT( bMobileH )];
  ------------------
  |  |  582|      0|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (582:29): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 6862|      0|                                bIsoTo = 1;
 6863|      0|                                bIsoFrom = 0;
 6864|      0|                            }
 6865|      0|                            else
 6866|      0|                            {
 6867|      0|                                if (*q == 'M')
  ------------------
  |  Branch (6867:37): [True: 0, False: 0]
  ------------------
 6868|      0|                                {
 6869|       |                                    /* copy from isotopic mobile H to fixed isotopic H */
 6870|      0|                                    pInChIFrom = pInpInChI[ALT_TAUT( bMobileH )];
  ------------------
  |  |  582|      0|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (582:29): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 6871|      0|                                    bIsoTo = 1;
 6872|      0|                                    bIsoFrom = 1;
 6873|      0|                                }
 6874|      0|                                else
 6875|      0|                                {
 6876|      0|                                    if (*q == 'n')
  ------------------
  |  Branch (6876:41): [True: 0, False: 0]
  ------------------
 6877|      0|                                    {
 6878|       |                                        /* copy from fixed H to fixed isotopic H */
 6879|      0|                                        pInChIFrom = pInChI;
 6880|      0|                                        bIsoTo = 1;
 6881|      0|                                        bIsoFrom = 0;
 6882|      0|                                    }
 6883|      0|                                    else
 6884|      0|                                    {
 6885|      0|                                        if (*q == 'e')
  ------------------
  |  Branch (6885:45): [True: 0, False: 0]
  ------------------
 6886|      0|                                        {
 6887|       |                                            /* copy from mobile H to isotopic mobile H */
 6888|      0|                                            pInChIFrom = pInChI;
 6889|      0|                                            bIsoTo = 1;
 6890|      0|                                            bIsoFrom = -1; /* empty */
 6891|      0|                                        }
 6892|      0|                                        else
 6893|      0|                                        {
 6894|      0|                                            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6895|      0|                                        }
 6896|      0|                                    }
 6897|      0|                                }
 6898|      0|                            }
 6899|      0|                            break;
 6900|      0|                        default:
  ------------------
  |  Branch (6900:25): [True: 0, False: 0]
  ------------------
 6901|      0|                            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6902|      0|                            break;
 6903|      0|                    }
 6904|      0|                    break;
 6905|       |
 6906|      0|                default:
  ------------------
  |  Branch (6906:17): [True: 0, False: 0]
  ------------------
 6907|      0|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6908|      0|                    break;
 6909|      0|            }
 6910|      0|            if (ret < 0)
  ------------------
  |  Branch (6910:17): [True: 0, False: 0]
  ------------------
 6911|      0|            {
 6912|      0|                goto exit_function;
 6913|      0|            }
 6914|       |            /* copy */
 6915|      0|            for (i = 0; i < val; i++)
  ------------------
  |  Branch (6915:25): [True: 0, False: 0]
  ------------------
 6916|      0|            {
 6917|      0|#if ( FIX_GAF_2019_2==1 )
 6918|      0|                if ((iComponent + i> nNumComponents - 1) || (iComponent + i<0))
  ------------------
  |  Branch (6918:21): [True: 0, False: 0]
  |  Branch (6918:61): [True: 0, False: 0]
  ------------------
 6919|      0|                {
 6920|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6921|      0|                    goto exit_function;
 6922|      0|                }
 6923|      0|                if (NULL == pInChIFrom || NULL == pInChIFrom + iComponent + i)
  ------------------
  |  Branch (6923:21): [True: 0, False: 0]
  |  Branch (6923:43): [True: 0, False: 0]
  ------------------
 6924|      0|                {
 6925|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6926|      0|                    goto exit_function;
 6927|      0|                }
 6928|       |
 6929|      0|                if ((pInChIFrom[iComponent + i].nNumberOfAtoms <= 0) || (pInChIFrom[iComponent + i].nNumberOfAtoms>MAX_ATOMS))
  ------------------
  |  |   43|      0|#define MAX_ATOMS  32766
  ------------------
  |  Branch (6929:21): [True: 0, False: 0]
  |  Branch (6929:73): [True: 0, False: 0]
  ------------------
 6930|      0|                {
 6931|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6932|      0|                    goto exit_function;
 6933|      0|                }
 6934|      0|#endif
 6935|      0|                ret = CopySegment(pInChI + iComponent + i, pInChIFrom + iComponent + i, nCpyType, bIsoTo, bIsoFrom);
 6936|      0|                if (!ret)
  ------------------
  |  Branch (6936:21): [True: 0, False: 0]
  ------------------
 6937|      0|                {
 6938|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6939|      0|                }
 6940|      0|                if (ret < 0)
  ------------------
  |  Branch (6940:21): [True: 0, False: 0]
  ------------------
 6941|      0|                {
 6942|      0|                    goto exit_function;
 6943|      0|                }
 6944|      0|            }
 6945|      0|            mpy_component = val;
 6946|      0|            goto end_main_cycle;
 6947|      0|        }
 6948|      3|        else
 6949|       |            /* regular multiplier */
 6950|      3|            if (( p = strchr( pStart, '*' ) ) && p < pEnd)
  ------------------
  |  Branch (6950:17): [True: 0, False: 3]
  |  Branch (6950:50): [True: 0, False: 0]
  ------------------
 6951|      0|            {
 6952|      0|                mpy_component = (int) inchi_strtol( pStart, &q, 10 );
 6953|      0|#if ( CHECK_STRTOL_ATNUMB==1 )
 6954|      0|                if (mpy_component>MAX_ATOMS || mpy_component<0)
  ------------------
  |  |   43|      0|#define MAX_ATOMS  32766
  ------------------
  |  Branch (6954:21): [True: 0, False: 0]
  |  Branch (6954:48): [True: 0, False: 0]
  ------------------
 6955|      0|                {
 6956|      0|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6957|      0|                    goto exit_function;
 6958|      0|                }
 6959|      0|#endif
 6960|      0|                if (p != q)
  ------------------
  |  Branch (6960:21): [True: 0, False: 0]
  ------------------
 6961|      0|                {
 6962|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6963|      0|                    goto exit_function;
 6964|      0|                }
 6965|       |
 6966|      0|                p++; /* move to the 1st character of the component */
 6967|      0|            }
 6968|      3|            else
 6969|      3|            {
 6970|      3|                mpy_component = 1;
 6971|      3|                p = pStart;
 6972|      3|            }
 6973|      3|#if (FIX_DALKE_BUGS == 1)
 6974|      3|        if (iComponent + mpy_component > nNumComponents)
  ------------------
  |  Branch (6974:13): [True: 0, False: 3]
  ------------------
 6975|      0|        {
 6976|      0|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6977|      0|            goto exit_function;
 6978|      0|        }
 6979|      3|#endif
 6980|      3|        pStart = p;
 6981|      3|        if (p < pEnd && *pbAbc == -1)
  ------------------
  |  Branch (6981:13): [True: 3, False: 0]
  |  Branch (6981:25): [True: 0, False: 3]
  ------------------
 6982|      0|        {
 6983|       |            /* check if compressed InChI */
 6984|      0|            *pbAbc = isupper( UCINT *p ) ? 1 : 0;
 6985|      0|        }
 6986|      3|        base = ( *pbAbc == 1 ) ? ALPHA_BASE : 10;
  ------------------
  |  |   96|      0|#define ALPHA_BASE  27
  ------------------
  |  Branch (6986:16): [True: 0, False: 3]
  ------------------
 6987|      3|        if (*pbAbc == 1)
  ------------------
  |  Branch (6987:13): [True: 0, False: 3]
  ------------------
 6988|      0|        {
 6989|       |            /* process the componnt: at1-at2p,at1-at2p,... */
 6990|       |            /* pass 1: find number of stereobonds */
 6991|      0|            for (p = pStart, iBond = 0; p < pEnd; iBond++)
  ------------------
  |  Branch (6991:41): [True: 0, False: 0]
  ------------------
 6992|      0|            {
 6993|       |                /* atoms 1, 2, and parity */
 6994|      0|                if (( nAtom1 = (AT_NUMB) inchi_strtol( p, &p, base ) ) &&
  ------------------
  |  Branch (6994:21): [True: 0, False: 0]
  ------------------
 6995|      0|                    ( nAtom2 = (AT_NUMB) inchi_strtol( p, &p, base ) ) &&
  ------------------
  |  Branch (6995:21): [True: 0, False: 0]
  ------------------
 6996|      0|                     ( bondParity = (int) inchi_strtol( p, &p, 10 ),
  ------------------
  |  Branch (6996:22): [True: 0, False: 0]
  ------------------
 6997|      0|                       AB_MIN_KNOWN_PARITY <= bondParity && bondParity <= AB_MAX_KNOWN_PARITY ))
  ------------------
  |  |  259|      0|#define AB_MIN_KNOWN_PARITY        1
  ------------------
                                     AB_MIN_KNOWN_PARITY <= bondParity && bondParity <= AB_MAX_KNOWN_PARITY ))
  ------------------
  |  |  258|      0|#define AB_MAX_KNOWN_PARITY        4 /* precalculated from const. equivalence parities */
  ------------------
  |  Branch (6997:24): [True: 0, False: 0]
  |  Branch (6997:61): [True: 0, False: 0]
  ------------------
 6998|      0|                {
 6999|      0|                    ; /* okay */
 7000|      0|                }
 7001|      0|                else
 7002|      0|                {
 7003|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7004|      0|                    goto exit_function;
 7005|      0|                }
 7006|      0|                if (nAtom1 <= nAtom2 ||
  ------------------
  |  Branch (7006:21): [True: 0, False: 0]
  ------------------
 7007|      0|                     nAtom1 > pInChI[iComponent].nNumberOfAtoms)
  ------------------
  |  Branch (7007:22): [True: 0, False: 0]
  ------------------
 7008|      0|                {
 7009|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7010|      0|                    goto exit_function;
 7011|      0|                }
 7012|      0|            }
 7013|      0|        }
 7014|      3|        else
 7015|      3|        {
 7016|       |            /* process the componnt: at1-at2p,at1-at2p,... */
 7017|       |            /* pass 1: find number of stereobonds */
 7018|      4|            for (p = pStart, iBond = 0; p < pEnd; iBond++, p += ( *p == ',' ))
  ------------------
  |  Branch (7018:41): [True: 3, False: 1]
  ------------------
 7019|      3|            {
 7020|      3|                nAtom1 = (AT_NUMB) inchi_strtol( p, &q, 10 );
 7021|      3|#if ( CHECK_STRTOL_ATNUMB==1 )
 7022|      3|                if (nAtom1>MAX_ATOMS || nAtom1<0)
  ------------------
  |  |   43|      6|#define MAX_ATOMS  32766
  ------------------
  |  Branch (7022:21): [True: 0, False: 3]
  |  Branch (7022:41): [True: 0, False: 3]
  ------------------
 7023|      0|                {
 7024|      0|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7025|      0|                    goto exit_function;
 7026|      0|                }
 7027|      3|#endif
 7028|      3|                if (*q != '-')
  ------------------
  |  Branch (7028:21): [True: 2, False: 1]
  ------------------
 7029|      2|                {
 7030|      2|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      2|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7031|      2|                    goto exit_function;
 7032|      2|                }
 7033|      1|                p = q + 1;
 7034|      1|                nAtom2 = (AT_NUMB) inchi_strtol( p, &q, 10 );
 7035|      1|#if ( CHECK_STRTOL_ATNUMB==1 )
 7036|      1|                if (nAtom2>MAX_ATOMS || nAtom2<0)
  ------------------
  |  |   43|      2|#define MAX_ATOMS  32766
  ------------------
  |  Branch (7036:21): [True: 0, False: 1]
  |  Branch (7036:41): [True: 0, False: 1]
  ------------------
 7037|      0|                {
 7038|      0|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7039|      0|                    goto exit_function;
 7040|      0|                }
 7041|      1|#endif
 7042|      1|                if (!nAtom1 || !nAtom2 ||
  ------------------
  |  Branch (7042:21): [True: 0, False: 1]
  |  Branch (7042:32): [True: 0, False: 1]
  ------------------
 7043|      1|                     nAtom1 <= nAtom2 ||
  ------------------
  |  Branch (7043:22): [True: 0, False: 1]
  ------------------
 7044|      1|                     nAtom1 > pInChI[iComponent].nNumberOfAtoms ||
  ------------------
  |  Branch (7044:22): [True: 0, False: 1]
  ------------------
 7045|      1|                    !(r = strchr((char *)parity_type, *q)))
  ------------------
  |  Branch (7045:21): [True: 0, False: 1]
  ------------------
 7046|      0|                {
 7047|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7048|      0|                    goto exit_function;
 7049|      0|                }
 7050|      1|                p = q + 1;
 7051|      1|            }
 7052|      3|        }
 7053|       |
 7054|      1|        if (p != pEnd)
  ------------------
  |  Branch (7054:13): [True: 0, False: 1]
  ------------------
 7055|      0|        {
 7056|      0|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7057|      0|            goto exit_function;
 7058|      0|        }
 7059|      1|        len = iBond;
 7060|       |
 7061|      1|#if ( FIX_GAF_2019_2==1 )
 7062|      1|        if ((iComponent > nNumComponents - 1) || (iComponent<0))
  ------------------
  |  Branch (7062:13): [True: 0, False: 1]
  |  Branch (7062:50): [True: 0, False: 1]
  ------------------
 7063|      0|        {
 7064|      0|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7065|      0|            goto exit_function;
 7066|      0|        }
 7067|      1|        if (pInChI[iComponent].nNumberOfAtoms <= 0 || pInChI[iComponent].nNumberOfAtoms > MAX_ATOMS)
  ------------------
  |  |   43|      1|#define MAX_ATOMS  32766
  ------------------
  |  Branch (7067:13): [True: 0, False: 1]
  |  Branch (7067:55): [True: 0, False: 1]
  ------------------
 7068|      0|        {
 7069|      0|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7070|      0|            goto exit_function;
 7071|      0|        }
 7072|      1|#endif
 7073|       |
 7074|       |        /* memory allocation */
 7075|      1|        pStereo = bIso ? &pInChI[iComponent].StereoIsotopic : &pInChI[iComponent].Stereo;
  ------------------
  |  Branch (7075:19): [True: 1, False: 0]
  ------------------
 7076|      1|        if (!*pStereo)
  ------------------
  |  Branch (7076:13): [True: 1, False: 0]
  ------------------
 7077|      1|        {
 7078|      1|            if (!( *pStereo = (INChI_Stereo *) inchi_calloc( 1, sizeof( **pStereo ) ) ))
  ------------------
  |  | 1133|      1|#define inchi_calloc   calloc
  ------------------
  |  Branch (7078:17): [True: 0, False: 1]
  ------------------
 7079|      0|            {
 7080|      0|                ret = RI_ERR_ALLOC; /* memory allocation failed */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 7081|      0|                goto exit_function;
 7082|      0|            }
 7083|      1|        }
 7084|      1|        if (pStereo[0]->b_parity || pStereo[0]->nNumberOfStereoBonds ||
  ------------------
  |  Branch (7084:13): [True: 0, False: 1]
  |  Branch (7084:37): [True: 0, False: 1]
  ------------------
 7085|      1|             pStereo[0]->nBondAtom1 || pStereo[0]->nBondAtom2)
  ------------------
  |  Branch (7085:14): [True: 0, False: 1]
  |  Branch (7085:40): [True: 0, False: 1]
  ------------------
 7086|      0|        {
 7087|      0|            ret = RI_ERR_SYNTAX; /* syntax error: bonds have already been allocated */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7088|      0|            goto exit_function;
 7089|      0|        }
 7090|       |        /* allocate sp2 stereo */
 7091|      1|        if (!( pStereo[0]->b_parity = (S_CHAR *) inchi_calloc( len + 1, sizeof( pStereo[0]->b_parity[0] ) ) ) ||
  ------------------
  |  | 1133|      1|#define inchi_calloc   calloc
  ------------------
  |  Branch (7091:13): [True: 0, False: 1]
  ------------------
 7092|      1|             !( pStereo[0]->nBondAtom1 = (AT_NUMB *) inchi_calloc( len + 1, sizeof( pStereo[0]->nBondAtom1[0] ) ) ) ||
  ------------------
  |  | 1133|      1|#define inchi_calloc   calloc
  ------------------
  |  Branch (7092:14): [True: 0, False: 1]
  ------------------
 7093|      1|             !( pStereo[0]->nBondAtom2 = (AT_NUMB *) inchi_calloc( len + 1, sizeof( pStereo[0]->nBondAtom2[0] ) ) ))
  ------------------
  |  | 1133|      1|#define inchi_calloc   calloc
  ------------------
  |  Branch (7093:14): [True: 0, False: 1]
  ------------------
 7094|      0|        {
 7095|       |            /* cleanup */
 7096|      0|            if (pStereo[0]->b_parity)
  ------------------
  |  Branch (7096:17): [True: 0, False: 0]
  ------------------
 7097|      0|            {
 7098|      0|                INCHI_HEAPCHK
 7099|      0|                    inchi_free( pStereo[0]->b_parity );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 7100|      0|                pStereo[0]->b_parity = NULL;
 7101|      0|            }
 7102|      0|            if (pStereo[0]->nBondAtom1)
  ------------------
  |  Branch (7102:17): [True: 0, False: 0]
  ------------------
 7103|      0|            {
 7104|      0|                INCHI_HEAPCHK
 7105|      0|                    inchi_free( pStereo[0]->nBondAtom1 );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 7106|      0|                pStereo[0]->nBondAtom1 = NULL;
 7107|      0|            }
 7108|      0|            if (pStereo[0]->nBondAtom2)
  ------------------
  |  Branch (7108:17): [True: 0, False: 0]
  ------------------
 7109|      0|            {
 7110|      0|                INCHI_HEAPCHK
 7111|      0|                    inchi_free( pStereo[0]->nBondAtom2 );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 7112|      0|                pStereo[0]->nBondAtom2 = NULL;
 7113|      0|            }
 7114|      0|            INCHI_HEAPCHK
 7115|      0|                ret = RI_ERR_ALLOC; /* memory allocation failed */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 7116|      0|            goto exit_function;
 7117|      0|        }
 7118|       |
 7119|       |        /* pass 2: store stereobonds */
 7120|      1|        if (*pbAbc == 1)
  ------------------
  |  Branch (7120:13): [True: 0, False: 1]
  ------------------
 7121|      0|        {
 7122|      0|            for (p = pStart, iBond = 0; p < pEnd; iBond++)
  ------------------
  |  Branch (7122:41): [True: 0, False: 0]
  ------------------
 7123|      0|            {
 7124|      0|                if (( nAtom1 = (AT_NUMB) inchi_strtol( p, &p, base ) ) &&
  ------------------
  |  Branch (7124:21): [True: 0, False: 0]
  ------------------
 7125|      0|                    ( nAtom2 = (AT_NUMB) inchi_strtol( p, &p, base ) ) &&
  ------------------
  |  Branch (7125:21): [True: 0, False: 0]
  ------------------
 7126|      0|                     ( bondParity = (int) inchi_strtol( p, &p, 10 ),
  ------------------
  |  Branch (7126:22): [True: 0, False: 0]
  ------------------
 7127|      0|                       AB_MIN_KNOWN_PARITY <= bondParity && bondParity <= AB_MAX_KNOWN_PARITY ))
  ------------------
  |  |  259|      0|#define AB_MIN_KNOWN_PARITY        1
  ------------------
                                     AB_MIN_KNOWN_PARITY <= bondParity && bondParity <= AB_MAX_KNOWN_PARITY ))
  ------------------
  |  |  258|      0|#define AB_MAX_KNOWN_PARITY        4 /* precalculated from const. equivalence parities */
  ------------------
  |  Branch (7127:24): [True: 0, False: 0]
  |  Branch (7127:61): [True: 0, False: 0]
  ------------------
 7128|      0|                {
 7129|      0|                    ; /* okay */
 7130|      0|                }
 7131|      0|                else
 7132|      0|                {
 7133|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7134|      0|                    goto exit_function;
 7135|      0|                }
 7136|      0|                pStereo[0]->b_parity[iBond] = bondParity;
 7137|      0|                pStereo[0]->nBondAtom1[iBond] = nAtom1;
 7138|      0|                pStereo[0]->nBondAtom2[iBond] = nAtom2;
 7139|       |
 7140|      0|                if (iBond &&
  ------------------
  |  Branch (7140:21): [True: 0, False: 0]
  ------------------
 7141|      0|                     !( pStereo[0]->nBondAtom1[iBond - 1] < nAtom1 ||
  ------------------
  |  Branch (7141:25): [True: 0, False: 0]
  ------------------
 7142|      0|                        pStereo[0]->nBondAtom1[iBond - 1] == nAtom1 &&
  ------------------
  |  Branch (7142:25): [True: 0, False: 0]
  ------------------
 7143|      0|                        pStereo[0]->nBondAtom2[iBond - 1] < nAtom2 ))
  ------------------
  |  Branch (7143:25): [True: 0, False: 0]
  ------------------
 7144|      0|                {
 7145|      0|                    ret = RI_ERR_SYNTAX; /* syntax error: wrong bond order */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7146|      0|                    goto exit_function;
 7147|      0|                }
 7148|      0|            }
 7149|      0|        }
 7150|      1|        else
 7151|      1|        {
 7152|      2|            for (p = pStart, iBond = 0; p < pEnd; iBond++, p += ( *p == ',' ))
  ------------------
  |  Branch (7152:41): [True: 1, False: 1]
  ------------------
 7153|      1|            {
 7154|      1|                nAtom1 = (AT_NUMB) inchi_strtol( p, &q, 10 );
 7155|      1|#if ( CHECK_STRTOL_ATNUMB==1 )
 7156|      1|                if (nAtom1>MAX_ATOMS || nAtom1<0)
  ------------------
  |  |   43|      2|#define MAX_ATOMS  32766
  ------------------
  |  Branch (7156:21): [True: 0, False: 1]
  |  Branch (7156:41): [True: 0, False: 1]
  ------------------
 7157|      0|                {
 7158|      0|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7159|      0|                    goto exit_function;
 7160|      0|                }
 7161|      1|#endif
 7162|      1|                if (*q != '-')
  ------------------
  |  Branch (7162:21): [True: 0, False: 1]
  ------------------
 7163|      0|                {
 7164|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7165|      0|                    goto exit_function;
 7166|      0|                }
 7167|      1|                p = q + 1;
 7168|      1|                nAtom2 = (AT_NUMB) inchi_strtol( p, &q, 10 );
 7169|      1|#if ( CHECK_STRTOL_ATNUMB==1 )
 7170|      1|                if (nAtom2>MAX_ATOMS || nAtom2<0)
  ------------------
  |  |   43|      2|#define MAX_ATOMS  32766
  ------------------
  |  Branch (7170:21): [True: 0, False: 1]
  |  Branch (7170:41): [True: 0, False: 1]
  ------------------
 7171|      0|                {
 7172|      0|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7173|      0|                    goto exit_function;
 7174|      0|                }
 7175|      1|#endif
 7176|      1|                if (!(r = strchr((char *)parity_type, *q)))
  ------------------
  |  Branch (7176:21): [True: 0, False: 1]
  ------------------
 7177|      0|                {
 7178|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7179|      0|                    goto exit_function;
 7180|      0|                }
 7181|      1|                p = q + 1;
 7182|      1|                bondParity = (int) ( r - parity_type ) + 1;
 7183|      1|                pStereo[0]->b_parity[iBond] = bondParity;
 7184|      1|                pStereo[0]->nBondAtom1[iBond] = nAtom1;
 7185|      1|                pStereo[0]->nBondAtom2[iBond] = nAtom2;
 7186|       |
 7187|      1|                if (iBond &&
  ------------------
  |  Branch (7187:21): [True: 0, False: 1]
  ------------------
 7188|      1|                     !( pStereo[0]->nBondAtom1[iBond - 1] < nAtom1 ||
  ------------------
  |  Branch (7188:25): [True: 0, False: 0]
  ------------------
 7189|      0|                        pStereo[0]->nBondAtom1[iBond - 1] == nAtom1 &&
  ------------------
  |  Branch (7189:25): [True: 0, False: 0]
  ------------------
 7190|      0|                        pStereo[0]->nBondAtom2[iBond - 1] < nAtom2 ))
  ------------------
  |  Branch (7190:25): [True: 0, False: 0]
  ------------------
 7191|      0|                {
 7192|      0|                    ret = RI_ERR_SYNTAX; /* syntax error: wrong bond order */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7193|      0|                    goto exit_function;
 7194|      0|                }
 7195|      1|            }
 7196|      1|        }
 7197|      1|        pStereo[0]->nNumberOfStereoBonds = iBond;
 7198|       |
 7199|      1|        if (p != pEnd)
  ------------------
  |  Branch (7199:13): [True: 0, False: 1]
  ------------------
 7200|      0|        {
 7201|      0|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7202|      0|            goto exit_function;
 7203|      0|        }
 7204|       |
 7205|       |        /* multiplier */
 7206|      1|        for (i = 1; i < mpy_component; i++)
  ------------------
  |  Branch (7206:21): [True: 0, False: 1]
  ------------------
 7207|      0|        {
 7208|      0|            ret = CopySegment( pInChI + iComponent + i, pInChI + iComponent, nCpyType, bIso, bIso );
 7209|      0|            if (ret < 0)
  ------------------
  |  Branch (7209:17): [True: 0, False: 0]
  ------------------
 7210|      0|            {
 7211|      0|                goto exit_function;
 7212|      0|            }
 7213|      0|        }
 7214|       |
 7215|      1|    end_main_cycle:
 7216|      1|        iComponent += mpy_component;
 7217|      1|        if (*pEnd)
  ------------------
  |  Branch (7217:13): [True: 0, False: 1]
  ------------------
 7218|      0|        {
 7219|      0|            pStart = pEnd + 1;
 7220|      0|            continue;
 7221|      0|        }
 7222|      1|        else
 7223|      1|        {
 7224|      1|            break;
 7225|      1|        }
 7226|      1|    }
 7227|      1|    if (nNumComponents != iComponent)
  ------------------
  |  Branch (7227:9): [True: 0, False: 1]
  ------------------
 7228|      0|    {
 7229|      0|        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 7230|      0|        goto exit_function;
 7231|      0|    }
 7232|      1|    ret = iComponent + 1;
 7233|       |
 7234|      5|exit_function:
 7235|       |
 7236|      5|    return ret;
 7237|      1|}
ichiread.c:ParseSegmentSp3:
 6466|    258|{
 6467|       |    /* Pass 1: count bonds and find actual numbers of  atom */
 6468|    258|    const char mult_type[] = "mnMNe";
 6469|    258|    const char parity_type[] = "-+u?";
 6470|    258|    const char *p, *q, *t, *pStart, *pEnd, *r;
 6471|    258|    AT_NUMB nAtom1;
 6472|    258|    int mpy_component, val;
 6473|    258|    int nNumComponents, iComponent, len, iAtom;
 6474|    258|    int atomParity;
 6475|    258|    int ret = 0, retf = 0;
 6476|    258|    int base = 10;
 6477|    258|    int nCpyType = CPY_SP3;
 6478|    258|    int bIso = ( state == IST_MOBILE_H_ISO_SP3 || state == IST_FIXED_H_ISO_SP3 );
  ------------------
  |  Branch (6478:18): [True: 17, False: 241]
  |  Branch (6478:51): [True: 36, False: 205]
  ------------------
 6479|    258|    INChI *pInChI = pInpInChI[bMobileH];
 6480|    258|    INChI_Stereo **pStereo = NULL;
 6481|       |
 6482|    258|    if (!bIso && state != IST_MOBILE_H_SP3 && state != IST_FIXED_H_SP3)
  ------------------
  |  Branch (6482:9): [True: 205, False: 53]
  |  Branch (6482:18): [True: 54, False: 151]
  |  Branch (6482:47): [True: 0, False: 54]
  ------------------
 6483|      0|    {
 6484|      0|        return RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 6485|      0|    }
 6486|    258|    if (str[0] != 't')
  ------------------
  |  Branch (6486:9): [True: 209, False: 49]
  ------------------
 6487|    209|    {
 6488|    209|        return 0; /* RI_ERR_EOF - ? */
 6489|    209|    }
 6490|       |
 6491|     49|    pStart = (char  *) str + 1;
 6492|     49|    iComponent = 0;
 6493|     49|    nNumComponents = ppnNumComponents[bMobileH];
 6494|       |
 6495|       |    /* Pass 1: create empty segment and exit */
 6496|     49|    if (!*pStart)
  ------------------
  |  Branch (6496:9): [True: 21, False: 28]
  ------------------
 6497|     21|    {
 6498|     21|        ret = SegmentSp3CreateEmpty( str, bMobileH, pInpInChI, nNumComponents, state, pbAbc );
 6499|     21|        goto exit_function;
 6500|     21|    }
 6501|       |
 6502|       |    /* Cycle over components */
 6503|   113k|    while (1)
  ------------------
  |  Branch (6503:12): [Folded - Ignored]
  ------------------
 6504|   113k|    {
 6505|   113k|        if (!( pEnd = strchr( pStart, ';' ) ))
  ------------------
  |  Branch (6505:13): [True: 28, False: 113k]
  ------------------
 6506|     28|        {
 6507|     28|            pEnd = pStart + strlen( pStart );
 6508|     28|        }
 6509|       |
 6510|       |
 6511|       |        /* Abbreviation? */
 6512|   113k|        if (( isdigit( *pStart ) &&
 6513|   113k|              0 < ( val = (int) inchi_strtol( pStart, &q, 10 ) ) ||
  ------------------
  |  Branch (6513:15): [True: 5, False: 0]
  ------------------
 6514|   113k|              ( q = pStart, val = 1 ) ) &&
  ------------------
  |  Branch (6514:15): [True: 113k, False: 0]
  ------------------
 6515|   113k|              ( t = strchr((char *)mult_type, *q)) && q + 1 == pEnd)
  ------------------
  |  Branch (6515:15): [True: 23, False: 113k]
  |  Branch (6515:55): [True: 0, False: 23]
  ------------------
 6516|      0|        {
 6517|       |            /* Process abbrebiation */
 6518|      0|            retf = SegmentSp3ProcessAbbreviation( &mpy_component, iComponent, nNumComponents,
 6519|      0|                                                  val, q, state, pbAbc, bMobileH, nCpyType,
 6520|      0|                                                  pInChI, pInpInChI[ALT_TAUT( bMobileH )] );
  ------------------
  |  |  582|      0|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (582:29): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 6521|      0|            if (retf == RI_ERR_SYNTAX)
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
  |  Branch (6521:17): [True: 0, False: 0]
  ------------------
 6522|      0|            {
 6523|      0|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6524|      0|                goto exit_function;
 6525|      0|            }
 6526|      0|            goto end_main_cycle;
 6527|      0|        }
 6528|       |        /* Multiplier? */
 6529|   113k|        else if (( p = strchr( pStart, '*' ) ) && p < pEnd)
  ------------------
  |  Branch (6529:18): [True: 0, False: 113k]
  |  Branch (6529:51): [True: 0, False: 0]
  ------------------
 6530|      0|        {
 6531|       |            /* Process regular multiplier */
 6532|      0|            mpy_component = (int) inchi_strtol( pStart, &q, 10 );
 6533|      0|            if (p != q)
  ------------------
  |  Branch (6533:17): [True: 0, False: 0]
  ------------------
 6534|      0|            {
 6535|      0|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6536|      0|                goto exit_function;
 6537|      0|            }
 6538|      0|            p++; /* move to the 1st character of the component */
 6539|      0|        }
 6540|   113k|        else
 6541|   113k|        {
 6542|       |            /* Just normal sequence of centers/configs, prepare to read */
 6543|   113k|            mpy_component = 1;
 6544|   113k|            p = pStart;
 6545|   113k|        }
 6546|   113k|#if (FIX_DALKE_BUGS == 1)
 6547|   113k|        if (iComponent + mpy_component > nNumComponents)
  ------------------
  |  Branch (6547:13): [True: 0, False: 113k]
  ------------------
 6548|      0|        {
 6549|      0|            ret = RI_ERR_SYNTAX; 
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6550|      0|            goto exit_function;
 6551|      0|        }
 6552|   113k|#endif
 6553|       |
 6554|   113k|        pStart = p;
 6555|   113k|        if (p < pEnd && *pbAbc == -1)
  ------------------
  |  Branch (6555:13): [True: 7, False: 113k]
  |  Branch (6555:25): [True: 0, False: 7]
  ------------------
 6556|      0|        {
 6557|       |            /* check if compressed InChI */
 6558|      0|            *pbAbc = isupper( UCINT *p ) ? 1 : 0;
 6559|      0|        }
 6560|   113k|        base = ( *pbAbc == 1 ) ? ALPHA_BASE : 10;
  ------------------
  |  |   96|      0|#define ALPHA_BASE  27
  ------------------
  |  Branch (6560:16): [True: 0, False: 113k]
  ------------------
 6561|       |        
 6562|       |        /* Process the component: at1p,at1p,... */
 6563|       |        
 6564|       |        /* Pass 1: find number of stereoatoms len */
 6565|   113k|        if (*pbAbc == 1)
  ------------------
  |  Branch (6565:13): [True: 0, False: 113k]
  ------------------
 6566|      0|        {
 6567|      0|            for (p = pStart, iAtom = 0; p < pEnd; iAtom++)
  ------------------
  |  Branch (6567:41): [True: 0, False: 0]
  ------------------
 6568|      0|            {
 6569|      0|                if (( nAtom1 = (AT_NUMB) inchi_strtol( p, &p, base ) ) &&
  ------------------
  |  Branch (6569:21): [True: 0, False: 0]
  ------------------
 6570|      0|                    ( atomParity = (int) inchi_strtol( p, &p, 10 ),
  ------------------
  |  Branch (6570:21): [True: 0, False: 0]
  ------------------
 6571|      0|                      AB_MIN_KNOWN_PARITY <= atomParity && atomParity <= AB_MAX_KNOWN_PARITY ))
  ------------------
  |  |  259|      0|#define AB_MIN_KNOWN_PARITY        1
  ------------------
                                    AB_MIN_KNOWN_PARITY <= atomParity && atomParity <= AB_MAX_KNOWN_PARITY ))
  ------------------
  |  |  258|      0|#define AB_MAX_KNOWN_PARITY        4 /* precalculated from const. equivalence parities */
  ------------------
  |  Branch (6571:23): [True: 0, False: 0]
  |  Branch (6571:60): [True: 0, False: 0]
  ------------------
 6572|      0|                {
 6573|      0|                    ; /* okay */
 6574|      0|                }
 6575|      0|                else
 6576|      0|                {
 6577|      0|                    ret = RI_ERR_SYNTAX; 
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6578|      0|                    goto exit_function;
 6579|      0|                }
 6580|      0|                if (nAtom1 > pInChI[iComponent].nNumberOfAtoms)
  ------------------
  |  Branch (6580:21): [True: 0, False: 0]
  ------------------
 6581|      0|                {
 6582|      0|                    ret = RI_ERR_SYNTAX; 
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6583|      0|                    goto exit_function;
 6584|      0|                }
 6585|      0|            }
 6586|      0|        }
 6587|   113k|        else
 6588|   113k|        {
 6589|   113k|            for (p = pStart, iAtom = 0; p < pEnd; iAtom++, p += ( *p == ',' ))
  ------------------
  |  Branch (6589:41): [True: 7, False: 113k]
  ------------------
 6590|      7|            {
 6591|      7|                nAtom1 = (AT_NUMB) inchi_strtol( p, &q, 10 );
 6592|      7|                p = q + 1;
 6593|      7|                if ( !nAtom1 ||
  ------------------
  |  Branch (6593:22): [True: 2, False: 5]
  ------------------
 6594|      7|                     nAtom1 > pInChI[iComponent].nNumberOfAtoms ||
  ------------------
  |  Branch (6594:22): [True: 0, False: 5]
  ------------------
 6595|      7|                     !(r = strchr((char *)parity_type, *q)))
  ------------------
  |  Branch (6595:22): [True: 0, False: 5]
  ------------------
 6596|      2|                {
 6597|      2|                    ret = RI_ERR_SYNTAX; 
  ------------------
  |  |   44|      2|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6598|      2|                    goto exit_function;
 6599|      2|                }
 6600|      7|            }
 6601|   113k|        }
 6602|   113k|        if (p != pEnd)
  ------------------
  |  Branch (6602:13): [True: 0, False: 113k]
  ------------------
 6603|      0|        {
 6604|      0|            ret = RI_ERR_SYNTAX; 
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6605|      0|            goto exit_function;
 6606|      0|        }
 6607|   113k|        len = iAtom;	
 6608|       |        /* Found len, the number of stereo centers in /t segment for component iComponent */
 6609|       |
 6610|   113k|#if ( ( FIX_GAF_2019_1==1 ) || ( FIX_GAF_2019_2==1 ) )
 6611|   113k|        if ((iComponent > nNumComponents - 1) || (iComponent<0))
  ------------------
  |  Branch (6611:13): [True: 0, False: 113k]
  |  Branch (6611:50): [True: 0, False: 113k]
  ------------------
 6612|      0|        {
 6613|      0|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6614|      0|            goto exit_function;
 6615|      0|        }
 6616|   113k|        if (pInChI[iComponent].nNumberOfAtoms <= 0 || pInChI[iComponent].nNumberOfAtoms > MAX_ATOMS)
  ------------------
  |  |   43|   113k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (6616:13): [True: 0, False: 113k]
  |  Branch (6616:55): [True: 0, False: 113k]
  ------------------
 6617|      0|        {
 6618|      0|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6619|      0|            goto exit_function;
 6620|      0|        }
 6621|   113k|#endif
 6622|       |
 6623|       |        /* Allocate memory for pStereo */
 6624|   113k|        pStereo = bIso ? &pInChI[iComponent].StereoIsotopic : &pInChI[iComponent].Stereo;
  ------------------
  |  Branch (6624:19): [True: 93.5k, False: 20.1k]
  ------------------
 6625|   113k|        if (!*pStereo)
  ------------------
  |  Branch (6625:13): [True: 113k, False: 0]
  ------------------
 6626|   113k|        {
 6627|   113k|            if (!( *pStereo = (INChI_Stereo *) inchi_calloc( 1, sizeof( **pStereo ) ) ))
  ------------------
  |  | 1133|   113k|#define inchi_calloc   calloc
  ------------------
  |  Branch (6627:17): [True: 0, False: 113k]
  ------------------
 6628|      0|            {
 6629|      0|                ret = RI_ERR_ALLOC; 
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 6630|      0|                goto exit_function;
 6631|      0|            }
 6632|   113k|        }
 6633|   113k|        if (pStereo[0]->t_parity || pStereo[0]->nNumberOfStereoCenters ||
  ------------------
  |  Branch (6633:13): [True: 0, False: 113k]
  |  Branch (6633:37): [True: 0, False: 113k]
  ------------------
 6634|   113k|             pStereo[0]->nNumber)
  ------------------
  |  Branch (6634:14): [True: 0, False: 113k]
  ------------------
 6635|      0|        {
 6636|      0|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6637|      0|            goto exit_function;
 6638|      0|        }
 6639|       |        /* Allocate sp3 stereo */
 6640|   113k|        if (!( pStereo[0]->t_parity = (S_CHAR *) inchi_calloc( len + 1, sizeof( pStereo[0]->b_parity[0] ) ) ) ||
  ------------------
  |  | 1133|   113k|#define inchi_calloc   calloc
  ------------------
  |  Branch (6640:13): [True: 0, False: 113k]
  ------------------
 6641|   113k|             !( pStereo[0]->nNumber = (AT_NUMB *) inchi_calloc( len + 1, sizeof( pStereo[0]->nNumber[0] ) ) ))
  ------------------
  |  | 1133|   113k|#define inchi_calloc   calloc
  ------------------
  |  Branch (6641:14): [True: 0, False: 113k]
  ------------------
 6642|      0|        {
 6643|       |            /* cleanup */
 6644|      0|            if (pStereo[0]->t_parity)
  ------------------
  |  Branch (6644:17): [True: 0, False: 0]
  ------------------
 6645|      0|            {
 6646|      0|                INCHI_HEAPCHK
 6647|      0|                inchi_free( pStereo[0]->t_parity );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 6648|      0|                pStereo[0]->t_parity = NULL;
 6649|      0|            }
 6650|      0|            if (pStereo[0]->nNumber)
  ------------------
  |  Branch (6650:17): [True: 0, False: 0]
  ------------------
 6651|      0|            {
 6652|      0|                INCHI_HEAPCHK
 6653|      0|                inchi_free( pStereo[0]->nNumber );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 6654|      0|                pStereo[0]->nNumber = NULL;
 6655|      0|            }
 6656|      0|            ret = RI_ERR_ALLOC; /* memory allocation failed */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 6657|      0|            goto exit_function;
 6658|      0|        }
 6659|       |
 6660|       |
 6661|       |        /* Store stereocenters (pass 2) */
 6662|   113k|        retf = SegmentSp3StoreStereoCenters( pbAbc, pStart, pEnd, pInChI[iComponent].nNumberOfAtoms, pStereo[0] );
 6663|   113k|        if (retf == RI_ERR_SYNTAX)
  ------------------
  |  |   44|   113k|#define RI_ERR_SYNTAX  (-2)
  ------------------
  |  Branch (6663:13): [True: 0, False: 113k]
  ------------------
 6664|      0|        {
 6665|      0|            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6666|      0|            goto exit_function;
 6667|      0|        }
 6668|       |
 6669|       |        /* Treat multiplier-covered components */
 6670|   113k|        retf = SegmentSp3CopyMultiplierCovered( mpy_component, iComponent, pInChI, bIso, nCpyType );
 6671|   113k|        if (retf == RI_ERR_SYNTAX)
  ------------------
  |  |   44|   113k|#define RI_ERR_SYNTAX  (-2)
  ------------------
  |  Branch (6671:13): [True: 0, False: 113k]
  ------------------
 6672|      0|        {
 6673|      0|            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6674|      0|            goto exit_function;
 6675|      0|        }
 6676|       |
 6677|   113k|    end_main_cycle:
 6678|   113k|        iComponent += mpy_component;
 6679|   113k|        if (*pEnd)
  ------------------
  |  Branch (6679:13): [True: 113k, False: 26]
  ------------------
 6680|   113k|        {
 6681|   113k|            pStart = pEnd + 1;
 6682|   113k|            continue;
 6683|   113k|        }
 6684|     26|        else
 6685|     26|        {
 6686|     26|            break;
 6687|     26|        }
 6688|       |
 6689|   113k|    } /* Cycle over components */
 6690|       |
 6691|     26|    if (nNumComponents != iComponent)
  ------------------
  |  Branch (6691:9): [True: 0, False: 26]
  ------------------
 6692|      0|    {
 6693|       |        /* Not all components treated, that's an error */
 6694|      0|        ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6695|      0|        goto exit_function;
 6696|      0|    }
 6697|       |    /* At this moment, INChI_Stereo pInChI[k].Stereo provides stereocenter parity info for k-th component
 6698|       |        pInChI[k].Stereo.
 6699|       |                        nNumber[nNumberOfStereoCenters] cano numbers
 6700|       |                        t_parity[nNumberOfStereoCenters] tetrahedral atom parities  
 6701|       |    */
 6702|       |    
 6703|       |
 6704|     26|    ret = iComponent + 1;
 6705|       |
 6706|     49|exit_function:
 6707|       |
 6708|     49|    return ret;
 6709|     26|}
ichiread.c:SegmentSp3CreateEmpty:
11699|     21|{
11700|     21|    int ret = 0;
11701|     21|    int iComponent;
11702|     21|    int len0 = 0;
11703|     21|    int bIso = ( state == IST_MOBILE_H_ISO_SP3 || state == IST_FIXED_H_ISO_SP3 );
  ------------------
  |  Branch (11703:18): [True: 2, False: 19]
  |  Branch (11703:51): [True: 18, False: 1]
  ------------------
11704|     21|    INChI_Stereo **pStereo = NULL;
11705|     21|    INChI *pInChI = pInpInChI[bMobileH];
11706|       |
11707|     42|    for (iComponent = 0; iComponent < nNumComponents; iComponent++)
  ------------------
  |  Branch (11707:26): [True: 21, False: 21]
  ------------------
11708|     21|    {
11709|     21|        INChI *pIsoInChI = &pInChI[iComponent];
11710|     21|        pStereo = bIso ? &pIsoInChI->StereoIsotopic : &pIsoInChI->Stereo;
  ------------------
  |  Branch (11710:19): [True: 20, False: 1]
  ------------------
11711|     21|        if (!*pStereo)
  ------------------
  |  Branch (11711:13): [True: 21, False: 0]
  ------------------
11712|     21|        {
11713|     21|            if (!( *pStereo = (INChI_Stereo *) inchi_calloc( 1, sizeof( **pStereo ) ) ))
  ------------------
  |  | 1133|     21|#define inchi_calloc   calloc
  ------------------
  |  Branch (11713:17): [True: 0, False: 21]
  ------------------
11714|      0|            {
11715|      0|                return RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
11716|      0|            }
11717|     21|        }
11718|       |        /* allocate empty sp3 stereo */
11719|     21|        if (!pStereo[0]->b_parity &&
  ------------------
  |  Branch (11719:13): [True: 21, False: 0]
  ------------------
11720|     21|             !( pStereo[0]->b_parity = (S_CHAR *) inchi_calloc( len0 + 1, sizeof( pStereo[0]->b_parity[0] ) ) ) ||
  ------------------
  |  | 1133|     21|#define inchi_calloc   calloc
  ------------------
  |  Branch (11720:14): [True: 0, False: 21]
  ------------------
11721|     21|             !pStereo[0]->nBondAtom1 &&
  ------------------
  |  Branch (11721:14): [True: 21, False: 0]
  ------------------
11722|     21|             !( pStereo[0]->nBondAtom1 = (AT_NUMB *) inchi_calloc( len0 + 1, sizeof( pStereo[0]->nBondAtom1[0] ) ) ) ||
  ------------------
  |  | 1133|     21|#define inchi_calloc   calloc
  ------------------
  |  Branch (11722:14): [True: 0, False: 21]
  ------------------
11723|     21|             !pStereo[0]->nBondAtom2 &&
  ------------------
  |  Branch (11723:14): [True: 21, False: 0]
  ------------------
11724|     21|             !( pStereo[0]->nBondAtom2 = (AT_NUMB *) inchi_calloc( len0 + 1, sizeof( pStereo[0]->nBondAtom2[0] ) ) ))
  ------------------
  |  | 1133|     21|#define inchi_calloc   calloc
  ------------------
  |  Branch (11724:14): [True: 0, False: 21]
  ------------------
11725|      0|        {
11726|       |            /* cleanup */
11727|      0|            if (pStereo[0]->b_parity)
  ------------------
  |  Branch (11727:17): [True: 0, False: 0]
  ------------------
11728|      0|            {
11729|      0|                INCHI_HEAPCHK
11730|      0|                    inchi_free( pStereo[0]->b_parity );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
11731|      0|                pStereo[0]->b_parity = NULL;
11732|      0|            }
11733|      0|            if (pStereo[0]->nBondAtom1)
  ------------------
  |  Branch (11733:17): [True: 0, False: 0]
  ------------------
11734|      0|            {
11735|      0|                INCHI_HEAPCHK
11736|      0|                    inchi_free( pStereo[0]->nBondAtom1 );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
11737|      0|                pStereo[0]->nBondAtom1 = NULL;
11738|      0|            }
11739|      0|            if (pStereo[0]->nBondAtom2)
  ------------------
  |  Branch (11739:17): [True: 0, False: 0]
  ------------------
11740|      0|            {
11741|      0|                INCHI_HEAPCHK
11742|      0|                    inchi_free( pStereo[0]->nBondAtom2 );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
11743|      0|                pStereo[0]->nBondAtom2 = NULL;
11744|      0|            }
11745|      0|            return RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
11746|      0|        }
11747|     21|        pStereo[0]->nCompInv2Abs = NO_VALUE_INT;
  ------------------
  |  |   51|     21|#define NO_VALUE_INT    9999
  ------------------
11748|     21|    }
11749|     21|    ret = nNumComponents + 1;
11750|       |
11751|     21|    return ret;
11752|     21|}
ichiread.c:SegmentSp3StoreStereoCenters:
11761|   113k|{
11762|   113k|    const char parity_type[] = "-+u?";
11763|   113k|    const char *p, *q, *r;
11764|   113k|    AT_NUMB nAtom1;
11765|   113k|    int iAtom;
11766|   113k|    int atomParity;
11767|   113k|    int base = 10;
11768|       |
11769|   113k|    if (*pbAbc == 1)
  ------------------
  |  Branch (11769:9): [True: 0, False: 113k]
  ------------------
11770|      0|    {
11771|      0|        for (p = (char  *) pStart, iAtom = 0; p < pEnd; iAtom++)
  ------------------
  |  Branch (11771:47): [True: 0, False: 0]
  ------------------
11772|      0|        {
11773|      0|            if (( nAtom1 = (AT_NUMB) inchi_strtol( p, &p, base ) ) &&
  ------------------
  |  Branch (11773:17): [True: 0, False: 0]
  ------------------
11774|      0|                ( atomParity = (int) inchi_strtol( p, &p, 10 ),
  ------------------
  |  Branch (11774:17): [True: 0, False: 0]
  ------------------
11775|      0|                  AB_MIN_KNOWN_PARITY <= atomParity && atomParity <= AB_MAX_KNOWN_PARITY ))
  ------------------
  |  |  259|      0|#define AB_MIN_KNOWN_PARITY        1
  ------------------
                                AB_MIN_KNOWN_PARITY <= atomParity && atomParity <= AB_MAX_KNOWN_PARITY ))
  ------------------
  |  |  258|      0|#define AB_MAX_KNOWN_PARITY        4 /* precalculated from const. equivalence parities */
  ------------------
  |  Branch (11775:19): [True: 0, False: 0]
  |  Branch (11775:56): [True: 0, False: 0]
  ------------------
11776|      0|            {
11777|      0|                ; /* okay */
11778|      0|            }
11779|      0|            else
11780|      0|            {
11781|      0|                return RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
11782|      0|            }
11783|      0|            if (nAtom1 > pInChI_iComponent_nNumberOfAtoms)
  ------------------
  |  Branch (11783:17): [True: 0, False: 0]
  ------------------
11784|      0|            {
11785|      0|                return RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
11786|      0|            }
11787|      0|            PStereo_0->t_parity[iAtom] = atomParity;
11788|      0|            PStereo_0->nNumber[iAtom] = nAtom1;
11789|      0|            if (iAtom && !( PStereo_0->nNumber[iAtom - 1] < nAtom1 ))
  ------------------
  |  Branch (11789:17): [True: 0, False: 0]
  |  Branch (11789:26): [True: 0, False: 0]
  ------------------
11790|      0|            {
11791|      0|                return RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
11792|      0|            }
11793|      0|        }
11794|      0|    }
11795|   113k|    else
11796|   113k|    {
11797|   113k|        for (p = (char  *) pStart, iAtom = 0; p < pEnd; iAtom++, p += ( *p == ',' ))
  ------------------
  |  Branch (11797:47): [True: 5, False: 113k]
  ------------------
11798|      5|        {
11799|      5|            nAtom1 = (AT_NUMB) inchi_strtol( p, &q, 10 );
11800|      5|#if ( CHECK_STRTOL_ATNUMB==1 )
11801|      5|            if (nAtom1>MAX_ATOMS || nAtom1<0)
  ------------------
  |  |   43|     10|#define MAX_ATOMS  32766
  ------------------
  |  Branch (11801:17): [True: 0, False: 5]
  |  Branch (11801:37): [True: 0, False: 5]
  ------------------
11802|      0|            {
11803|      0|                return RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
11804|      0|            }
11805|      5|#endif
11806|      5|            if (!(r = strchr((char *)parity_type, *q)))
  ------------------
  |  Branch (11806:17): [True: 0, False: 5]
  ------------------
11807|      0|            {
11808|      0|                return RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
11809|      0|            }
11810|      5|            p = q + 1;
11811|      5|            atomParity = (int) ( r - parity_type ) + 1;
11812|      5|            PStereo_0->t_parity[iAtom] = atomParity;
11813|      5|            PStereo_0->nNumber[iAtom] = nAtom1;
11814|      5|            if (iAtom && !( PStereo_0->nNumber[iAtom - 1] < nAtom1 ))
  ------------------
  |  Branch (11814:17): [True: 0, False: 5]
  |  Branch (11814:26): [True: 0, False: 0]
  ------------------
11815|      0|            {
11816|      0|                return RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
11817|      0|            }
11818|      5|        }
11819|   113k|    }
11820|   113k|    PStereo_0->nNumberOfStereoCenters = iAtom;
11821|       |    /*if ( iAtom ) {*/
11822|   113k|    PStereo_0->nCompInv2Abs = NO_VALUE_INT; /* unknown yet */
  ------------------
  |  |   51|   113k|#define NO_VALUE_INT    9999
  ------------------
11823|       |
11824|   113k|    if (p != pEnd)
  ------------------
  |  Branch (11824:9): [True: 0, False: 113k]
  ------------------
11825|      0|    {
11826|      0|        return RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
11827|      0|    }
11828|       |
11829|   113k|    return 0;
11830|   113k|}
ichiread.c:SegmentSp3CopyMultiplierCovered:
11841|   113k|{
11842|   113k|    int i, ret = 0;
11843|   113k|    for (i = 1; i < mpy_component; i++)
  ------------------
  |  Branch (11843:17): [True: 0, False: 113k]
  ------------------
11844|      0|    {
11845|      0|        ret = CopySegment( pInChI + iComponent + i, pInChI + iComponent, nCpyType, bIso, bIso );
11846|      0|        if (!ret)
  ------------------
  |  Branch (11846:13): [True: 0, False: 0]
  ------------------
11847|      0|        {
11848|      0|            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
11849|      0|        }
11850|      0|        if (ret < 0)
  ------------------
  |  Branch (11850:13): [True: 0, False: 0]
  ------------------
11851|      0|        {
11852|      0|            return ret;
11853|      0|        }
11854|      0|        ret = CopySegment( pInChI + iComponent + i, pInChI + iComponent, CPY_SP3_M, bIso, bIso );
11855|      0|        if (!ret)
  ------------------
  |  Branch (11855:13): [True: 0, False: 0]
  ------------------
11856|      0|        {
11857|      0|            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
11858|      0|        }
11859|      0|        if (ret < 0)
  ------------------
  |  Branch (11859:13): [True: 0, False: 0]
  ------------------
11860|      0|        {
11861|      0|            return ret;
11862|      0|        }
11863|      0|    }
11864|       |
11865|   113k|    return ret;
11866|   113k|}
ichiread.c:ParseSegmentSp3m:
 6243|    256|{
 6244|       |    /* Pass 1: count bonds and find actual numbers of  atom */
 6245|    256|    int nNumComponents, iComponent;
 6246|    256|    const char *p, *pStart, *pEnd;
 6247|    256|    int  ret = 0;
 6248|    256|    INChI *pInChI = pInpInChI[bMobileH];
 6249|    256|    INChI_Stereo **pStereo = NULL;
 6250|       |
 6251|    256|    int   bIso = ( state == IST_MOBILE_H_ISO_SP3_M || state == IST_FIXED_H_ISO_SP3_M );
  ------------------
  |  Branch (6251:20): [True: 15, False: 241]
  |  Branch (6251:55): [True: 36, False: 205]
  ------------------
 6252|       |
 6253|    256|    if (!bIso && state != IST_MOBILE_H_SP3_M && state != IST_FIXED_H_SP3_M)
  ------------------
  |  Branch (6253:9): [True: 205, False: 51]
  |  Branch (6253:18): [True: 54, False: 151]
  |  Branch (6253:49): [True: 0, False: 54]
  ------------------
 6254|      0|    {
 6255|      0|        return RI_ERR_PROGR; /* program error */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 6256|      0|    }
 6257|    256|    nNumComponents = ppnNumComponents[bMobileH];
 6258|       |
 6259|    256|    if (str[0] != 'm')
  ------------------
  |  Branch (6259:9): [True: 256, False: 0]
  ------------------
 6260|    256|    {
 6261|       |        /* /m is missing: check whether we have to inherit /m from a preceding stereo layer */
 6262|    256|        INChI_Stereo *pStereoFrom, *pStereoTo;
 6263|    256|        INChI        *pInChIFrom;
 6264|    256|        int          nNumCopied = 0, bMobileHFrom = -1, bIsoFrom = -1;
 6265|    256|        if (bMobileH && !bIso)
  ------------------
  |  Branch (6265:13): [True: 166, False: 90]
  |  Branch (6265:25): [True: 151, False: 15]
  ------------------
 6266|    151|        {
 6267|    151|            return 0; /* Main non-isotopic cannot inherit: it has no preceding layer */
 6268|    151|        }
 6269|    105|        else
 6270|    105|        {
 6271|    105|            if (!bMobileH && !bIso)
  ------------------
  |  Branch (6271:17): [True: 90, False: 15]
  |  Branch (6271:30): [True: 54, False: 36]
  ------------------
 6272|     54|            {
 6273|       |                /* fixed-H non-isotopic (F) inherits from Mobile-H non-isotopic (M) */
 6274|     54|                bMobileHFrom = TAUT_YES;
  ------------------
  |  |  580|     54|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6275|     54|                bIsoFrom = 0;
 6276|     54|            }
 6277|     51|            else
 6278|     51|            {
 6279|     51|                if (bMobileH && bIso)
  ------------------
  |  Branch (6279:21): [True: 15, False: 36]
  |  Branch (6279:33): [True: 15, False: 0]
  ------------------
 6280|     15|                {
 6281|       |                    /* Mobile-H isotopic (MI) inherits from Mobile-H non-isotopic (M) */
 6282|     15|                    bMobileHFrom = TAUT_YES;
  ------------------
  |  |  580|     15|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6283|     15|                    bIsoFrom = 0;
 6284|     15|                }
 6285|     36|                else
 6286|     36|                {
 6287|     36|                    if (!bMobileH && bIso)
  ------------------
  |  Branch (6287:25): [True: 36, False: 0]
  |  Branch (6287:38): [True: 36, False: 0]
  ------------------
 6288|     36|                    {
 6289|       |                        /* Fixed-H isotopic (FI) inherits from Fixed-H non-isotopic (F) */
 6290|     36|                        bMobileHFrom = TAUT_NON;
  ------------------
  |  |  579|     36|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 6291|     36|                        bIsoFrom = 0;
 6292|       |                        /* if Sp3 is empty in F as well as in M, then inherit from MI */
 6293|     36|                        if (!bIsSp3LayerNotEmpty( pInpInChI, TAUT_NON, 0, ppnNumComponents[TAUT_NON /*bMobileH*/] ) /* F */ &&
  ------------------
  |  |  579|     36|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                                      if (!bIsSp3LayerNotEmpty( pInpInChI, TAUT_NON, 0, ppnNumComponents[TAUT_NON /*bMobileH*/] ) /* F */ &&
  ------------------
  |  |  579|     36|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (6293:29): [True: 36, False: 0]
  ------------------
 6294|     36|                             !bIsSp3LayerNotEmpty( pInpInChI, TAUT_YES, 0, ppnNumComponents[TAUT_YES /*bMobileH*/] ) /* M */)
  ------------------
  |  |  580|     36|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                                           !bIsSp3LayerNotEmpty( pInpInChI, TAUT_YES, 0, ppnNumComponents[TAUT_YES /*bMobileH*/] ) /* M */)
  ------------------
  |  |  580|     36|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (6294:30): [True: 32, False: 4]
  ------------------
 6295|     32|                        {
 6296|     32|                            bMobileHFrom = TAUT_YES;
  ------------------
  |  |  580|     32|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6297|     32|                            bIsoFrom = 1;
 6298|     32|                        }
 6299|     36|                    }
 6300|     36|                }
 6301|     51|            }
 6302|    105|        }
 6303|    105|        if (bMobileHFrom < 0 || bIsoFrom < 0)
  ------------------
  |  Branch (6303:13): [True: 0, False: 105]
  |  Branch (6303:33): [True: 0, False: 105]
  ------------------
 6304|      0|        {
 6305|      0|            return RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 6306|      0|        }
 6307|    105|        if (!bIsSp3LayerNotEmpty( pInpInChI, bMobileHFrom, bIsoFrom, ppnNumComponents[/*bMobileH*/ bMobileHFrom] ))
  ------------------
  |  Branch (6307:13): [True: 96, False: 9]
  ------------------
 6308|     96|        {
 6309|       |            /* nothing to copy; check whether it should have inherited from a preceding layer */
 6310|     96|            if (!bMobileHFrom && bIsoFrom || bMobileHFrom && !bIsoFrom)
  ------------------
  |  Branch (6310:17): [True: 4, False: 92]
  |  Branch (6310:34): [True: 0, False: 4]
  |  Branch (6310:46): [True: 92, False: 4]
  |  Branch (6310:62): [True: 60, False: 32]
  ------------------
 6311|     60|            {
 6312|       |                /* MI or F inherit stereo from M */
 6313|     60|                bMobileHFrom = TAUT_YES;
  ------------------
  |  |  580|     60|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 6314|     60|                bIsoFrom = 0;
 6315|     60|                if (!bIsSp3LayerNotEmpty( pInpInChI, bMobileHFrom, bIsoFrom, ppnNumComponents[bMobileHFrom /*bMobileH*/] ))
  ------------------
  |  Branch (6315:21): [True: 60, False: 0]
  ------------------
 6316|     60|                {
 6317|     60|                    return 0;
 6318|     60|                }
 6319|     60|            }
 6320|     36|            else
 6321|     36|            {
 6322|     36|                return 0;
 6323|     36|            }
 6324|     96|        }
 6325|      9|        nNumComponents = inchi_min( ppnNumComponents[bMobileH], ppnNumComponents[bMobileHFrom] );
  ------------------
  |  |  167|      9|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 9]
  |  |  ------------------
  ------------------
 6326|  39.7k|        for (iComponent = 0; iComponent < nNumComponents; iComponent++)
  ------------------
  |  Branch (6326:30): [True: 39.7k, False: 9]
  ------------------
 6327|  39.7k|        {
 6328|  39.7k|            pInChIFrom = pInpInChI[bMobileHFrom] + iComponent;
 6329|  39.7k|            pInChI = pInpInChI[bMobileH] + iComponent;
 6330|  39.7k|            if (pInChIFrom->nNumberOfAtoms > 0 && !pInChIFrom->bDeleted &&
  ------------------
  |  Branch (6330:17): [True: 39.7k, False: 0]
  |  Branch (6330:51): [True: 39.7k, False: 0]
  ------------------
 6331|  39.7k|                 pInChI->nNumberOfAtoms > 0 && !pInChI->bDeleted)
  ------------------
  |  Branch (6331:18): [True: 39.7k, False: 0]
  |  Branch (6331:48): [True: 39.7k, False: 0]
  ------------------
 6332|  39.7k|            {
 6333|  39.7k|                pStereoFrom = bIsoFrom ? pInChIFrom->StereoIsotopic : pInChIFrom->Stereo;
  ------------------
  |  Branch (6333:31): [True: 0, False: 39.7k]
  ------------------
 6334|  39.7k|                pStereoTo = bIso ? pInChI->StereoIsotopic : pInChI->Stereo;
  ------------------
  |  Branch (6334:29): [True: 19.8k, False: 19.8k]
  ------------------
 6335|  39.7k|                if (pStereoFrom && pStereoTo)
  ------------------
  |  Branch (6335:21): [True: 39.7k, False: 0]
  |  Branch (6335:36): [True: 19.8k, False: 19.8k]
  ------------------
 6336|  19.8k|                {
 6337|  19.8k|                    pStereoTo->nCompInv2Abs = pStereoFrom->nCompInv2Abs;
 6338|  19.8k|                    nNumCopied++;
 6339|  19.8k|                }
 6340|  39.7k|            }
 6341|  39.7k|        }
 6342|      9|        return 0; /* return value > 0 means the non-/m segment has been processed here */
 6343|    105|    }
 6344|       |
 6345|      0|    pStart = str + 1;
 6346|      0|    iComponent = 0;
 6347|       |
 6348|       |    /*if ( !(pEnd = strchr( pStart, ';' )) )*/ /* 2007-09-25 DT */
 6349|      0|    if (!( pEnd = strchr( pStart, '/' ) ))
  ------------------
  |  Branch (6349:9): [True: 0, False: 0]
  ------------------
 6350|      0|    {
 6351|      0|        pEnd = pStart + strlen( pStart );
 6352|      0|    }
 6353|      0|    else
 6354|      0|    {
 6355|      0|        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6356|      0|        goto exit_function;
 6357|      0|    }
 6358|      0|    p = pStart;
 6359|      0|    if (pEnd == pStart)
  ------------------
  |  Branch (6359:9): [True: 0, False: 0]
  ------------------
 6360|      0|    {
 6361|       |        /* create empty sp3 segment */
 6362|      0|        int len = 0;
 6363|      0|        for (iComponent = 0; iComponent < nNumComponents; iComponent++)
  ------------------
  |  Branch (6363:30): [True: 0, False: 0]
  ------------------
 6364|      0|        {
 6365|      0|            INChI *pIsoInChI = &pInChI[iComponent];
 6366|      0|            pStereo = bIso ? &pIsoInChI->StereoIsotopic : &pIsoInChI->Stereo;
  ------------------
  |  Branch (6366:23): [True: 0, False: 0]
  ------------------
 6367|      0|            if (!*pStereo)
  ------------------
  |  Branch (6367:17): [True: 0, False: 0]
  ------------------
 6368|      0|            {
 6369|      0|                if (!( *pStereo = (INChI_Stereo *) inchi_calloc( 1, sizeof( **pStereo ) ) ))
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  |  Branch (6369:21): [True: 0, False: 0]
  ------------------
 6370|      0|                {
 6371|      0|                    ret = RI_ERR_ALLOC; /* memory allocation failed */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 6372|      0|                    goto exit_function;
 6373|      0|                }
 6374|      0|            }
 6375|      0|            pStereo[0]->nCompInv2Abs = NO_VALUE_INT;  /* deliberately empty */
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
 6376|       |#ifdef NEVER
 6377|       |            if (pStereo[0]->nNumberOfStereoCenters)
 6378|       |            {
 6379|       |                ret = RI_ERR_SYNTAX; /* syntax error */
 6380|       |                goto exit_function;
 6381|       |            }
 6382|       |#endif
 6383|       |            /* allocate empty sp3 stereo */
 6384|      0|            if (!pStereo[0]->t_parity &&
  ------------------
  |  Branch (6384:17): [True: 0, False: 0]
  ------------------
 6385|      0|                 !( pStereo[0]->t_parity = (S_CHAR *) inchi_calloc( len + 1, sizeof( pStereo[0]->b_parity[0] ) ) ) ||
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  |  Branch (6385:18): [True: 0, False: 0]
  ------------------
 6386|      0|                 !pStereo[0]->nNumber &&
  ------------------
  |  Branch (6386:18): [True: 0, False: 0]
  ------------------
 6387|      0|                 !( pStereo[0]->nNumber = (AT_NUMB *) inchi_calloc( len + 1, sizeof( pStereo[0]->nNumber[0] ) ) ))
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  |  Branch (6387:18): [True: 0, False: 0]
  ------------------
 6388|      0|            {
 6389|       |                /* cleanup */
 6390|      0|                if (pStereo[0]->t_parity)
  ------------------
  |  Branch (6390:21): [True: 0, False: 0]
  ------------------
 6391|      0|                {
 6392|      0|                    INCHI_HEAPCHK
 6393|      0|                        inchi_free( pStereo[0]->t_parity );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 6394|      0|                    pStereo[0]->t_parity = NULL;
 6395|      0|                }
 6396|      0|                if (pStereo[0]->nNumber)
  ------------------
  |  Branch (6396:21): [True: 0, False: 0]
  ------------------
 6397|      0|                {
 6398|      0|                    INCHI_HEAPCHK
 6399|      0|                        inchi_free( pStereo[0]->nNumber );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 6400|      0|                    pStereo[0]->nNumber = NULL;
 6401|      0|                }
 6402|      0|                ret = RI_ERR_ALLOC; /* memory allocation failed */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 6403|      0|                goto exit_function;
 6404|      0|            }
 6405|      0|        }
 6406|      0|        ret = nNumComponents + 1;
 6407|      0|    }
 6408|      0|    else
 6409|      0|    {
 6410|      0|        while (p < pEnd && iComponent < nNumComponents)
  ------------------
  |  Branch (6410:16): [True: 0, False: 0]
  |  Branch (6410:28): [True: 0, False: 0]
  ------------------
 6411|      0|        {
 6412|       |            /* cycle over components */
 6413|      0|            pStereo = bIso ? &pInChI[iComponent].StereoIsotopic : &pInChI[iComponent].Stereo;
  ------------------
  |  Branch (6413:23): [True: 0, False: 0]
  ------------------
 6414|      0|            if (*p != '.' && !*pStereo)
  ------------------
  |  Branch (6414:17): [True: 0, False: 0]
  |  Branch (6414:30): [True: 0, False: 0]
  ------------------
 6415|      0|            {
 6416|      0|                if (!( *pStereo = (INChI_Stereo *) inchi_calloc( 1, sizeof( **pStereo ) ) ))
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  |  Branch (6416:21): [True: 0, False: 0]
  ------------------
 6417|      0|                {
 6418|      0|                    ret = RI_ERR_ALLOC; /* memory allocation failed */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 6419|      0|                    goto exit_function;
 6420|      0|                }
 6421|      0|            }
 6422|      0|            switch (*p)
 6423|      0|            {
 6424|      0|                case '1':
  ------------------
  |  Branch (6424:17): [True: 0, False: 0]
  ------------------
 6425|      0|                    pStereo[0]->nCompInv2Abs = -1;
 6426|      0|                    break;
 6427|      0|                case '0':
  ------------------
  |  Branch (6427:17): [True: 0, False: 0]
  ------------------
 6428|      0|                    pStereo[0]->nCompInv2Abs = 1;
 6429|      0|                    break;
 6430|      0|                case '.':
  ------------------
  |  Branch (6430:17): [True: 0, False: 0]
  ------------------
 6431|      0|                    if (*pStereo)
  ------------------
  |  Branch (6431:25): [True: 0, False: 0]
  ------------------
 6432|      0|                    {
 6433|      0|                        pStereo[0]->nCompInv2Abs = 0;
 6434|      0|                    }
 6435|      0|                    break;
 6436|      0|                default:
  ------------------
  |  Branch (6436:17): [True: 0, False: 0]
  ------------------
 6437|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6438|      0|                    goto exit_function;
 6439|      0|            }
 6440|      0|            iComponent++;
 6441|      0|            p++;
 6442|      0|        }
 6443|      0|        if (p != pEnd || iComponent != nNumComponents)
  ------------------
  |  Branch (6443:13): [True: 0, False: 0]
  |  Branch (6443:26): [True: 0, False: 0]
  ------------------
 6444|      0|        {
 6445|      0|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6446|      0|            goto exit_function;
 6447|      0|        }
 6448|      0|        ret = nNumComponents + 1;
 6449|      0|    }
 6450|       |
 6451|      0|exit_function:
 6452|       |
 6453|      0|    return ret;
 6454|      0|}
ichiread.c:bIsSp3LayerNotEmpty:
 6210|    237|{
 6211|    237|    INChI        *pInChI;
 6212|    237|    INChI_Stereo *pStereo;
 6213|    237|    int           iComponent, num_not_empty = 0;
 6214|       |
 6215|    237|    if (pInpInChI[bMobileH])
  ------------------
  |  Branch (6215:9): [True: 237, False: 0]
  ------------------
 6216|    237|    {
 6217|   374k|        for (iComponent = 0; iComponent < nNumComponents; iComponent++)
  ------------------
  |  Branch (6217:30): [True: 374k, False: 237]
  ------------------
 6218|   374k|        {
 6219|   374k|            pInChI = pInpInChI[bMobileH] + iComponent;
 6220|   374k|            if (pInChI->bDeleted || !pInChI->nNumberOfAtoms)
  ------------------
  |  Branch (6220:17): [True: 0, False: 374k]
  |  Branch (6220:37): [True: 0, False: 374k]
  ------------------
 6221|      0|            {
 6222|      0|                continue;
 6223|      0|            }
 6224|   374k|            pStereo = bIso ? pInChI->StereoIsotopic : pInChI->Stereo;
  ------------------
  |  Branch (6224:23): [True: 53.8k, False: 320k]
  ------------------
 6225|   374k|            if (pStereo && pStereo->nNumberOfStereoCenters > 0 && pStereo->nNumber && pStereo->t_parity)
  ------------------
  |  Branch (6225:17): [True: 59.6k, False: 314k]
  |  Branch (6225:28): [True: 13, False: 59.6k]
  |  Branch (6225:67): [True: 13, False: 0]
  |  Branch (6225:87): [True: 13, False: 0]
  ------------------
 6226|     13|            {
 6227|     13|                num_not_empty++;
 6228|     13|            }
 6229|   374k|        }
 6230|    237|    }
 6231|    237|    return num_not_empty;
 6232|    237|}
ichiread.c:ParseSegmentSp3s:
 6101|    256|{
 6102|       |    /* Pass 1: count bonds and find actual numbers of  atom */
 6103|    256|    int nNumComponents, iComponent, val;
 6104|    256|    const char *p, *q, *pStart, *pEnd;
 6105|    256|    int  ret = 0;
 6106|    256|    INChI *pInChI = pInpInChI[bMobileH];
 6107|    256|    INChI_Stereo **pStereo = NULL;
 6108|       |
 6109|    256|    int   bIso = ( state == IST_MOBILE_H_ISO_SP3_S || state == IST_FIXED_H_ISO_SP3_S );
  ------------------
  |  Branch (6109:20): [True: 15, False: 241]
  |  Branch (6109:55): [True: 36, False: 205]
  ------------------
 6110|       |
 6111|    256|    if (!bIso && state != IST_MOBILE_H_SP3_S && state != IST_FIXED_H_SP3_S)
  ------------------
  |  Branch (6111:9): [True: 205, False: 51]
  |  Branch (6111:18): [True: 54, False: 151]
  |  Branch (6111:49): [True: 0, False: 54]
  ------------------
 6112|      0|    {
 6113|      0|        return RI_ERR_PROGR; /* program error */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 6114|      0|    }
 6115|       |
 6116|    256|    if (str[0] != 's')
  ------------------
  |  Branch (6116:9): [True: 246, False: 10]
  ------------------
 6117|    246|    {
 6118|    246|        return 0;
 6119|    246|    }
 6120|       |
 6121|     10|    pStart = (char  *) str + 1;
 6122|     10|    iComponent = 0;
 6123|     10|    nNumComponents = ppnNumComponents[bMobileH];
 6124|       |
 6125|       |    /*if ( !(pEnd = strchr( pStart, ';' )) )*/ /* 2007-09-25 DT */
 6126|     10|    if (!( pEnd = strchr( pStart, '/' ) ))
  ------------------
  |  Branch (6126:9): [True: 10, False: 0]
  ------------------
 6127|     10|    {
 6128|     10|        pEnd = pStart + strlen( pStart );
 6129|     10|    }
 6130|      0|    else
 6131|      0|    {
 6132|      0|        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6133|      0|        goto exit_function;
 6134|      0|    }
 6135|     10|    p = pStart;
 6136|     10|    if (pEnd == pStart)
  ------------------
  |  Branch (6136:9): [True: 0, False: 10]
  ------------------
 6137|      0|    {
 6138|       |        /* create empty sp3 segment */
 6139|      0|        int len = 0;
 6140|      0|        s[bMobileH][bIso] = NO_VALUE_INT; /* empty */
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
 6141|       |                                          /* create empty sp3 segment */
 6142|      0|        for (iComponent = 0; iComponent < nNumComponents; iComponent++)
  ------------------
  |  Branch (6142:30): [True: 0, False: 0]
  ------------------
 6143|      0|        {
 6144|      0|            pStereo = bIso ? &pInChI[iComponent].StereoIsotopic : &pInChI[iComponent].Stereo;
  ------------------
  |  Branch (6144:23): [True: 0, False: 0]
  ------------------
 6145|      0|            if (!*pStereo)
  ------------------
  |  Branch (6145:17): [True: 0, False: 0]
  ------------------
 6146|      0|            {
 6147|      0|                if (!( *pStereo = (INChI_Stereo *) inchi_calloc( 1, sizeof( **pStereo ) ) ))
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  |  Branch (6147:21): [True: 0, False: 0]
  ------------------
 6148|      0|                {
 6149|      0|                    ret = RI_ERR_ALLOC; /* memory allocation failed */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 6150|      0|                    goto exit_function;
 6151|      0|                }
 6152|      0|            }
 6153|      0|            pStereo[0]->nCompInv2Abs = 0;  /* deliberately empty */
 6154|       |
 6155|      0|            if (pStereo[0]->nNumberOfStereoCenters)
  ------------------
  |  Branch (6155:17): [True: 0, False: 0]
  ------------------
 6156|      0|            {
 6157|      0|                ret = RI_ERR_SYNTAX; /* syntax error: "/s" without a digit describes "no stereo" */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6158|      0|                goto exit_function;
 6159|      0|            }
 6160|       |            /* allocate empty sp3 stereo */
 6161|      0|            if (!pStereo[0]->t_parity &&
  ------------------
  |  Branch (6161:17): [True: 0, False: 0]
  ------------------
 6162|      0|                 !( pStereo[0]->t_parity = (S_CHAR *) inchi_calloc( len + 1, sizeof( pStereo[0]->b_parity[0] ) ) ) ||
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  |  Branch (6162:18): [True: 0, False: 0]
  ------------------
 6163|      0|                 !pStereo[0]->nNumber &&
  ------------------
  |  Branch (6163:18): [True: 0, False: 0]
  ------------------
 6164|      0|                 !( pStereo[0]->nNumber = (AT_NUMB *) inchi_calloc( len + 1, sizeof( pStereo[0]->nNumber[0] ) ) ))
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  |  Branch (6164:18): [True: 0, False: 0]
  ------------------
 6165|      0|            {
 6166|       |                /* cleanup */
 6167|      0|                if (pStereo[0]->t_parity)
  ------------------
  |  Branch (6167:21): [True: 0, False: 0]
  ------------------
 6168|      0|                {
 6169|      0|                    INCHI_HEAPCHK
 6170|      0|                        inchi_free( pStereo[0]->t_parity );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 6171|      0|                    pStereo[0]->t_parity = NULL;
 6172|      0|                }
 6173|      0|                if (pStereo[0]->nNumber)
  ------------------
  |  Branch (6173:21): [True: 0, False: 0]
  ------------------
 6174|      0|                {
 6175|      0|                    INCHI_HEAPCHK
 6176|      0|                        inchi_free( pStereo[0]->nNumber );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 6177|      0|                    pStereo[0]->nNumber = NULL;
 6178|      0|                }
 6179|      0|                ret = RI_ERR_ALLOC; /* memory allocation failed */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 6180|      0|                goto exit_function;
 6181|      0|            }
 6182|      0|        }
 6183|      0|        ret = nNumComponents + 1;
 6184|      0|    }
 6185|     10|    else
 6186|     10|    {
 6187|     10|        val = (int) inchi_strtol( p, &q, 10 );
 6188|     10|        if (q == pEnd && 1 <= val && val <= 3)
  ------------------
  |  Branch (6188:13): [True: 4, False: 6]
  |  Branch (6188:26): [True: 4, False: 0]
  |  Branch (6188:38): [True: 4, False: 0]
  ------------------
 6189|      4|        {
 6190|      4|            s[bMobileH][bIso] = val;
 6191|      4|            ret = nNumComponents + 1;
 6192|      4|        }
 6193|      6|        else
 6194|      6|        {
 6195|      6|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      6|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6196|      6|        }
 6197|     10|    }
 6198|       |
 6199|     10|exit_function:
 6200|       |
 6201|     10|    return ret;
 6202|     10|}
ichiread.c:ParseSegmentIsoAtoms:
 5684|    121|{
 5685|    121|    int i, mpy_component, val;
 5686|    121|    int nNumComponents, iComponent, len = 0, iAtom;
 5687|    121|    AT_NUMB nAtom1;
 5688|    121|    const char *p, *q, *t, *pStart, *pEnd, *r;
 5689|    121|    int  ret = 0;
 5690|    121|    INChI *pInChI = pInpInChI[bMobileH];
 5691|    121|    INChI *pInChIFrom = NULL;
 5692|    121|    INChI_IsotopicAtom **pIsotopicAtom = NULL;
 5693|    121|    INChI_IsotopicAtom isoAtom;
 5694|       |
 5695|    121|    const char   mult_type[] = "mnMNe";
 5696|    121|    const char   parity_type[] = "-+TDH";
 5697|    121|    int    bIsoFrom, nCpyType = CPY_ISO_AT;
 5698|    121|    int    base = 10;
 5699|       |
 5700|    121|    if (str[0] != 'i')
  ------------------
  |  Branch (5700:9): [True: 0, False: 121]
  ------------------
 5701|      0|    {
 5702|      0|        return 0;
 5703|      0|    }
 5704|       |
 5705|    121|    pStart = (char  *) str + 1;
 5706|    121|    iComponent = 0;
 5707|    121|    nNumComponents = ppnNumComponents[bMobileH];
 5708|       |
 5709|    121|    if (!( bMobileH == TAUT_YES && state == IST_MOBILE_H_ISO_ATOMS ||
  ------------------
  |  |  580|    242|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (5709:12): [True: 67, False: 54]
  |  Branch (5709:36): [True: 67, False: 0]
  ------------------
 5710|    121|           bMobileH == TAUT_NON && state == IST_FIXED_H_ISO_ATOMS ))
  ------------------
  |  |  579|    108|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (5710:12): [True: 54, False: 0]
  |  Branch (5710:36): [True: 54, False: 0]
  ------------------
 5711|      0|    {
 5712|      0|        return RI_ERR_PROGR; /* program error */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 5713|      0|    }
 5714|    121|    if (!*pStart)
  ------------------
  |  Branch (5714:9): [True: 33, False: 88]
  ------------------
 5715|     33|    {
 5716|     33|        return nNumComponents + 1; /* no isotopic atoms */
 5717|     33|    }
 5718|       |
 5719|  93.6k|    while (1)
  ------------------
  |  Branch (5719:12): [Folded - Ignored]
  ------------------
 5720|  93.6k|    {
 5721|       |        /* cycle over components */
 5722|  93.6k|        if (!( pEnd = strchr( pStart, ';' ) ))
  ------------------
  |  Branch (5722:13): [True: 87, False: 93.5k]
  ------------------
 5723|     87|        {
 5724|     87|            pEnd = pStart + strlen( pStart );
 5725|     87|        }
 5726|  93.6k|        if (( p = strchr( pStart, '*' ) ) && p < pEnd)
  ------------------
  |  Branch (5726:13): [True: 0, False: 93.6k]
  |  Branch (5726:46): [True: 0, False: 0]
  ------------------
 5727|      0|        {
 5728|      0|            mpy_component = (int) inchi_strtol( pStart, &q, 10 );
 5729|      0|            if (p != q)
  ------------------
  |  Branch (5729:17): [True: 0, False: 0]
  ------------------
 5730|      0|            {
 5731|      0|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5732|      0|                goto exit_function;
 5733|      0|            }
 5734|      0|#if (FIX_DALKE_BUGS == 1)
 5735|      0|            if (iComponent + mpy_component > nNumComponents)
  ------------------
  |  Branch (5735:17): [True: 0, False: 0]
  ------------------
 5736|      0|            {
 5737|      0|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5738|      0|                goto exit_function;
 5739|      0|            }
 5740|      0|#endif
 5741|      0|            p++; /* move to the 1st character of the component */
 5742|      0|        }
 5743|  93.6k|        else
 5744|  93.6k|        {
 5745|  93.6k|            if (( isdigit( *pStart ) &&
 5746|  93.6k|                  0 < ( val = (int) inchi_strtol( pStart, &q, 10 ) ) ||
  ------------------
  |  Branch (5746:19): [True: 78, False: 0]
  ------------------
 5747|  93.6k|                  ( q = pStart, val = 1 ) ) &&
  ------------------
  |  Branch (5747:19): [True: 93.5k, False: 0]
  ------------------
 5748|  93.6k|                  ( t = strchr((char *)mult_type, *q)) && q + 1 == pEnd)
  ------------------
  |  Branch (5748:19): [True: 24, False: 93.6k]
  |  Branch (5748:59): [True: 1, False: 23]
  ------------------
 5749|      1|            {
 5750|       |                /* process the abbreviation */
 5751|      1|                ret = 0;
 5752|      1|#if (FIX_DALKE_BUGS == 1)
 5753|      1|                if (iComponent + val > nNumComponents)
  ------------------
  |  Branch (5753:21): [True: 0, False: 1]
  ------------------
 5754|      0|                {
 5755|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5756|      0|                    goto exit_function;
 5757|      0|                }
 5758|      1|#endif
 5759|      1|                bIsoFrom = 0;
 5760|      1|                switch (bMobileH)
 5761|      1|                {
 5762|      0|                    case TAUT_YES:
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (5762:21): [True: 0, False: 1]
  ------------------
 5763|      0|                        ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5764|      0|                        break;
 5765|      1|                    case TAUT_NON:
  ------------------
  |  |  579|      1|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (5765:21): [True: 1, False: 0]
  ------------------
 5766|      1|                        if (*q == 'm')
  ------------------
  |  Branch (5766:29): [True: 0, False: 1]
  ------------------
 5767|      0|                        {
 5768|       |                            /* copy from mobile H to fixed H */
 5769|      0|                            pInChIFrom = pInpInChI[ALT_TAUT( bMobileH )];
  ------------------
  |  |  582|      0|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (582:29): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 5770|      0|                        }
 5771|      1|                        else
 5772|      1|                        {
 5773|      1|                            if (*q == 'e')
  ------------------
  |  Branch (5773:33): [True: 0, False: 1]
  ------------------
 5774|      0|                            {
 5775|       |                                /* copy from mobile H to isotopic mobile H */
 5776|      0|                                pInChIFrom = pInChI;
 5777|      0|                                bIsoFrom = -1; /* empty */
 5778|      0|                            }
 5779|      1|                            else
 5780|      1|                            {
 5781|      1|                                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      1|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5782|      1|                            }
 5783|      1|                        }
 5784|      1|                        break;
 5785|      0|                    default:
  ------------------
  |  Branch (5785:21): [True: 0, False: 1]
  ------------------
 5786|      0|                        ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5787|      0|                        break;
 5788|      1|                }
 5789|      1|                if (ret < 0)
  ------------------
  |  Branch (5789:21): [True: 1, False: 0]
  ------------------
 5790|      1|                {
 5791|      1|                    goto exit_function;
 5792|      1|                }
 5793|       |                /* copy */
 5794|      0|                for (i = 0; i < val; i++)
  ------------------
  |  Branch (5794:29): [True: 0, False: 0]
  ------------------
 5795|      0|                {
 5796|      0|#if ( FIX_GAF_2019_2==1 )
 5797|      0|                    {
 5798|      0|                        if ((iComponent + i>nNumComponents) || (iComponent + i<0))
  ------------------
  |  Branch (5798:29): [True: 0, False: 0]
  |  Branch (5798:64): [True: 0, False: 0]
  ------------------
 5799|      0|                        {
 5800|      0|                            ret = RI_ERR_SYNTAX;  /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5801|      0|                            goto exit_function;
 5802|      0|                        }
 5803|      0|                    }
 5804|      0|#endif
 5805|      0|                    ret = CopySegment( pInChI + iComponent + i, pInChIFrom + iComponent + i, nCpyType, 0, bIsoFrom );
 5806|      0|                    if (!ret)
  ------------------
  |  Branch (5806:25): [True: 0, False: 0]
  ------------------
 5807|      0|                    {
 5808|      0|                        ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5809|      0|                    }
 5810|      0|                    if (ret < 0)
  ------------------
  |  Branch (5810:25): [True: 0, False: 0]
  ------------------
 5811|      0|                    {
 5812|      0|                        goto exit_function;
 5813|      0|                    }
 5814|      0|                }
 5815|      0|                iComponent += val;
 5816|       |                /* continue to the next component(s) */
 5817|      0|                if (*pEnd)
  ------------------
  |  Branch (5817:21): [True: 0, False: 0]
  ------------------
 5818|      0|                {
 5819|      0|                    pStart = pEnd + 1;
 5820|      0|                    continue;
 5821|      0|                }
 5822|      0|                else
 5823|      0|                {
 5824|      0|                    break;
 5825|      0|                }
 5826|      0|            }
 5827|  93.6k|            else
 5828|  93.6k|            {
 5829|  93.6k|                mpy_component = 1;
 5830|  93.6k|                p = pStart;
 5831|  93.6k|            }
 5832|  93.6k|        }
 5833|       |
 5834|  93.6k|#if ( FIX_GAF_2019_2==1 )
 5835|  93.6k|        if ((iComponent > nNumComponents - 1) || (iComponent<0))
  ------------------
  |  Branch (5835:13): [True: 0, False: 93.6k]
  |  Branch (5835:50): [True: 0, False: 93.6k]
  ------------------
 5836|      0|        {
 5837|      0|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5838|      0|            goto exit_function;
 5839|      0|        }
 5840|  93.6k|        if (pInChI[iComponent].nNumberOfAtoms <= 0 || pInChI[iComponent].nNumberOfAtoms > MAX_ATOMS)
  ------------------
  |  |   43|  93.6k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (5840:13): [True: 0, False: 93.6k]
  |  Branch (5840:55): [True: 0, False: 93.6k]
  ------------------
 5841|      0|        {
 5842|      0|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5843|      0|            goto exit_function;
 5844|      0|        }
 5845|  93.6k|#endif
 5846|  93.6k|        pStart = p;
 5847|  93.6k|        pIsotopicAtom = &pInChI[iComponent].IsotopicAtom;
 5848|  93.6k|        if (*pIsotopicAtom)
  ------------------
  |  Branch (5848:13): [True: 0, False: 93.6k]
  ------------------
 5849|      0|        {
 5850|      0|            ret = RI_ERR_PROGR; /* program error */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 5851|      0|            goto exit_function;
 5852|      0|        }
 5853|       |
 5854|  93.6k|        if (p < pEnd && *pbAbc == -1)
  ------------------
  |  Branch (5854:13): [True: 81, False: 93.5k]
  |  Branch (5854:25): [True: 0, False: 81]
  ------------------
 5855|      0|        {
 5856|       |            /* check if compressed InChI */
 5857|      0|            *pbAbc = isupper( UCINT *p ) ? 1 : 0;
 5858|      0|        }
 5859|  93.6k|        base = ( *pbAbc == 1 ) ? ALPHA_BASE : 10;
  ------------------
  |  |   96|      0|#define ALPHA_BASE  27
  ------------------
  |  Branch (5859:16): [True: 0, False: 93.6k]
  ------------------
 5860|       |
 5861|   187k|one_more_time:
 5862|   187k|        if (*pbAbc == 1)
  ------------------
  |  Branch (5862:13): [True: 0, False: 187k]
  ------------------
 5863|      0|        {
 5864|       |            /* process the componnt: At[+/-Charge]TDH,... */
 5865|       |            /* pass 1: find number of stereoatoms */
 5866|      0|            for (p = pStart, iAtom = 0; p < pEnd; iAtom++)
  ------------------
  |  Branch (5866:41): [True: 0, False: 0]
  ------------------
 5867|      0|            {
 5868|      0|                nAtom1 = (AT_NUMB) inchi_strtol( p, &p, base );
 5869|      0|#if ( CHECK_STRTOL_ATNUMB==1 )
 5870|      0|                if (nAtom1>MAX_ATOMS || nAtom1<0)
  ------------------
  |  |   43|      0|#define MAX_ATOMS  32766
  ------------------
  |  Branch (5870:21): [True: 0, False: 0]
  |  Branch (5870:41): [True: 0, False: 0]
  ------------------
 5871|      0|                {
 5872|      0|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5873|      0|                    goto exit_function;
 5874|      0|                }
 5875|      0|#endif
 5876|      0|                if (!nAtom1 ||
  ------------------
  |  Branch (5876:21): [True: 0, False: 0]
  ------------------
 5877|      0|                     nAtom1 > pInChI[iComponent].nNumberOfAtoms)
  ------------------
  |  Branch (5877:22): [True: 0, False: 0]
  ------------------
 5878|      0|                {
 5879|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5880|      0|                    goto exit_function;
 5881|      0|                }
 5882|      0|                memset( &isoAtom, 0, sizeof( isoAtom ) );
 5883|      0|                isoAtom.nAtomNumber = nAtom1;
 5884|      0|                isoAtom.nIsoDifference = (NUM_H) inchi_strtol( p, &q, 10 ); /* alway in abc */
 5885|      0|                if (p == q)
  ------------------
  |  Branch (5885:21): [True: 0, False: 0]
  ------------------
 5886|      0|                {
 5887|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5888|      0|                    goto exit_function;
 5889|      0|                }
 5890|      0|                p = q;
 5891|      0|                if (*p == 't')
  ------------------
  |  Branch (5891:21): [True: 0, False: 0]
  ------------------
 5892|      0|                {
 5893|      0|                    isoAtom.nNum_T = 1;
 5894|      0|                    p++;
 5895|      0|                    if (isdigit( UCINT *p ))
 5896|      0|                    {
 5897|      0|                        isoAtom.nNum_T = (NUM_H) inchi_strtol( p, &q, 10 );
 5898|      0|                        p = q;
 5899|      0|                    }
 5900|      0|                }
 5901|      0|                if (*p == 'd')
  ------------------
  |  Branch (5901:21): [True: 0, False: 0]
  ------------------
 5902|      0|                {
 5903|      0|                    isoAtom.nNum_D = 1;
 5904|      0|                    p++;
 5905|      0|                    if (isdigit( UCINT *p ))
 5906|      0|                    {
 5907|      0|                        isoAtom.nNum_D = (NUM_H) inchi_strtol( p, &q, 10 );
 5908|      0|                        p = q;
 5909|      0|                    }
 5910|      0|                }
 5911|      0|                if (*p == 'h')
  ------------------
  |  Branch (5911:21): [True: 0, False: 0]
  ------------------
 5912|      0|                {
 5913|      0|                    isoAtom.nNum_H = 1;
 5914|      0|                    p++;
 5915|      0|                    if (isdigit( UCINT *p ))
 5916|      0|                    {
 5917|      0|                        isoAtom.nNum_H = (NUM_H) inchi_strtol( p, &q, 10 );
 5918|      0|                        p = q;
 5919|      0|                    }
 5920|      0|                }
 5921|      0|                if (p > pEnd || !isoAtom.nIsoDifference && !isoAtom.nNum_T && !isoAtom.nNum_D && !isoAtom.nNum_H)
  ------------------
  |  Branch (5921:21): [True: 0, False: 0]
  |  Branch (5921:33): [True: 0, False: 0]
  |  Branch (5921:60): [True: 0, False: 0]
  |  Branch (5921:79): [True: 0, False: 0]
  |  Branch (5921:98): [True: 0, False: 0]
  ------------------
 5922|      0|                {
 5923|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5924|      0|                    goto exit_function;
 5925|      0|                }
 5926|      0|                if (*pIsotopicAtom)
  ------------------
  |  Branch (5926:21): [True: 0, False: 0]
  ------------------
 5927|      0|                {
 5928|      0|                    pIsotopicAtom[0][iAtom] = isoAtom;
 5929|      0|                }
 5930|      0|            }
 5931|      0|        }
 5932|   187k|        else
 5933|   187k|        {
 5934|       |            /* process the componnt: At[+/-Charge]TDH,... */
 5935|       |            /* pass 1: find number of stereoatoms */
 5936|   223k|            for (p = pStart, iAtom = 0; p < pEnd; iAtom++)
  ------------------
  |  Branch (5936:41): [True: 35.9k, False: 187k]
  ------------------
 5937|  35.9k|            {
 5938|  35.9k|                nAtom1 = (AT_NUMB) inchi_strtol( p, &q, 10 );
 5939|  35.9k|#if ( CHECK_STRTOL_ATNUMB==1 )
 5940|  35.9k|                if (nAtom1>MAX_ATOMS || nAtom1<0)
  ------------------
  |  |   43|  71.8k|#define MAX_ATOMS  32766
  ------------------
  |  Branch (5940:21): [True: 2, False: 35.9k]
  |  Branch (5940:41): [True: 0, False: 35.9k]
  ------------------
 5941|      2|                {
 5942|      2|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      2|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5943|      2|                    goto exit_function;
 5944|      2|                }
 5945|  35.9k|#endif
 5946|  35.9k|                p = q;
 5947|  35.9k|                if (!nAtom1 ||
  ------------------
  |  Branch (5947:21): [True: 5, False: 35.9k]
  ------------------
 5948|  35.9k|                    nAtom1 > pInChI[iComponent].nNumberOfAtoms ||
  ------------------
  |  Branch (5948:21): [True: 0, False: 35.9k]
  ------------------
 5949|  35.9k|                    !(r = strchr( (char*)parity_type, *p )))
  ------------------
  |  Branch (5949:21): [True: 0, False: 35.9k]
  ------------------
 5950|      5|                {
 5951|      5|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      5|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5952|      5|                    goto exit_function;
 5953|      5|                }
 5954|  35.9k|                memset( &isoAtom, 0, sizeof( isoAtom ) );
 5955|  35.9k|                isoAtom.nAtomNumber = nAtom1;
 5956|  35.9k|                if (p[0] == '+' && isdigit( UCINT p[1] ))
  ------------------
  |  Branch (5956:21): [True: 502, False: 35.4k]
  ------------------
 5957|    502|                {
 5958|    502|                    isoAtom.nIsoDifference = (NUM_H) inchi_strtol( p + 1, &q, 10 );
 5959|    502|                    if (isoAtom.nIsoDifference >= 0) isoAtom.nIsoDifference++;
  ------------------
  |  Branch (5959:25): [True: 482, False: 20]
  ------------------
 5960|    502|                    p = q;
 5961|    502|                }
 5962|  35.4k|                else
 5963|  35.4k|                    if (p[0] == '-' && isdigit( UCINT p[1] ))
  ------------------
  |  Branch (5963:25): [True: 26.7k, False: 8.68k]
  ------------------
 5964|  26.7k|                    {
 5965|  26.7k|                        isoAtom.nIsoDifference = -(NUM_H) inchi_strtol( p + 1, &q, 10 );
 5966|  26.7k|                        if (isoAtom.nIsoDifference == 0) isoAtom.nIsoDifference++;
  ------------------
  |  Branch (5966:29): [True: 3.57k, False: 23.1k]
  ------------------
 5967|  26.7k|                        p = q;
 5968|  26.7k|                    }
 5969|  35.9k|                if (*p == 'T')
  ------------------
  |  Branch (5969:21): [True: 2.07k, False: 33.8k]
  ------------------
 5970|  2.07k|                {
 5971|  2.07k|                    isoAtom.nNum_T = 1;
 5972|  2.07k|                    p++;
 5973|  2.07k|                    if (isdigit( UCINT *p ))
 5974|  1.98k|                    {
 5975|  1.98k|                        isoAtom.nNum_T = (NUM_H) inchi_strtol( p, &q, 10 );
 5976|  1.98k|                        p = q;
 5977|  1.98k|                    }
 5978|  2.07k|                }
 5979|  35.9k|                if (*p == 'D')
  ------------------
  |  Branch (5979:21): [True: 1.41k, False: 34.5k]
  ------------------
 5980|  1.41k|                {
 5981|  1.41k|                    isoAtom.nNum_D = 1;
 5982|  1.41k|                    p++;
 5983|  1.41k|                    if (isdigit( UCINT *p ))
 5984|    104|                    {
 5985|    104|                        isoAtom.nNum_D = (NUM_H) inchi_strtol( p, &q, 10 );
 5986|    104|                        p = q;
 5987|    104|                    }
 5988|  1.41k|                }
 5989|  35.9k|                if (*p == 'H')
  ------------------
  |  Branch (5989:21): [True: 5.48k, False: 30.4k]
  ------------------
 5990|  5.48k|                {
 5991|  5.48k|                    isoAtom.nNum_H = 1;
 5992|  5.48k|                    p++;
 5993|  5.48k|                    if (isdigit( UCINT *p ))
 5994|  3.66k|                    {
 5995|  3.66k|                        isoAtom.nNum_H = (NUM_H) inchi_strtol( p, &q, 10 );
 5996|  3.66k|                        p = q;
 5997|  3.66k|                    }
 5998|  5.48k|                }
 5999|  35.9k|                if (!isoAtom.nIsoDifference && !isoAtom.nNum_T && !isoAtom.nNum_D && !isoAtom.nNum_H)
  ------------------
  |  Branch (5999:21): [True: 8.68k, False: 27.2k]
  |  Branch (5999:48): [True: 6.61k, False: 2.07k]
  |  Branch (5999:67): [True: 5.46k, False: 1.15k]
  |  Branch (5999:86): [True: 0, False: 5.46k]
  ------------------
 6000|      0|                {
 6001|      0|                    ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6002|      0|                    goto exit_function;
 6003|      0|                }
 6004|  35.9k|                if (p < pEnd)
  ------------------
  |  Branch (6004:21): [True: 35.7k, False: 148]
  ------------------
 6005|  35.7k|                {
 6006|  35.7k|                    if (*p == ',')
  ------------------
  |  Branch (6006:25): [True: 35.7k, False: 0]
  ------------------
 6007|  35.7k|                    {
 6008|  35.7k|                        p++;
 6009|  35.7k|                    }
 6010|      0|                    else
 6011|      0|                    {
 6012|      0|                        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6013|      0|                        goto exit_function;
 6014|      0|                    }
 6015|  35.7k|                }
 6016|  35.9k|                if (*pIsotopicAtom)
  ------------------
  |  Branch (6016:21): [True: 17.9k, False: 17.9k]
  ------------------
 6017|  17.9k|                {
 6018|  17.9k|                    pIsotopicAtom[0][iAtom] = isoAtom;
 6019|  17.9k|                }
 6020|  35.9k|            }
 6021|   187k|        }
 6022|   187k|        if (p != pEnd)
  ------------------
  |  Branch (6022:13): [True: 0, False: 187k]
  ------------------
 6023|      0|        {
 6024|      0|            ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6025|      0|            goto exit_function;
 6026|      0|        }
 6027|       |
 6028|   187k|        if (!*pIsotopicAtom)
  ------------------
  |  Branch (6028:13): [True: 93.6k, False: 93.6k]
  ------------------
 6029|  93.6k|        {
 6030|       |            /* end of the 1st pass */
 6031|  93.6k|            len = iAtom;
 6032|       |            /* memory allocation */
 6033|  93.6k|            if (!( *pIsotopicAtom = (INChI_IsotopicAtom *) inchi_calloc( len + 1, sizeof( **pIsotopicAtom ) ) ))
  ------------------
  |  | 1133|  93.6k|#define inchi_calloc   calloc
  ------------------
  |  Branch (6033:17): [True: 0, False: 93.6k]
  ------------------
 6034|      0|            {
 6035|      0|                ret = RI_ERR_ALLOC; /* memory allocation failed */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 6036|      0|                goto exit_function;
 6037|      0|            }
 6038|  93.6k|            goto one_more_time; /* goto the 2nd pass */
 6039|  93.6k|        }
 6040|  93.6k|        else
 6041|  93.6k|        {
 6042|       |            /* 2nd pass */
 6043|  93.6k|            if (len != iAtom)
  ------------------
  |  Branch (6043:17): [True: 0, False: 93.6k]
  ------------------
 6044|      0|            {
 6045|      0|                ret = RI_ERR_PROGR; /* program error */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 6046|      0|                goto exit_function;
 6047|      0|            }
 6048|  93.6k|            pInChI[iComponent].nNumberOfIsotopicAtoms = len;
 6049|  93.6k|        }
 6050|       |
 6051|       |        /* multiplier */
 6052|  93.6k|        for (i = 1; i < mpy_component; i++)
  ------------------
  |  Branch (6052:21): [True: 0, False: 93.6k]
  ------------------
 6053|      0|        {
 6054|      0|            ret = CopySegment( pInChI + iComponent + i, pInChI + iComponent, nCpyType, 0, 0 );
 6055|      0|            if (!ret)
  ------------------
  |  Branch (6055:17): [True: 0, False: 0]
  ------------------
 6056|      0|            {
 6057|      0|                ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6058|      0|            }
 6059|      0|            if (ret < 0)
  ------------------
  |  Branch (6059:17): [True: 0, False: 0]
  ------------------
 6060|      0|            {
 6061|      0|                goto exit_function;
 6062|      0|            }
 6063|      0|        }
 6064|       |
 6065|  93.6k|        iComponent += mpy_component;
 6066|  93.6k|        if (*pEnd)
  ------------------
  |  Branch (6066:13): [True: 93.5k, False: 80]
  ------------------
 6067|  93.5k|        {
 6068|  93.5k|            pStart = pEnd + 1;
 6069|  93.5k|            continue;
 6070|  93.5k|        }
 6071|     80|        else
 6072|     80|        {
 6073|     80|            break;
 6074|     80|        }
 6075|       |
 6076|  93.6k|    }
 6077|       |
 6078|     80|    if (nNumComponents != iComponent)
  ------------------
  |  Branch (6078:9): [True: 0, False: 80]
  ------------------
 6079|      0|    {
 6080|      0|        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 6081|      0|        goto exit_function;
 6082|      0|    }
 6083|       |
 6084|     80|    ret = iComponent + 1;
 6085|       |
 6086|     88|exit_function:
 6087|       |
 6088|     88|    return ret;
 6089|     80|}
ichiread.c:ParseSegmentIsoExchgH:
 5426|     17|{
 5427|       |    /* Pass 1: count bonds and find actual numbers of  atom */
 5428|     17|    const char *p, *q, *pStart, *pEnd;
 5429|     17|    int  ret = 0, num, i, i_prev;
 5430|     17|    static const char abc_h[] = "hdt";
 5431|       |
 5432|     17|    if (str[0] != 'h')
  ------------------
  |  Branch (5432:9): [True: 17, False: 0]
  ------------------
 5433|     17|    {
 5434|     17|        return 0;
 5435|     17|    }
 5436|       |
 5437|      0|    pStart = (char  *) str + 1;
 5438|       |
 5439|      0|    if (!( bMobileH == TAUT_YES && state == IST_MOBILE_H_ISO_EXCH_H ))
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (5439:12): [True: 0, False: 0]
  |  Branch (5439:36): [True: 0, False: 0]
  ------------------
 5440|      0|    {
 5441|      0|        return RI_ERR_PROGR; /* program error */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 5442|      0|    }
 5443|       |
 5444|      0|    if (!( pEnd = strchr( pStart, ';' ) ))
  ------------------
  |  Branch (5444:9): [True: 0, False: 0]
  ------------------
 5445|      0|    {
 5446|      0|        pEnd = pStart + strlen( pStart );
 5447|      0|    }
 5448|      0|    else
 5449|      0|    {
 5450|      0|        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5451|      0|        goto exit_function;
 5452|      0|    }
 5453|      0|    p = pStart;
 5454|       |
 5455|      0|    if (p < pEnd && *pbAbc == -1)
  ------------------
  |  Branch (5455:9): [True: 0, False: 0]
  |  Branch (5455:21): [True: 0, False: 0]
  ------------------
 5456|      0|    {
 5457|       |        /* check if compressed InChI */
 5458|       |        /* compressed:    /hNtNdNh where N is a decimal number */
 5459|       |        /* uncompressed:  /hT[n]D[n]H[n] where n > 1 is a decimal number */
 5460|      0|        *pbAbc = isdigit( UCINT *p ) ? 1 : 0;
 5461|      0|    }
 5462|       |
 5463|      0|    if (*pbAbc == 1)
  ------------------
  |  Branch (5463:9): [True: 0, False: 0]
  ------------------
 5464|      0|    {
 5465|      0|        i_prev = ( int )sizeof( abc_h );
 5466|      0|        while (p < pEnd)
  ------------------
  |  Branch (5466:16): [True: 0, False: 0]
  ------------------
 5467|      0|        {
 5468|      0|            num = (int) inchi_strtol( p, &q, 10 );
 5469|      0|#if ( CHECK_STRTOL_ATNUMB==1 )
 5470|      0|            if (num>MAX_ATOMS || num<0)
  ------------------
  |  |   43|      0|#define MAX_ATOMS  32766
  ------------------
  |  Branch (5470:17): [True: 0, False: 0]
  |  Branch (5470:34): [True: 0, False: 0]
  ------------------
 5471|      0|            {
 5472|      0|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5473|      0|                goto exit_function;
 5474|      0|            }
 5475|      0|#endif
 5476|      0|            if (0 >= num || p == q || q >= pEnd)
  ------------------
  |  Branch (5476:17): [True: 0, False: 0]
  |  Branch (5476:29): [True: 0, False: 0]
  |  Branch (5476:39): [True: 0, False: 0]
  ------------------
 5477|      0|            {
 5478|      0|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5479|      0|                goto exit_function;
 5480|      0|            }
 5481|      0|            p = strchr((char *)abc_h, *q);
 5482|      0|            if (p && ( i = (int) ( p - abc_h ) ) < i_prev)
  ------------------
  |  Branch (5482:17): [True: 0, False: 0]
  |  Branch (5482:22): [True: 0, False: 0]
  ------------------
 5483|      0|            {
 5484|      0|                nNumProtons[bMobileH].nNumRemovedIsotopicH[i] = (NUM_H) num;
 5485|      0|                p = q + 1;
 5486|      0|                i_prev = i;
 5487|      0|            }
 5488|      0|            else
 5489|      0|            {
 5490|      0|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5491|      0|                goto exit_function;
 5492|      0|            }
 5493|      0|        }
 5494|      0|    }
 5495|      0|    else
 5496|      0|    {
 5497|      0|        if (*p == 'T')
  ------------------
  |  Branch (5497:13): [True: 0, False: 0]
  ------------------
 5498|      0|        {
 5499|      0|            nNumProtons[bMobileH].nNumRemovedIsotopicH[2] = 1;
 5500|      0|            p++;
 5501|      0|            if (isdigit( UCINT p[0] ))
 5502|      0|            {
 5503|      0|                nNumProtons[bMobileH].nNumRemovedIsotopicH[2] = (NUM_H) inchi_strtol( p, &q, 10 );
 5504|      0|                p = q;
 5505|      0|            }
 5506|      0|        }
 5507|      0|        if (*p == 'D')
  ------------------
  |  Branch (5507:13): [True: 0, False: 0]
  ------------------
 5508|      0|        {
 5509|      0|            nNumProtons[bMobileH].nNumRemovedIsotopicH[1] = 1;
 5510|      0|            p++;
 5511|      0|            if (isdigit( UCINT p[0] ))
 5512|      0|            {
 5513|      0|                nNumProtons[bMobileH].nNumRemovedIsotopicH[1] = (NUM_H) inchi_strtol( p, &q, 10 );
 5514|      0|                p = q;
 5515|      0|            }
 5516|      0|        }
 5517|      0|        if (*p == 'H')
  ------------------
  |  Branch (5517:13): [True: 0, False: 0]
  ------------------
 5518|      0|        {
 5519|      0|            nNumProtons[bMobileH].nNumRemovedIsotopicH[0] = 1;
 5520|      0|            p++;
 5521|      0|            if (isdigit( UCINT p[0] ))
 5522|      0|            {
 5523|      0|                nNumProtons[bMobileH].nNumRemovedIsotopicH[0] = (NUM_H) inchi_strtol( p, &q, 10 );
 5524|      0|                p = q;
 5525|      0|            }
 5526|      0|        }
 5527|      0|    }
 5528|      0|    if (p != pEnd)
  ------------------
  |  Branch (5528:9): [True: 0, False: 0]
  ------------------
 5529|      0|    {
 5530|      0|        ret = RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5531|      0|        goto exit_function;
 5532|      0|    }
 5533|      0|    ret = 1;
 5534|       |
 5535|      0|exit_function:
 5536|       |
 5537|      0|    return ret;
 5538|      0|}
ichiread.c:ParseSegmentPerm:
 5548|     86|{
 5549|     86|    int nNumComponents, iComponent1, iComponent2, numTrans;
 5550|     86|    const char *p, *q, *pStart, *pEnd, *pPermStart, *pPermEnd;
 5551|     86|    int  ret = 0;
 5552|     86|    INChI *pInChI = pInpInChI[bMobileH]; /* bMobileH should be TAUT_NON = 0 */
 5553|     86|    INChI tmp;
 5554|     86|    int   base = 10;
 5555|       |
 5556|     86|    if (str[0] != 'o')
  ------------------
  |  Branch (5556:9): [True: 86, False: 0]
  ------------------
 5557|     86|    {
 5558|     86|        return 0;
 5559|     86|    }
 5560|       |
 5561|      0|    pStart = (char  *) str + 1;
 5562|      0|    nNumComponents = ppnNumComponents[bMobileH];
 5563|       |
 5564|      0|    if (!( bMobileH == TAUT_NON && ( state == IST_FIXED_H_PERMUTATION || state == IST_FIXED_H_ISO_PERMUTATION ) ))
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (5564:12): [True: 0, False: 0]
  |  Branch (5564:38): [True: 0, False: 0]
  |  Branch (5564:74): [True: 0, False: 0]
  ------------------
 5565|      0|    {
 5566|      0|        return RI_ERR_PROGR; /* program error */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 5567|      0|    }
 5568|       |
 5569|      0|    if (!( pEnd = strchr( pStart, ';' ) ))
  ------------------
  |  Branch (5569:9): [True: 0, False: 0]
  ------------------
 5570|      0|    {
 5571|      0|        pEnd = pStart + strlen( pStart );
 5572|      0|    }
 5573|      0|    else
 5574|      0|    {
 5575|      0|        return RI_ERR_SYNTAX; /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5576|      0|    }
 5577|      0|    while (pStart < pEnd)
  ------------------
  |  Branch (5577:12): [True: 0, False: 0]
  ------------------
 5578|      0|    {
 5579|       |        /* cycle over components; rearrange Fixed H components in order of Mobile H components */
 5580|       |        /* if /o(1,2,3) then reaarange Fixed H components in this way: tmp<-1, 1<-2, 2<-3, 3<-tmp */
 5581|      0|        if (*pStart != '(')
  ------------------
  |  Branch (5581:13): [True: 0, False: 0]
  ------------------
 5582|      0|        {
 5583|      0|            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5584|      0|            goto exit_function;
 5585|      0|        }
 5586|      0|        pPermStart = pStart + 1;
 5587|      0|        memset( &tmp, 0, sizeof( tmp ) );  /* initialization 2006-03 */
 5588|      0|        if (!( pPermEnd = strchr( pPermStart, ')' ) ) || pPermEnd == pPermStart)
  ------------------
  |  Branch (5588:13): [True: 0, False: 0]
  |  Branch (5588:58): [True: 0, False: 0]
  ------------------
 5589|      0|        {
 5590|      0|            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5591|      0|            goto exit_function;
 5592|      0|        }
 5593|       |
 5594|      0|        if (pPermStart < pPermEnd && *pbAbc == -1)
  ------------------
  |  Branch (5594:13): [True: 0, False: 0]
  |  Branch (5594:38): [True: 0, False: 0]
  ------------------
 5595|      0|        {
 5596|       |            /* check if compressed InChI */
 5597|      0|            *pbAbc = isupper( UCINT *pPermStart ) ? 1 : 0;
 5598|      0|        }
 5599|      0|        base = ( *pbAbc == 1 ) ? ALPHA_BASE : 10;
  ------------------
  |  |   96|      0|#define ALPHA_BASE  27
  ------------------
  |  Branch (5599:16): [True: 0, False: 0]
  ------------------
 5600|       |
 5601|       |        /* permutation cycle */
 5602|      0|        if (*pbAbc == 1)
  ------------------
  |  Branch (5602:13): [True: 0, False: 0]
  ------------------
 5603|      0|        {
 5604|      0|            for (p = pPermStart, iComponent2 = numTrans = 0; p < pPermEnd; iComponent2 = iComponent1, p = q)
  ------------------
  |  Branch (5604:62): [True: 0, False: 0]
  ------------------
 5605|      0|            {
 5606|       |                /* get first atom number */
 5607|      0|                if (0 >= ( iComponent1 = (int) inchi_strtol( p, &q, base ) ) || iComponent1 > nNumComponents)
  ------------------
  |  Branch (5607:21): [True: 0, False: 0]
  |  Branch (5607:81): [True: 0, False: 0]
  ------------------
 5608|      0|                {
 5609|      0|                    ret = RI_ERR_SYNTAX;  /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5610|      0|                    goto exit_function;
 5611|      0|                }
 5612|      0|#if ( FIX_GAF_2019_2==1 )
 5613|      0|                if ((iComponent1 - 1 > nNumComponents - 1) || (iComponent1 - 1<0))
  ------------------
  |  Branch (5613:21): [True: 0, False: 0]
  |  Branch (5613:63): [True: 0, False: 0]
  ------------------
 5614|      0|                {
 5615|      0|                    ret = RI_ERR_SYNTAX;  /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5616|      0|                    goto exit_function;
 5617|      0|                }
 5618|      0|#endif
 5619|      0|                if (iComponent2)
  ------------------
  |  Branch (5619:21): [True: 0, False: 0]
  ------------------
 5620|      0|                {
 5621|      0|                    pInChI[iComponent2 - 1] = pInChI[iComponent1 - 1];
 5622|      0|                    numTrans++;
 5623|      0|                }
 5624|      0|                else
 5625|      0|                {
 5626|      0|                    tmp = pInChI[iComponent1 - 1]; /* on the 1st pass save Component1 */
 5627|      0|                }
 5628|      0|            }
 5629|      0|        }
 5630|      0|        else
 5631|      0|        {
 5632|      0|            for (p = pPermStart, iComponent2 = numTrans = 0; p < pPermEnd; iComponent2 = iComponent1, p = q + ( *q == ',' ))
  ------------------
  |  Branch (5632:62): [True: 0, False: 0]
  ------------------
 5633|      0|            {
 5634|       |                /* get first atom number */
 5635|      0|                if (!isdigit( UCINT *p ))
  ------------------
  |  Branch (5635:21): [True: 0, False: 0]
  ------------------
 5636|      0|                {
 5637|      0|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5638|      0|                    goto exit_function;
 5639|      0|                }
 5640|      0|                if (!( iComponent1 = (int) inchi_strtol( p, &q, 10 ) ) || iComponent1 > nNumComponents)
  ------------------
  |  Branch (5640:21): [True: 0, False: 0]
  |  Branch (5640:75): [True: 0, False: 0]
  ------------------
 5641|      0|                {
 5642|      0|                    ret = RI_ERR_SYNTAX;  /* syntax error */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5643|      0|                    goto exit_function;
 5644|      0|                }
 5645|      0|                if (iComponent2)
  ------------------
  |  Branch (5645:21): [True: 0, False: 0]
  ------------------
 5646|      0|                {
 5647|      0|                    pInChI[iComponent2 - 1] = pInChI[iComponent1 - 1];
 5648|      0|                    numTrans++;
 5649|      0|                }
 5650|      0|                else
 5651|      0|                {
 5652|      0|                    tmp = pInChI[iComponent1 - 1]; /* on the 1st pass save Component1 */
 5653|      0|                }
 5654|      0|            }
 5655|      0|        }
 5656|      0|        pInChI[iComponent2 - 1] = tmp;
 5657|      0|        if (!numTrans || p != pPermEnd)
  ------------------
  |  Branch (5657:13): [True: 0, False: 0]
  |  Branch (5657:26): [True: 0, False: 0]
  ------------------
 5658|      0|        {
 5659|      0|            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5660|      0|            goto exit_function;
 5661|      0|        }
 5662|      0|        else
 5663|      0|        {
 5664|      0|            pStart = p + 1;
 5665|      0|        }
 5666|      0|    }
 5667|      0|    ret = 1;
 5668|       |
 5669|      0|exit_function:
 5670|       |
 5671|      0|    return ret;
 5672|      0|}
ichiread.c:nFillOutProtonMobileH:
 9419|     70|{
 9420|     70|    int len = 1;
 9421|     70|    pInChI->bDeleted = 1;
 9422|       |    /* formula */
 9423|     70|    if (!pInChI->szHillFormula &&
  ------------------
  |  Branch (9423:9): [True: 70, False: 0]
  ------------------
 9424|     70|         !( pInChI->szHillFormula = (char *) inchi_calloc( len + 1, sizeof( pInChI->szHillFormula[0] ) ) ))
  ------------------
  |  | 1133|     70|#define inchi_calloc   calloc
  ------------------
  |  Branch (9424:10): [True: 0, False: 70]
  ------------------
 9425|      0|    {
 9426|      0|        return RI_ERR_ALLOC; /* alloc failure */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 9427|      0|    }
 9428|     70|    strcpy( pInChI->szHillFormula, "H" );
 9429|     70|    pInChI->nNumberOfAtoms = 1;
 9430|       |
 9431|       |    /* atoms */
 9432|     70|    if (!pInChI->nAtom &&
  ------------------
  |  Branch (9432:9): [True: 70, False: 0]
  ------------------
 9433|     70|         !( pInChI->nAtom = (U_CHAR *) inchi_calloc( len + 1, sizeof( pInChI->nAtom[0] ) ) ))
  ------------------
  |  | 1133|     70|#define inchi_calloc   calloc
  ------------------
  |  Branch (9433:10): [True: 0, False: 70]
  ------------------
 9434|      0|    {
 9435|      0|        return RI_ERR_ALLOC; /* alloc failure */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 9436|      0|    }
 9437|     70|    pInChI->nAtom[0] = 1;
 9438|       |    /* charge */
 9439|     70|    pInChI->nTotalCharge = 1;
 9440|       |    /* connection table */
 9441|     70|    if (!pInChI->nConnTable &&
  ------------------
  |  Branch (9441:9): [True: 70, False: 0]
  ------------------
 9442|     70|         !( pInChI->nConnTable = (AT_NUMB *) inchi_calloc( len + 1, sizeof( pInChI->nConnTable[0] ) ) ))
  ------------------
  |  | 1133|     70|#define inchi_calloc   calloc
  ------------------
  |  Branch (9442:10): [True: 0, False: 70]
  ------------------
 9443|      0|    {
 9444|      0|        return RI_ERR_ALLOC; /* alloc failure */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 9445|      0|    }
 9446|     70|    pInChI->nConnTable[0] = 1;
 9447|     70|    pInChI->lenConnTable = len;
 9448|       |    /* tautomer */
 9449|     70|    if (!pInChI->nTautomer &&
  ------------------
  |  Branch (9449:9): [True: 70, False: 0]
  ------------------
 9450|     70|         !( pInChI->nTautomer = (AT_NUMB *) inchi_calloc( len + 1, sizeof( pInChI->nTautomer[0] ) ) ))
  ------------------
  |  | 1133|     70|#define inchi_calloc   calloc
  ------------------
  |  Branch (9450:10): [True: 0, False: 70]
  ------------------
 9451|      0|    {
 9452|      0|        return RI_ERR_ALLOC; /* alloc failure */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 9453|      0|    }
 9454|       |    /* nNum_H */
 9455|     70|    if (!pInChI->nNum_H &&
  ------------------
  |  Branch (9455:9): [True: 70, False: 0]
  ------------------
 9456|     70|         !( pInChI->nNum_H = (S_CHAR *) inchi_calloc( len + 1, sizeof( pInChI->nNum_H[0] ) ) ))
  ------------------
  |  | 1133|     70|#define inchi_calloc   calloc
  ------------------
  |  Branch (9456:10): [True: 0, False: 70]
  ------------------
 9457|      0|    {
 9458|      0|        return RI_ERR_ALLOC; /* alloc failure */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 9459|      0|    }
 9460|     70|    pInChI->nNum_H[0] = 0;
 9461|       |
 9462|     70|    pInChI->nTautomer[0] = 0;
 9463|     70|    pInChI->lenTautomer = 1;
 9464|       |
 9465|     70|    return 0;
 9466|     70|}
ichiread.c:CopySegment:
 9952|      8|{
 9953|      8|    int            ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      8|#define RI_ERR_ALLOC   (-1)
  ------------------
 9954|      8|    int            len;
 9955|       |
 9956|      8|    if (SegmentType == CPY_SP2 ||
  ------------------
  |  Branch (9956:9): [True: 4, False: 4]
  ------------------
 9957|      8|         SegmentType == CPY_SP3 ||
  ------------------
  |  Branch (9957:10): [True: 0, False: 4]
  ------------------
 9958|      8|         SegmentType == CPY_SP3_M ||
  ------------------
  |  Branch (9958:10): [True: 0, False: 4]
  ------------------
 9959|      8|         SegmentType == CPY_SP3_S)
  ------------------
  |  Branch (9959:10): [True: 0, False: 4]
  ------------------
 9960|      4|    {
 9961|      4|        INChI_Stereo **pstereoTo = NULL;
 9962|      4|        INChI_Stereo *stereoFrom = bIsotopicFrom == 1 ? pInChIFrom->StereoIsotopic :
  ------------------
  |  Branch (9962:36): [True: 0, False: 4]
  ------------------
 9963|      4|            bIsotopicFrom == 0 ? pInChIFrom->Stereo : NULL;
  ------------------
  |  Branch (9963:13): [True: 0, False: 4]
  ------------------
 9964|      4|        if (stereoFrom || bIsotopicFrom < 0)
  ------------------
  |  Branch (9964:13): [True: 0, False: 4]
  |  Branch (9964:27): [True: 4, False: 0]
  ------------------
 9965|      4|        {
 9966|      4|            if (SegmentType == CPY_SP2)
  ------------------
  |  Branch (9966:17): [True: 4, False: 0]
  ------------------
 9967|      4|            {
 9968|      4|#if ( FIX_GAF_2019_1==1 )
 9969|      4|                if (bIsotopicFrom >= 0 &&
  ------------------
  |  Branch (9969:21): [True: 0, False: 4]
  ------------------
 9970|      4|                    (pInChIFrom->nNumberOfAtoms > MAX_ATOMS || pInChIFrom->nNumberOfAtoms < 0))
  ------------------
  |  |   43|      0|#define MAX_ATOMS  32766
  ------------------
  |  Branch (9970:22): [True: 0, False: 0]
  |  Branch (9970:64): [True: 0, False: 0]
  ------------------
 9971|      0|                {
 9972|      0|                    ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9973|      0|                    goto exit_function;
 9974|      0|                }
 9975|      4|#endif
 9976|      4|                if (bIsotopicFrom < 0 ||
  ------------------
  |  Branch (9976:21): [True: 4, False: 0]
  ------------------
 9977|      4|                     stereoFrom->b_parity &&
  ------------------
  |  Branch (9977:22): [True: 0, False: 0]
  ------------------
 9978|      0|                     stereoFrom->nBondAtom1 &&
  ------------------
  |  Branch (9978:22): [True: 0, False: 0]
  ------------------
 9979|      0|                     stereoFrom->nBondAtom2)
  ------------------
  |  Branch (9979:22): [True: 0, False: 0]
  ------------------
 9980|      4|                {
 9981|       |
 9982|      4|                    len = ( bIsotopicFrom < 0 ) ? 0 : stereoFrom->nNumberOfStereoBonds;
  ------------------
  |  Branch (9982:27): [True: 4, False: 0]
  ------------------
 9983|      4|                    pstereoTo = bIsotopicTo ? &pInChITo->StereoIsotopic : &pInChITo->Stereo;
  ------------------
  |  Branch (9983:33): [True: 0, False: 4]
  ------------------
 9984|      4|                    if (!pstereoTo[0])
  ------------------
  |  Branch (9984:25): [True: 4, False: 0]
  ------------------
 9985|      4|                    {
 9986|      4|                        if (!( pstereoTo[0] = (INChI_Stereo *) inchi_calloc( 1, sizeof( **pstereoTo ) ) ))
  ------------------
  |  | 1133|      4|#define inchi_calloc   calloc
  ------------------
  |  Branch (9986:29): [True: 0, False: 4]
  ------------------
 9987|      0|                        {
 9988|      0|                            goto exit_function;
 9989|      0|                        }
 9990|      4|                    }
 9991|      4|                    if (pstereoTo[0]->nNumberOfStereoBonds > 0 || pstereoTo[0]->b_parity ||
  ------------------
  |  Branch (9991:25): [True: 0, False: 4]
  |  Branch (9991:67): [True: 0, False: 4]
  ------------------
 9992|      4|                         pstereoTo[0]->nBondAtom1 || pstereoTo[0]->nBondAtom2)
  ------------------
  |  Branch (9992:26): [True: 0, False: 4]
  |  Branch (9992:54): [True: 0, False: 4]
  ------------------
 9993|      0|                    {
 9994|      0|                        ret = RI_ERR_SYNTAX; /* stereo already exists */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 9995|      0|                        goto exit_function;
 9996|      0|                    }
 9997|       |                    /* allocate sp2 stereo */
 9998|      4|                    if (!( pstereoTo[0]->b_parity = (S_CHAR *) inchi_calloc( len + 1, sizeof( pstereoTo[0]->b_parity[0] ) ) ) ||
  ------------------
  |  | 1133|      4|#define inchi_calloc   calloc
  ------------------
  |  Branch (9998:25): [True: 0, False: 4]
  ------------------
 9999|      4|                         !( pstereoTo[0]->nBondAtom1 = (AT_NUMB *) inchi_calloc( len + 1, sizeof( pstereoTo[0]->nBondAtom1[0] ) ) ) ||
  ------------------
  |  | 1133|      4|#define inchi_calloc   calloc
  ------------------
  |  Branch (9999:26): [True: 0, False: 4]
  ------------------
10000|      4|                         !( pstereoTo[0]->nBondAtom2 = (AT_NUMB *) inchi_calloc( len + 1, sizeof( pstereoTo[0]->nBondAtom2[0] ) ) ))
  ------------------
  |  | 1133|      4|#define inchi_calloc   calloc
  ------------------
  |  Branch (10000:26): [True: 0, False: 4]
  ------------------
10001|      0|                    {
10002|       |                        /* cleanup */
10003|      0|                        if (pstereoTo[0]->b_parity)
  ------------------
  |  Branch (10003:29): [True: 0, False: 0]
  ------------------
10004|      0|                        {
10005|      0|                            INCHI_HEAPCHK
10006|      0|                                inchi_free( pstereoTo[0]->b_parity );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
10007|      0|                            pstereoTo[0]->b_parity = NULL;
10008|      0|                        }
10009|      0|                        if (pstereoTo[0]->nBondAtom1)
  ------------------
  |  Branch (10009:29): [True: 0, False: 0]
  ------------------
10010|      0|                        {
10011|      0|                            INCHI_HEAPCHK
10012|      0|                                inchi_free( pstereoTo[0]->nBondAtom1 );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
10013|      0|                            pstereoTo[0]->nBondAtom1 = NULL;
10014|      0|                        }
10015|      0|                        if (pstereoTo[0]->nBondAtom2)
  ------------------
  |  Branch (10015:29): [True: 0, False: 0]
  ------------------
10016|      0|                        {
10017|      0|                            INCHI_HEAPCHK
10018|      0|                                inchi_free( pstereoTo[0]->nBondAtom2 );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
10019|      0|                            pstereoTo[0]->nBondAtom2 = NULL;
10020|      0|                        }
10021|      0|                        INCHI_HEAPCHK
10022|      0|                            goto exit_function;
10023|      0|                    }
10024|       |                    /* copy stereo */
10025|      4|                    if (bIsotopicFrom >= 0 && len)
  ------------------
  |  Branch (10025:25): [True: 0, False: 4]
  |  Branch (10025:47): [True: 0, False: 0]
  ------------------
10026|      0|                    {
10027|      0|#if ( FIX_GAF_2019_1==1 )
10028|      0|                        if (pInChIFrom->nNumberOfAtoms > MAX_ATOMS || pInChIFrom->nNumberOfAtoms < 0)
  ------------------
  |  |   43|      0|#define MAX_ATOMS  32766
  ------------------
  |  Branch (10028:29): [True: 0, False: 0]
  |  Branch (10028:71): [True: 0, False: 0]
  ------------------
10029|      0|                        {
10030|      0|                            ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
10031|      0|                            goto exit_function;
10032|      0|                        }
10033|      0|#endif
10034|      0|                        memcpy( pstereoTo[0]->b_parity, stereoFrom->b_parity, ( len + 1 ) * sizeof( pstereoTo[0]->b_parity[0] ) );
10035|      0|                        memcpy( pstereoTo[0]->nBondAtom1, stereoFrom->nBondAtom1, ( len + 1 ) * sizeof( pstereoTo[0]->nBondAtom1[0] ) );
10036|      0|                        memcpy( pstereoTo[0]->nBondAtom2, stereoFrom->nBondAtom2, ( len + 1 ) * sizeof( pstereoTo[0]->nBondAtom2[0] ) );
10037|      0|                    }
10038|      4|                    pstereoTo[0]->nNumberOfStereoBonds = len;
10039|       |
10040|      4|                    return len + 1;
10041|      4|                }
10042|      0|                else
10043|      0|                {
10044|      0|                    return 0;
10045|      0|                }
10046|      4|            }
10047|      0|            else
10048|      0|            {
10049|      0|                if (SegmentType == CPY_SP3)
  ------------------
  |  Branch (10049:21): [True: 0, False: 0]
  ------------------
10050|      0|                {
10051|      0|                    if (bIsotopicFrom < 0 ||
  ------------------
  |  Branch (10051:25): [True: 0, False: 0]
  ------------------
10052|      0|                         stereoFrom->t_parity &&
  ------------------
  |  Branch (10052:26): [True: 0, False: 0]
  ------------------
10053|      0|                         stereoFrom->nNumber)
  ------------------
  |  Branch (10053:26): [True: 0, False: 0]
  ------------------
10054|      0|                    {
10055|       |
10056|      0|                        len = ( bIsotopicFrom < 0 ) ? 0 : stereoFrom->nNumberOfStereoCenters;
  ------------------
  |  Branch (10056:31): [True: 0, False: 0]
  ------------------
10057|       |
10058|      0|                        pstereoTo = bIsotopicTo ? &pInChITo->StereoIsotopic : &pInChITo->Stereo;
  ------------------
  |  Branch (10058:37): [True: 0, False: 0]
  ------------------
10059|      0|                        if (!pstereoTo[0])
  ------------------
  |  Branch (10059:29): [True: 0, False: 0]
  ------------------
10060|      0|                        {
10061|      0|                            if (!( pstereoTo[0] = (INChI_Stereo *) inchi_calloc( 1, sizeof( **pstereoTo ) ) ))
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  |  Branch (10061:33): [True: 0, False: 0]
  ------------------
10062|      0|                            {
10063|      0|                                goto exit_function;
10064|      0|                            }
10065|      0|                        }
10066|      0|                        if (pstereoTo[0]->nNumberOfStereoCenters > 0 || pstereoTo[0]->t_parity ||
  ------------------
  |  Branch (10066:29): [True: 0, False: 0]
  |  Branch (10066:73): [True: 0, False: 0]
  ------------------
10067|      0|                             pstereoTo[0]->nNumber)
  ------------------
  |  Branch (10067:30): [True: 0, False: 0]
  ------------------
10068|      0|                        {
10069|      0|                            ret = RI_ERR_SYNTAX; /* stereo already exists */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
10070|      0|                            goto exit_function;
10071|      0|                        }
10072|       |                        /* allocate sp3 stereo */
10073|      0|                        if (!( pstereoTo[0]->t_parity = (S_CHAR *) inchi_calloc( len + 1, sizeof( pstereoTo[0]->b_parity[0] ) ) ) ||
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  |  Branch (10073:29): [True: 0, False: 0]
  ------------------
10074|      0|                             !( pstereoTo[0]->nNumber = (AT_NUMB *) inchi_calloc( len + 1, sizeof( pstereoTo[0]->nBondAtom1[0] ) ) ))
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  |  Branch (10074:30): [True: 0, False: 0]
  ------------------
10075|      0|                        {
10076|       |                            /* cleanup */
10077|      0|                            if (pstereoTo[0]->t_parity)
  ------------------
  |  Branch (10077:33): [True: 0, False: 0]
  ------------------
10078|      0|                            {
10079|      0|                                inchi_free( pstereoTo[0]->t_parity );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
10080|      0|                                pstereoTo[0]->t_parity = NULL;
10081|      0|                            }
10082|      0|                            if (pstereoTo[0]->nNumber)
  ------------------
  |  Branch (10082:33): [True: 0, False: 0]
  ------------------
10083|      0|                            {
10084|      0|                                inchi_free( pstereoTo[0]->nNumber );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
10085|      0|                                pstereoTo[0]->nNumber = NULL;
10086|      0|                            }
10087|      0|                            goto exit_function;
10088|      0|                        }
10089|       |                        /* copy stereo */
10090|      0|                        if (bIsotopicFrom >= 0 && len)
  ------------------
  |  Branch (10090:29): [True: 0, False: 0]
  |  Branch (10090:51): [True: 0, False: 0]
  ------------------
10091|      0|                        {
10092|      0|                            memcpy( pstereoTo[0]->t_parity, stereoFrom->t_parity, ( len + 1 ) * sizeof( pstereoTo[0]->t_parity[0] ) );
10093|      0|                            memcpy( pstereoTo[0]->nNumber, stereoFrom->nNumber, ( len + 1 ) * sizeof( pstereoTo[0]->nNumber[0] ) );
10094|      0|                        }
10095|      0|                        pstereoTo[0]->nNumberOfStereoCenters = len;
10096|      0|                        return len + 1;
10097|      0|                    }
10098|      0|                    else
10099|      0|                    {
10100|      0|                        return 0;
10101|      0|                    }
10102|      0|                }
10103|      0|                else
10104|      0|                {
10105|      0|                    if (SegmentType == CPY_SP3_M)
  ------------------
  |  Branch (10105:25): [True: 0, False: 0]
  ------------------
10106|      0|                    {
10107|      0|                        pstereoTo = bIsotopicTo ? &pInChITo->StereoIsotopic : &pInChITo->Stereo;
  ------------------
  |  Branch (10107:37): [True: 0, False: 0]
  ------------------
10108|      0|                        if (!pstereoTo[0])
  ------------------
  |  Branch (10108:29): [True: 0, False: 0]
  ------------------
10109|      0|                        {
10110|      0|                            if (!( pstereoTo[0] = (INChI_Stereo *) inchi_calloc( 1, sizeof( **pstereoTo ) ) ))
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  |  Branch (10110:33): [True: 0, False: 0]
  ------------------
10111|      0|                            {
10112|      0|                                goto exit_function;
10113|      0|                            }
10114|      0|                        }
10115|      0|                        if (pstereoTo[0]->nCompInv2Abs && NO_VALUE_INT != pstereoTo[0]->nCompInv2Abs)
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (10115:29): [True: 0, False: 0]
  |  Branch (10115:59): [True: 0, False: 0]
  ------------------
10116|      0|                        {
10117|      0|                            ret = RI_ERR_SYNTAX; /* stereo already exists */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
10118|      0|                            goto exit_function;
10119|      0|                        }
10120|      0|                        if (bIsotopicFrom < 0)
  ------------------
  |  Branch (10120:29): [True: 0, False: 0]
  ------------------
10121|      0|                        {
10122|      0|                            pstereoTo[0]->nCompInv2Abs = 0;
10123|      0|                        }
10124|      0|                        else
10125|      0|                        {
10126|      0|                            pstereoTo[0]->nCompInv2Abs = stereoFrom->nCompInv2Abs;
10127|      0|                        }
10128|      0|                        return 1;
10129|      0|                    }
10130|      0|                    else
10131|      0|                    {
10132|       |                        /* use bTrivialInv to save /s1, /s2, /s3 */
10133|      0|                        if (SegmentType == CPY_SP3_S)
  ------------------
  |  Branch (10133:29): [True: 0, False: 0]
  ------------------
10134|      0|                        {
10135|      0|                            pstereoTo = bIsotopicFrom ? &pInChITo->StereoIsotopic : &pInChITo->Stereo;
  ------------------
  |  Branch (10135:41): [True: 0, False: 0]
  ------------------
10136|      0|                            if (!pstereoTo[0])
  ------------------
  |  Branch (10136:33): [True: 0, False: 0]
  ------------------
10137|      0|                            {
10138|      0|                                if (!( pstereoTo[0] = (INChI_Stereo *) inchi_calloc( 1, sizeof( **pstereoTo ) ) ))
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  |  Branch (10138:37): [True: 0, False: 0]
  ------------------
10139|      0|                                {
10140|      0|                                    goto exit_function;
10141|      0|                                }
10142|      0|                            }
10143|      0|                            if (pstereoTo[0]->bTrivialInv)
  ------------------
  |  Branch (10143:33): [True: 0, False: 0]
  ------------------
10144|      0|                            {
10145|      0|                                ret = RI_ERR_SYNTAX; /* stereo already exists */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
10146|      0|                                goto exit_function;
10147|      0|                            }
10148|      0|                            pstereoTo[0]->bTrivialInv = stereoFrom->bTrivialInv;
10149|      0|                            if (bIsotopicFrom < 0)
  ------------------
  |  Branch (10149:33): [True: 0, False: 0]
  ------------------
10150|      0|                            {
10151|      0|                                pstereoTo[0]->bTrivialInv = 0;
10152|      0|                            }
10153|      0|                            else
10154|      0|                            {
10155|      0|                                pstereoTo[0]->bTrivialInv = stereoFrom->bTrivialInv;
10156|      0|                            }
10157|      0|                            return 1;
10158|      0|                        }
10159|      0|                    }
10160|      0|                }
10161|      0|            }
10162|      4|        }
10163|       |
10164|      0|        return 0; /* nothing to copy */
10165|      4|    }
10166|       |
10167|      4|    else if (SegmentType == CPY_ISO_AT)
  ------------------
  |  Branch (10167:14): [True: 4, False: 0]
  ------------------
10168|      4|    {
10169|      4|        int nNumberOfIsotopicAtoms = pInChIFrom->nNumberOfIsotopicAtoms;
10170|      4|        INChI_IsotopicAtom   **pIsotopicAtomTo = NULL;
10171|      4|        INChI_IsotopicAtom    *IsotopicAtomFrom = pInChIFrom->IsotopicAtom;
10172|      4|        if (bIsotopicFrom < 0 || IsotopicAtomFrom)
  ------------------
  |  Branch (10172:13): [True: 0, False: 4]
  |  Branch (10172:34): [True: 4, False: 0]
  ------------------
10173|      4|        {
10174|      4|            len = ( bIsotopicFrom < 0 ) ? 0 : nNumberOfIsotopicAtoms;
  ------------------
  |  Branch (10174:19): [True: 0, False: 4]
  ------------------
10175|      4|#if ( FIX_GAF_2019_3==1 )
10176|      4|            if (pInChITo->nNumberOfIsotopicAtoms<1)
  ------------------
  |  Branch (10176:17): [True: 4, False: 0]
  ------------------
10177|      4|            {
10178|       |                /* forcibly free iso-related memory and set to NULL */
10179|      4|                qzfree(pInChITo->IsotopicAtom);
  ------------------
  |  | 1160|      4|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 0, False: 4]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
10180|      4|            }
10181|      4|#endif
10182|      4|            pIsotopicAtomTo = &pInChITo->IsotopicAtom;
10183|      4|            if (!*pIsotopicAtomTo)
  ------------------
  |  Branch (10183:17): [True: 4, False: 0]
  ------------------
10184|      4|            {
10185|      4|                if (!( *pIsotopicAtomTo = (INChI_IsotopicAtom *) inchi_calloc( len + 1, sizeof( **pIsotopicAtomTo ) ) ))
  ------------------
  |  | 1133|      4|#define inchi_calloc   calloc
  ------------------
  |  Branch (10185:21): [True: 0, False: 4]
  ------------------
10186|      0|                {
10187|      0|                    goto exit_function;
10188|      0|                }
10189|      4|            }
10190|      4|            if (pInChITo->nNumberOfIsotopicAtoms)
  ------------------
  |  Branch (10190:17): [True: 0, False: 4]
  ------------------
10191|      0|            {
10192|      0|                ret = RI_ERR_SYNTAX; /* stereo already exists */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
10193|      0|                goto exit_function;
10194|      0|            }
10195|      4|            if (bIsotopicFrom >= 0 && len)
  ------------------
  |  Branch (10195:17): [True: 4, False: 0]
  |  Branch (10195:39): [True: 4, False: 0]
  ------------------
10196|      4|            {
10197|      4|                memcpy( *pIsotopicAtomTo, IsotopicAtomFrom, ( len + 1 ) * sizeof( **pIsotopicAtomTo ) );
10198|      4|            }
10199|      4|            pInChITo->nNumberOfIsotopicAtoms = len;
10200|      4|            return len + 1;
10201|      4|        }
10202|       |
10203|      0|        return 0;
10204|      4|    }
10205|       |
10206|      0|    ret = RI_ERR_PROGR; /* program error */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
10207|       |
10208|      0|exit_function:
10209|       |
10210|      0|    return ret;
10211|      0|}
ichiread.c:getInChIChar:
10237|  2.36M|{
10238|  2.36M|    if (pInp->type == INCHI_IOS_TYPE_STRING)
  ------------------
  |  | 1011|  2.36M|#define INCHI_IOS_TYPE_STRING 1
  ------------------
  |  Branch (10238:9): [True: 2.36M, False: 0]
  ------------------
10239|  2.36M|    {
10240|       |        /* input from string */
10241|  2.36M|        if (pInp->s.nPtr < pInp->s.nUsedLength)
  ------------------
  |  Branch (10241:13): [True: 2.35M, False: 159]
  ------------------
10242|  2.35M|        {
10243|  2.35M|            return (int) pInp->s.pStr[pInp->s.nPtr++];
10244|  2.35M|        }
10245|    159|        return RI_ERR_EOF;
  ------------------
  |  |   47|    159|#define RI_ERR_EOF     (0)
  ------------------
10246|  2.36M|    }
10247|      0|    else
10248|      0|    {
10249|       |        /* input from plain file */
10250|      0|        int c;
10251|       |#if ( defined(_MSC_VER)&&defined(_WIN32) || defined(__BORLANDC__)&&defined(__WIN32__) || defined(__GNUC__)&&defined(__MINGW32__)&&defined(_WIN32) )
10252|       |        do
10253|       |        {
10254|       |            c = getc( pInp->f );
10255|       |            if (c == EOF)
10256|       |            {
10257|       |                c = RI_ERR_EOF;
10258|       |                break;
10259|       |            }
10260|       |        } while (c == '\r');
10261|       |#else
10262|      0|        c = getc( pInp->f );
10263|      0|        if (c == EOF)
  ------------------
  |  Branch (10263:13): [True: 0, False: 0]
  ------------------
10264|      0|        {
10265|      0|            c = RI_ERR_EOF;
  ------------------
  |  |   47|      0|#define RI_ERR_EOF     (0)
  ------------------
10266|      0|        }
10267|      0|#endif
10268|      0|        return c;
10269|      0|    }
10270|  2.36M|}
ichiread.c:nGetInChISegment:
10350|  1.60k|{
10351|  1.60k|    int c;
10352|  1.60k|    Line->len = 0;
10353|  2.34M|    while (0 < ( c = AddInChIChar( pInp, Line, pszToken ) ))
  ------------------
  |  Branch (10353:12): [True: 2.34M, False: 1.60k]
  ------------------
10354|  2.34M|    {
10355|  2.34M|        ;
10356|  2.34M|    }
10357|  1.60k|    if (c < -2)
  ------------------
  |  Branch (10357:9): [True: 1.30k, False: 306]
  ------------------
10358|  1.30k|    {
10359|  1.30k|        c = -( c + 2 );
10360|  1.30k|    }
10361|  1.60k|    Line->c = c;
10362|       |
10363|  1.60k|    return c;
10364|  1.60k|}
ichiread.c:AddInChIChar:
10277|  2.34M|{
10278|  2.34M|    int c = getInChIChar( pInp );
10279|       |    /*
10280|       |    while ( c == '\r' ) {
10281|       |    c = getInChIChar( pInp );
10282|       |    }
10283|       |    */
10284|       |
10285|       |    INCHI_HEAPCHK
10286|       |
10287|  2.34M|        if (Line->len + 2 >= Line->len_alloc)
  ------------------
  |  Branch (10287:13): [True: 17.0k, False: 2.33M]
  ------------------
10288|  17.0k|        {
10289|  17.0k|            char *str = (char *) inchi_calloc( Line->len_alloc + SEGM_LINE_ADD, sizeof( str[0] ) );
  ------------------
  |  | 1133|  17.0k|#define inchi_calloc   calloc
  ------------------
                          char *str = (char *) inchi_calloc( Line->len_alloc + SEGM_LINE_ADD, sizeof( str[0] ) );
  ------------------
  |  |   77|  17.0k|#define SEGM_LINE_ADD 128
  ------------------
10290|  17.0k|            INCHI_HEAPCHK
10291|  17.0k|                if (str)
  ------------------
  |  Branch (10291:21): [True: 17.0k, False: 0]
  ------------------
10292|  17.0k|                {
10293|  17.0k|                    if (Line->len > 0 && Line->str)
  ------------------
  |  Branch (10293:25): [True: 16.6k, False: 454]
  |  Branch (10293:42): [True: 16.6k, False: 0]
  ------------------
10294|  16.6k|                    {
10295|  16.6k|                        memcpy( str, Line->str, sizeof( str[0] ) * Line->len );
10296|  16.6k|                        Line->len_alloc += SEGM_LINE_ADD;
  ------------------
  |  |   77|  16.6k|#define SEGM_LINE_ADD 128
  ------------------
10297|  16.6k|                        inchi_free( Line->str );
  ------------------
  |  | 1136|  16.6k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 16.6k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
10298|  16.6k|                        INCHI_HEAPCHK
10299|  16.6k|                    }
10300|    454|                    else
10301|    454|                    {
10302|    454|                        Line->len_alloc += SEGM_LINE_ADD;
  ------------------
  |  |   77|    454|#define SEGM_LINE_ADD 128
  ------------------
10303|    454|                    }
10304|  17.0k|                    Line->str = str;
10305|  17.0k|                }
10306|      0|                else
10307|      0|                {
10308|      0|                    c = RI_ERR_ALLOC; /* fatal error */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
10309|      0|                    goto exit_function;
10310|      0|                }
10311|  17.0k|        }
10312|  2.34M|    INCHI_HEAPCHK
10313|  2.34M|        if (c < 0)
  ------------------
  |  Branch (10313:13): [True: 0, False: 2.34M]
  ------------------
10314|      0|        {
10315|      0|            Line->str[Line->len] = '\0';
10316|      0|            INCHI_HEAPCHK
10317|      0|                c = RI_ERR_SYNTAX; /* fatal error: wrong char */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
10318|      0|            goto exit_function;
10319|      0|        }
10320|       |
10321|  2.34M|    if (c && strchr( pszToken, c )) /*        /\            */
  ------------------
  |  Branch (10321:9): [True: 2.34M, False: 306]
  |  Branch (10321:14): [True: 1.30k, False: 2.34M]
  ------------------
10322|  1.30k|    {
10323|  1.30k|        Line->str[Line->len] = '\0';
10324|  1.30k|        INCHI_HEAPCHK
10325|  1.30k|            c = -( c + 2 );
10326|  1.30k|        goto exit_function;
10327|  1.30k|    }
10328|  2.34M|    else if (!c && !Line->len)
  ------------------
  |  Branch (10328:14): [True: 306, False: 2.34M]
  |  Branch (10328:20): [True: 59, False: 247]
  ------------------
10329|     59|    {
10330|     59|        Line->str[Line->len] = c;
10331|     59|        INCHI_HEAPCHK
10332|     59|    }
10333|  2.34M|    else
10334|  2.34M|    {
10335|  2.34M|        Line->str[Line->len++] = c;
10336|  2.34M|        INCHI_HEAPCHK
10337|  2.34M|    }
10338|       |
10339|  2.34M|exit_function:
10340|       |
10341|       |    INCHI_HEAPCHK
10342|       |
10343|  2.34M|        return c;
10344|  2.34M|}
ichiread.c:getInchiStateReadErr:
  530|    286|{
  531|    286|    int i, bRecMet = 0;
  532|       |
  533|    286|    if (stat >= IST_HAPPENED_IN_RECMET)
  ------------------
  |  |  363|    286|#define IST_HAPPENED_IN_RECMET   100
  ------------------
  |  Branch (533:9): [True: 6, False: 280]
  ------------------
  534|      6|    {
  535|      6|        bRecMet = 1;
  536|      6|        stat -= IST_HAPPENED_IN_RECMET;
  ------------------
  |  |  363|      6|#define IST_HAPPENED_IN_RECMET   100
  ------------------
  537|      6|    }
  538|  6.09k|    for (i = 0; 0 <= irErrMsg[i].stat && stat != irErrMsg[i].stat; i++)
  ------------------
  |  Branch (538:17): [True: 6.09k, False: 0]
  |  Branch (538:42): [True: 5.80k, False: 286]
  ------------------
  539|  5.80k|    {
  540|  5.80k|        ;
  541|  5.80k|    }
  542|    286|    sprintf( szMsg,
  543|    286|#if ( FIX_DALKE_BUGS == 1 )
  544|    286|             "%s%.100s",
  545|       |#else
  546|       |             "%s%s",
  547|       |#endif
  548|    286|             irErrMsg[i].msg, bRecMet ? ", Reconnected layer" : "" );
  ------------------
  |  Branch (548:31): [True: 6, False: 280]
  ------------------
  549|    286|}
ichiread.c:getInchiErrName:
  554|    222|{
  555|    222|    switch (nErr)
  ------------------
  |  Branch (555:13): [True: 7, False: 215]
  ------------------
  556|    222|    {
  557|      0|        case RI_ERR_ALLOC:
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
  |  Branch (557:9): [True: 0, False: 222]
  ------------------
  558|      0|            return "Allocation failed";
  559|      3|        case RI_ERR_PROGR:
  ------------------
  |  |   45|      3|#define RI_ERR_PROGR   (-3)
  ------------------
  |  Branch (559:9): [True: 3, False: 219]
  ------------------
  560|      3|            return "Program error";
  561|    212|        case RI_ERR_SYNTAX:
  ------------------
  |  |   44|    212|#define RI_ERR_SYNTAX  (-2)
  ------------------
  |  Branch (561:9): [True: 212, False: 10]
  ------------------
  562|    212|            return "Syntax error";
  563|      0|        case RI_ERR_EOL:
  ------------------
  |  |   46|      0|#define RI_ERR_EOL     (-4)
  ------------------
  |  Branch (563:9): [True: 0, False: 222]
  ------------------
  564|      0|            return "End of line";
  565|    222|    }
  566|      7|    return "Unknown error";
  567|    222|}
ichiread.c:SetHillFormFromInChI:
  575|     80|{
  576|     80|    int iINChI, iTaut, iComp, num_diff;
  577|     80|    INChI *pINChI;
  578|     80|    char *szHillFormulaOld;
  579|    240|    for (iINChI = 0, num_diff = 0; iINChI < INCHI_NUM; iINChI++)
  ------------------
  |  |  574|    240|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (579:36): [True: 160, False: 80]
  ------------------
  580|    160|    {
  581|    480|        for (iTaut = TAUT_NON; iTaut < TAUT_NUM; iTaut++)
  ------------------
  |  |  579|    160|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                      for (iTaut = TAUT_NON; iTaut < TAUT_NUM; iTaut++)
  ------------------
  |  |  578|    480|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (581:32): [True: 320, False: 160]
  ------------------
  582|    320|        {
  583|  1.53k|            for (iComp = 0; iComp < OneInput->nNumComponents[iINChI][iTaut]; iComp++)
  ------------------
  |  Branch (583:29): [True: 1.21k, False: 320]
  ------------------
  584|  1.21k|            {
  585|  1.21k|                pINChI = &OneInput->pInpInChI[iINChI][iTaut][iComp];
  586|  1.21k|                if (!pINChI->nNumberOfAtoms || pINChI->bDeleted || !pINChI->szHillFormula || !pINChI->szHillFormula[0])
  ------------------
  |  Branch (586:21): [True: 0, False: 1.21k]
  |  Branch (586:48): [True: 0, False: 1.21k]
  |  Branch (586:68): [True: 0, False: 1.21k]
  |  Branch (586:94): [True: 0, False: 1.21k]
  ------------------
  587|      0|                {
  588|      0|                    continue;
  589|      0|                }
  590|  1.21k|                szHillFormulaOld = pINChI->szHillFormula;
  591|  1.21k|                pINChI->szHillFormula = AllocateAndFillHillFormula( pINChI );
  592|  1.21k|                num_diff += !pINChI->szHillFormula || !pINChI->szHillFormula[0] || strcmp( pINChI->szHillFormula, szHillFormulaOld );
  ------------------
  |  Branch (592:29): [True: 0, False: 1.21k]
  |  Branch (592:55): [True: 0, False: 1.21k]
  |  Branch (592:84): [True: 99, False: 1.11k]
  ------------------
  593|  1.21k|                inchi_free( szHillFormulaOld );
  ------------------
  |  | 1136|  1.21k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 1.21k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  594|  1.21k|            }
  595|    320|        }
  596|    160|    }
  597|       |
  598|     80|    return num_diff;
  599|     80|}
ichiread.c:OutputInChIAsRequested:
 1208|     80|{
 1209|     80|    int      j, k, k1, k2, ret2 = 0, iINChI, iINChI1, iINChI2;
 1210|     80|    PINChI2 *pINChI[INCHI_NUM];
 1211|     80|    PINChI_Aux2 *pINChI_Aux[INCHI_NUM];
 1212|     80|    int bReqNonTaut;
 1213|     80|    int bHasSomeReconnected;
 1214|       |
 1215|     80|    INPUT_PARMS ip_local;
 1216|     80|    STRUCT_DATA sd_local;
 1217|     80|    INPUT_PARMS *ip = &ip_local;
 1218|     80|    STRUCT_DATA *sd = &sd_local;
 1219|     80|    NORM_CANON_FLAGS ncFlags;
 1220|     80|    NORM_CANON_FLAGS *pncFlags = &ncFlags;
 1221|     80|    int  nRet1, bSortPrintINChIFlags;
 1222|     80|    int  bReqSplitOutputInChI;
 1223|     80|    int  nNumOutputComponents;
 1224|       |
 1225|     80|    INCHI_IOS_STRING temp_string_container;
 1226|     80|    INCHI_IOS_STRING *strbuf = &temp_string_container;
 1227|     80|    memset( strbuf, 0, sizeof( *strbuf ) );
 1228|       |
 1229|     80|    if (0 >= inchi_strbuf_init( strbuf, INCHI_STRBUF_INITIAL_SIZE, INCHI_STRBUF_SIZE_INCREMENT ))
  ------------------
  |  |   93|     80|#define INCHI_STRBUF_INITIAL_SIZE 262144
  ------------------
                  if (0 >= inchi_strbuf_init( strbuf, INCHI_STRBUF_INITIAL_SIZE, INCHI_STRBUF_SIZE_INCREMENT ))
  ------------------
  |  |   94|     80|#define INCHI_STRBUF_SIZE_INCREMENT 262144
  ------------------
  |  Branch (1229:9): [True: 0, False: 80]
  ------------------
 1230|      0|    {
 1231|      0|        ret2 = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 1232|      0|        goto exit_error;
 1233|      0|    }
 1234|       |
 1235|     80|    nRet1 = 0;
 1236|     80|    k1 = k2 = 0;
 1237|     80|    memset( pncFlags, 0, sizeof( *pncFlags ) );
 1238|     80|    memset( pINChI, 0, sizeof( pINChI ) );
 1239|     80|    memset( pINChI_Aux, 0, sizeof( pINChI_Aux ) );
 1240|       |
 1241|     80|    *ip = *ip_inp;
 1242|     80|    *sd = *sd_inp;
 1243|     80|    bHasSomeReconnected = 0;
 1244|     80|    bSortPrintINChIFlags = 0;
 1245|     80|    nNumOutputComponents = 0;
 1246|     80|    bReqNonTaut = ( 0 != ( ip->nMode & REQ_MODE_BASIC ) );
  ------------------
  |  |   43|     80|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
 1247|     80|    bReqSplitOutputInChI = ( 0 != ( ip->bReadInChIOptions & READ_INCHI_SPLIT_OUTPUT ) );
  ------------------
  |  |  986|     80|#define READ_INCHI_SPLIT_OUTPUT          0x00000002
  ------------------
 1248|       |
 1249|       |    INCHI_HEAPCHK
 1250|       |
 1251|     80|        if (num_components[INCHI_BAS])
  ------------------
  |  |  575|     80|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (1251:13): [True: 80, False: 0]
  ------------------
 1252|     80|        {
 1253|     80|            MYREALLOC2( PINChI2, PINChI_Aux2, pINChI[INCHI_BAS], pINChI_Aux[INCHI_BAS], num_components[INCHI_BAS], num_components[INCHI_BAS], k1 );
  ------------------
  |  | 1165|     80|    do { \
  |  | 1166|     80|        if( (LEN1) <= (LEN2) ) {\
  |  |  ------------------
  |  |  |  Branch (1166:13): [True: 80, False: 0]
  |  |  ------------------
  |  | 1167|     80|            PTRTYPE1 * newPTR1 = (PTRTYPE1 *)inchi_calloc( (LEN2)+1, sizeof(PTRTYPE1) );\
  |  |  ------------------
  |  |  |  | 1133|     80|#define inchi_calloc   calloc
  |  |  ------------------
  |  | 1168|     80|            PTRTYPE2 * newPTR2 = (PTRTYPE2 *)inchi_calloc( (LEN2)+1, sizeof(PTRTYPE2) );\
  |  |  ------------------
  |  |  |  | 1133|     80|#define inchi_calloc   calloc
  |  |  ------------------
  |  | 1169|     80|            if ( newPTR1 && newPTR2 ) { \
  |  |  ------------------
  |  |  |  Branch (1169:18): [True: 80, False: 0]
  |  |  |  Branch (1169:29): [True: 80, False: 0]
  |  |  ------------------
  |  | 1170|     80|                if ( (PTR1) && (LEN1) > 0 ) \
  |  |  ------------------
  |  |  |  Branch (1170:22): [True: 0, False: 80]
  |  |  |  Branch (1170:32): [True: 0, False: 0]
  |  |  ------------------
  |  | 1171|     80|                    (memcpy) ( newPTR1, (PTR1), (LEN1) * sizeof(PTRTYPE1) ); \
  |  | 1172|     80|                if ( (PTR2) && (LEN1) > 0 ) \
  |  |  ------------------
  |  |  |  Branch (1172:22): [True: 0, False: 80]
  |  |  |  Branch (1172:32): [True: 0, False: 0]
  |  |  ------------------
  |  | 1173|     80|                    (memcpy) ( newPTR2, (PTR2), (LEN1) * sizeof(PTRTYPE2) ); \
  |  | 1174|     80|                if ( PTR1 ) \
  |  |  ------------------
  |  |  |  Branch (1174:22): [True: 0, False: 80]
  |  |  ------------------
  |  | 1175|     80|                    inchi_free(PTR1);  \
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1176|     80|                if ( PTR2 ) \
  |  |  ------------------
  |  |  |  Branch (1176:22): [True: 0, False: 80]
  |  |  ------------------
  |  | 1177|     80|                    inchi_free(PTR2);  \
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1178|     80|                (PTR1) = newPTR1; \
  |  | 1179|     80|                (PTR2) = newPTR2; \
  |  | 1180|     80|                (LEN1) = (LEN2);  \
  |  | 1181|     80|                (ERR)  = 0; \
  |  | 1182|     80|            } else {        \
  |  | 1183|      0|                (ERR)  = 1; \
  |  | 1184|      0|            }               \
  |  | 1185|     80|        } else { (ERR) = 0; } \
  |  | 1186|     80|    } while(0)
  |  |  ------------------
  |  |  |  Branch (1186:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1254|     80|        }
 1255|     80|    if (num_components[INCHI_REC])
  ------------------
  |  |  576|     80|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (1255:9): [True: 0, False: 80]
  ------------------
 1256|      0|    {
 1257|      0|        MYREALLOC2( PINChI2, PINChI_Aux2, pINChI[INCHI_REC], pINChI_Aux[INCHI_REC], num_components[INCHI_REC], num_components[INCHI_REC], k2 );
  ------------------
  |  | 1165|      0|    do { \
  |  | 1166|      0|        if( (LEN1) <= (LEN2) ) {\
  |  |  ------------------
  |  |  |  Branch (1166:13): [True: 0, False: 0]
  |  |  ------------------
  |  | 1167|      0|            PTRTYPE1 * newPTR1 = (PTRTYPE1 *)inchi_calloc( (LEN2)+1, sizeof(PTRTYPE1) );\
  |  |  ------------------
  |  |  |  | 1133|      0|#define inchi_calloc   calloc
  |  |  ------------------
  |  | 1168|      0|            PTRTYPE2 * newPTR2 = (PTRTYPE2 *)inchi_calloc( (LEN2)+1, sizeof(PTRTYPE2) );\
  |  |  ------------------
  |  |  |  | 1133|      0|#define inchi_calloc   calloc
  |  |  ------------------
  |  | 1169|      0|            if ( newPTR1 && newPTR2 ) { \
  |  |  ------------------
  |  |  |  Branch (1169:18): [True: 0, False: 0]
  |  |  |  Branch (1169:29): [True: 0, False: 0]
  |  |  ------------------
  |  | 1170|      0|                if ( (PTR1) && (LEN1) > 0 ) \
  |  |  ------------------
  |  |  |  Branch (1170:22): [True: 0, False: 0]
  |  |  |  Branch (1170:32): [True: 0, False: 0]
  |  |  ------------------
  |  | 1171|      0|                    (memcpy) ( newPTR1, (PTR1), (LEN1) * sizeof(PTRTYPE1) ); \
  |  | 1172|      0|                if ( (PTR2) && (LEN1) > 0 ) \
  |  |  ------------------
  |  |  |  Branch (1172:22): [True: 0, False: 0]
  |  |  |  Branch (1172:32): [True: 0, False: 0]
  |  |  ------------------
  |  | 1173|      0|                    (memcpy) ( newPTR2, (PTR2), (LEN1) * sizeof(PTRTYPE2) ); \
  |  | 1174|      0|                if ( PTR1 ) \
  |  |  ------------------
  |  |  |  Branch (1174:22): [True: 0, False: 0]
  |  |  ------------------
  |  | 1175|      0|                    inchi_free(PTR1);  \
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1176|      0|                if ( PTR2 ) \
  |  |  ------------------
  |  |  |  Branch (1176:22): [True: 0, False: 0]
  |  |  ------------------
  |  | 1177|      0|                    inchi_free(PTR2);  \
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1178|      0|                (PTR1) = newPTR1; \
  |  | 1179|      0|                (PTR2) = newPTR2; \
  |  | 1180|      0|                (LEN1) = (LEN2);  \
  |  | 1181|      0|                (ERR)  = 0; \
  |  | 1182|      0|            } else {        \
  |  | 1183|      0|                (ERR)  = 1; \
  |  | 1184|      0|            }               \
  |  | 1185|      0|        } else { (ERR) = 0; } \
  |  | 1186|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (1186:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1258|      0|    }
 1259|       |
 1260|       |
 1261|       |    INCHI_HEAPCHK
 1262|       |
 1263|     80|        if (k1 || k2 /*|| !pStr*/)
  ------------------
  |  Branch (1263:13): [True: 0, False: 80]
  |  Branch (1263:19): [True: 0, False: 80]
  ------------------
 1264|      0|        {
 1265|      0|            ret2 = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 1266|      0|            goto exit_error;
 1267|      0|        }
 1268|       |
 1269|     80|    if (num_components[INCHI_REC] &&
  ------------------
  |  |  576|     80|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (1269:9): [True: 0, False: 80]
  ------------------
 1270|     80|        ( ip->bTautFlags & TG_FLAG_RECONNECT_COORD ) &&
  ------------------
  |  |  935|      0|#define TG_FLAG_RECONNECT_COORD          0x00000100   /* reconnect disconnected "coord. centers" */
  ------------------
  |  Branch (1270:9): [True: 0, False: 0]
  ------------------
 1271|     80|         ( ip->bTautFlags & TG_FLAG_DISCONNECT_COORD ))
  ------------------
  |  |  934|      0|#define TG_FLAG_DISCONNECT_COORD         0x00000080   /* find "coord. centers" and disconnect them */
  ------------------
  |  Branch (1271:10): [True: 0, False: 0]
  ------------------
 1272|      0|    {
 1273|      0|        sd->bTautFlagsDone[0] |= TG_FLAG_DISCONNECT_COORD_DONE;
  ------------------
  |  |  972|      0|#define TG_FLAG_DISCONNECT_COORD_DONE    0x00000100   /* found and disconnected "coord. centers" */
  ------------------
 1274|      0|        bHasSomeReconnected = 1;
 1275|      0|    }
 1276|       |
 1277|    240|    for (iINChI = 0; iINChI < INCHI_NUM; iINChI++)
  ------------------
  |  |  574|    240|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1277:22): [True: 160, False: 80]
  ------------------
 1278|    160|    {
 1279|    480|        for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  578|    480|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1279:21): [True: 320, False: 160]
  ------------------
 1280|    320|        {
 1281|    320|            if (bReqNonTaut || j != TAUT_NON && OneInput->pInpInChI[iINChI][j])
  ------------------
  |  |  579|    640|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1281:17): [True: 0, False: 320]
  |  Branch (1281:32): [True: 160, False: 160]
  |  Branch (1281:49): [True: 80, False: 80]
  ------------------
 1282|     80|            {
 1283|  1.29k|                for (k = 0; k < num_components[iINChI]; k++)
  ------------------
  |  Branch (1283:29): [True: 1.21k, False: 80]
  ------------------
 1284|  1.21k|                {
 1285|       |                    /* allocate InChI & AuxInfo */
 1286|  1.21k|                    if (!( pINChI[iINChI][k][j] = (INChI *) inchi_calloc( 1, sizeof( INChI ) ) ))
  ------------------
  |  | 1133|  1.21k|#define inchi_calloc   calloc
  ------------------
  |  Branch (1286:25): [True: 0, False: 1.21k]
  ------------------
 1287|      0|                    {
 1288|      0|                        ret2 = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 1289|      0|                        goto exit_error;
 1290|      0|                    }
 1291|  1.21k|                    if (!( pINChI_Aux[iINChI][k][j] = (INChI_Aux *) inchi_calloc( 1, sizeof( INChI_Aux ) ) ))
  ------------------
  |  | 1133|  1.21k|#define inchi_calloc   calloc
  ------------------
  |  Branch (1291:25): [True: 0, False: 1.21k]
  ------------------
 1292|      0|                    {
 1293|      0|                        ret2 = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 1294|      0|                        goto exit_error;
 1295|      0|                    }
 1296|       |                    /* copy InChI & AuxInfo */
 1297|  1.21k|                    if (k < OneInput->nNumComponents[iINChI][j])
  ------------------
  |  Branch (1297:25): [True: 1.21k, False: 0]
  ------------------
 1298|  1.21k|                    {
 1299|       |
 1300|       |                        /* copy InChI */
 1301|  1.21k|                        *pINChI[iINChI][k][j] = OneInput->pInpInChI[iINChI][j][k];
 1302|  1.21k|                        memset( &OneInput->pInpInChI[iINChI][j][k], 0, sizeof( OneInput->pInpInChI[iINChI][j][k] ) );
 1303|  1.21k|                        INCHI_HEAPCHK
 1304|       |                            /* take care of protons in AuxInfo */
 1305|       |
 1306|  1.21k|                            if (nModeProtonIsoExchgH[iINChI] == MODE_PIXH_ADD_TO_EACH && j == TAUT_YES)
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1306:33): [True: 0, False: 1.21k]
  |  Branch (1306:90): [True: 0, False: 0]
  ------------------
 1307|      0|                            {
 1308|      0|                                pINChI_Aux[iINChI][k][j]->nNumRemovedProtons =
 1309|      0|                                    OneInput->nNumProtons[iINChI][j].pNumProtons[k].nNumRemovedProtons;
 1310|      0|                                for (k1 = 0; k1 < NUM_H_ISOTOPES; k1++)
  ------------------
  |  |  100|      0|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (1310:46): [True: 0, False: 0]
  ------------------
 1311|      0|                                {
 1312|      0|                                    pINChI_Aux[iINChI][k][j]->nNumRemovedIsotopicH[k1] =
 1313|      0|                                        OneInput->nNumProtons[iINChI][j].pNumProtons[k].nNumRemovedIsotopicH[k1];
 1314|      0|                                }
 1315|      0|                                INCHI_HEAPCHK
 1316|      0|                            }
 1317|  1.21k|                            else if (!k && nModeProtonIsoExchgH[iINChI] == MODE_PIXH_ADD_TO_FIRST ||
  ------------------
  |  Branch (1317:38): [True: 80, False: 1.13k]
  |  Branch (1317:44): [True: 80, False: 0]
  ------------------
 1318|  1.21k|                                      k + 1 == OneInput->nNumComponents[iINChI][j] &&
  ------------------
  |  Branch (1318:39): [True: 2, False: 1.13k]
  ------------------
 1319|  1.13k|                                      nModeProtonIsoExchgH[iINChI] == MODE_PIXH_ADD_A_PIXH_COMPONENT)
  ------------------
  |  Branch (1319:39): [True: 0, False: 2]
  ------------------
 1320|     80|                            {
 1321|       |                                /* add protons and exchangeable isotopic H to the first component's AuxInfo */
 1322|     80|                                pINChI_Aux[iINChI][k][j]->nNumRemovedProtons = OneInput->nNumProtons[iINChI][j].nNumRemovedProtons;
 1323|    320|                                for (k1 = 0; k1 < NUM_H_ISOTOPES; k1++)
  ------------------
  |  |  100|    320|#define NUM_H_ISOTOPES            3 /* number of hydrogen isotopes: protium, D, T   */
  ------------------
  |  Branch (1323:46): [True: 240, False: 80]
  ------------------
 1324|    240|                                {
 1325|    240|                                    pINChI_Aux[iINChI][k][j]->nNumRemovedIsotopicH[k1] =
 1326|    240|                                        OneInput->nNumProtons[iINChI][j].nNumRemovedIsotopicH[k1];
 1327|    240|                                }
 1328|     80|                                INCHI_HEAPCHK
 1329|     80|                            }
 1330|  1.13k|                            else
 1331|  1.13k|                            {
 1332|  1.13k|                                pINChI_Aux[iINChI][k][j]->bDeleted = pINChI[iINChI][k][j]->bDeleted;
 1333|  1.13k|                            }
 1334|       |
 1335|  1.21k|                        if (j == TAUT_YES && pINChI[iINChI][k][j] && pINChI[iINChI][k][j]->nNumberOfAtoms &&
  ------------------
  |  |  580|  2.42k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1335:29): [True: 1.21k, False: 0]
  |  Branch (1335:46): [True: 1.21k, False: 0]
  |  Branch (1335:70): [True: 1.21k, False: 0]
  ------------------
 1336|  1.21k|                             !pINChI[iINChI][k][j]->nNum_H_fixed)
  ------------------
  |  Branch (1336:30): [True: 1.21k, False: 0]
  ------------------
 1337|  1.21k|                        {
 1338|       |                            /* serializer crashes if it is not allocated */
 1339|  1.21k|                            pINChI[iINChI][k][j]->nNum_H_fixed = (S_CHAR *) inchi_calloc( pINChI[iINChI][k][j]->nNumberOfAtoms + 1, sizeof( pINChI[0][0][0]->nNum_H_fixed[0] ) );
  ------------------
  |  | 1133|  1.21k|#define inchi_calloc   calloc
  ------------------
 1340|  1.21k|                        }
 1341|       |
 1342|  1.21k|                        if (j == TAUT_YES && k < OneInput->nNumComponents[iINChI][TAUT_NON] &&
  ------------------
  |  |  580|  2.42k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                                      if (j == TAUT_YES && k < OneInput->nNumComponents[iINChI][TAUT_NON] &&
  ------------------
  |  |  579|  1.21k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1342:29): [True: 1.21k, False: 0]
  |  Branch (1342:46): [True: 0, False: 1.21k]
  ------------------
 1343|  1.21k|                             pINChI[iINChI][k][j] && pINChI[iINChI][k][j]->nNumberOfAtoms &&
  ------------------
  |  Branch (1343:30): [True: 0, False: 0]
  |  Branch (1343:54): [True: 0, False: 0]
  ------------------
 1344|  1.21k|                             pINChI[iINChI][k][TAUT_NON] && pINChI[iINChI][k][TAUT_NON]->nNumberOfAtoms &&
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                                           pINChI[iINChI][k][TAUT_NON] && pINChI[iINChI][k][TAUT_NON]->nNumberOfAtoms &&
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1344:30): [True: 0, False: 0]
  |  Branch (1344:61): [True: 0, False: 0]
  ------------------
 1345|  1.21k|                             !CompareReversedINChI( pINChI[iINChI][k][j], pINChI[iINChI][k][TAUT_NON], NULL, NULL ))
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1345:30): [True: 0, False: 0]
  ------------------
 1346|      0|                        {
 1347|      0|                            pINChI[iINChI][k][TAUT_NON]->nNumberOfAtoms = 0; /* eliminate non-taut equal to taut */
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 1348|      0|                        }
 1349|  1.21k|                    }
 1350|      0|                    else
 1351|      0|                    {
 1352|       |                        /* extra component, usually it is a Mobile H component */
 1353|       |                        /* corresponding to a free proton component in Fixed H */
 1354|      0|                        pINChI[iINChI][k][j]->bDeleted = 1;
 1355|      0|                        pINChI_Aux[iINChI][k][j]->bDeleted = 1;
 1356|      0|                    }
 1357|  1.21k|                } /* k */
 1358|     80|            } /* if ( bReqNonTaut || j != TAUT_NON && OneInput->pInpInChI[iINChI][j] )  */
 1359|       |
 1360|    320|            if (OneInput->pInpInChI[iINChI][j])
  ------------------
  |  Branch (1360:17): [True: 80, False: 240]
  ------------------
 1361|     80|            {
 1362|     80|                INCHI_HEAPCHK
 1363|     80|                    inchi_free( OneInput->pInpInChI[iINChI][j] );
  ------------------
  |  | 1136|     80|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 80, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1364|     80|                OneInput->pInpInChI[iINChI][j] = NULL;
 1365|     80|            }
 1366|    320|        } /* j */
 1367|    160|    } /* iINChI */
 1368|       |
 1369|     80|    if (bReqSplitOutputInChI)
  ------------------
  |  Branch (1369:9): [True: 0, False: 80]
  ------------------
 1370|      0|    {
 1371|      0|        if (bHasSomeReconnected)
  ------------------
  |  Branch (1371:13): [True: 0, False: 0]
  ------------------
 1372|      0|        {
 1373|      0|            iINChI1 = INCHI_REC; /* only reconnected */
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1374|      0|            iINChI2 = INCHI_NUM;
  ------------------
  |  |  574|      0|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
 1375|      0|            sd->num_components[INCHI_BAS] = sd->num_components[INCHI_REC];
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          sd->num_components[INCHI_BAS] = sd->num_components[INCHI_REC];
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1376|      0|        }
 1377|      0|        else
 1378|      0|        {
 1379|      0|            iINChI1 = 0;         /* only disconnected */
 1380|      0|            iINChI2 = iINChI1 + 1;
 1381|      0|        }
 1382|      0|        sd->num_components[INCHI_REC] = 0;  /* treat reconnected as connected */
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1383|      0|        nNumOutputComponents = sd->num_components[INCHI_BAS];
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1384|      0|    }
 1385|     80|    else
 1386|     80|    {
 1387|     80|        iINChI1 = 0;
 1388|     80|        iINChI2 = INCHI_NUM;
  ------------------
  |  |  574|     80|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
 1389|     80|        nNumOutputComponents = 1;
 1390|     80|    }
 1391|       |
 1392|    160|    for (k1 = 0, k2 = ( bReqSplitOutputInChI ? k1 + 1 : nNumOutputComponents ); k1 < k2 && k1 < nNumOutputComponents; k1 = k2, k2++)
  ------------------
  |  Branch (1392:25): [True: 0, False: 80]
  |  Branch (1392:81): [True: 160, False: 0]
  |  Branch (1392:92): [True: 80, False: 80]
  ------------------
 1393|     80|    {
 1394|       |
 1395|     80|        if (bReqSplitOutputInChI)
  ------------------
  |  Branch (1395:13): [True: 0, False: 80]
  ------------------
 1396|      0|        {
 1397|      0|            sd->num_components[INCHI_BAS] = 1;
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1398|      0|            sd->num_components[INCHI_REC] = 0;
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1399|       |            /* additional data */
 1400|      0|            sd->num_non_taut[INCHI_BAS] =
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1401|      0|                sd->num_taut[INCHI_BAS] =
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1402|      0|                sd->num_non_taut[INCHI_REC] =
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1403|      0|                sd->num_taut[INCHI_REC] = 0;
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1404|      0|            iINChI = iINChI1;
 1405|      0|            for (j = 0; j < TAUT_NUM && sd->num_components[iINChI]; j++)
  ------------------
  |  |  578|      0|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1405:25): [True: 0, False: 0]
  |  Branch (1405:41): [True: 0, False: 0]
  ------------------
 1406|      0|            {
 1407|      0|                for (k = k1; k < k2; k++)
  ------------------
  |  Branch (1407:30): [True: 0, False: 0]
  ------------------
 1408|      0|                {
 1409|       |                    /*  find where the current processed structure is located */
 1410|      0|                    int cur_is_in_non_taut = ( pINChI[iINChI][k][TAUT_NON] && pINChI[iINChI][k][TAUT_NON]->nNumberOfAtoms > 0 );
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                                  int cur_is_in_non_taut = ( pINChI[iINChI][k][TAUT_NON] && pINChI[iINChI][k][TAUT_NON]->nNumberOfAtoms > 0 );
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1410:48): [True: 0, False: 0]
  |  Branch (1410:79): [True: 0, False: 0]
  ------------------
 1411|      0|                    int cur_is_in_taut = ( pINChI[iINChI][k][TAUT_YES] && pINChI[iINChI][k][TAUT_YES]->nNumberOfAtoms > 0 );
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                                  int cur_is_in_taut = ( pINChI[iINChI][k][TAUT_YES] && pINChI[iINChI][k][TAUT_YES]->nNumberOfAtoms > 0 );
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1411:44): [True: 0, False: 0]
  |  Branch (1411:75): [True: 0, False: 0]
  ------------------
 1412|      0|                    int cur_is_non_taut = cur_is_in_non_taut && 0 == pINChI[iINChI][k][TAUT_NON]->lenTautomer ||
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1412:43): [True: 0, False: 0]
  |  Branch (1412:65): [True: 0, False: 0]
  ------------------
 1413|      0|                        cur_is_in_taut && 0 == pINChI[iINChI][k][TAUT_YES]->lenTautomer;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1413:25): [True: 0, False: 0]
  |  Branch (1413:43): [True: 0, False: 0]
  ------------------
 1414|      0|                    int cur_is_taut = cur_is_in_taut && 0 < pINChI[iINChI][k][TAUT_YES]->lenTautomer;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1414:39): [True: 0, False: 0]
  |  Branch (1414:57): [True: 0, False: 0]
  ------------------
 1415|      0|                    if (cur_is_non_taut + cur_is_taut)
  ------------------
  |  Branch (1415:25): [True: 0, False: 0]
  ------------------
 1416|      0|                    {
 1417|       |                        /*  count tautomeric and non-tautomeric components of the structures */
 1418|       |                        /*
 1419|       |                        int j1 = cur_is_in_non_taut? TAUT_NON:TAUT_YES;
 1420|       |                        int j2 = cur_is_in_taut?     TAUT_YES:TAUT_NON;
 1421|       |                        */
 1422|      0|                        sd->num_non_taut[INCHI_BAS] += cur_is_non_taut;
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1423|      0|                        sd->num_taut[INCHI_BAS] += cur_is_taut;
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1424|      0|                    }
 1425|      0|                }
 1426|      0|            }
 1427|      0|            INCHI_HEAPCHK
 1428|      0|        }
 1429|     80|        else
 1430|     80|        {
 1431|     80|            sd->num_components[INCHI_BAS] = inchi_max( OneInput->nNumComponents[INCHI_BAS][TAUT_YES],
  ------------------
  |  |  575|     80|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          sd->num_components[INCHI_BAS] = inchi_max( OneInput->nNumComponents[INCHI_BAS][TAUT_YES],
  ------------------
  |  |  166|     80|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 80, False: 0]
  |  |  ------------------
  ------------------
 1432|     80|                                                       OneInput->nNumComponents[INCHI_BAS][TAUT_NON] );
 1433|     80|            sd->num_components[INCHI_REC] = inchi_max( OneInput->nNumComponents[INCHI_REC][TAUT_YES],
  ------------------
  |  |  576|     80|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                          sd->num_components[INCHI_REC] = inchi_max( OneInput->nNumComponents[INCHI_REC][TAUT_YES],
  ------------------
  |  |  166|     80|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 80]
  |  |  ------------------
  ------------------
 1434|     80|                                                       OneInput->nNumComponents[INCHI_REC][TAUT_NON] );
 1435|       |            /* additional data needed for SortAndPrintINChI() */
 1436|    240|            for (iINChI = 0; iINChI < INCHI_NUM; iINChI++)
  ------------------
  |  |  574|    240|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1436:30): [True: 160, False: 80]
  ------------------
 1437|    160|            {
 1438|    160|                sd->num_non_taut[iINChI] =
 1439|    160|                    sd->num_taut[iINChI] = 0;
 1440|    320|                for (j = 0; j < TAUT_NUM && sd->num_components[iINChI]; j++)
  ------------------
  |  |  578|    640|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1440:29): [True: 240, False: 80]
  |  Branch (1440:45): [True: 160, False: 80]
  ------------------
 1441|    160|                {
 1442|    320|                    for (k = k1; k < k2; k++)
  ------------------
  |  Branch (1442:34): [True: 160, False: 160]
  ------------------
 1443|    160|                    {
 1444|       |                        /*  find where the current processed structure is located */
 1445|    160|                        int cur_is_in_non_taut = ( pINChI[iINChI][k][TAUT_NON] && pINChI[iINChI][k][TAUT_NON]->nNumberOfAtoms > 0 );
  ------------------
  |  |  579|    160|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                                      int cur_is_in_non_taut = ( pINChI[iINChI][k][TAUT_NON] && pINChI[iINChI][k][TAUT_NON]->nNumberOfAtoms > 0 );
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1445:52): [True: 0, False: 160]
  |  Branch (1445:83): [True: 0, False: 0]
  ------------------
 1446|    160|                        int cur_is_in_taut = ( pINChI[iINChI][k][TAUT_YES] && pINChI[iINChI][k][TAUT_YES]->nNumberOfAtoms > 0 );
  ------------------
  |  |  580|    160|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                                      int cur_is_in_taut = ( pINChI[iINChI][k][TAUT_YES] && pINChI[iINChI][k][TAUT_YES]->nNumberOfAtoms > 0 );
  ------------------
  |  |  580|    160|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1446:48): [True: 160, False: 0]
  |  Branch (1446:79): [True: 160, False: 0]
  ------------------
 1447|    160|                        int cur_is_non_taut = cur_is_in_non_taut && 0 == pINChI[iINChI][k][TAUT_NON]->lenTautomer ||
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1447:47): [True: 0, False: 160]
  |  Branch (1447:69): [True: 0, False: 0]
  ------------------
 1448|    160|                            cur_is_in_taut && 0 == pINChI[iINChI][k][TAUT_YES]->lenTautomer;
  ------------------
  |  |  580|    160|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1448:29): [True: 160, False: 0]
  |  Branch (1448:47): [True: 82, False: 78]
  ------------------
 1449|    160|                        int cur_is_taut = cur_is_in_taut && 0 < pINChI[iINChI][k][TAUT_YES]->lenTautomer;
  ------------------
  |  |  580|    160|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1449:43): [True: 160, False: 0]
  |  Branch (1449:61): [True: 78, False: 82]
  ------------------
 1450|    160|                        if (cur_is_non_taut + cur_is_taut)
  ------------------
  |  Branch (1450:29): [True: 160, False: 0]
  ------------------
 1451|    160|                        {
 1452|       |                            /*  count tautomeric and non-tautomeric components of the structures */
 1453|       |                            /*
 1454|       |                            int j1 = cur_is_in_non_taut? TAUT_NON:TAUT_YES;
 1455|       |                            int j2 = cur_is_in_taut?     TAUT_YES:TAUT_NON;
 1456|       |                            */
 1457|    160|                            sd->num_non_taut[iINChI] += cur_is_non_taut;
 1458|    160|                            sd->num_taut[iINChI] += cur_is_taut;
 1459|    160|                        }
 1460|    160|                    }
 1461|    160|                }
 1462|    160|            }
 1463|     80|            INCHI_HEAPCHK
 1464|     80|        }
 1465|     80|        if (bReqSplitOutputInChI)
  ------------------
  |  Branch (1465:13): [True: 0, False: 80]
  ------------------
 1466|      0|        {
 1467|       |            /* output components one by one (for splitting input InChI into components) */
 1468|      0|            PINChI2 *pInChI_2[INCHI_NUM];
 1469|      0|            PINChI_Aux2 *pInChI_Aux_2[INCHI_NUM];
 1470|      0|            INChI *pInChI_1[1][2];
 1471|      0|            INChI_Aux *pInChI_Aux_1[1][2];
 1472|      0|            memset( pInChI_2, 0, sizeof( pInChI_2 ) );
 1473|      0|            memset( pInChI_Aux_2, 0, sizeof( pInChI_Aux_2 ) );
 1474|      0|            for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  578|      0|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1474:25): [True: 0, False: 0]
  ------------------
 1475|      0|            {
 1476|      0|                pInChI_1[0][j] = pINChI[iINChI1][k1][j];
 1477|      0|                pInChI_Aux_1[0][j] = pINChI_Aux[iINChI1][k1][j];
 1478|      0|            }
 1479|      0|            pInChI_2[INCHI_BAS] = pInChI_1;
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1480|      0|            pInChI_Aux_2[INCHI_BAS] = pInChI_Aux_1;
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1481|       |            /* make sure purely reconnected InChI is marked as ReChI, not InChI */
 1482|      0|            if (bHasSomeReconnected &&
  ------------------
  |  Branch (1482:17): [True: 0, False: 0]
  ------------------
 1483|      0|                ( bInChIHasReconnectedMetal( pInChI_1[0][TAUT_YES] ) ||
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1483:19): [True: 0, False: 0]
  ------------------
 1484|      0|                  bInChIHasReconnectedMetal( pInChI_1[0][TAUT_NON] ) ))
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1484:19): [True: 0, False: 0]
  ------------------
 1485|      0|            {
 1486|      0|                bSortPrintINChIFlags = FLAG_SORT_PRINT_ReChI_PREFIX;
  ------------------
  |  |  335|      0|#define FLAG_SORT_PRINT_ReChI_PREFIX  64 /* Output ReChI instead of InChI */
  ------------------
 1487|      0|            }
 1488|      0|            else
 1489|      0|            {
 1490|      0|                bSortPrintINChIFlags = 0;
 1491|      0|            }
 1492|      0|            INCHI_HEAPCHK
 1493|      0|                nRet1 = SortAndPrintINChI( pCG, pOut, strbuf, pLog, ip,
 1494|      0|                                           NULL /*orig_inp_data*/,
 1495|      0|                                           NULL  /*prep_inp_data*/,
 1496|      0|                                           NULL /*composite_norm_data*/,
 1497|      0|                                           NULL /*pOrigStruct*/,
 1498|      0|                                           sd->num_components, sd->num_non_taut,
 1499|      0|                                           sd->num_taut, sd->bTautFlags,
 1500|      0|                                           sd->bTautFlagsDone, pncFlags, num_inp,
 1501|      0|                                           pInChI_2, pInChI_Aux_2,
 1502|      0|                                           &bSortPrintINChIFlags, save_opt_bits );
 1503|      0|            INCHI_HEAPCHK
 1504|      0|        }
 1505|     80|        else
 1506|     80|        {
 1507|     80|            INCHI_HEAPCHK
 1508|       |
 1509|     80|                bSortPrintINChIFlags = 0;
 1510|     80|            nRet1 = SortAndPrintINChI( pCG, pOut, strbuf, pLog, ip,
 1511|     80|                                       NULL /*orig_inp_data*/, NULL  /*prep_inp_data*/,
 1512|     80|                                       NULL /*composite_norm_data*/, NULL /*pOrigStruct*/,
 1513|     80|                                       sd->num_components, sd->num_non_taut, sd->num_taut,
 1514|     80|                                       sd->bTautFlags, sd->bTautFlagsDone, pncFlags, num_inp,
 1515|     80|                                       pINChI, pINChI_Aux, &bSortPrintINChIFlags,
 1516|     80|                                       save_opt_bits );
 1517|     80|            INCHI_HEAPCHK
 1518|     80|        }
 1519|     80|        if (nRet1 == _IS_FATAL || nRet1 == _IS_ERROR)
  ------------------
  |  |   41|    160|#define _IS_FATAL   3
  ------------------
                      if (nRet1 == _IS_FATAL || nRet1 == _IS_ERROR)
  ------------------
  |  |   40|     80|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (1519:13): [True: 0, False: 80]
  |  Branch (1519:35): [True: 0, False: 80]
  ------------------
 1520|      0|        {
 1521|      0|            break;
 1522|      0|        }
 1523|     80|    }
 1524|       |
 1525|     80|    INCHI_HEAPCHK
 1526|     80|        FreeAllINChIArrays( pINChI, pINChI_Aux, num_components );
 1527|     80|    INCHI_HEAPCHK
 1528|       |
 1529|    240|        for (iINChI = 0; iINChI < INCHI_NUM; iINChI++)
  ------------------
  |  |  574|    240|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1529:26): [True: 160, False: 80]
  ------------------
 1530|    160|        {
 1531|    480|            for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  578|    480|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1531:25): [True: 320, False: 160]
  ------------------
 1532|    320|            {
 1533|    320|                if (OneInput->nNumProtons[iINChI][j].pNumProtons)
  ------------------
  |  Branch (1533:21): [True: 0, False: 320]
  ------------------
 1534|      0|                {
 1535|      0|                    inchi_free( OneInput->nNumProtons[iINChI][j].pNumProtons );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1536|      0|                    OneInput->nNumProtons[iINChI][j].pNumProtons = NULL;
 1537|      0|                }
 1538|    320|            }
 1539|    160|        }
 1540|       |
 1541|       |    INCHI_HEAPCHK
 1542|       |
 1543|     80|        if (nRet1 == _IS_FATAL || nRet1 == _IS_ERROR)
  ------------------
  |  |   41|    160|#define _IS_FATAL   3
  ------------------
                      if (nRet1 == _IS_FATAL || nRet1 == _IS_ERROR)
  ------------------
  |  |   40|     80|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (1543:13): [True: 0, False: 80]
  |  Branch (1543:35): [True: 0, False: 80]
  ------------------
 1544|      0|        {
 1545|      0|            ret2 = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1546|      0|        }
 1547|       |
 1548|     80|exit_error:
 1549|       |
 1550|     80|    inchi_strbuf_close( strbuf );
 1551|       |
 1552|     80|    return ret2;
 1553|     80|}

QueueCreate:
   60|   110k|{
   61|   110k|    QUEUE     *q = NULL;
   62|   110k|    QINT_TYPE *Val = NULL;
  ------------------
  |  |   44|   110k|#define QINT_TYPE qInt
  ------------------
   63|   110k|    if (nTotLength < 1 || nSize != ( int )sizeof( QINT_TYPE ) ||
  ------------------
  |  Branch (63:9): [True: 0, False: 110k]
  |  Branch (63:27): [True: 0, False: 110k]
  ------------------
   64|   110k|         !( q = (QUEUE     *) inchi_calloc( 1, sizeof( QUEUE ) ) ) ||
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
  |  Branch (64:10): [True: 0, False: 110k]
  ------------------
   65|   110k|         !( Val = (QINT_TYPE *) inchi_calloc( nTotLength, nSize ) ))
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
  |  Branch (65:10): [True: 0, False: 110k]
  ------------------
   66|      0|    {
   67|      0|        if (q) inchi_free( q );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (67:13): [True: 0, False: 0]
  ------------------
   68|      0|        return NULL;
   69|      0|    }
   70|   110k|    q->Val = Val;
   71|       |    /* q->nSize      = nSize; */
   72|   110k|    q->nTotLength = nTotLength;
   73|       |
   74|   110k|    return q;
   75|   110k|}
QueueAdd:
   80|     36|{
   81|     36|    if (q && Val && q->nLength < q->nTotLength)
  ------------------
  |  Branch (81:9): [True: 36, False: 0]
  |  Branch (81:14): [True: 36, False: 0]
  |  Branch (81:21): [True: 36, False: 0]
  ------------------
   82|     36|    {
   83|     36|        q->Val[( q->nFirst + q->nLength ) % q->nTotLength] = *Val;
   84|     36|        q->nLength++;
   85|     36|        return q->nLength;
   86|     36|    }
   87|       |
   88|      0|    return -1;
   89|     36|}
QueueGet:
   94|     36|{
   95|     36|    if (q && Val && q->nLength > 0)
  ------------------
  |  Branch (95:9): [True: 36, False: 0]
  |  Branch (95:14): [True: 36, False: 0]
  |  Branch (95:21): [True: 36, False: 0]
  ------------------
   96|     36|    {
   97|     36|        *Val = q->Val[q->nFirst];
   98|       |        /* new: do not allow to overwrite the retrieved value */
   99|     36|        q->nFirst = ( q->nFirst == q->nTotLength - 1 ) ? 0 : q->nFirst + 1;
  ------------------
  |  Branch (99:21): [True: 0, False: 36]
  ------------------
  100|     36|        q->nLength--;
  101|       |        /* -- old --
  102|       |        if ( -- q->nLength ) {
  103|       |            q->nFirst = (q->nFirst == q->nTotLength - 1)? 0 : q->nFirst + 1;
  104|       |        }
  105|       |        */
  106|     36|        return q->nLength;
  107|     36|    }
  108|       |
  109|      0|    return -1;
  110|     36|}
QueueGetAny:
  115|     36|{
  116|     36|    if (0 <= ord && ord < q->nTotLength)
  ------------------
  |  Branch (116:9): [True: 36, False: 0]
  |  Branch (116:21): [True: 36, False: 0]
  ------------------
  117|     36|    {
  118|     36|        *Val = q->Val[ord];
  119|     36|        return  1; /*  success */
  120|     36|    }
  121|      0|    else
  122|      0|    {
  123|      0|        return -1; /*  error */
  124|      0|    }
  125|     36|}
QueueDelete:
  196|   110k|{
  197|   110k|    if (q)
  ------------------
  |  Branch (197:9): [True: 110k, False: 0]
  ------------------
  198|   110k|    {
  199|   110k|        if (q->Val) inchi_free( q->Val );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (199:13): [True: 110k, False: 0]
  ------------------
  200|   110k|        inchi_free( q );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  201|   110k|    }
  202|       |
  203|   110k|    return NULL;
  204|   110k|}
QueueReinit:
  209|      9|{
  210|      9|    if (q)
  ------------------
  |  Branch (210:9): [True: 9, False: 0]
  ------------------
  211|      9|    {
  212|      9|        q->nFirst = 0;
  213|      9|        q->nLength = 0;
  214|       |        /* memset( q->Val, 0, q->nTotLength*sizeof(q->Val[0])); */ /*  for debug only */
  215|      9|        return q->nTotLength;
  216|      9|    }
  217|       |
  218|      0|    return -1;
  219|      9|}
QueueLength:
  224|     33|{
  225|     33|    if (q)
  ------------------
  |  Branch (225:9): [True: 33, False: 0]
  ------------------
  226|     33|    {
  227|     33|        return q->nLength;
  228|     33|    }
  229|      0|    else
  230|      0|    {
  231|      0|        return 0;
  232|      0|    }
  233|     33|}
QueueWrittenLength:
  238|      9|{
  239|      9|    if (q)
  ------------------
  |  Branch (239:9): [True: 9, False: 0]
  ------------------
  240|      9|    {
  241|      9|        int len = q->nFirst + q->nLength;
  242|      9|        return ( len > q->nTotLength ) ? q->nTotLength : len;
  ------------------
  |  Branch (242:16): [True: 0, False: 9]
  ------------------
  243|      9|    }
  244|      0|    else
  245|      0|    {
  246|      0|        return 0;
  247|      0|    }
  248|      9|}
GetMinRingSize:
  259|      9|{
  260|      9|    int qLen, i, j;
  261|      9|    AT_RANK nCurLevel, nRingSize, nMinRingSize = MAX_ATOMS + 1;
  ------------------
  |  |   43|      9|#define MAX_ATOMS  32766
  ------------------
  262|      9|    qInt at_no, next;
  263|      9|    int  iat_no, inext;
  264|       |
  265|     33|    while (qLen = QueueLength( q ))
  ------------------
  |  Branch (265:12): [True: 24, False: 9]
  ------------------
  266|     24|    {
  267|       |        /*  traverse the next level (next outer ring) */
  268|     60|        for (i = 0; i < qLen; i++)
  ------------------
  |  Branch (268:21): [True: 36, False: 24]
  ------------------
  269|     36|        {
  270|     36|            if (0 <= QueueGet( q, &at_no ))
  ------------------
  |  Branch (270:17): [True: 36, False: 0]
  ------------------
  271|     36|            {
  272|     36|                iat_no = (int) at_no;
  273|     36|                nCurLevel = nAtomLevel[iat_no] + 1;
  274|     36|                if (2 * nCurLevel > nMaxRingSize + 4)
  ------------------
  |  Branch (274:21): [True: 0, False: 36]
  ------------------
  275|      0|                {
  276|       |                    /*  2*nCurLevel = nRingSize + 3 + k, k = 0 or 1  */
  277|      0|                    if (nMinRingSize < MAX_ATOMS + 1)
  ------------------
  |  |   43|      0|#define MAX_ATOMS  32766
  ------------------
  |  Branch (277:25): [True: 0, False: 0]
  ------------------
  278|      0|                    {
  279|      0|                        return ( nMinRingSize >= nMaxRingSize ) ? 0 : nMinRingSize;
  ------------------
  |  Branch (279:32): [True: 0, False: 0]
  ------------------
  280|      0|                    }
  281|      0|                    return 0; /*  min. ring size > nMaxRingSize */
  282|      0|                }
  283|     90|                for (j = 0; j < atom[iat_no].valence; j++)
  ------------------
  |  Branch (283:29): [True: 54, False: 36]
  ------------------
  284|     54|                {
  285|     54|                    next = (qInt) atom[iat_no].neighbor[j];
  286|     54|                    inext = (int) next;
  287|     54|                    if (!nAtomLevel[inext])
  ------------------
  |  Branch (287:25): [True: 18, False: 36]
  ------------------
  288|     18|                    {
  289|       |                        /*  the at_no neighbor has not been traversed yet. Add it to the queue */
  290|     18|                        if (0 <= QueueAdd( q, &next ))
  ------------------
  |  Branch (290:29): [True: 18, False: 0]
  ------------------
  291|     18|                        {
  292|     18|                            nAtomLevel[inext] = nCurLevel;
  293|     18|                            cSource[inext] = cSource[iat_no]; /*  keep the path number */
  294|     18|                        }
  295|      0|                        else
  296|      0|                        {
  297|      0|                            return -1; /*  error */
  298|      0|                        }
  299|     18|                    }
  300|     36|                    else
  301|     36|                    {
  302|     36|                        if (nAtomLevel[inext] + 1 >= nCurLevel &&
  ------------------
  |  Branch (302:29): [True: 0, False: 36]
  ------------------
  303|     36|                                cSource[inext] != cSource[iat_no]
  ------------------
  |  Branch (303:33): [True: 0, False: 0]
  ------------------
  304|       |                                /*  && cSource[(int)next] != -1 */
  305|     36|                              )
  306|      0|                        {
  307|       |                            /*  found a ring closure */
  308|       |                            /*  debug */
  309|      0|                            if (cSource[inext] == -1)
  ------------------
  |  Branch (309:33): [True: 0, False: 0]
  ------------------
  310|      0|                            {
  311|      0|                                return -1;  /*  error */
  312|      0|                            }
  313|      0|                            if (( nRingSize = nAtomLevel[inext] + nCurLevel - 2 ) < nMinRingSize)
  ------------------
  |  Branch (313:33): [True: 0, False: 0]
  ------------------
  314|      0|                            {
  315|      0|                                nMinRingSize = nRingSize;
  316|      0|                            }
  317|       |                            /* return (nRingSize >= nMaxRingSize)? 0 : nRingSize; */
  318|      0|                        }
  319|     36|                    }
  320|     54|                }
  321|     36|            }
  322|      0|            else
  323|      0|            {
  324|      0|                return -1; /*  error */
  325|      0|            }
  326|     36|        }
  327|     24|    }
  328|       |
  329|      9|    if (nMinRingSize < MAX_ATOMS + 1)
  ------------------
  |  |   43|      9|#define MAX_ATOMS  32766
  ------------------
  |  Branch (329:9): [True: 0, False: 9]
  ------------------
  330|      0|    {
  331|      0|        return ( nMinRingSize >= nMaxRingSize ) ? 0 : nMinRingSize;
  ------------------
  |  Branch (331:16): [True: 0, False: 0]
  ------------------
  332|      0|    }
  333|       |
  334|      9|    return 0;
  335|      9|}
is_bond_in_Nmax_memb_ring:
  361|      9|{
  362|      9|    int  nMinRingSize = -1, i;
  363|      9|    qInt n;
  364|      9|    int  nTotLen;
  365|       |
  366|      9|    if (nMaxRingSize < 3)
  ------------------
  |  Branch (366:9): [True: 0, False: 9]
  ------------------
  367|      0|    {
  368|      0|        return 0;
  369|      0|    }
  370|       |
  371|      9|    QueueReinit( q );
  372|       |
  373|       |    /*  mark the starting atom */
  374|      9|    nAtomLevel[at_no] = 1;
  375|      9|    cSource[at_no] = -1;
  376|       |    /*  add neighbors */
  377|     27|    for (i = 0; i < atom[at_no].valence; i++)
  ------------------
  |  Branch (377:17): [True: 18, False: 9]
  ------------------
  378|     18|    {
  379|     18|        n = (qInt) atom[at_no].neighbor[i];
  380|     18|        nAtomLevel[(int) n] = 2;
  381|     18|        cSource[(int) n] = 1 + ( i == neigh_ord );
  382|     18|        QueueAdd( q, &n );
  383|     18|    }
  384|       |
  385|      9|    nMinRingSize = GetMinRingSize( atom, q, nAtomLevel, cSource, nMaxRingSize );
  386|       |    /*  cleanup */
  387|      9|    nTotLen = QueueWrittenLength( q );
  388|     45|    for (i = 0; i < nTotLen; i++)
  ------------------
  |  Branch (388:17): [True: 36, False: 9]
  ------------------
  389|     36|    {
  390|     36|        if (0 < QueueGetAny( q, &n, i ))
  ------------------
  |  Branch (390:13): [True: 36, False: 0]
  ------------------
  391|     36|        {
  392|     36|            nAtomLevel[(int) n] = 0;
  393|     36|            cSource[(int) n] = 0;
  394|     36|        }
  395|     36|    }
  396|      9|    nAtomLevel[at_no] = 0;
  397|      9|    cSource[at_no] = 0;
  398|       |
  399|       |    /*
  400|       |    if ( nAtomLevel )
  401|       |        inchi_free ( nAtomLevel );
  402|       |    if ( cSource )
  403|       |        inchi_free ( cSource );
  404|       |    QueueDelete( q );
  405|       |    */
  406|       |
  407|      9|    return nMinRingSize;
  408|      9|}

clear_t_group_info:
  500|  55.4k|{
  501|  55.4k|    if (!ti)
  ------------------
  |  Branch (501:9): [True: 0, False: 55.4k]
  ------------------
  502|      0|    {
  503|      0|        return;
  504|      0|    }
  505|  55.4k|    else
  506|  55.4k|    {
  507|  55.4k|        T_GROUP   *t_group = ti->t_group;
  508|  55.4k|        int       max_num_t_groups = ti->max_num_t_groups;
  509|  55.4k|        AT_NUMB   *tGroupNumber = ti->tGroupNumber;
  510|  55.4k|        int       num_t_groups = ti->num_t_groups;
  511|  55.4k|        AT_NUMB   *nEndpointAtomNumber = ti->nEndpointAtomNumber;
  512|  55.4k|        int       nNumEndpoints = ti->nNumEndpoints;
  513|  55.4k|        AT_NUMB   *nIsotopicEndpointAtomNumber = ti->nIsotopicEndpointAtomNumber;
  514|  55.4k|        int       nNumIsotopicEndpoints = ti->nNumIsotopicEndpoints;
  515|  55.4k|        memset( ti, 0, sizeof( *ti ) );
  516|  55.4k|        if (t_group)
  ------------------
  |  Branch (516:13): [True: 0, False: 55.4k]
  ------------------
  517|      0|        {
  518|      0|            memset( t_group, 0, sizeof( t_group[0] )*max_num_t_groups );
  519|      0|        }
  520|  55.4k|        else
  521|  55.4k|        {
  522|  55.4k|            max_num_t_groups = 0;
  523|  55.4k|        }
  524|  55.4k|        if (tGroupNumber)
  ------------------
  |  Branch (524:13): [True: 0, False: 55.4k]
  ------------------
  525|      0|        {
  526|      0|            memset( tGroupNumber, 0, sizeof( tGroupNumber[0] )*num_t_groups );
  527|      0|        }
  528|  55.4k|        else
  529|  55.4k|        {
  530|  55.4k|            num_t_groups = 0;
  531|  55.4k|        }
  532|  55.4k|        if (nEndpointAtomNumber)
  ------------------
  |  Branch (532:13): [True: 0, False: 55.4k]
  ------------------
  533|      0|        {
  534|      0|            memset( nEndpointAtomNumber, 0, sizeof( nEndpointAtomNumber[0] )*nNumEndpoints );
  535|      0|        }
  536|  55.4k|        else
  537|  55.4k|        {
  538|  55.4k|            nNumEndpoints = 0;
  539|  55.4k|        }
  540|  55.4k|        if (nIsotopicEndpointAtomNumber)
  ------------------
  |  Branch (540:13): [True: 0, False: 55.4k]
  ------------------
  541|      0|        {
  542|      0|            memset( nIsotopicEndpointAtomNumber, 0, sizeof( nIsotopicEndpointAtomNumber[0] )*nNumIsotopicEndpoints );
  543|      0|        }
  544|  55.4k|        else
  545|  55.4k|        {
  546|  55.4k|            nNumIsotopicEndpoints = 0;
  547|  55.4k|        }
  548|       |
  549|  55.4k|        ti->t_group = t_group;
  550|  55.4k|        ti->max_num_t_groups = max_num_t_groups;
  551|  55.4k|        ti->tGroupNumber = tGroupNumber;
  552|  55.4k|        ti->num_t_groups = num_t_groups;
  553|  55.4k|        ti->nEndpointAtomNumber = nEndpointAtomNumber;
  554|  55.4k|        ti->nNumEndpoints = nNumEndpoints;
  555|  55.4k|        ti->nIsotopicEndpointAtomNumber = nIsotopicEndpointAtomNumber;
  556|       |
  557|  55.4k|        ti->nNumIsotopicEndpoints = nNumIsotopicEndpoints;
  558|  55.4k|    }
  559|       |
  560|  55.4k|    return;
  561|  55.4k|}
GetTgroupInfoFromInChI:
  569|  55.4k|{
  570|  55.4k|    int ret, i, j, k, itg, num_atoms, len_tg, bIso, num_t_groups;
  571|  55.4k|    AT_NUMB   *tGroupNumber = NULL;
  572|  55.4k|    AT_NUMB   *tSymmRank = NULL;
  573|  55.4k|    AT_NUMB   *tiSymmRank = NULL;
  574|  55.4k|    AT_NUMB   *tiGroupNumber = NULL;
  575|       |
  576|  55.4k|    ret = 0;
  577|       |
  578|  55.4k|    clear_t_group_info( ti );
  579|  55.4k|    if (pInChI && pInChI->lenTautomer > 1 &&
  ------------------
  |  Branch (579:9): [True: 55.4k, False: 0]
  |  Branch (579:19): [True: 39, False: 55.4k]
  ------------------
  580|  55.4k|         pInChI->nTautomer && pInChI->nTautomer[0] > 0)
  ------------------
  |  Branch (580:10): [True: 39, False: 0]
  |  Branch (580:31): [True: 39, False: 0]
  ------------------
  581|     39|    {
  582|     39|        num_atoms = pInChI->nNumberOfAtoms;
  583|     39|        bIso = pInChI->IsotopicAtom && pInChI->nNumberOfIsotopicAtoms;
  ------------------
  |  Branch (583:16): [True: 0, False: 39]
  |  Branch (583:40): [True: 0, False: 0]
  ------------------
  584|     39|        num_t_groups = pInChI->nTautomer[0];
  585|     39|        len_tg = pInChI->lenTautomer - T_GROUP_HDR_LEN*pInChI->nTautomer[0] - 1; /* number of endpoints */
  ------------------
  |  |  100|     39|#define           T_GROUP_HDR_LEN   (1+T_NUM_NO_ISOTOPIC /*+T_NUM_ISOTOPIC*/) /* LinearCTTautomer */
  |  |  ------------------
  |  |  |  |   97|     39|#define           T_NUM_NO_ISOTOPIC 2
  |  |  ------------------
  ------------------
  586|       |
  587|       |        /* allocation ti->t_group */
  588|     39|        if (ti->max_num_t_groups != num_atoms / 2 + 1 || !ti->t_group)
  ------------------
  |  Branch (588:13): [True: 39, False: 0]
  |  Branch (588:58): [True: 0, False: 0]
  ------------------
  589|     39|        {
  590|     39|            ti->max_num_t_groups = num_atoms / 2 + 1;
  591|     39|            if (ti->t_group)
  ------------------
  |  Branch (591:17): [True: 0, False: 39]
  ------------------
  592|      0|                inchi_free( ti->t_group );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  593|     39|            ti->t_group = (T_GROUP *) inchi_calloc( ti->max_num_t_groups, sizeof( ti->t_group[0] ) );
  ------------------
  |  | 1133|     39|#define inchi_calloc   calloc
  ------------------
  594|     39|        }
  595|       |
  596|       |        /* allocation ti->tGroupNumber */
  597|     39|        if (ti->num_t_groups != num_t_groups || !ti->tGroupNumber)
  ------------------
  |  Branch (597:13): [True: 39, False: 0]
  |  Branch (597:49): [True: 0, False: 0]
  ------------------
  598|     39|        {
  599|     39|            ti->num_t_groups = num_t_groups;
  600|     39|            if (ti->tGroupNumber)
  ------------------
  |  Branch (600:17): [True: 0, False: 39]
  ------------------
  601|      0|                inchi_free( ti->tGroupNumber );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  602|     39|            ti->tGroupNumber = (AT_NUMB *) inchi_calloc( ( ti->num_t_groups + 1 )*TGSO_TOTAL_LEN, sizeof( ti->tGroupNumber[0] ) );
  ------------------
  |  | 1133|     39|#define inchi_calloc   calloc
  ------------------
                          ti->tGroupNumber = (AT_NUMB *) inchi_calloc( ( ti->num_t_groups + 1 )*TGSO_TOTAL_LEN, sizeof( ti->tGroupNumber[0] ) );
  ------------------
  |  |  169|     39|#define TGSO_TOTAL_LEN   4
  ------------------
  603|     39|        }
  604|       |
  605|       |        /* allocation ti->tGroupNumber */
  606|     39|        if (len_tg != ti->nNumEndpoints || !ti->nEndpointAtomNumber)
  ------------------
  |  Branch (606:13): [True: 39, False: 0]
  |  Branch (606:44): [True: 0, False: 0]
  ------------------
  607|     39|        {
  608|     39|            ti->nNumEndpoints = len_tg;
  609|     39|            if (ti->nEndpointAtomNumber)
  ------------------
  |  Branch (609:17): [True: 0, False: 39]
  ------------------
  610|      0|                inchi_free( ti->nEndpointAtomNumber );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  611|     39|            ti->nEndpointAtomNumber = (AT_NUMB *) inchi_calloc( len_tg + 1, sizeof( ti->nEndpointAtomNumber[0] ) );
  ------------------
  |  | 1133|     39|#define inchi_calloc   calloc
  ------------------
  612|     39|        }
  613|       |
  614|       |        /* check */
  615|     39|        if (!ti->t_group || !ti->tGroupNumber || !ti->nEndpointAtomNumber)
  ------------------
  |  Branch (615:13): [True: 0, False: 39]
  |  Branch (615:29): [True: 0, False: 39]
  |  Branch (615:50): [True: 0, False: 39]
  ------------------
  616|      0|        {
  617|      0|            ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
  618|      0|            goto exit_function;
  619|      0|        }
  620|       |
  621|     39|        tGroupNumber = ti->tGroupNumber;
  622|     39|        tSymmRank = tGroupNumber + TGSO_SYMM_RANK   * ti->num_t_groups;  /*  equivalence; cannot restore */
  ------------------
  |  |  166|     39|#define TGSO_SYMM_RANK   1  /* tSymmRank:     symmetry ranks (no isotopes) = min. ordering number > 0. */
  ------------------
  623|     39|        tiSymmRank = tGroupNumber + TGSO_SYMM_IRANK  * ti->num_t_groups;
  ------------------
  |  |  168|     39|#define TGSO_SYMM_IRANK  3  /* tiSymmRank:    isotopic symmetry ranks */
  ------------------
  624|     39|        tiGroupNumber = tGroupNumber + TGSO_SYMM_IORDER * ti->num_t_groups;
  ------------------
  |  |  167|     39|#define TGSO_SYMM_IORDER 2  /* tiGroupNumber: isotopic symmetry rank sorting order */
  ------------------
  625|       |
  626|       |
  627|       |        INCHI_HEAPCHK
  628|       |
  629|     39|            j = 1; /* index in pInChI->nTautomer[] */
  630|     39|        i = 0; /* index in ti->nEndpointAtomNumber[] */
  631|       |
  632|  1.45k|        for (itg = 0; itg < pInChI->nTautomer[0]; itg++)
  ------------------
  |  Branch (632:23): [True: 1.41k, False: 39]
  ------------------
  633|  1.41k|        {
  634|  1.41k|            len_tg = pInChI->nTautomer[j]; /* t-group length not including pInChI->nTautomer[j] */
  635|  1.41k|            ti->t_group[itg].num[0] = pInChI->nTautomer[j + 1] + pInChI->nTautomer[j + 2]; /* num mobile H & (-) */
  636|  1.41k|            ti->t_group[itg].num[1] = pInChI->nTautomer[j + 2]; /* num mobile (-) */
  637|  1.41k|            tGroupNumber[itg] = tiGroupNumber[itg] = itg; /* index */
  638|  1.41k|            ti->t_group[itg].nGroupNumber = /*tSymmRank[itg] = tiSymmRank[itg] =*/ itg + 1; /* t-group number */
  639|  1.41k|            j += T_GROUP_HDR_LEN;   /* skip t-group header */
  ------------------
  |  |  100|  1.41k|#define           T_GROUP_HDR_LEN   (1+T_NUM_NO_ISOTOPIC /*+T_NUM_ISOTOPIC*/) /* LinearCTTautomer */
  |  |  ------------------
  |  |  |  |   97|  1.41k|#define           T_NUM_NO_ISOTOPIC 2
  |  |  ------------------
  ------------------
  640|  1.41k|            len_tg -= T_GROUP_HDR_LEN - 1;
  ------------------
  |  |  100|  1.41k|#define           T_GROUP_HDR_LEN   (1+T_NUM_NO_ISOTOPIC /*+T_NUM_ISOTOPIC*/) /* LinearCTTautomer */
  |  |  ------------------
  |  |  |  |   97|  1.41k|#define           T_NUM_NO_ISOTOPIC 2
  |  |  ------------------
  ------------------
  641|       |
  642|  1.41k|            ti->t_group[itg].nNumEndpoints = len_tg;
  643|  1.41k|            ti->t_group[itg].nFirstEndpointAtNoPos = i;
  644|       |
  645|  53.8k|            for (; 0 < len_tg--; j++, i++)
  ------------------
  |  Branch (645:20): [True: 52.3k, False: 1.41k]
  ------------------
  646|  52.3k|            {
  647|  52.3k|                k = ti->nEndpointAtomNumber[i] = pInChI->nTautomer[j] - 1;
  648|  52.3k|#if ( FIX_GAF_2019_1==1 )
  649|  52.3k|                if (k<0 || k>num_atoms)
  ------------------
  |  Branch (649:21): [True: 0, False: 52.3k]
  |  Branch (649:28): [True: 0, False: 52.3k]
  ------------------
  650|      0|                {
  651|      0|                    ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  652|      0|                    goto exit_function;
  653|      0|                }
  654|  52.3k|#endif
  655|  52.3k|                if (at)
  ------------------
  |  Branch (655:21): [True: 52.3k, False: 0]
  ------------------
  656|  52.3k|                {
  657|  52.3k|                    at[k].endpoint = itg + 1;
  658|  52.3k|                }
  659|  52.3k|                if (endpoint)
  ------------------
  |  Branch (659:21): [True: 0, False: 52.3k]
  ------------------
  660|      0|                {
  661|      0|                    endpoint[k] = itg + 1;
  662|      0|                }
  663|  52.3k|            }
  664|  1.41k|        }
  665|       |
  666|     39|        if (i != ti->nNumEndpoints)
  ------------------
  |  Branch (666:13): [True: 0, False: 39]
  ------------------
  667|      0|        {
  668|      0|            ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  669|      0|        }
  670|       |
  671|     39|        INCHI_HEAPCHK
  672|     39|    }
  673|       |
  674|  55.4k|exit_function:
  675|  55.4k|    return ret;
  676|  55.4k|}
FillOutpStructEndpointFromInChI:
  681|      5|{
  682|      5|    int num_at = pInChI->nNumberOfAtoms;
  683|      5|    AT_NUMB *endpoint = *pEndpoint;
  684|      5|    int     itg, i, j, k, len_tg;
  685|       |
  686|      5|    if (!endpoint && !( endpoint = (AT_NUMB*) inchi_malloc( num_at * sizeof( endpoint[0] ) ) ))
  ------------------
  |  | 1130|      5|#define inchi_malloc   malloc
  ------------------
  |  Branch (686:9): [True: 5, False: 0]
  |  Branch (686:22): [True: 0, False: 5]
  ------------------
  687|      0|    {
  688|      0|        return RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
  689|      0|    }
  690|       |
  691|      5|    memset( endpoint, 0, num_at * sizeof( endpoint[0] ) );
  692|      5|    if (pInChI->lenTautomer <= 1 || !pInChI->nTautomer)
  ------------------
  |  Branch (692:9): [True: 5, False: 0]
  |  Branch (692:37): [True: 0, False: 0]
  ------------------
  693|      5|    {
  694|      5|        goto exit_function;
  695|      5|    }
  696|       |
  697|      0|    j = 1; /* index in pInChI->nTautomer[] */
  698|      0|    i = 0; /* index in ti->nEndpointAtomNumber[] */
  699|      0|    for (itg = 0; itg < pInChI->nTautomer[0]; itg++)
  ------------------
  |  Branch (699:19): [True: 0, False: 0]
  ------------------
  700|      0|    {
  701|      0|        len_tg = pInChI->nTautomer[j]; /* t-group length not including pInChI->nTautomer[j] */
  702|      0|        j += T_GROUP_HDR_LEN;   /* skip t-group header */
  ------------------
  |  |  100|      0|#define           T_GROUP_HDR_LEN   (1+T_NUM_NO_ISOTOPIC /*+T_NUM_ISOTOPIC*/) /* LinearCTTautomer */
  |  |  ------------------
  |  |  |  |   97|      0|#define           T_NUM_NO_ISOTOPIC 2
  |  |  ------------------
  ------------------
  703|      0|        len_tg -= T_GROUP_HDR_LEN - 1;
  ------------------
  |  |  100|      0|#define           T_GROUP_HDR_LEN   (1+T_NUM_NO_ISOTOPIC /*+T_NUM_ISOTOPIC*/) /* LinearCTTautomer */
  |  |  ------------------
  |  |  |  |   97|      0|#define           T_NUM_NO_ISOTOPIC 2
  |  |  ------------------
  ------------------
  704|       |        /* ti->t_group[itg].nNumEndpoints = len_tg; */
  705|      0|        for (; 0 < len_tg--; j++, i++)
  ------------------
  |  Branch (705:16): [True: 0, False: 0]
  ------------------
  706|      0|        {
  707|      0|            k = pInChI->nTautomer[j] - 1;
  708|      0|            endpoint[k] = itg + 1;
  709|      0|        }
  710|      0|    }
  711|       |
  712|      5|exit_function:
  713|      5|    *pEndpoint = endpoint;
  714|       |
  715|      5|    return 0;
  716|      0|}
cmp_charge_val:
  721|    117|{
  722|    117|    const CHARGE_VAL *p1 = (const CHARGE_VAL *) a1;
  723|    117|    const CHARGE_VAL *p2 = (const CHARGE_VAL *) a2;
  724|    117|    int    diff;
  725|       |
  726|    117|    if (diff = (int) p1->nValence - (int) p2->nValence)  /* smaller valence first */
  ------------------
  |  Branch (726:9): [True: 96, False: 21]
  ------------------
  727|     96|        return diff;
  728|     21|    if (diff = abs( (int) p1->nCharge ) - abs( (int) p2->nCharge )) /* smaller abs charge first */
  ------------------
  |  Branch (728:9): [True: 6, False: 15]
  ------------------
  729|      6|        return diff;
  730|     15|    if (diff = (int) p2->nCharge - (int) p1->nCharge) /* (+) first, (-) second */
  ------------------
  |  Branch (730:9): [True: 15, False: 0]
  ------------------
  731|     15|        return diff;
  732|      0|    return (int) p1->nValenceOrderingNumber - (int) p2->nValenceOrderingNumber;
  733|     15|}
bMayBeACationInMobileHLayer:
  738|     38|{
  739|     38|    static const char szEl[] = "N;P;O;S;Se;Te;";
  740|     38|    static const char cVal[] = { 4,4,3,3, 3, 3, 0 };
  741|     38|    static char en[8];
  742|     38|    static int  ne;
  743|     38|    int ne2;
  744|     38|    int    i, j, neigh;
  745|     38|    char   *p;
  746|     38|    if (!bMobileH || !at[iat].num_H)
  ------------------
  |  Branch (746:9): [True: 26, False: 12]
  |  Branch (746:22): [True: 12, False: 0]
  ------------------
  747|     38|    {
  748|     38|        return 1;
  749|     38|    }
  750|      0|    if (!ne)
  ------------------
  |  Branch (750:9): [True: 0, False: 0]
  ------------------
  751|      0|    { /* one time initialization */
  752|      0|        const char *b, *e;
  753|      0|        int  len;
  754|      0|        char elname[ATOM_EL_LEN];
  755|      0|        ne2 = 0;
  756|      0|        for (b = szEl; e = strchr( b, ';' ); b = e + 1)
  ------------------
  |  Branch (756:24): [True: 0, False: 0]
  ------------------
  757|      0|        {
  758|      0|            len = (int) ( e - b );
  759|      0|            memcpy( elname, b, len );
  760|      0|            elname[len] = '\0';
  761|      0|            en[ne2++] = get_periodic_table_number( elname );
  762|      0|        }
  763|      0|        en[ne2] = '\0';
  764|      0|        ne = ne2;
  765|      0|    }
  766|      0|    if (p = (char *) memchr( en, at[iat].el_number, ne ))
  ------------------
  |  Branch (766:9): [True: 0, False: 0]
  ------------------
  767|      0|    {
  768|      0|        i = (int) ( p - en );
  769|       |        /* >B(-)< exception */
  770|      0|        if (at[iat].valence + at[iat].num_H <= cVal[i])
  ------------------
  |  Branch (770:13): [True: 0, False: 0]
  ------------------
  771|      0|        {
  772|      0|            for (j = 0; j < at[iat].valence; j++)
  ------------------
  |  Branch (772:25): [True: 0, False: 0]
  ------------------
  773|      0|            {
  774|      0|                neigh = at[iat].neighbor[j];
  775|      0|                if (at[neigh].valence == 4 && at[neigh].chem_bonds_valence == 4 && !at[neigh].num_H &&
  ------------------
  |  Branch (775:21): [True: 0, False: 0]
  |  Branch (775:47): [True: 0, False: 0]
  |  Branch (775:84): [True: 0, False: 0]
  ------------------
  776|      0|                     pVA[neigh].cNumValenceElectrons == 3 && pVA[neigh].cPeriodicRowNumber == 1)
  ------------------
  |  Branch (776:22): [True: 0, False: 0]
  |  Branch (776:62): [True: 0, False: 0]
  ------------------
  777|      0|                {
  778|      0|                    return 1;
  779|      0|                }
  780|      0|            }
  781|      0|            return 0;
  782|      0|        }
  783|      0|    }
  784|      0|    return 1;
  785|      0|}
clean_charge_val:
  791|     15|{
  792|     15|    inp_ATOM *at = atom + iat;
  793|     15|    int nPeriodicNum = at->el_number;
  794|     15|    int num_bonds = at->valence;
  795|     15|    int min_valence = at->valence + at->num_H;
  796|       |    /* in fixed-H case treat tautomeric -O as tautomeric to avoid #O(+) */
  797|     15|    int bTautomeric = ( at->endpoint != 0 );
  798|     15|    int bFixedHTautomeric = !bMobileH && ( endpoint && endpoint[iat] &&
  ------------------
  |  Branch (798:29): [True: 10, False: 5]
  |  Branch (798:44): [True: 10, False: 0]
  |  Branch (798:56): [True: 0, False: 10]
  ------------------
  799|     10|                            pVA[iat].cNumValenceElectrons == 6 && 1 == num_bonds &&
  ------------------
  |  Branch (799:29): [True: 0, False: 0]
  |  Branch (799:67): [True: 0, False: 0]
  ------------------
  800|     10|                            !at->num_H && !bIsMetal );
  ------------------
  |  Branch (800:29): [True: 0, False: 0]
  |  Branch (800:43): [True: 0, False: 0]
  ------------------
  801|       |    /* int bIsMetal      = is_el_a_metal( nPeriodicNum );*/
  802|     15|    int bDoNotAddH = if_skip_add_H( nPeriodicNum );
  803|     15|    int nPeriod, nNumEqAbsCharges;
  804|     15|    int nNumValenceEl = get_sp_element_type( nPeriodicNum, &nPeriod ) - 1;
  805|       |
  806|     15|    int i, j;
  807|       |
  808|     15|    if (!len)
  ------------------
  |  Branch (808:9): [True: 0, False: 15]
  ------------------
  809|      0|        return len;
  810|       |
  811|     15|    insertions_sort( pCG, pChargeVal, len, sizeof( pChargeVal[0] ), cmp_charge_val );
  812|       |
  813|       |    /* metals -- very preliminary code */
  814|     15|    if (bIsMetal && bDoNotAddH)
  ------------------
  |  Branch (814:9): [True: 0, False: 15]
  |  Branch (814:21): [True: 0, False: 0]
  ------------------
  815|      0|    {
  816|       |/* keep the 1st found */
  817|      0|        return inchi_min( 1, len );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  818|      0|    }
  819|       |    /* Mobile-H layer cannot have H on positively charged N, P (all IV), O, S, Se, Te (all III) */
  820|       |
  821|       |    /*
  822|       |    if ( abs( pChargeVal[0].nCharge ) > 1 && pChargeVal[0].nValence >= min_valence ) {
  823|       |        return inchi_min( 1, len );
  824|       |    }
  825|       |    */
  826|     15|    nNumEqAbsCharges = 0;
  827|     83|    for (i = j = 0; i < len && j < ( nNumEqAbsCharges ? 3 + nNumEqAbsCharges : 4 ); i++)
  ------------------
  |  Branch (827:21): [True: 72, False: 11]
  |  Branch (827:32): [True: 70, False: 2]
  |  Branch (827:38): [True: 5, False: 67]
  ------------------
  828|     70|    {
  829|       |        /* for now accept only charge = 0, -1, +1 */
  830|     70|        if (abs( pChargeVal[i].nCharge ) > 1)
  ------------------
  |  Branch (830:13): [True: 17, False: 53]
  ------------------
  831|     17|        {
  832|     17|            continue;
  833|     17|        }
  834|     53|        if (BOND_TYPE_TRIPLE + BOND_TYPE_DOUBLE * ( min_valence - 1 ) < pChargeVal[i].nValence)
  ------------------
  |  |   62|     53|#define BOND_TYPE_TRIPLE    3
  ------------------
                      if (BOND_TYPE_TRIPLE + BOND_TYPE_DOUBLE * ( min_valence - 1 ) < pChargeVal[i].nValence)
  ------------------
  |  |   61|     53|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (834:13): [True: 0, False: 53]
  ------------------
  835|      0|        {
  836|      0|            continue; /* not more than one triple and the rest - double bonds per atom */
  837|      0|        }
  838|     53|        if (( bTautomeric || j && bFixedHTautomeric ) && pChargeVal[i].nCharge < 0)
  ------------------
  |  Branch (838:15): [True: 0, False: 53]
  |  Branch (838:30): [True: 38, False: 15]
  |  Branch (838:35): [True: 0, False: 38]
  |  Branch (838:58): [True: 0, False: 0]
  ------------------
  839|      0|        {
  840|      0|            continue; /* negative charge must be included in the tautomeric group */
  841|      0|        }
  842|     53|        if (( bTautomeric || bFixedHTautomeric ) && pChargeVal[i].nCharge > 0)
  ------------------
  |  Branch (842:15): [True: 0, False: 53]
  |  Branch (842:30): [True: 0, False: 53]
  |  Branch (842:53): [True: 0, False: 0]
  ------------------
  843|      0|        {
  844|      0|            continue; /* positive charge for now cannot reach a tautomeric group */
  845|      0|        }
  846|     53|        if (j && !bMayBeACationInMobileHLayer( atom, pVA, iat, bMobileH ) && pChargeVal[i].nCharge > 0)
  ------------------
  |  Branch (846:13): [True: 38, False: 15]
  |  Branch (846:18): [True: 0, False: 38]
  |  Branch (846:78): [True: 0, False: 0]
  ------------------
  847|      0|        {
  848|      0|            if (i + 1 < len &&
  ------------------
  |  Branch (848:17): [True: 0, False: 0]
  ------------------
  849|      0|                 pChargeVal[i].nValence == pChargeVal[i + 1].nValence &&
  ------------------
  |  Branch (849:18): [True: 0, False: 0]
  ------------------
  850|      0|                 pChargeVal[i].nCharge == -pChargeVal[i + 1].nCharge)
  ------------------
  |  Branch (850:18): [True: 0, False: 0]
  ------------------
  851|      0|            {
  852|       |                /* (-) if exists is always after (+) */
  853|      0|                i += 1; /* also skip the next element */
  854|      0|            }
  855|      0|            continue; /* in case of Mobile-H, a hydrogen cannot be on a (+)-charged heteroatom */
  856|      0|        }
  857|       |
  858|       |        /* accept same valence opposite charges only for C and its group in Periodic Table */
  859|     53|        if (j && !bTautomeric &&
  ------------------
  |  Branch (859:13): [True: 38, False: 15]
  |  Branch (859:18): [True: 38, False: 0]
  ------------------
  860|     53|             pChargeVal[i].nValence == pChargeVal[j - 1].nValence &&
  ------------------
  |  Branch (860:14): [True: 9, False: 29]
  ------------------
  861|     53|             pChargeVal[i].nCharge == -pChargeVal[j - 1].nCharge)
  ------------------
  |  Branch (861:14): [True: 9, False: 0]
  ------------------
  862|      9|        {
  863|      9|            if (nNumValenceEl == VALUE_OCTET / 2 && pChargeVal[i].nCharge && !nNumEqAbsCharges)
  ------------------
  |  |   54|      9|#define VALUE_OCTET    8     /* number of electrons in a full shell */
  ------------------
  |  Branch (863:17): [True: 4, False: 5]
  |  Branch (863:53): [True: 4, False: 0]
  |  Branch (863:78): [True: 4, False: 0]
  ------------------
  864|      4|            {
  865|      4|                pChargeVal[j++] = pChargeVal[i];
  866|      4|                nNumEqAbsCharges++;
  867|      4|            }
  868|      9|            continue;
  869|      9|        }
  870|       |        /* do not accept valence=5 for neutral NHn in case of not Mobile-H 2005-01-26 ???? */
  871|     44|        if (nNumValenceEl == 5 && nPeriod == 1 && at->num_H &&
  ------------------
  |  Branch (871:13): [True: 6, False: 38]
  |  Branch (871:35): [True: 6, False: 0]
  |  Branch (871:51): [True: 0, False: 6]
  ------------------
  872|     44|             j && !bMobileH &&
  ------------------
  |  Branch (872:14): [True: 0, False: 0]
  |  Branch (872:19): [True: 0, False: 0]
  ------------------
  873|     44|             pChargeVal[i].nValence == 5 && !pChargeVal[i].nCharge)
  ------------------
  |  Branch (873:14): [True: 0, False: 0]
  |  Branch (873:45): [True: 0, False: 0]
  ------------------
  874|      0|        {
  875|      0|            continue;
  876|      0|        }
  877|       |        /* do not accept gaps in allowed valences */
  878|     44|        if (j && pChargeVal[i].nValence > pChargeVal[j - 1].nValence + 1)
  ------------------
  |  Branch (878:13): [True: 29, False: 15]
  |  Branch (878:18): [True: 2, False: 27]
  ------------------
  879|      2|        {
  880|      2|            break;
  881|      2|        }
  882|     42|        pChargeVal[j++] = pChargeVal[i];
  883|     42|    }
  884|     15|    len = j;
  885|     15|    if (!nNumEqAbsCharges && num_bonds < 3 && len == 4)
  ------------------
  |  Branch (885:9): [True: 11, False: 4]
  |  Branch (885:30): [True: 11, False: 0]
  |  Branch (885:47): [True: 3, False: 8]
  ------------------
  886|      3|    {
  887|      3|        len--; /* prohibit =S#  where # is a triple bond */
  888|      3|    }
  889|     15|    return len;
  890|     15|}
GetAtomRestoreInfo:
  912|   653k|{
  913|       |/* #defines from util.c */
  914|   653k|#define MIN_ATOM_CHARGE        (-2)
  915|   653k|#define MAX_ATOM_CHARGE         2
  916|   653k|#define NEUTRAL_STATE          (-MIN_ATOM_CHARGE)
  917|   653k|#define NUM_ATOM_CHARGES       (MAX_ATOM_CHARGE - MIN_ATOM_CHARGE + 1)
  918|   653k|#define MAX_NUM_VALENCES        5  /* max. number + 1 to provide zero termination */
  919|       |
  920|   653k|    int i, j, j2, k, k2, charge, cur_charge, num_non_bonding_electrons;
  921|   653k|    int nNumStates, nNumSelectedStates, num_H, num_bonds;
  922|   653k|    int nOctetNeutralValenceExcess, nFirstNeutralValenceExcess;
  923|   653k|    int nFoundNeutralValenceExcess, nFoundNeutralValenceOrdNumber;
  924|   653k|    int nLastFoundValenceOrdNumber, nLastFoundValenceState;
  925|   653k|    int cn_bits, cn_bits_array[5], len_cn_bits_array;
  926|   653k|    inp_ATOM *at = atom + iat;
  927|   653k|    VAL_AT      *pVA = pVArray + iat;
  928|   653k|    int nPeriodicNum = at->el_number;
  929|   653k|    int cur_chem_valence, cur_chem_valence_fixed, min_chem_valence, known_chem_valence;
  930|   653k|    int metal_bonds_chem_valence, not_metal_bonds_chem_valence, alt_bonds_delta_valence, bonds_chem_valence, bond_type;
  931|   653k|    CHARGE_VAL  ChargeVal[NUM_ATOM_CHARGES*MAX_NUM_VALENCES];
  932|       |
  933|   653k|    memset( ChargeVal, 0, sizeof( ChargeVal ) );
  934|       |
  935|   653k|    pVA->cDoNotAddH = if_skip_add_H( nPeriodicNum );  /* InChI never adds H to this atom */
  936|       |    /*pVA->cMetal     = is_el_a_metal( nPeriodicNum );*/ /* the atom is a metal */
  937|       |
  938|       |    /* count bonds to metal atoms; metals have already been marked */
  939|   653k|    metal_bonds_chem_valence = not_metal_bonds_chem_valence = alt_bonds_delta_valence = 0;
  940|       |
  941|   653k|    if (pVA->cMetal)
  ------------------
  |  Branch (941:9): [True: 66.7k, False: 586k]
  ------------------
  942|  66.7k|    {
  943|  66.7k|        j = at->valence; /* all bonds to metal */
  944|  66.7k|        for (i = k = j2 = k2 = 0; i < at->valence; i++)
  ------------------
  |  Branch (944:35): [True: 0, False: 66.7k]
  ------------------
  945|      0|        {
  946|      0|            bond_type = ( at->bond_type[i] & BOND_TYPE_MASK );
  ------------------
  |  |  217|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
  947|      0|            if (bond_type <= BOND_TYPE_TRIPLE)
  ------------------
  |  |   62|      0|#define BOND_TYPE_TRIPLE    3
  ------------------
  |  Branch (947:17): [True: 0, False: 0]
  ------------------
  948|      0|            {
  949|      0|                metal_bonds_chem_valence += inchi_max( BOND_TYPE_SINGLE, bond_type );
  ------------------
  |  |  166|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  950|      0|            }
  951|      0|            else
  952|      0|            {
  953|      0|                metal_bonds_chem_valence += BOND_TYPE_SINGLE;
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  954|      0|                k++; /* count alternating bonds */
  955|      0|            }
  956|      0|        }
  957|  66.7k|    }
  958|   586k|    else
  959|   586k|    {
  960|   586k|        for (i = j = j2 = k = k2 = 0; i < at->valence; i++)
  ------------------
  |  Branch (960:39): [True: 24, False: 586k]
  ------------------
  961|     24|        {
  962|     24|            bond_type = ( at->bond_type[i] & BOND_TYPE_MASK );
  ------------------
  |  |  217|     24|#define BOND_TYPE_MASK        0x0f
  ------------------
  963|     24|            if (pVArray[(int) at->neighbor[i]].cMetal)
  ------------------
  |  Branch (963:17): [True: 0, False: 24]
  ------------------
  964|      0|            {
  965|      0|                j++;  /* number of bonds to metal atoms */
  966|      0|                if (bond_type <= BOND_TYPE_TRIPLE)
  ------------------
  |  |   62|      0|#define BOND_TYPE_TRIPLE    3
  ------------------
  |  Branch (966:21): [True: 0, False: 0]
  ------------------
  967|      0|                {
  968|      0|                    metal_bonds_chem_valence += inchi_max( BOND_TYPE_SINGLE, bond_type );
  ------------------
  |  |  166|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  969|      0|                }
  970|      0|                else
  971|      0|                {
  972|      0|                    metal_bonds_chem_valence += BOND_TYPE_SINGLE;
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  973|      0|                    k++; /* count alternating bonds */
  974|      0|                }
  975|      0|            }
  976|     24|            else
  977|     24|            {
  978|     24|                j2++;
  979|     24|                if (bond_type <= BOND_TYPE_TRIPLE)
  ------------------
  |  |   62|     24|#define BOND_TYPE_TRIPLE    3
  ------------------
  |  Branch (979:21): [True: 24, False: 0]
  ------------------
  980|     24|                {
  981|     24|                    not_metal_bonds_chem_valence += inchi_max( BOND_TYPE_SINGLE, bond_type );
  ------------------
  |  |  166|     24|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 24]
  |  |  ------------------
  ------------------
  982|     24|                }
  983|      0|                else
  984|      0|                {
  985|      0|                    not_metal_bonds_chem_valence += BOND_TYPE_SINGLE;
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  986|      0|                    k2++; /* count alternating bonds */
  987|      0|                }
  988|     24|            }
  989|     24|        }
  990|   586k|    }
  991|       |
  992|   653k|    bonds_chem_valence = metal_bonds_chem_valence + not_metal_bonds_chem_valence;
  993|       |
  994|   653k|    if (at->chem_bonds_valence > bonds_chem_valence)
  ------------------
  |  Branch (994:9): [True: 0, False: 653k]
  ------------------
  995|      0|    {
  996|      0|        if (at->chem_bonds_valence - bonds_chem_valence > 1)
  ------------------
  |  Branch (996:13): [True: 0, False: 0]
  ------------------
  997|      0|        {
  998|      0|            at->chem_bonds_valence = bonds_chem_valence + 1;  /* should not happen */
  999|      0|        }
 1000|      0|        alt_bonds_delta_valence = at->chem_bonds_valence - bonds_chem_valence;
 1001|      0|    }
 1002|       |
 1003|   653k|    pVA->cNumBondsToMetal = j;
 1004|       |
 1005|   653k|    if (nPeriodicNum == EL_NUMBER_H)
  ------------------
  |  |   41|   653k|#define EL_NUMBER_H ((U_CHAR) 1)
  ------------------
  |  Branch (1005:9): [True: 0, False: 653k]
  ------------------
 1006|      0|    {
 1007|       |        /* ignore bridging H; ??? later add ??? */
 1008|      0|        return 0;
 1009|      0|    }
 1010|       |
 1011|   653k|    num_H = at->num_H;
 1012|   653k|    num_bonds = at->valence;
 1013|       |
 1014|   653k|    if (!num_bonds && !num_H)
  ------------------
  |  Branch (1014:9): [True: 653k, False: 15]
  |  Branch (1014:23): [True: 653k, False: 0]
  ------------------
 1015|   653k|    {
 1016|   653k|        return 0; /* do not know the answer: isolated atom */
 1017|   653k|    }
 1018|       |    /* at the beginning all bonds are single */
 1019|     15|    min_chem_valence = num_bonds + num_H;
 1020|     15|    cur_chem_valence = bonds_chem_valence + alt_bonds_delta_valence + num_H; /* includes double & alternating bond contribution */
 1021|       |
 1022|       |    /* number of non-bonding electrons in case of all single bonds */
 1023|     15|    num_non_bonding_electrons = (int) pVA->cNumValenceElectrons - min_chem_valence;
 1024|       |    /* Octet rule: charge = bonds_valence + NumValenceElectrons - 8 */
 1025|     15|    charge = min_chem_valence + (int) pVA->cNumValenceElectrons - VALUE_OCTET; /* wrong */
  ------------------
  |  |   54|     15|#define VALUE_OCTET    8     /* number of electrons in a full shell */
  ------------------
 1026|       |
 1027|       |    /* typical (ad hoc) minimal neutral valence */
 1028|     15|    known_chem_valence = ( pVA->cNumValenceElectrons > VALUE_OCTET / 2 ) ?
  ------------------
  |  |   54|     15|#define VALUE_OCTET    8     /* number of electrons in a full shell */
  ------------------
  |  Branch (1028:26): [True: 11, False: 4]
  ------------------
 1029|     11|        VALUE_OCTET - pVA->cNumValenceElectrons :
  ------------------
  |  |   54|     11|#define VALUE_OCTET    8     /* number of electrons in a full shell */
  ------------------
 1030|     15|        pVA->cNumValenceElectrons;
 1031|       |/* excess of typical valence over all-single-bonds valence */
 1032|     15|    nOctetNeutralValenceExcess = known_chem_valence - min_chem_valence;
 1033|       |    /*  (NB=num.bonds, NV=neutral valence, NVX=neutral valence excess, LFVS=last found valence state, val.=valence)
 1034|       |
 1035|       |       element NB  knownFst octet Last  octetNVX  firstNVX foundNVX chargeLFVS  LFVS
 1036|       |                   valence  val.  NV>=
 1037|       |
 1038|       |       -B       1    3        3    3        2         2   =     2        +2
 1039|       |       >B       2    3        3    3        1         1   =     1        +1
 1040|       |       >B-      3    3        3    3        0         0   =     0         0
 1041|       |       >B<      4    3        3    3       -1        -1   <>   N/A       -1
 1042|       |
 1043|       |       -C       1    4        4    4        3         3   =     3        N/A
 1044|       |       >C       2    4        4    4        2         2   =     2        +2  (-2)
 1045|       |       >C-      3    4        4    4        1         1   =     1        +1  (-1)
 1046|       |       >C<      4    4        4    4        0         0   =     0         0
 1047|       |       C(V)     5    4        4    N/A     -1        -1   <>   N/A       N/A
 1048|       |
 1049|       |       -Si      1    4        4    4        3         3   =     3        N/A
 1050|       |       >Si      2    4        4    4        2         2   =     2        +2  (-2)
 1051|       |       >Si-     3    4        4    4        1         1   =     1        +1  (-1)
 1052|       |       >Si-     4    4        4    4        0         0   =     0         0
 1053|       |       Si(V)    5    4        4    N/A     -1        -1   <>   N/A       -1
 1054|       |
 1055|       |       -N       1    3        3    3        2         2   =     2        -2
 1056|       |       >N       2    3        3    3        1         1   =     1        -1
 1057|       |       >N-      3    3        3    3        0         0   =     0         0  (+2)
 1058|       |       >N<      4    3        3    5       -1        -1   <>    1        +1
 1059|       |       N(V)     5    3        3    5       -2        -2   <>    0         0
 1060|       |       N(VI)    6    3        3    N/A     -3        -3   <>   N/A       N/A
 1061|       |       N(VII)   7    3        3    N/A     -4        -4   <>   N/A       N/A
 1062|       |
 1063|       |       -P       1    3        3    3        2         2   =     2        -2
 1064|       |       >P       2    3        3    3        1         1   =     1        -1
 1065|       |       >P-      3    3        3    3        0         0   =     0         0  (-2, +2)
 1066|       |       >P<      4    3        3    5       -1        -1   <>    1        +1  (-1)
 1067|       |       P(V)     5    3        3    5       -2        -2   <>    0         0  (-2)
 1068|       |       P(VI)    6    3        3    N/A     -3        -3   <>   N/A       -1
 1069|       |       P(VII)   7    3        3    N/A     -4        -4   <>   N/A       -2
 1070|       |       P(VIII)  8    3        3    N/A     -5        -5   <>   N/A       N/A
 1071|       |
 1072|       |       -O       1    2        2    2        1         1   =     1        -1
 1073|       |       >O       2    2        2    2        0         0   =     0         0
 1074|       |       >O-      3    2        2    N/A     -1        -1   <>   N/A       +1
 1075|       |       >O<      4    2        2    N/A     -2        -2   <>   N/A       +2
 1076|       |       O(V)     5    2        2    N/A     -3        -3   <>   N/A       +1
 1077|       |       O(VI)    6    2        2    N/A     -4        -4   <>   N/A       N/A
 1078|       |
 1079|       |       -S       1    2        2    2        1         1   =     1        -1
 1080|       |       >S       2    2        2    2        0         0   =     0         0       NPNP - prohibit
 1081|       |       >S-      3    2        2    4       -1        -1   <>    1        +1  (-1) PNPN
 1082|       |       >S<      4    2        2    4       -2        -2   <>    0         0  (+2)
 1083|       |       S(V)     5    2        2    6       -3        -3   <>    1        +1  (-1)
 1084|       |       S(VI)    6    2        2    6       -4        -4   <>    0         0
 1085|       |       S(VII)   7    2        2    N/A     -5        -5   <>    0        -1
 1086|       |       S(VIII)  8    2        2    N/A     -6        -6   <>   N/A       N/A
 1087|       |
 1088|       |       -F       1    1        1    1        0         0   =     0         0
 1089|       |       >F       2    1        1    1       -1        -1   <>   N/A       +1
 1090|       |       >F-      3    1        1    1       -2        -2   <>   N/A       +2
 1091|       |       >F<      4    1        1    1       -3        -3   <>   N/A       N/A
 1092|       |       F(V)     5    1        1    1       -4        -4   <>   N/A       +2
 1093|       |       F(VI)    6    1        1    1       -5        -5   <>   N/A       N/A
 1094|       |
 1095|       |       -Cl      1    1        1    1        0         0   =     0         0      NPNP - prohibit
 1096|       |       >Cl      2    1        1    3       -1        -1   <>    1        +1      PNPN - prohibit
 1097|       |       >Cl-     3    1        1    3       -2        -2   <>    0         0 (+2) NPNP
 1098|       |       >Cl<     4    1        1    5       -3        -3   <>    1        +1      PNPN
 1099|       |       Cl(V)    5    1        1    5       -4        -4   <>    0         0
 1100|       |       Cl(VI)   6    1        1    7       -5        -5   <>    1        +1
 1101|       |       Cl(VII)  7    1        1    7       -6        -6   <>    0         0
 1102|       |       Cl(VIII) 8    1        1    N/A     -7        -7   <>   N/A       N/A
 1103|       |
 1104|       |
 1105|       |      NB                 = num_bonds+num_H
 1106|       |
 1107|       |      knownFst valence   = nFirstNeutralValenceExcess + min_chem_valence
 1108|       |      octet val.         = nOctetNeutralValenceExcess + min_chem_valence
 1109|       |      Last NV>=          = nFoundNeutralValenceExcess + min_chem_valence
 1110|       |
 1111|       |      octetNVX           = nOctetNeutralValenceExcess
 1112|       |      firstNVX           = nFirstNeutralValenceExcess
 1113|       |      foundNVX           = nFoundNeutralValenceExcess
 1114|       |
 1115|       |      chargeLFVS         = ChargeVal[nLastFoundValenceState].nCharge
 1116|       |
 1117|       |    */
 1118|       |    /* minimal known neutral atom valence; different for Sn(2/4), Tl(1/3), Pb(2/4): (known/typical ad hoc) */
 1119|     15|    known_chem_valence = get_el_valence( nPeriodicNum, 0, 0 );
 1120|       |
 1121|     15|    if (pSrm->bMetalAddFlower)
  ------------------
  |  Branch (1121:9): [True: 15, False: 0]
  ------------------
 1122|     15|    {
 1123|       |        /* bond orders of bonds to metal may be as they are (pSrm->nMetalInitBondOrder==1)
 1124|       |                                        or decreased by one (pSrm->nMetalInitBondOrder==0)
 1125|       |           nMetalInitBondOrder == nMetalMinBondOrder + nMetalInitEdgeFlow
 1126|       |        */
 1127|     15|        cur_chem_valence_fixed = cur_chem_valence - pVA->cNumBondsToMetal * ( 1 - pSrm->nMetalInitBondOrder );
 1128|     15|        pVA->cInitOrigValenceToMetal = metal_bonds_chem_valence;
 1129|     15|        pVA->cInitValenceToMetal = metal_bonds_chem_valence - pVA->cNumBondsToMetal * ( 1 - pSrm->nMetalInitBondOrder );
 1130|     15|        pVA->cInitFlowToMetal = pVA->cInitValenceToMetal - pVA->cNumBondsToMetal * pSrm->nMetalMinBondOrder;
 1131|     15|        if (pVA->cMetal)
  ------------------
  |  Branch (1131:13): [True: 0, False: 15]
  ------------------
 1132|      0|        {
 1133|      0|            pVA->cInitFreeValences += alt_bonds_delta_valence;
 1134|      0|        }
 1135|     15|        if (pSrm->nMetalInitEdgeFlow < pSrm->nMetalInitBondOrder - pSrm->nMetalMinBondOrder)
  ------------------
  |  Branch (1135:13): [True: 0, False: 15]
  ------------------
 1136|      0|        {
 1137|       |            /* single bond has zero initial flow + 2 radicals at incident atoms */
 1138|      0|            if (pVA->cInitFlowToMetal <= pVA->cNumBondsToMetal)
  ------------------
  |  Branch (1138:17): [True: 0, False: 0]
  ------------------
 1139|      0|            {
 1140|      0|                if (pVA->cMetal)
  ------------------
  |  Branch (1140:21): [True: 0, False: 0]
  ------------------
 1141|      0|                {
 1142|      0|                    pVA->cInitFreeValences += pVA->cInitFlowToMetal;
 1143|      0|                }
 1144|      0|                pVA->cInitFlowToMetal = 0;
 1145|      0|            }
 1146|      0|            else
 1147|      0|            {
 1148|      0|                if (pVA->cMetal)
  ------------------
  |  Branch (1148:21): [True: 0, False: 0]
  ------------------
 1149|      0|                {
 1150|      0|                    pVA->cInitFreeValences += pVA->cNumBondsToMetal * ( 1 - pSrm->nMetalInitEdgeFlow );
 1151|      0|                }
 1152|      0|                pVA->cInitFlowToMetal -= pVA->cNumBondsToMetal * ( 1 - pSrm->nMetalInitEdgeFlow );
 1153|      0|            }
 1154|      0|        }
 1155|     15|    }
 1156|      0|    else
 1157|      0|    {
 1158|       |        /* treat metal atoms as ordinary non-metal atoms */
 1159|      0|        cur_chem_valence_fixed = cur_chem_valence;
 1160|      0|        pVA->cInitFlowToMetal = metal_bonds_chem_valence - pVA->cNumBondsToMetal;
 1161|      0|        pVA->cInitValenceToMetal = metal_bonds_chem_valence;
 1162|      0|        pVA->cInitOrigValenceToMetal = metal_bonds_chem_valence;
 1163|      0|    }
 1164|       |
 1165|       |
 1166|     15|    if (pVA->cMetal && pSrm->bMetalAddFlower)
  ------------------
  |  Branch (1166:9): [True: 0, False: 15]
  |  Branch (1166:24): [True: 0, False: 0]
  ------------------
 1167|      0|    {
 1168|      0|        pVA->cnListIndex = cnListIndexMe + 1;
  ------------------
  |  |  492|      0|#define cnListIndexMe (17)  /* index of {cnMe, cn_bits_Me,... } element of cnList[] */
  ------------------
 1169|       |        /*
 1170|       |        pVA->cInitOrigValenceToMetal += alt_bonds_delta_valence;
 1171|       |        pVA->cInitValenceToMetal     += alt_bonds_delta_valence;
 1172|       |        pVA->cInitFreeValences = (pSrm->nMetalInitBondOrder + alt_bonds_delta_valence
 1173|       |                                 - (pSrm->nMetalMinBondOrder + pSrm->nMetalInitEdgeFlow)) * pVA->cNumBondsToMetal;
 1174|       |        */
 1175|      0|        return 0;  /* metal */
 1176|      0|    }
 1177|       |
 1178|     15|    if (!known_chem_valence)
  ------------------
  |  Branch (1178:9): [True: 0, False: 15]
  ------------------
 1179|      0|    {
 1180|       |        /* a noble gas like He, Ne, ... */
 1181|      0|        pVA->cInitFreeValences = at->chem_bonds_valence - at->valence;
 1182|      0|        return TREAT_ATOM_AS_METAL; /* do not know anything about this atom; needs 2nd pass */
  ------------------
  |  |  286|      0|#define TREAT_ATOM_AS_METAL 99
  ------------------
 1183|      0|    }
 1184|       |
 1185|     15|    nFirstNeutralValenceExcess = known_chem_valence - min_chem_valence;
 1186|       |
 1187|     15|    nFoundNeutralValenceExcess = NO_VALUE_INT;
  ------------------
  |  |   51|     15|#define NO_VALUE_INT    9999
  ------------------
 1188|     15|    nFoundNeutralValenceOrdNumber = NO_VALUE_INT;
  ------------------
  |  |   51|     15|#define NO_VALUE_INT    9999
  ------------------
 1189|     15|    nLastFoundValenceOrdNumber = NO_VALUE_INT;
  ------------------
  |  |   51|     15|#define NO_VALUE_INT    9999
  ------------------
 1190|     15|    nLastFoundValenceState = NO_VALUE_INT;
  ------------------
  |  |   51|     15|#define NO_VALUE_INT    9999
  ------------------
 1191|       |
 1192|       |    /* find the lowest known valence >= all-single-bonds valence */
 1193|     90|    for (cur_charge = MIN_ATOM_CHARGE, nNumStates = 0; cur_charge <= MAX_ATOM_CHARGE; cur_charge++)
  ------------------
  |  |  914|     15|#define MIN_ATOM_CHARGE        (-2)
  ------------------
                  for (cur_charge = MIN_ATOM_CHARGE, nNumStates = 0; cur_charge <= MAX_ATOM_CHARGE; cur_charge++)
  ------------------
  |  |  915|     90|#define MAX_ATOM_CHARGE         2
  ------------------
  |  Branch (1193:56): [True: 75, False: 15]
  ------------------
 1194|     75|    {
 1195|    450|        for (i = 0; i < MAX_NUM_VALENCES; i++)
  ------------------
  |  |  918|    450|#define MAX_NUM_VALENCES        5  /* max. number + 1 to provide zero termination */
  ------------------
  |  Branch (1195:21): [True: 375, False: 75]
  ------------------
 1196|    375|        {
 1197|    375|            known_chem_valence = get_el_valence( nPeriodicNum, cur_charge, i );
 1198|    375|            if (cur_chem_valence_fixed > known_chem_valence || !known_chem_valence)
  ------------------
  |  Branch (1198:17): [True: 275, False: 100]
  |  Branch (1198:64): [True: 0, False: 100]
  ------------------
 1199|    275|            {
 1200|    275|                continue; /* known valence < all-single-bonds valence */
 1201|    275|            }
 1202|    100|            if (BOND_TYPE_TRIPLE + BOND_TYPE_DOUBLE * ( num_bonds - 1 ) + num_H < known_chem_valence)
  ------------------
  |  |   62|    100|#define BOND_TYPE_TRIPLE    3
  ------------------
                          if (BOND_TYPE_TRIPLE + BOND_TYPE_DOUBLE * ( num_bonds - 1 ) + num_H < known_chem_valence)
  ------------------
  |  |   61|    100|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (1202:17): [True: 28, False: 72]
  ------------------
 1203|     28|            {
 1204|     28|                continue; /* not more than one triple and the rest - double bonds per atom */
 1205|     28|            }
 1206|       |
 1207|       |            /* keep all found */
 1208|     72|            ChargeVal[nNumStates].nValence = known_chem_valence;
 1209|     72|            ChargeVal[nNumStates].nCharge = cur_charge;
 1210|     72|            ChargeVal[nNumStates].nValenceOrderingNumber = i;
 1211|     72|            if (!cur_charge && nFoundNeutralValenceExcess == NO_VALUE_INT)
  ------------------
  |  |   51|     18|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (1211:17): [True: 18, False: 54]
  |  Branch (1211:32): [True: 15, False: 3]
  ------------------
 1212|     15|            {
 1213|       |                /* neutral state; compare to the lowest typical valence */
 1214|     15|                nFoundNeutralValenceExcess = known_chem_valence - min_chem_valence;
 1215|     15|                nFoundNeutralValenceOrdNumber = i;
 1216|     15|            }
 1217|     72|            if (min_chem_valence == known_chem_valence)
  ------------------
  |  Branch (1217:17): [True: 21, False: 51]
  ------------------
 1218|     21|            {
 1219|     21|                if (nLastFoundValenceState == NO_VALUE_INT)
  ------------------
  |  |   51|     21|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (1219:21): [True: 15, False: 6]
  ------------------
 1220|     15|                {
 1221|       |                    /* accept the first found */
 1222|     15|                    nLastFoundValenceState = nNumStates;
 1223|     15|                }
 1224|      6|                else
 1225|      6|                    if (abs( ChargeVal[nLastFoundValenceState].nCharge ) >= abs( cur_charge ))
  ------------------
  |  Branch (1225:25): [True: 4, False: 2]
  ------------------
 1226|      4|                    {
 1227|       |                        /* accept smaller abs(charge); if abs(charges) are same, accept (+) */
 1228|      4|                        nLastFoundValenceState = nNumStates;
 1229|      4|                    }
 1230|     21|            }
 1231|       |
 1232|     72|            nNumStates++;
 1233|     72|        }
 1234|     75|    }
 1235|       |
 1236|       |    /***********************************************************************************/
 1237|       |    /* select only appropriate charge & valence so that a suitable ChargeStruct exists */
 1238|       |    /***********************************************************************************/
 1239|       |
 1240|     15|    nNumSelectedStates = clean_charge_val( pCG, ChargeVal, nNumStates, atom,
 1241|     15|                                           pVArray, iat, pVA->cMetal,
 1242|     15|                                           bMobileH, endpoint );
 1243|       |
 1244|     15|    if (!nNumSelectedStates)
  ------------------
  |  Branch (1244:9): [True: 0, False: 15]
  ------------------
 1245|      0|    {
 1246|      0|        return TREAT_ATOM_AS_METAL; /* nothing to do */
  ------------------
  |  |  286|      0|#define TREAT_ATOM_AS_METAL 99
  ------------------
 1247|      0|    }
 1248|       |
 1249|       |    /***********************************************************************************/
 1250|       |    /*       Find an appropriate ChargeStruct index for the ChargeVal found            */
 1251|       |    /***********************************************************************************/
 1252|     15|    cn_bits = 0;
 1253|     15|    memset( cn_bits_array, 0, sizeof( cn_bits_array ) );
 1254|       |    /***** set bits identifying a suitable ChargeStruct ******/
 1255|     58|    for (i = len_cn_bits_array = 0; i < nNumSelectedStates && len_cn_bits_array < 4; i++)
  ------------------
  |  Branch (1255:37): [True: 43, False: 15]
  |  Branch (1255:63): [True: 43, False: 0]
  ------------------
 1256|     43|    {
 1257|     43|        switch (ChargeVal[i].nCharge)
 1258|     43|        {
 1259|     12|            case -1:
  ------------------
  |  Branch (1259:13): [True: 12, False: 31]
  ------------------
 1260|     12|                cn_bits_array[len_cn_bits_array] |= cn_bits_M; /* Minus 1 */
  ------------------
  |  |  446|     12|#define cn_bits_M  4  /* Minus 1: charge = -1 */
  ------------------
 1261|     12|                break;
 1262|     17|            case 0:
  ------------------
  |  Branch (1262:13): [True: 17, False: 26]
  ------------------
 1263|     17|                cn_bits_array[len_cn_bits_array] |= cn_bits_N; /* Neutral */
  ------------------
  |  |  444|     17|#define cn_bits_N  1  /* Neutral: charge =  0 */
  ------------------
 1264|     17|                break;
 1265|     14|            case 1:
  ------------------
  |  Branch (1265:13): [True: 14, False: 29]
  ------------------
 1266|     14|                cn_bits_array[len_cn_bits_array] |= cn_bits_P; /* Plus 1 */
  ------------------
  |  |  445|     14|#define cn_bits_P  2  /* Plus 1:  charge = +1 */
  ------------------
 1267|     14|                break;
 1268|      0|            default:
  ------------------
  |  Branch (1268:13): [True: 0, False: 43]
  ------------------
 1269|      0|                return RI_ERR_PROGR; /* program error */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1270|     43|        }
 1271|     43|        if (i + 1 < nNumSelectedStates &&
  ------------------
  |  Branch (1271:13): [True: 28, False: 15]
  ------------------
 1272|     43|             ChargeVal[i].nValence == ChargeVal[i + 1].nValence &&
  ------------------
  |  Branch (1272:14): [True: 4, False: 24]
  ------------------
 1273|     43|             ChargeVal[i].nCharge &&
  ------------------
  |  Branch (1273:14): [True: 4, False: 0]
  ------------------
 1274|     43|             ChargeVal[i].nCharge == -ChargeVal[i + 1].nCharge)
  ------------------
  |  Branch (1274:14): [True: 4, False: 0]
  ------------------
 1275|      4|        {
 1276|      4|            ; /* add opposite charge to the same element of cn_bits_array[] */
 1277|      4|        }
 1278|     39|        else
 1279|     39|        {
 1280|     39|            len_cn_bits_array++;
 1281|     39|        }
 1282|     43|    }
 1283|     15|    if (!len_cn_bits_array || len_cn_bits_array > 4)
  ------------------
  |  Branch (1283:9): [True: 0, False: 15]
  |  Branch (1283:31): [True: 0, False: 15]
  ------------------
 1284|      0|    {
 1285|      0|        return RI_ERR_PROGR; /* program error */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1286|      0|    }
 1287|       |    /* accommodate added 4-state ChargeStruct: +/- cannot be in case of 4 states */
 1288|     15|    if (len_cn_bits_array + 1 == nNumSelectedStates && nNumSelectedStates == 4)
  ------------------
  |  Branch (1288:9): [True: 4, False: 11]
  |  Branch (1288:56): [True: 1, False: 3]
  ------------------
 1289|      1|    {
 1290|      1|        len_cn_bits_array--;
 1291|      1|        nNumSelectedStates--;
 1292|      1|        cn_bits_array[len_cn_bits_array] = 0;
 1293|      1|    }
 1294|       |    /* fix for terminal hydrogenless -C as in isocyano or CO: there is no just cnE_[] ChargeStruct */
 1295|     15|    if (len_cn_bits_array == 1 &&
  ------------------
  |  Branch (1295:9): [True: 0, False: 15]
  ------------------
 1296|     15|         cn_bits_array[0] == ( cn_bits_P | cn_bits_M ) &&
  ------------------
  |  |  445|      0|#define cn_bits_P  2  /* Plus 1:  charge = +1 */
  ------------------
                       cn_bits_array[0] == ( cn_bits_P | cn_bits_M ) &&
  ------------------
  |  |  446|      0|#define cn_bits_M  4  /* Minus 1: charge = -1 */
  ------------------
  |  Branch (1296:10): [True: 0, False: 0]
  ------------------
 1297|     15|         ChargeVal[0].nValence + 1 > BOND_TYPE_TRIPLE + BOND_TYPE_DOUBLE * ( num_bonds - 1 ) + num_H)
  ------------------
  |  |   62|      0|#define BOND_TYPE_TRIPLE    3
  ------------------
                       ChargeVal[0].nValence + 1 > BOND_TYPE_TRIPLE + BOND_TYPE_DOUBLE * ( num_bonds - 1 ) + num_H)
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (1297:10): [True: 0, False: 0]
  ------------------
 1298|      0|    {
 1299|      0|        cn_bits_array[len_cn_bits_array++] = cn_bits_N;
  ------------------
  |  |  444|      0|#define cn_bits_N  1  /* Neutral: charge =  0 */
  ------------------
 1300|      0|        ChargeVal[nNumSelectedStates].nValence = ChargeVal[nNumSelectedStates - 1].nValence;
 1301|      0|        ChargeVal[nNumSelectedStates].nCharge = 0;
 1302|      0|        ChargeVal[nNumSelectedStates].nValenceOrderingNumber = 0;
 1303|      0|    }
 1304|       |
 1305|     15|make_cn_bits:
 1306|     15|    cn_bits = MAKE_CN_BITS( cn_bits_array[0], cn_bits_array[1], cn_bits_array[2], cn_bits_array[3] );
  ------------------
  |  |  449|     15|#define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  ------------------
  |  |  |  |  447|     15|#define cn_bits_shift 3
  |  |  ------------------
  |  |               #define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  ------------------
  |  |  |  |  447|     15|#define cn_bits_shift 3
  |  |  ------------------
  |  |               #define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  ------------------
  |  |  |  |  447|     15|#define cn_bits_shift 3
  |  |  ------------------
  ------------------
 1307|       |
 1308|       |    /*********** find ChargeStructure **************/
 1309|    100|    for (i = 0, j = -1; i < cnListNumEl; i++)
  ------------------
  |  Branch (1309:25): [True: 100, False: 0]
  ------------------
 1310|    100|    {
 1311|    100|        if (cnList[i].bits == cn_bits)
  ------------------
  |  Branch (1311:13): [True: 15, False: 85]
  ------------------
 1312|     15|        {
 1313|     15|            j = i;
 1314|     15|            break; /* found */
 1315|     15|        }
 1316|    100|    }
 1317|       |
 1318|     15|    if (j < 0)
  ------------------
  |  Branch (1318:9): [True: 0, False: 15]
  ------------------
 1319|      0|    {
 1320|       |        /* ChargeStructure was not found */
 1321|      0|        if (1 < len_cn_bits_array && len_cn_bits_array + 1 == nNumSelectedStates)
  ------------------
  |  Branch (1321:13): [True: 0, False: 0]
  |  Branch (1321:38): [True: 0, False: 0]
  ------------------
 1322|      0|        {
 1323|       |/* a pair of opposite charges was combined */
 1324|      0|            len_cn_bits_array--;
 1325|      0|            cn_bits_array[len_cn_bits_array] = 0;
 1326|      0|            goto make_cn_bits;
 1327|      0|        }
 1328|      0|        else if (nNumSelectedStates == 4)
  ------------------
  |  Branch (1328:18): [True: 0, False: 0]
  ------------------
 1329|      0|        {
 1330|       |            /* reduce number of states */
 1331|      0|            len_cn_bits_array--;
 1332|      0|            cn_bits_array[len_cn_bits_array] = 0;
 1333|      0|            nNumSelectedStates--;
 1334|      0|            goto make_cn_bits;
 1335|      0|        }
 1336|      0|        return RI_ERR_PROGR; /* charge structure not found */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1337|      0|    }
 1338|       |
 1339|       |    /********** ChargeStructure has been found **********/
 1340|     15|    pVA->cnListIndex = j + 1; /* charge structure index + 1 */
 1341|     15|    pVA->cInitCharge = cnList[j].nInitialCharge;
 1342|       |    /********** Calculate "Free Valence" ****************/
 1343|     15|#if ( ALLOW_METAL_BOND_ZERO == 1 )
 1344|       |
 1345|       |#if ( INIT_METAL_BOND_ZERO == 1 )
 1346|       |    if (pVA->cMetal)
 1347|       |    {
 1348|       |        j = 0;
 1349|       |    }
 1350|       |    else
 1351|       |    {
 1352|       |        j = ChargeVal[0].nValence - cur_chem_valence_fixed;
 1353|       |    }
 1354|       |#else
 1355|     15|    j = ChargeVal[0].nValence - cur_chem_valence_fixed;
 1356|     15|#endif
 1357|       |
 1358|       |#else
 1359|       |    j = ChargeVal[0].nValence - cur_chem_valence_fixed;
 1360|       |#endif
 1361|     15|    if (j < 0)
  ------------------
  |  Branch (1361:9): [True: 0, False: 15]
  ------------------
 1362|      0|    {
 1363|      0|        return RI_ERR_PROGR; /* program error */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1364|      0|    }
 1365|     15|    pVA->cInitFreeValences = j; /* number of initial unsatisfied valences; should be combined with */
 1366|       |                                /* (cap - flow) of vertex=0 in the charge structure[pVA->cnListIndex-1] */
 1367|     15|    return 1; /* success */
 1368|       |
 1369|     15|#undef MIN_ATOM_CHARGE
 1370|     15|#undef MAX_ATOM_CHARGE
 1371|     15|#undef NEUTRAL_STATE
 1372|     15|#undef NUM_ATOM_CHARGES
 1373|     15|#undef MAX_NUM_VALENCES
 1374|     15|}
get_sp_element_type:
 1427|   653k|{
 1428|   653k|    int row = 0, type = 0;
 1429|   653k|    if (nPeriodicNumber == 1)
  ------------------
  |  Branch (1429:9): [True: 0, False: 653k]
  ------------------
 1430|      0|    {
 1431|      0|        type = 1; /* H: 1 */
 1432|      0|        row = 0;
 1433|      0|    }
 1434|   653k|    else if (nPeriodicNumber == 2)
  ------------------
  |  Branch (1434:14): [True: 116, False: 653k]
  ------------------
 1435|    116|    {
 1436|    116|        type = 0; row = 0;
 1437|    116|    }
 1438|   653k|    else if (nPeriodicNumber <= 10)
  ------------------
  |  Branch (1438:14): [True: 769, False: 652k]
  ------------------
 1439|    769|    {
 1440|       |        /* Li: 2, Be: 3, B: 4, C: 5, N: 6, O: 7, F: 8, Ne: 9; later subtract 1 */
 1441|    769|        type = nPeriodicNumber - 1; row = 1;
 1442|    769|    }
 1443|   652k|    else if (nPeriodicNumber <= 18)
  ------------------
  |  Branch (1443:14): [True: 47.4k, False: 604k]
  ------------------
 1444|  47.4k|    {
 1445|  47.4k|        type = nPeriodicNumber - 9; row = 2;
 1446|  47.4k|    }
 1447|   604k|    else if (nPeriodicNumber <= 20)
  ------------------
  |  Branch (1447:14): [True: 1.05k, False: 603k]
  ------------------
 1448|  1.05k|    {
 1449|  1.05k|        type = nPeriodicNumber - 17; row = 3;
 1450|  1.05k|    }
 1451|   603k|    else if (nPeriodicNumber <= 30)
  ------------------
  |  Branch (1451:14): [True: 33.1k, False: 570k]
  ------------------
 1452|  33.1k|    {
 1453|  33.1k|        type = 0; row = 3;
 1454|  33.1k|    }
 1455|   570k|    else if (nPeriodicNumber <= 36)
  ------------------
  |  Branch (1455:14): [True: 537k, False: 33.1k]
  ------------------
 1456|   537k|    {
 1457|   537k|        type = nPeriodicNumber - 27; row = 3;
 1458|   537k|    }
 1459|  33.1k|    else if (nPeriodicNumber <= 38)
  ------------------
  |  Branch (1459:14): [True: 19, False: 33.0k]
  ------------------
 1460|     19|    {
 1461|     19|        type = nPeriodicNumber - 35; row = 4;
 1462|     19|    }
 1463|  33.0k|    else if (nPeriodicNumber <= 48)
  ------------------
  |  Branch (1463:14): [True: 58, False: 33.0k]
  ------------------
 1464|     58|    {
 1465|     58|        type = 0; row = 4;
 1466|     58|    }
 1467|  33.0k|    else if (nPeriodicNumber <= 54)
  ------------------
  |  Branch (1467:14): [True: 607, False: 32.4k]
  ------------------
 1468|    607|    {
 1469|    607|        type = nPeriodicNumber - 45; row = 4;
 1470|    607|    }
 1471|  32.4k|    else if (nPeriodicNumber <= 56)
  ------------------
  |  Branch (1471:14): [True: 19, False: 32.4k]
  ------------------
 1472|     19|    {
 1473|     19|        type = nPeriodicNumber - 53; row = 5;
 1474|     19|    }
 1475|  32.4k|    else if (nPeriodicNumber <= 80)
  ------------------
  |  Branch (1475:14): [True: 244, False: 32.1k]
  ------------------
 1476|    244|    {
 1477|    244|        type = 0; row = 5;
 1478|    244|    }
 1479|  32.1k|    else if (nPeriodicNumber <= 86)
  ------------------
  |  Branch (1479:14): [True: 0, False: 32.1k]
  ------------------
 1480|      0|    {
 1481|      0|        type = nPeriodicNumber - 77; row = 5;
 1482|      0|    }
 1483|  32.1k|    else if (nPeriodicNumber <= 88)
  ------------------
  |  Branch (1483:14): [True: 0, False: 32.1k]
  ------------------
 1484|      0|    {
 1485|      0|        type = nPeriodicNumber - 85; row = 6;
 1486|      0|    }
 1487|  32.1k|    else
 1488|  32.1k|    {
 1489|  32.1k|        type = 0; row = 6;
 1490|  32.1k|    }
 1491|       |
 1492|   653k|    *nRow = row;
 1493|       |
 1494|   653k|    return type == 9 ? 0 : type;
  ------------------
  |  Branch (1494:12): [True: 1, False: 653k]
  ------------------
 1495|   653k|}
ReallocTCGroups:
 1500|    124|{
 1501|    124|    TC_GROUP *pTCGroup = (TC_GROUP *) inchi_malloc( sizeof( pTCGroup[0] )*( pTCGroups->max_tc_groups + nAdd ) );
  ------------------
  |  | 1130|    124|#define inchi_malloc   malloc
  ------------------
 1502|       |
 1503|    124|    if (pTCGroup)
  ------------------
  |  Branch (1503:9): [True: 124, False: 0]
  ------------------
 1504|    124|    {
 1505|    124|        if (pTCGroups->num_tc_groups)
  ------------------
  |  Branch (1505:13): [True: 82, False: 42]
  ------------------
 1506|     82|        {
 1507|     82|            memcpy( pTCGroup, pTCGroups->pTCG, sizeof( pTCGroup[0] )*pTCGroups->num_tc_groups );
 1508|     82|        }
 1509|    124|        memset( pTCGroup + pTCGroups->max_tc_groups, 0, sizeof( pTCGroup[0] )*nAdd );
 1510|    124|        if (pTCGroups->pTCG)
  ------------------
  |  Branch (1510:13): [True: 82, False: 42]
  ------------------
 1511|     82|        {
 1512|     82|            inchi_free( pTCGroups->pTCG );
  ------------------
  |  | 1136|     82|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 82, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1513|     82|        }
 1514|    124|        pTCGroups->pTCG = pTCGroup;
 1515|    124|        pTCGroups->max_tc_groups += nAdd;
 1516|    124|        return 0;
 1517|    124|    }
 1518|       |
 1519|      0|    return RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 1520|    124|}
RegisterTCGroup:
 1526|  2.06k|{
 1527|  2.06k|    int i, ret = 0;
 1528|       |
 1529|       |    /* search */
 1530|   155k|    for (i = 0; i < pTCGroups->num_tc_groups; i++)
  ------------------
  |  Branch (1530:17): [True: 153k, False: 1.43k]
  ------------------
 1531|   153k|    {
 1532|   153k|        if (pTCGroups->pTCG[i].type == nGroupType &&
  ------------------
  |  Branch (1532:13): [True: 153k, False: 135]
  ------------------
 1533|   153k|             pTCGroups->pTCG[i].ord_num == nGroupOrdNum)
  ------------------
  |  Branch (1533:14): [True: 630, False: 153k]
  ------------------
 1534|    630|        {
 1535|    630|            break;
 1536|    630|        }
 1537|   153k|    }
 1538|       |
 1539|  2.06k|    if (i == pTCGroups->num_tc_groups)
  ------------------
  |  Branch (1539:9): [True: 1.43k, False: 630]
  ------------------
 1540|  1.43k|    {
 1541|       |        /* add one more group */
 1542|  1.43k|        if (pTCGroups->num_tc_groups == pTCGroups->max_tc_groups)
  ------------------
  |  Branch (1542:13): [True: 124, False: 1.30k]
  ------------------
 1543|    124|        {
 1544|    124|            ret = ReallocTCGroups( pTCGroups, INC_NUM_TCGROUPS );
  ------------------
  |  |  186|    124|#define INC_NUM_TCGROUPS 16
  ------------------
 1545|    124|            if (ret)
  ------------------
  |  Branch (1545:17): [True: 0, False: 124]
  ------------------
 1546|      0|            {
 1547|      0|                goto exit_function;
 1548|      0|            }
 1549|    124|        }
 1550|       |
 1551|  1.43k|        ret = i + 1; /* added new group */
 1552|  1.43k|        pTCGroups->num_tc_groups++;
 1553|  1.43k|        pTCGroups->pTCG[i].type = nGroupType;
 1554|  1.43k|        pTCGroups->pTCG[i].ord_num = nGroupOrdNum;
 1555|  1.43k|    }
 1556|       |
 1557|  2.06k|    pTCGroups->pTCG[i].num_edges += nNumEdges;
 1558|       |
 1559|  2.06k|    pTCGroups->pTCG[i].st_cap += nVertexCap;
 1560|  2.06k|    pTCGroups->pTCG[i].st_flow += nVertexFlow;
 1561|       |
 1562|  2.06k|    pTCGroups->pTCG[i].edges_cap += nEdgeCap;
 1563|  2.06k|    pTCGroups->pTCG[i].edges_flow += nEdgeFlow;
 1564|       |
 1565|  2.06k|exit_function:
 1566|  2.06k|    return ret;
 1567|  2.06k|}
nTautEndpointEdgeCap:
 1572|    580|{
 1573|       |    /* There are 3 sources of cap-flow = number of unsatisfied valences:
 1574|       |       -----------------------------------------------------------------
 1575|       |       1. pVA[i].cInitFreeValences
 1576|       |       2. pCN[0].v.cap - pCN[0].v.flow
 1577|       |       3. st[i].chem_bonds_valence - SUM(SINGLE, DOUBLE, TRIPLE bond orders)
 1578|       |          Reasons: (a) This sum will not include 'ALTERN' bonds
 1579|       |                   (b) until now at[i].chem_bonds_valence was used as a
 1580|       |                       number of satisfied valences. In case of adjacent
 1581|       |                       stereobonds marked as BOND_TYPE_ALTERN the value of
 1582|       |                       at[i].chem_bonds_valence may be = at[i].valence+1.
 1583|       |       4. Since tautomerism is defined for a neutral atom, do not add
 1584|       |          initial flows from the atom to the ChargeStruct
 1585|       |          CORRECTION: tautomeric endpoints do not have ChargeStruct.
 1586|       |
 1587|       |     */
 1588|    580|    int j, k, nEdgeCap, bonds_valence, stereo_bond_excess_valence;
 1589|    580|    MY_CONST C_NODE *pCN = pVA[i].cnListIndex > 0 ? cnList[pVA[i].cnListIndex - 1].pCN : NULL;
  ------------------
  |  |  296|    580|#define MY_CONST  const
  ------------------
  |  Branch (1589:28): [True: 0, False: 580]
  ------------------
 1590|       |
 1591|       |
 1592|       |    /* 1: free valences to reach the minimum known atom valence */
 1593|    580|    nEdgeCap = pVA[i].cInitFreeValences;
 1594|       |
 1595|       |    /* 2: atom free valence in the ChargeStruct */
 1596|    580|    if (pCN)
  ------------------
  |  Branch (1596:9): [True: 0, False: 580]
  ------------------
 1597|      0|    {
 1598|      0|        nEdgeCap += pCN[0].v.cap - pCN[0].v.flow; /* normally should not happen */
 1599|      0|    }
 1600|       |
 1601|       |    /* 3: atom free valence due to known from stereochemistry stereogenic bond types */
 1602|       |    /*
 1603|       |    for ( j = 0, bonds_valence = 0; j < at[i].valence; j ++ )
 1604|       |    {
 1605|       |        if ( at[i].bond_type[j] <= BOND_TYPE_TRIPLE )
 1606|       |        {
 1607|       |            bonds_valence += at[i].bond_type[j];
 1608|       |        }
 1609|       |    }
 1610|       |    */
 1611|       |
 1612|       |    /* bonds > SINGLE are assumed fixed stereobonds; fixed bond cannot increase t-group edge flow */
 1613|    580|    for (stereo_bond_excess_valence = 0, j = 0; j < MAX_NUM_STEREO_BONDS && at[i].sb_parity[j]; j++)
  ------------------
  |  |  876|  1.16k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (1613:49): [True: 580, False: 0]
  |  Branch (1613:77): [True: 0, False: 580]
  ------------------
 1614|      0|    {
 1615|      0|        k = at[i].sb_ord[j];
 1616|      0|        if (at[i].bond_type[k] < BOND_TYPE_TRIPLE)
  ------------------
  |  |   62|      0|#define BOND_TYPE_TRIPLE    3
  ------------------
  |  Branch (1616:13): [True: 0, False: 0]
  ------------------
 1617|      0|        {
 1618|      0|            stereo_bond_excess_valence += at[i].bond_type[k] - BOND_TYPE_SINGLE;
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
 1619|      0|        }
 1620|      0|    }
 1621|       |
 1622|       |    /*
 1623|       |    bonds_valence = (at[i].chem_bonds_valence - bonds_valence) + (bonds_valence -at[i].valence - stereo_bond_excess_valence);
 1624|       |    */
 1625|    580|    bonds_valence = ( at[i].chem_bonds_valence - at[i].valence ) - stereo_bond_excess_valence;
 1626|       |
 1627|       |
 1628|       |    /*---- add 1, 2, 3 ----*/
 1629|    580|    if (bonds_valence >= 0)
  ------------------
  |  Branch (1629:9): [True: 580, False: 0]
  ------------------
 1630|    580|    {
 1631|    580|        nEdgeCap += bonds_valence;
 1632|    580|    }
 1633|      0|    else
 1634|      0|    {
 1635|      0|        nEdgeCap = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1636|      0|    }
 1637|       |
 1638|    580|    return nEdgeCap;
 1639|    580|}
BondFlowMaxcapMinorder:
 1695|    454|{
 1696|       |
 1697|    454|    int nFlow, nMaxcap, nMinorder, nInitorder, bNeedsFlower = 0;
 1698|    454|    inp_ATOM *at = atom + iat;
 1699|    454|    int       neigh = at->neighbor[ineigh];
 1700|    454|    int       bond_type = at->bond_type[ineigh] & BOND_TYPE_MASK;
  ------------------
  |  |  217|    454|#define BOND_TYPE_MASK        0x0f
  ------------------
 1701|    454|    int       nMetal = ( 0 != pVA[iat].cMetal ) + ( 0 != pVA[neigh].cMetal );
 1702|    454|    int       nEndpoint = ( 0 != at->endpoint ) + ( 0 != atom[neigh].endpoint );
 1703|    454|    int       nStereo = ( at->p_parity || at->sb_parity[0] ) + ( atom[neigh].p_parity || atom[neigh].sb_parity[0] );
  ------------------
  |  Branch (1703:27): [True: 0, False: 454]
  |  Branch (1703:43): [True: 0, False: 454]
  |  Branch (1703:66): [True: 0, False: 454]
  |  Branch (1703:90): [True: 0, False: 454]
  ------------------
 1704|       |
 1705|    454|    if (bond_type > BOND_TYPE_TRIPLE)
  ------------------
  |  |   62|    454|#define BOND_TYPE_TRIPLE    3
  ------------------
  |  Branch (1705:9): [True: 0, False: 454]
  ------------------
 1706|      0|    {
 1707|      0|        bond_type = BOND_TYPE_SINGLE;
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
 1708|      0|    }
 1709|       |
 1710|       |    /* M=metal, A=non-metal atom, e=endpoint */
 1711|    454|    if (nStereo && pSrm->bFixStereoBonds || !nMetal || !pSrm->bMetalAddFlower)
  ------------------
  |  Branch (1711:9): [True: 0, False: 454]
  |  Branch (1711:20): [True: 0, False: 0]
  |  Branch (1711:45): [True: 454, False: 0]
  |  Branch (1711:56): [True: 0, False: 0]
  ------------------
 1712|    454|    {
 1713|       |        /* atom-atom rules, no metal atoms involved (1: A-A, A-Ae, Ae-Ae) */
 1714|    454|        nMinorder = BOND_TYPE_SINGLE;
  ------------------
  |  |   60|    454|#define BOND_TYPE_SINGLE    1
  ------------------
 1715|    454|        nInitorder = bond_type;
 1716|    454|        nFlow = nInitorder - nMinorder;
 1717|    454|    }
 1718|      0|    else if (nMetal && !nEndpoint)
  ------------------
  |  Branch (1718:14): [True: 0, False: 0]
  |  Branch (1718:24): [True: 0, False: 0]
  ------------------
 1719|      0|    {
 1720|       |        /* M-a, M-M */
 1721|       |        /* atom - metal or metal-metal, none of them is an endpoint (2: M-M, M-A) */
 1722|      0|        nMinorder = pSrm->nMetalMinBondOrder;
 1723|      0|        nInitorder = pSrm->nMetalInitBondOrder + bond_type - BOND_TYPE_SINGLE;
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
 1724|      0|        nFlow = nInitorder - nMinorder;
 1725|      0|        if (!pSrm->nMetalInitEdgeFlow &&
  ------------------
  |  Branch (1725:13): [True: 0, False: 0]
  ------------------
 1726|      0|             pSrm->nMetalInitBondOrder > pSrm->nMetalMinBondOrder &&
  ------------------
  |  Branch (1726:14): [True: 0, False: 0]
  ------------------
 1727|      0|             nFlow > 0)
  ------------------
  |  Branch (1727:14): [True: 0, False: 0]
  ------------------
 1728|      0|        {
 1729|       |            /* reduce initial flow by 1 and increase st_cap on metal by 1 */
 1730|      0|            nFlow--;
 1731|      0|        }
 1732|      0|        bNeedsFlower = ( 0 != pVA[iat].cMetal );
 1733|      0|    }
 1734|      0|    else
 1735|      0|        if (pVA[iat].cMetal && !at->endpoint && !pVA[neigh].cMetal && atom[neigh].endpoint ||
  ------------------
  |  Branch (1735:13): [True: 0, False: 0]
  |  Branch (1735:32): [True: 0, False: 0]
  |  Branch (1735:49): [True: 0, False: 0]
  |  Branch (1735:71): [True: 0, False: 0]
  ------------------
 1736|      0|             pVA[neigh].cMetal && !atom[neigh].endpoint && !pVA[iat].cMetal   && at->endpoint)
  ------------------
  |  Branch (1736:14): [True: 0, False: 0]
  |  Branch (1736:35): [True: 0, False: 0]
  |  Branch (1736:60): [True: 0, False: 0]
  |  Branch (1736:82): [True: 0, False: 0]
  ------------------
 1737|      0|        {
 1738|       |            /* M-ae */
 1739|       |            /* metal connected to a non-metal endpoint (3: M-Ae) */
 1740|      0|            nMinorder = pSrm->nMetal2EndpointMinBondOrder;
 1741|      0|            nInitorder = pSrm->nMetal2EndpointInitBondOrder + bond_type - BOND_TYPE_SINGLE;
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
 1742|      0|            nFlow = nInitorder - nMinorder;
 1743|      0|            if (!pSrm->nMetal2EndpointInitEdgeFlow &&
  ------------------
  |  Branch (1743:17): [True: 0, False: 0]
  ------------------
 1744|      0|                 pSrm->nMetal2EndpointInitBondOrder > pSrm->nMetal2EndpointMinBondOrder &&
  ------------------
  |  Branch (1744:18): [True: 0, False: 0]
  ------------------
 1745|      0|                 nFlow > 0)
  ------------------
  |  Branch (1745:18): [True: 0, False: 0]
  ------------------
 1746|      0|            {
 1747|       |                /* reduce initial flow by 1 and increase st_cap on metal by 1 */
 1748|      0|                nFlow--;
 1749|      0|            }
 1750|      0|            bNeedsFlower = ( 0 != pVA[iat].cMetal );
 1751|      0|        }
 1752|      0|        else
 1753|      0|        {
 1754|       |            /* endpoint is metal => no flower (4: M-Me, Me-Me, Me-A, Me-Ae) */
 1755|      0|            nMinorder = pSrm->nMetal2EndpointMinBondOrder;
 1756|      0|            nInitorder = pSrm->nMetal2EndpointInitBondOrder + bond_type - BOND_TYPE_SINGLE;
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
 1757|      0|            nFlow = nInitorder - nMinorder;
 1758|      0|            if (!pSrm->nMetal2EndpointInitEdgeFlow &&
  ------------------
  |  Branch (1758:17): [True: 0, False: 0]
  ------------------
 1759|      0|                 pSrm->nMetal2EndpointInitBondOrder > pSrm->nMetal2EndpointMinBondOrder &&
  ------------------
  |  Branch (1759:18): [True: 0, False: 0]
  ------------------
 1760|      0|                 nFlow > 0)
  ------------------
  |  Branch (1760:18): [True: 0, False: 0]
  ------------------
 1761|      0|            {
 1762|       |/* reduce initial flow by 1 and increase st_cap on metal by 1 */
 1763|      0|                nFlow--;
 1764|      0|            }
 1765|      0|            bNeedsFlower = ( pVA[iat].cMetal && !at->endpoint );
  ------------------
  |  Branch (1765:30): [True: 0, False: 0]
  |  Branch (1765:49): [True: 0, False: 0]
  ------------------
 1766|      0|        }
 1767|       |
 1768|    454|    nMaxcap = BOND_TYPE_TRIPLE - nMinorder;
  ------------------
  |  |   62|    454|#define BOND_TYPE_TRIPLE    3
  ------------------
 1769|    454|    if (pnMaxcap)
  ------------------
  |  Branch (1769:9): [True: 78, False: 376]
  ------------------
 1770|     78|    {
 1771|     78|        *pnMaxcap = nMaxcap;
 1772|     78|    }
 1773|    454|    if (pnMinorder)
  ------------------
  |  Branch (1773:9): [True: 454, False: 0]
  ------------------
 1774|    454|    {
 1775|    454|        *pnMinorder = nMinorder;
 1776|    454|    }
 1777|    454|    if (pbNeedsFlower)
  ------------------
  |  Branch (1777:9): [True: 66, False: 388]
  ------------------
 1778|     66|    {
 1779|     66|        *pbNeedsFlower = bNeedsFlower;
 1780|     66|    }
 1781|       |
 1782|    454|    return nFlow;
 1783|    454|}
AtomStcapStflow:
 1789|  3.68k|{
 1790|  3.68k|    int ineigh, bFlower;
 1791|  3.68k|    int nStflow = 0, nMaxBondCap, nMinBondOrder, bNeedsFlower = 0;
 1792|  3.68k|    int valence = atom[iat].valence;
 1793|  3.68k|    int nStcap = atom[iat].chem_bonds_valence;
 1794|  3.68k|    int nMGroupEdgeCap = 0, nMGroupEdgeFlow = 0, nFlow;
 1795|       |
 1796|  3.68k|    if (pSrm->bMetalAddFlower)
  ------------------
  |  Branch (1796:9): [True: 3.68k, False: 0]
  ------------------
 1797|  3.68k|    {
 1798|  3.68k|        nStcap -= pVA[iat].cInitOrigValenceToMetal - pVA[iat].cInitValenceToMetal;
 1799|  3.68k|    }
 1800|       |
 1801|  3.74k|    for (ineigh = 0; ineigh < valence; ineigh++)
  ------------------
  |  Branch (1801:22): [True: 66, False: 3.68k]
  ------------------
 1802|     66|    {
 1803|     66|        nFlow = BondFlowMaxcapMinorder( atom, pVA, pSrm, iat, ineigh, &nMaxBondCap, &nMinBondOrder, &bFlower );
 1804|     66|        nStflow += nFlow;
 1805|     66|        nStcap -= nMinBondOrder;
 1806|     66|        if (bFlower)
  ------------------
  |  Branch (1806:13): [True: 0, False: 66]
  ------------------
 1807|      0|        {
 1808|      0|            bNeedsFlower++;
 1809|      0|            nMGroupEdgeFlow += nFlow;
 1810|      0|            nMGroupEdgeCap += BOND_TYPE_TRIPLE - nMinBondOrder + pSrm->nMetalMaxCharge_D;
  ------------------
  |  |   62|      0|#define BOND_TYPE_TRIPLE    3
  ------------------
 1811|      0|        }
 1812|     66|    }
 1813|       |
 1814|  3.68k|    if (pnStcap)
  ------------------
  |  Branch (1814:9): [True: 3.68k, False: 0]
  ------------------
 1815|  3.68k|    {
 1816|  3.68k|        *pnStcap = bNeedsFlower ? nStflow : nStcap; /* initially, metal atoms are not radicals */
  ------------------
  |  Branch (1816:20): [True: 0, False: 3.68k]
  ------------------
 1817|  3.68k|    }
 1818|  3.68k|    if (pnStflow)
  ------------------
  |  Branch (1818:9): [True: 3.68k, False: 0]
  ------------------
 1819|  3.68k|    {
 1820|  3.68k|        *pnStflow = nStflow;
 1821|  3.68k|    }
 1822|  3.68k|    if (pnMGroupEdgeFlow)
  ------------------
  |  Branch (1822:9): [True: 0, False: 3.68k]
  ------------------
 1823|      0|    {
 1824|      0|        *pnMGroupEdgeFlow = nMGroupEdgeCap - nMGroupEdgeFlow;
 1825|      0|    }
 1826|  3.68k|    if (pnMGroupEdgeCap)
  ------------------
  |  Branch (1826:9): [True: 0, False: 3.68k]
  ------------------
 1827|      0|    {
 1828|      0|        *pnMGroupEdgeCap = nMGroupEdgeCap;
 1829|      0|    }
 1830|       |
 1831|  3.68k|    return bNeedsFlower; /* number of variable bonds to metal */
 1832|  3.68k|}
nCountBnsSizes:
 1869|    840|{
 1870|    840|    int i, j, n, k, ret = 0, nBonds, nOtherEdges, nVertices, bMetalAtoms, bNeedsFlower;
 1871|    840|    int nTgroupEdges, nTgroupEdgesFromTg, nTotNegChargInTgroups, cap, flow;
 1872|    840|    MY_CONST C_NODE *pCN = NULL;
  ------------------
  |  |  296|    840|#define MY_CONST  const
  ------------------
 1873|    840|    nVertices = nBonds = nOtherEdges = nTgroupEdges = nTgroupEdgesFromTg = nTotNegChargInTgroups = 0;
 1874|       |
 1875|       |    /* count metal atoms and electrons */
 1876|   654k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (1876:17): [True: 653k, False: 840]
  ------------------
 1877|   653k|    {
 1878|   653k|        pTCGroups->num_metal_atoms += ( pVA[i].cMetal != 0 );
 1879|   653k|        pTCGroups->num_metal_bonds += pVA[i].cNumBondsToMetal;
 1880|   653k|        pTCGroups->total_electrons += at[i].el_number;
 1881|   653k|        pTCGroups->total_electrons_metals += pVA[i].cMetal ? at[i].el_number : 0;
  ------------------
  |  Branch (1881:46): [True: 66.7k, False: 586k]
  ------------------
 1882|   653k|    }
 1883|    840|    pTCGroups->total_electrons -= pTCGroups->total_charge;
 1884|    840|    pTCGroups->num_metal_bonds /= 2;
 1885|       |
 1886|       |    /* register tautomeric groups */
 1887|  2.25k|    for (i = 0; i < ti->num_t_groups; i++)
  ------------------
  |  Branch (1887:17): [True: 1.41k, False: 840]
  ------------------
 1888|  1.41k|    {
 1889|  1.41k|        ret = RegisterTCGroup( pTCGroups,
 1890|  1.41k|                               BNS_VERT_TYPE_TGROUP,
  ------------------
  |  |   75|  1.41k|#define BNS_VERT_TYPE_TGROUP        0x0004
  ------------------
 1891|  1.41k|                               ti->t_group[i].nGroupNumber,
 1892|  1.41k|                               ti->t_group[i].num[0] /* st_cap */,
 1893|  1.41k|                               0 /* st_flow */,
 1894|  1.41k|                               0 /* edge cap */,
 1895|  1.41k|                               0 /* edge flow */,
 1896|  1.41k|                               ti->t_group[i].nNumEndpoints /* num Edges */
 1897|  1.41k|        );
 1898|  1.41k|        if (ret < 0)
  ------------------
  |  Branch (1898:13): [True: 0, False: 1.41k]
  ------------------
 1899|      0|        {
 1900|      0|            goto exit_function;
 1901|      0|        }
 1902|       |
 1903|       |        /* edges to tautomeric groups */
 1904|  1.41k|        nOtherEdges += ti->t_group[i].nNumEndpoints;
 1905|  1.41k|        nTgroupEdgesFromTg += ti->t_group[i].nNumEndpoints;
 1906|       |        /* total negative charge in t-groups */
 1907|  1.41k|        nTotNegChargInTgroups += ti->t_group[i].num[1];
 1908|  1.41k|        if (ret > 0)
  ------------------
  |  Branch (1908:13): [True: 1.41k, False: 0]
  ------------------
 1909|  1.41k|        {
 1910|       |            /* should always happen since this is the first time this t-group is added */
 1911|  1.41k|            j = ret - 1;
 1912|  1.41k|            pTCGroups->pTCG[j].tg_num_H = ti->t_group[i].num[0] - ti->t_group[i].num[1];
 1913|  1.41k|            pTCGroups->pTCG[j].tg_num_Minus = ti->t_group[i].num[1];
 1914|  1.41k|        }
 1915|  1.41k|    }
 1916|       |
 1917|    840|    bMetalAtoms = 0;
 1918|       |
 1919|  1.48k|repeat_for_metals:
 1920|       |
 1921|       |    /* count vertices and register ChargeValence groups */
 1922|       |    /* for now an atom may belong either to a t-group or to a ChargeValence group, but not to both */
 1923|   722k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (1923:17): [True: 720k, False: 1.48k]
  ------------------
 1924|   720k|    {
 1925|       |        /* number of bonds */
 1926|   720k|        nBonds += at[i].valence;
 1927|       |        /* Process ChargeStruct vertices and edges */
 1928|   720k|        if (pVA[i].cnListIndex)
  ------------------
  |  Branch (1928:13): [True: 15, False: 720k]
  ------------------
 1929|     15|        {
 1930|       |            /* count vertices & edges in the ChargeValence Substructure attached to an atom */
 1931|       |            /* Important: unlike inp_ATOM, each edge e appears in pCN[*].e[*] only ONE time */
 1932|     15|            int     len = cnList[j = pVA[i].cnListIndex - 1].len;
 1933|     15|            int     bits = cnList[j].bits;
 1934|     15|            int     type, neigh_type, metal_group_number;
 1935|     15|            pCN = cnList[j].pCN;
 1936|       |
 1937|       |            /* first process all non-metals, after that -- all metals */
 1938|     15|            if (( bits != cn_bits_Me ) != !bMetalAtoms)
  ------------------
  |  |  468|     15|#define cn_bits_Me (-1)
  ------------------
  |  Branch (1938:17): [True: 0, False: 15]
  ------------------
 1939|      0|            {
 1940|      0|                continue;
 1941|      0|            }
 1942|     15|            metal_group_number = 0;
 1943|     73|            for (j = 0; j < len; j++)
  ------------------
  |  Branch (1943:25): [True: 58, False: 15]
  ------------------
 1944|     58|            {
 1945|     58|                type = pCN[j].v.type; /* ChargeStruct vertex type: atom is the first, c-groups are last */
 1946|       |
 1947|       |                /* process all pCN[j] neighbors */
 1948|    103|                for (k = 0; k < MAX_CN_VAL && ( n = pCN[j].e[k].neigh ); k++)
  ------------------
  |  |  425|    206|#define MAX_CN_VAL 3
  ------------------
  |  Branch (1948:29): [True: 103, False: 0]
  |  Branch (1948:47): [True: 45, False: 58]
  ------------------
 1949|     45|                {
 1950|     45|                    nOtherEdges++;  /* edges inside ChargeStruct */
 1951|     45|                    n--; /* neighbor vertex position inside cnList[j].pCN */
 1952|     45|                    neigh_type = pCN[n].v.type; /* type of the neighboring atom */
 1953|       |
 1954|     45|                    if (IS_BNS_VT_C_GR( neigh_type ))
  ------------------
  |  |  106|     45|#define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   99|     45|#define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|     45|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  |  |  ------------------
  |  |  |  |               #define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|     45|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   77|     45|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  |  |  |  Branch (106:37): [True: 25, False: 20]
  |  |  ------------------
  ------------------
 1955|     25|                    {
 1956|       |                        /* register this edge to a CN-group vertex */
 1957|     25|                        cap = !bMetalAtoms ? pCN[j].e[k].cap : pCN[j].e[k].cap ? pSrm->nMetalMaxCharge_D : 0;
  ------------------
  |  Branch (1957:31): [True: 25, False: 0]
  |  Branch (1957:64): [True: 0, False: 0]
  ------------------
 1958|     25|                        flow = !bMetalAtoms ? pCN[j].e[k].flow : pCN[j].e[k].flow ? pSrm->nMetalMaxCharge_D : 0;
  ------------------
  |  Branch (1958:32): [True: 25, False: 0]
  |  Branch (1958:66): [True: 0, False: 0]
  ------------------
 1959|       |
 1960|     25|                        ret = RegisterTCGroup( pTCGroups,
 1961|     25|                                               neigh_type,
 1962|     25|                                               0 /* ord_num*/,
 1963|     25|                                               0 /* st_cap */,
 1964|     25|                                               0 /* st_flow */,
 1965|     25|                                               cap /* edge cap*/,
 1966|     25|                                               flow /* edge flow */,
 1967|     25|                                               1 /* nNumEdges*/ );
 1968|     25|                        if (ret < 0)
  ------------------
  |  Branch (1968:29): [True: 0, False: 25]
  ------------------
 1969|      0|                        {
 1970|      0|                            goto exit_function;
 1971|      0|                        }
 1972|     25|                        if (ret > 0)
  ------------------
  |  Branch (1972:29): [True: 12, False: 13]
  ------------------
 1973|     12|                        {
 1974|       |                            /* the group has just been created; add one more edge to (+/-) or supergroup */
 1975|     12|                            ret = RegisterTCGroup( pTCGroups,
 1976|     12|                                                   neigh_type,
 1977|     12|                                                   0 /* ord_num*/,
 1978|     12|                                                   0 /* st_cap */,
 1979|     12|                                                   0 /* st_flow */,
 1980|     12|                                                   0 /* edge cap*/,
 1981|     12|                                                   0/* edge flow*/,
 1982|     12|                                                   1 /* nNumEdges*/ );
 1983|     12|                            if (ret < 0)
  ------------------
  |  Branch (1983:33): [True: 0, False: 12]
  ------------------
 1984|      0|                            {
 1985|      0|                                goto exit_function;
 1986|      0|                            }
 1987|     12|                            nOtherEdges++;
 1988|     12|                        }
 1989|     25|                    }
 1990|       |
 1991|     45|                    if (IS_BNS_VT_C_GR( type ))
  ------------------
  |  |  106|     45|#define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   99|     45|#define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|     45|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  |  |  ------------------
  |  |  |  |               #define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|     45|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   77|     45|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  |  |  |  Branch (106:37): [True: 0, False: 45]
  |  |  ------------------
  ------------------
 1992|      0|                    {
 1993|       |                        /* register this edge to a CN-group vertex; normally this does not happen */
 1994|       |
 1995|      0|                        cap = !bMetalAtoms ? pCN[j].e[k].cap : pCN[j].e[k].cap ? pSrm->nMetalMaxCharge_D : 0;
  ------------------
  |  Branch (1995:31): [True: 0, False: 0]
  |  Branch (1995:64): [True: 0, False: 0]
  ------------------
 1996|      0|                        flow = !bMetalAtoms ? pCN[j].e[k].flow : pCN[j].e[k].flow ? pSrm->nMetalMaxCharge_D : 0;
  ------------------
  |  Branch (1996:32): [True: 0, False: 0]
  |  Branch (1996:66): [True: 0, False: 0]
  ------------------
 1997|       |
 1998|      0|                        ret = RegisterTCGroup( pTCGroups, type, 0 /* ord_num*/,
 1999|      0|                                               0 /* st_cap */, 0 /* st_flow */,
 2000|      0|                                               cap /* edge cap*/, flow /* edge flow */, 1 /* nNumEdges*/ );
 2001|      0|                        if (ret < 0)
  ------------------
  |  Branch (2001:29): [True: 0, False: 0]
  ------------------
 2002|      0|                        {
 2003|      0|                            goto exit_function;
 2004|      0|                        }
 2005|      0|                        if (ret > 0)
  ------------------
  |  Branch (2005:29): [True: 0, False: 0]
  ------------------
 2006|      0|                        {
 2007|       |                            /* the group has just been created; add one more edge to (+/-) or supergroup */
 2008|      0|                            ret = RegisterTCGroup( pTCGroups, type, 0 /* ord_num*/,
 2009|      0|                                                   0 /* st_cap */, 0 /* st_flow */,
 2010|      0|                                                   0 /* edge cap*/, 0/* edge flow*/, 1 /* nNumEdges*/ );
 2011|      0|                            if (ret < 0)
  ------------------
  |  Branch (2011:33): [True: 0, False: 0]
  ------------------
 2012|      0|                            {
 2013|      0|                                goto exit_function;
 2014|      0|                            }
 2015|      0|                            nOtherEdges++;
 2016|      0|                        }
 2017|      0|                    }
 2018|     45|                } /* end of the current vertex pCN[j] neighbors */
 2019|       |
 2020|       |                /* process  pCN[j] vertex */
 2021|       |
 2022|     58|                if (type & BNS_VERT_TYPE_ATOM)
  ------------------
  |  |   73|     58|#define BNS_VERT_TYPE_ATOM          0x0001
  ------------------
  |  Branch (2022:21): [True: 15, False: 43]
  ------------------
 2023|     15|                {
 2024|     15|                    continue;  /* do not count regular atoms here */
 2025|     15|                }
 2026|     43|                if (IS_BNS_VT_CHRG_STRUCT( type ))
  ------------------
  |  |  110|     43|#define IS_BNS_VT_CHRG_STRUCT(X)    (((X) & BNS_VERT_TYPE__AUX) &&  ((X) & BNS_VERT_TYPE_TEMP))
  |  |  ------------------
  |  |  |  |   81|     43|#define BNS_VERT_TYPE__AUX          0x0080  /* vertex added to build charge substructures */
  |  |  ------------------
  |  |               #define IS_BNS_VT_CHRG_STRUCT(X)    (((X) & BNS_VERT_TYPE__AUX) &&  ((X) & BNS_VERT_TYPE_TEMP))
  |  |  ------------------
  |  |  |  |   79|     18|#define BNS_VERT_TYPE_TEMP          0x0040
  |  |  ------------------
  |  |  |  Branch (110:38): [True: 18, False: 25]
  |  |  |  Branch (110:69): [True: 18, False: 0]
  |  |  ------------------
  ------------------
 2027|     18|                {
 2028|     18|                    nVertices++;
 2029|     18|                    continue;
 2030|     18|                }
 2031|       |
 2032|     25|                if (pSrm->bMetalAddFlower && IS_BNS_VT_M_GR( type ))
  ------------------
  |  |  108|     25|#define IS_BNS_VT_M_GR(X)           ((X) == BNS_VERT_TYPE_METAL_GR )  /* metal flower base or vertices */
  |  |  ------------------
  |  |  |  |   85|     25|#define BNS_VERT_TYPE_METAL_GR      0x0800  /* metal atom group; may be used alone or with BNS_VT_M_POS, BNS_VT_M_NEG */
  |  |  ------------------
  |  |  |  Branch (108:37): [True: 0, False: 25]
  |  |  ------------------
  ------------------
  |  Branch (2032:21): [True: 25, False: 0]
  ------------------
 2033|      0|                {
 2034|       |                    /* special treatment: flow and cap are known as well as structure */
 2035|       |                    /* initial bond valence to metal is either 0 or 1 */
 2036|      0|                    EdgeFlow nEdgeFlow, nEdgeCap;
 2037|       |
 2038|      0|                    bNeedsFlower = AtomStcapStflow( at, pVA, pSrm, i, NULL /*pnStcap*/, NULL /*pnStflow*/,
 2039|      0|                                                    &nEdgeCap, &nEdgeFlow );
 2040|      0|                    if (!bNeedsFlower)
  ------------------
  |  Branch (2040:25): [True: 0, False: 0]
  ------------------
 2041|      0|                    {
 2042|      0|                        ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 2043|      0|                        goto exit_function;
 2044|      0|                    }
 2045|       |                    /*
 2046|       |                    GetAtomToMCGroupInitEdgeCapFlow( &nEdgeCap, &nEdgeFlow, pSrm, at,  pVA, i );
 2047|       |                    GetAtomToMCGroupInitEdgeCapFlow( &nEdgeCap, &nEdgeFlow, pSrm );
 2048|       |                    */
 2049|       |                    /* the 1st is the flower base */
 2050|       |                    /* atom - G0 edge and G0 vertex */
 2051|      0|                    ret = RegisterTCGroup( pTCGroups,
 2052|      0|                                           type,
 2053|      0|                                           0 /* ord_num*/,
 2054|       |                                           /*pVA[i].cInitFreeValences*/
 2055|      0|                                           0 /* st_cap */,
 2056|      0|                                           0 /* st_flow */,
 2057|      0|                                           (int) nEdgeCap,
 2058|      0|                                           (int) nEdgeFlow,
 2059|      0|                                           1 /* nNumEdges*/ );
 2060|      0|                    if (ret < 0)
  ------------------
  |  Branch (2060:25): [True: 0, False: 0]
  ------------------
 2061|      0|                    {
 2062|      0|                        goto exit_function;
 2063|      0|                    }
 2064|       |                    /* count edge atom-G0 */
 2065|      0|                    nOtherEdges++;
 2066|      0|                    if (ret > 0)
  ------------------
  |  Branch (2066:25): [True: 0, False: 0]
  ------------------
 2067|      0|                    {
 2068|       |                        /* first time registration: add G0-G1 and G0-G2 edges to G0 */
 2069|       |
 2070|      0|                        ret = RegisterTCGroup( pTCGroups,
 2071|      0|                                               type,
 2072|      0|                                               0 /* ord_num*/,
 2073|      0|                                               0 /* st_cap */,
 2074|      0|                                               0 /* st_flow */,
 2075|      0|                                               0,/* edge cap*/
 2076|      0|                                               0 /*edge flow*/,
 2077|      0|                                               2 /* nNumEdges*/ );
 2078|       |
 2079|      0|                        if (ret < 0)
  ------------------
  |  Branch (2079:29): [True: 0, False: 0]
  ------------------
 2080|      0|                        {
 2081|      0|                            goto exit_function;
 2082|      0|                        }
 2083|       |
 2084|       |                        /* first time registration: add G1; it has 3 edges */
 2085|       |
 2086|      0|                        ret = RegisterTCGroup( pTCGroups,
 2087|      0|                                               type,
 2088|      0|                                               1 /* ord_num*/,
 2089|      0|                                               0 /* st_cap */,
 2090|      0|                                               0 /* st_flow */,
 2091|      0|                                               0,/* edge cap*/
 2092|      0|                                               0 /*edge flow*/,
 2093|      0|                                               3 /* nNumEdges*/ );
 2094|       |
 2095|      0|                        if (ret <= 0)
  ------------------
  |  Branch (2095:29): [True: 0, False: 0]
  ------------------
 2096|      0|                        {
 2097|      0|                            ret = !ret ? RI_ERR_PROGR : ret;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  |  Branch (2097:35): [True: 0, False: 0]
  ------------------
 2098|      0|                            goto exit_function;
 2099|      0|                        }
 2100|       |
 2101|       |                        /* first time registration: add G2; it has 3 edges */
 2102|       |
 2103|      0|                        ret = RegisterTCGroup( pTCGroups,
 2104|      0|                                               type,
 2105|      0|                                               2 /* ord_num*/,
 2106|      0|                                               0 /* st_cap */,
 2107|      0|                                               0 /* st_flow */,
 2108|      0|                                               0,/* edge cap*/
 2109|      0|                                               0 /*edge flow*/,
 2110|      0|                                               3 /* nNumEdges*/ );
 2111|       |
 2112|      0|                        if (ret <= 0)
  ------------------
  |  Branch (2112:29): [True: 0, False: 0]
  ------------------
 2113|      0|                        {
 2114|      0|                            ret = !ret ? RI_ERR_PROGR : ret;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  |  Branch (2114:35): [True: 0, False: 0]
  ------------------
 2115|      0|                            goto exit_function;
 2116|      0|                        }
 2117|       |
 2118|       |                        /* first time registration: add G3; it has 2 edges */
 2119|       |
 2120|      0|                        ret = RegisterTCGroup( pTCGroups,
 2121|      0|                                               type,
 2122|      0|                                               3 /* ord_num*/,
 2123|      0|                                               0 /* st_cap */,
 2124|      0|                                               0 /* st_flow */,
 2125|      0|                                               0,/* edge cap*/
 2126|      0|                                               0 /*edge flow*/,
 2127|      0|                                               2 /* nNumEdges*/ );
 2128|       |
 2129|      0|                        if (ret <= 0)
  ------------------
  |  Branch (2129:29): [True: 0, False: 0]
  ------------------
 2130|      0|                        {
 2131|      0|                            ret = !ret ? RI_ERR_PROGR : ret;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  |  Branch (2131:35): [True: 0, False: 0]
  ------------------
 2132|      0|                            goto exit_function;
 2133|      0|                        }
 2134|       |                        /* count added metal flower vertices: G0, G1, G2, G3 */
 2135|      0|                        nVertices += 4;
 2136|       |                        /* count added metal flower edges: C0-C1, C0-C2, C1-C2, C1-C3, C2-C3 */
 2137|      0|                        nOtherEdges += 5;
 2138|       |                        /* add connections of G0 to G1 and G2 */
 2139|      0|                    }
 2140|      0|                    continue;
 2141|      0|                }
 2142|       |
 2143|     25|                nVertices++; /* count BNS_VT_C_POS* types; all contain BNS_VERT_TYPE_C_GROUP bit */
 2144|     25|                if (!IS_BNS_VT_C_GR( type ))
  ------------------
  |  |  106|     25|#define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   99|     25|#define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|     25|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  |  |  ------------------
  |  |  |  |               #define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|     25|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   77|     25|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  ------------------
  |  Branch (2144:21): [True: 0, False: 25]
  ------------------
 2145|      0|                {  /* check */
 2146|      0|                    ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 2147|      0|                    goto exit_function;
 2148|      0|                }
 2149|       |                /* add st_cap and st_flow for a charge group */
 2150|     25|                cap = !bMetalAtoms ? pCN[j].v.cap : pCN[j].v.cap ? pSrm->nMetalMaxCharge_D : 0;
  ------------------
  |  Branch (2150:23): [True: 25, False: 0]
  |  Branch (2150:53): [True: 0, False: 0]
  ------------------
 2151|     25|                flow = !bMetalAtoms ? pCN[j].v.flow : pCN[j].v.flow ? pSrm->nMetalMaxCharge_D : 0;
  ------------------
  |  Branch (2151:24): [True: 25, False: 0]
  |  Branch (2151:55): [True: 0, False: 0]
  ------------------
 2152|       |
 2153|     25|                ret = RegisterTCGroup( pTCGroups, type, 0 /* ord_num*/,
 2154|     25|                                       cap /* st-cap*/, flow /* st-flow */,
 2155|     25|                                       0 /* edge cap */, 0 /* edge flow */, 0 /* edges already counted */ );
 2156|     25|                if (ret < 0)
  ------------------
  |  Branch (2156:21): [True: 0, False: 25]
  ------------------
 2157|      0|                {
 2158|      0|                    goto exit_function;
 2159|      0|                }
 2160|     25|            }
 2161|     15|        }
 2162|   720k|        else
 2163|   720k|        {
 2164|   720k|            pCN = NULL;
 2165|   720k|        }
 2166|       |
 2167|       |        /* count edge caps to t-groups */
 2168|   720k|        if (at[i].endpoint)
  ------------------
  |  Branch (2168:13): [True: 580, False: 720k]
  ------------------
 2169|    580|        {
 2170|    580|            int nEdgeCap = nTautEndpointEdgeCap( at, pVA, i );
 2171|    580|            nTgroupEdges++;
 2172|    580|            if (nEdgeCap < 0)
  ------------------
  |  Branch (2172:17): [True: 0, False: 580]
  ------------------
 2173|      0|            {
 2174|      0|                ret = nEdgeCap;
 2175|      0|                goto exit_function;
 2176|      0|            }
 2177|       |
 2178|       |            /* add number of unsatisfied valences for a t-group; the unknown flow = 0 */
 2179|    580|            ret = RegisterTCGroup( pTCGroups,
 2180|    580|                                   BNS_VERT_TYPE_TGROUP,
  ------------------
  |  |   75|    580|#define BNS_VERT_TYPE_TGROUP        0x0004
  ------------------
 2181|    580|                                   at[i].endpoint,
 2182|    580|                                   0 /* st_cap */,
 2183|    580|                                   0 /* st_flow */,
 2184|    580|                                   nEdgeCap /* edge cap */,
 2185|    580|                                   0 /* edge flow */,
 2186|    580|                                   0 /* t-group edges have already been counted */ );
 2187|    580|            if (ret < 0)
  ------------------
  |  Branch (2187:17): [True: 0, False: 580]
  ------------------
 2188|      0|            {
 2189|      0|                goto exit_function;
 2190|      0|            }
 2191|    580|        }
 2192|   720k|    }
 2193|       |
 2194|  1.48k|    if (!bMetalAtoms && pTCGroups->num_metal_atoms)
  ------------------
  |  Branch (2194:9): [True: 840, False: 644]
  |  Branch (2194:25): [True: 644, False: 196]
  ------------------
 2195|    644|    {
 2196|    644|        bMetalAtoms = 1;
 2197|    644|        nBonds = 0; /* added 2006-05-15 */
 2198|    644|        goto repeat_for_metals;
 2199|    644|    }
 2200|       |
 2201|       |    /* count real atoms and bonds */
 2202|    840|    nBonds /= 2;
 2203|    840|    pTCGroups->num_atoms = num_at;
 2204|    840|    pTCGroups->num_bonds = nBonds;
 2205|       |
 2206|    840|    pTCGroups->num_tgroups = ti->num_t_groups;
 2207|    840|    pTCGroups->num_tgroup_edges = nTgroupEdges;
 2208|    840|    pTCGroups->tgroup_charge = -nTotNegChargInTgroups;
 2209|       |
 2210|    840|    if (0 <= ret && nTgroupEdgesFromTg != nTgroupEdges)
  ------------------
  |  Branch (2210:9): [True: 840, False: 0]
  |  Branch (2210:21): [True: 39, False: 801]
  ------------------
 2211|     39|    {
 2212|     39|        ret = BNS_PROGRAM_ERR;
  ------------------
  |  |   78|     39|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   75|     39|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2213|     39|    }
 2214|       |
 2215|    840|    nVertices += num_at;
 2216|       |
 2217|       |
 2218|       |    /* count other vertices */
 2219|    840|    nVertices += ti->num_t_groups;
 2220|    840|    nBonds += nOtherEdges;
 2221|       |
 2222|       |    /* return edges and vertices */
 2223|    840|    pTCGroups->nVertices = nVertices;
 2224|    840|    pTCGroups->nEdges = nBonds;
 2225|       |
 2226|       |
 2227|    840|exit_function:
 2228|    840|    return ret;
 2229|    840|}
nAddSuperCGroups:
 2277|    801|{
 2278|    801|    int i, k, n, n1, n2, n3, nNumTg = 0, ret = 0, nNumToConnect;
 2279|       |
 2280|    813|    for (i = 0; i < pTCGroups->num_tc_groups; i++)
  ------------------
  |  Branch (2280:17): [True: 12, False: 801]
  ------------------
 2281|     12|    {
 2282|     12|        if (pTCGroups->pTCG[i].type & BNS_VERT_TYPE_TGROUP)
  ------------------
  |  |   75|     12|#define BNS_VERT_TYPE_TGROUP        0x0004
  ------------------
  |  Branch (2282:13): [True: 0, False: 12]
  ------------------
 2283|      0|        {
 2284|      0|            nNumTg++;
 2285|      0|            continue; /* t-group */
 2286|      0|        }
 2287|     12|        if (IS_BNS_VT_C_GR( pTCGroups->pTCG[i].type ) ||
  ------------------
  |  |  106|     24|#define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   99|     12|#define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|     12|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  |  |  ------------------
  |  |  |  |               #define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|     12|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   77|     12|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  |  |  |  Branch (106:37): [True: 12, False: 0]
  |  |  ------------------
  ------------------
 2288|     12|             IS_BNS_VT_M_GR( pTCGroups->pTCG[i].type ))
  ------------------
  |  |  108|      0|#define IS_BNS_VT_M_GR(X)           ((X) == BNS_VERT_TYPE_METAL_GR )  /* metal flower base or vertices */
  |  |  ------------------
  |  |  |  |   85|      0|#define BNS_VERT_TYPE_METAL_GR      0x0800  /* metal atom group; may be used alone or with BNS_VT_M_POS, BNS_VT_M_NEG */
  |  |  ------------------
  |  |  |  Branch (108:37): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2289|     12|        {
 2290|       |            /* ChargeValence (cn) group */
 2291|     12|            switch (pTCGroups->pTCG[i].type)
 2292|     12|            {
 2293|      3|                case BNS_VT_C_POS:
  ------------------
  |  |   91|      3|#define BNS_VT_C_POS     BNS_VERT_TYPE_C_GROUP                               /* positive charge group, heteroat */
  |  |  ------------------
  |  |  |  |   77|      3|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  ------------------
  |  Branch (2293:17): [True: 3, False: 9]
  ------------------
 2294|      3|                    k = TCG_Plus0;
 2295|      3|                    break;
 2296|      3|                case BNS_VT_C_NEG:
  ------------------
  |  |   92|      3|#define BNS_VT_C_NEG     (BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_C_NEGATIVE)  /* negative charge group, heteroat */
  |  |  ------------------
  |  |  |  |   77|      3|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  |  |               #define BNS_VT_C_NEG     (BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_C_NEGATIVE)  /* negative charge group, heteroat */
  |  |  ------------------
  |  |  |  |   82|      3|#define BNS_VERT_TYPE_C_NEGATIVE    0x0100  /* negative charge group; attribute, should be used with BNS_VERT_TYPE_C_GROUP */
  |  |  ------------------
  ------------------
  |  Branch (2296:17): [True: 3, False: 9]
  ------------------
 2297|      3|                    k = TCG_Minus0;
 2298|      3|                    break;
 2299|      3|                case BNS_VT_C_POS_C:
  ------------------
  |  |   93|      3|#define BNS_VT_C_POS_C   (BNS_VT_C_POS | BNS_VERT_TYPE_CARBON_GR)            /* positive charge group, C, Si, Ge, Sn */
  |  |  ------------------
  |  |  |  |   91|      3|#define BNS_VT_C_POS     BNS_VERT_TYPE_C_GROUP                               /* positive charge group, heteroat */
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|      3|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BNS_VT_C_POS_C   (BNS_VT_C_POS | BNS_VERT_TYPE_CARBON_GR)            /* positive charge group, C, Si, Ge, Sn */
  |  |  ------------------
  |  |  |  |   84|      3|#define BNS_VERT_TYPE_CARBON_GR     0x0400  /* charge of carbon atom; should be used with BNS_VT_C_POS, BNS_VT_C_NEG */
  |  |  ------------------
  ------------------
  |  Branch (2299:17): [True: 3, False: 9]
  ------------------
 2300|      3|                    k = TCG_Plus_C0;
 2301|      3|                    break;
 2302|      3|                case BNS_VT_C_NEG_C:
  ------------------
  |  |   94|      3|#define BNS_VT_C_NEG_C   (BNS_VT_C_NEG | BNS_VERT_TYPE_CARBON_GR)            /* negative charge group, C, Si, Ge, Sn */
  |  |  ------------------
  |  |  |  |   92|      3|#define BNS_VT_C_NEG     (BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_C_NEGATIVE)  /* negative charge group, heteroat */
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|      3|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  |  |  ------------------
  |  |  |  |               #define BNS_VT_C_NEG     (BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_C_NEGATIVE)  /* negative charge group, heteroat */
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|      3|#define BNS_VERT_TYPE_C_NEGATIVE    0x0100  /* negative charge group; attribute, should be used with BNS_VERT_TYPE_C_GROUP */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BNS_VT_C_NEG_C   (BNS_VT_C_NEG | BNS_VERT_TYPE_CARBON_GR)            /* negative charge group, C, Si, Ge, Sn */
  |  |  ------------------
  |  |  |  |   84|      3|#define BNS_VERT_TYPE_CARBON_GR     0x0400  /* charge of carbon atom; should be used with BNS_VT_C_POS, BNS_VT_C_NEG */
  |  |  ------------------
  ------------------
  |  Branch (2302:17): [True: 3, False: 9]
  ------------------
 2303|      3|                    k = TCG_Minus_C0;
 2304|      3|                    break;
 2305|      0|                case BNS_VT_C_POS_M:
  ------------------
  |  |   95|      0|#define BNS_VT_C_POS_M   (BNS_VT_C_POS | BNS_VERT_TYPE_METAL_GR)             /* positive charge group, metal */
  |  |  ------------------
  |  |  |  |   91|      0|#define BNS_VT_C_POS     BNS_VERT_TYPE_C_GROUP                               /* positive charge group, heteroat */
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|      0|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BNS_VT_C_POS_M   (BNS_VT_C_POS | BNS_VERT_TYPE_METAL_GR)             /* positive charge group, metal */
  |  |  ------------------
  |  |  |  |   85|      0|#define BNS_VERT_TYPE_METAL_GR      0x0800  /* metal atom group; may be used alone or with BNS_VT_M_POS, BNS_VT_M_NEG */
  |  |  ------------------
  ------------------
  |  Branch (2305:17): [True: 0, False: 12]
  ------------------
 2306|      0|                    k = TCG_Plus_M0;
 2307|      0|                    break;
 2308|      0|                case BNS_VT_C_NEG_M:
  ------------------
  |  |   96|      0|#define BNS_VT_C_NEG_M   (BNS_VT_C_NEG | BNS_VERT_TYPE_METAL_GR)             /* negative charge group, metal */
  |  |  ------------------
  |  |  |  |   92|      0|#define BNS_VT_C_NEG     (BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_C_NEGATIVE)  /* negative charge group, heteroat */
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|      0|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  |  |  ------------------
  |  |  |  |               #define BNS_VT_C_NEG     (BNS_VERT_TYPE_C_GROUP | BNS_VERT_TYPE_C_NEGATIVE)  /* negative charge group, heteroat */
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|      0|#define BNS_VERT_TYPE_C_NEGATIVE    0x0100  /* negative charge group; attribute, should be used with BNS_VERT_TYPE_C_GROUP */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BNS_VT_C_NEG_M   (BNS_VT_C_NEG | BNS_VERT_TYPE_METAL_GR)             /* negative charge group, metal */
  |  |  ------------------
  |  |  |  |   85|      0|#define BNS_VERT_TYPE_METAL_GR      0x0800  /* metal atom group; may be used alone or with BNS_VT_M_POS, BNS_VT_M_NEG */
  |  |  ------------------
  ------------------
  |  Branch (2308:17): [True: 0, False: 12]
  ------------------
 2309|      0|                    k = TCG_Minus_M0;
 2310|      0|                    break;
 2311|      0|                case BNS_VT_M_GROUP:
  ------------------
  |  |   97|      0|#define BNS_VT_M_GROUP   BNS_VERT_TYPE_METAL_GR                              /* metal-group, flower vertex */
  |  |  ------------------
  |  |  |  |   85|      0|#define BNS_VERT_TYPE_METAL_GR      0x0800  /* metal atom group; may be used alone or with BNS_VT_M_POS, BNS_VT_M_NEG */
  |  |  ------------------
  ------------------
  |  Branch (2311:17): [True: 0, False: 12]
  ------------------
 2312|      0|                    switch (pTCGroups->pTCG[i].ord_num)
 2313|      0|                    {
 2314|      0|                        case 0:
  ------------------
  |  Branch (2314:25): [True: 0, False: 0]
  ------------------
 2315|      0|                            k = TCG_MeFlower0;
 2316|      0|                            break;
 2317|      0|                        case 1:
  ------------------
  |  Branch (2317:25): [True: 0, False: 0]
  ------------------
 2318|      0|                            k = TCG_MeFlower1;
 2319|      0|                            break;
 2320|      0|                        case 2:
  ------------------
  |  Branch (2320:25): [True: 0, False: 0]
  ------------------
 2321|      0|                            k = TCG_MeFlower2;
 2322|      0|                            break;
 2323|      0|                        case 3:
  ------------------
  |  Branch (2323:25): [True: 0, False: 0]
  ------------------
 2324|      0|                            k = TCG_MeFlower3;
 2325|      0|                            break;
 2326|      0|                        default:
  ------------------
  |  Branch (2326:25): [True: 0, False: 0]
  ------------------
 2327|      0|                            ret = RI_ERR_PROGR; /* unexpected group type */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 2328|      0|                            goto exit_function;
 2329|      0|                    }
 2330|      0|                    break;
 2331|       |
 2332|      0|                default:
  ------------------
  |  Branch (2332:17): [True: 0, False: 12]
  ------------------
 2333|      0|                    ret = RI_ERR_PROGR; /* unexpected group type */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 2334|      0|                    goto exit_function;
 2335|     12|            }
 2336|       |
 2337|     12|            if (pTCGroups->nGroup[k] >= 0 || pTCGroups->pTCG[i].ord_num && !IS_BNS_VT_M_GR( pTCGroups->pTCG[i].type ))
  ------------------
  |  |  108|      0|#define IS_BNS_VT_M_GR(X)           ((X) == BNS_VERT_TYPE_METAL_GR )  /* metal flower base or vertices */
  |  |  ------------------
  |  |  |  |   85|      0|#define BNS_VERT_TYPE_METAL_GR      0x0800  /* metal atom group; may be used alone or with BNS_VT_M_POS, BNS_VT_M_NEG */
  |  |  ------------------
  ------------------
  |  Branch (2337:17): [True: 0, False: 12]
  |  Branch (2337:46): [True: 0, False: 12]
  |  Branch (2337:76): [True: 0, False: 0]
  ------------------
 2338|      0|            {
 2339|      0|                ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 2340|      0|                goto exit_function;
 2341|      0|            }
 2342|     12|            pTCGroups->nGroup[k] = i; /* ordering number of the Charge group, starting from 0 */
 2343|     12|        }
 2344|     12|    }
 2345|       |
 2346|       |    /* add (+) supergroup */
 2347|    801|    n1 = pTCGroups->nGroup[TCG_Plus0];
 2348|    801|    n2 = pTCGroups->nGroup[TCG_Plus_C0];
 2349|    801|    n3 = pTCGroups->nGroup[TCG_Plus_M0];
 2350|    801|    nNumToConnect = ( n1 >= 0 ) + ( n2 >= 0 ) + ( n3 >= 0 );
 2351|       |
 2352|    801|    if (nNumToConnect)
  ------------------
  |  Branch (2352:9): [True: 3, False: 798]
  ------------------
 2353|      3|    {
 2354|       |        /* if both groups are present then add a supergroup */
 2355|      3|        ret = RegisterTCGroup( pTCGroups,
 2356|      3|                               BNS_VT_C_POS_ALL,
  ------------------
  |  |   99|      3|#define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  ------------------
  |  |  |  |   78|      3|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  ------------------
  |  |               #define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  ------------------
  |  |  |  |   77|      3|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  ------------------
 2357|      3|                               0,
 2358|      3|                               0 /* st_cap */,
 2359|      3|                               0 /* st_flow */,
 2360|      3|                               0 /* edge cap */,
 2361|      3|                               0 /* edge flow */,
 2362|      3|                               1 + nNumToConnect
 2363|       |                                /* one more edge to connect to */
 2364|      3|        /* an additional (+/-) vertex */ );
 2365|       |
 2366|      3|        if (ret <= 0)
  ------------------
  |  Branch (2366:13): [True: 0, False: 3]
  ------------------
 2367|      0|        {
 2368|      0|            ret = !ret ? RI_ERR_PROGR : ret;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  |  Branch (2368:19): [True: 0, False: 0]
  ------------------
 2369|      0|            goto exit_function;
 2370|      0|        }
 2371|       |
 2372|      3|        pTCGroups->nGroup[TCG_Plus] = ret - 1; /* newly added group number */
 2373|      3|        pTCGroups->nVertices += 2; /* two vertices including itself */
 2374|      3|        pTCGroups->nEdges += 1 + nNumToConnect; /* one more edge to connect to an additional (+/-) vertex */
 2375|      3|    }
 2376|       |
 2377|       |    /* add (-) supergroup */
 2378|    801|    n1 = pTCGroups->nGroup[TCG_Minus0];
 2379|    801|    n2 = pTCGroups->nGroup[TCG_Minus_C0];
 2380|    801|    n3 = pTCGroups->nGroup[TCG_Minus_M0];
 2381|    801|    nNumToConnect = ( n1 >= 0 ) + ( n2 >= 0 ) + ( n3 >= 0 );
 2382|    801|    if (nNumToConnect)
  ------------------
  |  Branch (2382:9): [True: 3, False: 798]
  ------------------
 2383|      3|    {
 2384|       |        /* if both groups are present then add a supergroup */
 2385|       |
 2386|      3|        ret = RegisterTCGroup( pTCGroups,
 2387|      3|                               BNS_VT_C_NEG_ALL,
  ------------------
  |  |  100|      3|#define BNS_VT_C_NEG_ALL  (BNS_VT_C_POS_ALL | BNS_VERT_TYPE_C_NEGATIVE) /* supergroup (-) */
  |  |  ------------------
  |  |  |  |   99|      3|#define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|      3|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  |  |  ------------------
  |  |  |  |               #define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|      3|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BNS_VT_C_NEG_ALL  (BNS_VT_C_POS_ALL | BNS_VERT_TYPE_C_NEGATIVE) /* supergroup (-) */
  |  |  ------------------
  |  |  |  |   82|      3|#define BNS_VERT_TYPE_C_NEGATIVE    0x0100  /* negative charge group; attribute, should be used with BNS_VERT_TYPE_C_GROUP */
  |  |  ------------------
  ------------------
 2388|      3|                               0,
 2389|      3|                               0 /* st_cap */,
 2390|      3|                               0 /* st_flow */,
 2391|      3|                               0 /* edge cap */,
 2392|      3|                               0 /* edge flow */,
 2393|      3|                               1 + nNumToConnect /* one more edge to connect to an additional (+/-) vertex */ );
 2394|       |
 2395|      3|        if (ret < 0)
  ------------------
  |  Branch (2395:13): [True: 0, False: 3]
  ------------------
 2396|      0|        {
 2397|      0|            goto exit_function;
 2398|      0|        }
 2399|      3|        pTCGroups->nGroup[TCG_Minus] = ret - 1; /* newly added group number */
 2400|      3|        pTCGroups->nVertices += 2; /* needs two vertices including itself */
 2401|      3|        pTCGroups->nEdges += 1 + nNumToConnect; /* one more edge to connect to an additional (+/-) vertex */
 2402|      3|    }
 2403|       |
 2404|       |    /* add neutralization vertex: (+)-()=(-) connection */
 2405|    801|    k = pTCGroups->nGroup[TCG_Minus];
 2406|    801|    n = pTCGroups->nGroup[TCG_Plus];
 2407|    801|    nNumToConnect = ( k >= 0 ) + ( n >= 0 );
 2408|    801|    if (nNumToConnect)
  ------------------
  |  Branch (2408:9): [True: 3, False: 798]
  ------------------
 2409|      3|    {
 2410|      3|        pTCGroups->nVertices += 1;
 2411|      3|        pTCGroups->nEdges += nNumToConnect; /* one edge per super-c-group */
 2412|      3|    }
 2413|       |
 2414|    801|    ret = 0;
 2415|       |
 2416|    801|exit_function:
 2417|    801|    return ret;
 2418|    801|}
AddTGroups2TCGBnStruct:
 2427|    801|{
 2428|    801|    int ret = 0;
 2429|    801|    inp_ATOM *at = pStruct->at;
 2430|    801|    int       num_atoms = pStruct->num_atoms;
 2431|    801|    int tot_st_cap, tot_st_flow;
 2432|       |    /* ret = ReInitBnStruct( pBNS ); */
 2433|       |
 2434|    801|    if (pTCGroups->num_tgroups /* tgi && tgi->num_t_groups && tgi->t_group*/)
  ------------------
  |  Branch (2434:9): [True: 0, False: 801]
  ------------------
 2435|      0|    {
 2436|      0|        int         i, k, endpoint, /*centerpoint,*/ fictpoint;
 2437|      0|        int         num_tg = pTCGroups->num_tgroups;
 2438|      0|        int         num_edges = pBNS->num_edges;
 2439|      0|        int         num_vertices = pBNS->num_vertices;
 2440|      0|        BNS_VERTEX *vert_ficpoint, *vert_ficpoint_prev;  /* fictitious vertex describing t-group */
 2441|      0|        BNS_VERTEX *vert_endpoint;
 2442|      0|        BNS_EDGE   *edge;      /* edge between that vertex and the tautomeric endpoint */
 2443|      0|        int        nMaxTGroupNumber = 0;
 2444|       |        /*ENDPOINT_INFO eif;*/
 2445|       |
 2446|       |        /* Debug: check overflow */
 2447|      0|        if (num_vertices + num_tg >= pBNS->max_vertices)
  ------------------
  |  Branch (2447:13): [True: 0, False: 0]
  ------------------
 2448|      0|        {
 2449|      0|            return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   82|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2450|      0|        }
 2451|      0|        if (num_edges + pTCGroups->num_tgroup_edges >= pBNS->max_edges)
  ------------------
  |  Branch (2451:13): [True: 0, False: 0]
  ------------------
 2452|      0|        {
 2453|      0|            return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   82|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2454|      0|        }
 2455|       |
 2456|       |        /* find the largest t-group ID */
 2457|      0|        for (i = 0; i < pTCGroups->num_tc_groups; i++)
  ------------------
  |  Branch (2457:21): [True: 0, False: 0]
  ------------------
 2458|      0|        {
 2459|      0|            if (pTCGroups->pTCG[i].type & BNS_VERT_TYPE_TGROUP)
  ------------------
  |  |   75|      0|#define BNS_VERT_TYPE_TGROUP        0x0004
  ------------------
  |  Branch (2459:17): [True: 0, False: 0]
  ------------------
 2460|      0|            {
 2461|      0|                k = pTCGroups->pTCG[i].ord_num;
 2462|      0|                if (k <= 0)
  ------------------
  |  Branch (2462:21): [True: 0, False: 0]
  ------------------
 2463|      0|                {
 2464|      0|                    return BNS_CPOINT_ERR; /* t-group does not have a number or has a wrong number */
  ------------------
  |  |   84|      0|#define BNS_CPOINT_ERR     (BNS_ERR +  8) /*(-9991)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2465|      0|                }
 2466|      0|                if (k > pTCGroups->num_tc_groups)
  ------------------
  |  Branch (2466:21): [True: 0, False: 0]
  ------------------
 2467|      0|                {
 2468|      0|                    return BNS_CPOINT_ERR; /* t-group has a wrong number */
  ------------------
  |  |   84|      0|#define BNS_CPOINT_ERR     (BNS_ERR +  8) /*(-9991)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2469|      0|                }
 2470|      0|                if (k != nMaxTGroupNumber + 1)
  ------------------
  |  Branch (2470:21): [True: 0, False: 0]
  ------------------
 2471|      0|                {
 2472|      0|                    return BNS_CPOINT_ERR; /* t-group numbers are not contiguously ascending */
  ------------------
  |  |   84|      0|#define BNS_CPOINT_ERR     (BNS_ERR +  8) /*(-9991)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2473|      0|                }
 2474|      0|                nMaxTGroupNumber = k;
 2475|      0|            }
 2476|      0|            else
 2477|      0|            {
 2478|      0|                break; /* t-groups are contiguous and first in the list */
 2479|      0|            }
 2480|      0|        }
 2481|       |
 2482|      0|        if (i != num_tg)
  ------------------
  |  Branch (2482:13): [True: 0, False: 0]
  ------------------
 2483|      0|        {
 2484|      0|            return BNS_CPOINT_ERR; /* number of t-groups is wrong */
  ------------------
  |  |   84|      0|#define BNS_CPOINT_ERR     (BNS_ERR +  8) /*(-9991)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2485|      0|        }
 2486|       |
 2487|       |        /* since t-group IDs may be not contiguous, clear all vertices that will be added.
 2488|       |           all-zeroes-vertex will be ignored by the BNS
 2489|       |        */
 2490|      0|        memset( pBNS->vert + num_vertices, 0, nMaxTGroupNumber * sizeof( pBNS->vert[0] ) );
 2491|       |
 2492|       |        /* initialize new fictitious vertices */
 2493|      0|        vert_ficpoint_prev = pBNS->vert + num_vertices - 1;
 2494|       |
 2495|      0|        tot_st_cap = tot_st_flow = 0;
 2496|       |
 2497|      0|        for (i = 0; i < num_tg; i++, vert_ficpoint_prev = vert_ficpoint)
  ------------------
  |  Branch (2497:21): [True: 0, False: 0]
  ------------------
 2498|      0|        {
 2499|       |            /*
 2500|       |              vert_ficpoint-1 is the last vertex;
 2501|       |              vert_ficpoint   is the vertex that is being added
 2502|       |              Note: nGroupNumber are not contiguous
 2503|       |            */
 2504|      0|            vert_ficpoint = pBNS->vert + num_vertices + pTCGroups->pTCG[i].ord_num - 1;
 2505|      0|            vert_ficpoint->iedge = vert_ficpoint_prev->iedge + vert_ficpoint_prev->max_adj_edges;
 2506|      0|            vert_ficpoint->max_adj_edges = pTCGroups->pTCG[i].num_edges + nMaxAddEdges + BNS_ADD_SUPER_TGROUP;
  ------------------
  |  |  113|      0|#define BNS_ADD_SUPER_TGROUP 1  /* reserve one more edge for a t-group to connect to a single super-t-group */
  ------------------
 2507|      0|            vert_ficpoint->num_adj_edges = 0;
 2508|      0|            vert_ficpoint->st_edge.flow = vert_ficpoint->st_edge.flow0 = 0;
 2509|      0|            vert_ficpoint->st_edge.cap = vert_ficpoint->st_edge.cap0 = pTCGroups->pTCG[i].st_cap;
 2510|      0|            tot_st_cap += pTCGroups->pTCG[i].st_cap;
 2511|      0|            vert_ficpoint->type = pTCGroups->pTCG[i].type;
 2512|      0|            pTCGroups->pTCG[i].nVertexNumber = (int) ( vert_ficpoint - pBNS->vert );
 2513|      0|        }
 2514|       |
 2515|      0|        for (endpoint = 0; endpoint < num_atoms; endpoint++)
  ------------------
  |  Branch (2515:28): [True: 0, False: 0]
  ------------------
 2516|      0|        {
 2517|      0|            if (!at[endpoint].endpoint)
  ------------------
  |  Branch (2517:17): [True: 0, False: 0]
  ------------------
 2518|      0|                continue;
 2519|      0|            fictpoint = at[endpoint].endpoint + num_vertices - 1;
 2520|      0|            vert_ficpoint = pBNS->vert + fictpoint;  /* t-group vertex */
 2521|      0|            vert_endpoint = pBNS->vert + endpoint;   /* endpoint vertex */
 2522|       |            /* Debug: check overflow */
 2523|      0|            if (fictpoint >= pBNS->max_vertices ||
  ------------------
  |  Branch (2523:17): [True: 0, False: 0]
  ------------------
 2524|      0|                 num_edges >= pBNS->max_edges ||
  ------------------
  |  Branch (2524:18): [True: 0, False: 0]
  ------------------
 2525|      0|                 vert_ficpoint->num_adj_edges >= vert_ficpoint->max_adj_edges ||
  ------------------
  |  Branch (2525:18): [True: 0, False: 0]
  ------------------
 2526|      0|                 vert_endpoint->num_adj_edges >= vert_endpoint->max_adj_edges)
  ------------------
  |  Branch (2526:18): [True: 0, False: 0]
  ------------------
 2527|      0|            {
 2528|      0|                ret = BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   82|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2529|      0|                break;
 2530|      0|            }
 2531|       |
 2532|       |#ifdef NEVER
 2533|       |            /* obtain donor/acceptor info */
 2534|       |            if (!nGetEndpointInfo( at, endpoint, &eif ))
 2535|       |            {
 2536|       |                ret = BNS_BOND_ERR;
 2537|       |                break;
 2538|       |            }
 2539|       |#endif
 2540|       |
 2541|      0|            vert_endpoint->type |= BNS_VERT_TYPE_ENDPOINT;
  ------------------
  |  |   74|      0|#define BNS_VERT_TYPE_ENDPOINT      0x0002  /* attribute */
  ------------------
 2542|       |
 2543|       |#ifdef NEVER
 2544|       |            /* set capacity = 1 to the edges from the endpoint to the centerpoint(s) */
 2545|       |            for (k = 0; k < vert_endpoint->num_adj_edges; k++)
 2546|       |            {
 2547|       |                int iedge = vert_endpoint->iedge[k];
 2548|       |                if (!pBNS->edge[iedge].cap)
 2549|       |                {
 2550|       |/* single bond, possibly between endpoint and centerpoint */
 2551|       |                    centerpoint = ( pBNS->edge[iedge].neighbor12 ^ endpoint );
 2552|       |                    if (centerpoint < pBNS->num_atoms &&
 2553|       |                         pBNS->vert[centerpoint].st_edge.cap >= 1)
 2554|       |                    {
 2555|       |                        int bond_type = ( at[endpoint].bond_type[k] & BOND_TYPE_MASK );
 2556|       |                        if (bond_type == BOND_TAUTOM ||
 2557|       |                            bond_type == BOND_ALTERN ||
 2558|       |                            bond_type == BOND_ALT12NS ||
 2559|       |                            bond_type == BOND_SINGLE)
 2560|       |                        {
 2561|       |                            pBNS->edge[iedge].cap = 1;
 2562|       |                        }
 2563|       |                    }
 2564|       |                }
 2565|       |            }
 2566|       |#endif
 2567|       |
 2568|       |            /* create a new edge connecting endpoint to the new fictitious t-group vertex vert_ficpoint */
 2569|      0|            edge = pBNS->edge + num_edges;
 2570|      0|            edge->cap = vert_endpoint->st_edge.cap - vert_endpoint->st_edge.flow;
 2571|      0|            edge->cap = inchi_min( edge->cap, MAX_TGROUP_EDGE_CAP );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2572|      0|            edge->cap = inchi_max( edge->cap, 0 );
  ------------------
  |  |  166|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2573|      0|            edge->flow = 0;
 2574|      0|            edge->pass = 0;
 2575|       |
 2576|       |#if ( RESET_EDGE_FORBIDDEN_MASK == 1 )
 2577|       |            edge->forbidden &= pBNS->edge_forbidden_mask;
 2578|       |#endif
 2579|       |
 2580|       |#ifdef NEVER
 2581|       |            /* later include case when the charge change allows the endpoint to become tautomeric */
 2582|       |            /* mark endoint having moveable H atom with flow=1 */
 2583|       |
 2584|       |            /* -- old "no charges" version -- */
 2585|       |            /* if (at[endpoint].chem_bonds_valence == at[endpoint].valence) */
 2586|       |            /* -- the following line takes charges into account -- */
 2587|       |            if (eif.cDonor) /* means the endpoint has an H-atom to donate */
 2588|       |            {
 2589|       |                /* increment edge flow */
 2590|       |                edge->flow++;
 2591|       |                /* increment one vertex st-flow & cap */
 2592|       |                vert_ficpoint->st_edge.flow++;
 2593|       |                vert_ficpoint->st_edge.cap++;
 2594|       |                /* increment another vertex st-flow & cap */
 2595|       |                vert_endpoint->st_edge.flow++;
 2596|       |                vert_endpoint->st_edge.cap++;
 2597|       |            }
 2598|       |#endif
 2599|       |
 2600|       |            /* connect edge to endpoint and fictpoint and increment the counters of neighbors and edges */
 2601|      0|            ret = ConnectTwoVertices( vert_endpoint, vert_ficpoint, edge, pBNS, 0 );
 2602|      0|            if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2603|      0|            {
 2604|      0|                break;
 2605|      0|            }
 2606|      0|            num_edges++;
 2607|      0|            edge->cap0 = edge->cap;
 2608|      0|            edge->flow0 = edge->flow;
 2609|      0|            pVA[endpoint].nTautGroupEdge = num_edges; /* edge index + 1 */
 2610|      0|        }
 2611|       |
 2612|      0|        pBNS->num_edges = num_edges;
 2613|      0|        pBNS->num_vertices += nMaxTGroupNumber;
 2614|      0|        pBNS->num_t_groups = num_tg;
 2615|      0|        pBNS->tot_st_cap += tot_st_cap;
 2616|      0|        pBNS->tot_st_flow += tot_st_flow;
 2617|      0|    }
 2618|       |
 2619|    801|    return ret;
 2620|    801|}
ConnectTwoVertices:
 2625|     69|{
 2626|     69|    int ip1 = (int) ( p1 - pBNS->vert );
 2627|     69|    int ip2 = (int) ( p2 - pBNS->vert );
 2628|     69|    int ie = (int) ( e - pBNS->edge );
 2629|       |
 2630|       |    /* debug: check bounds */
 2631|     69|    if (ip1 >= pBNS->max_vertices || ip1 < 0 ||
  ------------------
  |  Branch (2631:9): [True: 0, False: 69]
  |  Branch (2631:38): [True: 0, False: 69]
  ------------------
 2632|     69|         ip2 >= pBNS->max_vertices || ip2 < 0 ||
  ------------------
  |  Branch (2632:10): [True: 0, False: 69]
  |  Branch (2632:39): [True: 0, False: 69]
  ------------------
 2633|     69|         ie >= pBNS->max_edges || ie < 0 ||
  ------------------
  |  Branch (2633:10): [True: 0, False: 69]
  |  Branch (2633:35): [True: 0, False: 69]
  ------------------
 2634|     69|         ( p1->iedge - pBNS->iedge ) < 0 ||
  ------------------
  |  Branch (2634:10): [True: 0, False: 69]
  ------------------
 2635|     69|         ( p1->iedge - pBNS->iedge ) + p1->max_adj_edges > pBNS->max_iedges ||
  ------------------
  |  Branch (2635:10): [True: 0, False: 69]
  ------------------
 2636|     69|         ( p2->iedge - pBNS->iedge ) < 0 ||
  ------------------
  |  Branch (2636:10): [True: 0, False: 69]
  ------------------
 2637|     69|         ( p2->iedge - pBNS->iedge ) + p2->max_adj_edges > pBNS->max_iedges ||
  ------------------
  |  Branch (2637:10): [True: 0, False: 69]
  ------------------
 2638|     69|         p1->num_adj_edges >= p1->max_adj_edges ||
  ------------------
  |  Branch (2638:10): [True: 0, False: 69]
  ------------------
 2639|     69|         p2->num_adj_edges >= p2->max_adj_edges)
  ------------------
  |  Branch (2639:10): [True: 0, False: 69]
  ------------------
 2640|      0|    {
 2641|      0|        return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   82|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2642|      0|    }
 2643|       |    /* clear the edge */
 2644|     69|    if (bClearEdge)
  ------------------
  |  Branch (2644:9): [True: 24, False: 45]
  ------------------
 2645|     24|    {
 2646|     24|        memset( e, 0, sizeof( *e ) );
 2647|     24|    }
 2648|     45|    else
 2649|     45|        if (e->neighbor1 || e->neighbor12)
  ------------------
  |  Branch (2649:13): [True: 0, False: 45]
  |  Branch (2649:29): [True: 0, False: 45]
  ------------------
 2650|      0|        {
 2651|      0|            return BNS_PROGRAM_ERR;
  ------------------
  |  |   78|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2652|      0|        }
 2653|       |
 2654|       |        /* connect */
 2655|     69|    e->neighbor1 = inchi_min( ip1, ip2 );
  ------------------
  |  |  167|     69|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 35, False: 34]
  |  |  ------------------
  ------------------
 2656|     69|    e->neighbor12 = ip1 ^ ip2;
 2657|     69|    p1->iedge[p1->num_adj_edges] = ie;
 2658|     69|    p2->iedge[p2->num_adj_edges] = ie;
 2659|     69|    e->neigh_ord[ip1 > ip2] = p1->num_adj_edges++;
 2660|       |
 2661|     69|    e->neigh_ord[ip1 < ip2] = p2->num_adj_edges++;
 2662|     69|    return 0;
 2663|     69|}
AddRadicalToMetal:
 2704|      3|{
 2705|      3|    int iG0 = pTCGroups->nGroup[TCG_MeFlower0]; /* index in pTCGroups->pTCG[] */
 2706|      3|    int iG1 = pTCGroups->nGroup[TCG_MeFlower1];
 2707|      3|    int iG2 = pTCGroups->nGroup[TCG_MeFlower2];
 2708|      3|    int iG3 = pTCGroups->nGroup[TCG_MeFlower3];
 2709|      3|    int n = ( iG0 >= 0 ) + ( iG1 >= 0 ) + ( iG2 >= 0 ) + ( iG3 >= 0 );
 2710|      3|    int vG0, vG1, vG2, vG3;  /* M-vertex number */
 2711|      3|    BNS_VERTEX *pG0 = NULL, *pG1 = NULL, *pG2 = NULL, *pG3 = NULL;
 2712|       |
 2713|      3|    if (pTCGroups->num_metal_atoms &&
  ------------------
  |  Branch (2713:9): [True: 0, False: 3]
  ------------------
 2714|      3|         pSrm->bMetalAddFlower      &&
  ------------------
  |  Branch (2714:10): [True: 0, False: 0]
  ------------------
 2715|      3|         *tot_st_cap % 2 &&
  ------------------
  |  Branch (2715:10): [True: 0, False: 0]
  ------------------
 2716|      3|         n == 4)
  ------------------
  |  Branch (2716:10): [True: 0, False: 0]
  ------------------
 2717|      0|    {
 2718|      0|        vG0 = pTCGroups->pTCG[iG0].nVertexNumber;
 2719|      0|        vG1 = pTCGroups->pTCG[iG1].nVertexNumber;
 2720|      0|        vG2 = pTCGroups->pTCG[iG2].nVertexNumber;
 2721|      0|        vG3 = pTCGroups->pTCG[iG3].nVertexNumber;
 2722|       |
 2723|      0|        pG0 = pBNS->vert + vG0;
 2724|      0|        pG1 = pBNS->vert + vG1;
 2725|      0|        pG2 = pBNS->vert + vG2;
 2726|      0|        pG3 = pBNS->vert + vG3;
 2727|       |
 2728|       |        /* add 1 unit to metal flower st_cap */
 2729|      0|        pG3->st_edge.cap++;
 2730|      0|        pG3->st_edge.cap0++;
 2731|      0|        ( *tot_st_cap )++;
 2732|      0|        return 1;
 2733|      0|    }
 2734|       |
 2735|      3|    return 0;
 2736|      3|}
ConnectMetalFlower:
 2743|      3|{
 2744|      3|    int iG0 = pTCGroups->nGroup[TCG_MeFlower0]; /* index in pTCGroups->pTCG[] */
 2745|      3|    int iG1 = pTCGroups->nGroup[TCG_MeFlower1];
 2746|      3|    int iG2 = pTCGroups->nGroup[TCG_MeFlower2];
 2747|      3|    int iG3 = pTCGroups->nGroup[TCG_MeFlower3];
 2748|      3|    int n = ( iG0 >= 0 ) + ( iG1 >= 0 ) + ( iG2 >= 0 ) + ( iG3 >= 0 );
 2749|      3|    int vG0, vG1, vG2, vG3;  /* M-vertex number */
 2750|      3|    int cur_num_edges = *pcur_num_edges;
 2751|      3|    int cur_num_vertices = *pcur_num_vertices;
 2752|      3|    BNS_VERTEX *pG0 = NULL, *pG1 = NULL, *pG2 = NULL, *pG3 = NULL;
 2753|      3|    BNS_EDGE   *ea = NULL, *eb = NULL, *ed = NULL, *ex = NULL, *ey = NULL, *e;
 2754|      3|    int         ia, ib, id, ix, iy;
 2755|      3|    int         c, f, dc, df, ca, fa, cb, fb, cd, fd, cx, fx, cy, fy;
 2756|      3|    int         C0, F0, C1, F1, C2, F2, C3, F3, D;
 2757|      3|    int         ret = 0, i;
 2758|       |
 2759|      3|    if (0 == n)
  ------------------
  |  Branch (2759:9): [True: 3, False: 0]
  ------------------
 2760|      3|    {
 2761|      3|        goto exit_function;
 2762|      3|    }
 2763|       |
 2764|      0|    if (4 != n)
  ------------------
  |  Branch (2764:9): [True: 0, False: 0]
  ------------------
 2765|      0|    {
 2766|      0|        ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 2767|      0|        goto exit_function;
 2768|      0|    }
 2769|       |
 2770|      0|    vG0 = pTCGroups->pTCG[iG0].nVertexNumber;
 2771|      0|    vG1 = pTCGroups->pTCG[iG1].nVertexNumber;
 2772|      0|    vG2 = pTCGroups->pTCG[iG2].nVertexNumber;
 2773|      0|    vG3 = pTCGroups->pTCG[iG3].nVertexNumber;
 2774|       |
 2775|      0|    pG0 = pBNS->vert + vG0;
 2776|      0|    pG1 = pBNS->vert + vG1;
 2777|      0|    pG2 = pBNS->vert + vG2;
 2778|      0|    pG3 = pBNS->vert + vG3;
 2779|       |
 2780|       |    /* count G0 edges cap and flow (currently only atoms are connected to G0) */
 2781|      0|    for (i = 0, c = 0, f = 0; i < pG0->num_adj_edges; i++)
  ------------------
  |  Branch (2781:31): [True: 0, False: 0]
  ------------------
 2782|      0|    {
 2783|      0|        e = pBNS->edge + pG0->iedge[i];
 2784|      0|        c += e->cap;
 2785|      0|        f += e->flow;
 2786|      0|    }
 2787|       |
 2788|       |    /* consistency checks */
 2789|      0|    if (!IS_BNS_VT_M_GR( pTCGroups->pTCG[iG0].type ) &&
  ------------------
  |  |  108|      0|#define IS_BNS_VT_M_GR(X)           ((X) == BNS_VERT_TYPE_METAL_GR )  /* metal flower base or vertices */
  |  |  ------------------
  |  |  |  |   85|      0|#define BNS_VERT_TYPE_METAL_GR      0x0800  /* metal atom group; may be used alone or with BNS_VT_M_POS, BNS_VT_M_NEG */
  |  |  ------------------
  ------------------
  |  Branch (2789:9): [True: 0, False: 0]
  ------------------
 2790|      0|        ( pTCGroups->pTCG[iG0].edges_cap != pG0->st_edge.cap ||
  ------------------
  |  Branch (2790:11): [True: 0, False: 0]
  ------------------
 2791|      0|            pTCGroups->pTCG[iG0].edges_flow != pG0->st_edge.flow ))
  ------------------
  |  Branch (2791:13): [True: 0, False: 0]
  ------------------
 2792|      0|    {
 2793|      0|        ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 2794|      0|        goto exit_function;
 2795|      0|    }
 2796|       |
 2797|      0|    if (pTCGroups->pTCG[iG0].edges_cap != c ||
  ------------------
  |  Branch (2797:9): [True: 0, False: 0]
  ------------------
 2798|      0|         pTCGroups->pTCG[iG0].edges_flow != f)
  ------------------
  |  Branch (2798:10): [True: 0, False: 0]
  ------------------
 2799|      0|    {
 2800|      0|        ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 2801|      0|        goto exit_function;
 2802|      0|    }
 2803|       |
 2804|       |    /* get new edges */
 2805|       |
 2806|      0|    ea = pBNS->edge + ( ia = cur_num_edges++ );
 2807|      0|    eb = pBNS->edge + ( ib = cur_num_edges++ );
 2808|      0|    ed = pBNS->edge + ( id = cur_num_edges++ );
 2809|      0|    ex = pBNS->edge + ( ix = cur_num_edges++ );
 2810|      0|    ey = pBNS->edge + ( iy = cur_num_edges++ );
 2811|       |
 2812|       |    /* connect vertices with edges */
 2813|      0|    ret = ConnectTwoVertices( pG0, pG1, eb, pBNS, 1 );
 2814|      0|    if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2815|      0|    {
 2816|      0|        goto exit_function;
 2817|      0|    }
 2818|       |
 2819|      0|    ret = ConnectTwoVertices( pG0, pG2, ea, pBNS, 1 );
 2820|       |
 2821|      0|    if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2822|      0|    {
 2823|      0|        goto exit_function;
 2824|      0|    }
 2825|       |
 2826|      0|    ret = ConnectTwoVertices( pG1, pG2, ed, pBNS, 1 );
 2827|       |
 2828|      0|    if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2829|      0|    {
 2830|      0|        goto exit_function;
 2831|      0|    }
 2832|       |
 2833|      0|    ret = ConnectTwoVertices( pG1, pG3, ey, pBNS, 1 );
 2834|       |
 2835|      0|    if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2836|      0|    {
 2837|      0|        goto exit_function;
 2838|      0|    }
 2839|       |
 2840|      0|    ret = ConnectTwoVertices( pG2, pG3, ex, pBNS, 1 );
 2841|       |
 2842|      0|    if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2843|      0|    {
 2844|      0|        goto exit_function;
 2845|      0|    }
 2846|       |
 2847|       |    /* calculate caps and flows */
 2848|       |
 2849|      0|    dc = c % 2;
 2850|      0|    c /= 2;
 2851|      0|    df = f % 2;
 2852|      0|    f /= 2;
 2853|       |
 2854|      0|    D = pSrm->nMetalFlowerParam_D;
 2855|       |
 2856|      0|    C0 = F0 = 2 * c + 2 * D + dc;
 2857|      0|    C1 = F1 = c + 2 * D + dc - df;
 2858|      0|    C2 = F2 = c + 2 * D;
 2859|      0|    C3 = F3 = 0;
 2860|       |
 2861|      0|    ca = c + 2 * D;
 2862|      0|    fa = c + D - f;
 2863|       |
 2864|      0|    cb = c + 2 * D + dc;
 2865|      0|    fb = c + D + dc - ( f + df );
 2866|       |
 2867|      0|    cd = c + 2 * D;
 2868|      0|    fd = f + D;
 2869|       |
 2870|      0|    cx = cy = D;
 2871|      0|    fx = fy = 0;
 2872|       |
 2873|       |    /* check overflow */
 2874|      0|    if (C0 >= EDGE_FLOW_ST_MASK || F0 >= EDGE_FLOW_ST_MASK ||
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
                  if (C0 >= EDGE_FLOW_ST_MASK || F0 >= EDGE_FLOW_ST_MASK ||
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (2874:9): [True: 0, False: 0]
  |  Branch (2874:36): [True: 0, False: 0]
  ------------------
 2875|      0|         C1 >= EDGE_FLOW_ST_MASK || F1 >= EDGE_FLOW_ST_MASK ||
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
                       C1 >= EDGE_FLOW_ST_MASK || F1 >= EDGE_FLOW_ST_MASK ||
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (2875:10): [True: 0, False: 0]
  |  Branch (2875:37): [True: 0, False: 0]
  ------------------
 2876|      0|         C2 >= EDGE_FLOW_ST_MASK || F2 >= EDGE_FLOW_ST_MASK ||
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
                       C2 >= EDGE_FLOW_ST_MASK || F2 >= EDGE_FLOW_ST_MASK ||
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (2876:10): [True: 0, False: 0]
  |  Branch (2876:37): [True: 0, False: 0]
  ------------------
 2877|      0|         C3 >= EDGE_FLOW_ST_MASK || F3 >= EDGE_FLOW_ST_MASK)
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
                       C3 >= EDGE_FLOW_ST_MASK || F3 >= EDGE_FLOW_ST_MASK)
  ------------------
  |  |  156|      0|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (2877:10): [True: 0, False: 0]
  |  Branch (2877:37): [True: 0, False: 0]
  ------------------
 2878|      0|    {
 2879|      0|        return BNS_PROGRAM_ERR; /* cannot handle too large st-cap or st-flow */
  ------------------
  |  |   78|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2880|      0|    }
 2881|       |
 2882|       |    /* set st caps and flows */
 2883|       |
 2884|      0|    SetStCapFlow( pG0, tot_st_flow, tot_st_cap, C0, F0 );
 2885|      0|    SetStCapFlow( pG1, tot_st_flow, tot_st_cap, C1, F1 );
 2886|      0|    SetStCapFlow( pG2, tot_st_flow, tot_st_cap, C2, F2 );
 2887|      0|    SetStCapFlow( pG3, tot_st_flow, tot_st_cap, C3, F3 );
 2888|       |
 2889|      0|    SetEdgeCapFlow( ea, ca, fa );
 2890|      0|    SetEdgeCapFlow( eb, cb, fb );
 2891|      0|    SetEdgeCapFlow( ed, cd, fd );
 2892|      0|    SetEdgeCapFlow( ex, cx, fx );
 2893|      0|    SetEdgeCapFlow( ey, cy, fy );
 2894|       |
 2895|       |
 2896|      0|    *pcur_num_edges = cur_num_edges;
 2897|      0|    *pcur_num_vertices = cur_num_vertices;
 2898|       |
 2899|      0|    ret = 0;
 2900|       |
 2901|      3|exit_function:
 2902|       |
 2903|      3|    return ret;
 2904|      0|}
AddEdgeFlow:
 2922|     24|{
 2923|       |
 2924|       |    /* overflow check */
 2925|     24|    if (e01->cap < 0 || edge_cap < 0 || (int) e01->cap + edge_cap >= EDGE_FLOW_MASK)
  ------------------
  |  |  161|     24|#define EDGE_FLOW_MASK          0x3fff  /* mask for flow */
  ------------------
  |  Branch (2925:9): [True: 0, False: 24]
  |  Branch (2925:25): [True: 0, False: 24]
  |  Branch (2925:41): [True: 0, False: 24]
  ------------------
 2926|      0|    {
 2927|      0|        return BNS_PROGRAM_ERR;
  ------------------
  |  |   78|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2928|      0|    }
 2929|       |
 2930|     24|    if (pDst->st_edge.cap < 0 || (int) pDst->st_edge.cap + edge_cap >= EDGE_FLOW_ST_MASK ||
  ------------------
  |  |  156|     48|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (2930:9): [True: 0, False: 24]
  |  Branch (2930:34): [True: 0, False: 24]
  ------------------
 2931|     24|         pDst->st_edge.flow < 0 || (int) pDst->st_edge.flow + edge_flow >= EDGE_FLOW_ST_MASK ||
  ------------------
  |  |  156|     48|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (2931:10): [True: 0, False: 24]
  |  Branch (2931:36): [True: 0, False: 24]
  ------------------
 2932|     24|         pSrc->st_edge.cap < 0 || pSrc->st_edge.flow < 0 ||
  ------------------
  |  Branch (2932:10): [True: 0, False: 24]
  |  Branch (2932:35): [True: 0, False: 24]
  ------------------
 2933|     24|         (int) pSrc->st_edge.flow + edge_flow >= EDGE_FLOW_ST_MASK)
  ------------------
  |  |  156|     24|#define EDGE_FLOW_ST_MASK       0x3fff  /* mask for flow */
  ------------------
  |  Branch (2933:10): [True: 0, False: 24]
  ------------------
 2934|      0|    {
 2935|      0|        return BNS_PROGRAM_ERR;
  ------------------
  |  |   78|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2936|      0|    }
 2937|       |
 2938|       |    /* add flow */
 2939|     24|    e01->cap += edge_cap;
 2940|     24|    e01->flow += edge_flow;
 2941|     24|    e01->cap0 = e01->cap;
 2942|     24|    e01->flow0 = e01->flow;
 2943|       |
 2944|     24|    pDst->st_edge.cap += edge_cap;
 2945|     24|    pDst->st_edge.cap0 = pDst->st_edge.cap;
 2946|     24|    *tot_st_cap += edge_cap;
 2947|       |
 2948|     24|    pDst->st_edge.flow += edge_flow;
 2949|     24|    pDst->st_edge.flow0 = pDst->st_edge.flow;
 2950|     24|    *tot_st_flow += edge_flow;
 2951|       |
 2952|     24|    pSrc->st_edge.flow += edge_flow;
 2953|     24|    pSrc->st_edge.flow0 = pSrc->st_edge.flow;
 2954|     24|    *tot_st_flow += edge_flow;
 2955|       |
 2956|       |/*
 2957|       |    pDst->st_edge.cap  += e01->cap;
 2958|       |    pDst->st_edge.cap0  = pDst->st_edge.cap;
 2959|       |    *tot_st_cap       += e01->cap;
 2960|       |
 2961|       |    pDst->st_edge.flow += e01->flow;
 2962|       |    pDst->st_edge.flow0 = pDst->st_edge.flow;
 2963|       |    *tot_st_flow      += e01->flow;
 2964|       |
 2965|       |    pSrc->st_edge.flow += e01->flow;
 2966|       |    pSrc->st_edge.flow0 = pSrc->st_edge.flow;
 2967|       |    *tot_st_flow      += e01->flow;
 2968|       |*/
 2969|     24|    return 0;
 2970|     24|}
ConnectSuperCGroup:
 3059|      9|{
 3060|      9|    BNS_EDGE   **e0X = NULL, *e;
 3061|      9|    BNS_VERTEX **pvX = NULL, *pv0 = NULL, *pv1 = NULL, *pv = NULL;
 3062|      9|    int         *jX = NULL, *iX = NULL;
 3063|      9|    int        i, j, num_groups, j0, i1, j1, iXX, ret = 0, fst = 0;
 3064|      9|    int        cur_num_vertices = *pcur_num_vertices;
 3065|      9|    int        cur_num_edges = *pcur_num_edges;
 3066|       |
 3067|      9|    if (nSuperCGroup >= 0)
  ------------------
  |  Branch (3067:9): [True: 6, False: 3]
  ------------------
 3068|      6|    {
 3069|      6|        i1 = pTCGroups->nGroup[nSuperCGroup]; /* the supergroup */
 3070|      6|        if (i1 < 0)
  ------------------
  |  Branch (3070:13): [True: 0, False: 6]
  ------------------
 3071|      0|            return 0;
 3072|      6|    }
 3073|      3|    else
 3074|      3|    {
 3075|      3|        i1 = -1;
 3076|      3|        fst = 1;
 3077|      3|    }
 3078|       |
 3079|     33|    for (i = num_groups = 0; i < num_add; i++)
  ------------------
  |  Branch (3079:30): [True: 24, False: 9]
  ------------------
 3080|     24|    {
 3081|     24|        iXX = pTCGroups->nGroup[nAddGroups[i]];
 3082|     24|        num_groups += ( iXX >= 0 && iXX != i1 );
  ------------------
  |  Branch (3082:25): [True: 18, False: 6]
  |  Branch (3082:37): [True: 18, False: 0]
  ------------------
 3083|     24|    }
 3084|      9|    if (num_groups < 1)
  ------------------
  |  Branch (3084:9): [True: 0, False: 9]
  ------------------
 3085|      0|    {  /* Y connect only 2 or more groups; V connects even 1 group */
 3086|      0|        return 0;
 3087|      0|    }
 3088|       |
 3089|      9|    e0X = (BNS_EDGE   **) inchi_calloc( num_groups + 1, sizeof( e0X[0] ) );
  ------------------
  |  | 1133|      9|#define inchi_calloc   calloc
  ------------------
 3090|      9|    pvX = (BNS_VERTEX **) inchi_calloc( num_groups + 1, sizeof( pvX[0] ) );
  ------------------
  |  | 1133|      9|#define inchi_calloc   calloc
  ------------------
 3091|      9|    jX = (int         *) inchi_calloc( num_groups + 1, sizeof( jX[0] ) );
  ------------------
  |  | 1133|      9|#define inchi_calloc   calloc
  ------------------
 3092|      9|    iX = (int         *) inchi_calloc( num_groups + 1, sizeof( iX[0] ) );
  ------------------
  |  | 1133|      9|#define inchi_calloc   calloc
  ------------------
 3093|       |
 3094|      9|    if (!e0X || !pvX || !jX || !iX)
  ------------------
  |  Branch (3094:9): [True: 0, False: 9]
  |  Branch (3094:17): [True: 0, False: 9]
  |  Branch (3094:25): [True: 0, False: 9]
  |  Branch (3094:32): [True: 0, False: 9]
  ------------------
 3095|      0|    {
 3096|      0|        ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 3097|      0|        goto exit_function;
 3098|      0|    }
 3099|       |
 3100|       |    /* create vert_ficpoint -- central Y-connection vertex */
 3101|       |
 3102|      9|    j0 = cur_num_vertices;
 3103|      9|    pv0 = pBNS->vert + j0; /* center of the Y-connection; has number j0 */
 3104|      9|    pv0->iedge = ( pv0 - 1 )->iedge + ( pv0 - 1 )->max_adj_edges;
 3105|      9|    pv0->max_adj_edges = num_groups + 1 + BNS_ADD_EDGES; /* Y-connection num. edges */
  ------------------
  |  |  117|      9|#define BNS_ADD_EDGES        1  /* max. number of edges to add to each atom (except edges to a t-group or c-group) */
  ------------------
 3106|      9|    pv0->num_adj_edges = 0; /* nothing connected yet */
 3107|      9|    pv0->type = BNS_VT_YVCONNECTOR;
  ------------------
  |  |  103|      9|#define BNS_VT_YVCONNECTOR  BNS_VERT_TYPE__AUX                                 /* group connection */
  |  |  ------------------
  |  |  |  |   81|      9|#define BNS_VERT_TYPE__AUX          0x0080  /* vertex added to build charge substructures */
  |  |  ------------------
  ------------------
 3108|      9|    cur_num_vertices++;
 3109|       |
 3110|      9|    if (fst == 0)
  ------------------
  |  Branch (3110:9): [True: 6, False: 3]
  ------------------
 3111|      6|    {
 3112|       |        /* find super c-group vertex pv1, number j1 */
 3113|      6|        jX[0] = j1 = pTCGroups->pTCG[i1].nVertexNumber;
 3114|      6|        iX[0] = i1;
 3115|      6|        pvX[0] = pv1 = pBNS->vert + j1;
 3116|      6|    }
 3117|       |
 3118|       |    /* find other c-group vertices */
 3119|     33|    for (i = 0, j = 1; i < num_add; i++)
  ------------------
  |  Branch (3119:24): [True: 24, False: 9]
  ------------------
 3120|     24|    {
 3121|     24|        iXX = pTCGroups->nGroup[nAddGroups[i]];
 3122|     24|        if (( iXX >= 0 ) && ( iXX != i1 ))
  ------------------
  |  Branch (3122:13): [True: 18, False: 6]
  |  Branch (3122:29): [True: 18, False: 0]
  ------------------
 3123|     18|        {
 3124|     18|            iX[j] = iXX;
 3125|     18|            jX[j] = pTCGroups->pTCG[iXX].nVertexNumber;
 3126|     18|            pvX[j] = pBNS->vert + jX[j];
 3127|     18|            j++;
 3128|     18|        }
 3129|     24|    }
 3130|       |
 3131|       |    /* grab (num_groups+1) free edges */
 3132|     33|    for (i = fst; i <= num_groups; i++)
  ------------------
  |  Branch (3132:19): [True: 24, False: 9]
  ------------------
 3133|     24|    {
 3134|     24|        e = e0X[i] = pBNS->edge + cur_num_edges;
 3135|     24|        pv = pvX[i];
 3136|     24|        j = jX[i];
 3137|     24|        iXX = iX[i];
 3138|       |        /* connect all to pv0 */
 3139|     24|        ret = ConnectTwoVertices( pv0, pv, e, pBNS, 1 );
 3140|     24|        if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|     24|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|     24|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|     24|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|     24|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 24, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 24]
  |  |  ------------------
  ------------------
 3141|      0|        {
 3142|      0|            goto exit_function;
 3143|      0|        }
 3144|     24|        if (i)
  ------------------
  |  Branch (3144:13): [True: 18, False: 6]
  ------------------
 3145|     18|        {
 3146|       |            /* from c-group to central Y-connecting vertex of from supergroup to (+/-) vertex */
 3147|     18|            pTCGroups->pTCG[iX[i]].nForwardEdge = cur_num_edges;
 3148|     18|        }
 3149|      6|        else
 3150|      6|        {
 3151|       |            /* from central Y-connecting vertex to supergroup */
 3152|      6|            pTCGroups->pTCG[iX[i]].nBackwardEdge = cur_num_edges;
 3153|      6|        }
 3154|     24|        cur_num_edges++;
 3155|     24|    }
 3156|       |
 3157|       |    /* set flow and cap for incoming into pv0 edges */
 3158|     27|    for (i = 1; i <= num_groups; i++)
  ------------------
  |  Branch (3158:17): [True: 18, False: 9]
  ------------------
 3159|     18|    {
 3160|     18|        int nDelta = pTCGroups->pTCG[iX[i]].st_cap - pTCGroups->pTCG[iX[i]].edges_cap;
 3161|     18|        int edge_cap = pTCGroups->pTCG[iX[i]].edges_cap + nDelta; /* added nDelta */
 3162|     18|        int edge_flow = pTCGroups->pTCG[iX[i]].edges_cap - pTCGroups->pTCG[iX[i]].edges_flow /*-nDelta*/;
 3163|       |
 3164|     18|        ret = AddEdgeFlow( edge_cap, edge_flow,
 3165|     18|                     e0X[i], pvX[i]/*src*/, pv0 /* dest*/, tot_st_cap, tot_st_flow );
 3166|       |
 3167|     18|        if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|     18|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|     18|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|     18|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|     18|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 18, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 18]
  |  |  ------------------
  ------------------
 3168|      0|        {
 3169|      0|            goto exit_function;
 3170|      0|        }
 3171|     18|    }
 3172|       |
 3173|      9|    if (fst == 0)
  ------------------
  |  Branch (3173:9): [True: 6, False: 3]
  ------------------
 3174|      6|    {
 3175|       |        /* set flow and cap for going out of pv0 and into pv1 edge */
 3176|      6|        int edge_cap = pv0->st_edge.cap;
 3177|      6|        int edge_flow = pv0->st_edge.cap - pv0->st_edge.flow;
 3178|       |
 3179|      6|        ret = AddEdgeFlow( pv0->st_edge.cap, pv0->st_edge.cap - pv0->st_edge.flow,
 3180|      6|                     e0X[0], pv0/*src*/, pv1 /* dest*/, tot_st_cap, tot_st_flow );
 3181|       |
 3182|      6|        if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      6|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      6|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      6|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      6|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 6, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 6]
  |  |  ------------------
  ------------------
 3183|      0|        {
 3184|      0|            goto exit_function;
 3185|      0|        }
 3186|       |
 3187|      6|        pTCGroups->pTCG[iX[0]].edges_cap += edge_cap;
 3188|      6|        pTCGroups->pTCG[iX[0]].edges_flow += edge_flow;
 3189|      6|        pTCGroups->pTCG[iX[0]].st_cap += edge_cap;
 3190|      6|        pTCGroups->pTCG[iX[0]].st_flow += edge_flow;
 3191|      6|    }
 3192|      3|    else
 3193|      3|    {
 3194|       |        /* no supergroup => change cap to flow */
 3195|      3|        *tot_st_cap += pv0->st_edge.flow - pv0->st_edge.cap;
 3196|      3|        pv0->st_edge.cap += pv0->st_edge.flow - pv0->st_edge.cap;
 3197|      3|        pv0->st_edge.cap0 = pv0->st_edge.cap;
 3198|      3|    }
 3199|       |
 3200|      9|    *pcur_num_vertices = cur_num_vertices;
 3201|      9|    *pcur_num_edges = cur_num_edges;
 3202|      9|    ret = num_groups;
 3203|       |
 3204|      9|exit_function:
 3205|      9|    if (e0X) inchi_free( e0X );
  ------------------
  |  | 1136|      9|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 9, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (3205:9): [True: 9, False: 0]
  ------------------
 3206|      9|    if (pvX) inchi_free( pvX );
  ------------------
  |  | 1136|      9|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 9, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (3206:9): [True: 9, False: 0]
  ------------------
 3207|      9|    if (jX) inchi_free( jX );
  ------------------
  |  | 1136|      9|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 9, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (3207:9): [True: 9, False: 0]
  ------------------
 3208|      9|    if (iX) inchi_free( iX );
  ------------------
  |  | 1136|      9|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 9, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (3208:9): [True: 9, False: 0]
  ------------------
 3209|       |
 3210|      9|    return ret;
 3211|      9|}
AddStCapFlow:
 3216|     33|{
 3217|     33|    vert_ficpoint->st_edge.flow += flow;
 3218|     33|    *tot_st_flow += flow;
 3219|     33|    vert_ficpoint->st_edge.cap += cap;
 3220|     33|    *tot_st_cap += cap;
 3221|       |
 3222|     33|    vert_ficpoint->st_edge.flow0 = vert_ficpoint->st_edge.flow;
 3223|     33|    vert_ficpoint->st_edge.cap0 = vert_ficpoint->st_edge.cap;
 3224|     33|}
AddCGroups2TCGBnStruct:
 3248|    801|{
 3249|    801|    int ret = 0, ret1, ret2, ret3, bNeedsFlower;
 3250|    801|    inp_ATOM *at = pStruct->at;
 3251|    801|    int       num_atoms = pStruct->num_atoms;
 3252|       |    /*int       num_tg           = pTCGroups->num_tgroups;*/
 3253|    801|    int       num_cg = pTCGroups->num_tc_groups - pTCGroups->num_tgroups;
 3254|    801|    int       fst_cg_vertex = pBNS->num_vertices;
 3255|    801|    int       fst_cg_group = pTCGroups->num_tgroups;
 3256|    801|    int       num_vertices = pBNS->num_vertices;
 3257|    801|    int       num_edges = pBNS->num_edges;
 3258|    801|    int       cg_charge = 0;
 3259|    801|    ICHICONST SRM *pSrm = pStruct->pSrm;
  ------------------
  |  |   41|    801|#define ICHICONST      const
  ------------------
 3260|       |
 3261|       |    /* ret = ReInitBnStruct( pBNS ); */
 3262|       |
 3263|    801|    if (num_cg > 0)
  ------------------
  |  Branch (3263:9): [True: 3, False: 798]
  ------------------
 3264|      3|    {
 3265|       |    /* if ( cgi && cgi->num_c_groups && cgi->c_group ) */
 3266|      3|        int         i, i1, i2, j, j1, j2, k, k1, k2, n, c_point, c_neigh, cap, flow;
 3267|      3|        int         cur_num_vertices, cur_num_edges;
 3268|      3|        BNS_VERTEX *vert_ficpoint, *vert_ficpoint_prev, *vert_ficpoint_base;  /* fictitious vertex describing charge c-group */
 3269|      3|        BNS_VERTEX *pv1, *pv2;
 3270|      3|        BNS_EDGE   *edge;      /* edge between that vertex and the tautomeric c_point */
 3271|      3|        int        nMaxCGroupNumber = 0;
 3272|      3|        MY_CONST C_NODE *pCN;
  ------------------
  |  |  296|      3|#define MY_CONST  const
  ------------------
 3273|      3|        int              cn_len, cn_bits, bMetalAtoms;
 3274|      3|        int              type;
 3275|      3|        int        tot_st_cap, tot_st_flow;
 3276|      3|        int        nAddGroups[16];
 3277|       |
 3278|       |
 3279|       |        /* Debug: check overflow */
 3280|      3|        if (num_vertices >= pBNS->max_vertices)
  ------------------
  |  Branch (3280:13): [True: 0, False: 3]
  ------------------
 3281|      0|        {
 3282|      0|            return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   82|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3283|      0|        }
 3284|       |
 3285|      3|        nMaxCGroupNumber = num_cg;
 3286|       |        /* clear all vertices not used until now */
 3287|      3|        memset( pBNS->vert + num_vertices, 0, ( pBNS->max_vertices - num_vertices ) * sizeof( pBNS->vert[0] ) );
 3288|      3|        tot_st_cap = pBNS->tot_st_cap;
 3289|      3|        tot_st_flow = pBNS->tot_st_flow;
 3290|       |
 3291|       |        /*****************************************/
 3292|       |        /* initialize new fictitious vertices    */
 3293|       |        /* representing c-point groups, c-groups */
 3294|       |        /*****************************************/
 3295|      3|        vert_ficpoint_prev = pBNS->vert + fst_cg_vertex - 1;
 3296|       |
 3297|     21|        for (i = 0; i < num_cg; i++)
  ------------------
  |  Branch (3297:21): [True: 18, False: 3]
  ------------------
 3298|     18|        {
 3299|       |            /*
 3300|       |              vert_ficpoint-1 is the last vertex;
 3301|       |              vert_ficpoint   is the being added vertex
 3302|       |              Note: nGroupNumber are not contiguous
 3303|       |            */
 3304|     18|            vert_ficpoint = vert_ficpoint_prev + 1;
 3305|     18|            vert_ficpoint->iedge = vert_ficpoint_prev->iedge + vert_ficpoint_prev->max_adj_edges;
 3306|     18|            vert_ficpoint->max_adj_edges = pTCGroups->pTCG[i + fst_cg_group].num_edges + nMaxAddEdges;
 3307|     18|            vert_ficpoint->num_adj_edges = 0;
 3308|       |
 3309|     18|            vert_ficpoint->st_edge.flow += pTCGroups->pTCG[i + fst_cg_group].st_flow;
 3310|     18|            tot_st_flow += pTCGroups->pTCG[i + fst_cg_group].st_flow;
 3311|     18|            vert_ficpoint->st_edge.cap += pTCGroups->pTCG[i + fst_cg_group].st_cap;
 3312|     18|            tot_st_cap += pTCGroups->pTCG[i + fst_cg_group].st_cap;
 3313|       |
 3314|     18|            vert_ficpoint->st_edge.flow0 = vert_ficpoint->st_edge.flow;
 3315|     18|            vert_ficpoint->st_edge.cap0 = vert_ficpoint->st_edge.cap;
 3316|       |
 3317|     18|            vert_ficpoint->type = pTCGroups->pTCG[i + fst_cg_group].type;
 3318|       |            /* save the vertex number */
 3319|     18|            pTCGroups->pTCG[i + fst_cg_group].nVertexNumber = (int) ( vert_ficpoint - pBNS->vert );
 3320|       |
 3321|     18|            vert_ficpoint_prev = vert_ficpoint; /* keep track of iedges */
 3322|     18|        }
 3323|       |
 3324|      3|        cur_num_vertices = (int) ( vert_ficpoint_prev - pBNS->vert ) + 1;
 3325|      3|        cur_num_edges = num_edges;
 3326|       |
 3327|       |        /*************************************************************/
 3328|       |        /* pass 1:                                                   */
 3329|       |        /* create ChargeStruct for c-points and connect them to      */
 3330|       |        /* the vertices representing c-point groups;                 */
 3331|       |        /* set final atom st_cap, st_flow                            */
 3332|       |        /*************************************************************/
 3333|     18|        for (c_point = 0; c_point < num_atoms; c_point++)
  ------------------
  |  Branch (3333:27): [True: 15, False: 3]
  ------------------
 3334|     15|        {
 3335|     15|            if (!( k = pVA[c_point].cnListIndex ))
  ------------------
  |  Branch (3335:17): [True: 0, False: 15]
  ------------------
 3336|      0|                continue;  /* not a c-point */
 3337|       |
 3338|     15|            k--;
 3339|     15|            pCN = cnList[k].pCN;   /* pointer to the ChargeStruct */
 3340|     15|            cn_len = cnList[k].len;   /* length of the ChargeStruct  */
 3341|     15|            cn_bits = cnList[k].bits;  /* bits: for M-recognition */
 3342|       |            /* cn_bits = cnList[k].bits; */ /* ChargeStruct type */
 3343|     15|            bMetalAtoms = ( cn_bits == cn_bits_Me );
  ------------------
  |  |  468|     15|#define cn_bits_Me (-1)
  ------------------
 3344|     15|            vert_ficpoint_base = vert_ficpoint_prev; /* add aux vertices after this */
 3345|       |
 3346|       |            /* create disconnected auxiliary vertices of the at[c_point] ChargeStruct; add to them st_flow & st_cap */
 3347|     73|            for (i1 = 0; i1 < cn_len; i1++)
  ------------------
  |  Branch (3347:26): [True: 58, False: 15]
  ------------------
 3348|     58|            {
 3349|     58|                if (!IS_BNS_VT_CHRG_STRUCT( pCN[i1].v.type ))
  ------------------
  |  |  110|     58|#define IS_BNS_VT_CHRG_STRUCT(X)    (((X) & BNS_VERT_TYPE__AUX) &&  ((X) & BNS_VERT_TYPE_TEMP))
  |  |  ------------------
  |  |  |  |   81|     58|#define BNS_VERT_TYPE__AUX          0x0080  /* vertex added to build charge substructures */
  |  |  ------------------
  |  |               #define IS_BNS_VT_CHRG_STRUCT(X)    (((X) & BNS_VERT_TYPE__AUX) &&  ((X) & BNS_VERT_TYPE_TEMP))
  |  |  ------------------
  |  |  |  |   79|     18|#define BNS_VERT_TYPE_TEMP          0x0040
  |  |  ------------------
  |  |  |  Branch (110:38): [True: 18, False: 40]
  |  |  |  Branch (110:69): [True: 18, False: 0]
  |  |  ------------------
  ------------------
 3350|     40|                {
 3351|     40|                    continue;
 3352|     40|                }
 3353|       |                /* the atom is always the first; the attached c-points are always the last */
 3354|     18|                vert_ficpoint = vert_ficpoint_base + i1; /* i1 = 1, 2,.. less number of attached c-points */
 3355|     18|                vert_ficpoint->iedge = vert_ficpoint_prev->iedge + vert_ficpoint_prev->max_adj_edges;
 3356|     18|                vert_ficpoint->max_adj_edges = pCN[i1].v.valence; /* do not add additional edges to aux vertices */
 3357|     18|                vert_ficpoint->num_adj_edges = 0;
 3358|       |
 3359|     18|                cap = !bMetalAtoms ? pCN[i1].v.cap : pCN[i1].v.cap ? pSrm->nMetalMaxCharge_D : 0;
  ------------------
  |  Branch (3359:23): [True: 18, False: 0]
  |  Branch (3359:54): [True: 0, False: 0]
  ------------------
 3360|     18|                flow = !bMetalAtoms ? pCN[i1].v.flow : pCN[i1].v.flow ? pSrm->nMetalMaxCharge_D : 0;
  ------------------
  |  Branch (3360:24): [True: 18, False: 0]
  |  Branch (3360:56): [True: 0, False: 0]
  ------------------
 3361|       |
 3362|     18|                AddStCapFlow( vert_ficpoint, &tot_st_flow, &tot_st_cap, cap, flow );
 3363|     18|                vert_ficpoint->type = pCN[i1].v.type; /* =BNS_VERT_TYPE__AUX */
 3364|       |
 3365|     18|                vert_ficpoint_prev = vert_ficpoint; /* the last one will be vert_ficpoint for the next c-point */
 3366|     18|                cur_num_vertices = (int) ( vert_ficpoint - pBNS->vert ) + 1;
 3367|       |
 3368|     18|                if (vert_ficpoint->iedge + vert_ficpoint->max_adj_edges - pBNS->iedge >= pBNS->max_iedges)
  ------------------
  |  Branch (3368:21): [True: 0, False: 18]
  ------------------
 3369|      0|                {
 3370|      0|                    return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   82|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3371|      0|                }
 3372|     18|                if (cur_num_vertices >= pBNS->max_vertices)
  ------------------
  |  Branch (3372:21): [True: 0, False: 18]
  ------------------
 3373|      0|                {
 3374|      0|                    return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   82|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3375|      0|                }
 3376|     18|            }
 3377|       |
 3378|       |            /* connect the vertices with new edges, add edge flow and cap */
 3379|     73|            for (i1 = 0; i1 < cn_len; i1++)
  ------------------
  |  Branch (3379:26): [True: 58, False: 15]
  ------------------
 3380|     58|            {
 3381|     58|                pv1 = NULL;
 3382|     58|                k1 = -1;
 3383|       |
 3384|       |                /* find vertex corresponding to i1 */
 3385|       |
 3386|     58|                if (pCN[i1].v.type & BNS_VERT_TYPE_ATOM)
  ------------------
  |  |   73|     58|#define BNS_VERT_TYPE_ATOM          0x0001
  ------------------
  |  Branch (3386:21): [True: 15, False: 43]
  ------------------
 3387|     15|                {
 3388|     15|                    pv1 = pBNS->vert + c_point; /* may be only one atom -- the current c_point at i1==0 */
 3389|       |                    /* add atom vertex st_cap and st_flow */
 3390|     15|                    cap = !bMetalAtoms ? pCN[i1].v.cap : pCN[i1].v.cap ? pSrm->nMetalMaxCharge_D : 0;
  ------------------
  |  Branch (3390:27): [True: 15, False: 0]
  |  Branch (3390:58): [True: 0, False: 0]
  ------------------
 3391|     15|                    flow = !bMetalAtoms ? pCN[i1].v.flow : pCN[i1].v.flow ? pSrm->nMetalMaxCharge_D : 0;
  ------------------
  |  Branch (3391:28): [True: 15, False: 0]
  |  Branch (3391:60): [True: 0, False: 0]
  ------------------
 3392|     15|                    AddStCapFlow( pv1, &tot_st_flow, &tot_st_cap, cap, flow );
 3393|     15|                }
 3394|       |
 3395|     43|                else if (IS_BNS_VT_C_GR( pCN[i1].v.type ))
  ------------------
  |  |  106|     43|#define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   99|     43|#define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|     43|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  |  |  ------------------
  |  |  |  |               #define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|     43|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   77|     43|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  |  |  |  Branch (106:37): [True: 25, False: 18]
  |  |  ------------------
  ------------------
 3396|     25|                {
 3397|       |                    /* find c-group vertex by looking for its type */
 3398|     70|                    for (j = 0; j < num_cg; j++)
  ------------------
  |  Branch (3398:33): [True: 70, False: 0]
  ------------------
 3399|     70|                    {
 3400|     70|                        if (pCN[i1].v.type == pBNS->vert[fst_cg_vertex + j].type)
  ------------------
  |  Branch (3400:29): [True: 25, False: 45]
  ------------------
 3401|     25|                        {
 3402|     25|                            pv1 = pBNS->vert + fst_cg_vertex + j;
 3403|     25|                            break;
 3404|     25|                        }
 3405|     70|                    }
 3406|       |                    /* index of the pTCGroups->pTCG[] */
 3407|     25|                    if (pv1)
  ------------------
  |  Branch (3407:25): [True: 25, False: 0]
  ------------------
 3408|     25|                    {
 3409|     25|                        k1 = j + fst_cg_group;
 3410|     25|                        if (pTCGroups->pTCG[k1].type != pCN[i1].v.type ||
  ------------------
  |  Branch (3410:29): [True: 0, False: 25]
  ------------------
 3411|     25|                             pTCGroups->pTCG[k1].ord_num)
  ------------------
  |  Branch (3411:30): [True: 0, False: 25]
  ------------------
 3412|      0|                        {
 3413|      0|                            return RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 3414|      0|                        }
 3415|     25|                    }
 3416|     25|                }
 3417|       |
 3418|     18|                else if (IS_BNS_VT_M_GR( pCN[i1].v.type ))
  ------------------
  |  |  108|     18|#define IS_BNS_VT_M_GR(X)           ((X) == BNS_VERT_TYPE_METAL_GR )  /* metal flower base or vertices */
  |  |  ------------------
  |  |  |  |   85|     18|#define BNS_VERT_TYPE_METAL_GR      0x0800  /* metal atom group; may be used alone or with BNS_VT_M_POS, BNS_VT_M_NEG */
  |  |  ------------------
  |  |  |  Branch (108:37): [True: 0, False: 18]
  |  |  ------------------
  ------------------
 3419|      0|                {
 3420|      0|                    k1 = pTCGroups->nGroup[TCG_MeFlower0];
 3421|      0|                    if (k1 < 0 ||
  ------------------
  |  Branch (3421:25): [True: 0, False: 0]
  ------------------
 3422|      0|                         pTCGroups->pTCG[k1].type != pCN[i1].v.type ||
  ------------------
  |  Branch (3422:26): [True: 0, False: 0]
  ------------------
 3423|      0|                             pTCGroups->pTCG[k1].ord_num ||
  ------------------
  |  Branch (3423:30): [True: 0, False: 0]
  ------------------
 3424|      0|                             !pSrm->bMetalAddFlower)
  ------------------
  |  Branch (3424:30): [True: 0, False: 0]
  ------------------
 3425|      0|                    {
 3426|      0|                        return RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 3427|      0|                    }
 3428|      0|                    pv1 = pBNS->vert + pTCGroups->pTCG[k1].nVertexNumber;
 3429|      0|                }
 3430|       |
 3431|     18|                else if (IS_BNS_VT_CHRG_STRUCT( pCN[i1].v.type ))
  ------------------
  |  |  110|     18|#define IS_BNS_VT_CHRG_STRUCT(X)    (((X) & BNS_VERT_TYPE__AUX) &&  ((X) & BNS_VERT_TYPE_TEMP))
  |  |  ------------------
  |  |  |  |   81|     18|#define BNS_VERT_TYPE__AUX          0x0080  /* vertex added to build charge substructures */
  |  |  ------------------
  |  |               #define IS_BNS_VT_CHRG_STRUCT(X)    (((X) & BNS_VERT_TYPE__AUX) &&  ((X) & BNS_VERT_TYPE_TEMP))
  |  |  ------------------
  |  |  |  |   79|     18|#define BNS_VERT_TYPE_TEMP          0x0040
  |  |  ------------------
  |  |  |  Branch (110:38): [True: 18, False: 0]
  |  |  |  Branch (110:69): [True: 18, False: 0]
  |  |  ------------------
  ------------------
 3432|     18|                {
 3433|       |                    /* aux vertex */
 3434|     18|                    pv1 = vert_ficpoint_base + i1;
 3435|     18|                }
 3436|       |
 3437|     58|                if (!pv1)
  ------------------
  |  Branch (3437:21): [True: 0, False: 58]
  ------------------
 3438|      0|                {
 3439|      0|                    return BNS_BOND_ERR;
  ------------------
  |  |   80|      0|#define BNS_BOND_ERR       (BNS_ERR +  4) /*(-9995)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3440|      0|                }
 3441|       |
 3442|       |                /* connect pairs of vertices with new edges */
 3443|    103|                for (k = 0; k < MAX_CN_VAL && ( i2 = pCN[i1].e[k].neigh ); k++)
  ------------------
  |  |  425|    206|#define MAX_CN_VAL 3
  ------------------
  |  Branch (3443:29): [True: 103, False: 0]
  |  Branch (3443:47): [True: 45, False: 58]
  ------------------
 3444|     45|                {
 3445|     45|                    pv2 = NULL;
 3446|     45|                    k2 = -1;
 3447|     45|                    i2--; /* neighbor */
 3448|       |
 3449|       |                    /* find vertex corresponding to i2 */
 3450|       |
 3451|     45|                    if (pCN[i2].v.type & BNS_VERT_TYPE_ATOM)
  ------------------
  |  |   73|     45|#define BNS_VERT_TYPE_ATOM          0x0001
  ------------------
  |  Branch (3451:25): [True: 0, False: 45]
  ------------------
 3452|      0|                    {
 3453|      0|                        pv2 = pBNS->vert + c_point;
 3454|      0|                        cap = !bMetalAtoms ? pCN[i2].v.cap : pCN[i2].v.cap ? pSrm->nMetalMaxCharge_D : 0;
  ------------------
  |  Branch (3454:31): [True: 0, False: 0]
  |  Branch (3454:62): [True: 0, False: 0]
  ------------------
 3455|      0|                        flow = !bMetalAtoms ? pCN[i2].v.flow : pCN[i2].v.flow ? pSrm->nMetalMaxCharge_D : 0;
  ------------------
  |  Branch (3455:32): [True: 0, False: 0]
  |  Branch (3455:64): [True: 0, False: 0]
  ------------------
 3456|       |                        /* add atom vertex st_cap and st_flow; this normally should not happen */
 3457|      0|                        AddStCapFlow( pv2, &tot_st_flow, &tot_st_cap, cap, flow );
 3458|      0|                    }
 3459|       |
 3460|     45|                    else if (IS_BNS_VT_C_GR( pCN[i2].v.type ))
  ------------------
  |  |  106|     45|#define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   99|     45|#define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|     45|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  |  |  ------------------
  |  |  |  |               #define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|     45|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   77|     45|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  |  |  |  Branch (106:37): [True: 25, False: 20]
  |  |  ------------------
  ------------------
 3461|     25|                    {
 3462|       |                        /* find c-group vertex by looking for its type */
 3463|     70|                        for (j = 0; j < num_cg; j++)
  ------------------
  |  Branch (3463:37): [True: 70, False: 0]
  ------------------
 3464|     70|                        {
 3465|     70|                            if (pCN[i2].v.type == pBNS->vert[fst_cg_vertex + j].type)
  ------------------
  |  Branch (3465:33): [True: 25, False: 45]
  ------------------
 3466|     25|                            {
 3467|     25|                                pv2 = pBNS->vert + fst_cg_vertex + j;
 3468|     25|                                break;
 3469|     25|                            }
 3470|     70|                        }
 3471|     25|                        if (pv2)
  ------------------
  |  Branch (3471:29): [True: 25, False: 0]
  ------------------
 3472|     25|                        {
 3473|     25|                            k2 = j + fst_cg_group;
 3474|     25|                            if (pTCGroups->pTCG[k2].type != pCN[i2].v.type ||
  ------------------
  |  Branch (3474:33): [True: 0, False: 25]
  ------------------
 3475|     25|                                 pTCGroups->pTCG[k2].ord_num)
  ------------------
  |  Branch (3475:34): [True: 0, False: 25]
  ------------------
 3476|      0|                            {
 3477|      0|                                return RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 3478|      0|                            }
 3479|     25|                        }
 3480|     25|                    }
 3481|       |
 3482|     20|                    else if (IS_BNS_VT_M_GR( pCN[i2].v.type ))
  ------------------
  |  |  108|     20|#define IS_BNS_VT_M_GR(X)           ((X) == BNS_VERT_TYPE_METAL_GR )  /* metal flower base or vertices */
  |  |  ------------------
  |  |  |  |   85|     20|#define BNS_VERT_TYPE_METAL_GR      0x0800  /* metal atom group; may be used alone or with BNS_VT_M_POS, BNS_VT_M_NEG */
  |  |  ------------------
  |  |  |  Branch (108:37): [True: 0, False: 20]
  |  |  ------------------
  ------------------
 3483|      0|                    {
 3484|      0|                        k2 = pTCGroups->nGroup[TCG_MeFlower0];
 3485|      0|                        if (k2 < 0 ||
  ------------------
  |  Branch (3485:29): [True: 0, False: 0]
  ------------------
 3486|      0|                             pTCGroups->pTCG[k2].type != pCN[i2].v.type ||
  ------------------
  |  Branch (3486:30): [True: 0, False: 0]
  ------------------
 3487|      0|                                 pTCGroups->pTCG[k2].ord_num ||
  ------------------
  |  Branch (3487:34): [True: 0, False: 0]
  ------------------
 3488|      0|                                 !pSrm->bMetalAddFlower)
  ------------------
  |  Branch (3488:34): [True: 0, False: 0]
  ------------------
 3489|      0|                        {
 3490|      0|                            return RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 3491|      0|                        }
 3492|      0|                        pv2 = pBNS->vert + pTCGroups->pTCG[k2].nVertexNumber;
 3493|      0|                    }
 3494|       |
 3495|     20|                    else if (IS_BNS_VT_CHRG_STRUCT( pCN[i2].v.type ))
  ------------------
  |  |  110|     20|#define IS_BNS_VT_CHRG_STRUCT(X)    (((X) & BNS_VERT_TYPE__AUX) &&  ((X) & BNS_VERT_TYPE_TEMP))
  |  |  ------------------
  |  |  |  |   81|     20|#define BNS_VERT_TYPE__AUX          0x0080  /* vertex added to build charge substructures */
  |  |  ------------------
  |  |               #define IS_BNS_VT_CHRG_STRUCT(X)    (((X) & BNS_VERT_TYPE__AUX) &&  ((X) & BNS_VERT_TYPE_TEMP))
  |  |  ------------------
  |  |  |  |   79|     20|#define BNS_VERT_TYPE_TEMP          0x0040
  |  |  ------------------
  |  |  |  Branch (110:38): [True: 20, False: 0]
  |  |  |  Branch (110:69): [True: 20, False: 0]
  |  |  ------------------
  ------------------
 3496|     20|                    {
 3497|     20|                        pv2 = vert_ficpoint_base + i2;
 3498|     20|                    }
 3499|       |
 3500|       |                    /* connect pv1 and pv2 */
 3501|     45|                    if (!pv1 || !pv2 || pv1 == pv2)
  ------------------
  |  Branch (3501:25): [True: 0, False: 45]
  |  Branch (3501:33): [True: 0, False: 45]
  |  Branch (3501:41): [True: 0, False: 45]
  ------------------
 3502|      0|                    {
 3503|      0|                        return BNS_BOND_ERR;
  ------------------
  |  |   80|      0|#define BNS_BOND_ERR       (BNS_ERR +  4) /*(-9995)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3504|      0|                    }
 3505|       |
 3506|     45|                    j1 = (int) ( pv1 - pBNS->vert );
 3507|     45|                    j2 = (int) ( pv2 - pBNS->vert );
 3508|       |
 3509|       |                    /* create a new edge connecting pv1 and pv2 */
 3510|     45|                    edge = pBNS->edge + cur_num_edges;
 3511|     45|                    if (IS_BNS_VT_M_GR( pCN[i1].v.type ) && IS_BNS_VT_ATOM( pCN[i2].v.type ) ||
  ------------------
  |  |  108|     90|#define IS_BNS_VT_M_GR(X)           ((X) == BNS_VERT_TYPE_METAL_GR )  /* metal flower base or vertices */
  |  |  ------------------
  |  |  |  |   85|     45|#define BNS_VERT_TYPE_METAL_GR      0x0800  /* metal atom group; may be used alone or with BNS_VT_M_POS, BNS_VT_M_NEG */
  |  |  ------------------
  |  |  |  Branch (108:37): [True: 0, False: 45]
  |  |  ------------------
  ------------------
                                  if (IS_BNS_VT_M_GR( pCN[i1].v.type ) && IS_BNS_VT_ATOM( pCN[i2].v.type ) ||
  ------------------
  |  |  111|     45|#define IS_BNS_VT_ATOM(X)           ((X) & BNS_VERT_TYPE_ATOM)
  |  |  ------------------
  |  |  |  |   73|      0|#define BNS_VERT_TYPE_ATOM          0x0001
  |  |  ------------------
  |  |  |  Branch (111:37): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3512|     45|                         IS_BNS_VT_M_GR( pCN[i2].v.type ) && IS_BNS_VT_ATOM( pCN[i1].v.type ))
  ------------------
  |  |  108|     90|#define IS_BNS_VT_M_GR(X)           ((X) == BNS_VERT_TYPE_METAL_GR )  /* metal flower base or vertices */
  |  |  ------------------
  |  |  |  |   85|     45|#define BNS_VERT_TYPE_METAL_GR      0x0800  /* metal atom group; may be used alone or with BNS_VT_M_POS, BNS_VT_M_NEG */
  |  |  ------------------
  |  |  |  Branch (108:37): [True: 0, False: 45]
  |  |  ------------------
  ------------------
                                       IS_BNS_VT_M_GR( pCN[i2].v.type ) && IS_BNS_VT_ATOM( pCN[i1].v.type ))
  ------------------
  |  |  111|      0|#define IS_BNS_VT_ATOM(X)           ((X) & BNS_VERT_TYPE_ATOM)
  |  |  ------------------
  |  |  |  |   73|      0|#define BNS_VERT_TYPE_ATOM          0x0001
  |  |  ------------------
  |  |  |  Branch (111:37): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3513|      0|                    {
 3514|       |                        /* at[c_point] is a metal or is treated as a metal; connect it to M-group */
 3515|       |                        /* metal - M-group (i.e. Metal-Flower) edge */
 3516|      0|                        int nStCap, nStFlow;
 3517|      0|                        bNeedsFlower = AtomStcapStflow( at, pVA, pSrm, c_point, &nStCap, &nStFlow, &edge->cap, &edge->flow );
 3518|       |                        /* GetAtomToMCGroupInitEdgeCapFlow( &edge->cap, &edge->flow, pSrm, at, pVA, c_point ); */
 3519|      0|                        if (!bNeedsFlower)
  ------------------
  |  Branch (3519:29): [True: 0, False: 0]
  ------------------
 3520|      0|                        {
 3521|      0|                            return RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 3522|      0|                        }
 3523|      0|                        pVA[c_point].nMetalGroupEdge = cur_num_edges + 1;
 3524|       |                        /* pBNS->vert[c_point].st_edge.cap  += edge->flow;*/ /* where was this done ???*/
 3525|      0|                        pBNS->vert[c_point].st_edge.flow += edge->flow;
 3526|      0|                        pBNS->vert[c_point].st_edge.cap += edge->flow + pVA[c_point].cInitFreeValences;
 3527|      0|                        pBNS->vert[c_point].st_edge.flow0 = pBNS->vert[c_point].st_edge.flow;
 3528|      0|                        pBNS->vert[c_point].st_edge.cap0 = pBNS->vert[c_point].st_edge.cap;
 3529|      0|                        tot_st_flow += edge->flow;
 3530|      0|                        tot_st_cap += edge->flow + pVA[c_point].cInitFreeValences;
 3531|      0|                    }
 3532|     45|                    else
 3533|     45|                    {
 3534|     45|                        edge->cap = !bMetalAtoms ? pCN[i1].e[k].cap : pCN[i1].e[k].cap ? pSrm->nMetalMaxCharge_D : 0;
  ------------------
  |  Branch (3534:37): [True: 45, False: 0]
  |  Branch (3534:71): [True: 0, False: 0]
  ------------------
 3535|     45|                        edge->flow = !bMetalAtoms ? pCN[i1].e[k].flow : pCN[i1].e[k].flow ? pSrm->nMetalMaxCharge_D : 0;
  ------------------
  |  Branch (3535:38): [True: 45, False: 0]
  |  Branch (3535:73): [True: 0, False: 0]
  ------------------
 3536|     45|                    }
 3537|       |
 3538|     45|                    edge->forbidden = pCN[i1].e[k].bForbiddenEdge ? BNS_EDGE_FORBIDDEN_MASK : 0;
  ------------------
  |  |   67|      0|#define BNS_EDGE_FORBIDDEN_MASK  1
  ------------------
  |  Branch (3538:39): [True: 0, False: 45]
  ------------------
 3539|       |
 3540|       |                    /* c-group incoming edges cap and flow needed in ConnectSuperCGroup() */
 3541|       |                    /*
 3542|       |                    if ( k1 >= 0 ) {
 3543|       |                        pTCGroups->pTCG[k1].edges_cap  += pCN[i1].e[k].cap;
 3544|       |                        pTCGroups->pTCG[k1].edges_flow += pCN[i1].e[k].flow;
 3545|       |                    }
 3546|       |                    if ( k2 >= 0 ) {
 3547|       |                        pTCGroups->pTCG[k2].edges_cap  += pCN[i1].e[k].cap;
 3548|       |                        pTCGroups->pTCG[k2].edges_flow += pCN[i1].e[k].flow;
 3549|       |                    }
 3550|       |                    */
 3551|       |
 3552|     45|                    edge->pass = 0;
 3553|       |
 3554|       |#if ( RESET_EDGE_FORBIDDEN_MASK == 1 )
 3555|       |                    edge->forbidden &= pBNS->edge_forbidden_mask;
 3556|       |#endif
 3557|       |
 3558|       |                    /* check edge overflow */
 3559|     45|                    if (pv1->num_adj_edges >= pv1->max_adj_edges ||
  ------------------
  |  Branch (3559:25): [True: 0, False: 45]
  ------------------
 3560|     45|                         pv2->num_adj_edges >= pv2->max_adj_edges ||
  ------------------
  |  Branch (3560:26): [True: 0, False: 45]
  ------------------
 3561|     45|                         cur_num_edges >= pBNS->max_edges)
  ------------------
  |  Branch (3561:26): [True: 0, False: 45]
  ------------------
 3562|      0|                    {
 3563|      0|                        return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   82|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3564|      0|                    }
 3565|       |
 3566|       |                    /* connect edge to the incident vertices and increment the counters of neighbors and edges */
 3567|       |
 3568|     45|                    ret = ConnectTwoVertices( pv1, pv2, edge, pBNS, 0 );
 3569|       |
 3570|     45|                    if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|     45|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|     45|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|     45|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|     45|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 45, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 45]
  |  |  ------------------
  ------------------
 3571|      0|                    {
 3572|      0|                        return ret;
 3573|      0|                    }
 3574|       |
 3575|     45|                    edge->cap0 = edge->cap;
 3576|     45|                    edge->flow0 = edge->flow;
 3577|       |
 3578|       |                    /* save the edge index */
 3579|     45|                    type = IS_BNS_VT_C_GR( pv1->type ) ? pv1->type :
  ------------------
  |  |  106|     45|#define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   99|     45|#define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|     45|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  |  |  ------------------
  |  |  |  |               #define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|     45|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   77|     45|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  |  |  |  Branch (106:37): [True: 0, False: 45]
  |  |  ------------------
  ------------------
 3580|     45|                        IS_BNS_VT_C_GR( pv2->type ) ? pv2->type : 0;
  ------------------
  |  |  106|     45|#define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   99|     45|#define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|     45|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  |  |  ------------------
  |  |  |  |               #define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|     45|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   77|     45|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  |  |  |  Branch (106:37): [True: 25, False: 20]
  |  |  ------------------
  ------------------
 3581|     45|                    if (type)
  ------------------
  |  Branch (3581:25): [True: 25, False: 20]
  ------------------
 3582|     25|                    {
 3583|       |                        /* the edge connects to a c-group */
 3584|     25|                        if (type & BNS_VERT_TYPE_C_NEGATIVE)
  ------------------
  |  |   82|     25|#define BNS_VERT_TYPE_C_NEGATIVE    0x0100  /* negative charge group; attribute, should be used with BNS_VERT_TYPE_C_GROUP */
  ------------------
  |  Branch (3584:29): [True: 11, False: 14]
  ------------------
 3585|     11|                        {
 3586|     11|                            pVA[c_point].nCMinusGroupEdge = cur_num_edges + 1;
 3587|     11|                        }
 3588|     14|                        else
 3589|     14|                        {
 3590|     14|                            pVA[c_point].nCPlusGroupEdge = cur_num_edges + 1;
 3591|     14|                        }
 3592|     25|                    }
 3593|     45|                    cur_num_edges++; /* end of new edge creation */
 3594|     45|                }
 3595|     58|            }
 3596|     15|        }
 3597|       |
 3598|       |
 3599|       |        /*************************************************************/
 3600|       |        /* pass 2:                                                   */
 3601|       |        /* adjust bond cap, flow from the final atom st_cap, st_flow */
 3602|       |        /*************************************************************/
 3603|     18|        for (c_point = 0; c_point < num_atoms; c_point++)
  ------------------
  |  Branch (3603:27): [True: 15, False: 3]
  ------------------
 3604|     15|        {
 3605|     15|            int st_cap, st_cap2, max_edge_flow;
 3606|     15|            pv1 = pBNS->vert + c_point;  /* atom vertex */
 3607|     15|            st_cap = pv1->st_edge.cap;
 3608|     60|            for (k = 0; k < pv1->num_adj_edges; k++)
  ------------------
  |  Branch (3608:25): [True: 45, False: 15]
  ------------------
 3609|     45|            {
 3610|     45|                edge = pBNS->edge + pv1->iedge[k];      /* incident edge */
 3611|     45|                c_neigh = edge->neighbor12 ^ c_point;   /* adjacent vertex */
 3612|     45|                pv2 = pBNS->vert + c_neigh;
 3613|     45|                if (c_neigh > c_point || !( pv2->type & BNS_VERT_TYPE_ATOM ))
  ------------------
  |  |   73|     12|#define BNS_VERT_TYPE_ATOM          0x0001
  ------------------
  |  Branch (3613:21): [True: 33, False: 12]
  |  Branch (3613:42): [True: 0, False: 12]
  ------------------
 3614|     33|                {
 3615|     33|                    continue;
 3616|     33|                }
 3617|       |                /* adjacent vertex is an atom; the edge is a bond; process each bond only once */
 3618|     12|                st_cap2 = pv2->st_edge.cap;
 3619|       |                /* the edge flow <= min( incident atom st_caps) */
 3620|     12|                max_edge_flow = inchi_min( st_cap, st_cap2 );
  ------------------
  |  |  167|     12|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 2, False: 10]
  |  |  ------------------
  ------------------
 3621|       |                /* bond order <= triple bond (flow=2) */
 3622|     12|                if (pSrm->bMetalAddFlower && !pSrm->nMetalMinBondOrder &&
  ------------------
  |  Branch (3622:21): [True: 12, False: 0]
  |  Branch (3622:46): [True: 12, False: 0]
  ------------------
 3623|     12|                    ( pVA[c_point].cMetal && pVA[c_point].cNumBondsToMetal ||
  ------------------
  |  Branch (3623:23): [True: 0, False: 12]
  |  Branch (3623:46): [True: 0, False: 0]
  ------------------
 3624|     12|                        pVA[c_neigh].cMetal && pVA[c_neigh].cNumBondsToMetal ))
  ------------------
  |  Branch (3624:25): [True: 0, False: 12]
  |  Branch (3624:48): [True: 0, False: 0]
  ------------------
 3625|      0|                {
 3626|      0|                    max_edge_flow = inchi_min( max_edge_flow, MAX_BOND_EDGE_CAP + 1 );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3627|      0|                }
 3628|     12|                else
 3629|     12|                {
 3630|     12|                    max_edge_flow = inchi_min( max_edge_flow, MAX_BOND_EDGE_CAP );
  ------------------
  |  |  167|     12|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 4, False: 8]
  |  |  ------------------
  ------------------
 3631|     12|                }
 3632|     12|                if (at[c_point].bond_type[k] == BOND_TYPE_SINGLE)
  ------------------
  |  |   60|     12|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (3632:21): [True: 12, False: 0]
  ------------------
 3633|     12|                {
 3634|       |                    /* the bond has not been changed due to stereo */
 3635|     12|                    edge->cap = edge->cap0 = max_edge_flow;
 3636|     12|                }
 3637|     12|            }
 3638|     15|        }
 3639|       |
 3640|       |        /***********************************************************/
 3641|       |        /**************                                 ************/
 3642|       |        /************** connect M-flower with new edges ************/
 3643|       |        /**************                                 ************/
 3644|       |        /***********************************************************/
 3645|       |
 3646|      3|        ret = ConnectMetalFlower( &cur_num_vertices, &cur_num_edges, &tot_st_cap, &tot_st_flow, pSrm, pBNS, pTCGroups );
 3647|       |
 3648|      3|        if (ret < 0)
  ------------------
  |  Branch (3648:13): [True: 0, False: 3]
  ------------------
 3649|      0|        {
 3650|      0|            goto exit_function;
 3651|      0|        }
 3652|       |
 3653|       |        /***********************************************************/
 3654|       |        /**************                                 ************/
 3655|       |        /************** add additional vertices & edges ************/
 3656|       |        /************** to connect c-groups             ************/
 3657|       |        /**************                                 ************/
 3658|       |        /***********************************************************/
 3659|       |
 3660|       |        /* (+) supergroup, Y-connection */
 3661|       |
 3662|      3|        k = 0;
 3663|      3|        nAddGroups[k++] = TCG_Plus0;
 3664|      3|        nAddGroups[k++] = TCG_Plus_C0;
 3665|      3|        nAddGroups[k++] = TCG_Plus_M0;
 3666|       |
 3667|      3|        ret1 = ConnectSuperCGroup( TCG_Plus,
 3668|      3|                                   nAddGroups,
 3669|      3|                                   k,
 3670|      3|                                   &cur_num_vertices,
 3671|      3|                                   &cur_num_edges,
 3672|      3|                                   &tot_st_cap,
 3673|      3|                                   &tot_st_flow,
 3674|      3|                                   pBNS,
 3675|      3|                                   pTCGroups );
 3676|       |
 3677|       |        /* (-) supergroup, Y-connection */
 3678|       |
 3679|      3|        k = 0;
 3680|      3|        nAddGroups[k++] = TCG_Minus0;
 3681|      3|        nAddGroups[k++] = TCG_Minus_C0;
 3682|      3|        nAddGroups[k++] = TCG_Minus_M0;
 3683|       |
 3684|      3|        ret2 = ConnectSuperCGroup( TCG_Minus,
 3685|      3|                                   nAddGroups,
 3686|      3|                                   k,
 3687|      3|                                   &cur_num_vertices,
 3688|      3|                                   &cur_num_edges,
 3689|      3|                                   &tot_st_cap,
 3690|      3|                                   &tot_st_flow,
 3691|      3|                                   pBNS,
 3692|      3|                                   pTCGroups );
 3693|       |
 3694|       |        /******** connect (+) and (-) ***************/
 3695|       |
 3696|      3|        k = 0;
 3697|      3|        nAddGroups[k++] = TCG_Plus;
 3698|      3|        nAddGroups[k++] = TCG_Minus;
 3699|       |
 3700|      3|        ret3 = ConnectSuperCGroup( -1,
 3701|      3|                                    nAddGroups,
 3702|      3|                                    k,
 3703|      3|                                    &cur_num_vertices,
 3704|      3|                                    &cur_num_edges,
 3705|      3|                                    &tot_st_cap,
 3706|      3|                                    &tot_st_flow,
 3707|      3|                                    pBNS,
 3708|      3|                                    pTCGroups );
 3709|       |
 3710|       |        /* Take care of the full charge */
 3711|       |
 3712|      3|        cg_charge = pTCGroups->total_charge - pTCGroups->tgroup_charge - pTCGroups->charge_on_atoms;
 3713|      3|        ret = 1;
 3714|      3|        if (ret3 > 0)
  ------------------
  |  Branch (3714:13): [True: 3, False: 0]
  ------------------
 3715|      3|        {
 3716|       |            /* (+) and (-) or at least one of them have been connected */
 3717|      3|            int nVertPlusMinus = cur_num_vertices - 1;
 3718|      3|            BNS_VERTEX *pVertPlusMinus = pBNS->vert + nVertPlusMinus;
 3719|      3|            BNS_VERTEX *pVertPlus = NULL, *pVertMinus = NULL, *pVert = NULL;
 3720|      3|            BNS_EDGE   *pEdgePlus = NULL, *pEdgeMinus = NULL, *pEdge = NULL;
 3721|      3|            n = pTCGroups->nGroup[TCG_Plus] >= 0;   /* (+)-supergroup exists */
 3722|      3|            k = pTCGroups->nGroup[TCG_Minus] >= 0;  /* (-)-supergroup exists */
 3723|       |
 3724|      3|            if (pVertPlusMinus->num_adj_edges == 2 && k + n == 2)
  ------------------
  |  Branch (3724:17): [True: 3, False: 0]
  |  Branch (3724:55): [True: 3, False: 0]
  ------------------
 3725|      3|            {
 3726|      3|                pEdgePlus = pBNS->edge + pVertPlusMinus->iedge[0];  /* TCG_Plus was the 1st */
 3727|      3|                pEdgeMinus = pBNS->edge + pVertPlusMinus->iedge[1];  /* TCG_Minus was the 2nd */
 3728|      3|            }
 3729|       |
 3730|      0|            else if (pVertPlusMinus->num_adj_edges == 1 && k + n == 1)
  ------------------
  |  Branch (3730:22): [True: 0, False: 0]
  |  Branch (3730:60): [True: 0, False: 0]
  ------------------
 3731|      0|            {
 3732|      0|                if (pTCGroups->nGroup[TCG_Plus] >= 0)
  ------------------
  |  Branch (3732:21): [True: 0, False: 0]
  ------------------
 3733|      0|                {
 3734|      0|                    pEdgePlus = pBNS->edge + pVertPlusMinus->iedge[0];
 3735|      0|                }
 3736|      0|                else if (pTCGroups->nGroup[TCG_Minus] >= 0)
  ------------------
  |  Branch (3736:26): [True: 0, False: 0]
  ------------------
 3737|      0|                {
 3738|      0|                    pEdgeMinus = pBNS->edge + pVertPlusMinus->iedge[0];
 3739|      0|                }
 3740|      0|            }
 3741|       |
 3742|      0|            else if (k + n)
  ------------------
  |  Branch (3742:22): [True: 0, False: 0]
  ------------------
 3743|      0|            {
 3744|       |                /* program error check */
 3745|      0|                ret = BNS_BOND_ERR;
  ------------------
  |  |   80|      0|#define BNS_BOND_ERR       (BNS_ERR +  4) /*(-9995)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3746|      0|                goto exit_function;
 3747|      0|            }
 3748|       |
 3749|      3|            if (pEdgePlus)
  ------------------
  |  Branch (3749:17): [True: 3, False: 0]
  ------------------
 3750|      3|            {
 3751|      3|                pVertPlus = pBNS->vert + ( pEdgePlus->neighbor12 ^ nVertPlusMinus );
 3752|      3|            }
 3753|      3|            if (pEdgeMinus)
  ------------------
  |  Branch (3753:17): [True: 3, False: 0]
  ------------------
 3754|      3|            {
 3755|      3|                pVertMinus = pBNS->vert + ( pEdgeMinus->neighbor12 ^ nVertPlusMinus );
 3756|      3|            }
 3757|       |
 3758|      3|            pVert = pVertPlus ? pVertPlus : pVertMinus ? pVertMinus : NULL;
  ------------------
  |  Branch (3758:21): [True: 3, False: 0]
  |  Branch (3758:45): [True: 0, False: 0]
  ------------------
 3759|      3|            pEdge = pEdgePlus ? pEdgePlus : pEdgeMinus ? pEdgeMinus : NULL;
  ------------------
  |  Branch (3759:21): [True: 3, False: 0]
  |  Branch (3759:45): [True: 0, False: 0]
  ------------------
 3760|      3|            if (pEdgeMinus)
  ------------------
  |  Branch (3760:17): [True: 3, False: 0]
  ------------------
 3761|      3|            {
 3762|      3|                pTCGroups->nEdgeMinus = (int) ( pEdgeMinus - pBNS->edge );
 3763|      3|            }
 3764|      3|            if (pEdgePlus)
  ------------------
  |  Branch (3764:17): [True: 3, False: 0]
  ------------------
 3765|      3|            {
 3766|      3|                pTCGroups->nEdgePlus = (int) ( pEdgePlus - pBNS->edge );
 3767|      3|            }
 3768|      3|            if (pEdge)
  ------------------
  |  Branch (3768:17): [True: 3, False: 0]
  ------------------
 3769|      3|            {
 3770|      3|                pTCGroups->nEdge4charge = (int) ( pEdge - pBNS->edge );
 3771|      3|            }
 3772|       |
 3773|       |            /* set total charge */
 3774|       |
 3775|      3|            if (pVert && pEdge)
  ------------------
  |  Branch (3775:17): [True: 3, False: 0]
  |  Branch (3775:26): [True: 3, False: 0]
  ------------------
 3776|      3|            {
 3777|       |                /* do not check rescaps for now */
 3778|      3|                if (cg_charge > 0)
  ------------------
  |  Branch (3778:21): [True: 0, False: 3]
  ------------------
 3779|      0|                {
 3780|      0|                    pVertPlusMinus->st_edge.cap += cg_charge;
 3781|      0|                    tot_st_cap += cg_charge;
 3782|      0|                    pVertPlusMinus->st_edge.cap0 = pVertPlusMinus->st_edge.cap;
 3783|      0|                }
 3784|       |
 3785|      3|                if (cg_charge < 0)
  ------------------
  |  Branch (3785:21): [True: 3, False: 0]
  ------------------
 3786|      3|                {
 3787|      3|                    pVert->st_edge.cap -= cg_charge;
 3788|      3|                    tot_st_cap -= cg_charge;
 3789|      3|                    pVert->st_edge.cap0 = pVert->st_edge.cap;
 3790|       |
 3791|      3|                    if (pEdge->cap - pEdge->flow + cg_charge < 0)
  ------------------
  |  Branch (3791:25): [True: 3, False: 0]
  ------------------
 3792|      3|                    {
 3793|       |                        /* 2006-02-06: increase edge capacity to avoid clogging */
 3794|      3|                        pEdge->cap = pEdge->flow - cg_charge;
 3795|      3|                    }
 3796|      3|                }
 3797|      3|                pTCGroups->added_charge = cg_charge;
 3798|      3|            }
 3799|      3|            if (!cg_charge || ( pVert && pEdge ))
  ------------------
  |  Branch (3799:17): [True: 0, False: 3]
  |  Branch (3799:33): [True: 3, False: 0]
  |  Branch (3799:42): [True: 3, False: 0]
  ------------------
 3800|      3|            {
 3801|      3|                ret = 2;
 3802|      3|            }
 3803|      3|        }
 3804|       |
 3805|      3|        AddRadicalToMetal( &tot_st_cap, &tot_st_flow, pSrm, pBNS, pTCGroups );
 3806|       |
 3807|       |
 3808|      3|        pBNS->num_edges = cur_num_edges;
 3809|      3|        pBNS->num_vertices = cur_num_vertices;
 3810|      3|        pBNS->num_c_groups = num_cg;
 3811|      3|        pBNS->tot_st_cap = tot_st_cap;
 3812|      3|        pBNS->tot_st_flow = tot_st_flow;
 3813|      3|    }
 3814|       |
 3815|    801|exit_function:
 3816|    801|    return ret;
 3817|    801|}
nNumEdgesToCnVertex:
 3822|     15|{
 3823|     15|    int i, j, n, num_edges, v1 = v + 1;
 3824|     73|    for (i = 0, num_edges = 0; i < len; i++)
  ------------------
  |  Branch (3824:32): [True: 58, False: 15]
  ------------------
 3825|     58|    {
 3826|    103|        for (j = 0; j < MAX_CN_VAL && ( n = pCN[i].e[j].neigh ); j++)
  ------------------
  |  |  425|    206|#define MAX_CN_VAL 3
  ------------------
  |  Branch (3826:21): [True: 103, False: 0]
  |  Branch (3826:39): [True: 45, False: 58]
  ------------------
 3827|     45|        {
 3828|     45|            num_edges += ( i == v || n == v1 );
  ------------------
  |  Branch (3828:28): [True: 21, False: 24]
  |  Branch (3828:38): [True: 0, False: 24]
  ------------------
 3829|     45|        }
 3830|     58|    }
 3831|     15|    return num_edges;
 3832|     15|}
AllocateAndInitTCGBnStruct:
 3880|    801|{
 3881|    801|    inp_ATOM *at = pStruct->at;
 3882|    801|    int          num_atoms = pStruct->num_atoms;
 3883|    801|    ICHICONST SRM *pSrm = pStruct->pSrm;
  ------------------
  |  |   41|    801|#define ICHICONST      const
  ------------------
 3884|       |
 3885|    801|    BN_STRUCT   *pBNS = NULL;
 3886|    801|    BNS_VERTEX  *vert;
 3887|    801|    BNS_IEDGE   *iedge;
 3888|       |
 3889|    801|    int    neigh, num_changed_bonds = 0;
 3890|    801|    U_CHAR bond_type, bond_mark;
 3891|    801|    int bNeedsFlower1, bNeedsFlower2, min_order;
 3892|       |
 3893|    801|    int i, j, k, m, n_edges, num_bonds, num_edges;
 3894|    801|    int f1, f2, c1, c2, edge_cap, edge_flow, st_cap, st_flow, flag_alt_bond;
 3895|    801|    int tot_st_cap, tot_st_flow;
 3896|    801|    int max_tg, max_edges, max_vertices, len_alt_path, max_iedges, num_iedges, num_altp;
 3897|       |
 3898|       |    /* count vertices */
 3899|    801|    max_tg = pTCGroups->num_tgroups;
 3900|       |    /* +1 for a super-tautomeric group */
 3901|       |    /* max_vertices = num_atoms + nMaxAddAtoms + max_tg + 1; */
 3902|    801|    max_vertices = pTCGroups->nVertices + nMaxAddAtoms;
 3903|       |
 3904|       |    /* count edges */
 3905|    801|    num_changed_bonds = 0;
 3906|    801|    num_bonds = pTCGroups->num_bonds;
 3907|       |
 3908|       |    /* each atom has enough edges to belong to a tautomeric group + nMaxAddEdges */
 3909|       |    /* number of atoms is large enough to accommodate max. possible number of t-groups + nMaxAddAtoms */
 3910|       |    /* max_altp cannot be larger than BN_MAX_ALTP = 16 */
 3911|    801|    num_edges = pTCGroups->nEdges;
 3912|       |
 3913|       |    /* +max_tg for edges between t-groups and super-tautomeric group */
 3914|    801|    max_edges = num_edges + ( nMaxAddEdges + NUM_KINDS_OF_GROUPS )*max_vertices;
  ------------------
  |  |  114|    801|#define NUM_KINDS_OF_GROUPS  2  /* 1 accounts for t-group kind, one more 1 accounts for c-group kind */
  ------------------
 3915|    801|    max_iedges = 2 * max_edges + pTCGroups->nAddIedges;
 3916|    801|    len_alt_path = max_vertices + iALTP_HDR_LEN + 1; /* may overflow if an edge is traversed in 2 directions */
 3917|    801|    len_alt_path += inchi_max( max_vertices / 2, 16 ); /* to avoid the overflow */
  ------------------
  |  |  166|    801|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 11, False: 790]
  |  |  ------------------
  ------------------
 3918|       |
 3919|    801|    if (!( pBNS = (BN_STRUCT   *) inchi_calloc( 1, sizeof( BN_STRUCT ) ) ) ||
  ------------------
  |  | 1133|    801|#define inchi_calloc   calloc
  ------------------
  |  Branch (3919:9): [True: 0, False: 801]
  ------------------
 3920|    801|         !( pBNS->edge = (BNS_EDGE    *) inchi_calloc( max_edges, sizeof( BNS_EDGE ) ) ) ||
  ------------------
  |  | 1133|    801|#define inchi_calloc   calloc
  ------------------
  |  Branch (3920:10): [True: 0, False: 801]
  ------------------
 3921|    801|         !( pBNS->vert = (BNS_VERTEX  *) inchi_calloc( max_vertices, sizeof( BNS_VERTEX ) ) ) ||
  ------------------
  |  | 1133|    801|#define inchi_calloc   calloc
  ------------------
  |  Branch (3921:10): [True: 0, False: 801]
  ------------------
 3922|    801|         !( pBNS->iedge = (BNS_IEDGE   *) inchi_calloc( max_iedges, sizeof( BNS_IEDGE ) ) ))
  ------------------
  |  | 1133|    801|#define inchi_calloc   calloc
  ------------------
  |  Branch (3922:10): [True: 0, False: 801]
  ------------------
 3923|      0|    {
 3924|      0|        return DeAllocateBnStruct( pBNS );
 3925|      0|    }
 3926|       |
 3927|       |    /* alt path init (standard spell) */
 3928|  13.6k|    for (num_altp = 0; num_altp < max_altp && num_altp < BN_MAX_ALTP; num_altp++)
  ------------------
  |  |   45|  12.8k|#define BN_MAX_ALTP  16
  ------------------
  |  Branch (3928:24): [True: 12.8k, False: 801]
  |  Branch (3928:47): [True: 12.8k, False: 0]
  ------------------
 3929|  12.8k|    {
 3930|  12.8k|        if (!( pBNS->altp[num_altp] = (BNS_ALT_PATH*) inchi_calloc( len_alt_path, sizeof( BNS_ALT_PATH ) ) ))
  ------------------
  |  | 1133|  12.8k|#define inchi_calloc   calloc
  ------------------
  |  Branch (3930:13): [True: 0, False: 12.8k]
  ------------------
 3931|      0|        {
 3932|      0|            return DeAllocateBnStruct( pBNS );
 3933|      0|        }
 3934|  12.8k|        ALTP_ALLOCATED_LEN( pBNS->altp[num_altp] ) = len_alt_path;
  ------------------
  |  |  139|  12.8k|#define ALTP_ALLOCATED_LEN(altp)        (altp)[iALTP_MAX_LEN].number
  ------------------
 3935|  12.8k|        pBNS->len_alt_path = len_alt_path;  /* ??? duplication ??? */
 3936|       |        /* re-init */
 3937|  12.8k|        ALTP_DELTA( pBNS->altp[num_altp] ) = 0;
  ------------------
  |  |  140|  12.8k|#define ALTP_DELTA(altp)                 (altp)[iALTP_FLOW].flow[0]
  ------------------
 3938|  12.8k|        ALTP_START_ATOM( pBNS->altp[num_altp] ) = NO_VERTEX;
  ------------------
  |  |  131|  12.8k|#define ALTP_START_ATOM(altp)           (altp)[iALTP_START_ATOM].number
  ------------------
                      ALTP_START_ATOM( pBNS->altp[num_altp] ) = NO_VERTEX;
  ------------------
  |  |  146|  12.8k|#define NO_VERTEX    -2
  ------------------
 3939|  12.8k|        ALTP_END_ATOM( pBNS->altp[num_altp] ) = NO_VERTEX;
  ------------------
  |  |  130|  12.8k|#define ALTP_END_ATOM(altp)             (altp)[iALTP_END_ATOM].number
  ------------------
                      ALTP_END_ATOM( pBNS->altp[num_altp] ) = NO_VERTEX;
  ------------------
  |  |  146|  12.8k|#define NO_VERTEX    -2
  ------------------
 3940|  12.8k|        ALTP_PATH_LEN( pBNS->altp[num_altp] ) = 0;
  ------------------
  |  |  129|  12.8k|#define ALTP_PATH_LEN(altp)             (altp)[iALTP_PATH_LEN].number  /* number of bonds = number of atoms-1*/
  ------------------
 3941|  12.8k|    }
 3942|    801|    pBNS->alt_path = NULL;
 3943|    801|    pBNS->num_altp = 0;
 3944|    801|    pBNS->max_altp = num_altp;
 3945|       |
 3946|       |
 3947|       |    /* fill vertices (no connectivity) */
 3948|    801|    iedge = pBNS->iedge;
 3949|    801|    num_iedges = 0;
 3950|    801|    tot_st_cap = tot_st_flow = 0;
 3951|  4.46k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (3951:17): [True: 3.65k, False: 801]
  ------------------
 3952|  3.65k|    {
 3953|       |        /* count edges incident to pBNS->vert[i] */
 3954|  3.65k|        k = at[i].valence + ( at[i].endpoint != 0 ) + ( nMaxAddEdges /*+ NUM_KINDS_OF_GROUPS*/ );
 3955|  3.65k|        if (( j = pVA[i].cnListIndex - 1 ) >= 0)
  ------------------
  |  Branch (3955:13): [True: 15, False: 3.64k]
  ------------------
 3956|     15|        {
 3957|       |            /* add number of neighbors in the ChargeStruct */
 3958|     15|            k += nNumEdgesToCnVertex( cnList[j].pCN, cnList[j].len, 0 );
 3959|     15|        }
 3960|       |        /* set max number of edges for the vertex */
 3961|  3.65k|        pBNS->vert[i].max_adj_edges = k;
 3962|  3.65k|        pBNS->vert[i].iedge = iedge;
 3963|  3.65k|        iedge += k;
 3964|       |        /* add atom vertex cap */
 3965|  3.65k|        st_cap = 0;
 3966|  3.65k|        st_flow = 0;
 3967|  3.65k|        bNeedsFlower1 = AtomStcapStflow( at, pVA, pSrm, i, &c1, &f1, NULL, NULL );
 3968|       |        /* pVA[i].cNumBondsToMetal = bNeedsFlower1; */
 3969|       |        /* GetAtomStCapFlow( at, pVA, pSrm, i, &c1, &f1 ); */
 3970|  3.65k|        st_cap += c1;
 3971|  3.65k|        st_cap += bNeedsFlower1 ? 0 : pVA[i].cInitFreeValences;
  ------------------
  |  Branch (3971:19): [True: 0, False: 3.65k]
  ------------------
 3972|  3.65k|        pBNS->vert[i].st_edge.cap = st_cap; /* the 1st time st_cap is set */
 3973|  3.65k|        pBNS->vert[i].st_edge.cap0 = pBNS->vert[i].st_edge.cap;
 3974|  3.65k|        tot_st_cap += st_cap;
 3975|  3.65k|    }
 3976|       |
 3977|    801|    num_iedges = (int) ( iedge - pBNS->iedge );
 3978|    801|    if (max_iedges - num_iedges < ( nMaxAddEdges + NUM_KINDS_OF_GROUPS )*max_vertices)
  ------------------
  |  |  114|    801|#define NUM_KINDS_OF_GROUPS  2  /* 1 accounts for t-group kind, one more 1 accounts for c-group kind */
  ------------------
  |  Branch (3978:9): [True: 0, False: 801]
  ------------------
 3979|      0|    {
 3980|      0|        return DeAllocateBnStruct( pBNS );
 3981|      0|    }
 3982|       |
 3983|    801|    pBNS->num_atoms = num_atoms;      /* number of real atoms */
 3984|    801|    pBNS->num_added_atoms = 0;
 3985|    801|    pBNS->num_t_groups = 0;              /* number of added t-groups */
 3986|    801|    pBNS->num_c_groups = 0;
 3987|    801|    pBNS->nMaxAddAtoms = nMaxAddAtoms;
 3988|    801|    pBNS->nMaxAddEdges = nMaxAddEdges;
 3989|       |
 3990|    801|    pBNS->num_vertices = num_atoms;      /* current number of vertices, in general a sum of
 3991|       |                                               pBNS->num_atoms
 3992|       |                                               pBNS->num_t_groups
 3993|       |                                               number of c-groups
 3994|       |                                               number of auxiliary vertices
 3995|       |                                               pBNS->num_added_atoms
 3996|       |                                            */
 3997|    801|    pBNS->max_vertices = max_vertices;
 3998|       |
 3999|       |
 4000|    801|    pBNS->num_bonds = num_bonds;      /* number of real edges (bonds) */
 4001|    801|    pBNS->max_edges = max_edges;
 4002|    801|    pBNS->max_iedges = max_iedges;
 4003|       |
 4004|       |
 4005|       |    /*
 4006|       |       To remove t-groups and added atoms:
 4007|       |
 4008|       |        for ( i = 0; i < pBNS->num_atoms; i ++ )
 4009|       |        {
 4010|       |            for ( j = pBNS->vert[i].num_adj_edges-1; 0 <= j; j -- )
 4011|       |            {
 4012|       |                k = pBNS->edge[pBNS->vert[i].iedge[j]].neighbor12 ^ i;
 4013|       |                if ( pBNS->vert[k].type & BNS_VERT_TYPE_ATOM )
 4014|       |                {
 4015|       |                    pBNS->vert[i].num_adj_edges = j+1;
 4016|       |                    break;
 4017|       |                }
 4018|       |            }
 4019|       |        }
 4020|       |
 4021|       |       pBNS->num_vertices    = pBNS->num_atoms;
 4022|       |       pBNS->num_edges       = pBNS->num_bonds;
 4023|       |       pBNS->num_added_atoms = 0;
 4024|       |       pBNS->num_t_groups    = 0;
 4025|       |       pBNS->num_added_edges = 0;
 4026|       |
 4027|       |       ALTP_DELTA(pBNS->alt_path)      = 0;
 4028|       |       ALTP_START_ATOM(pBNS->alt_path) = NO_VERTEX;
 4029|       |       ALTP_END_ATOM(pBNS->alt_path)   = NO_VERTEX;
 4030|       |       ALTP_PATH_LEN(pBNS->alt_path)   = 0;
 4031|       |
 4032|       |    */
 4033|       |
 4034|       |
 4035|       |    /* add and fill edges and connectivity */
 4036|  4.46k|    for (i = 0, n_edges = 0; i < num_atoms; i++)
  ------------------
  |  Branch (4036:30): [True: 3.65k, False: 801]
  ------------------
 4037|  3.65k|    {
 4038|  3.65k|        vert = pBNS->vert + i; /* pointer to the ith vertex */
 4039|  3.65k|        st_cap = 0;
 4040|  3.65k|        st_flow = 0;
 4041|  3.65k|        flag_alt_bond = 0;
 4042|  3.68k|        for (j = 0; j < at[i].valence; j++)
  ------------------
  |  Branch (4042:21): [True: 24, False: 3.65k]
  ------------------
 4043|     24|        {
 4044|     24|            neigh = at[i].neighbor[j];
 4045|       |            /* find this bond at the neighbor */
 4046|     33|            for (k = 0; k < at[neigh].valence; k++)
  ------------------
  |  Branch (4046:25): [True: 33, False: 0]
  ------------------
 4047|     33|            {
 4048|     33|                if (at[neigh].neighbor[k] == i)
  ------------------
  |  Branch (4048:21): [True: 24, False: 9]
  ------------------
 4049|     24|                {
 4050|     24|                    break;
 4051|     24|                }
 4052|     33|            }
 4053|     24|            bond_type = ( at[i].bond_type[j] & BOND_TYPE_MASK );
  ------------------
  |  |  217|     24|#define BOND_TYPE_MASK        0x0f
  ------------------
 4054|     24|            bond_mark = ( at[i].bond_type[j] & ~BOND_TYPE_MASK );
  ------------------
  |  |  217|     24|#define BOND_TYPE_MASK        0x0f
  ------------------
 4055|     24|            if (bond_type != BOND_SINGLE && bond_type != BOND_DOUBLE && bond_type != BOND_TRIPLE)
  ------------------
  |  |  205|     24|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   60|     48|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
                          if (bond_type != BOND_SINGLE && bond_type != BOND_DOUBLE && bond_type != BOND_TRIPLE)
  ------------------
  |  |  206|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   61|     24|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
                          if (bond_type != BOND_SINGLE && bond_type != BOND_DOUBLE && bond_type != BOND_TRIPLE)
  ------------------
  |  |  207|      0|#define BOND_TRIPLE BOND_TYPE_TRIPLE  /* 3                                  */
  |  |  ------------------
  |  |  |  |   62|      0|#define BOND_TYPE_TRIPLE    3
  |  |  ------------------
  ------------------
  |  Branch (4055:17): [True: 0, False: 24]
  |  Branch (4055:45): [True: 0, False: 0]
  |  Branch (4055:73): [True: 0, False: 0]
  ------------------
 4056|      0|            {
 4057|       |                /* make unknown bonds single */
 4058|      0|                bond_type = BOND_SINGLE;
  ------------------
  |  |  205|      0|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
 4059|      0|                at[i].bond_type[j] = bond_mark | bond_type;
 4060|      0|                num_changed_bonds++;
 4061|      0|            }
 4062|     24|            if (neigh > i)
  ------------------
  |  Branch (4062:17): [True: 12, False: 12]
  ------------------
 4063|     12|            {
 4064|       |                /* this is the first time we encounter this bond */
 4065|     12|                bNeedsFlower1 = AtomStcapStflow( at, pVA, pSrm, i, &c1, &f1, NULL, NULL );
 4066|       |                /* GetAtomStCapFlow( at, pVA, pSrm, i, &c1, &f1 ); */
 4067|     12|                c1 += bNeedsFlower1 ? 0 : pVA[i].cInitFreeValences;  /* elevate cap to the lowest valence in ChargeStruct */
  ------------------
  |  Branch (4067:23): [True: 0, False: 12]
  ------------------
 4068|     12|                bNeedsFlower2 = AtomStcapStflow( at, pVA, pSrm, neigh, &c2, &f2, NULL, NULL );
 4069|       |                /* GetAtomStCapFlow( at, pVA, pSrm, neigh, &c2, &f2 ); */
 4070|     12|                c2 += bNeedsFlower2 ? 0 : pVA[neigh].cInitFreeValences; /* elevate cap to the lowest valence in ChargeStruct */
  ------------------
  |  Branch (4070:23): [True: 0, False: 12]
  ------------------
 4071|       |
 4072|       |                /* at this point -O would have st_cap=st_flow=0 because the lowest valence=1 for charge=-1 */
 4073|       |                /* however, if -O belongs to a t-group its cap would be 1, flow = 0 */
 4074|       |                /*f1 = MAX_AT_FLOW(at[i]);*/
 4075|       |                /*f2 = MAX_AT_FLOW(at[neigh]);*/
 4076|       |
 4077|     12|                edge_flow = BondFlowMaxcapMinorder( at, pVA, pSrm, i, j, &edge_cap, &min_order, NULL );
 4078|       |
 4079|     12|                pBNS->edge[n_edges].neighbor1 = (AT_NUMB) i;
 4080|     12|                pBNS->edge[n_edges].neighbor12 = (AT_NUMB) ( i ^ neigh );
 4081|     12|                pBNS->edge[n_edges].flow =
 4082|     12|                    pBNS->edge[n_edges].flow0 = edge_flow;
 4083|     12|                pBNS->edge[n_edges].cap =
 4084|     12|                    pBNS->edge[n_edges].cap0 = edge_cap;
 4085|     12|                pBNS->edge[n_edges].neigh_ord[0] = j;  /* iedge to neigh index at vertex[i],     i < neigh */
 4086|     12|                pBNS->edge[n_edges].neigh_ord[1] = k;  /* iedge to i     index at vertex[neigh], i < neigh */
 4087|     12|                pBNS->edge[n_edges].pass = 0;
 4088|     12|                pBNS->edge[n_edges].forbidden = 0; /* may be forbidden if edge_flow = 1: stereogenic fixed double bond */
 4089|     12|                if (bond_type == BOND_TYPE_DOUBLE)
  ------------------
  |  |   61|     12|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (4089:21): [True: 0, False: 12]
  ------------------
 4090|      0|                {
 4091|       |                    /* forbid changing stereogenic double bonds */
 4092|      0|                    for (m = 0; m < MAX_NUM_STEREO_BONDS && at[i].sb_parity[m]; m++)
  ------------------
  |  |  876|      0|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (4092:33): [True: 0, False: 0]
  |  Branch (4092:61): [True: 0, False: 0]
  ------------------
 4093|      0|                    {
 4094|      0|                        if (at[i].sb_ord[m] == j)
  ------------------
  |  Branch (4094:29): [True: 0, False: 0]
  ------------------
 4095|      0|                        {
 4096|      0|                            pBNS->edge[n_edges].forbidden |= BNS_EDGE_FORBIDDEN_MASK;
  ------------------
  |  |   67|      0|#define BNS_EDGE_FORBIDDEN_MASK  1
  ------------------
 4097|      0|                            break;
 4098|      0|                        }
 4099|      0|                    }
 4100|      0|                }
 4101|     12|                vert->iedge[j] = pBNS->vert[neigh].iedge[k] = n_edges++; /* same iedge index as neighbor index in at[] */
 4102|     12|            }
 4103|     12|            else
 4104|     12|            {
 4105|       |                /* this is the second time we encounter this bond. It was stored at */
 4106|     12|                int  iedge2 = pBNS->vert[neigh].iedge[k];
 4107|     12|                edge_cap = pBNS->edge[iedge2].cap;
 4108|     12|                edge_flow = pBNS->edge[iedge2].flow;
 4109|     12|            }
 4110|     24|            st_flow += edge_flow;
 4111|       |            /*
 4112|       |            st_cap  += edge_cap;
 4113|       |            */
 4114|     24|        }
 4115|       |
 4116|  3.65k|        vert->num_adj_edges = j;
 4117|       |        /*
 4118|       |        vert->st_edge.cap   =
 4119|       |        vert->st_edge.cap0  = st_cap;
 4120|       |        */
 4121|  3.65k|        vert->st_edge.flow =
 4122|  3.65k|            vert->st_edge.flow0 = st_flow;
 4123|  3.65k|        vert->type = BNS_VERT_TYPE_ATOM;
  ------------------
  |  |   73|  3.65k|#define BNS_VERT_TYPE_ATOM          0x0001
  ------------------
 4124|       |        /*
 4125|       |        tot_st_cap  += vert->st_edge.cap;
 4126|       |        */
 4127|  3.65k|        tot_st_flow += vert->st_edge.flow;
 4128|  3.65k|    }
 4129|       |
 4130|    801|    *pNum_changed_bonds = num_changed_bonds / 2;
 4131|       |
 4132|    801|    pBNS->num_edges = n_edges;   /* number of edges */
 4133|    801|    pBNS->num_iedges = num_iedges;
 4134|    801|    pBNS->num_added_edges = 0;
 4135|       |
 4136|    801|    pBNS->tot_st_cap = tot_st_cap;
 4137|    801|    pBNS->tot_st_flow = tot_st_flow;
 4138|       |
 4139|       |/* exit_function: */
 4140|       |
 4141|    801|    return pBNS;
 4142|    801|}
IncrZeroBondsAndClearEndpts:
 4147|  55.4k|{
 4148|  55.4k|    int i, j;
 4149|   113k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (4149:17): [True: 58.2k, False: 55.4k]
  ------------------
 4150|  58.2k|    {
 4151|  58.2k|        at[i].endpoint = 0;
 4152|  58.2k|        at[i].component = iComponent;
 4153|  58.2k|        for (j = 0; j < at[i].valence; j++)
  ------------------
  |  Branch (4153:21): [True: 24, False: 58.2k]
  ------------------
 4154|     24|        {
 4155|     24|            if (!at[i].bond_type[j])
  ------------------
  |  Branch (4155:17): [True: 0, False: 24]
  ------------------
 4156|      0|            {
 4157|      0|                at[i].bond_type[j] = BOND_TYPE_SINGLE;
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
 4158|      0|                at[i].chem_bonds_valence += BOND_TYPE_SINGLE;
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
 4159|      0|            }
 4160|     24|        }
 4161|  58.2k|    }
 4162|  55.4k|}
IncrZeroBonds:
 4167|  54.6k|{
 4168|  54.6k|    int i, j;
 4169|   109k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (4169:17): [True: 54.6k, False: 54.6k]
  ------------------
 4170|  54.6k|    {
 4171|  54.6k|        at[i].component = iComponent;
 4172|  54.6k|        for (j = 0; j < at[i].valence; j++)
  ------------------
  |  Branch (4172:21): [True: 24, False: 54.6k]
  ------------------
 4173|     24|        {
 4174|     24|            if (!at[i].bond_type[j])
  ------------------
  |  Branch (4174:17): [True: 0, False: 24]
  ------------------
 4175|      0|            {
 4176|      0|                at[i].bond_type[j] = BOND_TYPE_SINGLE;
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
 4177|      0|                at[i].chem_bonds_valence += BOND_TYPE_SINGLE;
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
 4178|      0|            }
 4179|     24|        }
 4180|  54.6k|    }
 4181|  54.6k|}
ClearEndpts:
 4186|  54.6k|{
 4187|  54.6k|    int i;
 4188|   109k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (4188:17): [True: 54.6k, False: 54.6k]
  ------------------
 4189|  54.6k|    {
 4190|  54.6k|        at[i].endpoint = 0;
 4191|  54.6k|    }
 4192|  54.6k|}
RunBnsRestoreOnce:
 4541|    806|{
 4542|       |    /* run BNS for the first time */
 4543|    806|    int nTotalDelta = 0, ret = 0;
 4544|    806|    int nDelta;
 4545|       |
 4546|    806|    ReInitBnStructAltPaths( pBNS );
 4547|       |
 4548|    806|    do
 4549|    812|    {
 4550|    812|        nDelta = RunBalancedNetworkSearch( pBNS, pBD, BNS_EF_CHNG_FLOW );
  ------------------
  |  |  379|    812|#define BNS_EF_CHNG_FLOW      1  /* change Balanced Network (BN) flow inside the BNS search */
  ------------------
 4551|    812|        if (IS_BNS_ERROR( nDelta ))
  ------------------
  |  |   95|    812|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|    812|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|    812|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|    812|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 812, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 812]
  |  |  ------------------
  ------------------
 4552|      0|        {
 4553|      0|            ret = nDelta;
 4554|      0|            goto exit_function;
 4555|      0|        }
 4556|    812|        nTotalDelta += nDelta;
 4557|    812|        ReInitBnStructAltPaths( pBNS );
 4558|    812|        ret = ReInitBnData( pBD );
 4559|    812|        if (ret > 0)
  ------------------
  |  Branch (4559:13): [True: 0, False: 812]
  ------------------
 4560|      0|        {
 4561|      0|            ret = -ret;
 4562|      0|            goto exit_function;
 4563|      0|        }
 4564|    812|    }
 4565|    812|    while (nDelta > 0 && ret == 0);
  ------------------
  |  Branch (4565:12): [True: 6, False: 806]
  |  Branch (4565:26): [True: 6, False: 0]
  ------------------
 4566|       |
 4567|    806|    pBNS->tot_st_flow += 2 * nTotalDelta;
 4568|       |
 4569|    806|    ret = nTotalDelta;
 4570|       |
 4571|    806|exit_function:
 4572|    806|    return ret;
 4573|    806|}
comp_cc_cand:
 4578|      1|{
 4579|      1|    const CC_CAND *p1 = (const CC_CAND *) a1;
 4580|      1|    const CC_CAND *p2 = (const CC_CAND *) a2;
 4581|      1|    int            ret;
 4582|       |
 4583|      1|    if (ret = (int) p2->cMetal - (int) p1->cMetal)
  ------------------
  |  Branch (4583:9): [True: 0, False: 1]
  ------------------
 4584|      0|        return ret; /* metal first */
 4585|      1|    if (ret = (int) p2->cNumBondsToMetal - (int) p1->cNumBondsToMetal)
  ------------------
  |  Branch (4585:9): [True: 0, False: 1]
  ------------------
 4586|      0|        return ret; /* connected to metal first */
 4587|      1|    if (ret = (int) p2->cPeriodicRowNumber - (int) p1->cPeriodicRowNumber)
  ------------------
  |  Branch (4587:9): [True: 1, False: 0]
  ------------------
 4588|      1|        return ret; /* heaviest first */
 4589|      0|    if (ret = (int) p2->num_bonds - (int) p1->num_bonds)
  ------------------
  |  Branch (4589:9): [True: 0, False: 0]
  ------------------
 4590|      0|        return ret; /* more bonds first */
 4591|      0|    if (ret = (int) p1->chem_valence - (int) p2->chem_valence)
  ------------------
  |  Branch (4591:9): [True: 0, False: 0]
  ------------------
 4592|      0|        return ret; /* less bond order first */
 4593|      0|    if (!p1->cNumValenceElectrons && p2->cNumValenceElectrons)
  ------------------
  |  Branch (4593:9): [True: 0, False: 0]
  |  Branch (4593:38): [True: 0, False: 0]
  ------------------
 4594|      0|        return -1; /* no valence electrons first */
 4595|      0|    if (!p2->cNumValenceElectrons && p1->cNumValenceElectrons)
  ------------------
  |  Branch (4595:9): [True: 0, False: 0]
  |  Branch (4595:38): [True: 0, False: 0]
  ------------------
 4596|      0|        return -1; /* no valence electrons first */
 4597|      0|    if ((int) p2->cNumValenceElectrons - (int) p1->cNumValenceElectrons)
  ------------------
  |  Branch (4597:9): [True: 0, False: 0]
  ------------------
 4598|      0|        return ret; /* more valence electrons first */
 4599|      0|    ret = (int) p2->iat - (int) p1->iat; /* greater canon number first */
 4600|       |
 4601|      0|    return ret;
 4602|      0|}
AllocEdgeList:
 4684|  44.8k|{
 4685|  44.8k|    switch (nLen)
 4686|  44.8k|    {
 4687|  21.2k|        case EDGE_LIST_FREE:
  ------------------
  |  |  271|  21.2k|#define EDGE_LIST_FREE   (-2)
  ------------------
  |  Branch (4687:9): [True: 21.2k, False: 23.6k]
  ------------------
 4688|  21.2k|            if (NULL != pEdges->pnEdges)
  ------------------
  |  Branch (4688:17): [True: 1.62k, False: 19.5k]
  ------------------
 4689|  1.62k|            {
 4690|  1.62k|                inchi_free( pEdges->pnEdges );
  ------------------
  |  | 1136|  1.62k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 1.62k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4691|  1.62k|            }
 4692|       |            /* fall through */
 4693|  43.2k|        case EDGE_LIST_CLEAR:
  ------------------
  |  |  270|  43.2k|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  |  Branch (4693:9): [True: 22.0k, False: 22.8k]
  ------------------
 4694|  43.2k|            memset( pEdges, 0, sizeof( *pEdges ) );
 4695|  43.2k|            break;
 4696|  1.62k|        default:
  ------------------
  |  Branch (4696:9): [True: 1.62k, False: 43.2k]
  ------------------
 4697|  1.62k|            if (nLen > 0 && nLen != pEdges->num_alloc)
  ------------------
  |  Branch (4697:17): [True: 1.62k, False: 0]
  |  Branch (4697:29): [True: 1.62k, False: 0]
  ------------------
 4698|  1.62k|            {
 4699|  1.62k|                EdgeIndex *tmp_edges = pEdges->pnEdges;
 4700|  1.62k|                int        tmp_num = pEdges->num_edges;
 4701|  1.62k|                pEdges->pnEdges = (EdgeIndex *) inchi_calloc( nLen, sizeof( pEdges->pnEdges[0] ) );
  ------------------
  |  | 1133|  1.62k|#define inchi_calloc   calloc
  ------------------
 4702|  1.62k|                if (!pEdges->pnEdges)
  ------------------
  |  Branch (4702:21): [True: 0, False: 1.62k]
  ------------------
 4703|      0|                {
 4704|      0|                    return RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 4705|      0|                }
 4706|  1.62k|                tmp_num = inchi_min( tmp_num, nLen );
  ------------------
  |  |  167|  1.62k|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 1.62k, False: 0]
  |  |  ------------------
  ------------------
 4707|  1.62k|                if (tmp_edges && tmp_num > 0)
  ------------------
  |  Branch (4707:21): [True: 0, False: 1.62k]
  |  Branch (4707:34): [True: 0, False: 0]
  ------------------
 4708|      0|                {
 4709|      0|                    memcpy( pEdges->pnEdges, tmp_edges, tmp_num * sizeof( pEdges->pnEdges[0] ) );
 4710|      0|                    pEdges->num_edges = tmp_num;
 4711|      0|                }
 4712|  1.62k|                else
 4713|  1.62k|                {
 4714|  1.62k|                    pEdges->num_edges = 0;
 4715|  1.62k|                }
 4716|  1.62k|                if (tmp_edges)
  ------------------
  |  Branch (4716:21): [True: 0, False: 1.62k]
  ------------------
 4717|      0|                {
 4718|      0|                    inchi_free( tmp_edges );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4719|      0|                }
 4720|  1.62k|                pEdges->num_alloc = nLen;
 4721|  1.62k|                return 0;
 4722|  1.62k|            }
 4723|      0|            break;
 4724|  44.8k|    }
 4725|       |
 4726|  43.2k|    return 0;
 4727|  44.8k|}
AddToEdgeList:
 4732|    120|{
 4733|    120|    if (pEdges->num_alloc == pEdges->num_edges)
  ------------------
  |  Branch (4733:9): [True: 14, False: 106]
  ------------------
 4734|     14|    {
 4735|     14|        int ret;
 4736|     14|        if (nAddLen <= 0)
  ------------------
  |  Branch (4736:13): [True: 0, False: 14]
  ------------------
 4737|      0|        {
 4738|      0|            return RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 4739|      0|        }
 4740|     14|        if (ret = AllocEdgeList( pEdges, pEdges->num_alloc + nAddLen ))
  ------------------
  |  Branch (4740:13): [True: 0, False: 14]
  ------------------
 4741|      0|        {
 4742|      0|            return ret;
 4743|      0|        }
 4744|     14|    }
 4745|       |
 4746|    120|    pEdges->pnEdges[pEdges->num_edges++] = (EdgeIndex) iedge;
 4747|    120|    return 0;
 4748|    120|}
AllocBfsQueue:
 4809|  2.52k|{
 4810|  2.52k|    int ret = 0;
 4811|  2.52k|    switch (num_at)
 4812|  2.52k|    {
 4813|    840|        case BFS_Q_FREE:
  ------------------
  |  |   89|    840|#define BFS_Q_FREE   (-2)
  ------------------
  |  Branch (4813:9): [True: 840, False: 1.68k]
  ------------------
 4814|    840|            if (pQ->q)
  ------------------
  |  Branch (4814:17): [True: 840, False: 0]
  ------------------
 4815|    840|            {
 4816|    840|                pQ->q = QueueDelete( pQ->q );
 4817|    840|            }
 4818|    840|            if (pQ->nAtomLevel)
  ------------------
  |  Branch (4818:17): [True: 840, False: 0]
  ------------------
 4819|    840|            {
 4820|    840|                inchi_free( pQ->nAtomLevel );
  ------------------
  |  | 1136|    840|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 840, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4821|    840|            }
 4822|    840|            if (pQ->cSource)
  ------------------
  |  Branch (4822:17): [True: 840, False: 0]
  ------------------
 4823|    840|            {
 4824|    840|                inchi_free( pQ->cSource );
  ------------------
  |  | 1136|    840|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 840, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4825|    840|            }
 4826|       |            /* fall through */
 4827|  1.68k|        case BFS_Q_CLEAR:
  ------------------
  |  |   88|  1.68k|#define BFS_Q_CLEAR  (-1)
  ------------------
  |  Branch (4827:9): [True: 840, False: 1.68k]
  ------------------
 4828|  1.68k|            memset( pQ, 0, sizeof( *pQ ) );
 4829|  1.68k|            return 0;
 4830|       |
 4831|    840|        default:
  ------------------
  |  Branch (4831:9): [True: 840, False: 1.68k]
  ------------------
 4832|    840|            if (num_at <= 0)
  ------------------
  |  Branch (4832:17): [True: 0, False: 840]
  ------------------
 4833|      0|            {
 4834|      0|                ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 4835|      0|                goto exit_function;
 4836|      0|            }
 4837|    840|            if (num_at > pQ->num_at)
  ------------------
  |  Branch (4837:17): [True: 840, False: 0]
  ------------------
 4838|    840|            {
 4839|    840|                if (pQ->num_at)
  ------------------
  |  Branch (4839:21): [True: 0, False: 840]
  ------------------
 4840|      0|                {
 4841|      0|                    AllocBfsQueue( pQ, BFS_Q_FREE, 0 );
  ------------------
  |  |   89|      0|#define BFS_Q_FREE   (-2)
  ------------------
 4842|      0|                }
 4843|    840|                pQ->q = QueueCreate( num_at + 1, sizeof( qInt ) );
 4844|    840|                pQ->nAtomLevel = (AT_RANK*) inchi_calloc( sizeof( pQ->nAtomLevel[0] ), num_at );
  ------------------
  |  | 1133|    840|#define inchi_calloc   calloc
  ------------------
 4845|    840|                pQ->cSource = (S_CHAR *) inchi_calloc( sizeof( pQ->cSource[0] ), num_at );
  ------------------
  |  | 1133|    840|#define inchi_calloc   calloc
  ------------------
 4846|    840|                if (!pQ->q || !pQ->cSource || !pQ->nAtomLevel)
  ------------------
  |  Branch (4846:21): [True: 0, False: 840]
  |  Branch (4846:31): [True: 0, False: 840]
  |  Branch (4846:47): [True: 0, False: 840]
  ------------------
 4847|      0|                {
 4848|      0|                    ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 4849|      0|                    goto exit_function;
 4850|      0|                }
 4851|    840|                pQ->num_at = num_at;
 4852|    840|            }
 4853|    840|            pQ->min_ring_size = min_ring_size;
 4854|  2.52k|    }
 4855|       |
 4856|    840|exit_function:
 4857|    840|    return ret;
 4858|  2.52k|}
RemoveForbiddenEdgeMask:
 4863|  9.29k|{
 4864|  9.29k|    int i, mask = ~forbidden_edge_mask;
 4865|  9.35k|    for (i = 0; i < pEdges->num_edges; i++)
  ------------------
  |  Branch (4865:17): [True: 60, False: 9.29k]
  ------------------
 4866|     60|    {
 4867|     60|        pBNS->edge[pEdges->pnEdges[i]].forbidden &= mask;
 4868|     60|    }
 4869|  9.29k|}
SetForbiddenEdgeMask:
 4874|  1.60k|{
 4875|  1.60k|    int i;
 4876|  1.62k|    for (i = 0; i < pEdges->num_edges; i++)
  ------------------
  |  Branch (4876:17): [True: 18, False: 1.60k]
  ------------------
 4877|     18|    {
 4878|     18|        pBNS->edge[pEdges->pnEdges[i]].forbidden |= forbidden_edge_mask;
 4879|     18|    }
 4880|  1.60k|}
GetChargeFlowerUpperEdge:
 4909|  1.65k|{
 4910|  1.65k|    int ret = NO_VERTEX, i, j, k, i0, i1;
  ------------------
  |  |  146|  1.65k|#define NO_VERTEX    -2
  ------------------
 4911|  1.65k|    Vertex  v0, v1[3], vc, v_t, v;
 4912|  1.65k|    BNS_EDGE   *pe, *pe1[3], *pe_t;
 4913|  1.65k|    BNS_VERTEX *pv0, *pv1[3], *pv_t;
 4914|       |
 4915|  1.65k|    if (nChargeEdge < 0)
  ------------------
  |  Branch (4915:9): [True: 1.63k, False: 21]
  ------------------
 4916|  1.63k|    {
 4917|  1.63k|        goto exit_function;
 4918|  1.63k|    }
 4919|       |
 4920|     21|    pe = pBNS->edge + nChargeEdge;
 4921|     21|    vc = pe->neighbor1; /* charge vertex */
 4922|     21|    if (!IS_BNS_VT_C_GR( pBNS->vert[vc].type ))
  ------------------
  |  |  106|     21|#define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   99|     21|#define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|     21|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  |  |  ------------------
  |  |  |  |               #define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|     21|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   77|     21|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  ------------------
  |  Branch (4922:9): [True: 17, False: 4]
  ------------------
 4923|     17|    {
 4924|     17|        vc = vc ^ pe->neighbor12;
 4925|     17|    }
 4926|       |
 4927|     21|    v0 = vc ^ pe->neighbor12; /* ChargeStruct vertex ? */
 4928|     21|    pv0 = pBNS->vert + v0;
 4929|     21|    if (IS_BNS_VT_ATOM( pv0->type ))
  ------------------
  |  |  111|     21|#define IS_BNS_VT_ATOM(X)           ((X) & BNS_VERT_TYPE_ATOM)
  |  |  ------------------
  |  |  |  |   73|     21|#define BNS_VERT_TYPE_ATOM          0x0001
  |  |  ------------------
  |  |  |  Branch (111:37): [True: 17, False: 4]
  |  |  ------------------
  ------------------
 4930|     17|    {
 4931|     17|        goto exit_function; /* no charge flower exists */
 4932|     17|    }
 4933|       |
 4934|       |    /* 2 edges from v0 */
 4935|     16|    for (i = j = 0; i < pv0->num_adj_edges && j < 3; i++)
  ------------------
  |  Branch (4935:21): [True: 12, False: 4]
  |  Branch (4935:47): [True: 12, False: 0]
  ------------------
 4936|     12|    {
 4937|     12|        pe1[j] = pBNS->edge + pv0->iedge[i];
 4938|     12|        if (vc != ( v1[j] = pe1[j]->neighbor12 ^ v0 ) &&
  ------------------
  |  Branch (4938:13): [True: 8, False: 4]
  ------------------
 4939|     12|            ( pv1[j] = pBNS->vert + v1[j],
  ------------------
  |  Branch (4939:13): [True: 8, False: 0]
  ------------------
 4940|      8|                !IS_BNS_VT_ATOM( pv1[j]->type ) && !IS_BNS_VT_C_GR( pv1[j]->type ) ))
  ------------------
  |  |  111|     16|#define IS_BNS_VT_ATOM(X)           ((X) & BNS_VERT_TYPE_ATOM)
  |  |  ------------------
  |  |  |  |   73|      8|#define BNS_VERT_TYPE_ATOM          0x0001
  |  |  ------------------
  ------------------
                              !IS_BNS_VT_ATOM( pv1[j]->type ) && !IS_BNS_VT_C_GR( pv1[j]->type ) ))
  ------------------
  |  |  106|     16|#define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   99|      8|#define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|      8|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  |  |  ------------------
  |  |  |  |               #define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|      8|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   77|      8|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  ------------------
  |  Branch (4940:17): [True: 8, False: 0]
  |  Branch (4940:52): [True: 8, False: 0]
  ------------------
 4941|      8|        {
 4942|      8|            j++;
 4943|      8|        }
 4944|     12|    }
 4945|       |
 4946|      4|    if (j != 2 || i != pv0->num_adj_edges)
  ------------------
  |  Branch (4946:9): [True: 0, False: 4]
  |  Branch (4946:19): [True: 0, False: 4]
  ------------------
 4947|      0|    {
 4948|      0|        goto exit_function;
 4949|      0|    }
 4950|       |
 4951|      4|    if (pv1[1]->num_adj_edges == 2 &&
  ------------------
  |  Branch (4951:9): [True: 4, False: 0]
  ------------------
 4952|      4|         pv1[0]->num_adj_edges == 3)
  ------------------
  |  Branch (4952:10): [True: 4, False: 0]
  ------------------
 4953|      4|    {
 4954|      4|        i0 = 1;
 4955|      4|        i1 = 0;
 4956|      4|    }
 4957|      0|    else if (pv1[0]->num_adj_edges == 2 &&
  ------------------
  |  Branch (4957:14): [True: 0, False: 0]
  ------------------
 4958|      0|         pv1[1]->num_adj_edges == 3)
  ------------------
  |  Branch (4958:10): [True: 0, False: 0]
  ------------------
 4959|      0|    {
 4960|      0|        i0 = 0;
 4961|      0|        i1 = 1;
 4962|      0|    }
 4963|      0|    else
 4964|      0|    {
 4965|      0|        goto exit_function;
 4966|      0|    }
 4967|       |
 4968|       |    /* additional check: traverse edges around v1[i1] */
 4969|      4|    pv_t = pv1[i1];
 4970|      4|    v_t = v1[i1];
 4971|     16|    for (i = k = 0; i < pv_t->num_adj_edges; i++)
  ------------------
  |  Branch (4971:21): [True: 12, False: 4]
  ------------------
 4972|     12|    {
 4973|     12|        pe_t = pBNS->edge + pv_t->iedge[i];
 4974|     12|        v = pe_t->neighbor12 ^ v_t; /* v1[i1] neighbor */
 4975|     12|        if (v == v0)
  ------------------
  |  Branch (4975:13): [True: 4, False: 8]
  ------------------
 4976|      4|        {
 4977|      4|            k += 1;
 4978|      4|        }
 4979|     12|        if (v == v1[i0])
  ------------------
  |  Branch (4979:13): [True: 4, False: 8]
  ------------------
 4980|      4|        {
 4981|      4|            k += 2;
 4982|      4|        }
 4983|     12|        if (IS_BNS_VT_ATOM( pBNS->vert[v].type ))
  ------------------
  |  |  111|     12|#define IS_BNS_VT_ATOM(X)           ((X) & BNS_VERT_TYPE_ATOM)
  |  |  ------------------
  |  |  |  |   73|     12|#define BNS_VERT_TYPE_ATOM          0x0001
  |  |  ------------------
  |  |  |  Branch (111:37): [True: 4, False: 8]
  |  |  ------------------
  ------------------
 4984|      4|        {
 4985|      4|            k += 4;
 4986|      4|        }
 4987|     12|    }
 4988|      4|    if (k != 7)
  ------------------
  |  Branch (4988:9): [True: 0, False: 4]
  ------------------
 4989|      0|    {
 4990|      0|        goto exit_function;
 4991|      0|    }
 4992|       |
 4993|      4|    ret = (int) ( pe1[i0] - pBNS->edge );
 4994|       |
 4995|  1.65k|exit_function:
 4996|  1.65k|    return ret;
 4997|      4|}
MakeOneInChIOutOfStrFromINChI2:
 5089|    801|{
 5090|    801|    int ret;
 5091|    801|    INPUT_PARMS ip_loc, *ip;
 5092|    801|    STRUCT_DATA sd_loc, *sd;
 5093|       |
 5094|    801|    ip_loc = *ip_inp;
 5095|    801|    sd_loc = *sd_inp;
 5096|    801|    ip = &ip_loc;
 5097|    801|    sd = &sd_loc;
 5098|       |
 5099|    801|    memset( sd, 0, sizeof( *sd ) );
 5100|       |
 5101|       |    /* create structure out of BNS */
 5102|    801|    memcpy( at2, at, ( pStruct->num_atoms + pStruct->num_deleted_H ) * sizeof( at2[0] ) );
 5103|    801|    pStruct->at = at2;
 5104|    801|    ret = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 5105|    801|    pStruct->at = at;
 5106|    801|    if (ret < 0)
  ------------------
  |  Branch (5106:9): [True: 0, False: 801]
  ------------------
 5107|      0|    {
 5108|      0|        goto exit_function;/*  out of RAM or other normalization problem */
 5109|      0|    }
 5110|       |
 5111|    801|    pStruct->at = at;
 5112|       |
 5113|    801|    ret = MakeOneInChIOutOfStrFromINChI( pCG, ic, ip, sd, pStruct,
 5114|    801|                                         at2, at3, pTCGroups );
 5115|       |
 5116|    801|    if (ret < 0)
  ------------------
  |  Branch (5116:9): [True: 0, False: 801]
  ------------------
 5117|      0|    {
 5118|      0|        goto exit_function;/*  out of RAM or other normalization problem */
 5119|      0|    }
 5120|    801|    if (at_norm)
  ------------------
  |  Branch (5120:9): [True: 801, False: 0]
  ------------------
 5121|    801|    {
 5122|    801|        *at_norm = pStruct->pOne_norm_data[0]->at;
 5123|    801|    }
 5124|    801|    if (at_prep)
  ------------------
  |  Branch (5124:9): [True: 801, False: 0]
  ------------------
 5125|    801|    {
 5126|    801|        if (pStruct->pOne_norm_data[0]->bTautPreprocessed && pStruct->pOne_norm_data[0]->at_fixed_bonds)
  ------------------
  |  Branch (5126:13): [True: 1, False: 800]
  |  Branch (5126:62): [True: 1, False: 0]
  ------------------
 5127|      1|        {
 5128|      1|            *at_prep = pStruct->pOne_norm_data[0]->at_fixed_bonds;
 5129|      1|        }
 5130|    800|        else
 5131|       |        /* get preprocessed structure in case of Fixed-H */
 5132|    800|            if (pStruct->iMobileH == TAUT_NON && pStruct->pOne_norm_data[1] && pStruct->pOne_norm_data[1]->bTautPreprocessed)
  ------------------
  |  |  579|  1.60k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (5132:17): [True: 5, False: 795]
  |  Branch (5132:50): [True: 1, False: 4]
  |  Branch (5132:80): [True: 1, False: 0]
  ------------------
 5133|      1|            {
 5134|      1|                *at_prep = pStruct->pOne_norm_data[1]->at_fixed_bonds;
 5135|      1|            }
 5136|    799|            else
 5137|    799|            {
 5138|    799|                *at_prep = NULL;
 5139|    799|            }
 5140|    801|    }
 5141|    801|    if (t_group_info)
  ------------------
  |  Branch (5141:9): [True: 801, False: 0]
  ------------------
 5142|    801|    {
 5143|    801|        if (pStruct->iMobileH == TAUT_YES &&
  ------------------
  |  |  580|  1.60k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (5143:13): [True: 796, False: 5]
  ------------------
 5144|    801|             pStruct->One_ti.num_t_groups &&
  ------------------
  |  Branch (5144:14): [True: 1, False: 795]
  ------------------
 5145|    801|             pStruct->One_ti.t_group && pStruct->One_ti.nEndpointAtomNumber)
  ------------------
  |  Branch (5145:14): [True: 1, False: 0]
  |  Branch (5145:41): [True: 1, False: 0]
  ------------------
 5146|      1|        {
 5147|      1|            *t_group_info = &pStruct->One_ti;
 5148|      1|        }
 5149|    800|        else
 5150|    800|        {
 5151|    800|            *t_group_info = NULL;
 5152|    800|        }
 5153|    801|    }
 5154|       |
 5155|    801|exit_function:
 5156|    801|    return ret;
 5157|    801|}
MakeOneInChIOutOfStrFromINChI:
 5169|  55.4k|{
 5170|       |
 5171|  55.4k|    INCHI_MODE     bTautFlags = ip->bTautFlags | TG_FLAG_H_ALREADY_REMOVED;
  ------------------
  |  |  946|  55.4k|#define TG_FLAG_H_ALREADY_REMOVED        0x00020000   /* processing structure restored from InChI */
  ------------------
 5172|  55.4k|    INCHI_MODE     bTautFlagsDone = 0; /*(ip->bTautFlagsDone | sd->bTautFlagsDone[INCHI_BAS]);*/
 5173|  55.4k|    INChI       *cur_INChI[TAUT_NUM];
 5174|  55.4k|    INChI_Aux   *cur_INChI_Aux[TAUT_NUM];
 5175|  55.4k|    int           i, j, k;
 5176|  55.4k|    int           iComponent = pTCGroups->iComponent;
 5177|  55.4k|    int           len_at = pStruct->num_atoms + pStruct->num_deleted_H;
 5178|  55.4k|    int           num_atoms = pStruct->num_atoms;
 5179|  55.4k|    long          ulStructTime;
 5180|       |
 5181|  55.4k|    INP_ATOM_DATA InpCurAtData;
 5182|  55.4k|    INP_ATOM_DATA *inp_cur_data;
 5183|       |
 5184|  55.4k|    INP_ATOM_DATA InpNormAtData, InpNormTautData;
 5185|  55.4k|    INP_ATOM_DATA *inp_norm_data[TAUT_NUM]; /*  = { &InpNormAtData, &InpNormTautData }; */
 5186|       |
 5187|  55.4k|    int            bOrigCoord = 0;
 5188|  55.4k|    int            num_at, ret = RI_ERR_PROGR;
  ------------------
  |  |   45|  55.4k|#define RI_ERR_PROGR   (-3)
  ------------------
 5189|  55.4k|    struct tagInchiTime ulMaxTime;
 5190|       |
 5191|  55.4k|    T_GROUP_INFO *t_group_info = NULL;
 5192|       |    /* initialization */
 5193|  55.4k|    inp_cur_data = &InpCurAtData;
 5194|  55.4k|    inp_norm_data[TAUT_NON] = &InpNormAtData;
  ------------------
  |  |  579|  55.4k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 5195|  55.4k|    inp_norm_data[TAUT_YES] = &InpNormTautData;
  ------------------
  |  |  580|  55.4k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5196|       |
 5197|  55.4k|    memset( inp_cur_data, 0, sizeof( *inp_cur_data ) );
 5198|  55.4k|    memset( inp_norm_data[TAUT_NON], 0, sizeof( *inp_norm_data[0] ) );
  ------------------
  |  |  579|  55.4k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 5199|  55.4k|    memset( inp_norm_data[TAUT_YES], 0, sizeof( *inp_norm_data[0] ) );
  ------------------
  |  |  580|  55.4k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5200|  55.4k|    ulStructTime = sd->ulStructTime;
 5201|  55.4k|    memset( sd, 0, sizeof( *sd ) );
 5202|       |
 5203|       |    /* deallocate old results */
 5204|  55.4k|    free_t_group_info( &pStruct->One_ti );
 5205|   166k|    for (k = 0; k < TAUT_NUM; k++)
  ------------------
  |  |  578|   166k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (5205:17): [True: 110k, False: 55.4k]
  ------------------
 5206|   110k|    {
 5207|   110k|        Free_INChI( &pStruct->pOneINChI[k] );
 5208|   110k|        Free_INChI_Aux( &pStruct->pOneINChI_Aux[k] );
 5209|   110k|        if (pStruct->pOne_norm_data[k])
  ------------------
  |  Branch (5209:13): [True: 0, False: 110k]
  ------------------
 5210|      0|        {
 5211|      0|            FreeInpAtomData( pStruct->pOne_norm_data[k] );
 5212|      0|            inchi_free( pStruct->pOne_norm_data[k] );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 5213|      0|            pStruct->pOne_norm_data[k] = NULL;
 5214|      0|        }
 5215|   110k|        cur_INChI[k] = NULL;
 5216|   110k|        cur_INChI_Aux[k] = NULL;
 5217|   110k|    }
 5218|       |
 5219|  55.4k|    memcpy( at3, at2, sizeof( at3[0] )*len_at );
 5220|       |
 5221|       |    /* prepare the structure */
 5222|  55.4k|    IncrZeroBondsAndClearEndpts( at3, num_atoms, iComponent + 1 );
 5223|       |
 5224|  55.4k|    CopySt2At( at3, pStruct->st, pStruct->num_atoms );
 5225|       |
 5226|  55.4k|    FixUnkn0DStereoBonds( at3, pStruct->num_atoms );
 5227|       |
 5228|  55.4k|    ret = ReconcileAllCmlBondParities( at3, pStruct->num_atoms, 0 );
 5229|       |
 5230|  55.4k|    if (ret < 0)
  ------------------
  |  Branch (5230:9): [True: 0, False: 55.4k]
  ------------------
 5231|      0|    {
 5232|      0|        goto exit_function;
 5233|      0|    }
 5234|       |
 5235|  55.4k|    if (0 < fix_odd_things( num_atoms, at3, 1, ip->bFixNonUniformDraw ))
  ------------------
  |  Branch (5235:9): [True: 0, False: 55.4k]
  ------------------
 5236|      0|    {
 5237|      0|        if (sd->nErrorType < _IS_WARNING)
  ------------------
  |  |   39|      0|#define _IS_WARNING 1
  ------------------
  |  Branch (5237:13): [True: 0, False: 0]
  ------------------
 5238|      0|        {
 5239|      0|            sd->nErrorType = _IS_WARNING;
  ------------------
  |  |   39|      0|#define _IS_WARNING 1
  ------------------
 5240|      0|        }
 5241|      0|        sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_FIX_ODD_THINGS_DONE;
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                      sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_FIX_ODD_THINGS_DONE;
  ------------------
  |  |  975|      0|#define TG_FLAG_FIX_ODD_THINGS_DONE      0x00000800   /* fixed drawing ambiguities in fix_odd_things */
  ------------------
 5242|      0|    }
 5243|       |
 5244|       |    /* allocate and set parameters */
 5245|  55.4k|    inp_cur_data->at = at3;
 5246|  55.4k|    inp_cur_data->num_at = num_atoms;
 5247|  55.4k|    inp_cur_data->num_removed_H = pStruct->num_deleted_H;
 5248|       |
 5249|  55.4k|    bTautFlagsDone &= ~( TG_FLAG_FOUND_ISOTOPIC_H_DONE | TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE );
  ------------------
  |  |  978|  55.4k|#define TG_FLAG_FOUND_ISOTOPIC_H_DONE    0x00004000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
                  bTautFlagsDone &= ~( TG_FLAG_FOUND_ISOTOPIC_H_DONE | TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE );
  ------------------
  |  |  979|  55.4k|#define TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE 0x00008000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
 5250|       |
 5251|  55.4k|    if (i = bNumHeterAtomHasIsotopicH( at3, num_atoms ))
  ------------------
  |  Branch (5251:9): [True: 30, False: 55.3k]
  ------------------
 5252|     30|    {
 5253|     30|        if (i & 1)
  ------------------
  |  Branch (5253:13): [True: 3, False: 27]
  ------------------
 5254|      3|        {
 5255|      3|            bTautFlagsDone |= TG_FLAG_FOUND_ISOTOPIC_H_DONE;
  ------------------
  |  |  978|      3|#define TG_FLAG_FOUND_ISOTOPIC_H_DONE    0x00004000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
 5256|      3|        }
 5257|     30|        if (i & 2)
  ------------------
  |  Branch (5257:13): [True: 30, False: 0]
  ------------------
 5258|     30|        {
 5259|     30|            bTautFlagsDone |= TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE;
  ------------------
  |  |  979|     30|#define TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE 0x00008000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
 5260|     30|        }
 5261|     30|    }
 5262|       |
 5263|  55.4k|    memset( &ulMaxTime, 0, sizeof( ulMaxTime ) );
 5264|       |
 5265|       |    /*  allocate memory for non-tautimeric (k=0) and tautomeric (k=1) results */
 5266|   166k|    for (k = 0; k < TAUT_NUM; k++)
  ------------------
  |  |  578|   166k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (5266:17): [True: 110k, False: 55.4k]
  ------------------
 5267|   110k|    {
 5268|       |
 5269|   110k|        if (!pStruct->bMobileH || k == pStruct->bMobileH)
  ------------------
  |  Branch (5269:13): [True: 40, False: 110k]
  |  Branch (5269:35): [True: 55.3k, False: 55.3k]
  ------------------
 5270|  55.4k|        {
 5271|       |            /* pStruct->bMobileH=0: k = 0, 1   => allow allocation of both Fixed-H and Mobile-H InChI
 5272|       |               pStruct->bMobileH=1: k = 1 only => allow allocation of only Mobile-H InChI              */
 5273|  55.4k|            int nAllocMode = ( k == TAUT_YES ? REQ_MODE_TAUT : 0 ) |
  ------------------
  |  |  580|  55.4k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                          int nAllocMode = ( k == TAUT_YES ? REQ_MODE_TAUT : 0 ) |
  ------------------
  |  |   44|  55.4k|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
  |  Branch (5273:30): [True: 55.4k, False: 2]
  |  Branch (5273:32): [True: 55.4k, False: 20]
  ------------------
 5274|  55.4k|                ( bTautFlagsDone & ( TG_FLAG_FOUND_ISOTOPIC_H_DONE |
  ------------------
  |  |  978|  55.4k|#define TG_FLAG_FOUND_ISOTOPIC_H_DONE    0x00004000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
 5275|  55.4k|                    TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE ) ) ?
  ------------------
  |  |  979|  55.4k|#define TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE 0x00008000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
 5276|  55.4k|                    ( ip->nMode & REQ_MODE_ISO ) : 0;
  ------------------
  |  |   45|  55.4k|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
 5277|       |
 5278|  55.4k|            if (k == TAUT_NON && ( ip->nMode & REQ_MODE_BASIC ) ||
  ------------------
  |  |  579|   110k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                          if (k == TAUT_NON && ( ip->nMode & REQ_MODE_BASIC ) ||
  ------------------
  |  |   43|     20|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
  |  Branch (5278:17): [True: 20, False: 55.4k]
  |  Branch (5278:34): [True: 20, False: 0]
  ------------------
 5279|  55.4k|                 k == TAUT_YES && ( ip->nMode & REQ_MODE_TAUT ))
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                               k == TAUT_YES && ( ip->nMode & REQ_MODE_TAUT ))
  ------------------
  |  |   44|  55.4k|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
  |  Branch (5279:18): [True: 55.4k, False: 0]
  |  Branch (5279:35): [True: 55.4k, False: 0]
  ------------------
 5280|  55.4k|            {
 5281|       |                /*  alloc INChI and INChI_Aux only if ip->nMode allows this */
 5282|  55.4k|                cur_INChI[k] = Alloc_INChI( inp_cur_data->at, inp_cur_data->num_at, &inp_cur_data->num_bonds,
 5283|  55.4k|                                              &inp_cur_data->num_isotopic, nAllocMode );
 5284|  55.4k|                cur_INChI_Aux[k] = Alloc_INChI_Aux( inp_cur_data->num_at,
 5285|  55.4k|                                              inp_cur_data->num_isotopic, nAllocMode, bOrigCoord );
 5286|  55.4k|                if (cur_INChI_Aux[k])
  ------------------
  |  Branch (5286:21): [True: 55.4k, False: 0]
  ------------------
 5287|  55.4k|                {
 5288|  55.4k|                    cur_INChI_Aux[k]->bIsIsotopic = inp_cur_data->num_isotopic;
 5289|  55.4k|                }
 5290|       |
 5291|       |                /*  alloc memory for the output structure: non-tautomeric and tautomeric (for displaying) */
 5292|  55.4k|                CreateInpAtomData( inp_norm_data[k], inp_cur_data->num_at + inp_cur_data->num_removed_H, k );
 5293|       |
 5294|  55.4k|                inp_norm_data[k]->num_removed_H = inp_cur_data->num_removed_H;
 5295|  55.4k|            }
 5296|      0|            else
 5297|      0|            {
 5298|      0|                FreeInpAtomData( inp_norm_data[k] );
 5299|      0|            }
 5300|  55.4k|        }
 5301|  55.3k|        else
 5302|  55.3k|        {
 5303|  55.3k|            FreeInpAtomData( inp_norm_data[k] );
 5304|  55.3k|        }
 5305|   110k|    }
 5306|       |
 5307|  55.4k|    k = pStruct->bMobileH;
 5308|       |
 5309|       |    /* In case of Fixed-H we have to create InChI for both Fixed-H and Mobile-H */
 5310|       |
 5311|  55.4k|    num_at = Create_INChI( pCG,
 5312|  55.4k|                           ic,
 5313|  55.4k|                           (INPUT_PARMS *) ip,
 5314|  55.4k|                           cur_INChI,
 5315|  55.4k|                           cur_INChI_Aux,
 5316|  55.4k|                           NULL,
 5317|  55.4k|                           inp_cur_data->at,
 5318|  55.4k|                           inp_norm_data,
 5319|  55.4k|                           inp_cur_data->num_at + inp_cur_data->num_removed_H,
 5320|  55.4k|                           ip->nMode,
 5321|  55.4k|                           &bTautFlags,
 5322|  55.4k|                           &bTautFlagsDone,
 5323|  55.4k|                           NULL /* &ulMaxTime*/,
 5324|  55.4k|                           &pStruct->One_ti,
 5325|  55.4k|                           sd->pStrErrStruct );
 5326|       |
 5327|  55.4k|    SetConnectedComponentNumber( inp_cur_data->at, inp_cur_data->num_at, iComponent + 1 ); /*  normalization alters structure component number */
 5328|       |
 5329|       |    /* Detect InChI errors */
 5330|       |
 5331|  55.4k|    if (num_at < 0)
  ------------------
  |  Branch (5331:9): [True: 0, False: 55.4k]
  ------------------
 5332|      0|    {
 5333|      0|        ret = num_at;
 5334|      0|    }
 5335|  55.4k|    else if (cur_INChI[k] && cur_INChI[k]->nErrorCode)
  ------------------
  |  Branch (5335:14): [True: 55.4k, False: 0]
  |  Branch (5335:30): [True: 0, False: 55.4k]
  ------------------
 5336|      0|    {
 5337|      0|        ret = cur_INChI[k]->nErrorCode;
 5338|      0|    }
 5339|  55.4k|    else if (cur_INChI_Aux[k] && cur_INChI_Aux[k]->nErrorCode)
  ------------------
  |  Branch (5339:14): [True: 55.4k, False: 0]
  |  Branch (5339:34): [True: 0, False: 55.4k]
  ------------------
 5340|      0|    {
 5341|      0|        ret = cur_INChI_Aux[k]->nErrorCode;
 5342|      0|    }
 5343|  55.4k|    else
 5344|  55.4k|    {
 5345|  55.4k|        ret = 0;
 5346|  55.4k|    }
 5347|       |
 5348|       |    /* Fill out the output */
 5349|       |
 5350|  55.4k|    if (!ret)
  ------------------
  |  Branch (5350:9): [True: 55.4k, False: 0]
  ------------------
 5351|  55.4k|    {
 5352|  55.4k|        int bMobileH = pStruct->bMobileH;
 5353|  55.4k|        if (bMobileH == TAUT_NON &&
  ------------------
  |  |  579|   110k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (5353:13): [True: 20, False: 55.3k]
  ------------------
 5354|  55.4k|             0 == cur_INChI[TAUT_NON]->nNumberOfAtoms &&
  ------------------
  |  |  579|     20|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (5354:14): [True: 19, False: 1]
  ------------------
 5355|  55.4k|             0 < cur_INChI[TAUT_YES]->nNumberOfAtoms)
  ------------------
  |  |  580|     19|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (5355:14): [True: 19, False: 0]
  ------------------
 5356|     19|        {
 5357|       |            /* tautomerism or H(+) removal/addition was not discovered */
 5358|     19|            bMobileH = TAUT_YES;
  ------------------
  |  |  580|     19|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5359|     19|        }
 5360|       |
 5361|  55.4k|        pStruct->nChargeRevrs = cur_INChI[TAUT_YES]->nTotalCharge;
  ------------------
  |  |  580|  55.4k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5362|       |
 5363|  55.4k|        pStruct->pOneINChI[0] = cur_INChI[bMobileH];
 5364|  55.4k|        pStruct->pOneINChI_Aux[0] = cur_INChI_Aux[bMobileH];
 5365|  55.4k|        pStruct->nOneINChI_bMobileH = bMobileH;
 5366|  55.4k|        cur_INChI[bMobileH] = NULL;  /* remove pointer to avoid deallocation at exit_function */
 5367|  55.4k|        cur_INChI_Aux[bMobileH] = NULL;  /* remove pointer to avoid deallocation at exit_function */
 5368|       |
 5369|  55.4k|        pStruct->nNumRemovedProtons = ( pStruct->iMobileH == TAUT_YES ) ? pStruct->One_ti.tni.nNumRemovedProtons : 0;
  ------------------
  |  |  580|  55.4k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (5369:39): [True: 55.3k, False: 20]
  ------------------
 5370|       |
 5371|       |
 5372|       |        /* set correct t-group numbers to endpoints */
 5373|       |
 5374|  55.4k|        t_group_info = &pStruct->One_ti;
 5375|       |
 5376|  55.4k|        if (t_group_info->num_t_groups && t_group_info->t_group && t_group_info->nEndpointAtomNumber)
  ------------------
  |  Branch (5376:13): [True: 2, False: 55.4k]
  |  Branch (5376:43): [True: 2, False: 0]
  |  Branch (5376:68): [True: 2, False: 0]
  ------------------
 5377|      2|        {
 5378|      2|            inp_ATOM     *at_norm = inp_norm_data[TAUT_YES]->at;
  ------------------
  |  |  580|      2|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5379|      2|            int          num_at_norm = inp_norm_data[TAUT_YES]->num_at;
  ------------------
  |  |  580|      2|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5380|     12|            for (i = 0; i < num_at_norm; i++)
  ------------------
  |  Branch (5380:25): [True: 10, False: 2]
  ------------------
 5381|     10|            {
 5382|     10|                at_norm[i].endpoint = 0;
 5383|     10|            }
 5384|      4|            for (i = 0; i < t_group_info->num_t_groups; i++)
  ------------------
  |  Branch (5384:25): [True: 2, False: 2]
  ------------------
 5385|      2|            {
 5386|      2|                k = t_group_info->t_group[i].nFirstEndpointAtNoPos;
 5387|       |                /* add number of mobile (-) to the number of mobile H */
 5388|      2|                t_group_info->t_group[i].num[0] += t_group_info->t_group[i].num[1];
 5389|      6|                for (j = 0; j < t_group_info->t_group[i].nNumEndpoints; j++, k++)
  ------------------
  |  Branch (5389:29): [True: 4, False: 2]
  ------------------
 5390|      4|                {
 5391|      4|                    at_norm[t_group_info->nEndpointAtomNumber[k]].endpoint = t_group_info->t_group[i].nGroupNumber;
 5392|      4|                }
 5393|      2|            }
 5394|      2|        }
 5395|       |
 5396|  55.4k|        pStruct->pOne_norm_data[0] = (INP_ATOM_DATA *) inchi_malloc( sizeof( pStruct->pOne_norm_data[0][0] ) );
  ------------------
  |  | 1130|  55.4k|#define inchi_malloc   malloc
  ------------------
 5397|       |
 5398|  55.4k|        if (pStruct->pOne_norm_data[0])
  ------------------
  |  Branch (5398:13): [True: 55.4k, False: 0]
  ------------------
 5399|  55.4k|        {
 5400|  55.4k|            memcpy( pStruct->pOne_norm_data[0], inp_norm_data[bMobileH], sizeof( pStruct->pOne_norm_data[0][0] ) );
 5401|  55.4k|            memset( inp_norm_data[bMobileH], 0, sizeof( *inp_norm_data[0] ) );
 5402|  55.4k|        }
 5403|      0|        else
 5404|      0|        {
 5405|      0|            ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 5406|      0|        }
 5407|       |
 5408|  55.4k|        if (bMobileH == TAUT_NON && cur_INChI[TAUT_YES]->nNumberOfAtoms > 0)
  ------------------
  |  |  579|   110k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                      if (bMobileH == TAUT_NON && cur_INChI[TAUT_YES]->nNumberOfAtoms > 0)
  ------------------
  |  |  580|      1|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (5408:13): [True: 1, False: 55.4k]
  |  Branch (5408:37): [True: 1, False: 0]
  ------------------
 5409|      1|        {
 5410|      1|            int bMobileHalt = ALT_TAUT( bMobileH ); /* = TAUT_YES */
  ------------------
  |  |  582|      1|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  580|      1|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (582:29): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 5411|      1|            pStruct->pOneINChI[1] = cur_INChI[bMobileHalt];
 5412|      1|            pStruct->pOneINChI_Aux[1] = cur_INChI_Aux[bMobileHalt];
 5413|      1|            cur_INChI[bMobileHalt] = NULL;
 5414|      1|            cur_INChI_Aux[bMobileHalt] = NULL;
 5415|      1|            pStruct->pOne_norm_data[1] = (INP_ATOM_DATA *) inchi_malloc( sizeof( pStruct->pOne_norm_data[0][0] ) );
  ------------------
  |  | 1130|      1|#define inchi_malloc   malloc
  ------------------
 5416|      1|            if (pStruct->pOne_norm_data[1])
  ------------------
  |  Branch (5416:17): [True: 1, False: 0]
  ------------------
 5417|      1|            {
 5418|      1|                memcpy( pStruct->pOne_norm_data[1], inp_norm_data[bMobileHalt], sizeof( pStruct->pOne_norm_data[0][0] ) );
 5419|      1|                memset( inp_norm_data[bMobileHalt], 0, sizeof( *inp_norm_data[0] ) );
 5420|      1|            }
 5421|      0|            else
 5422|      0|            {
 5423|      0|                ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 5424|      0|            }
 5425|      1|        }
 5426|  55.4k|    }
 5427|      0|    else
 5428|      0|    {
 5429|       |#if ( bRELEASE_VERSION != 1 )
 5430|       |#ifndef TARGET_API_LIB
 5431|       |        fprintf( stdout, "ERROR: Create_INChI returned %d\n", ret );
 5432|       |#endif
 5433|       |#endif
 5434|      0|    }
 5435|       |
 5436|  55.4k|exit_function:
 5437|       |    /* deallocate unused */
 5438|   166k|    for (k = 0; k < TAUT_NUM; k++)
  ------------------
  |  |  578|   166k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (5438:17): [True: 110k, False: 55.4k]
  ------------------
 5439|   110k|    {
 5440|   110k|        Free_INChI( &cur_INChI[k] );
 5441|   110k|        Free_INChI_Aux( &cur_INChI_Aux[k] );
 5442|   110k|        FreeInpAtomData( inp_norm_data[k] );
 5443|   110k|    }
 5444|  55.4k|    sd->ulStructTime = ulStructTime;
 5445|       |
 5446|  55.4k|    return ret;
 5447|  55.4k|}
ConnectDisconnectedH:
 5465|  54.6k|{
 5466|  54.6k|    int i, j, k, n, m, num_H;
 5467|  54.6k|    int tot_atoms = num_atoms + num_deleted_H;
 5468|       |
 5469|  54.6k|    for (i = num_atoms; i < tot_atoms; i = j)
  ------------------
  |  Branch (5469:25): [True: 0, False: 54.6k]
  ------------------
 5470|      0|    {
 5471|      0|        k = at[i].neighbor[0]; /* a[k] is the atom connected to the explicit hydrogen at[i] */
 5472|       |
 5473|      0|        for (j = i; j < tot_atoms && at[j].neighbor[0] == k; j++)
  ------------------
  |  Branch (5473:21): [True: 0, False: 0]
  |  Branch (5473:38): [True: 0, False: 0]
  ------------------
 5474|      0|        {
 5475|      0|            ;
 5476|      0|        }
 5477|       |
 5478|      0|        num_H = j - i; /* number of explicit H for at[k] */
 5479|      0|        if (num_H > at[k].num_H)
  ------------------
  |  Branch (5479:13): [True: 0, False: 0]
  ------------------
 5480|      0|        {
 5481|      0|            return RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 5482|      0|        }
 5483|      0|        if (num_H + at[k].valence > MAXVAL)
  ------------------
  |  |   88|      0|#define MAXVAL 20       /* maximum valence */
  ------------------
  |  Branch (5483:13): [True: 0, False: 0]
  ------------------
 5484|      0|        {
 5485|      0|            return RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 5486|      0|        }
 5487|       |
 5488|       |        /* insert links to explicit H before all other links in the connection list */
 5489|      0|        n = at[k].valence;
 5490|      0|        memmove( at[k].neighbor + num_H, at[k].neighbor, sizeof( at[k].neighbor[0] ) * n );
 5491|      0|        memmove( at[k].bond_stereo + num_H, at[k].bond_stereo, sizeof( at[k].bond_stereo[0] ) * n );
 5492|      0|        memmove( at[k].bond_type + num_H, at[k].bond_type, sizeof( at[k].bond_type[0] ) * n );
 5493|      0|        for (n = 0; n < num_H; n++)
  ------------------
  |  Branch (5493:21): [True: 0, False: 0]
  ------------------
 5494|      0|        {
 5495|      0|            at[k].neighbor[n] = i + n;
 5496|      0|            at[k].bond_stereo[n] = 0;
 5497|      0|            at[k].bond_type[n] = BOND_TYPE_SINGLE;
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
 5498|      0|        }
 5499|       |
 5500|      0|        for (m = 0; m < MAX_NUM_STEREO_BONDS && at[k].sb_parity[m]; m++)
  ------------------
  |  |  876|      0|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (5500:21): [True: 0, False: 0]
  |  Branch (5500:49): [True: 0, False: 0]
  ------------------
 5501|      0|        {
 5502|      0|            at[k].sb_ord[m] += num_H;
 5503|      0|            if (at[k].sn_ord[m] < 0)
  ------------------
  |  Branch (5503:17): [True: 0, False: 0]
  ------------------
 5504|      0|            {
 5505|      0|                for (n = i; n < j; n++)
  ------------------
  |  Branch (5505:29): [True: 0, False: 0]
  ------------------
 5506|      0|                {
 5507|      0|                    if (at[n].orig_at_number == at[k].sn_orig_at_num[m])
  ------------------
  |  Branch (5507:25): [True: 0, False: 0]
  ------------------
 5508|      0|                    {
 5509|      0|                        at[k].sn_ord[m] = n - i;
 5510|      0|                        break;
 5511|      0|                    }
 5512|      0|                }
 5513|       |
 5514|      0|                if (n == j)
  ------------------
  |  Branch (5514:21): [True: 0, False: 0]
  ------------------
 5515|      0|                {
 5516|      0|                    return RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 5517|      0|                }
 5518|      0|            }
 5519|      0|            else
 5520|      0|            {
 5521|      0|                at[k].sn_ord[m] += num_H;
 5522|      0|            }
 5523|      0|        }
 5524|       |
 5525|      0|        at[k].valence += num_H;
 5526|      0|        at[k].chem_bonds_valence += num_H;
 5527|      0|        at[k].num_H -= num_H; /* cannot be negative */
 5528|       |
 5529|       |        /*memset( at[k].num_iso_H, 0, sizeof(at[0].num_iso_H) );*/ /* attached H must carry all isotopic shifts */
 5530|      0|        for (n = i; n < j; n++)
  ------------------
  |  Branch (5530:21): [True: 0, False: 0]
  ------------------
 5531|      0|        {
 5532|      0|            at[n].chem_bonds_valence = BOND_TYPE_SINGLE;
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
 5533|      0|        }
 5534|       |
 5535|       |        /* isotopic H */
 5536|      0|        for (m = j - 1; i <= m && at[m].iso_atw_diff > 0; m--)
  ------------------
  |  Branch (5536:25): [True: 0, False: 0]
  |  Branch (5536:35): [True: 0, False: 0]
  ------------------
 5537|      0|        {
 5538|      0|            if (at[m].iso_atw_diff > NUM_H_ISOTOPES)
  ------------------
  |  |   53|      0|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (5538:17): [True: 0, False: 0]
  ------------------
 5539|      0|            {
 5540|      0|                return RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 5541|      0|            }
 5542|      0|            if (0 >= at[k].num_iso_H[(int) at[m].iso_atw_diff - 1] --)
  ------------------
  |  Branch (5542:17): [True: 0, False: 0]
  ------------------
 5543|      0|            {
 5544|      0|                return RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 5545|      0|            }
 5546|      0|        }
 5547|      0|    }
 5548|       |
 5549|       |    /* subtract isotopic H */
 5550|   109k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5550:17): [True: 54.6k, False: 54.6k]
  ------------------
 5551|  54.6k|    {
 5552|   218k|        for (m = 0; m < NUM_H_ISOTOPES; m++)
  ------------------
  |  |   53|   218k|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (5552:21): [True: 163k, False: 54.6k]
  ------------------
 5553|   163k|        {
 5554|   163k|            at[i].num_H -= at[i].num_iso_H[m];
 5555|   163k|        }
 5556|  54.6k|        if (0 > at[i].num_H)
  ------------------
  |  Branch (5556:13): [True: 1, False: 54.6k]
  ------------------
 5557|      1|        {
 5558|      1|            return RI_ERR_PROGR;
  ------------------
  |  |   45|      1|#define RI_ERR_PROGR   (-3)
  ------------------
 5559|      1|        }
 5560|  54.6k|    }
 5561|       |
 5562|  54.6k|    return tot_atoms;
 5563|  54.6k|}
DisconnectedConnectedH:
 5579|      1|{
 5580|      1|    int i, j, k, n, m, num_H, num_iso_H;
 5581|      1|    int tot_atoms = num_atoms + num_deleted_H;
 5582|       |
 5583|       |    /* add implicit isotopic H to total implicit H */
 5584|      6|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5584:17): [True: 5, False: 1]
  ------------------
 5585|      5|    {
 5586|     20|        for (m = 0; m < NUM_H_ISOTOPES; m++)
  ------------------
  |  |   53|     20|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (5586:21): [True: 15, False: 5]
  ------------------
 5587|     15|        {
 5588|     15|            at[i].num_H += at[i].num_iso_H[m];
 5589|     15|        }
 5590|      5|    }
 5591|       |
 5592|      1|    for (i = num_atoms; i < tot_atoms; i = j)
  ------------------
  |  Branch (5592:25): [True: 0, False: 1]
  ------------------
 5593|      0|    {
 5594|      0|        k = at[i].neighbor[0]; /* a[k] is the atom connected to the explicit hydrogen at[i] */
 5595|       |
 5596|      0|        for (j = i; j < tot_atoms && at[j].neighbor[0] == k; j++)
  ------------------
  |  Branch (5596:21): [True: 0, False: 0]
  |  Branch (5596:38): [True: 0, False: 0]
  ------------------
 5597|      0|        {
 5598|      0|            at[j].chem_bonds_valence = 0;
 5599|      0|        }
 5600|      0|        num_H = j - i; /* number of explicit H for at[k] */
 5601|       |
 5602|       |        /* verify correct number of explicit H */
 5603|      0|        for (n = 0; n < at[k].valence && at[k].neighbor[n] >= num_atoms; n++)
  ------------------
  |  Branch (5603:21): [True: 0, False: 0]
  |  Branch (5603:42): [True: 0, False: 0]
  ------------------
 5604|      0|        {
 5605|      0|            ;
 5606|      0|        }
 5607|      0|        if (n != num_H)
  ------------------
  |  Branch (5607:13): [True: 0, False: 0]
  ------------------
 5608|      0|        {
 5609|      0|            return RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 5610|      0|        }
 5611|       |
 5612|       |        /* remove bonds to explicit H located in front of all other bonds in the connection list */
 5613|      0|        n = ( at[k].valence -= num_H ); /* new number of bonds */
 5614|      0|        at[k].chem_bonds_valence -= num_H; /* new no-H valence */
 5615|      0|        if (n)
  ------------------
  |  Branch (5615:13): [True: 0, False: 0]
  ------------------
 5616|      0|        {
 5617|      0|            memmove( at[k].neighbor, at[k].neighbor + num_H, sizeof( at[k].neighbor[0] ) * n );
 5618|      0|            memmove( at[k].bond_stereo, at[k].bond_stereo + num_H, sizeof( at[k].bond_stereo[0] ) * n );
 5619|      0|            memmove( at[k].bond_type, at[k].bond_type + num_H, sizeof( at[k].bond_type[0] ) * n );
 5620|      0|        }
 5621|       |        /* clear the 'tails' */
 5622|      0|        memset( at[k].neighbor + n, 0, sizeof( at[k].neighbor[0] ) * num_H );
 5623|      0|        memset( at[k].bond_stereo + n, 0, sizeof( at[k].bond_stereo[0] ) * num_H );
 5624|      0|        memset( at[k].bond_type + n, 0, sizeof( at[k].bond_type[0] ) * num_H );
 5625|       |
 5626|      0|        for (m = 0; m < MAX_NUM_STEREO_BONDS && at[k].sb_parity[m]; m++)
  ------------------
  |  |  876|      0|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (5626:21): [True: 0, False: 0]
  |  Branch (5626:49): [True: 0, False: 0]
  ------------------
 5627|      0|        {
 5628|      0|            at[k].sb_ord[m] -= num_H;
 5629|      0|            if (0 <= at[k].sn_ord[m] && at[k].sn_ord[m] < num_H)
  ------------------
  |  Branch (5629:17): [True: 0, False: 0]
  |  Branch (5629:41): [True: 0, False: 0]
  ------------------
 5630|      0|            {
 5631|      0|                at[k].sn_ord[m] = -1; /* disconnected explicit H */
 5632|      0|            }
 5633|      0|        }
 5634|       |        /* add explicit isotopic H (already included in num_H) */
 5635|      0|        for (num_iso_H = 0, m = j - 1; i <= m && at[m].iso_atw_diff > 0; m--)
  ------------------
  |  Branch (5635:40): [True: 0, False: 0]
  |  Branch (5635:50): [True: 0, False: 0]
  ------------------
 5636|      0|        {
 5637|      0|            if (at[m].iso_atw_diff > NUM_H_ISOTOPES)
  ------------------
  |  |   53|      0|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (5637:17): [True: 0, False: 0]
  ------------------
 5638|      0|            {
 5639|      0|                return RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 5640|      0|            }
 5641|      0|            at[k].num_iso_H[(int) at[m].iso_atw_diff - 1] ++;
 5642|      0|        }
 5643|      0|        at[k].num_H += num_H; /* add all explicit H including isotopic */
 5644|      0|    }
 5645|       |
 5646|      1|    return tot_atoms;
 5647|      1|}
MakeInChIOutOfStrFromINChI2:
 5659|  54.6k|{
 5660|  54.6k|    char szTitle[MAX_SDF_HEADER + MAX_SDF_VALUE + 256];
 5661|       |
 5662|  54.6k|    int   len, ret;
 5663|       |    /*
 5664|       |    PINChI2     *pINChI[INCHI_NUM];
 5665|       |    PINChI_Aux2 *pINChI_Aux[INCHI_NUM];
 5666|       |    */
 5667|  54.6k|    INPUT_PARMS local_ip;
 5668|  54.6k|    STRUCT_DATA local_sd;
 5669|  54.6k|    INPUT_PARMS *ip = &local_ip;
 5670|  54.6k|    STRUCT_DATA *sd = &local_sd;
 5671|       |
 5672|  54.6k|    ORIG_ATOM_DATA OrigAtData; /* 0=> disconnected, 1=> original */
 5673|  54.6k|    ORIG_ATOM_DATA *orig_inp_data = &OrigAtData;
 5674|  54.6k|    ORIG_ATOM_DATA PrepAtData[2]; /* 0=> disconnected, 1=> original */
 5675|  54.6k|    ORIG_ATOM_DATA *prep_inp_data = PrepAtData;
 5676|       |
 5677|  54.6k|    INCHI_IOS_STRING temp_string_container;
 5678|  54.6k|    INCHI_IOS_STRING *strbuf = &temp_string_container;
 5679|  54.6k|    memset( strbuf, 0, sizeof( *strbuf ) );
 5680|       |
 5681|  54.6k|    if (0 >= inchi_strbuf_init( strbuf, INCHI_STRBUF_INITIAL_SIZE, INCHI_STRBUF_SIZE_INCREMENT ))
  ------------------
  |  |   93|  54.6k|#define INCHI_STRBUF_INITIAL_SIZE 262144
  ------------------
                  if (0 >= inchi_strbuf_init( strbuf, INCHI_STRBUF_INITIAL_SIZE, INCHI_STRBUF_SIZE_INCREMENT ))
  ------------------
  |  |   94|  54.6k|#define INCHI_STRBUF_SIZE_INCREMENT 262144
  ------------------
  |  Branch (5681:9): [True: 0, False: 54.6k]
  ------------------
 5682|      0|    {
 5683|      0|        ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 5684|      0|        goto exit_error;
 5685|      0|    }
 5686|       |
 5687|  54.6k|    *ip = *ip_inp;
 5688|  54.6k|    ip->bDisplay = 0;
 5689|  54.6k|    ip->bDisplayCompositeResults = 0;
 5690|  54.6k|    ip->bDisplayEachComponentINChI = 0;
 5691|  54.6k|    ip->bDisplayIfRestoreWarnings = 0;
 5692|  54.6k|    ip->bINChIOutputOptions = INCHI_OUT_NO_AUX_INFO;
  ------------------
  |  |  157|  54.6k|#define INCHI_OUT_NO_AUX_INFO           0x0001   /* do not output Aux Info                  */
  ------------------
 5693|       |
 5694|       |    /*
 5695|       |    if ( pStruct->bMobileH ) {
 5696|       |        ip->nMode &= ~REQ_MODE_BASIC;
 5697|       |        ip->nMode |= REQ_MODE_TAUT;
 5698|       |    } else {
 5699|       |        ip->nMode |= (REQ_MODE_TAUT | REQ_MODE_BASIC);
 5700|       |    }
 5701|       |    */
 5702|       |
 5703|  54.6k|    memset( sd, 0, sizeof( *sd ) );
 5704|  54.6k|    sd->fPtrStart = -1;
 5705|  54.6k|    sd->fPtrEnd = -1;
 5706|       |
 5707|       |    /*
 5708|       |    if ( ip->nMode & REQ_MODE_STEREO ) {
 5709|       |        if ( ip->nMode & (REQ_MODE_RELATIVE_STEREO | REQ_MODE_RACEMIC_STEREO) ) {
 5710|       |            sd->bChiralFlag |= FLAG_INP_AT_NONCHIRAL;
 5711|       |        } else {
 5712|       |            sd->bChiralFlag |= FLAG_INP_AT_CHIRAL;
 5713|       |        }
 5714|       |    }
 5715|       |    */
 5716|       |
 5717|  54.6k|    memset( orig_inp_data, 0, sizeof( *orig_inp_data ) );
 5718|  54.6k|    memset( prep_inp_data, 0, 2 * sizeof( *prep_inp_data ) );
 5719|  54.6k|    memset( pStruct->RevInChI.pINChI, 0, sizeof( pStruct->RevInChI.pINChI ) );
 5720|  54.6k|    memset( pStruct->RevInChI.pINChI_Aux, 0, sizeof( pStruct->RevInChI.pINChI_Aux ) );
 5721|  54.6k|    memset( szTitle, 0, sizeof( szTitle ) );
 5722|       |
 5723|  54.6k|    len = sizeof( orig_inp_data->at[0] )*( pStruct->num_atoms + pStruct->num_deleted_H );
 5724|       |
 5725|  54.6k|    orig_inp_data->at = (inp_ATOM *) inchi_malloc( len );
  ------------------
  |  | 1130|  54.6k|#define inchi_malloc   malloc
  ------------------
 5726|       |
 5727|  54.6k|    if (orig_inp_data->at)
  ------------------
  |  Branch (5727:9): [True: 54.6k, False: 0]
  ------------------
 5728|  54.6k|    {
 5729|       |        /*memcpy( orig_inp_data->at, pStruct->at2, len );*/
 5730|       |        /*ret = ConnectDisconnectedH( orig_inp_data->at, pStruct->num_atoms, pStruct->num_deleted_H );*/
 5731|       |
 5732|  54.6k|        CopySt2At( pStruct->at2, pStruct->st, pStruct->num_atoms );
 5733|       |
 5734|  54.6k|        ret = ConnectDisconnectedH( pStruct->at2, pStruct->num_atoms, pStruct->num_deleted_H );
 5735|  54.6k|        if (ret < 0)
  ------------------
  |  Branch (5735:13): [True: 1, False: 54.6k]
  ------------------
 5736|      1|        {
 5737|      1|            goto exit_error;
 5738|      1|        }
 5739|       |
 5740|  54.6k|        orig_inp_data->num_inp_atoms = ret;
 5741|       |        /* connections changed => reconcile parities even if they were reconciled before */
 5742|       |        /* remove t-group markings and increment zero-order bonds,
 5743|       |           otherwise MakeInChIOutOfStrFromINChI2() woild fail */
 5744|       |        /*
 5745|       |        IncrZeroBondsAndClearEndpts(pStruct->at2, pStruct->num_atoms, iComponent+1);
 5746|       |        */
 5747|       |
 5748|  54.6k|        IncrZeroBonds( pStruct->at2, pStruct->num_atoms, iComponent + 1 );
 5749|       |
 5750|       |        /* CopySt2At() moved to the position before ConnectDisconnectedH() because
 5751|       |           in case stereo exists only in Mobile-H layer and the processd here
 5752|       |           component is restored in Fixed-H layer the parities needed by
 5753|       |           ConnectDisconnectedH() must be there before calling
 5754|       |           ConnectDisconnectedH()
 5755|       |        */
 5756|       |        /*CopySt2At( pStruct->at2, pStruct->st, pStruct->num_atoms );*/
 5757|       |
 5758|  54.6k|        ret = ReconcileAllCmlBondParities( pStruct->at2, orig_inp_data->num_inp_atoms, 0 );
 5759|  54.6k|        if (ret < 0)
  ------------------
  |  Branch (5759:13): [True: 0, False: 54.6k]
  ------------------
 5760|      0|        {
 5761|      0|            goto exit_error;
 5762|      0|        }
 5763|       |
 5764|  54.6k|        memcpy( orig_inp_data->at, pStruct->at2, len );
 5765|       |
 5766|  54.6k|        ClearEndpts( orig_inp_data->at, pStruct->num_atoms );
 5767|       |
 5768|  54.6k|        if (FixUnkn0DStereoBonds( orig_inp_data->at, pStruct->num_atoms ))
  ------------------
  |  Branch (5768:13): [True: 0, False: 54.6k]
  ------------------
 5769|      0|        {
 5770|      0|            ret = ReconcileAllCmlBondParities( pStruct->at2, orig_inp_data->num_inp_atoms, 0 );
 5771|      0|            if (ret < 0)
  ------------------
  |  Branch (5771:17): [True: 0, False: 0]
  ------------------
 5772|      0|            {
 5773|      0|                goto exit_error;
 5774|      0|            }
 5775|      0|        }
 5776|       |        /* keep endpoint[] markings in at2[] for subsequent add/remove protons */
 5777|  54.6k|    }
 5778|      0|    else
 5779|      0|    {
 5780|      0|        ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 5781|      0|        goto exit_error;
 5782|      0|    }
 5783|       |
 5784|  54.6k|    memset( sd->num_components, 0, sizeof( sd->num_components ) );
 5785|  54.6k|    memset( sd->num_taut, 0, sizeof( sd->num_taut ) );
 5786|  54.6k|    memset( sd->num_non_taut, 0, sizeof( sd->num_non_taut ) );
 5787|  54.6k|    memset( sd->bTautFlagsDone, 0, sizeof( sd->bTautFlagsDone ) );
 5788|  54.6k|    memset( sd->bTautFlags, 0, sizeof( sd->bTautFlags ) );
 5789|       |
 5790|       |
 5791|  54.6k|    ret = ProcessOneStructure( ic, pCG, sd, ip, szTitle,
 5792|  54.6k|                               pStruct->RevInChI.pINChI,
 5793|  54.6k|                               pStruct->RevInChI.pINChI_Aux,
 5794|  54.6k|                               NULL /*inp_file*/,
 5795|  54.6k|                               NULL /*log_file*/,
 5796|  54.6k|                               NULL /*out_file*/,
 5797|  54.6k|                               NULL /*prb_file*/,
 5798|  54.6k|                               orig_inp_data, prep_inp_data,
 5799|  54.6k|                               num_inp, strbuf,
 5800|  54.6k|                               0 /* save_opt_bits */ );
 5801|       |
 5802|       |
 5803|  54.6k|    memcpy( pStruct->RevInChI.num_components, sd->num_components, sizeof( pStruct->RevInChI.num_components ) );
 5804|  54.6k|    memcpy( sd_inp->pStrErrStruct, sd->pStrErrStruct, sizeof( sd_inp->pStrErrStruct ) );
 5805|  54.6k|    pStruct->RevInChI.nRetVal = ret;
 5806|       |
 5807|       |    /* translate returned value */
 5808|  54.6k|    if (ret == _IS_ERROR || ret == _IS_FATAL || ret == _IS_UNKNOWN)
  ------------------
  |  |   40|   109k|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
                  if (ret == _IS_ERROR || ret == _IS_FATAL || ret == _IS_UNKNOWN)
  ------------------
  |  |   41|   109k|#define _IS_FATAL   3
  ------------------
                  if (ret == _IS_ERROR || ret == _IS_FATAL || ret == _IS_UNKNOWN)
  ------------------
  |  |   42|  54.6k|#define _IS_UNKNOWN 4    /* unknown error: used in INChI DLL only */
  ------------------
  |  Branch (5808:9): [True: 0, False: 54.6k]
  |  Branch (5808:29): [True: 0, False: 54.6k]
  |  Branch (5808:49): [True: 0, False: 54.6k]
  ------------------
 5809|      0|    {
 5810|      0|        ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 5811|      0|    }
 5812|  54.6k|    else if (ret == _IS_OKAY)
  ------------------
  |  |   38|  54.6k|#define _IS_OKAY    0
  ------------------
  |  Branch (5812:14): [True: 54.6k, False: 4]
  ------------------
 5813|  54.6k|    {
 5814|  54.6k|        ret = 0;
 5815|  54.6k|    }
 5816|      4|    else if (ret == _IS_WARNING)
  ------------------
  |  |   39|      4|#define _IS_WARNING 1
  ------------------
  |  Branch (5816:14): [True: 4, False: 0]
  ------------------
 5817|      4|    {
 5818|      4|        ret = 1;
 5819|      4|    }
 5820|      0|    else
 5821|      0|    {
 5822|      0|        ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 5823|      0|    }
 5824|       |
 5825|       |    /* save total charge from Mobile-H layer */
 5826|       |
 5827|  54.6k|    pStruct->nChargeRevrs = 0;
 5828|  54.6k|    if (ret >= 0)
  ------------------
  |  Branch (5828:9): [True: 54.6k, False: 0]
  ------------------
 5829|  54.6k|    {
 5830|  54.6k|        if (bRevInchiComponentExists( pStruct, INCHI_REC, TAUT_YES, 0 ))
  ------------------
  |  |  576|  54.6k|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                      if (bRevInchiComponentExists( pStruct, INCHI_REC, TAUT_YES, 0 ))
  ------------------
  |  |  580|  54.6k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (5830:13): [True: 0, False: 54.6k]
  ------------------
 5831|      0|        {
 5832|      0|            pStruct->nChargeRevrs = pStruct->RevInChI.pINChI[INCHI_REC][0][TAUT_YES]->nTotalCharge;
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                          pStruct->nChargeRevrs = pStruct->RevInChI.pINChI[INCHI_REC][0][TAUT_YES]->nTotalCharge;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5833|      0|        }
 5834|  54.6k|        else if (bRevInchiComponentExists( pStruct, INCHI_BAS, TAUT_YES, 0 ))
  ------------------
  |  |  575|  54.6k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                      else if (bRevInchiComponentExists( pStruct, INCHI_BAS, TAUT_YES, 0 ))
  ------------------
  |  |  580|  54.6k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (5834:18): [True: 54.6k, False: 1]
  ------------------
 5835|  54.6k|        {
 5836|  54.6k|            pStruct->nChargeRevrs = pStruct->RevInChI.pINChI[INCHI_BAS][0][TAUT_YES]->nTotalCharge;
  ------------------
  |  |  575|  54.6k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          pStruct->nChargeRevrs = pStruct->RevInChI.pINChI[INCHI_BAS][0][TAUT_YES]->nTotalCharge;
  ------------------
  |  |  580|  54.6k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 5837|  54.6k|        }
 5838|  54.6k|    }
 5839|       |
 5840|       |    /* free structure data */
 5841|  54.6k|    FreeOrigAtData( orig_inp_data );
 5842|  54.6k|    FreeOrigAtData( prep_inp_data );
 5843|  54.6k|    FreeOrigAtData( prep_inp_data + 1 );
 5844|       |
 5845|  54.6k|exit_error:
 5846|  54.6k|#if ( FIX_GAF_2019_2==1 )
 5847|  54.6k|    if (orig_inp_data->at)
  ------------------
  |  Branch (5847:9): [True: 1, False: 54.6k]
  ------------------
 5848|      1|    {
 5849|      1|        FreeInpAtom(&orig_inp_data->at);
 5850|      1|    }
 5851|  54.6k|#endif
 5852|  54.6k|    inchi_strbuf_close( strbuf );
 5853|       |
 5854|  54.6k|    return ret;
 5855|  54.6k|}

CopySt2At:
   74|   110k|{
   75|   110k|    int i;
   76|   110k|    if (!st)
  ------------------
  |  Branch (76:9): [True: 110k, False: 0]
  ------------------
   77|   110k|    {
   78|   110k|        return;
   79|   110k|    }
   80|       |
   81|      0|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (81:17): [True: 0, False: 0]
  ------------------
   82|      0|    {
   83|      0|        if (st[i].p_parity)
  ------------------
  |  Branch (83:13): [True: 0, False: 0]
  ------------------
   84|      0|        {
   85|      0|            memcpy( at[i].p_orig_at_num, st[i].p_orig_at_num, sizeof( at[0].p_orig_at_num ) );
   86|      0|            at[i].p_parity = st[i].p_parity;
   87|      0|        }
   88|      0|        if (st[i].sb_parity[0])
  ------------------
  |  Branch (88:13): [True: 0, False: 0]
  ------------------
   89|      0|        {
   90|      0|            memcpy( at[i].sb_ord, st[i].sb_ord, sizeof( st[0].sb_ord ) );
   91|      0|            memcpy( at[i].sb_parity, st[i].sb_parity, sizeof( at[0].sb_parity ) );
   92|      0|            memcpy( at[i].sn_ord, st[i].sn_ord, sizeof( at[0].sn_ord ) );
   93|      0|            memcpy( at[i].sn_orig_at_num, st[i].sn_orig_at_num, sizeof( at[0].sn_orig_at_num ) );
   94|      0|        }
   95|      0|    }
   96|      0|}
RestoreAtomConnectionsSetStereo:
  105|  55.4k|{
  106|  55.4k|    inp_ATOM     *at = NULL;
  107|  55.4k|    inp_ATOM_STEREO * st = NULL;
  108|  55.4k|    int           num_atoms, i, jv, jn, n_vertex, n_neigh, num_H, parity;
  109|  55.4k|    int           nNumDeletedH = 0, iDeletedH = 0, idelH1, idelH2, ret = 0, len;
  110|  55.4k|    int           num_stereo_bonds, num_stereo_centers, num_stereo_bonds2, num_stereo_centers2;
  111|  55.4k|    INChI_Stereo *pStereo = NULL, *pStereo2 = NULL;
  112|  55.4k|    AT_NUMB       nCumulene[MAX_CUMULENE_LEN + 2];
  113|       |
  114|  55.4k|    num_atoms = pInChI->nNumberOfAtoms;
  115|  55.4k|    if (num_atoms <= 0)
  ------------------
  |  Branch (115:9): [True: 0, False: 55.4k]
  ------------------
  116|      0|    {
  117|      0|        return 0;
  118|      0|    }
  119|       |
  120|       |    INCHI_HEAPCHK
  121|       |
  122|       |    /* atoms */
  123|  55.4k|        pStruct->at = at = (inp_ATOM *) inchi_calloc( num_atoms, sizeof( pStruct->at[0] ) );
  ------------------
  |  | 1133|  55.4k|#define inchi_calloc   calloc
  ------------------
  124|  55.4k|    if (!at)
  ------------------
  |  Branch (124:9): [True: 0, False: 55.4k]
  ------------------
  125|      0|    {
  126|      0|        ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
  127|      0|        goto exit_function;
  128|      0|    }
  129|       |
  130|  55.4k|    pStruct->num_atoms = num_atoms;
  131|       |
  132|       |    /* charge */
  133|  55.4k|    pStruct->charge = pInChI->nTotalCharge;
  134|       |
  135|       |    /* elements, terminal atoms H */
  136|   763k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (136:17): [True: 707k, False: 55.4k]
  ------------------
  137|   707k|    {
  138|   707k|        at[i].el_number = pInChI->nAtom[i];
  139|   707k|        if (-1 == get_element_chemical_symbol( UCINT pInChI->nAtom[i], at[i].elname ))
  ------------------
  |  |  116|   707k|#define UCINT  (int)(unsigned char)
  ------------------
  |  Branch (139:13): [True: 0, False: 707k]
  ------------------
  140|      0|        {
  141|      0|            ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  142|      0|            goto exit_function;
  143|      0|        }
  144|   707k|        at[i].orig_at_number = iAtNoOffset + i + 1;
  145|   707k|        at[i].orig_compt_at_numb = i + 1;
  146|   707k|        at[i].component = iComponent + 1;
  147|   707k|        num_H = pInChI->nNum_H[i];
  148|       |        /* --- pInChI->nNum_H_fixed[i] was added to pInChI->nNum_H[i] ---
  149|       |        if ( pInChI->nNum_H_fixed ) {
  150|       |            num_H += pInChI->nNum_H_fixed[i];
  151|       |        }
  152|       |        */
  153|       |#if 0
  154|       |        ( FIX_GAF_ISSUES == 1 )
  155|       |            if (num_H < 0)
  156|       |            {
  157|       |                ret = RI_ERR_PROGR;
  158|       |                goto exit_function;
  159|       |            }
  160|       |#endif
  161|   707k|        at[i].num_H = num_H;
  162|   707k|    }
  163|       |
  164|       |    INCHI_HEAPCHK
  165|       |
  166|       |    /* connections */
  167|  55.4k|    for (i = 1, n_vertex = pInChI->nConnTable[0] - 1; i < pInChI->lenConnTable; i++)
  ------------------
  |  Branch (167:55): [True: 24, False: 55.4k]
  ------------------
  168|     24|    {
  169|     24|        if (( n_neigh = pInChI->nConnTable[i] - 1 ) < n_vertex)
  ------------------
  |  Branch (169:13): [True: 12, False: 12]
  ------------------
  170|     12|        {
  171|       |            /*  vertex - neighbor connection */
  172|     12|            jv = at[n_vertex].valence++;
  173|     12|            at[n_vertex].neighbor[jv] = n_neigh;
  174|     12|            at[n_vertex].bond_type[jv] = BOND_TYPE_SINGLE;
  ------------------
  |  |   60|     12|#define BOND_TYPE_SINGLE    1
  ------------------
  175|     12|            at[n_vertex].chem_bonds_valence += at[n_vertex].bond_type[jv];
  176|       |            /*  neighbor - vertex connection */
  177|     12|            jn = at[n_neigh].valence++;
  178|     12|            at[n_neigh].neighbor[jn] = n_vertex;
  179|     12|            at[n_neigh].bond_type[jn] = BOND_TYPE_SINGLE;
  ------------------
  |  |   60|     12|#define BOND_TYPE_SINGLE    1
  ------------------
  180|     12|            at[n_neigh].chem_bonds_valence += at[n_neigh].bond_type[jn];
  181|     12|        }
  182|     12|        else if (( n_vertex = n_neigh ) >= num_atoms)
  ------------------
  |  Branch (182:18): [True: 0, False: 12]
  ------------------
  183|      0|        {
  184|      0|            ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  185|      0|            goto exit_function;
  186|      0|        }
  187|     24|    }
  188|       |
  189|       |    INCHI_HEAPCHK
  190|       |
  191|       |    /* isotopic atoms */
  192|  55.4k|    if (pInChI->IsotopicAtom && pInChI->nNumberOfIsotopicAtoms)
  ------------------
  |  Branch (192:9): [True: 32, False: 55.4k]
  |  Branch (192:33): [True: 32, False: 0]
  ------------------
  193|     32|    {
  194|  8.08k|        for (i = 0; i < pInChI->nNumberOfIsotopicAtoms; i++)
  ------------------
  |  Branch (194:21): [True: 8.04k, False: 32]
  ------------------
  195|  8.04k|        {
  196|  8.04k|            n_vertex = pInChI->IsotopicAtom[i].nAtomNumber - 1;
  197|  8.04k|            at[n_vertex].iso_atw_diff = (char) pInChI->IsotopicAtom[i].nIsoDifference;
  198|  8.04k|            at[n_vertex].num_iso_H[0] = (char) pInChI->IsotopicAtom[i].nNum_H;
  199|  8.04k|            at[n_vertex].num_iso_H[1] = (char) pInChI->IsotopicAtom[i].nNum_D;
  200|  8.04k|            at[n_vertex].num_iso_H[2] = (char) pInChI->IsotopicAtom[i].nNum_T;
  201|  8.04k|        }
  202|     32|        pStruct->bIsotopic |= 1;
  203|     32|    }
  204|       |
  205|       |    INCHI_HEAPCHK
  206|       |
  207|       |    /* tautomeric groups */
  208|  55.4k|    if (ret = GetTgroupInfoFromInChI( &pStruct->ti, at, NULL, pInChI ))
  ------------------
  |  Branch (208:9): [True: 0, False: 55.4k]
  ------------------
  209|      0|    {
  210|      0|        goto exit_function;
  211|      0|    }
  212|       |
  213|       |    /* coordinates: data from unused members: pInChI->IsotopicTGroup and InChI->nNumberOfIsotopicTGroups */
  214|  55.4k|    if (pInChI->IsotopicTGroup && !pInChI->nNumberOfIsotopicTGroups)
  ------------------
  |  Branch (214:9): [True: 0, False: 55.4k]
  |  Branch (214:35): [True: 0, False: 0]
  ------------------
  215|      0|    {
  216|      0|        pStruct->pXYZ = (XYZ_COORD *) pInChI->IsotopicTGroup;
  217|      0|        pInChI->IsotopicTGroup = NULL;
  218|      0|    }
  219|       |
  220|       |    /* stereo */
  221|  55.4k|    if (pInChI->StereoIsotopic &&
  ------------------
  |  Branch (221:9): [True: 16, False: 55.4k]
  ------------------
  222|  55.4k|        ( pInChI->StereoIsotopic->nNumberOfStereoBonds +
  ------------------
  |  Branch (222:9): [True: 0, False: 16]
  ------------------
  223|     16|            pInChI->StereoIsotopic->nNumberOfStereoCenters ))
  224|      0|    {
  225|      0|        pStereo = pInChI->StereoIsotopic;
  226|      0|    }
  227|  55.4k|    else if (pInChI->Stereo &&
  ------------------
  |  Branch (227:14): [True: 257, False: 55.1k]
  ------------------
  228|  55.4k|        ( pInChI->Stereo->nNumberOfStereoBonds +
  ------------------
  |  Branch (228:9): [True: 0, False: 257]
  ------------------
  229|    257|            pInChI->Stereo->nNumberOfStereoCenters ))
  230|      0|    {
  231|      0|        pStereo = pInChI->Stereo;
  232|      0|    }
  233|  55.4k|    else
  234|  55.4k|    {
  235|  55.4k|        pStereo = NULL;
  236|  55.4k|    }
  237|       |
  238|       |    /* stereo2: Mobile-H in addition to Fixed-H*/
  239|  55.4k|    pStereo2 = NULL;
  240|  55.4k|    if (pInChIMobH && pInChIMobH->nNumberOfAtoms)
  ------------------
  |  Branch (240:9): [True: 20, False: 55.4k]
  |  Branch (240:23): [True: 20, False: 0]
  ------------------
  241|     20|    {
  242|     20|        if (pInChIMobH->StereoIsotopic &&
  ------------------
  |  Branch (242:13): [True: 0, False: 20]
  ------------------
  243|     20|            ( pInChIMobH->StereoIsotopic->nNumberOfStereoBonds +
  ------------------
  |  Branch (243:13): [True: 0, False: 0]
  ------------------
  244|      0|                pInChIMobH->StereoIsotopic->nNumberOfStereoCenters ))
  245|      0|        {
  246|      0|            pStereo2 = pInChIMobH->StereoIsotopic;
  247|      0|        }
  248|     20|        else
  249|     20|        {
  250|     20|            if (pInChIMobH->Stereo &&
  ------------------
  |  Branch (250:17): [True: 0, False: 20]
  ------------------
  251|     20|                ( pInChIMobH->Stereo->nNumberOfStereoBonds +
  ------------------
  |  Branch (251:17): [True: 0, False: 0]
  ------------------
  252|      0|                  pInChIMobH->Stereo->nNumberOfStereoCenters ))
  253|      0|            {
  254|      0|                pStereo2 = pInChIMobH->Stereo;
  255|      0|            }
  256|     20|        }
  257|     20|    }
  258|       |
  259|       |    INCHI_HEAPCHK
  260|       |
  261|  55.4k|    num_stereo_bonds = num_stereo_bonds2 = 0;
  262|  55.4k|    num_stereo_centers = num_stereo_centers2 = 0;
  263|       |    /* -- have already been done in the initialization --
  264|       |       iDeletedH = 0;
  265|       |       nNumDeletedH = 0;
  266|       |    */
  267|  55.4k|    if (pStereo || pStereo2)
  ------------------
  |  Branch (267:9): [True: 0, False: 55.4k]
  |  Branch (267:20): [True: 0, False: 55.4k]
  ------------------
  268|      0|    {
  269|       |        /* count implicit H needed for parities and reallocate at[]; set at[n_vertex].at_type=1 for these atoms */
  270|      0|        int len1 = pStereo ? pStereo->nNumberOfStereoCenters : 0;
  ------------------
  |  Branch (270:20): [True: 0, False: 0]
  ------------------
  271|      0|        int len2 = pStereo2 ? pStereo2->nNumberOfStereoCenters : 0;
  ------------------
  |  Branch (271:20): [True: 0, False: 0]
  ------------------
  272|      0|        int i2, diff, diff2;
  273|      0|        for (i = i2 = 0; i < len1 || i2 < len2; )
  ------------------
  |  Branch (273:26): [True: 0, False: 0]
  |  Branch (273:38): [True: 0, False: 0]
  ------------------
  274|      0|        {
  275|      0|            if (i < len1 && i2 < len2)
  ------------------
  |  Branch (275:17): [True: 0, False: 0]
  |  Branch (275:29): [True: 0, False: 0]
  ------------------
  276|      0|            {
  277|      0|                diff = (int) pStereo->nNumber[i] - (int) pStereo2->nNumber[i2];
  278|      0|                if (diff <= 0)
  ------------------
  |  Branch (278:21): [True: 0, False: 0]
  ------------------
  279|      0|                {
  280|      0|                    n_vertex = pStereo->nNumber[i] - 1;
  281|      0|                    i++;
  282|      0|                    i2 += !diff;
  283|      0|                }
  284|      0|                else
  285|      0|                {
  286|      0|                    n_vertex = pStereo2->nNumber[i2] - 1;
  287|      0|                    num_stereo_centers2++;
  288|      0|                    i2++;
  289|      0|                }
  290|      0|            }
  291|      0|            else if (i < len1)
  ------------------
  |  Branch (291:22): [True: 0, False: 0]
  ------------------
  292|      0|            {
  293|      0|                n_vertex = pStereo->nNumber[i] - 1;
  294|      0|                i++;
  295|      0|            }
  296|      0|            else
  297|      0|            {
  298|      0|                n_vertex = pStereo2->nNumber[i2] - 1;
  299|      0|                num_stereo_centers2++;
  300|      0|                i2++;
  301|      0|            }
  302|       |
  303|       |            /* find whether it is an allene */
  304|      0|            if (at[n_vertex].valence == 2 &&
  ------------------
  |  Branch (304:17): [True: 0, False: 0]
  ------------------
  305|      0|                 at[n_vertex].num_H == 0 &&
  ------------------
  |  Branch (305:18): [True: 0, False: 0]
  ------------------
  306|      0|                 bCanAtomBeMiddleAllene( at[n_vertex].elname, 0, 0 ) &&
  ------------------
  |  Branch (306:18): [True: 0, False: 0]
  ------------------
  307|      0|                 at[jv = at[n_vertex].neighbor[0]].valence + at[jv].num_H == 3 &&
  ------------------
  |  Branch (307:18): [True: 0, False: 0]
  ------------------
  308|      0|                 bCanAtomBeTerminalAllene( at[jv].elname, 0, 0 ) &&
  ------------------
  |  Branch (308:18): [True: 0, False: 0]
  ------------------
  309|      0|                 at[jn = at[n_vertex].neighbor[1]].valence + at[jn].num_H == 3 &&
  ------------------
  |  Branch (309:18): [True: 0, False: 0]
  ------------------
  310|      0|                 bCanAtomBeTerminalAllene( at[jn].elname, 0, 0 ))
  ------------------
  |  Branch (310:18): [True: 0, False: 0]
  ------------------
  311|      0|            {
  312|       |                /* allene */
  313|      0|                if (!at[jv].at_type && at[jv].num_H)
  ------------------
  |  Branch (313:21): [True: 0, False: 0]
  |  Branch (313:40): [True: 0, False: 0]
  ------------------
  314|      0|                {
  315|      0|                    nNumDeletedH += at[jv].num_H;
  316|      0|                    at[jv].at_type++;  /* H should be added as an explicit H */
  317|      0|                }
  318|       |
  319|      0|                if (!at[jn].at_type && at[jn].num_H)
  ------------------
  |  Branch (319:21): [True: 0, False: 0]
  |  Branch (319:40): [True: 0, False: 0]
  ------------------
  320|      0|                {
  321|      0|                    nNumDeletedH += at[jn].num_H;
  322|      0|                    at[jn].at_type++;  /* H should be added as an explicit H */
  323|      0|                }
  324|      0|            }
  325|      0|            else
  326|      0|            {
  327|       |                /* stereogenic atom - sp3 */
  328|      0|                if (!at[n_vertex].at_type && at[n_vertex].num_H)
  ------------------
  |  Branch (328:21): [True: 0, False: 0]
  |  Branch (328:46): [True: 0, False: 0]
  ------------------
  329|      0|                {
  330|      0|                    nNumDeletedH += at[n_vertex].num_H;
  331|      0|                    at[n_vertex].at_type++; /* H should be added as an explicit H */
  332|      0|                }
  333|      0|            }
  334|      0|        }
  335|       |
  336|       |        INCHI_HEAPCHK
  337|       |
  338|      0|        len1 = pStereo ? pStereo->nNumberOfStereoBonds : 0;
  ------------------
  |  Branch (338:16): [True: 0, False: 0]
  ------------------
  339|      0|        len2 = pStereo2 ? pStereo2->nNumberOfStereoBonds : 0;
  ------------------
  |  Branch (339:16): [True: 0, False: 0]
  ------------------
  340|      0|        for (i = i2 = 0; i < len1 || i2 < len2; )
  ------------------
  |  Branch (340:26): [True: 0, False: 0]
  |  Branch (340:38): [True: 0, False: 0]
  ------------------
  341|      0|        {
  342|      0|            if (i < len1 && i2 < len2)
  ------------------
  |  Branch (342:17): [True: 0, False: 0]
  |  Branch (342:29): [True: 0, False: 0]
  ------------------
  343|      0|            {
  344|      0|                diff = (int) pStereo->nBondAtom1[i] - (int) pStereo2->nBondAtom1[i2];
  345|      0|                diff2 = (int) pStereo->nBondAtom2[i] - (int) pStereo2->nBondAtom2[i2];
  346|      0|                if (diff < 0 || diff == 0 && diff2 <= 0)
  ------------------
  |  Branch (346:21): [True: 0, False: 0]
  |  Branch (346:33): [True: 0, False: 0]
  |  Branch (346:46): [True: 0, False: 0]
  ------------------
  347|      0|                {
  348|      0|                    n_vertex = pStereo->nBondAtom1[i] - 1;
  349|      0|                    n_neigh = pStereo->nBondAtom2[i] - 1;
  350|      0|                    i++;
  351|      0|                    i2 += !diff && !diff2;
  ------------------
  |  Branch (351:27): [True: 0, False: 0]
  |  Branch (351:36): [True: 0, False: 0]
  ------------------
  352|      0|                }
  353|      0|                else
  354|      0|                {
  355|      0|                    n_vertex = pStereo2->nBondAtom1[i2] - 1;
  356|      0|                    n_neigh = pStereo2->nBondAtom2[i2] - 1;
  357|      0|                    num_stereo_bonds2++;
  358|      0|                    i2++;
  359|      0|                }
  360|      0|            }
  361|      0|            else if (i < len1)
  ------------------
  |  Branch (361:22): [True: 0, False: 0]
  ------------------
  362|      0|            {
  363|      0|                n_vertex = pStereo->nBondAtom1[i] - 1;
  364|      0|                n_neigh = pStereo->nBondAtom2[i] - 1;
  365|      0|                i++;
  366|      0|            }
  367|      0|            else
  368|      0|            {
  369|      0|                n_vertex = pStereo2->nBondAtom1[i2] - 1;
  370|      0|                n_neigh = pStereo2->nBondAtom2[i2] - 1;
  371|      0|                num_stereo_bonds2++;
  372|      0|                i2++;
  373|      0|            }
  374|       |
  375|      0|            if (!is_in_the_list( at[n_vertex].neighbor,
  ------------------
  |  Branch (375:17): [True: 0, False: 0]
  ------------------
  376|      0|                (AT_NUMB) n_neigh, at[n_vertex].valence ))
  377|      0|            {
  378|       |                /* must be a cumulene */
  379|      0|                if (!bFindCumuleneChain( at, (AT_NUMB) n_vertex, (AT_NUMB) n_neigh,
  ------------------
  |  Branch (379:21): [True: 0, False: 0]
  ------------------
  380|      0|                    nCumulene, MAX_CUMULENE_LEN + 1 ))
  ------------------
  |  |  235|      0|#define MAX_CUMULENE_LEN   2     /* max number of bonds in a cumulene chain - 1                     */
  ------------------
  381|      0|                {
  382|      0|                    ret = RI_ERR_SYNTAX; /* not a cumulene */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
  383|      0|                    goto exit_function;
  384|      0|                }
  385|      0|            }
  386|       |
  387|      0|            if (!at[n_vertex].at_type && at[n_vertex].num_H)
  ------------------
  |  Branch (387:17): [True: 0, False: 0]
  |  Branch (387:42): [True: 0, False: 0]
  ------------------
  388|      0|            {
  389|      0|                nNumDeletedH += at[n_vertex].num_H;
  390|      0|                at[n_vertex].at_type++;  /* H should be added as an explicit H */
  391|      0|            }
  392|       |
  393|      0|            if (!at[n_neigh].at_type && at[n_neigh].num_H)
  ------------------
  |  Branch (393:17): [True: 0, False: 0]
  |  Branch (393:41): [True: 0, False: 0]
  ------------------
  394|      0|            {
  395|      0|                nNumDeletedH += at[n_neigh].num_H;
  396|      0|                at[n_neigh].at_type++;   /* H should be added as an explicit H */
  397|      0|            }
  398|      0|        }
  399|       |
  400|       |        INCHI_HEAPCHK
  401|       |
  402|      0|        if (nNumDeletedH)
  ------------------
  |  Branch (402:13): [True: 0, False: 0]
  ------------------
  403|      0|        {
  404|       |            /* add explicit H */
  405|      0|#if ( FIX_GAF_2019_2==1 )           
  406|      0|            inp_ATOM *at2 = (inp_ATOM *)inchi_calloc(nNumDeletedH>0 ? num_atoms + nNumDeletedH : num_atoms,
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  |  Branch (406:54): [True: 0, False: 0]
  ------------------
  407|      0|                sizeof(at2[0]));
  408|       |#else
  409|       |            /* add explicit H */
  410|       |            inp_ATOM *at2 = (inp_ATOM *)inchi_calloc(num_atoms + nNumDeletedH, sizeof(at2[0]));
  411|       |#endif
  412|      0|            if (!at2)
  ------------------
  |  Branch (412:17): [True: 0, False: 0]
  ------------------
  413|      0|            {
  414|      0|                ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
  415|      0|                goto exit_function;
  416|      0|            }
  417|      0|            pStruct->num_deleted_H = nNumDeletedH;
  418|      0|            memcpy( at2, at, num_atoms * sizeof( at2[0] ) );
  419|      0|            inchi_free( at );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  420|      0|            pStruct->at = at = at2;
  421|       |            /* fill out deleted H atom info */
  422|      0|            for (i = num_atoms; i < num_atoms + nNumDeletedH; i++)
  ------------------
  |  Branch (422:33): [True: 0, False: 0]
  ------------------
  423|      0|            {
  424|      0|                strcpy( at[i].elname, "H" );
  425|      0|                at[i].el_number = EL_NUMBER_H;
  ------------------
  |  |   41|      0|#define EL_NUMBER_H ((U_CHAR) 1)
  ------------------
  426|      0|                at[i].orig_at_number = iAtNoOffset + i + 1;
  427|      0|                at[i].orig_compt_at_numb = i + 1;
  428|      0|                at[i].component = iComponent + 1;
  429|      0|            }
  430|       |
  431|       |            /* connect deleted H */
  432|      0|            for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (432:25): [True: 0, False: 0]
  ------------------
  433|      0|            {
  434|      0|                if (at[i].at_type == 1)
  ------------------
  |  Branch (434:21): [True: 0, False: 0]
  ------------------
  435|      0|                {
  436|      0|                    if (0 > ( ret = AddExplicitDeletedH( at, i, num_atoms,
  ------------------
  |  Branch (436:25): [True: 0, False: 0]
  ------------------
  437|      0|                        &iDeletedH, &idelH1,
  438|      0|                        nNumDeletedH, pStereo2 != NULL ) ))
  439|      0|                    {
  440|      0|                        goto exit_function;
  441|      0|                    }
  442|      0|                }
  443|      0|            }
  444|      0|        }
  445|       |
  446|      0|        INCHI_HEAPCHK
  447|      0|    }
  448|       |
  449|  55.4k|    if (pStereo)
  ------------------
  |  Branch (449:9): [True: 0, False: 55.4k]
  ------------------
  450|      0|    {
  451|       |        /* mark stereo centers, they have already been connected the added explicit H, if any */
  452|      0|        int bInvertedParity = ( pStereo->nCompInv2Abs == -1 );
  453|      0|        for (i = 0; i < pStereo->nNumberOfStereoCenters; i++)
  ------------------
  |  Branch (453:21): [True: 0, False: 0]
  ------------------
  454|      0|        {
  455|      0|            n_vertex = pStereo->nNumber[i] - 1;
  456|      0|            parity = pStereo->t_parity[i];
  457|      0|            if (bInvertedParity)
  ------------------
  |  Branch (457:17): [True: 0, False: 0]
  ------------------
  458|      0|            {
  459|      0|                parity = ( parity == AB_PARITY_EVEN ) ? AB_PARITY_ODD : ( parity == AB_PARITY_ODD ) ? AB_PARITY_EVEN : parity;
  ------------------
  |  |  248|      0|#define AB_PARITY_EVEN   2  /* 2 => even parity */
  ------------------
                              parity = ( parity == AB_PARITY_EVEN ) ? AB_PARITY_ODD : ( parity == AB_PARITY_ODD ) ? AB_PARITY_EVEN : parity;
  ------------------
  |  |  247|      0|#define AB_PARITY_ODD    1  /* 1 => odd parity */
  ------------------
                              parity = ( parity == AB_PARITY_EVEN ) ? AB_PARITY_ODD : ( parity == AB_PARITY_ODD ) ? AB_PARITY_EVEN : parity;
  ------------------
  |  |  247|      0|#define AB_PARITY_ODD    1  /* 1 => odd parity */
  ------------------
                              parity = ( parity == AB_PARITY_EVEN ) ? AB_PARITY_ODD : ( parity == AB_PARITY_ODD ) ? AB_PARITY_EVEN : parity;
  ------------------
  |  |  248|      0|#define AB_PARITY_EVEN   2  /* 2 => even parity */
  ------------------
  |  Branch (459:26): [True: 0, False: 0]
  |  Branch (459:73): [True: 0, False: 0]
  ------------------
  460|      0|            }
  461|       |            /* find whether it is allene */
  462|      0|            if (at[n_vertex].valence == 2 &&
  ------------------
  |  Branch (462:17): [True: 0, False: 0]
  ------------------
  463|      0|                 at[n_vertex].num_H == 0 &&
  ------------------
  |  Branch (463:18): [True: 0, False: 0]
  ------------------
  464|      0|                 bCanAtomBeMiddleAllene( at[n_vertex].elname, 0, 0 ) &&
  ------------------
  |  Branch (464:18): [True: 0, False: 0]
  ------------------
  465|       |                 /* allene has exactly 2 double bonds */
  466|      0|                 ( jv = at[n_vertex].neighbor[0], at[jv].valence + at[jv].num_H == 3 ) &&
  ------------------
  |  Branch (466:18): [True: 0, False: 0]
  ------------------
  467|      0|                 bCanAtomBeTerminalAllene( at[jv].elname, 0, 0 ) &&
  ------------------
  |  Branch (467:18): [True: 0, False: 0]
  ------------------
  468|      0|                 ( jn = at[n_vertex].neighbor[1], at[jn].valence + at[jn].num_H == 3 ) &&
  ------------------
  |  Branch (468:18): [True: 0, False: 0]
  ------------------
  469|      0|                 bCanAtomBeTerminalAllene( at[jn].elname, 0, 0 ))
  ------------------
  |  Branch (469:18): [True: 0, False: 0]
  ------------------
  470|      0|            {
  471|       |                /* allene: add explicit H if implicit H are present */
  472|       |                /* iDeletedH = current number of already added explicit H */
  473|       |                /* idelH1    = index in at[] of the explicit H added to atom jv */
  474|      0|                if (at[jv].num_H)
  ------------------
  |  Branch (474:21): [True: 0, False: 0]
  ------------------
  475|      0|                {
  476|      0|                    if (0 > ( ret = AddExplicitDeletedH( at, jv, num_atoms, &iDeletedH,
  ------------------
  |  Branch (476:25): [True: 0, False: 0]
  ------------------
  477|      0|                        &idelH1, nNumDeletedH,
  478|      0|                        pStereo2 != NULL ) ))
  479|      0|                    {
  480|      0|                        goto exit_function;
  481|      0|                    }
  482|      0|                }
  483|      0|                else
  484|      0|                {
  485|       |                    /* index of the stereo atom neighbor */
  486|      0|                    idelH1 = at[jv].neighbor[at[jv].neighbor[0] == n_vertex];
  487|      0|                }
  488|       |
  489|      0|                if (at[jn].num_H)
  ------------------
  |  Branch (489:21): [True: 0, False: 0]
  ------------------
  490|      0|                {
  491|       |                    /* iDeletedH = current number of already added explicit H */
  492|       |                    /* idelH2    = index of the explicit H added to atom jn */
  493|      0|                    if (0 > ( ret = AddExplicitDeletedH( at, jn, num_atoms, &iDeletedH, &idelH2, nNumDeletedH, pStereo2 != NULL ) ))
  ------------------
  |  Branch (493:25): [True: 0, False: 0]
  ------------------
  494|      0|                    {
  495|      0|                        goto exit_function;
  496|      0|                    }
  497|      0|                }
  498|      0|                else
  499|      0|                {
  500|      0|                    idelH2 = at[jn].neighbor[at[jn].neighbor[0] == n_vertex];
  501|      0|                }
  502|       |                /* allene: set bond types to double */
  503|       |                /*
  504|       |                if ( 0 > (ret = set_bond_type( at, (AT_NUMB)n_vertex, (AT_NUMB)jv, BOND_TYPE_DOUBLE ) ) ||
  505|       |                     0 > (ret = set_bond_type( at, (AT_NUMB)n_vertex, (AT_NUMB)jn, BOND_TYPE_DOUBLE ) ) ) {
  506|       |                    goto exit_function;
  507|       |                }
  508|       |                */
  509|       |                /* allene: make 0D parity */
  510|      0|                ret = set_cumulene_0D_parity( at, st, num_atoms, idelH1, jv, jn, idelH2, parity, 2 );
  511|      0|                if (ret < 0)
  ------------------
  |  Branch (511:21): [True: 0, False: 0]
  ------------------
  512|      0|                {
  513|      0|                    goto exit_function;
  514|      0|                }
  515|      0|            }
  516|      0|            else
  517|      0|            {
  518|       |                /* stereogenic sp3 atom */
  519|      0|                if (at[n_vertex].num_H)
  ------------------
  |  Branch (519:21): [True: 0, False: 0]
  ------------------
  520|      0|                {
  521|      0|                    if (0 > ( ret = AddExplicitDeletedH( at, n_vertex, num_atoms,
  ------------------
  |  Branch (521:25): [True: 0, False: 0]
  ------------------
  522|      0|                        &iDeletedH, &idelH1, nNumDeletedH,
  523|      0|                        pStereo2 != NULL ) ))
  524|      0|                    {
  525|      0|                        goto exit_function;
  526|      0|                    }
  527|      0|                }
  528|       |
  529|      0|                ret = set_atom_0D_parity( at, st, num_atoms, nNumDeletedH, n_vertex, parity );
  530|       |
  531|      0|                if (ret < 0)
  ------------------
  |  Branch (531:21): [True: 0, False: 0]
  ------------------
  532|      0|                {
  533|      0|                    goto exit_function;
  534|      0|                }
  535|      0|                num_stereo_centers++;
  536|      0|            }
  537|       |
  538|      0|            if (ret < 0)
  ------------------
  |  Branch (538:17): [True: 0, False: 0]
  ------------------
  539|      0|            {
  540|      0|                goto exit_function;
  541|      0|            }
  542|      0|        }
  543|       |
  544|       |        INCHI_HEAPCHK
  545|       |
  546|       |        /* mark stereobonds */
  547|      0|        for (i = 0; i < pStereo->nNumberOfStereoBonds; i++)
  ------------------
  |  Branch (547:21): [True: 0, False: 0]
  ------------------
  548|      0|        {
  549|      0|            jv = pStereo->nBondAtom1[i] - 1;
  550|      0|            jn = pStereo->nBondAtom2[i] - 1;
  551|      0|            parity = pStereo->b_parity[i];
  552|      0|            if (!is_in_the_list( at[jv].neighbor, (AT_NUMB) jn, at[jv].valence ))
  ------------------
  |  Branch (552:17): [True: 0, False: 0]
  ------------------
  553|      0|            {
  554|       |                /* must be a cumulene */
  555|      0|                if (!bFindCumuleneChain( at, (AT_NUMB) jv, (AT_NUMB) jn, nCumulene, MAX_CUMULENE_LEN + 1 ))
  ------------------
  |  |  235|      0|#define MAX_CUMULENE_LEN   2     /* max number of bonds in a cumulene chain - 1                     */
  ------------------
  |  Branch (555:21): [True: 0, False: 0]
  ------------------
  556|      0|                {
  557|      0|                    return RI_ERR_SYNTAX; /* not a cumulene */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
  558|      0|                }
  559|      0|                len = MAX_CUMULENE_LEN + 1;
  ------------------
  |  |  235|      0|#define MAX_CUMULENE_LEN   2     /* max number of bonds in a cumulene chain - 1                     */
  ------------------
  560|      0|            }
  561|      0|            else
  562|      0|            {
  563|       |                /* a regular double or alt bond */
  564|      0|                nCumulene[0] = jv;
  565|      0|                nCumulene[1] = jn;
  566|      0|                len = 1; /* cumulene length is number of bonds, not number of atoms */
  567|      0|            }
  568|       |
  569|       |            /* cumulene or double bond: add explicit H if implicit H are present */
  570|      0|            if (at[jv].num_H)
  ------------------
  |  Branch (570:17): [True: 0, False: 0]
  ------------------
  571|      0|            {
  572|      0|                if (0 > ( ret = AddExplicitDeletedH( at, jv, num_atoms, &iDeletedH, &idelH1, nNumDeletedH, pStereo2 != NULL ) ))
  ------------------
  |  Branch (572:21): [True: 0, False: 0]
  ------------------
  573|      0|                {
  574|      0|                    goto exit_function;
  575|      0|                }
  576|      0|            }
  577|      0|            else
  578|      0|            {
  579|       |                /* double bond neighbor that has the smallest canonical number; it is either 0th or 1st */
  580|      0|                idelH1 = at[jv].neighbor[at[jv].neighbor[0] == nCumulene[1]];
  581|      0|            }
  582|      0|            if (at[jn].num_H)
  ------------------
  |  Branch (582:17): [True: 0, False: 0]
  ------------------
  583|      0|            {
  584|      0|                if (0 > ( ret = AddExplicitDeletedH( at, jn, num_atoms, &iDeletedH, &idelH2, nNumDeletedH, pStereo2 != NULL ) ))
  ------------------
  |  Branch (584:21): [True: 0, False: 0]
  ------------------
  585|      0|                {
  586|      0|                    goto exit_function;
  587|      0|                }
  588|      0|            }
  589|      0|            else
  590|      0|            {
  591|      0|                idelH2 = at[jn].neighbor[at[jn].neighbor[0] == nCumulene[len - 1]];
  592|      0|            }
  593|      0|            if (0 > ( ret = set_cumulene_0D_parity( at, st, num_atoms, idelH1, jv, jn, idelH2, parity, len ) ))
  ------------------
  |  Branch (593:17): [True: 0, False: 0]
  ------------------
  594|      0|            {
  595|      0|                goto exit_function;
  596|      0|            }
  597|      0|        }
  598|       |
  599|      0|        INCHI_HEAPCHK
  600|      0|    }
  601|       |
  602|       |    /* allocate memory for Mobile-H-only stereo */
  603|  55.4k|    if (num_stereo_centers2 + num_stereo_bonds2)
  ------------------
  |  Branch (603:9): [True: 0, False: 55.4k]
  ------------------
  604|      0|    {
  605|      0|        if (!( st = (inp_ATOM_STEREO *) inchi_calloc( num_atoms, sizeof( st[0] ) ) ))
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  |  Branch (605:13): [True: 0, False: 0]
  ------------------
  606|      0|        {
  607|      0|            ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
  608|      0|            goto exit_function;
  609|      0|        }
  610|      0|        CopyAt2St( at, st, num_atoms );
  611|      0|    }
  612|       |
  613|  55.4k|    pStruct->st = st;
  614|  55.4k|    if (num_stereo_centers2)
  ------------------
  |  Branch (614:9): [True: 0, False: 55.4k]
  ------------------
  615|      0|    {
  616|       |        /* In case of Fixed-H */
  617|       |        /* mark additional Mobile-H stereo centers, they have already been connected the added explicit H, if any */
  618|      0|        int bInvertedParity = ( pStereo2->nCompInv2Abs == -1 );
  619|      0|        for (i = 0; i < pStereo2->nNumberOfStereoCenters; i++)
  ------------------
  |  Branch (619:21): [True: 0, False: 0]
  ------------------
  620|      0|        {
  621|      0|            n_vertex = pStereo2->nNumber[i] - 1;
  622|      0|            parity = pStereo2->t_parity[i];
  623|      0|            if (at[n_vertex].p_parity)
  ------------------
  |  Branch (623:17): [True: 0, False: 0]
  ------------------
  624|      0|            {
  625|      0|                continue; /* the parity has already been set for Fixed-H */
  626|      0|            }
  627|      0|            if (bInvertedParity)
  ------------------
  |  Branch (627:17): [True: 0, False: 0]
  ------------------
  628|      0|            {
  629|      0|                parity = ( parity == AB_PARITY_EVEN ) ? AB_PARITY_ODD : ( parity == AB_PARITY_ODD ) ? AB_PARITY_EVEN : parity;
  ------------------
  |  |  248|      0|#define AB_PARITY_EVEN   2  /* 2 => even parity */
  ------------------
                              parity = ( parity == AB_PARITY_EVEN ) ? AB_PARITY_ODD : ( parity == AB_PARITY_ODD ) ? AB_PARITY_EVEN : parity;
  ------------------
  |  |  247|      0|#define AB_PARITY_ODD    1  /* 1 => odd parity */
  ------------------
                              parity = ( parity == AB_PARITY_EVEN ) ? AB_PARITY_ODD : ( parity == AB_PARITY_ODD ) ? AB_PARITY_EVEN : parity;
  ------------------
  |  |  247|      0|#define AB_PARITY_ODD    1  /* 1 => odd parity */
  ------------------
                              parity = ( parity == AB_PARITY_EVEN ) ? AB_PARITY_ODD : ( parity == AB_PARITY_ODD ) ? AB_PARITY_EVEN : parity;
  ------------------
  |  |  248|      0|#define AB_PARITY_EVEN   2  /* 2 => even parity */
  ------------------
  |  Branch (629:26): [True: 0, False: 0]
  |  Branch (629:73): [True: 0, False: 0]
  ------------------
  630|      0|            }
  631|       |            /* find whether it is allene */
  632|      0|            if (at[n_vertex].valence == 2 &&
  ------------------
  |  Branch (632:17): [True: 0, False: 0]
  ------------------
  633|      0|                 at[n_vertex].num_H == 0 &&
  ------------------
  |  Branch (633:18): [True: 0, False: 0]
  ------------------
  634|      0|                 bCanAtomBeMiddleAllene( at[n_vertex].elname, 0, 0 ) &&
  ------------------
  |  Branch (634:18): [True: 0, False: 0]
  ------------------
  635|       |                 /* allene has exactly 2 double bonds */
  636|      0|                 ( jv = at[n_vertex].neighbor[0], at[jv].valence + at[jv].num_H == 3 ) &&
  ------------------
  |  Branch (636:18): [True: 0, False: 0]
  ------------------
  637|      0|                 bCanAtomBeTerminalAllene( at[jv].elname, 0, 0 ) &&
  ------------------
  |  Branch (637:18): [True: 0, False: 0]
  ------------------
  638|      0|                 ( jn = at[n_vertex].neighbor[1], at[jn].valence + at[jn].num_H == 3 ) &&
  ------------------
  |  Branch (638:18): [True: 0, False: 0]
  ------------------
  639|      0|                 bCanAtomBeTerminalAllene( at[jn].elname, 0, 0 ))
  ------------------
  |  Branch (639:18): [True: 0, False: 0]
  ------------------
  640|      0|            {
  641|       |                /* allene: add explicit H if implicit H are present */
  642|       |                /* iDeletedH = current number of already added explicit H */
  643|       |                /* idelH1    = index in at[] of the explicit H added to atom jv */
  644|      0|                if (at[jv].num_H)
  ------------------
  |  Branch (644:21): [True: 0, False: 0]
  ------------------
  645|      0|                {
  646|      0|                    if (0 > ( ret = AddExplicitDeletedH( at, jv, num_atoms, &iDeletedH, &idelH1, nNumDeletedH, pStereo2 != NULL ) ))
  ------------------
  |  Branch (646:25): [True: 0, False: 0]
  ------------------
  647|      0|                    {
  648|      0|                        goto exit_function;
  649|      0|                    }
  650|      0|                }
  651|      0|                else
  652|      0|                {
  653|       |                    /* index of the stereo atom neighbor */
  654|      0|                    idelH1 = at[jv].neighbor[at[jv].neighbor[0] == n_vertex];
  655|      0|                }
  656|      0|                if (at[jn].num_H)
  ------------------
  |  Branch (656:21): [True: 0, False: 0]
  ------------------
  657|      0|                {
  658|       |                    /* iDeletedH = current number of already added explicit H */
  659|       |                    /* idelH2    = index of the explicit H added to atom jn */
  660|      0|                    if (0 > ( ret = AddExplicitDeletedH( at, jn, num_atoms, &iDeletedH, &idelH2, nNumDeletedH, pStereo2 != NULL ) ))
  ------------------
  |  Branch (660:25): [True: 0, False: 0]
  ------------------
  661|      0|                    {
  662|      0|                        goto exit_function;
  663|      0|                    }
  664|      0|                }
  665|      0|                else
  666|      0|                {
  667|      0|                    idelH2 = at[jn].neighbor[at[jn].neighbor[0] == n_vertex];
  668|      0|                }
  669|       |                /* allene: set bond types to double */
  670|       |                /*
  671|       |                if ( 0 > (ret = set_bond_type( at, (AT_NUMB)n_vertex, (AT_NUMB)jv, BOND_TYPE_DOUBLE ) ) ||
  672|       |                     0 > (ret = set_bond_type( at, (AT_NUMB)n_vertex, (AT_NUMB)jn, BOND_TYPE_DOUBLE ) ) ) {
  673|       |                    goto exit_function;
  674|       |                }
  675|       |                */
  676|       |                /* allene: make 0D parity */
  677|      0|                ret = set_cumulene_0D_parity( at, st, num_atoms, idelH1, jv, jn, idelH2, parity, 2 );
  678|      0|                if (ret < 0)
  ------------------
  |  Branch (678:21): [True: 0, False: 0]
  ------------------
  679|      0|                {
  680|      0|                    goto exit_function;
  681|      0|                }
  682|      0|            }
  683|      0|            else
  684|      0|            {
  685|       |                /* stereogenic sp3 atom */
  686|      0|                if (at[n_vertex].num_H)
  ------------------
  |  Branch (686:21): [True: 0, False: 0]
  ------------------
  687|      0|                {
  688|      0|                    if (0 > ( ret = AddExplicitDeletedH( at, n_vertex, num_atoms, &iDeletedH, &idelH1, nNumDeletedH, pStereo2 != NULL ) ))
  ------------------
  |  Branch (688:25): [True: 0, False: 0]
  ------------------
  689|      0|                    {
  690|      0|                        goto exit_function;
  691|      0|                    }
  692|      0|                }
  693|      0|                ret = set_atom_0D_parity( at, st, num_atoms, nNumDeletedH, n_vertex, parity );
  694|      0|                if (ret < 0)
  ------------------
  |  Branch (694:21): [True: 0, False: 0]
  ------------------
  695|      0|                {
  696|      0|                    goto exit_function;
  697|      0|                }
  698|      0|                num_stereo_centers++;
  699|      0|            }
  700|      0|            if (ret < 0)
  ------------------
  |  Branch (700:17): [True: 0, False: 0]
  ------------------
  701|      0|            {
  702|      0|                goto exit_function;
  703|      0|            }
  704|      0|        }
  705|      0|    }
  706|       |
  707|  55.4k|    if (num_stereo_bonds2)
  ------------------
  |  Branch (707:9): [True: 0, False: 55.4k]
  ------------------
  708|      0|    {
  709|       |        /* In case of Fixed-H */
  710|       |        /* mark additional Mobile-H stereobonds, they have already been connected the added explicit H, if any */
  711|      0|        for (i = 0; i < pStereo2->nNumberOfStereoBonds; i++)
  ------------------
  |  Branch (711:21): [True: 0, False: 0]
  ------------------
  712|      0|        {
  713|      0|            jv = pStereo2->nBondAtom1[i] - 1;
  714|      0|            jn = pStereo2->nBondAtom2[i] - 1;
  715|      0|            parity = pStereo2->b_parity[i];
  716|      0|            if (!is_in_the_list( at[jv].neighbor, (AT_NUMB) jn, at[jv].valence ))
  ------------------
  |  Branch (716:17): [True: 0, False: 0]
  ------------------
  717|      0|            {
  718|       |                /* must be a cumulene */
  719|      0|                if (!bFindCumuleneChain( at, (AT_NUMB) jv, (AT_NUMB) jn, nCumulene, MAX_CUMULENE_LEN + 1 ))
  ------------------
  |  |  235|      0|#define MAX_CUMULENE_LEN   2     /* max number of bonds in a cumulene chain - 1                     */
  ------------------
  |  Branch (719:21): [True: 0, False: 0]
  ------------------
  720|      0|                {
  721|      0|                    return RI_ERR_SYNTAX; /* not a cumulene */
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
  722|      0|                }
  723|      0|                len = MAX_CUMULENE_LEN + 1;
  ------------------
  |  |  235|      0|#define MAX_CUMULENE_LEN   2     /* max number of bonds in a cumulene chain - 1                     */
  ------------------
  724|      0|            }
  725|      0|            else
  726|      0|            {
  727|       |                /* a regular double or alt bond */
  728|      0|                nCumulene[0] = jv;
  729|      0|                nCumulene[1] = jn;
  730|      0|                len = 1; /* cumulene length is number of bonds, not number of atoms */
  731|      0|            }
  732|       |            /* cumulene or double bond: add explicit H if implicit H are present */
  733|      0|            if (at[jv].num_H)
  ------------------
  |  Branch (733:17): [True: 0, False: 0]
  ------------------
  734|      0|            {
  735|      0|                if (0 > ( ret = AddExplicitDeletedH( at, jv, num_atoms, &iDeletedH, &idelH1, nNumDeletedH, pStereo2 != NULL ) ))
  ------------------
  |  Branch (735:21): [True: 0, False: 0]
  ------------------
  736|      0|                {
  737|      0|                    goto exit_function;
  738|      0|                }
  739|      0|            }
  740|      0|            else
  741|      0|            {
  742|       |                /* double bond neighbor that has the smallest canonical number */
  743|      0|                idelH1 = at[jv].neighbor[at[jv].neighbor[0] == nCumulene[1]];
  744|      0|            }
  745|      0|            if (at[jn].num_H)
  ------------------
  |  Branch (745:17): [True: 0, False: 0]
  ------------------
  746|      0|            {
  747|      0|                if (0 > ( ret = AddExplicitDeletedH( at, jn, num_atoms, &iDeletedH, &idelH2, nNumDeletedH, pStereo2 != NULL ) ))
  ------------------
  |  Branch (747:21): [True: 0, False: 0]
  ------------------
  748|      0|                {
  749|      0|                    goto exit_function;
  750|      0|                }
  751|      0|            }
  752|      0|            else
  753|      0|            {
  754|      0|                idelH2 = at[jn].neighbor[at[jn].neighbor[0] == nCumulene[len - 1]];
  755|      0|            }
  756|      0|            if (0 > ( ret = set_cumulene_0D_parity( at, st, num_atoms, idelH1, jv, jn, idelH2, parity, len ) ))
  ------------------
  |  Branch (756:17): [True: 0, False: 0]
  ------------------
  757|      0|            {
  758|      0|                goto exit_function;
  759|      0|            }
  760|      0|        }
  761|      0|    }
  762|       |
  763|  55.4k|    ret = num_atoms;
  764|       |
  765|  55.4k|exit_function:
  766|       |
  767|  55.4k|    return ret;
  768|  55.4k|}
SetStereoBondTypesFrom0DStereo:
  827|  55.4k|{
  828|  55.4k|    INChI_Stereo *pStereo;
  829|  55.4k|    inp_ATOM     *at = pStruct->at;
  830|  55.4k|    int           num_atoms = pStruct->num_atoms;
  831|  55.4k|    int           i, j, num_stereo_bonds, ret;
  832|       |
  833|  55.4k|    if (pInChI->StereoIsotopic &&
  ------------------
  |  Branch (833:9): [True: 16, False: 55.4k]
  ------------------
  834|  55.4k|        ( pInChI->StereoIsotopic->nNumberOfStereoBonds +
  ------------------
  |  Branch (834:9): [True: 0, False: 16]
  ------------------
  835|     16|            pInChI->StereoIsotopic->nNumberOfStereoCenters ))
  836|      0|    {
  837|      0|        pStereo = pInChI->StereoIsotopic;
  838|      0|    }
  839|  55.4k|    else
  840|  55.4k|        if (pInChI->Stereo &&
  ------------------
  |  Branch (840:13): [True: 257, False: 55.1k]
  ------------------
  841|  55.4k|            ( pInChI->Stereo->nNumberOfStereoBonds +
  ------------------
  |  Branch (841:13): [True: 0, False: 257]
  ------------------
  842|    257|                pInChI->Stereo->nNumberOfStereoCenters ))
  843|      0|        {
  844|      0|            pStereo = pInChI->Stereo;
  845|      0|        }
  846|  55.4k|        else
  847|  55.4k|        {
  848|  55.4k|            pStereo = NULL;
  849|  55.4k|        }
  850|       |
  851|       |    /************************ set bond types separately from stereo *******************/
  852|  55.4k|    if (pStereo)
  ------------------
  |  Branch (852:9): [True: 0, False: 55.4k]
  ------------------
  853|      0|    {
  854|      0|        num_stereo_bonds = 0;
  855|      0|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (855:21): [True: 0, False: 0]
  ------------------
  856|      0|        {
  857|       |            /* set BOND_TYPE_DOUBLE in allenes and cumulenes */
  858|       |            /* set BOND_TYPE_STEREO in double bond stereo */
  859|      0|            for (j = 0; j < MAX_NUM_STEREO_BONDS && at[i].sb_parity[j]; j++)
  ------------------
  |  |  876|      0|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (859:25): [True: 0, False: 0]
  |  Branch (859:53): [True: 0, False: 0]
  ------------------
  860|      0|            {
  861|      0|                num_stereo_bonds++;
  862|      0|                if (0 > ( ret = SetStereoBondTypeFor0DParity( at, i, j ) ))
  ------------------
  |  Branch (862:21): [True: 0, False: 0]
  ------------------
  863|      0|                {
  864|      0|                    goto exit_function;
  865|      0|                }
  866|      0|            }
  867|      0|        }
  868|      0|        if (num_stereo_bonds)
  ------------------
  |  Branch (868:13): [True: 0, False: 0]
  ------------------
  869|      0|        {
  870|      0|            int num_bond_type_stereo;
  871|      0|            int num_bond_type_altern;
  872|      0|            AT_NUMB neigh;
  873|       |            /* replace adjacent BOND_TYPE_STEREO with BOND_TYPE_ALTERN */
  874|      0|            for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (874:25): [True: 0, False: 0]
  ------------------
  875|      0|            {
  876|      0|                num_bond_type_stereo = 0;
  877|      0|                num_bond_type_altern = 0;
  878|      0|                for (j = 0; j < at[i].valence; j++)
  ------------------
  |  Branch (878:29): [True: 0, False: 0]
  ------------------
  879|      0|                {
  880|      0|                    num_bond_type_stereo += ( at[i].bond_type[j] == BOND_TYPE_STEREO );
  ------------------
  |  |  281|      0|#define BOND_TYPE_STEREO (BOND_TYPE_SINGLE | BOND_MARK_STEREO)
  |  |  ------------------
  |  |  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  |  |               #define BOND_TYPE_STEREO (BOND_TYPE_SINGLE | BOND_MARK_STEREO)
  |  |  ------------------
  |  |  |  |  280|      0|#define BOND_MARK_STEREO 0x10
  |  |  ------------------
  ------------------
  881|      0|                    num_bond_type_altern += ( at[i].bond_type[j] == BOND_TYPE_ALTERN );
  ------------------
  |  |   63|      0|#define BOND_TYPE_ALTERN    4
  ------------------
  882|      0|                }
  883|      0|                if (num_bond_type_stereo + num_bond_type_altern > 1 && num_bond_type_stereo)
  ------------------
  |  Branch (883:21): [True: 0, False: 0]
  |  Branch (883:72): [True: 0, False: 0]
  ------------------
  884|      0|                {
  885|      0|                    for (j = 0; j < at[i].valence; j++)
  ------------------
  |  Branch (885:33): [True: 0, False: 0]
  ------------------
  886|      0|                    {
  887|      0|                        if (at[i].bond_type[j] == BOND_TYPE_STEREO)
  ------------------
  |  |  281|      0|#define BOND_TYPE_STEREO (BOND_TYPE_SINGLE | BOND_MARK_STEREO)
  |  |  ------------------
  |  |  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  |  |               #define BOND_TYPE_STEREO (BOND_TYPE_SINGLE | BOND_MARK_STEREO)
  |  |  ------------------
  |  |  |  |  280|      0|#define BOND_MARK_STEREO 0x10
  |  |  ------------------
  ------------------
  |  Branch (887:29): [True: 0, False: 0]
  ------------------
  888|      0|                        {
  889|      0|                            neigh = at[i].neighbor[j];
  890|       |                            /* does not change at[i].chem_bond_valence in case of BOND_TYPE_ALTERN */
  891|      0|                            if (0 > ( ret = set_bond_type( at, (AT_NUMB) i, neigh, BOND_TYPE_ALTERN ) ))
  ------------------
  |  |   63|      0|#define BOND_TYPE_ALTERN    4
  ------------------
  |  Branch (891:33): [True: 0, False: 0]
  ------------------
  892|      0|                            {
  893|      0|                                goto exit_function;
  894|      0|                            }
  895|      0|                        }
  896|      0|                    }
  897|      0|                }
  898|       |                /* at this point only isolated stereo bonds have type BOND_TYPE_STEREO */
  899|      0|            }
  900|       |            /* increment at[i].chem_bonds_valence if at[i] has an altern. bond */
  901|       |            /* replace BOND_TYPE_STEREO with BOND_TYPE_DOUBLE and increment   */
  902|       |            /* chem_bonds_valence of the adjacent atoms */
  903|      0|            for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (903:25): [True: 0, False: 0]
  ------------------
  904|      0|            {
  905|      0|                num_bond_type_stereo = 0;
  906|      0|                num_bond_type_altern = 0;
  907|      0|                for (j = 0; j < at[i].valence; j++)
  ------------------
  |  Branch (907:29): [True: 0, False: 0]
  ------------------
  908|      0|                {
  909|      0|                    num_bond_type_stereo += ( at[i].bond_type[j] == BOND_TYPE_STEREO );
  ------------------
  |  |  281|      0|#define BOND_TYPE_STEREO (BOND_TYPE_SINGLE | BOND_MARK_STEREO)
  |  |  ------------------
  |  |  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  |  |               #define BOND_TYPE_STEREO (BOND_TYPE_SINGLE | BOND_MARK_STEREO)
  |  |  ------------------
  |  |  |  |  280|      0|#define BOND_MARK_STEREO 0x10
  |  |  ------------------
  ------------------
  910|      0|                    num_bond_type_altern += ( at[i].bond_type[j] == BOND_TYPE_ALTERN );
  ------------------
  |  |   63|      0|#define BOND_TYPE_ALTERN    4
  ------------------
  911|      0|                }
  912|      0|                if (!num_bond_type_stereo && num_bond_type_altern)
  ------------------
  |  Branch (912:21): [True: 0, False: 0]
  |  Branch (912:46): [True: 0, False: 0]
  ------------------
  913|      0|                {
  914|       |                    /* an atom has only BOND_TYPE_ALTERN => adjacent BOND_TYPE_ALTERN case */
  915|      0|                    at[i].chem_bonds_valence += 1;
  916|      0|                }
  917|      0|                else
  918|      0|                {
  919|      0|                    if (num_bond_type_stereo == 1)
  ------------------
  |  Branch (919:25): [True: 0, False: 0]
  ------------------
  920|      0|                    {
  921|       |                        /* isolated BOND_TYPE_STEREO => replace with BOND_TYPE_DOUBLE */
  922|      0|                        for (j = 0; j < at[i].valence; j++)
  ------------------
  |  Branch (922:37): [True: 0, False: 0]
  ------------------
  923|      0|                        {
  924|      0|                            if (at[i].bond_type[j] == BOND_TYPE_STEREO)
  ------------------
  |  |  281|      0|#define BOND_TYPE_STEREO (BOND_TYPE_SINGLE | BOND_MARK_STEREO)
  |  |  ------------------
  |  |  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  |  |               #define BOND_TYPE_STEREO (BOND_TYPE_SINGLE | BOND_MARK_STEREO)
  |  |  ------------------
  |  |  |  |  280|      0|#define BOND_MARK_STEREO 0x10
  |  |  ------------------
  ------------------
  |  Branch (924:33): [True: 0, False: 0]
  ------------------
  925|      0|                            {
  926|      0|                                neigh = at[i].neighbor[j];
  927|       |                                /* replacing BOND_TYPE_STEREO with BOND_TYPE_DOUBLE */
  928|       |                                /* does not change at->chem_bonds_valence */
  929|      0|                                if (0 > ( ret = set_bond_type( at, (AT_NUMB) i, neigh, BOND_TYPE_DOUBLE ) ))
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (929:37): [True: 0, False: 0]
  ------------------
  930|      0|                                {
  931|      0|                                    goto exit_function;
  932|      0|                                }
  933|      0|                                at[i].chem_bonds_valence++;
  934|      0|                                at[(int) neigh].chem_bonds_valence++;
  935|      0|                            }
  936|      0|                        }
  937|      0|                    }
  938|      0|                    else
  939|      0|                    {
  940|      0|                        if (num_bond_type_stereo + num_bond_type_altern)
  ------------------
  |  Branch (940:29): [True: 0, False: 0]
  ------------------
  941|      0|                        {
  942|       |                            /* an atom still has both BOND_TYPE_STEREO and BOND_TYPE_ALTERN */
  943|      0|                            ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  944|      0|                            goto exit_function;
  945|      0|                        }
  946|      0|                    }
  947|      0|                }
  948|      0|            }
  949|      0|            INCHI_HEAPCHK
  950|      0|        }
  951|      0|    }
  952|  55.4k|    ret = 0; /* success */
  953|       |
  954|  55.4k|exit_function:
  955|       |
  956|  55.4k|    return ret;
  957|  55.4k|}
CopyBnsToAtom:
  966|  11.8k|{
  967|  11.8k|    int i, j, atom_charge, left_charge, charge, ret = 0, v1, nMinorder;
  968|  11.8k|    int          num_at = pStruct->num_atoms;
  969|  11.8k|    inp_ATOM *at = pStruct->at;
  970|  11.8k|    ICHICONST SRM *pSrm = pStruct->pSrm;
  ------------------
  |  |   41|  11.8k|#define ICHICONST      const
  ------------------
  971|  11.8k|    BNS_VERTEX  *pv;
  972|  11.8k|    BNS_EDGE    *pe;
  973|  11.8k|    int          chem_bonds_valence, bond_order;
  974|       |
  975|  11.8k|    atom_charge = left_charge = 0;
  976|  66.0k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (976:17): [True: 54.1k, False: 11.8k]
  ------------------
  977|  54.1k|    {
  978|  54.1k|        pv = pBNS->vert + i;
  979|       |        /* bonds */
  980|  54.1k|        chem_bonds_valence = 0;
  981|  54.5k|        for (j = 0; j < at[i].valence; j++)
  ------------------
  |  Branch (981:21): [True: 376, False: 54.1k]
  ------------------
  982|    376|        {
  983|    376|            pe = pBNS->edge + pv->iedge[j];
  984|    376|            BondFlowMaxcapMinorder( at, pVA, pSrm, i, j, NULL, &nMinorder, NULL );
  985|    376|            bond_order = pe->flow + nMinorder;
  986|    376|            if (!bAllowZeroBondOrder && !bond_order)
  ------------------
  |  Branch (986:17): [True: 0, False: 376]
  |  Branch (986:41): [True: 0, False: 0]
  ------------------
  987|      0|            {
  988|      0|                bond_order = 1;
  989|      0|            }
  990|    376|            chem_bonds_valence += bond_order;
  991|    376|            at[i].bond_type[j] = bond_order;  /* BOND_MARK_HIGHLIGHT */
  992|    376|        }
  993|  54.1k|        at[i].chem_bonds_valence = chem_bonds_valence;
  994|       |        /* charges (both may be present resulting in zero) */
  995|  54.1k|        at[i].charge = pVA[i].cInitCharge;
  996|  54.1k|        if (pVA[i].nCMinusGroupEdge)
  ------------------
  |  Branch (996:13): [True: 172, False: 54.0k]
  ------------------
  997|    172|        {
  998|    172|            pe = pBNS->edge + pVA[i].nCMinusGroupEdge - 1;
  999|    172|            if (charge = pe->flow)
  ------------------
  |  Branch (999:17): [True: 172, False: 0]
  ------------------
 1000|    172|            {
 1001|    172|                at[i].charge -= charge;
 1002|    172|                atom_charge -= charge;
 1003|    172|            }
 1004|    172|        }
 1005|  54.1k|        if (pVA[i].nCPlusGroupEdge)
  ------------------
  |  Branch (1005:13): [True: 219, False: 53.9k]
  ------------------
 1006|    219|        {
 1007|    219|            pe = pBNS->edge + pVA[i].nCPlusGroupEdge - 1;
 1008|    219|            if (charge = pe->cap - pe->flow)
  ------------------
  |  Branch (1008:17): [True: 0, False: 219]
  ------------------
 1009|      0|            {
 1010|      0|                at[i].charge += charge;
 1011|      0|                atom_charge += charge;
 1012|      0|            }
 1013|    219|        }
 1014|  54.1k|        if (pv->st_edge.cap > pv->st_edge.flow)
  ------------------
  |  Branch (1014:13): [True: 48, False: 54.1k]
  ------------------
 1015|     48|        {
 1016|     48|            at[i].radical = RADICAL_SINGLET + ( pv->st_edge.cap - pv->st_edge.flow );
  ------------------
  |  |  103|     48|#define RADICAL_SINGLET 1
  ------------------
 1017|     48|        }
 1018|  54.1k|    }
 1019|       |    /* find charge excess */
 1020|  12.5k|    for (i = num_at; i < pBNS->num_vertices; i++)
  ------------------
  |  Branch (1020:22): [True: 705, False: 11.8k]
  ------------------
 1021|    705|    {
 1022|    705|        pv = pBNS->vert + i;
 1023|    705|        if (charge = pv->st_edge.cap - pv->st_edge.flow)
  ------------------
  |  Branch (1023:13): [True: 17, False: 688]
  ------------------
 1024|     17|        {
 1025|     17|            if (IS_BNS_VT_C_OR_CSUPER_GR( pv->type ))
  ------------------
  |  |  105|     17|#define IS_BNS_VT_C_OR_CSUPER_GR(X) ((X) & BNS_VT_C_POS)
  |  |  ------------------
  |  |  |  |   91|     17|#define BNS_VT_C_POS     BNS_VERT_TYPE_C_GROUP                               /* positive charge group, heteroat */
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|     17|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (105:37): [True: 17, False: 0]
  |  |  ------------------
  ------------------
 1026|     17|            {
 1027|     17|                left_charge -= charge;
 1028|     17|            }
 1029|      0|            else
 1030|      0|                if (IS_BNS_VT_YVCONNECTOR( pv->type ))
  ------------------
  |  |  109|      0|#define IS_BNS_VT_YVCONNECTOR(X)    (((X) & BNS_VERT_TYPE__AUX) && !((X) & BNS_VERT_TYPE_TEMP))
  |  |  ------------------
  |  |  |  |   81|      0|#define BNS_VERT_TYPE__AUX          0x0080  /* vertex added to build charge substructures */
  |  |  ------------------
  |  |               #define IS_BNS_VT_YVCONNECTOR(X)    (((X) & BNS_VERT_TYPE__AUX) && !((X) & BNS_VERT_TYPE_TEMP))
  |  |  ------------------
  |  |  |  |   79|      0|#define BNS_VERT_TYPE_TEMP          0x0040
  |  |  ------------------
  |  |  |  Branch (109:38): [True: 0, False: 0]
  |  |  |  Branch (109:68): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1031|      0|                {
 1032|      0|                    left_charge += charge;
 1033|      0|                }
 1034|     17|        }
 1035|    705|    }
 1036|       |    /* tautomeric H and (-) */
 1037|  11.8k|    for (i = 0; i < pBNS->num_t_groups; i++)
  ------------------
  |  Branch (1037:17): [True: 0, False: 11.8k]
  ------------------
 1038|      0|    {
 1039|       |        /* tautomeric groups are first non-atom vertices;
 1040|       |        order of them is same as in pTCGroups->pTCG[] */
 1041|      0|        int num_H = pTCGroups->pTCG[i].tg_num_H;
 1042|      0|        int num_Minus = pTCGroups->pTCG[i].tg_num_Minus;
 1043|      0|        int bMinusFirst = ( pTCGroups->pTCG[i].tg_RestoreFlags & TGRF_MINUS_FIRST );
 1044|      0|        int num_at_add;
 1045|      0|        Vertex vMinus = NO_VERTEX;
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
 1046|      0|        pv = pBNS->vert + num_at + i;  /* t-group vertex */
 1047|      0|        if (!( pv->type & BNS_VERT_TYPE_TGROUP ))
  ------------------
  |  |   75|      0|#define BNS_VERT_TYPE_TGROUP        0x0004
  ------------------
  |  Branch (1047:13): [True: 0, False: 0]
  ------------------
 1048|      0|        {
 1049|      0|            return RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1050|      0|        }
 1051|      0|        if (pTCGroups->pTCG[i].tg_set_Minus > 0 && num_Minus > 0)
  ------------------
  |  Branch (1051:13): [True: 0, False: 0]
  |  Branch (1051:52): [True: 0, False: 0]
  ------------------
 1052|      0|        {
 1053|      0|            vMinus = pTCGroups->pTCG[i].tg_set_Minus - 1;
 1054|      0|            num_Minus--;
 1055|      0|        }
 1056|       |
 1057|      0|        if (bMinusFirst)
  ------------------
  |  Branch (1057:13): [True: 0, False: 0]
  ------------------
 1058|      0|        {
 1059|      0|            for (j = 0; j < pv->num_adj_edges; j++)
  ------------------
  |  Branch (1059:25): [True: 0, False: 0]
  ------------------
 1060|      0|            {
 1061|      0|                pe = pBNS->edge + pv->iedge[j];
 1062|      0|                v1 = pe->neighbor1;
 1063|      0|                num_at_add = pe->flow;
 1064|      0|                if (v1 == vMinus)
  ------------------
  |  Branch (1064:21): [True: 0, False: 0]
  ------------------
 1065|      0|                {
 1066|      0|                    if (num_at_add)
  ------------------
  |  Branch (1066:25): [True: 0, False: 0]
  ------------------
 1067|      0|                    {
 1068|      0|                        at[v1].charge = -1;  /* no checking at[v1].charge == 0 for now ??? */
 1069|      0|                        num_at_add--;       /* no checking  num_at_add > 0 for now ??? */
 1070|      0|                    }
 1071|      0|                    else
 1072|      0|                    {
 1073|      0|                        num_Minus++;        /* error ??? */
 1074|      0|                    }
 1075|      0|                    vMinus = NO_VERTEX;
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
 1076|      0|                }
 1077|      0|                if (num_at_add > 0)
  ------------------
  |  Branch (1077:21): [True: 0, False: 0]
  ------------------
 1078|      0|                {
 1079|       |                    /* atom has tautomeric attachment; do not allow =N(-) */
 1080|      0|                    if (num_Minus && !at[v1].charge &&
  ------------------
  |  Branch (1080:25): [True: 0, False: 0]
  |  Branch (1080:38): [True: 0, False: 0]
  ------------------
 1081|      0|                         at[v1].valence == at[v1].chem_bonds_valence)
  ------------------
  |  Branch (1081:26): [True: 0, False: 0]
  ------------------
 1082|      0|                    {
 1083|      0|                        at[v1].charge--;
 1084|      0|                        num_at_add--;
 1085|      0|                        num_Minus--;
 1086|      0|                    }
 1087|      0|                    if (num_at_add > 0)
  ------------------
  |  Branch (1087:25): [True: 0, False: 0]
  ------------------
 1088|      0|                    {
 1089|      0|                        at[v1].num_H += num_at_add;
 1090|      0|                        num_H -= num_at_add;
 1091|      0|                        num_at_add = 0;
 1092|      0|                    }
 1093|      0|                }
 1094|      0|                at[v1].endpoint = i + 1;
 1095|      0|            }
 1096|      0|            if (( num_H + num_Minus != pv->st_edge.cap - pv->st_edge.flow ) && ( num_H || num_Minus || vMinus != NO_VERTEX ))
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (1096:17): [True: 0, False: 0]
  |  Branch (1096:82): [True: 0, False: 0]
  |  Branch (1096:91): [True: 0, False: 0]
  |  Branch (1096:104): [True: 0, False: 0]
  ------------------
 1097|      0|            {
 1098|      0|                return RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1099|      0|            }
 1100|      0|        }
 1101|      0|        else
 1102|      0|        {
 1103|      0|            for (j = pv->num_adj_edges - 1; 0 <= j; j--)
  ------------------
  |  Branch (1103:45): [True: 0, False: 0]
  ------------------
 1104|      0|            {
 1105|      0|                pe = pBNS->edge + pv->iedge[j];
 1106|      0|                v1 = pe->neighbor1;
 1107|      0|                num_at_add = pe->flow;
 1108|      0|                if (v1 == vMinus)
  ------------------
  |  Branch (1108:21): [True: 0, False: 0]
  ------------------
 1109|      0|                {
 1110|      0|                    if (num_at_add)
  ------------------
  |  Branch (1110:25): [True: 0, False: 0]
  ------------------
 1111|      0|                    {
 1112|      0|                        at[v1].charge = -1;  /* no checking at[v1].charge == 0 for now ??? */
 1113|      0|                        num_at_add--;       /* no checking  num_at_add > 0 for now ??? */
 1114|      0|                    }
 1115|      0|                    else
 1116|      0|                    {
 1117|      0|                        num_Minus++;        /* error ??? */
 1118|      0|                    }
 1119|      0|                    vMinus = NO_VERTEX;
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
 1120|      0|                }
 1121|      0|                if (num_at_add > 0)
  ------------------
  |  Branch (1121:21): [True: 0, False: 0]
  ------------------
 1122|      0|                {
 1123|       |                    /* atom has tautomeric attachment; do not allow =N(-) */
 1124|      0|                    if (num_Minus && !at[v1].charge &&
  ------------------
  |  Branch (1124:25): [True: 0, False: 0]
  |  Branch (1124:38): [True: 0, False: 0]
  ------------------
 1125|      0|                         at[v1].valence == at[v1].chem_bonds_valence)
  ------------------
  |  Branch (1125:26): [True: 0, False: 0]
  ------------------
 1126|      0|                    {
 1127|      0|                        at[v1].charge--;
 1128|      0|                        num_at_add--;
 1129|      0|                        num_Minus--;
 1130|      0|                    }
 1131|      0|                    if (num_at_add > 0)
  ------------------
  |  Branch (1131:25): [True: 0, False: 0]
  ------------------
 1132|      0|                    {
 1133|      0|                        at[v1].num_H += num_at_add;
 1134|      0|                        num_H -= num_at_add;
 1135|      0|                        num_at_add = 0;
 1136|      0|                    }
 1137|      0|                }
 1138|      0|                at[v1].endpoint = i + 1;
 1139|      0|            }
 1140|      0|            if (( num_H + num_Minus != pv->st_edge.cap - pv->st_edge.flow ) && ( num_H || num_Minus || vMinus != NO_VERTEX ))
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (1140:17): [True: 0, False: 0]
  |  Branch (1140:82): [True: 0, False: 0]
  |  Branch (1140:91): [True: 0, False: 0]
  |  Branch (1140:104): [True: 0, False: 0]
  ------------------
 1141|      0|            {
 1142|      0|                return RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1143|      0|            }
 1144|      0|        }
 1145|      0|    }
 1146|       |
 1147|  11.8k|    return ret;
 1148|  11.8k|}
CheckBnsConsistency:
 1157|    804|{
 1158|    804|    int nOutput = 0;
 1159|       |#ifndef TARGET_API_LIB
 1160|       |#if ( bRELEASE_VERSION == 0 )
 1161|       |    char s[128];
 1162|       |    int i, j, atom_charge, left_charge, charge, excess_charge, ret = 0;
 1163|       |    int v1, v2, flow, tot_st_flow, tot_st_cap, num_electrons, nNumMetalAtoms;
 1164|       |    int       num_at = pStruct->num_atoms;
 1165|       |    inp_ATOM *at = pStruct->at;
 1166|       |    BNS_VERTEX  *pv;
 1167|       |    BNS_EDGE    *pe;
 1168|       |#ifdef _DEBUG
 1169|       |    int       bDebugOutput = 0;
 1170|       |    bNoRad = 1;
 1171|       |    bDebugOutput = 1;
 1172|       |#endif
 1173|       |    /* count electrons and metals */
 1174|       |    num_electrons = -pTCGroups->total_charge;
 1175|       |    nNumMetalAtoms = 0;
 1176|       |    for (i = 0; i < pTCGroups->num_tgroups; i++)
 1177|       |    {
 1178|       |        num_electrons += pTCGroups->pTCG[i].tg_num_H;
 1179|       |    }
 1180|       |    for (i = 0; i < num_at; i++)
 1181|       |    {
 1182|       |        num_electrons += at[i].el_number + at[i].num_H;
 1183|       |        nNumMetalAtoms += pVA[i].cMetal;
 1184|       |    }
 1185|       |    /* create output string */
 1186|       |    sprintf( s, "%d:%d%sM%02dv%da%de%db%d* ",
 1187|       |                bNoRad, pTCGroups->iComponent + 1, num_electrons % 2 ? "O" : "E", nNumMetalAtoms,
 1188|       |                pBNS->num_vertices, num_at, pBNS->num_edges, pBNS->num_bonds );
 1189|       |
 1190|       |
 1191|       |    tot_st_flow = tot_st_cap = 0;
 1192|       |    atom_charge = left_charge = 0;
 1193|       |    if (pBNS->num_atoms != num_at)
 1194|       |    {
 1195|       |        fprintf( stdout, "\n%sNum. atoms discrepancy: %d(BNS) vs. %d(at) ", s, pBNS->num_atoms, num_at );
 1196|       |        nOutput++;
 1197|       |    }
 1198|       |    /* check edges */
 1199|       |#ifdef _DEBUG
 1200|       |    if (bDebugOutput && bNoRad)
 1201|       |    {
 1202|       |        fprintf( stderr, "\n\n------begin------------------------------------------------\n" );
 1203|       |        fprintf( stderr, "\n\fedge    cap       flow     v1   v2\n\n" );
 1204|       |        /*                  xxxx xxxx/xxxx xxxx/xxxx xxxx xxxx    */
 1205|       |    }
 1206|       |#endif
 1207|       |    for (i = 0; i < pBNS->num_edges; i++)
 1208|       |    {
 1209|       |        pe = pBNS->edge + i;
 1210|       |        v1 = pe->neighbor1;
 1211|       |        v2 = v1 ^ pe->neighbor12;
 1212|       |        if (pe->cap < pe->flow || pe->flow < 0)
 1213|       |        {
 1214|       |            fprintf( stdout, "\n%sedge %d (%d-%d) has cap=%d flow=%d  ", s, i, v1, v2, pe->cap, pe->flow );
 1215|       |            nOutput++;
 1216|       |        }
 1217|       |#ifdef _DEBUG
 1218|       |        if (bDebugOutput && bNoRad)
 1219|       |        {
 1220|       |            /*                xxxx  xxxx/xxxx xxxx/xxxx xxxx xxxx    */
 1221|       |            fprintf( stderr, "%4d %4d/%-4d %4d/%-4d %4d %4d\n", i, pe->cap, pe->cap0, pe->flow, pe->flow0, v1, v2 );
 1222|       |        }
 1223|       |#endif
 1224|       |    }
 1225|       |
 1226|       |
 1227|       |    /* check vertices */
 1228|       |#ifdef _DEBUG
 1229|       |    if (bDebugOutput && bNoRad)
 1230|       |    {
 1231|       |        fprintf( stderr, "\n\fvert   st-cap   st-flow   type iedge : neigh\n\n" );
 1232|       |        /*                   xxxx xxxx/xxxx xxxx/xxxx 0xXXX xxxx : xxx    */
 1233|       |    }
 1234|       |#endif
 1235|       |    for (i = 0; i < pBNS->num_vertices; i++)
 1236|       |    {
 1237|       |        pv = pBNS->vert + i;
 1238|       |#ifdef _DEBUG
 1239|       |        if (bDebugOutput && bNoRad)
 1240|       |        {
 1241|       |            /*                   xxxx xxxx/xxxx xxxx/xxxx 0xXXX xxxx : xxx    */
 1242|       |            int j;
 1243|       |            const char *s;
 1244|       |            char sAtom[6];
 1245|       |            switch (pv->type)
 1246|       |            {
 1247|       |                case BNS_VERT_TYPE_ATOM:
 1248|       |                    sprintf( sAtom, "At %-2.2s", i < num_at ? at[i].elname : "??" );
 1249|       |                    s = sAtom;
 1250|       |                    break;
 1251|       |                case BNS_VERT_TYPE_ATOM | BNS_VERT_TYPE_ENDPOINT:
 1252|       |                    s = "Endpt";
 1253|       |                    break;
 1254|       |                case BNS_VT_C_POS:
 1255|       |                    s = "(+)  ";
 1256|       |                    break;
 1257|       |                case BNS_VT_C_NEG:
 1258|       |                    s = "(-)  ";
 1259|       |                    break;
 1260|       |                case BNS_VT_C_POS_C:
 1261|       |                    s = "(+C) ";
 1262|       |                    break;
 1263|       |                case BNS_VT_C_NEG_C:
 1264|       |                    s = "(-C) ";
 1265|       |                    break;
 1266|       |                case BNS_VT_C_POS_M:
 1267|       |                    s = "(+M) ";
 1268|       |                    break;
 1269|       |                case BNS_VT_C_NEG_M:
 1270|       |                    s = "(-M) ";
 1271|       |                    break;
 1272|       |                case BNS_VT_C_POS_ALL:
 1273|       |                    s = "(+)Sg";
 1274|       |                    break;
 1275|       |                case BNS_VT_C_NEG_ALL:
 1276|       |                    s = "(-)Sg";
 1277|       |                    break;
 1278|       |                case BNS_VT_M_GROUP:
 1279|       |                    s = "M-grp";
 1280|       |                    break;
 1281|       |                case BNS_VERT_TYPE__AUX | BNS_VERT_TYPE_TEMP:
 1282|       |                    s = "ChStr";
 1283|       |                    break;
 1284|       |                case BNS_VERT_TYPE__AUX:
 1285|       |                    s = "Yconn";
 1286|       |                    break;
 1287|       |                case BNS_VERT_TYPE_TGROUP:
 1288|       |                    s = "T-grp";
 1289|       |                    break;
 1290|       |                default:
 1291|       |                    s = "Unkn.";
 1292|       |                    break;
 1293|       |            }
 1294|       |            fprintf( stderr, "%4d %4d/%-4d %4d/%-4d 0x%03X %5s",
 1295|       |                                i, pv->st_edge.cap, pv->st_edge.cap0, pv->st_edge.flow, pv->st_edge.flow0,
 1296|       |                                pv->type, s );
 1297|       |            for (j = 0; j < pv->num_adj_edges; j++)
 1298|       |            {
 1299|       |                fprintf( stderr, " %2d", pv->iedge[j] );
 1300|       |            }
 1301|       |            fprintf( stderr, ":" );
 1302|       |            for (j = 0; j < pv->num_adj_edges; j++)
 1303|       |            {
 1304|       |                pe = pBNS->edge + pv->iedge[j];
 1305|       |                fprintf( stderr, " %2d", pe->neighbor12 ^ i );
 1306|       |            }
 1307|       |            fprintf( stderr, "\n" );
 1308|       |        }
 1309|       |#endif
 1310|       |        tot_st_flow += pv->st_edge.flow;
 1311|       |        tot_st_cap += pv->st_edge.cap;
 1312|       |        if (pv->num_adj_edges > pv->max_adj_edges)
 1313|       |        {
 1314|       |            fprintf( stdout, "\n%s%s %d type 0x%X \"%s\" num_edges=%d > max=%d  ", s,
 1315|       |                i < num_at ? "atom" : "vertex", i,
 1316|       |                pv->type, at[i].elname, pv->num_adj_edges, pv->max_adj_edges );
 1317|       |            nOutput++;
 1318|       |        }
 1319|       |        if (i < num_at)
 1320|       |        {
 1321|       |            /* charge on atoms */
 1322|       |            charge = pVA[i].cInitCharge;
 1323|       |            if (pVA[i].nCMinusGroupEdge)
 1324|       |            {
 1325|       |                pe = pBNS->edge + pVA[i].nCMinusGroupEdge - 1;
 1326|       |                if (pe->flow > 0)
 1327|       |                {
 1328|       |                    charge -= pe->flow;
 1329|       |                }
 1330|       |            }
 1331|       |            if (pVA[i].nCPlusGroupEdge)
 1332|       |            {
 1333|       |                pe = pBNS->edge + pVA[i].nCPlusGroupEdge - 1;
 1334|       |                if (pe->cap > pe->flow)
 1335|       |                {
 1336|       |                    charge += pe->cap - pe->flow;
 1337|       |                }
 1338|       |            }
 1339|       |            if (bNoRad && pv->st_edge.flow != pv->st_edge.cap)
 1340|       |            {
 1341|       |                fprintf( stdout, "\n%s%s %d: type 0x%X \"%s\" unexpected st_cap=%d st_flow=%d ", s,
 1342|       |                    i < num_at ? "atom" : "vertex", i,
 1343|       |                    pv->type, at[i].elname, pv->st_edge.cap, pv->st_edge.flow );
 1344|       |                nOutput++;
 1345|       |            }
 1346|       |            else
 1347|       |                if (bNoRad && charge && !strcmp( at[i].elname, "C" ))
 1348|       |                {
 1349|       |                    /* ignore carbonyls */
 1350|       |                    if (i == 0 && num_at == 2 && !strcmp( at[1].elname, "O" ) &&
 1351|       |                         !at[0].num_H && !at[1].num_H && !pTCGroups->total_charge)
 1352|       |                    {
 1353|       |                        ; /* C(-)#O(+) structure */
 1354|       |                    }
 1355|       |                    else
 1356|       |                    {
 1357|       |                        fprintf( stdout, "\n%s%s %d: type 0x%X \"%s\" charge=%d ", s,
 1358|       |                            i < num_at ? "atom" : "vertex", i,
 1359|       |                            pv->type, at[i].elname, charge );
 1360|       |                        nOutput++;
 1361|       |                    }
 1362|       |                }
 1363|       |            atom_charge += charge;
 1364|       |        }
 1365|       |        else
 1366|       |            if (( charge = pv->st_edge.cap - pv->st_edge.flow ) > 0)
 1367|       |            {
 1368|       |                /* excess charge */
 1369|       |                if (!bNoRad && IS_BNS_VT_C_OR_CSUPER_GR( pv->type ))
 1370|       |                {
 1371|       |                    left_charge -= charge;
 1372|       |                }
 1373|       |                else
 1374|       |                    if (!bNoRad && IS_BNS_VT_YVCONNECTOR( pv->type ))
 1375|       |                    {
 1376|       |                        left_charge += charge;
 1377|       |                    }
 1378|       |                    else
 1379|       |                        if (!bNoRad && IS_BNS_VT_M_GR( pv->type ) &&
 1380|       |                             0 <= ( j = pTCGroups->nGroup[TCG_MeFlower3] ) &&
 1381|       |                             i == pTCGroups->pTCG[j].nVertexNumber)
 1382|       |                        {
 1383|       |                            ; /* additional "radical" on metal flower */
 1384|       |                        }
 1385|       |                        else
 1386|       |                            if (!( pv->type & BNS_VERT_TYPE_TGROUP ) || bNoRad)
 1387|       |                            {
 1388|       |                                /* t-groups before running BFS should have st_cap > st_flow */
 1389|       |                                fprintf( stdout, "\n%s%s %d: type 0x%X unexpected st_cap=%d st_flow=%d ", s,
 1390|       |                                    i < num_at ? "atom" : "vertex", i,
 1391|       |                                    pv->type, pv->st_edge.cap, pv->st_edge.flow );
 1392|       |                                nOutput++;
 1393|       |                            }
 1394|       |            }
 1395|       |        if (pv->st_edge.cap < pv->st_edge.flow || pv->st_edge.flow < 0)
 1396|       |        {
 1397|       |            fprintf( stdout, "\n%s%s %d: type 0x%X \"%s\" st_cap=%d st_flow=%d  ", s,
 1398|       |                i < num_at ? "atom" : "vertex", i,
 1399|       |                pv->type, i < num_at ? at[i].elname : "", pv->st_edge.cap, pv->st_edge.flow );
 1400|       |            nOutput++;
 1401|       |        }
 1402|       |        /* check edge_flow vs. st_flow consistency */
 1403|       |        for (j = 0, flow = 0; j < pv->num_adj_edges; j++)
 1404|       |        {
 1405|       |            pe = pBNS->edge + pv->iedge[j];
 1406|       |            flow += pe->flow;
 1407|       |        }
 1408|       |        if (flow != pv->st_edge.flow)
 1409|       |        {
 1410|       |            fprintf( stdout, "\n%s%s %d: type 0x%X \"%s\" st_flow=%d edge_flow=%d  ", s,
 1411|       |                i < num_at ? "atom" : "vertex", i,
 1412|       |                pv->type, i < num_at ? at[i].elname : "", pv->st_edge.flow, flow );
 1413|       |            nOutput++;
 1414|       |        }
 1415|       |    }
 1416|       |#ifdef _DEBUG
 1417|       |    if (bDebugOutput && bNoRad)
 1418|       |    {
 1419|       |        fprintf( stderr, "\n------end--------------------------------------------------\n" );
 1420|       |    }
 1421|       |#endif
 1422|       |    /*
 1423|       |    if ( num_electrons %= 2 ) {
 1424|       |        fprintf( stdout, "\n%d*Odd number of electrons (%d atoms) ", bNoRad, num_at );
 1425|       |        nOutput ++;
 1426|       |    }
 1427|       |    */
 1428|       |    /* tautomeric groups charge */
 1429|       |    for (i = 0, charge = 0; i < pTCGroups->num_tgroups; i++)
 1430|       |    {
 1431|       |        charge -= pTCGroups->pTCG[i].tg_num_Minus;
 1432|       |    }
 1433|       |    /* compare */
 1434|       |    if (charge != pTCGroups->tgroup_charge)
 1435|       |    {
 1436|       |        fprintf( stdout, "\n%sCounted t-group charge=%d while %d was saved  ", s,
 1437|       |               charge, pTCGroups->tgroup_charge );
 1438|       |        nOutput++;
 1439|       |    }
 1440|       |    /* add other charges */
 1441|       |    charge += atom_charge + left_charge;
 1442|       |    excess_charge = pTCGroups->total_charge - pTCGroups->added_charge - pTCGroups->tgroup_charge;
 1443|       |    if (charge != pTCGroups->total_charge && excess_charge != pTCGroups->total_charge - charge)
 1444|       |    {
 1445|       |        fprintf( stdout, "\n%sCounted total charge=%d while %d was saved; excess charge=%d  ", s,
 1446|       |            charge, pTCGroups->total_charge, excess_charge );
 1447|       |        nOutput++;
 1448|       |    }
 1449|       |    if (tot_st_cap != pBNS->tot_st_cap || tot_st_flow != pBNS->tot_st_flow)
 1450|       |    {
 1451|       |        fprintf( stdout, "\n%sCounted/saved total st_flow=%d/%d st_cap=%d/%d  ", s,
 1452|       |            tot_st_flow, pBNS->tot_st_flow, tot_st_cap, pBNS->tot_st_cap );
 1453|       |        nOutput++;
 1454|       |    }
 1455|       |    if (nOutput)
 1456|       |    {
 1457|       |        fprintf( stdout, "\n" );
 1458|       |    }
 1459|       |#endif
 1460|       |#endif
 1461|       |
 1462|    804|    return nOutput;
 1463|    804|}
MoveRadToAtomsAddCharges:
 1846|    801|{
 1847|    801|    int nNumRad, ret = 0, ret2;
 1848|    801|    int i, j, k, num_rad_not_atom, num_moved = 0, num_candidates = 0, extra_charge = 0, added_charge, delta;
 1849|    801|    BNS_EDGE   *pEdge;
 1850|    801|    BNS_VERTEX *pv;
 1851|    801|    Vertex      v1, v2;
 1852|    801|    S_SHORT    *pnRad = NULL, *pnDelta = NULL;
 1853|    801|    CC_CAND    *pCand = NULL;
 1854|    801|    int         cnBits, bAtomRadRemoved = 0;
 1855|       |
 1856|    801|    int num_at = pStruct->num_atoms;
 1857|    801|    int num_deleted_H = pStruct->num_deleted_H;
 1858|    801|    int len_at = num_at + num_deleted_H;
 1859|       |
 1860|    846|    for (i = pBNS->num_atoms, num_rad_not_atom = 0; i < pBNS->num_vertices; i++)
  ------------------
  |  Branch (1860:53): [True: 45, False: 801]
  ------------------
 1861|     45|    {
 1862|     45|        num_rad_not_atom += pBNS->vert[i].st_edge.cap - pBNS->vert[i].st_edge.flow;
 1863|     45|    }
 1864|    801|    if (!num_rad_not_atom)
  ------------------
  |  Branch (1864:9): [True: 798, False: 3]
  ------------------
 1865|    798|    {
 1866|    798|        goto exit_function;
 1867|    798|    }
 1868|       |    /****************************************************/
 1869|       |    /*                                                  */
 1870|       |    /*    Move radicals from ChargeStruct to atoms      */
 1871|       |    /*                                                  */
 1872|       |    /****************************************************/
 1873|       |
 1874|       |    /* allocate memory to keep track of moved radicals */
 1875|      3|    pnRad = (S_SHORT *) inchi_malloc( pBNS->num_vertices * sizeof( pnRad[0] ) );
  ------------------
  |  | 1130|      3|#define inchi_malloc   malloc
  ------------------
 1876|      3|    pnDelta = (S_SHORT *) inchi_calloc( pBNS->num_atoms, sizeof( pnDelta[0] ) );
  ------------------
  |  | 1133|      3|#define inchi_calloc   calloc
  ------------------
 1877|      3|    if (!pnRad || !pnDelta)
  ------------------
  |  Branch (1877:9): [True: 0, False: 3]
  |  Branch (1877:19): [True: 0, False: 3]
  ------------------
 1878|      0|    {
 1879|      0|        ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 1880|      0|        goto exit_function;
 1881|      0|    }
 1882|     63|    for (i = 0; i < pBNS->num_vertices; i++)
  ------------------
  |  Branch (1882:17): [True: 60, False: 3]
  ------------------
 1883|     60|    {
 1884|     60|        pnRad[i] = pBNS->vert[i].st_edge.cap - pBNS->vert[i].st_edge.flow;
 1885|     60|    }
 1886|      5|    while (1)
  ------------------
  |  Branch (1886:12): [Folded - Ignored]
  ------------------
 1887|      5|    {
 1888|       |        /* remove radicals from atoms */
 1889|     30|        for (i = 0; i < pBNS->num_atoms; i++)
  ------------------
  |  Branch (1889:21): [True: 25, False: 5]
  ------------------
 1890|     25|        {
 1891|     25|            pnDelta[i] = pBNS->vert[i].st_edge.cap - pBNS->vert[i].st_edge.flow;
 1892|     25|            pBNS->vert[i].st_edge.cap -= pnDelta[i];
 1893|     25|            bAtomRadRemoved += ( 0 != pnDelta[i] );
 1894|     25|        }
 1895|      5|        ret = SetRadEndpoints( pBNS, pBD, RAD_SRCH_FROM_FICT );
 1896|      5|        if (!ret)
  ------------------
  |  Branch (1896:13): [True: 3, False: 2]
  ------------------
 1897|      3|        {
 1898|      3|            break;
 1899|      3|        }
 1900|      2|        if (ret < 0)
  ------------------
  |  Branch (1900:13): [True: 0, False: 2]
  ------------------
 1901|      0|        {
 1902|      0|            goto exit_function;
 1903|      0|        }
 1904|      2|        nNumRad = ret;
 1905|      4|        for (i = 0; i < nNumRad; i++)
  ------------------
  |  Branch (1905:21): [True: 2, False: 2]
  ------------------
 1906|      2|        {
 1907|      2|            pEdge = pBNS->edge + pBD->RadEdges[i];
 1908|      2|            v1 = pEdge->neighbor1;
 1909|      2|            v2 = pEdge->neighbor12 ^ v1;
 1910|      2|            pBNS->vert[v1].st_edge.flow -= pEdge->flow;
 1911|      2|            pBNS->vert[v2].st_edge.flow -= pEdge->flow;
 1912|      2|            pBNS->tot_st_flow -= 2 * pEdge->flow;
 1913|      2|            pEdge->flow = 0;
 1914|      2|            pEdge->forbidden |= forbidden_mask;
 1915|      2|            pBNS->edge_forbidden_mask |= forbidden_mask;
 1916|      2|        }
 1917|      2|        ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 1918|      2|        if (ret < 0)
  ------------------
  |  Branch (1918:13): [True: 0, False: 2]
  ------------------
 1919|      0|        {
 1920|      0|            goto exit_function;
 1921|      0|        }
 1922|      2|        else
 1923|      2|        {
 1924|      2|            num_moved += ret;
 1925|      2|        }
 1926|      2|        RemoveRadEndpoints( pBNS, pBD, NULL );
 1927|      2|        if (ret == 0)
  ------------------
  |  Branch (1927:13): [True: 0, False: 2]
  ------------------
 1928|      0|        {
 1929|      0|            break;  /* could not move more radicals */
 1930|      0|        }
 1931|      2|        if (bAtomRadRemoved)
  ------------------
  |  Branch (1931:13): [True: 0, False: 2]
  ------------------
 1932|      0|        {
 1933|       |            /* restore radicals to atoms */
 1934|      0|            for (i = 0; i < pBNS->num_atoms; i++)
  ------------------
  |  Branch (1934:25): [True: 0, False: 0]
  ------------------
 1935|      0|            {
 1936|      0|                pBNS->vert[i].st_edge.cap += pnDelta[i];
 1937|      0|            }
 1938|      0|            bAtomRadRemoved = 0;
 1939|      0|        }
 1940|      2|    }
 1941|      3|    if (bAtomRadRemoved)
  ------------------
  |  Branch (1941:9): [True: 2, False: 1]
  ------------------
 1942|      2|    {
 1943|       |        /* restore radicals to atoms */
 1944|     12|        for (i = 0; i < pBNS->num_atoms; i++)
  ------------------
  |  Branch (1944:21): [True: 10, False: 2]
  ------------------
 1945|     10|        {
 1946|     10|            pBNS->vert[i].st_edge.cap += pnDelta[i];
 1947|     10|        }
 1948|      2|        bAtomRadRemoved = 0;
 1949|      2|    }
 1950|      3|    pBNS->edge_forbidden_mask &= ~forbidden_mask;
 1951|       |
 1952|       |
 1953|       |    /****************************************************/
 1954|       |    /*                                                  */
 1955|       |    /*    Fix the charges                               */
 1956|       |    /*                                                  */
 1957|       |    /****************************************************/
 1958|      3|    if (num_moved)
  ------------------
  |  Branch (1958:9): [True: 2, False: 1]
  ------------------
 1959|      2|    {
 1960|       |        /* find reqired charge */
 1961|      2|        extra_charge = 0;
 1962|     32|        for (i = pBNS->num_atoms, pv = pBNS->vert + i; i < pBNS->num_vertices; i++, pv++)
  ------------------
  |  Branch (1962:56): [True: 30, False: 2]
  ------------------
 1963|     30|        {
 1964|     30|            if (delta = pv->st_edge.cap - pv->st_edge.flow)
  ------------------
  |  Branch (1964:17): [True: 2, False: 28]
  ------------------
 1965|      2|            {
 1966|      2|                if (IS_BNS_VT_C_OR_CSUPER_GR( pv->type ))
  ------------------
  |  |  105|      2|#define IS_BNS_VT_C_OR_CSUPER_GR(X) ((X) & BNS_VT_C_POS)
  |  |  ------------------
  |  |  |  |   91|      2|#define BNS_VT_C_POS     BNS_VERT_TYPE_C_GROUP                               /* positive charge group, heteroat */
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|      2|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (105:37): [True: 2, False: 0]
  |  |  ------------------
  ------------------
 1967|      2|                {
 1968|      2|                    extra_charge -= delta;
 1969|      2|                }
 1970|      0|                else
 1971|      0|                    if (BNS_VERT_TYPE__AUX == pv->type)
  ------------------
  |  |   81|      0|#define BNS_VERT_TYPE__AUX          0x0080  /* vertex added to build charge substructures */
  ------------------
  |  Branch (1971:25): [True: 0, False: 0]
  ------------------
 1972|      0|                    {
 1973|      0|                        extra_charge += delta;
 1974|      0|                    }
 1975|      0|                    else
 1976|      0|                    {
 1977|      0|                        ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1978|      0|                        goto exit_function;
 1979|      0|                    }
 1980|      2|            }
 1981|     30|        }
 1982|      2|        if (!extra_charge)
  ------------------
  |  Branch (1982:13): [True: 0, False: 2]
  ------------------
 1983|      0|        {
 1984|      0|            goto exit_function;
 1985|      0|        }
 1986|       |        /* find differences */
 1987|      2|        num_candidates = 0;
 1988|     42|        for (i = 0; i < pBNS->num_vertices; i++)
  ------------------
  |  Branch (1988:21): [True: 40, False: 2]
  ------------------
 1989|     40|        {
 1990|     40|            pnRad[i] = ( pBNS->vert[i].st_edge.cap - pBNS->vert[i].st_edge.flow ) - pnRad[i];
 1991|     40|            if (pnRad[i] > 0 && i < pBNS->num_atoms && !pVA[i].nTautGroupEdge)
  ------------------
  |  Branch (1991:17): [True: 3, False: 37]
  |  Branch (1991:33): [True: 3, False: 0]
  |  Branch (1991:56): [True: 3, False: 0]
  ------------------
 1992|      3|            {
 1993|      3|                num_candidates++;
 1994|      3|            }
 1995|     40|        }
 1996|      2|    }
 1997|      3|    if (num_candidates > 0)
  ------------------
  |  Branch (1997:9): [True: 2, False: 1]
  ------------------
 1998|      2|    {
 1999|      2|        pCand = (CC_CAND *) inchi_calloc( num_candidates, sizeof( pCand[0] ) );
  ------------------
  |  | 1133|      2|#define inchi_calloc   calloc
  ------------------
 2000|      2|        if (!pCand)
  ------------------
  |  Branch (2000:13): [True: 0, False: 2]
  ------------------
 2001|      0|        {
 2002|      0|            ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 2003|      0|            goto exit_function;
 2004|      0|        }
 2005|       |        /* create atom */
 2006|      2|        memcpy( at2, at, len_at * sizeof( at2[0] ) );
 2007|      2|        pStruct->at = at2;
 2008|      2|        ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 2009|      2|        pStruct->at = at;
 2010|      2|        if (ret2 < 0)
  ------------------
  |  Branch (2010:13): [True: 0, False: 2]
  ------------------
 2011|      0|        {
 2012|      0|            ret = ret2;
 2013|      0|            goto exit_function;
 2014|      0|        }
 2015|       |
 2016|     42|        for (i = 0, j = 0; i < pBNS->num_vertices; i++)
  ------------------
  |  Branch (2016:28): [True: 40, False: 2]
  ------------------
 2017|     40|        {
 2018|     40|            if (pnRad[i] > 0 && i < pBNS->num_atoms && !pVA[i].nTautGroupEdge)
  ------------------
  |  Branch (2018:17): [True: 3, False: 37]
  |  Branch (2018:33): [True: 3, False: 0]
  |  Branch (2018:56): [True: 3, False: 0]
  ------------------
 2019|      3|            {
 2020|      3|                pCand[j].iat = i;
 2021|      3|                pCand[j].num_bonds = at2[i].valence;
 2022|      3|                pCand[j].chem_valence = at2[i].chem_bonds_valence;
 2023|      3|                pCand[j].cMetal = pVA[i].cMetal;
 2024|      3|                pCand[j].cNumBondsToMetal = pVA[i].cNumBondsToMetal;
 2025|      3|                pCand[j].cNumValenceElectrons = pVA[i].cNumValenceElectrons;
 2026|      3|                pCand[j].cPeriodicRowNumber = pVA[i].cPeriodicRowNumber;
 2027|      3|                pCand[j].el_number = at2[i].el_number;
 2028|      3|                cnBits = ( pVA[i].cnListIndex > 0 ) ? cnList[pVA[i].cnListIndex - 1].bits : 0;
  ------------------
  |  Branch (2028:26): [True: 3, False: 0]
  ------------------
 2029|     11|                while (cnBits > 0)
  ------------------
  |  Branch (2029:24): [True: 8, False: 3]
  ------------------
 2030|      8|                {
 2031|      8|                    pCand[j].cNumChargeStates++;
 2032|      8|                    cnBits >>= cn_bits_shift;
  ------------------
  |  |  447|      8|#define cn_bits_shift 3
  ------------------
 2033|      8|                }
 2034|      3|                j++;
 2035|      3|            }
 2036|     40|        }
 2037|      2|        if (j > 1)
  ------------------
  |  Branch (2037:13): [True: 1, False: 1]
  ------------------
 2038|      1|        {
 2039|      1|            qsort( pCand, j, sizeof( pCand[0] ), comp_cc_cand );
 2040|      1|        }
 2041|      2|        added_charge = 0;
 2042|       |
 2043|      5|        for (k = 0; k < j; k++)
  ------------------
  |  Branch (2043:21): [True: 3, False: 2]
  ------------------
 2044|      3|        {
 2045|      3|            int rest_of_charge = extra_charge - added_charge;
 2046|      3|            int charge_per_left_atom = ( abs( rest_of_charge ) + j - k - 1 ) / ( j - k );
 2047|      3|            int this_atom_add_charge = rest_of_charge > 0 ? charge_per_left_atom : -charge_per_left_atom;
  ------------------
  |  Branch (2047:40): [True: 0, False: 3]
  ------------------
 2048|      3|            pVA[pCand[k].iat].cInitCharge += this_atom_add_charge;
 2049|      3|            added_charge += this_atom_add_charge;
 2050|      3|            if (this_atom_add_charge)
  ------------------
  |  Branch (2050:17): [True: 3, False: 0]
  ------------------
 2051|      3|            {
 2052|     36|                for (i = pBNS->num_vertices - 1, pv = pBNS->vert + i; this_atom_add_charge && pBNS->num_atoms <= i; i--, pv--)
  ------------------
  |  Branch (2052:71): [True: 33, False: 3]
  |  Branch (2052:95): [True: 33, False: 0]
  ------------------
 2053|     33|                {
 2054|     33|                    if (delta = pv->st_edge.cap - pv->st_edge.flow)
  ------------------
  |  Branch (2054:25): [True: 3, False: 30]
  ------------------
 2055|      3|                    {
 2056|      3|                        if (this_atom_add_charge < 0 && IS_BNS_VT_C_OR_CSUPER_GR( pv->type ))
  ------------------
  |  |  105|      3|#define IS_BNS_VT_C_OR_CSUPER_GR(X) ((X) & BNS_VT_C_POS)
  |  |  ------------------
  |  |  |  |   91|      3|#define BNS_VT_C_POS     BNS_VERT_TYPE_C_GROUP                               /* positive charge group, heteroat */
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|      3|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (105:37): [True: 3, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (2056:29): [True: 3, False: 0]
  ------------------
 2057|      3|                        {
 2058|      3|                            if (delta + this_atom_add_charge > 0)
  ------------------
  |  Branch (2058:33): [True: 1, False: 2]
  ------------------
 2059|      1|                            {
 2060|      1|                                delta = -this_atom_add_charge;
 2061|      1|                            }
 2062|      3|                            pv->st_edge.cap -= delta;
 2063|      3|                            pBNS->tot_st_cap -= delta;
 2064|      3|                            this_atom_add_charge += delta;
 2065|      3|                        }
 2066|      0|                        else
 2067|      0|                        {
 2068|      0|                            if (this_atom_add_charge > 0 && BNS_VERT_TYPE__AUX == pv->type)
  ------------------
  |  |   81|      0|#define BNS_VERT_TYPE__AUX          0x0080  /* vertex added to build charge substructures */
  ------------------
  |  Branch (2068:33): [True: 0, False: 0]
  |  Branch (2068:61): [True: 0, False: 0]
  ------------------
 2069|      0|                            {
 2070|      0|                                if (delta > this_atom_add_charge)
  ------------------
  |  Branch (2070:37): [True: 0, False: 0]
  ------------------
 2071|      0|                                {
 2072|      0|                                    delta = this_atom_add_charge;
 2073|      0|                                }
 2074|      0|                                pv->st_edge.cap -= delta;
 2075|      0|                                pBNS->tot_st_cap -= delta;
 2076|      0|                                this_atom_add_charge -= delta;
 2077|      0|                            }
 2078|      0|                        }
 2079|      3|                    }
 2080|     33|                }
 2081|      3|            }
 2082|      3|        }
 2083|      2|    }
 2084|       |
 2085|    801|exit_function:
 2086|    801|    if (pnRad)
  ------------------
  |  Branch (2086:9): [True: 3, False: 798]
  ------------------
 2087|      3|    {
 2088|      3|        inchi_free( pnRad );
  ------------------
  |  | 1136|      3|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 3, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2089|      3|    }
 2090|    801|    if (pnDelta)
  ------------------
  |  Branch (2090:9): [True: 3, False: 798]
  ------------------
 2091|      3|    {
 2092|      3|        inchi_free( pnDelta );
  ------------------
  |  | 1136|      3|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 3, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2093|      3|    }
 2094|    801|    if (pCand)
  ------------------
  |  Branch (2094:9): [True: 2, False: 799]
  ------------------
 2095|      2|    {
 2096|      2|        inchi_free( pCand );
  ------------------
  |  | 1136|      2|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 2, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2097|      2|    }
 2098|       |
 2099|    801|    return ret;
 2100|      3|}
RearrangePlusMinusEdgesFlow:
 3404|    801|{
 3405|    801|    int ret, ePlus, eMinus;
 3406|    801|    EDGE_LIST NewlyFixedEdges;
 3407|    801|    BNS_EDGE *pPlus, *pMinus;
 3408|    801|    int i, k1, k2, num_found, num_tot, delta, v1, v2;
 3409|       |
 3410|    801|    ret = 0;
 3411|       |
 3412|    801|    AllocEdgeList( &NewlyFixedEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|    801|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 3413|  4.46k|    for (i = 0, num_found = num_tot = 0; i < pBNS->num_atoms; i++)
  ------------------
  |  Branch (3413:42): [True: 3.65k, False: 801]
  ------------------
 3414|  3.65k|    {
 3415|  3.65k|        eMinus = pVA[i].nCMinusGroupEdge - 1;
 3416|  3.65k|        ePlus = pVA[i].nCPlusGroupEdge - 1;
 3417|  3.65k|        num_tot += ( eMinus >= 0 ) + ( ePlus >= 0 );
 3418|  3.65k|        if (eMinus >= 0 && ePlus >= 0)
  ------------------
  |  Branch (3418:13): [True: 11, False: 3.64k]
  |  Branch (3418:28): [True: 10, False: 1]
  ------------------
 3419|     10|        {
 3420|     10|            pPlus = pBNS->edge + ePlus;
 3421|     10|            pMinus = pBNS->edge + eMinus;
 3422|     10|            if (( k1 = pMinus->flow ) > 0 && ( k2 = pPlus->cap - pPlus->flow ) > 0)
  ------------------
  |  Branch (3422:17): [True: 10, False: 0]
  |  Branch (3422:46): [True: 0, False: 10]
  ------------------
 3423|      0|            {
 3424|      0|                num_found++;
 3425|      0|            }
 3426|     10|        }
 3427|  3.65k|    }
 3428|    801|    if (!num_found)
  ------------------
  |  Branch (3428:9): [True: 801, False: 0]
  ------------------
 3429|    801|    {
 3430|    801|        goto exit_function;
 3431|    801|    }
 3432|      0|    if (ret = AllocEdgeList( &NewlyFixedEdges, num_tot + pBNS->num_bonds ))
  ------------------
  |  Branch (3432:9): [True: 0, False: 0]
  ------------------
 3433|      0|    {
 3434|      0|        goto exit_function;
 3435|      0|    }
 3436|       |
 3437|      0|    for (i = 0, num_found = num_tot = 0; i < pBNS->num_atoms; i++)
  ------------------
  |  Branch (3437:42): [True: 0, False: 0]
  ------------------
 3438|      0|    {
 3439|      0|        eMinus = pVA[i].nCMinusGroupEdge - 1;
 3440|      0|        ePlus = pVA[i].nCPlusGroupEdge - 1;
 3441|      0|        num_tot += ( eMinus >= 0 ) + ( ePlus >= 0 );
 3442|      0|        if (eMinus >= 0 && ePlus >= 0)
  ------------------
  |  Branch (3442:13): [True: 0, False: 0]
  |  Branch (3442:28): [True: 0, False: 0]
  ------------------
 3443|      0|        {
 3444|      0|            pPlus = pBNS->edge + ePlus;
 3445|      0|            pMinus = pBNS->edge + eMinus;
 3446|      0|            if (( k1 = pMinus->flow ) > 0 && ( k2 = pPlus->cap - pPlus->flow ) > 0)
  ------------------
  |  Branch (3446:17): [True: 0, False: 0]
  |  Branch (3446:46): [True: 0, False: 0]
  ------------------
 3447|      0|            {
 3448|       |                /* rearrange */
 3449|      0|                v1 = pMinus->neighbor1;
 3450|      0|                v2 = pMinus->neighbor12 ^ v1;
 3451|      0|                delta = inchi_min( k1, k2 );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3452|      0|                pMinus->flow -= delta;
 3453|      0|                pBNS->vert[v1].st_edge.flow -= delta;
 3454|      0|                pBNS->vert[v2].st_edge.flow -= delta;
 3455|      0|                pBNS->tot_st_flow -= 2 * delta;
 3456|      0|            }
 3457|       |            /* fix charges */
 3458|      0|            pPlus->forbidden |= forbidden_edge_mask;
 3459|      0|            pMinus->forbidden |= forbidden_edge_mask;
 3460|      0|            if (( ret = AddToEdgeList( &NewlyFixedEdges, eMinus, 0 ) ) ||
  ------------------
  |  Branch (3460:17): [True: 0, False: 0]
  ------------------
 3461|      0|                ( ret = AddToEdgeList( &NewlyFixedEdges, ePlus, 0 ) ))
  ------------------
  |  Branch (3461:17): [True: 0, False: 0]
  ------------------
 3462|      0|            {
 3463|      0|                goto exit_function;
 3464|      0|            }
 3465|      0|        }
 3466|      0|        else
 3467|      0|        {
 3468|      0|            if (eMinus >= 0)
  ------------------
  |  Branch (3468:17): [True: 0, False: 0]
  ------------------
 3469|      0|            {
 3470|       |                /* fix charges */
 3471|      0|                pMinus = pBNS->edge + eMinus;
 3472|      0|                pMinus->forbidden |= forbidden_edge_mask;
 3473|      0|                if (ret = AddToEdgeList( &NewlyFixedEdges, eMinus, 0 ))
  ------------------
  |  Branch (3473:21): [True: 0, False: 0]
  ------------------
 3474|      0|                {
 3475|      0|                    goto exit_function;
 3476|      0|                }
 3477|      0|            }
 3478|      0|            else
 3479|      0|            {
 3480|      0|                if (ePlus >= 0)
  ------------------
  |  Branch (3480:21): [True: 0, False: 0]
  ------------------
 3481|      0|                {
 3482|       |                    /* fix charges */
 3483|      0|                    pPlus = pBNS->edge + ePlus;
 3484|      0|                    pPlus->forbidden |= forbidden_edge_mask;
 3485|      0|                    if (ret = AddToEdgeList( &NewlyFixedEdges, ePlus, 0 ))
  ------------------
  |  Branch (3485:25): [True: 0, False: 0]
  ------------------
 3486|      0|                    {
 3487|      0|                        goto exit_function;
 3488|      0|                    }
 3489|      0|                }
 3490|      0|            }
 3491|      0|        }
 3492|      0|    }
 3493|      0|    for (i = 0; i < pBNS->num_bonds; i++)
  ------------------
  |  Branch (3493:17): [True: 0, False: 0]
  ------------------
 3494|      0|    {
 3495|      0|        pBNS->edge[i].forbidden |= forbidden_edge_mask;
 3496|      0|        if (ret = AddToEdgeList( &NewlyFixedEdges, i, 0 ))
  ------------------
  |  Branch (3496:13): [True: 0, False: 0]
  ------------------
 3497|      0|        {
 3498|      0|            goto exit_function;
 3499|      0|        }
 3500|      0|    }
 3501|      0|    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 3502|      0|    RemoveForbiddenEdgeMask( pBNS, &NewlyFixedEdges, forbidden_edge_mask );
 3503|      0|    if (ret < 0)
  ------------------
  |  Branch (3503:9): [True: 0, False: 0]
  ------------------
 3504|      0|    {
 3505|      0|        goto exit_function;
 3506|      0|    }
 3507|       |
 3508|    801|exit_function:
 3509|    801|    AllocEdgeList( &NewlyFixedEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|    801|#define EDGE_LIST_FREE   (-2)
  ------------------
 3510|       |
 3511|    801|    return ret;
 3512|      0|}
IncrementZeroOrderBondsToHeteroat:
 3526|    801|{
 3527|    801|#define FIX_BOND_ADD_ALLOC 128
 3528|    801|    Vertex     vPathStart, vPathEnd;
 3529|    801|    int        nPathLen, nDeltaH, nDeltaCharge, nNumVisitedAtoms;
 3530|    801|    BNS_EDGE   *pe, *peZero, *peNeighMeigh = NULL, *peMeFlower;
 3531|    801|    BNS_VERTEX *pMeFlower = NULL, *pNeigh = NULL, *pNeighNeigh = NULL;
 3532|       |
 3533|    801|    int i, j, k, ret2, ret, bFixedCarbonCharges, num_changes, bSuccess;
 3534|    801|    int num_at = pStruct->num_atoms;
 3535|    801|    int num_deleted_H = pStruct->num_deleted_H;
 3536|    801|    int len_at = num_at + num_deleted_H;
 3537|    801|    int inv_forbidden_edge_mask = ~forbidden_edge_mask;
 3538|    801|    Vertex vMeFlower0, vNeigh, vNeighMeigh = NO_VERTEX;
  ------------------
  |  |  146|    801|#define NO_VERTEX    -2
  ------------------
 3539|       |
 3540|    801|    EDGE_LIST CarbonChargeEdges;
 3541|    801|    EDGE_LIST NewlyFixedEdges;
 3542|       |
 3543|    801|    ret = 0;
 3544|    801|    num_changes = 0;
 3545|       |
 3546|    801|    bFixedCarbonCharges = 0;
 3547|    801|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|    801|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 3548|    801|    AllocEdgeList( &NewlyFixedEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|    801|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 3549|       |
 3550|    801|    if (!pTCGroups->num_metal_atoms ||
  ------------------
  |  Branch (3550:9): [True: 162, False: 639]
  ------------------
 3551|    801|         0 > ( k = pTCGroups->nGroup[TCG_MeFlower0] ) ||
  ------------------
  |  Branch (3551:10): [True: 639, False: 0]
  ------------------
 3552|    801|         0 > ( vMeFlower0 = pTCGroups->pTCG[k].nVertexNumber ))
  ------------------
  |  Branch (3552:10): [True: 0, False: 0]
  ------------------
 3553|    801|    {
 3554|    801|        goto exit_function;
 3555|    801|    }
 3556|       |
 3557|      0|    memcpy( at2, at, len_at * sizeof( at2[0] ) );
 3558|      0|    pStruct->at = at2;
 3559|      0|    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 3560|      0|    pStruct->at = at;
 3561|      0|    if (ret2 < 0)
  ------------------
  |  Branch (3561:9): [True: 0, False: 0]
  ------------------
 3562|      0|    {
 3563|      0|        ret = ret2;
 3564|      0|        goto exit_function;
 3565|      0|    }
 3566|      0|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (3566:17): [True: 0, False: 0]
  ------------------
 3567|      0|    {
 3568|      0|        if (!pVA[i].cMetal || pVA[i].nMetalGroupEdge <= 0)
  ------------------
  |  Branch (3568:13): [True: 0, False: 0]
  |  Branch (3568:31): [True: 0, False: 0]
  ------------------
 3569|      0|        {
 3570|      0|            continue;
 3571|      0|        }
 3572|      0|        peMeFlower = pBNS->edge + pVA[i].nMetalGroupEdge - 1;
 3573|      0|        if (vMeFlower0 != ( peMeFlower->neighbor12 ^ i ))
  ------------------
  |  Branch (3573:13): [True: 0, False: 0]
  ------------------
 3574|      0|        {
 3575|      0|            ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 3576|      0|            goto exit_function;
 3577|      0|        }
 3578|      0|        pMeFlower = pBNS->vert + vMeFlower0;
 3579|       |
 3580|      0|        for (j = 0; j < at2[i].valence; j++)
  ------------------
  |  Branch (3580:21): [True: 0, False: 0]
  ------------------
 3581|      0|        {
 3582|      0|            if (!peMeFlower->flow)
  ------------------
  |  Branch (3582:17): [True: 0, False: 0]
  ------------------
 3583|      0|            {
 3584|      0|                break; /* cannot do anything */
 3585|      0|            }
 3586|      0|            if (!( at2[i].bond_type[j] & BOND_TYPE_MASK ))
  ------------------
  |  |  217|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
  |  Branch (3586:17): [True: 0, False: 0]
  ------------------
 3587|      0|            {
 3588|       |                /* found a zero order bond */
 3589|      0|                if (!bFixedCarbonCharges)
  ------------------
  |  Branch (3589:21): [True: 0, False: 0]
  ------------------
 3590|      0|                {
 3591|       |                    /* do not let carbon atoms get charged */
 3592|      0|                    if (0 > ( ret = ForbidCarbonChargeEdges( pBNS, pTCGroups, &CarbonChargeEdges, forbidden_edge_mask ) ))
  ------------------
  |  Branch (3592:25): [True: 0, False: 0]
  ------------------
 3593|      0|                    {
 3594|      0|                        goto exit_function;
 3595|      0|                    }
 3596|      0|                    bFixedCarbonCharges++;
 3597|      0|                }
 3598|      0|                peZero = pBNS->edge + pBNS->vert[i].iedge[j];
 3599|      0|                if (peZero->flow)
  ------------------
  |  Branch (3599:21): [True: 0, False: 0]
  ------------------
 3600|      0|                {
 3601|      0|                    ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 3602|      0|                    goto exit_function;
 3603|      0|                }
 3604|       |                /* fix other edges */
 3605|      0|                for (k = 0; k < at2[i].valence; k++)
  ------------------
  |  Branch (3605:29): [True: 0, False: 0]
  ------------------
 3606|      0|                {
 3607|      0|                    pe = pBNS->edge + pBNS->vert[i].iedge[k];
 3608|      0|                    if (pe->flow == 1 && !( pe->forbidden & forbidden_edge_mask ))
  ------------------
  |  Branch (3608:25): [True: 0, False: 0]
  |  Branch (3608:42): [True: 0, False: 0]
  ------------------
 3609|      0|                    {
 3610|      0|                        if (ret = AddToEdgeList( &NewlyFixedEdges, (int) ( pe - pBNS->edge ), FIX_BOND_ADD_ALLOC ))
  ------------------
  |  | 3527|      0|#define FIX_BOND_ADD_ALLOC 128
  ------------------
  |  Branch (3610:29): [True: 0, False: 0]
  ------------------
 3611|      0|                        {
 3612|      0|                            goto exit_function;
 3613|      0|                        }
 3614|      0|                        pe->forbidden |= forbidden_edge_mask;
 3615|      0|                    }
 3616|      0|                }
 3617|       |                /* do not create =N(+)= in a ring or #O(+) terminal */
 3618|      0|                for (k = 0; k < num_at; k++)
  ------------------
  |  Branch (3618:29): [True: 0, False: 0]
  ------------------
 3619|      0|                {
 3620|      0|                    if (!pVA[k].cMetal && pVA[k].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (3620:25): [True: 0, False: 0]
  |  Branch (3620:43): [True: 0, False: 0]
  ------------------
 3621|      0|                         at2[k].valence == 2 && !at2[k].num_H && pVA[k].cMinRingSize <= 6 &&
  ------------------
  |  Branch (3621:26): [True: 0, False: 0]
  |  Branch (3621:49): [True: 0, False: 0]
  |  Branch (3621:66): [True: 0, False: 0]
  ------------------
 3622|      0|                         pVA[k].nCPlusGroupEdge > 0 &&
  ------------------
  |  Branch (3622:26): [True: 0, False: 0]
  ------------------
 3623|      0|                         ( pe = pBNS->edge + pVA[k].nCPlusGroupEdge - 1 )->flow == 1 &&
  ------------------
  |  Branch (3623:26): [True: 0, False: 0]
  ------------------
 3624|      0|                         !( pe->forbidden & forbidden_edge_mask ))
  ------------------
  |  Branch (3624:26): [True: 0, False: 0]
  ------------------
 3625|      0|                    {
 3626|       |
 3627|      0|                        if (ret = AddToEdgeList( &NewlyFixedEdges, (int) ( pe - pBNS->edge ), FIX_BOND_ADD_ALLOC ))
  ------------------
  |  | 3527|      0|#define FIX_BOND_ADD_ALLOC 128
  ------------------
  |  Branch (3627:29): [True: 0, False: 0]
  ------------------
 3628|      0|                        {
 3629|      0|                            goto exit_function;
 3630|      0|                        }
 3631|      0|                        pe->forbidden |= forbidden_edge_mask;
 3632|      0|                    }
 3633|      0|                }
 3634|       |
 3635|       |                /* metal's neighbor connected by a zero-order bond */
 3636|      0|                pNeigh = pBNS->vert + ( vNeigh = at2[i].neighbor[j] );
 3637|       |                /*for ( k = 0; k < pNeigh->num_adj_edges; k ++ )*/
 3638|      0|                for (k = pNeigh->num_adj_edges - 1; 0 <= k; k--)
  ------------------
  |  Branch (3638:53): [True: 0, False: 0]
  ------------------
 3639|      0|                {
 3640|      0|                    peNeighMeigh = pBNS->edge + pNeigh->iedge[k];
 3641|      0|                    if (!peNeighMeigh->flow)
  ------------------
  |  Branch (3641:25): [True: 0, False: 0]
  ------------------
 3642|      0|                    {
 3643|      0|                        continue;
 3644|      0|                    }
 3645|      0|                    vNeighMeigh = peNeighMeigh->neighbor12 ^ vNeigh;
 3646|      0|                    if (vNeighMeigh != i && vNeighMeigh != vMeFlower0)
  ------------------
  |  Branch (3646:25): [True: 0, False: 0]
  |  Branch (3646:45): [True: 0, False: 0]
  ------------------
 3647|      0|                    {
 3648|       |                        /* metal neighbor's neighbor connected by a not-zero-order bond */
 3649|      0|                        pNeighNeigh = pBNS->vert + vNeighMeigh;
 3650|      0|                        break; /* found */
 3651|      0|                    }
 3652|      0|                }
 3653|      0|                if (k < 0)
  ------------------
  |  Branch (3653:21): [True: 0, False: 0]
  ------------------
 3654|      0|                {
 3655|      0|                    continue; /* neighbor not found */
 3656|      0|                }
 3657|      0|                peZero->flow++;
 3658|      0|                peZero->forbidden |= forbidden_edge_mask;
 3659|      0|                peMeFlower->flow--;
 3660|      0|                peNeighMeigh->flow--;
 3661|      0|                pMeFlower->st_edge.flow--;
 3662|      0|                pNeighNeigh->st_edge.flow--;
 3663|      0|                pBNS->tot_st_flow -= 2;
 3664|       |                /* test */
 3665|      0|                bSuccess = 0;
 3666|      0|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 3667|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 3668|       |
 3669|      0|                if (ret == 1 && ( vPathEnd == vMeFlower0 && vPathStart == vNeighMeigh ||
  ------------------
  |  Branch (3669:21): [True: 0, False: 0]
  |  Branch (3669:35): [True: 0, False: 0]
  |  Branch (3669:61): [True: 0, False: 0]
  ------------------
 3670|      0|                    vPathEnd == vNeighMeigh && vPathStart == vMeFlower0 ) && abs( nDeltaCharge ) <= 2)
  ------------------
  |  Branch (3670:21): [True: 0, False: 0]
  |  Branch (3670:48): [True: 0, False: 0]
  |  Branch (3670:78): [True: 0, False: 0]
  ------------------
 3671|      0|                {
 3672|      0|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 3673|      0|                    if (ret > 0)
  ------------------
  |  Branch (3673:25): [True: 0, False: 0]
  ------------------
 3674|      0|                    {
 3675|      0|                        ( *pnNumRunBNS )++;
 3676|      0|                        *pnTotalDelta += ret;
 3677|      0|                        num_changes++;
 3678|      0|                        bSuccess = ret;
 3679|      0|                    }
 3680|      0|                    if (ret = AddToEdgeList( &NewlyFixedEdges, (int) ( peZero - pBNS->edge ), FIX_BOND_ADD_ALLOC ))
  ------------------
  |  | 3527|      0|#define FIX_BOND_ADD_ALLOC 128
  ------------------
  |  Branch (3680:25): [True: 0, False: 0]
  ------------------
 3681|      0|                    {
 3682|      0|                        goto exit_function;
 3683|      0|                    }
 3684|      0|                }
 3685|      0|                else
 3686|      0|                {
 3687|      0|                    peZero->flow--;
 3688|      0|                    peZero->forbidden &= inv_forbidden_edge_mask;
 3689|      0|                    peMeFlower->flow++;
 3690|      0|                    peNeighMeigh->flow++;
 3691|      0|                    pMeFlower->st_edge.flow++;
 3692|      0|                    pNeighNeigh->st_edge.flow++;
 3693|      0|                    pBNS->tot_st_flow += 2;
 3694|      0|                }
 3695|      0|                RemoveForbiddenEdgeMask( pBNS, &NewlyFixedEdges, forbidden_edge_mask );
 3696|      0|                NewlyFixedEdges.num_edges = 0;
 3697|      0|                if (bSuccess)
  ------------------
  |  Branch (3697:21): [True: 0, False: 0]
  ------------------
 3698|      0|                {
 3699|       |                    /* update at2[] */
 3700|      0|                    memcpy( at2, at, len_at * sizeof( at2[0] ) );
 3701|      0|                    pStruct->at = at2;
 3702|      0|                    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 3703|      0|                    pStruct->at = at;
 3704|      0|                    if (ret2 < 0)
  ------------------
  |  Branch (3704:25): [True: 0, False: 0]
  ------------------
 3705|      0|                    {
 3706|      0|                        ret = ret2;
 3707|      0|                        goto exit_function;
 3708|      0|                    }
 3709|      0|                }
 3710|      0|            }
 3711|      0|        }
 3712|      0|    }
 3713|      0|    ret = num_changes;
 3714|       |
 3715|    801|exit_function:
 3716|    801|    RemoveForbiddenEdgeMask( pBNS, &CarbonChargeEdges, forbidden_edge_mask );
 3717|    801|    RemoveForbiddenEdgeMask( pBNS, &NewlyFixedEdges, forbidden_edge_mask );
 3718|    801|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|    801|#define EDGE_LIST_FREE   (-2)
  ------------------
 3719|    801|    AllocEdgeList( &NewlyFixedEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|    801|#define EDGE_LIST_FREE   (-2)
  ------------------
 3720|       |
 3721|    801|    return ret;
 3722|      0|}
MovePlusFromS2DiaminoCarbon:
 3742|    801|{
 3743|    801|    int i, j, k, ret, ret2, cur_success;
 3744|    801|    int delta;
 3745|    801|    EdgeIndex        ePlusS, ePlusC, eMinusC, e;
 3746|    801|    BNS_VERTEX *pvS, *pvC, *pv1, *pv2;
 3747|    801|    BNS_EDGE   *pePlusS, *pePlusC, *pe1, *pe2, *peCN[3], *peSC, *pe;
 3748|    801|    Vertex     vC, vN;
 3749|       |
 3750|    801|    int num_at = pStruct->num_atoms;
 3751|    801|    int num_deleted_H = pStruct->num_deleted_H;
 3752|    801|    int len_at = num_at + num_deleted_H;
 3753|       |
 3754|    801|    Vertex     vPathStart, vPathEnd, v1, v2;
 3755|    801|    int        nPathLen, nDeltaH, nDeltaCharge, nNumVisitedAtoms;
 3756|       |
 3757|    801|    EDGE_LIST AllChargeEdges;
 3758|       |
 3759|    801|    ret = 0;
 3760|    801|    cur_success = 0;
 3761|       |
 3762|    801|    AllocEdgeList( &AllChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|    801|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 3763|       |
 3764|    801|    memcpy( at2, at, len_at * sizeof( at2[0] ) );
 3765|    801|    pStruct->at = at2;
 3766|    801|    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 3767|    801|    pStruct->at = at;
 3768|    801|    if (ret2 < 0)
  ------------------
  |  Branch (3768:9): [True: 0, False: 801]
  ------------------
 3769|      0|    {
 3770|      0|        ret = ret2;
 3771|      0|        goto exit_function;
 3772|      0|    }
 3773|       |    /* find (NH2)C=S(+) */
 3774|  4.46k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (3774:17): [True: 3.65k, False: 801]
  ------------------
 3775|  3.65k|    {
 3776|  3.65k|        if (!pVA[i].cMetal && pVA[i].cNumValenceElectrons == 6 &&
  ------------------
  |  Branch (3776:13): [True: 1.71k, False: 1.94k]
  |  Branch (3776:31): [True: 208, False: 1.50k]
  ------------------
 3777|  3.65k|             at2[i].valence == 2 &&
  ------------------
  |  Branch (3777:14): [True: 4, False: 204]
  ------------------
 3778|  3.65k|             ( pvS = pBNS->vert + i )->st_edge.cap == pvS->st_edge.flow &&
  ------------------
  |  Branch (3778:14): [True: 2, False: 2]
  ------------------
 3779|  3.65k|             0 <= ( ePlusS = pVA[i].nCPlusGroupEdge - 1 ) && !( pePlusS = pBNS->edge + ePlusS )->flow && /* S(+) */
  ------------------
  |  Branch (3779:14): [True: 2, False: 0]
  |  Branch (3779:62): [True: 0, False: 2]
  ------------------
 3780|  3.65k|             ( pe1 = pBNS->edge + pvS->iedge[0] )->flow +
  ------------------
  |  Branch (3780:14): [True: 0, False: 0]
  ------------------
 3781|      0|             ( pe2 = pBNS->edge + pvS->iedge[1] )->flow == 1 /* -S(+)= */ &&
 3782|  3.65k|             pVA[vC = ( peSC = pe1->flow ? pe1 : pe2 )->neighbor12 ^ i].cNumValenceElectrons == 4 &&
  ------------------
  |  Branch (3782:14): [True: 0, False: 0]
  |  Branch (3782:32): [True: 0, False: 0]
  ------------------
 3783|  3.65k|             at2[vC].valence == 3 &&
  ------------------
  |  Branch (3783:14): [True: 0, False: 0]
  ------------------
 3784|  3.65k|             0 <= ( ePlusC = pVA[vC].nCPlusGroupEdge - 1 ) && ( pePlusC = pBNS->edge + ePlusC )->flow &&
  ------------------
  |  Branch (3784:14): [True: 0, False: 0]
  |  Branch (3784:63): [True: 0, False: 0]
  ------------------
 3785|  3.65k|             !( 0 <= ( eMinusC = pVA[vC].nCMinusGroupEdge - 1 ) && pBNS->edge[eMinusC].flow ))
  ------------------
  |  Branch (3785:17): [True: 0, False: 0]
  |  Branch (3785:68): [True: 0, False: 0]
  ------------------
 3786|      0|        {
 3787|       |            /* found >C=S(+)- */
 3788|      0|            pvC = pBNS->vert + vC;
 3789|      0|            for (j = k = 0; j < at[vC].valence; j++)
  ------------------
  |  Branch (3789:29): [True: 0, False: 0]
  ------------------
 3790|      0|            {
 3791|      0|                if (peSC != ( peCN[k] = pBNS->edge + pvC->iedge[j] ) && !peCN[k]->flow)
  ------------------
  |  Branch (3791:21): [True: 0, False: 0]
  |  Branch (3791:73): [True: 0, False: 0]
  ------------------
 3792|      0|                {
 3793|      0|                    k++; /* a single bond from C */
 3794|      0|                }
 3795|      0|            }
 3796|      0|            if (k != 2)
  ------------------
  |  Branch (3796:17): [True: 0, False: 0]
  ------------------
 3797|      0|            {
 3798|      0|                continue;
 3799|      0|            }
 3800|      0|            for (j = 0; j < k; j++)
  ------------------
  |  Branch (3800:25): [True: 0, False: 0]
  ------------------
 3801|      0|            {
 3802|      0|                vN = peCN[j]->neighbor12 ^ vC;
 3803|      0|                if (pVA[vN].cNumValenceElectrons != 5 ||
  ------------------
  |  Branch (3803:21): [True: 0, False: 0]
  ------------------
 3804|      0|                     pBNS->vert[vN].st_edge.cap != pBNS->vert[vN].st_edge.flow ||
  ------------------
  |  Branch (3804:22): [True: 0, False: 0]
  ------------------
 3805|      0|                     at2[vN].num_H != 2 ||
  ------------------
  |  Branch (3805:22): [True: 0, False: 0]
  ------------------
 3806|      0|                     at2[vN].endpoint || ( pStruct->endpoint && pStruct->endpoint[vN] ))
  ------------------
  |  Branch (3806:22): [True: 0, False: 0]
  |  Branch (3806:44): [True: 0, False: 0]
  |  Branch (3806:65): [True: 0, False: 0]
  ------------------
 3807|      0|                {
 3808|      0|                    break; /* does not fit the pattern */
 3809|      0|                }
 3810|      0|            }
 3811|      0|            if (j != k)
  ------------------
  |  Branch (3811:17): [True: 0, False: 0]
  ------------------
 3812|      0|            {
 3813|      0|                continue;
 3814|      0|            }
 3815|       |            /* fix all charges */
 3816|      0|            if (!AllChargeEdges.num_edges)
  ------------------
  |  Branch (3816:17): [True: 0, False: 0]
  ------------------
 3817|      0|            {
 3818|      0|                for (j = 0; j < num_at; j++)
  ------------------
  |  Branch (3818:29): [True: 0, False: 0]
  ------------------
 3819|      0|                {
 3820|      0|                    if (0 <= ( e = pVA[j].nCPlusGroupEdge - 1 ) && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (3820:25): [True: 0, False: 0]
  |  Branch (3820:68): [True: 0, False: 0]
  ------------------
 3821|      0|                        ( ret = AddToEdgeList( &AllChargeEdges, e, 2 * num_at ) ))
  ------------------
  |  Branch (3821:25): [True: 0, False: 0]
  ------------------
 3822|      0|                    {
 3823|      0|                        goto exit_function;
 3824|      0|                    }
 3825|      0|                    if (0 <= ( e = pVA[j].nCMinusGroupEdge - 1 ) && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (3825:25): [True: 0, False: 0]
  |  Branch (3825:69): [True: 0, False: 0]
  ------------------
 3826|      0|                        ( ret = AddToEdgeList( &AllChargeEdges, e, 2 * num_at ) ))
  ------------------
  |  Branch (3826:25): [True: 0, False: 0]
  ------------------
 3827|      0|                    {
 3828|      0|                        goto exit_function;
 3829|      0|                    }
 3830|      0|                }
 3831|      0|            }
 3832|      0|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 3833|      0|            pePlusS->forbidden &= ~forbidden_edge_mask;
 3834|      0|            pe = pePlusC;
 3835|      0|            if (!pe->flow)
  ------------------
  |  Branch (3835:17): [True: 0, False: 0]
  ------------------
 3836|      0|                continue;
 3837|      0|            delta = 1;
 3838|      0|            pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 3839|      0|            pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 3840|       |
 3841|      0|            pe->flow -= delta;
 3842|      0|            pv1->st_edge.flow -= delta;
 3843|      0|            pv2->st_edge.flow -= delta;
 3844|      0|            pBNS->tot_st_flow -= 2 * delta;
 3845|       |
 3846|      0|            ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 3847|      0|                                  &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 3848|       |
 3849|      0|            if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (3849:17): [True: 0, False: 0]
  |  Branch (3849:31): [True: 0, False: 0]
  |  Branch (3849:49): [True: 0, False: 0]
  ------------------
 3850|      0|                vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == -1)
  ------------------
  |  Branch (3850:17): [True: 0, False: 0]
  |  Branch (3850:35): [True: 0, False: 0]
  |  Branch (3850:57): [True: 0, False: 0]
  ------------------
 3851|      0|            {
 3852|       |                /* Remover (+)charge from S => nDeltaCharge == -1 */
 3853|       |                /* Flow change on pe (+)charge edge (atom S) is not known to RunBnsTestOnce()) */
 3854|      0|                ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 3855|      0|                if (ret > 0)
  ------------------
  |  Branch (3855:21): [True: 0, False: 0]
  ------------------
 3856|      0|                {
 3857|      0|                    ( *pnNumRunBNS )++;
 3858|      0|                    cur_success++;
 3859|      0|                }
 3860|      0|            }
 3861|      0|            else
 3862|      0|            {
 3863|      0|                pe->flow += delta;
 3864|      0|                pv1->st_edge.flow += delta;
 3865|      0|                pv2->st_edge.flow += delta;
 3866|      0|                pBNS->tot_st_flow += 2 * delta;
 3867|      0|            }
 3868|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 3869|      0|        }
 3870|  3.65k|    }
 3871|    801|exit_function:
 3872|    801|    AllocEdgeList( &AllChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|    801|#define EDGE_LIST_FREE   (-2)
  ------------------
 3873|       |
 3874|    801|    return ret;
 3875|    801|}
EliminateChargeSeparationOnHeteroatoms:
 3891|    801|{
 3892|    801|    int i, j, k, ret, ret2, num_pos, num_neg, num_min = 0, bFixedCarbonCharges;
 3893|    801|    int vPlusSuper;  /* (+)super vertex */
 3894|    801|    int ePlusSuper;  /* edge from vPlusSuper to (+/-) */
 3895|    801|    int vPlusMinus;  /* (+/-) vertex */
 3896|    801|    int nDeltaPlus1, nDeltaMinus1, delta;
 3897|    801|    BNS_VERTEX *pvPlusSuper, *pvPlusMinus;
 3898|    801|    BNS_EDGE   *pEdge;
 3899|       |
 3900|    801|    int num_at = pStruct->num_atoms;
 3901|    801|    int num_deleted_H = pStruct->num_deleted_H;
 3902|    801|    int len_at = num_at + num_deleted_H;
 3903|    801|    int inv_forbidden_edge_mask = ~forbidden_edge_mask;
 3904|       |
 3905|    801|    Vertex     vPathStart, vPathEnd;
 3906|    801|    int        nPathLen, nDeltaH, nDeltaCharge, nNumVisitedAtoms;
 3907|       |
 3908|    801|    EDGE_LIST FixedLargeRingStereoEdges, CarbonChargeEdges;
 3909|       |
 3910|    801|    ret = 0;
 3911|       |
 3912|    801|    AllocEdgeList( &FixedLargeRingStereoEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|    801|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 3913|    801|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|    801|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 3914|    801|    bFixedCarbonCharges = 0;
 3915|       |
 3916|    801|    if (forbidden_stereo_edge_mask)
  ------------------
  |  Branch (3916:9): [True: 0, False: 801]
  ------------------
 3917|      0|    {
 3918|      0|        for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (3918:21): [True: 0, False: 0]
  ------------------
 3919|      0|        {
 3920|      0|            for (j = 0; j < at2[i].valence; j++)
  ------------------
  |  Branch (3920:25): [True: 0, False: 0]
  ------------------
 3921|      0|            {
 3922|      0|                if (pBNS->edge[k = pBNS->vert[i].iedge[j]].forbidden == forbidden_stereo_edge_mask)
  ------------------
  |  Branch (3922:21): [True: 0, False: 0]
  ------------------
 3923|      0|                {
 3924|      0|                    int nMinRingSize = is_bond_in_Nmax_memb_ring( at2, i, j, pStruct->pbfsq->q,
 3925|      0|                                                             pStruct->pbfsq->nAtomLevel,
 3926|      0|                                                             pStruct->pbfsq->cSource, 99 /* max ring size */ );
 3927|      0|                    if (0 < nMinRingSize && ( ret = AddToEdgeList( &FixedLargeRingStereoEdges, k, 64 ) ))
  ------------------
  |  Branch (3927:25): [True: 0, False: 0]
  |  Branch (3927:45): [True: 0, False: 0]
  ------------------
 3928|      0|                    {
 3929|      0|                        goto exit_function;
 3930|      0|                    }
 3931|      0|                }
 3932|      0|            }
 3933|      0|        }
 3934|      0|        if (!FixedLargeRingStereoEdges.num_edges)
  ------------------
  |  Branch (3934:13): [True: 0, False: 0]
  ------------------
 3935|      0|        {
 3936|      0|            goto exit_function;
 3937|      0|        }
 3938|      0|        else
 3939|      0|        {
 3940|       |             /* allow stereobonds in rings change */
 3941|      0|            RemoveForbiddenEdgeMask( pBNS, &FixedLargeRingStereoEdges, forbidden_stereo_edge_mask );
 3942|      0|        }
 3943|      0|    }
 3944|       |
 3945|    801|    memcpy( at2, at, len_at * sizeof( at2[0] ) );
 3946|    801|    pStruct->at = at2;
 3947|    801|    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 3948|    801|    pStruct->at = at;
 3949|    801|    if (ret2 < 0)
  ------------------
  |  Branch (3949:9): [True: 0, False: 801]
  ------------------
 3950|      0|    {
 3951|      0|        ret = ret2;
 3952|      0|        goto exit_function;
 3953|      0|    }
 3954|       |    /* count charges */
 3955|    801|    num_pos = num_neg = 0;
 3956|  4.46k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (3956:17): [True: 3.65k, False: 801]
  ------------------
 3957|  3.65k|    {
 3958|  3.65k|        if (!pVA[i].cMetal && !at2[i].radical)
  ------------------
  |  Branch (3958:13): [True: 1.71k, False: 1.94k]
  |  Branch (3958:31): [True: 1.70k, False: 3]
  ------------------
 3959|  1.70k|        {
 3960|  1.70k|            num_pos += ( at2[i].charge > 0 );
 3961|  1.70k|            num_neg += ( at2[i].charge < 0 );
 3962|  1.70k|        }
 3963|  3.65k|    }
 3964|    801|    num_min = inchi_min( num_pos, num_neg );
  ------------------
  |  |  167|    801|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 3, False: 798]
  |  |  ------------------
  ------------------
 3965|       |
 3966|       |
 3967|    801|    if (num_min &&
  ------------------
  |  Branch (3967:9): [True: 0, False: 801]
  ------------------
 3968|    801|        ( k = pTCGroups->nGroup[TCG_Plus] ) >= 0 &&
  ------------------
  |  Branch (3968:9): [True: 0, False: 0]
  ------------------
 3969|    801|        ( ePlusSuper = pTCGroups->pTCG[k].nForwardEdge ) > 0 &&
  ------------------
  |  Branch (3969:9): [True: 0, False: 0]
  ------------------
 3970|    801|        ( vPlusSuper = pTCGroups->pTCG[k].nVertexNumber ) >= num_at &&
  ------------------
  |  Branch (3970:9): [True: 0, False: 0]
  ------------------
 3971|    801|         !( pEdge = pBNS->edge + ePlusSuper )->forbidden)
  ------------------
  |  Branch (3971:10): [True: 0, False: 0]
  ------------------
 3972|      0|    {
 3973|       |
 3974|      0|        vPlusMinus = pEdge->neighbor12 ^ vPlusSuper;
 3975|      0|        pvPlusSuper = pBNS->vert + vPlusSuper;
 3976|      0|        pvPlusMinus = pBNS->vert + vPlusMinus;
 3977|      0|        num_min = inchi_min( num_min, pEdge->flow );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3978|      0|        nDeltaPlus1 = pvPlusSuper->st_edge.cap - pvPlusSuper->st_edge.flow;
 3979|      0|        nDeltaMinus1 = pvPlusMinus->st_edge.cap - pvPlusMinus->st_edge.flow;
 3980|      0|        if (num_min && ( !nDeltaPlus1 && !nDeltaMinus1 ))
  ------------------
  |  Branch (3980:13): [True: 0, False: 0]
  |  Branch (3980:26): [True: 0, False: 0]
  |  Branch (3980:42): [True: 0, False: 0]
  ------------------
 3981|      0|        {
 3982|      0|            if (!bFixedCarbonCharges)
  ------------------
  |  Branch (3982:17): [True: 0, False: 0]
  ------------------
 3983|      0|            { /* 02-02-2006 */
 3984|       |              /* do not let carbon atoms get charged */
 3985|      0|                if (0 > ( ret = ForbidCarbonChargeEdges( pBNS, pTCGroups, &CarbonChargeEdges, forbidden_edge_mask ) ))
  ------------------
  |  Branch (3985:21): [True: 0, False: 0]
  ------------------
 3986|      0|                {
 3987|      0|                    goto exit_function;
 3988|      0|                }
 3989|      0|                bFixedCarbonCharges++;
 3990|      0|            }
 3991|      0|            delta = 1;
 3992|      0|            pEdge->forbidden |= forbidden_edge_mask;
 3993|      0|            pBNS->edge_forbidden_mask |= forbidden_edge_mask;
 3994|      0|            for (i = 0; i < num_min; i += delta)
  ------------------
  |  Branch (3994:25): [True: 0, False: 0]
  ------------------
 3995|      0|            {
 3996|       |                /* cancel 1 pair of charges at a time   */
 3997|       |                /* an attempt to cancel all at once may */
 3998|       |                /* convert a pair of N(IV)(+) into a pair of N(V) neutral with total charge reduced by 2 */
 3999|      0|                pEdge->flow -= delta;
 4000|      0|                pvPlusSuper->st_edge.flow -= delta;
 4001|      0|                pvPlusMinus->st_edge.flow -= delta;
 4002|      0|                pBNS->tot_st_flow -= 2 * delta;
 4003|       |                /* test for charhe cancellation */
 4004|      0|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 4005|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 4006|      0|                if (ret < 0)
  ------------------
  |  Branch (4006:21): [True: 0, False: 0]
  ------------------
 4007|      0|                {
 4008|      0|                    goto exit_function;
 4009|      0|                }
 4010|      0|                if (ret == 1 && ( vPathEnd == vPlusSuper && vPathStart == vPlusMinus ||
  ------------------
  |  Branch (4010:21): [True: 0, False: 0]
  |  Branch (4010:35): [True: 0, False: 0]
  |  Branch (4010:61): [True: 0, False: 0]
  ------------------
 4011|      0|                    vPathEnd == vPlusMinus && vPathStart == vPlusSuper ) && nDeltaCharge < 0)
  ------------------
  |  Branch (4011:21): [True: 0, False: 0]
  |  Branch (4011:47): [True: 0, False: 0]
  |  Branch (4011:77): [True: 0, False: 0]
  ------------------
 4012|      0|                {
 4013|      0|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 4014|      0|                    ( *pnNumRunBNS )++;
 4015|      0|                    if (ret < 0)
  ------------------
  |  Branch (4015:25): [True: 0, False: 0]
  ------------------
 4016|      0|                    {
 4017|      0|                        goto exit_function;
 4018|      0|                    }
 4019|      0|                    else
 4020|      0|                        if (ret == 1)
  ------------------
  |  Branch (4020:29): [True: 0, False: 0]
  ------------------
 4021|      0|                        {
 4022|      0|                            *pnTotalDelta += ret;
 4023|      0|                        }
 4024|      0|                        else
 4025|      0|                        {
 4026|      0|                            ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 4027|      0|                            goto exit_function;
 4028|      0|                        }
 4029|      0|                }
 4030|      0|                else
 4031|      0|                {
 4032|      0|                    pEdge->flow += delta;
 4033|      0|                    pvPlusSuper->st_edge.flow += delta;
 4034|      0|                    pvPlusMinus->st_edge.flow += delta;
 4035|      0|                    pBNS->tot_st_flow += 2 * delta;
 4036|      0|                    break;
 4037|      0|                }
 4038|      0|            }
 4039|      0|            num_min -= i; /* how many pairs of charges left */
 4040|      0|            pEdge->forbidden &= inv_forbidden_edge_mask;
 4041|      0|        }
 4042|      0|        nDeltaPlus1 = pvPlusSuper->st_edge.cap - pvPlusSuper->st_edge.flow;
 4043|      0|        nDeltaMinus1 = pvPlusMinus->st_edge.cap - pvPlusMinus->st_edge.flow;
 4044|      0|        if (num_min > 1 && ( !nDeltaPlus1 && !nDeltaMinus1 ))
  ------------------
  |  Branch (4044:13): [True: 0, False: 0]
  |  Branch (4044:30): [True: 0, False: 0]
  |  Branch (4044:46): [True: 0, False: 0]
  ------------------
 4045|      0|        {
 4046|      0|            delta = 2;
 4047|      0|            pEdge->forbidden |= forbidden_edge_mask;
 4048|      0|            pBNS->edge_forbidden_mask |= forbidden_edge_mask;
 4049|      0|            for (i = 0; i < num_min; i += delta)
  ------------------
  |  Branch (4049:25): [True: 0, False: 0]
  ------------------
 4050|      0|            {
 4051|       |                /* cancel 2 pairs of opposite charges at a time   */
 4052|       |                /* 1. test cancellation of a pair of (+) charges */
 4053|      0|                pvPlusSuper->st_edge.cap += delta;
 4054|      0|                pBNS->tot_st_cap += delta;
 4055|      0|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 4056|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 4057|      0|                if (ret < 0)
  ------------------
  |  Branch (4057:21): [True: 0, False: 0]
  ------------------
 4058|      0|                {
 4059|      0|                    goto exit_function;
 4060|      0|                }
 4061|      0|                pvPlusSuper->st_edge.cap -= delta;
 4062|      0|                pBNS->tot_st_cap -= delta;
 4063|      0|                if (ret != 1 || ( vPathEnd != vPlusSuper || vPathStart != vPlusSuper ) || nDeltaCharge >= 0)
  ------------------
  |  Branch (4063:21): [True: 0, False: 0]
  |  Branch (4063:35): [True: 0, False: 0]
  |  Branch (4063:61): [True: 0, False: 0]
  |  Branch (4063:91): [True: 0, False: 0]
  ------------------
 4064|      0|                {
 4065|      0|                    break;
 4066|      0|                }
 4067|       |                /* 2. test cancellation of a pair of (-) charges */
 4068|      0|                pvPlusMinus->st_edge.cap += delta;
 4069|      0|                pBNS->tot_st_cap += delta;
 4070|      0|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 4071|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 4072|      0|                if (ret < 0)
  ------------------
  |  Branch (4072:21): [True: 0, False: 0]
  ------------------
 4073|      0|                {
 4074|      0|                    goto exit_function;
 4075|      0|                }
 4076|      0|                pvPlusMinus->st_edge.cap -= delta;
 4077|      0|                pBNS->tot_st_cap -= delta;
 4078|      0|                if (ret != 1 || ( vPathEnd != vPlusMinus || vPathStart != vPlusMinus ) || nDeltaCharge >= 0)
  ------------------
  |  Branch (4078:21): [True: 0, False: 0]
  |  Branch (4078:35): [True: 0, False: 0]
  |  Branch (4078:61): [True: 0, False: 0]
  |  Branch (4078:91): [True: 0, False: 0]
  ------------------
 4079|      0|                {
 4080|      0|                    break;
 4081|      0|                }
 4082|       |                /* 3. Actually cancel the pair of charges */
 4083|      0|                pEdge->flow -= delta;
 4084|      0|                pvPlusSuper->st_edge.flow -= delta;
 4085|      0|                pvPlusMinus->st_edge.flow -= delta;
 4086|      0|                pBNS->tot_st_flow -= 2 * delta;
 4087|      0|                ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 4088|      0|                ( *pnNumRunBNS )++;
 4089|      0|                if (ret < 0)
  ------------------
  |  Branch (4089:21): [True: 0, False: 0]
  ------------------
 4090|      0|                {
 4091|      0|                    goto exit_function;
 4092|      0|                }
 4093|      0|                else
 4094|      0|                {
 4095|      0|                    if (ret == 2)
  ------------------
  |  Branch (4095:25): [True: 0, False: 0]
  ------------------
 4096|      0|                    {
 4097|      0|                        *pnTotalDelta += ret;
 4098|      0|                    }
 4099|      0|                    else
 4100|      0|                    {
 4101|      0|                        ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 4102|      0|                        goto exit_function;
 4103|      0|                    }
 4104|      0|                }
 4105|      0|            }
 4106|      0|            num_min -= i; /* how many pairs of charges left */
 4107|      0|            pEdge->forbidden &= inv_forbidden_edge_mask;
 4108|      0|        }
 4109|      0|    }
 4110|    801|    memcpy( at2, at, len_at * sizeof( at2[0] ) );
 4111|    801|    pStruct->at = at;
 4112|       |
 4113|    801|exit_function:
 4114|    801|    if (bFixedCarbonCharges)
  ------------------
  |  Branch (4114:9): [True: 0, False: 801]
  ------------------
 4115|      0|    {
 4116|      0|        RemoveForbiddenEdgeMask( pBNS, &CarbonChargeEdges, forbidden_edge_mask );
 4117|      0|        AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|      0|#define EDGE_LIST_FREE   (-2)
  ------------------
 4118|      0|    }
 4119|    801|    if (forbidden_stereo_edge_mask && FixedLargeRingStereoEdges.num_edges)
  ------------------
  |  Branch (4119:9): [True: 0, False: 801]
  |  Branch (4119:39): [True: 0, False: 0]
  ------------------
 4120|      0|    {
 4121|      0|        SetForbiddenEdgeMask( pBNS, &FixedLargeRingStereoEdges, forbidden_stereo_edge_mask );
 4122|      0|    }
 4123|    801|    AllocEdgeList( &FixedLargeRingStereoEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|    801|#define EDGE_LIST_FREE   (-2)
  ------------------
 4124|       |
 4125|    801|    return ret < 0 ? ret : num_min;
  ------------------
  |  Branch (4125:12): [True: 0, False: 801]
  ------------------
 4126|    801|}
RestoreCyanoGroup:
 4559|    801|{
 4560|    801|    Vertex     vPathStart, vPathEnd;
 4561|    801|    int        nPathLen, nDeltaH, nDeltaCharge, nNumVisitedAtoms;
 4562|    801|    BNS_EDGE  *pe;
 4563|       |
 4564|    801|    int i, j, ret2, ret;
 4565|    801|    int num_at = pStruct->num_atoms;
 4566|    801|    int num_deleted_H = pStruct->num_deleted_H;
 4567|    801|    int len_at = num_at + num_deleted_H;
 4568|    801|    int inv_forbidden_edge_mask = ~forbidden_edge_mask;
 4569|    801|    Vertex v1, v2;
 4570|       |
 4571|    801|    EDGE_LIST CarbonChargeEdges;
 4572|       |
 4573|    801|    ret = 0;
 4574|    801|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|    801|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 4575|       |
 4576|    801|    memcpy( at2, at, len_at * sizeof( at2[0] ) );
 4577|    801|    pStruct->at = at2;
 4578|    801|    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 4579|    801|    pStruct->at = at;
 4580|    801|    if (ret2 < 0)
  ------------------
  |  Branch (4580:9): [True: 0, False: 801]
  ------------------
 4581|      0|    {
 4582|      0|        ret = ret2;
 4583|      0|        goto exit_function;
 4584|      0|    }
 4585|       |
 4586|  4.46k|    for (i = 0; i < num_at && 0 <= ret; i++)
  ------------------
  |  Branch (4586:17): [True: 3.65k, False: 801]
  |  Branch (4586:31): [True: 3.65k, False: 0]
  ------------------
 4587|  3.65k|    {
 4588|  3.65k|        if (at2[i].valence == 1 &&
  ------------------
  |  Branch (4588:13): [True: 6, False: 3.65k]
  ------------------
 4589|  3.65k|             at2[i].num_H == 0 &&
  ------------------
  |  Branch (4589:14): [True: 6, False: 0]
  ------------------
 4590|  3.65k|             at2[i].chem_bonds_valence == 2 &&
  ------------------
  |  Branch (4590:14): [True: 0, False: 6]
  ------------------
 4591|  3.65k|             at2[i].charge == -1 &&
  ------------------
  |  Branch (4591:14): [True: 0, False: 0]
  ------------------
 4592|  3.65k|             at2[i].radical == 0 &&
  ------------------
  |  Branch (4592:14): [True: 0, False: 0]
  ------------------
 4593|  3.65k|             pVA[i].cNumValenceElectrons == 5 &&  /* terminal N(-)=, P, As, Sb, Bi */
  ------------------
  |  Branch (4593:14): [True: 0, False: 0]
  ------------------
 4594|  3.65k|             pVA[i].nCMinusGroupEdge > 0 &&
  ------------------
  |  Branch (4594:14): [True: 0, False: 0]
  ------------------
 4595|  3.65k|             pVA[i].nTautGroupEdge == 0 &&
  ------------------
  |  Branch (4595:14): [True: 0, False: 0]
  ------------------
 4596|  3.65k|             at2[j = at2[i].neighbor[0]].valence == 2 &&
  ------------------
  |  Branch (4596:14): [True: 0, False: 0]
  ------------------
 4597|  3.65k|             at2[j].num_H == 0 &&
  ------------------
  |  Branch (4597:14): [True: 0, False: 0]
  ------------------
 4598|  3.65k|             at2[j].chem_bonds_valence == 4 &&
  ------------------
  |  Branch (4598:14): [True: 0, False: 0]
  ------------------
 4599|  3.65k|             at2[j].charge == 0 &&
  ------------------
  |  Branch (4599:14): [True: 0, False: 0]
  ------------------
 4600|  3.65k|             at2[j].radical == 0 &&
  ------------------
  |  Branch (4600:14): [True: 0, False: 0]
  ------------------
 4601|  3.65k|             pVA[j].cNumValenceElectrons == 4 && /* C or Si or Ge or Sn or Pb */
  ------------------
  |  Branch (4601:14): [True: 0, False: 0]
  ------------------
 4602|  3.65k|             pVA[i].cnListIndex > 0 &&
  ------------------
  |  Branch (4602:14): [True: 0, False: 0]
  ------------------
 4603|  3.65k|             cnList[pVA[i].cnListIndex - 1].bits == cn_bits_MN)
  ------------------
  |  |  464|      0|#define cn_bits_MN  MAKE_CN_BITS(cn_bits_M, cn_bits_N, 0, 0)
  |  |  ------------------
  |  |  |  |  449|      0|#define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  |  |  ------------------
  |  |  |  |  |  |  447|      0|#define cn_bits_shift 3
  |  |  |  |  ------------------
  |  |  |  |               #define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  |  |  ------------------
  |  |  |  |  |  |  447|      0|#define cn_bits_shift 3
  |  |  |  |  ------------------
  |  |  |  |               #define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  |  |  ------------------
  |  |  |  |  |  |  447|      0|#define cn_bits_shift 3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4603:14): [True: 0, False: 0]
  ------------------
 4604|      0|        {
 4605|       |            /* found N(-)=C= */
 4606|      0|            pe = pBNS->edge + ( pVA[i].nCMinusGroupEdge - 1 ); /* N#N(+) triple bond edge */
 4607|       |
 4608|      0|            if (!pe->flow)
  ------------------
  |  Branch (4608:17): [True: 0, False: 0]
  ------------------
 4609|      0|            {
 4610|      0|                continue; /* wrong atom ??? Strange... */
 4611|      0|            }
 4612|      0|            v1 = pe->neighbor1;
 4613|      0|            v2 = pe->neighbor12 ^ v1;
 4614|      0|            pe->flow--;
 4615|      0|            pBNS->vert[v1].st_edge.flow--;
 4616|      0|            pBNS->vert[v2].st_edge.flow--;
 4617|      0|            pBNS->tot_st_flow -= 2;
 4618|      0|            pe->forbidden |= forbidden_edge_mask;
 4619|       |
 4620|       |            /* do not let carbon atoms get charged */
 4621|      0|            if (0 > ( ret = ForbidCarbonChargeEdges( pBNS, pTCGroups, &CarbonChargeEdges, forbidden_edge_mask ) ))
  ------------------
  |  Branch (4621:17): [True: 0, False: 0]
  ------------------
 4622|      0|            {
 4623|      0|                goto exit_function;
 4624|      0|            }
 4625|       |
 4626|      0|            ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 4627|      0|                                  &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 4628|       |
 4629|      0|            if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (4629:17): [True: 0, False: 0]
  |  Branch (4629:31): [True: 0, False: 0]
  |  Branch (4629:49): [True: 0, False: 0]
  ------------------
 4630|      0|                vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == 1)
  ------------------
  |  Branch (4630:17): [True: 0, False: 0]
  |  Branch (4630:35): [True: 0, False: 0]
  |  Branch (4630:57): [True: 0, False: 0]
  ------------------
 4631|      0|            {
 4632|      0|                ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 4633|      0|                ( *pnNumRunBNS )++;
 4634|      0|                *pnTotalDelta += ret;
 4635|      0|            }
 4636|      0|            else
 4637|      0|            {
 4638|      0|                pe->flow++;
 4639|      0|                pBNS->vert[v1].st_edge.flow++;
 4640|      0|                pBNS->vert[v2].st_edge.flow++;
 4641|      0|                pBNS->tot_st_flow += 2;
 4642|      0|            }
 4643|      0|            RemoveForbiddenEdgeMask( pBNS, &CarbonChargeEdges, forbidden_edge_mask );
 4644|       |
 4645|      0|            pe->forbidden &= inv_forbidden_edge_mask; /* unmask the edges */
 4646|      0|        }
 4647|  3.65k|    }
 4648|       |
 4649|    801|exit_function:
 4650|       |
 4651|    801|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|    801|#define EDGE_LIST_FREE   (-2)
  ------------------
 4652|       |
 4653|    801|    return ret;
 4654|    801|}
RestoreIsoCyanoGroup:
 4668|    801|{
 4669|    801|#define INC_EDGE_LIST 16
 4670|    801|    Vertex     vPathStart, vPathEnd;
 4671|    801|    int        nPathLen, nDeltaH, nDeltaCharge, nNumVisitedAtoms, num_failed, num_success;
 4672|    801|    BNS_EDGE  *pe;
 4673|    801|    Vertex    v1, v2;
 4674|       |
 4675|    801|    int i, j, ret2, ret, bIsCarbon;
 4676|    801|    int num_at = pStruct->num_atoms;
 4677|    801|    int num_deleted_H = pStruct->num_deleted_H;
 4678|    801|    int len_at = num_at + num_deleted_H;
 4679|    801|    int inv_forbidden_edge_mask = ~forbidden_edge_mask;
 4680|    801|    EdgeIndex eNMinusEdge, eNPlusEdge, eNPlusEdge1, eN34Edge;
 4681|    801|    EdgeIndex eNFlowerEdge1;
 4682|       |
 4683|    801|    EDGE_LIST CarbonChargeEdges, AllChargeEdges, IsoCyanoCarbonChargeEdges;
 4684|       |
 4685|    801|    ret = 0;
 4686|    801|    num_failed = num_success = 0;
 4687|    801|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_CLEAR ); /* carbon charge edges */
  ------------------
  |  |  270|    801|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 4688|    801|    AllocEdgeList( &AllChargeEdges, EDGE_LIST_CLEAR );    /* heteroatom charge edges */
  ------------------
  |  |  270|    801|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 4689|    801|    AllocEdgeList( &IsoCyanoCarbonChargeEdges, EDGE_LIST_CLEAR );   /* C in C(+)#N(+) charge edges */
  ------------------
  |  |  270|    801|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 4690|       |
 4691|    801|    memcpy( at2, at, len_at * sizeof( at2[0] ) );
 4692|    801|    pStruct->at = at2;
 4693|    801|    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 4694|    801|    pStruct->at = at;
 4695|    801|    if (ret2 < 0)
  ------------------
  |  Branch (4695:9): [True: 0, False: 801]
  ------------------
 4696|      0|    {
 4697|      0|        ret = ret2;
 4698|      0|        goto exit_function;
 4699|      0|    }
 4700|       |    /* 1st attempt: take care of C(+)#N(+)-  => C(-)#N(+)- and remove 2 negative charges */
 4701|       |    /* This would produce nDeltaCharge = 2 */
 4702|    801|    AllocEdgeList( &CarbonChargeEdges, 2 * num_at );
 4703|  4.46k|    for (i = 0; i < num_at && 0 <= ret; i++)
  ------------------
  |  Branch (4703:17): [True: 3.65k, False: 801]
  |  Branch (4703:31): [True: 3.65k, False: 0]
  ------------------
 4704|  3.65k|    {
 4705|       |        /* accumulate edges for subsequent fixing them */
 4706|  3.65k|        bIsCarbon = ( pVA[i].cNumValenceElectrons == 4 && pVA[i].cPeriodicRowNumber == 1 );
  ------------------
  |  Branch (4706:23): [True: 51, False: 3.60k]
  |  Branch (4706:59): [True: 27, False: 24]
  ------------------
 4707|  3.65k|        eNFlowerEdge1 = NO_VERTEX;
  ------------------
  |  |  146|  3.65k|#define NO_VERTEX    -2
  ------------------
 4708|  3.65k|        if (( eNMinusEdge = pVA[i].nCMinusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (4708:13): [True: 11, False: 3.64k]
  ------------------
 4709|  3.65k|             !pBNS->edge[eNMinusEdge].forbidden)
  ------------------
  |  Branch (4709:14): [True: 11, False: 0]
  ------------------
 4710|     11|        {
 4711|     11|            if (bIsCarbon)
  ------------------
  |  Branch (4711:17): [True: 3, False: 8]
  ------------------
 4712|      3|            {
 4713|      3|                if (ret = AddToEdgeList( &CarbonChargeEdges, eNMinusEdge, INC_EDGE_LIST ))
  ------------------
  |  | 4669|      3|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (4713:21): [True: 0, False: 3]
  ------------------
 4714|      0|                {
 4715|      0|                    goto exit_function;
 4716|      0|                }
 4717|      3|            }
 4718|      8|            else
 4719|      8|            {
 4720|      8|                if (!pVA[i].cMetal && !at2[i].endpoint && at2[i].charge != -1)
  ------------------
  |  Branch (4720:21): [True: 8, False: 0]
  |  Branch (4720:39): [True: 8, False: 0]
  |  Branch (4720:59): [True: 1, False: 7]
  ------------------
 4721|      1|                {
 4722|      1|                    if (ret = AddToEdgeList( &AllChargeEdges, eNMinusEdge, INC_EDGE_LIST ))
  ------------------
  |  | 4669|      1|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (4722:25): [True: 0, False: 1]
  ------------------
 4723|      0|                    {
 4724|      0|                        goto exit_function;
 4725|      0|                    }
 4726|      1|                }
 4727|      8|            }
 4728|     11|        }
 4729|  3.65k|        if (( eNPlusEdge = pVA[i].nCPlusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (4729:13): [True: 14, False: 3.64k]
  ------------------
 4730|  3.65k|             !pBNS->edge[eNPlusEdge].forbidden)
  ------------------
  |  Branch (4730:14): [True: 14, False: 0]
  ------------------
 4731|     14|        {
 4732|     14|            if (bIsCarbon)
  ------------------
  |  Branch (4732:17): [True: 3, False: 11]
  ------------------
 4733|      3|            {
 4734|      3|                if (ret = AddToEdgeList( &CarbonChargeEdges, eNPlusEdge, INC_EDGE_LIST ))
  ------------------
  |  | 4669|      3|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (4734:21): [True: 0, False: 3]
  ------------------
 4735|      0|                {
 4736|      0|                    goto exit_function;
 4737|      0|                }
 4738|      3|            }
 4739|     11|            else
 4740|     11|            {
 4741|     11|                if (!pVA[i].cMetal && !at2[i].endpoint)
  ------------------
  |  Branch (4741:21): [True: 11, False: 0]
  |  Branch (4741:39): [True: 11, False: 0]
  ------------------
 4742|     11|                {
 4743|     11|                    if (ret = AddToEdgeList( &AllChargeEdges, eNPlusEdge, INC_EDGE_LIST ))
  ------------------
  |  | 4669|     11|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (4743:25): [True: 0, False: 11]
  ------------------
 4744|      0|                    {
 4745|      0|                        goto exit_function;
 4746|      0|                    }
 4747|     11|                    if (pVA[i].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (4747:25): [True: 1, False: 10]
  ------------------
 4748|     11|                         NO_VERTEX != ( eNFlowerEdge1 = GetChargeFlowerUpperEdge( pBNS, pVA, eNPlusEdge ) ) &&
  ------------------
  |  |  146|      1|#define NO_VERTEX    -2
  ------------------
  |  Branch (4748:26): [True: 0, False: 1]
  ------------------
 4749|     11|                         !pBNS->edge[eNFlowerEdge1].flow)
  ------------------
  |  Branch (4749:26): [True: 0, False: 0]
  ------------------
 4750|      0|                    {
 4751|      0|                        if (ret = AddToEdgeList( &AllChargeEdges, eNFlowerEdge1, INC_EDGE_LIST ))
  ------------------
  |  | 4669|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (4751:29): [True: 0, False: 0]
  ------------------
 4752|      0|                        {
 4753|      0|                            goto exit_function;
 4754|      0|                        }
 4755|      0|                    }
 4756|     11|                }
 4757|     11|            }
 4758|     14|        }
 4759|  3.65k|        if (bIsCarbon &&
  ------------------
  |  Branch (4759:13): [True: 27, False: 3.63k]
  ------------------
 4760|  3.65k|             0 <= eNMinusEdge &&
  ------------------
  |  Branch (4760:14): [True: 3, False: 24]
  ------------------
 4761|  3.65k|             0 <= eNPlusEdge &&
  ------------------
  |  Branch (4761:14): [True: 3, False: 0]
  ------------------
 4762|  3.65k|             at2[i].valence == 1 &&
  ------------------
  |  Branch (4762:14): [True: 0, False: 3]
  ------------------
 4763|  3.65k|             at2[i].num_H == 0 &&
  ------------------
  |  Branch (4763:14): [True: 0, False: 0]
  ------------------
 4764|  3.65k|             at2[i].radical == 0 &&
  ------------------
  |  Branch (4764:14): [True: 0, False: 0]
  ------------------
 4765|  3.65k|             !pBNS->edge[eNMinusEdge].forbidden &&
  ------------------
  |  Branch (4765:14): [True: 0, False: 0]
  ------------------
 4766|  3.65k|             pBNS->edge[eNMinusEdge].flow == 0 &&
  ------------------
  |  Branch (4766:14): [True: 0, False: 0]
  ------------------
 4767|  3.65k|             !pBNS->edge[eNPlusEdge].forbidden &&
  ------------------
  |  Branch (4767:14): [True: 0, False: 0]
  ------------------
 4768|  3.65k|             pBNS->edge[eNPlusEdge].flow == 0 &&   /* found terminal C(+) */
  ------------------
  |  Branch (4768:14): [True: 0, False: 0]
  ------------------
 4769|       |
 4770|  3.65k|             at2[j = at2[i].neighbor[0]].valence == 2 &&
  ------------------
  |  Branch (4770:14): [True: 0, False: 0]
  ------------------
 4771|  3.65k|             at2[j].num_H == 0 &&
  ------------------
  |  Branch (4771:14): [True: 0, False: 0]
  ------------------
 4772|  3.65k|             at2[j].radical == 0 &&
  ------------------
  |  Branch (4772:14): [True: 0, False: 0]
  ------------------
 4773|  3.65k|             pVA[j].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (4773:14): [True: 0, False: 0]
  ------------------
 4774|  3.65k|             ( eNPlusEdge1 = pVA[j].nCPlusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (4774:14): [True: 0, False: 0]
  ------------------
 4775|  3.65k|             pBNS->edge[eNPlusEdge].flow == 0)
  ------------------
  |  Branch (4775:14): [True: 0, False: 0]
  ------------------
 4776|      0|        {     /* -N(+)- */
 4777|       |
 4778|       |#ifdef NEVER /* I have not found a good reason to do this yet */
 4779|       |            /* fix (+) charge on -N(+)- as much as C charges are fixed */
 4780|       |            if (ret = AddToEdgeList( &CarbonChargeEdges, eNPlusEdge1, INC_EDGE_LIST ))
 4781|       |            {
 4782|       |                goto exit_function;
 4783|       |            }
 4784|       |            /* fix floer edge to prevent N(V) ??? */
 4785|       |            if (NO_VERTEX != ( eNFlowerEdge1 = GetChargeFlowerUpperEdge( pBNS, pVA, eNPlusEdge1 ) ) &&
 4786|       |                 !pBNS->edge[eNFlowerEdge1].flow)
 4787|       |            {
 4788|       |                if (ret = AddToEdgeList( &CarbonChargeEdges, eNFlowerEdge1, INC_EDGE_LIST ))
 4789|       |                {
 4790|       |                    goto exit_function;
 4791|       |                }
 4792|       |            }
 4793|       |#endif
 4794|       |            /*
 4795|       |               Carbon(+)         Carbon(-)
 4796|       |               ChargeStruct:     ChargeStruct:
 4797|       |
 4798|       |                         5(+C)             5(+C)
 4799|       |                        /                 //
 4800|       |               6(-C)  4          6(-C)  4
 4801|       |                   \ //             \\ /
 4802|       |                    3                 3
 4803|       |                    |                 |
 4804|       |                    2                 2
 4805|       |                    ||                ||
 4806|       |                   -C1-              -C1-
 4807|       |                    |                 |
 4808|       |
 4809|       |             3-6 is (-) Charge Edge; 4-5 is (+) Charge Edge
 4810|       |
 4811|       |             To convert the left pattern to the right one:
 4812|       |
 4813|       |             We need to release these charge edges and decrement
 4814|       |             edge 3-4 flow to change charge from (+) to (-)
 4815|       |
 4816|       |            */
 4817|       |
 4818|       |            /* find vertices 4 and 5 */
 4819|      0|            v1 = pBNS->edge[eNPlusEdge].neighbor1; /* one of two vertices incident with edge 4-5 */
 4820|      0|            v2 = pBNS->edge[eNPlusEdge].neighbor12 ^ v1;
 4821|      0|            if (IS_BNS_VT_C_GR( pBNS->vert[v1].type ))
  ------------------
  |  |  106|      0|#define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   99|      0|#define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|      0|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  |  |  ------------------
  |  |  |  |               #define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|      0|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   77|      0|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  |  |  |  Branch (106:37): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4822|      0|            {
 4823|       |                /* v1 is 5(+C) */
 4824|      0|                Vertex tmp = v1;
 4825|      0|                v1 = v2;
 4826|      0|                v2 = tmp;
 4827|      0|            }
 4828|       |            /* v1 should be 4, v2 - 5(+C) */
 4829|      0|            if (!IS_BNS_VT_CHRG_STRUCT( pBNS->vert[v1].type ) || pBNS->vert[v1].num_adj_edges != 2)
  ------------------
  |  |  110|      0|#define IS_BNS_VT_CHRG_STRUCT(X)    (((X) & BNS_VERT_TYPE__AUX) &&  ((X) & BNS_VERT_TYPE_TEMP))
  |  |  ------------------
  |  |  |  |   81|      0|#define BNS_VERT_TYPE__AUX          0x0080  /* vertex added to build charge substructures */
  |  |  ------------------
  |  |               #define IS_BNS_VT_CHRG_STRUCT(X)    (((X) & BNS_VERT_TYPE__AUX) &&  ((X) & BNS_VERT_TYPE_TEMP))
  |  |  ------------------
  |  |  |  |   79|      0|#define BNS_VERT_TYPE_TEMP          0x0040
  |  |  ------------------
  |  |  |  Branch (110:38): [True: 0, False: 0]
  |  |  |  Branch (110:69): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (4829:66): [True: 0, False: 0]
  ------------------
 4830|      0|            {
 4831|      0|                continue; /* mismatch */
 4832|      0|            }
 4833|       |            /* find edge 3-4 */
 4834|      0|            eN34Edge = pBNS->vert[v1].iedge[pBNS->vert[v1].iedge[0] == eNPlusEdge];
 4835|      0|            if (pBNS->edge[eN34Edge].forbidden || !pBNS->edge[eN34Edge].flow)
  ------------------
  |  Branch (4835:17): [True: 0, False: 0]
  |  Branch (4835:51): [True: 0, False: 0]
  ------------------
 4836|      0|            {
 4837|      0|                continue;
 4838|      0|            }
 4839|       |            /* save 3 edges: 6-3, 4-5, and 3-4 in this order */
 4840|      0|            if (ret = AddToEdgeList( &IsoCyanoCarbonChargeEdges, eNMinusEdge, INC_EDGE_LIST ))
  ------------------
  |  | 4669|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (4840:17): [True: 0, False: 0]
  ------------------
 4841|      0|            {
 4842|      0|                goto exit_function;
 4843|      0|            }
 4844|      0|            if (ret = AddToEdgeList( &IsoCyanoCarbonChargeEdges, eNPlusEdge, INC_EDGE_LIST ))
  ------------------
  |  | 4669|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (4844:17): [True: 0, False: 0]
  ------------------
 4845|      0|            {
 4846|      0|                goto exit_function;
 4847|      0|            }
 4848|      0|            if (ret = AddToEdgeList( &IsoCyanoCarbonChargeEdges, eN34Edge, INC_EDGE_LIST ))
  ------------------
  |  | 4669|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (4848:17): [True: 0, False: 0]
  ------------------
 4849|      0|            {
 4850|      0|                goto exit_function;
 4851|      0|            }
 4852|      0|        }
 4853|  3.65k|    }
 4854|       |    /* 1st attempt: move (-) charges from heteroatoms to C(+) */
 4855|    801|    SetForbiddenEdgeMask( pBNS, &CarbonChargeEdges, forbidden_edge_mask );
 4856|    801|    SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 4857|    801|    RemoveForbiddenEdgeMask( pBNS, &IsoCyanoCarbonChargeEdges, forbidden_edge_mask );
 4858|    801|    for (i = IsoCyanoCarbonChargeEdges.num_edges - 3; 0 <= i; i -= 3)
  ------------------
  |  Branch (4858:55): [True: 0, False: 801]
  ------------------
 4859|      0|    {
 4860|      0|        eNMinusEdge = IsoCyanoCarbonChargeEdges.pnEdges[i];
 4861|      0|        eNPlusEdge = IsoCyanoCarbonChargeEdges.pnEdges[i + 1];
 4862|      0|        eN34Edge = IsoCyanoCarbonChargeEdges.pnEdges[i + 2];
 4863|       |
 4864|      0|        pe = pBNS->edge + eN34Edge;
 4865|      0|        pe->forbidden |= forbidden_edge_mask;
 4866|      0|        if (!pe->flow)
  ------------------
  |  Branch (4866:13): [True: 0, False: 0]
  ------------------
 4867|      0|        {
 4868|      0|            continue; /* already done */
 4869|      0|        }
 4870|       |
 4871|      0|        v1 = pe->neighbor1;
 4872|      0|        v2 = pe->neighbor12 ^ v1;
 4873|      0|        pe->flow--;
 4874|      0|        pBNS->vert[v1].st_edge.flow--;
 4875|      0|        pBNS->vert[v2].st_edge.flow--;
 4876|      0|        pBNS->tot_st_flow -= 2;
 4877|       |
 4878|      0|        ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 4879|      0|                              &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 4880|       |
 4881|      0|        if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (4881:13): [True: 0, False: 0]
  |  Branch (4881:27): [True: 0, False: 0]
  |  Branch (4881:45): [True: 0, False: 0]
  ------------------
 4882|      0|            vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge <= -2)
  ------------------
  |  Branch (4882:13): [True: 0, False: 0]
  |  Branch (4882:31): [True: 0, False: 0]
  |  Branch (4882:53): [True: 0, False: 0]
  ------------------
 4883|      0|        {
 4884|      0|            ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 4885|      0|            ( *pnNumRunBNS )++;
 4886|      0|            *pnTotalDelta += ret;
 4887|      0|            num_success++;
 4888|      0|        }
 4889|      0|        else
 4890|      0|        {
 4891|      0|            pe->flow++;
 4892|      0|            pBNS->vert[v1].st_edge.flow++;
 4893|      0|            pBNS->vert[v2].st_edge.flow++;
 4894|      0|            pBNS->tot_st_flow += 2;
 4895|      0|            pe->forbidden &= inv_forbidden_edge_mask;
 4896|      0|            num_failed++;
 4897|      0|        }
 4898|      0|    }
 4899|    801|    if (num_failed)
  ------------------
  |  Branch (4899:9): [True: 0, False: 801]
  ------------------
 4900|      0|    {
 4901|       |        /* relax conditions: allow all heteroatoms to change charge */
 4902|      0|        RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 4903|      0|        for (i = IsoCyanoCarbonChargeEdges.num_edges - 3; 0 <= i; i -= 3)
  ------------------
  |  Branch (4903:59): [True: 0, False: 0]
  ------------------
 4904|      0|        {
 4905|      0|            eNMinusEdge = IsoCyanoCarbonChargeEdges.pnEdges[i];
 4906|      0|            eNPlusEdge = IsoCyanoCarbonChargeEdges.pnEdges[i + 1];
 4907|      0|            eN34Edge = IsoCyanoCarbonChargeEdges.pnEdges[i + 2];
 4908|       |
 4909|      0|            pe = pBNS->edge + eN34Edge;
 4910|      0|            pe->forbidden |= forbidden_edge_mask;
 4911|      0|            if (!pe->flow)
  ------------------
  |  Branch (4911:17): [True: 0, False: 0]
  ------------------
 4912|      0|            {
 4913|      0|                continue; /* already done */
 4914|      0|            }
 4915|       |
 4916|      0|            v1 = pe->neighbor1;
 4917|      0|            v2 = pe->neighbor12 ^ v1;
 4918|      0|            pe->flow--;
 4919|      0|            pBNS->vert[v1].st_edge.flow--;
 4920|      0|            pBNS->vert[v2].st_edge.flow--;
 4921|      0|            pBNS->tot_st_flow -= 2;
 4922|       |
 4923|      0|            ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 4924|      0|                                  &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 4925|       |
 4926|      0|            if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (4926:17): [True: 0, False: 0]
  |  Branch (4926:31): [True: 0, False: 0]
  |  Branch (4926:49): [True: 0, False: 0]
  ------------------
 4927|      0|                vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge <= 2)
  ------------------
  |  Branch (4927:17): [True: 0, False: 0]
  |  Branch (4927:35): [True: 0, False: 0]
  |  Branch (4927:57): [True: 0, False: 0]
  ------------------
 4928|      0|            {
 4929|      0|                ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 4930|      0|                ( *pnNumRunBNS )++;
 4931|      0|                *pnTotalDelta += ret;
 4932|      0|                num_success++;
 4933|      0|            }
 4934|      0|            else
 4935|      0|            {
 4936|      0|                pe->flow++;
 4937|      0|                pBNS->vert[v1].st_edge.flow++;
 4938|      0|                pBNS->vert[v2].st_edge.flow++;
 4939|      0|                pBNS->tot_st_flow += 2;
 4940|      0|                pe->forbidden &= inv_forbidden_edge_mask; /* let it change if it wants */
 4941|      0|                num_failed++;
 4942|      0|            }
 4943|      0|        }
 4944|      0|    }
 4945|    801|    RemoveForbiddenEdgeMask( pBNS, &CarbonChargeEdges, forbidden_edge_mask );
 4946|    801|    RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 4947|    801|    RemoveForbiddenEdgeMask( pBNS, &IsoCyanoCarbonChargeEdges, forbidden_edge_mask );
 4948|       |
 4949|       |
 4950|    801|exit_function:
 4951|       |
 4952|    801|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|    801|#define EDGE_LIST_FREE   (-2)
  ------------------
 4953|    801|    AllocEdgeList( &AllChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|    801|#define EDGE_LIST_FREE   (-2)
  ------------------
 4954|    801|    AllocEdgeList( &IsoCyanoCarbonChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|    801|#define EDGE_LIST_FREE   (-2)
  ------------------
 4955|       |
 4956|    801|    return ret;
 4957|    801|#undef INC_EDGE_LIST
 4958|    801|}
FixMetal_Nminus_Ominus:
 4972|    801|{
 4973|    801|#define INC_EDGE_LIST 16
 4974|    801|    Vertex     vPathStart, vPathEnd;
 4975|    801|    int        nPathLen, nDeltaH, nDeltaCharge, nNumVisitedAtoms;
 4976|    801|    int        num_failed, num_success, n, nDeltaChargeMax, nMetalCharge;
 4977|    801|    BNS_EDGE  *pe;
 4978|    801|    Vertex    v1, v2;
 4979|       |
 4980|    801|    int i, j, k, ret2, ret;
 4981|    801|    int num_at = pStruct->num_atoms;
 4982|    801|    int num_deleted_H = pStruct->num_deleted_H;
 4983|    801|    int len_at = num_at + num_deleted_H;
 4984|    801|    int inv_forbidden_edge_mask = ~forbidden_edge_mask;
 4985|    801|    EdgeIndex e, eNMinusEdge, eNMinusEdge1, eNMinusEdge2, eNPlusEdge2;
 4986|       |
 4987|    801|    EDGE_LIST AllChargeEdges;
 4988|       |
 4989|    801|    ret = 0;
 4990|    801|    num_failed = num_success = 0;
 4991|    801|    AllocEdgeList( &AllChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|    801|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 4992|       |
 4993|    801|    memcpy( at2, at, len_at * sizeof( at2[0] ) );
 4994|    801|    pStruct->at = at2;
 4995|    801|    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 4996|    801|    pStruct->at = at;
 4997|    801|    if (ret2 < 0)
  ------------------
  |  Branch (4997:9): [True: 0, False: 801]
  ------------------
 4998|      0|    {
 4999|      0|        ret = ret2;
 5000|      0|        goto exit_function;
 5001|      0|    }
 5002|       |    /* attepmt #1 N#N(+)-N => N(-)=N(+)=N */
 5003|  4.46k|    for (i = 0; i < num_at && 0 <= ret; i++)
  ------------------
  |  Branch (5003:17): [True: 3.65k, False: 801]
  |  Branch (5003:31): [True: 3.65k, False: 0]
  ------------------
 5004|  3.65k|    {
 5005|  3.65k|        if (at2[i].valence == 1 &&
  ------------------
  |  Branch (5005:13): [True: 6, False: 3.65k]
  ------------------
 5006|  3.65k|             at2[i].num_H == 0 &&
  ------------------
  |  Branch (5006:14): [True: 6, False: 0]
  ------------------
 5007|  3.65k|             at2[i].radical == 0 &&
  ------------------
  |  Branch (5007:14): [True: 5, False: 1]
  ------------------
 5008|  3.65k|             pVA[i].cNumValenceElectrons == 6 &&  /* terminal -O */
  ------------------
  |  Branch (5008:14): [True: 5, False: 0]
  ------------------
 5009|  3.65k|             ( eNMinusEdge = pVA[i].nCMinusGroupEdge - 1 ) >= 0 && pBNS->edge[eNMinusEdge].flow == 1 &&
  ------------------
  |  Branch (5009:14): [True: 5, False: 0]
  |  Branch (5009:68): [True: 5, False: 0]
  ------------------
 5010|  3.65k|             !pBNS->edge[eNMinusEdge].forbidden && /* terminal O(-) */
  ------------------
  |  Branch (5010:14): [True: 5, False: 0]
  ------------------
 5011|       |
 5012|  3.65k|             at2[j = at2[i].neighbor[0]].valence == 2 &&
  ------------------
  |  Branch (5012:14): [True: 5, False: 0]
  ------------------
 5013|  3.65k|             at2[j].num_H == 0 &&
  ------------------
  |  Branch (5013:14): [True: 5, False: 0]
  ------------------
 5014|  3.65k|             at2[j].radical == 0 &&
  ------------------
  |  Branch (5014:14): [True: 5, False: 0]
  ------------------
 5015|  3.65k|             pVA[j].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (5015:14): [True: 0, False: 5]
  ------------------
 5016|  3.65k|             ( eNMinusEdge1 = pVA[j].nCMinusGroupEdge - 1 ) >= 0 && pBNS->edge[eNMinusEdge1].flow == 1 &&
  ------------------
  |  Branch (5016:14): [True: 0, False: 0]
  |  Branch (5016:69): [True: 0, False: 0]
  ------------------
 5017|  3.65k|             !pBNS->edge[eNMinusEdge1].forbidden &&
  ------------------
  |  Branch (5017:14): [True: 0, False: 0]
  ------------------
 5018|       |
 5019|  3.65k|             pVA[k = at2[j].neighbor[at2[j].neighbor[0] == i]].cMetal &&
  ------------------
  |  Branch (5019:14): [True: 0, False: 0]
  ------------------
 5020|       |
 5021|  3.65k|             ( eNMinusEdge2 = pVA[k].nCMinusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (5021:14): [True: 0, False: 0]
  ------------------
 5022|  3.65k|             !pBNS->edge[eNMinusEdge2].forbidden &&
  ------------------
  |  Branch (5022:14): [True: 0, False: 0]
  ------------------
 5023|  3.65k|             ( eNPlusEdge2 = pVA[k].nCPlusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (5023:14): [True: 0, False: 0]
  ------------------
 5024|  3.65k|             !pBNS->edge[eNPlusEdge2].forbidden)
  ------------------
  |  Branch (5024:14): [True: 0, False: 0]
  ------------------
 5025|      0|        {
 5026|       |            /* found M(q)-N(-)-O(-); convert to M(q-2)-N=O */
 5027|       |
 5028|       |            /* find all charge edges to fix */
 5029|      0|            if (0 == AllChargeEdges.num_edges)
  ------------------
  |  Branch (5029:17): [True: 0, False: 0]
  ------------------
 5030|      0|            {
 5031|      0|                for (n = 0; n < num_at; n++)
  ------------------
  |  Branch (5031:29): [True: 0, False: 0]
  ------------------
 5032|      0|                {
 5033|      0|                    if (( e = pVA[n].nCMinusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (5033:25): [True: 0, False: 0]
  ------------------
 5034|      0|                         !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (5034:26): [True: 0, False: 0]
  ------------------
 5035|      0|                    {
 5036|      0|                        if (ret = AddToEdgeList( &AllChargeEdges, e, num_at ))
  ------------------
  |  Branch (5036:29): [True: 0, False: 0]
  ------------------
 5037|      0|                        {
 5038|      0|                            goto exit_function;
 5039|      0|                        }
 5040|      0|                    }
 5041|      0|                    if (( e = pVA[n].nCPlusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (5041:25): [True: 0, False: 0]
  ------------------
 5042|      0|                         !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (5042:26): [True: 0, False: 0]
  ------------------
 5043|      0|                    {
 5044|      0|                        if (ret = AddToEdgeList( &AllChargeEdges, e, num_at ))
  ------------------
  |  Branch (5044:29): [True: 0, False: 0]
  ------------------
 5045|      0|                        {
 5046|      0|                            goto exit_function;
 5047|      0|                        }
 5048|      0|                        if (pVA[n].cNumValenceElectrons == 6 &&
  ------------------
  |  Branch (5048:29): [True: 0, False: 0]
  ------------------
 5049|      0|                             NO_VERTEX != ( e = GetChargeFlowerUpperEdge( pBNS, pVA, e ) ) &&
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (5049:30): [True: 0, False: 0]
  ------------------
 5050|      0|                             pBNS->edge[e].flow == 0)
  ------------------
  |  Branch (5050:30): [True: 0, False: 0]
  ------------------
 5051|      0|                        {
 5052|      0|                            if (ret = AddToEdgeList( &AllChargeEdges, e, num_at ))
  ------------------
  |  Branch (5052:33): [True: 0, False: 0]
  ------------------
 5053|      0|                            {
 5054|      0|                                goto exit_function;
 5055|      0|                            }
 5056|      0|                        }
 5057|      0|                    }
 5058|      0|                }
 5059|      0|            }
 5060|       |
 5061|      0|            nMetalCharge = ( pBNS->edge[eNPlusEdge2].cap - pBNS->edge[eNPlusEdge2].flow )
 5062|      0|                - pBNS->edge[eNMinusEdge2].flow;
 5063|      0|            if (nMetalCharge == 0)
  ------------------
  |  Branch (5063:17): [True: 0, False: 0]
  ------------------
 5064|      0|            {
 5065|       |                /* change on O is invisible; charge from N(-) goes, charge comes to Metal */
 5066|      0|                nDeltaChargeMax = 0;
 5067|      0|            }
 5068|      0|            else
 5069|      0|            {
 5070|      0|                if (nMetalCharge == 2)
  ------------------
  |  Branch (5070:21): [True: 0, False: 0]
  ------------------
 5071|      0|                {
 5072|       |                    /* charges on Metal and N disappear */
 5073|      0|                    nDeltaChargeMax = -2;
 5074|      0|                }
 5075|      0|                else
 5076|      0|                {
 5077|       |                    /* charge from N disappears */
 5078|      0|                    nDeltaChargeMax = -1;
 5079|      0|                }
 5080|      0|            }
 5081|       |
 5082|      0|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 5083|      0|            pBNS->edge[eNMinusEdge1].forbidden &= inv_forbidden_edge_mask;
 5084|      0|            pBNS->edge[eNMinusEdge2].forbidden &= inv_forbidden_edge_mask;
 5085|      0|            pBNS->edge[eNPlusEdge2].forbidden &= inv_forbidden_edge_mask;
 5086|       |
 5087|      0|            pe = pBNS->edge + eNMinusEdge; /* must be already fixed as a charge edge */
 5088|       |
 5089|      0|            v1 = pe->neighbor1;
 5090|      0|            v2 = pe->neighbor12 ^ v1;
 5091|      0|            pe->flow--;
 5092|      0|            pBNS->vert[v1].st_edge.flow--;
 5093|      0|            pBNS->vert[v2].st_edge.flow--;
 5094|      0|            pBNS->tot_st_flow -= 2;
 5095|       |
 5096|      0|            ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 5097|      0|                                  &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 5098|       |
 5099|      0|            if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (5099:17): [True: 0, False: 0]
  |  Branch (5099:31): [True: 0, False: 0]
  |  Branch (5099:49): [True: 0, False: 0]
  ------------------
 5100|      0|                vPathEnd == v2 && vPathStart == v1 ) /*&& nDeltaCharge == nDeltaChargeMax*/)
  ------------------
  |  Branch (5100:17): [True: 0, False: 0]
  |  Branch (5100:35): [True: 0, False: 0]
  ------------------
 5101|      0|            {
 5102|      0|                ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 5103|      0|                ( *pnNumRunBNS )++;
 5104|      0|                *pnTotalDelta += ret;
 5105|      0|                num_success++;
 5106|      0|            }
 5107|      0|            else
 5108|      0|            {
 5109|      0|                pe->flow++;
 5110|      0|                pBNS->vert[v1].st_edge.flow++;
 5111|      0|                pBNS->vert[v2].st_edge.flow++;
 5112|      0|                pBNS->tot_st_flow += 2;
 5113|      0|                num_failed++;
 5114|      0|            }
 5115|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 5116|      0|        }
 5117|  3.65k|    }
 5118|    801|    ret = num_success;
 5119|       |
 5120|    801|exit_function:
 5121|       |
 5122|    801|    AllocEdgeList( &AllChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|    801|#define EDGE_LIST_FREE   (-2)
  ------------------
 5123|       |
 5124|    801|    return ret;
 5125|    801|#undef INC_EDGE_LIST
 5126|    801|}
RestoreNNNgroup:
 5140|    801|{
 5141|    801|#define INC_EDGE_LIST 16
 5142|    801|    Vertex     vPathStart, vPathEnd;
 5143|    801|    int        nPathLen, nDeltaH, nDeltaCharge, nNumVisitedAtoms, num_failed, num_success, n, nDeltaChargeMax;
 5144|    801|    BNS_EDGE  *pe;
 5145|    801|    Vertex    v1, v2;
 5146|       |
 5147|    801|    int i, j, k, ret2, ret;
 5148|    801|    int num_at = pStruct->num_atoms;
 5149|    801|    int num_deleted_H = pStruct->num_deleted_H;
 5150|    801|    int len_at = num_at + num_deleted_H;
 5151|    801|    int inv_forbidden_edge_mask = ~forbidden_edge_mask;
 5152|    801|    EdgeIndex eNMinusEdge, eNPlusEdge, eNMinusEdge1, eNPlusEdge1, eNMinusEdge2, eNPlusEdge2;
 5153|    801|    EdgeIndex eNFlowerEdge1, eNFlowerEdge2;
 5154|       |
 5155|    801|    EDGE_LIST CarbonChargeEdges, AllChargeEdges, NNNChargeEdges, CurNNNChargeEdges, AllNNNTermAtoms, AllNIIIChargeEdges;
 5156|       |
 5157|    801|    ret = 0;
 5158|    801|    num_failed = num_success = 0;
 5159|    801|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|    801|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 5160|    801|    AllocEdgeList( &AllChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|    801|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 5161|    801|    AllocEdgeList( &NNNChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|    801|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 5162|    801|    AllocEdgeList( &CurNNNChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|    801|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 5163|    801|    AllocEdgeList( &AllNNNTermAtoms, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|    801|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 5164|    801|    AllocEdgeList( &AllNIIIChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|    801|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 5165|       |
 5166|    801|    memcpy( at2, at, len_at * sizeof( at2[0] ) );
 5167|    801|    pStruct->at = at2;
 5168|    801|    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 5169|    801|    pStruct->at = at;
 5170|    801|    if (ret2 < 0)
  ------------------
  |  Branch (5170:9): [True: 0, False: 801]
  ------------------
 5171|      0|    {
 5172|      0|        ret = ret2;
 5173|      0|        goto exit_function;
 5174|      0|    }
 5175|       |    /* attepmt #1 N#N(+)-N => N(-)=N(+)=N: naive approach; expecting tp move (-) from some other atom */
 5176|  4.46k|    for (i = 0; i < num_at && 0 <= ret; i++)
  ------------------
  |  Branch (5176:17): [True: 3.65k, False: 801]
  |  Branch (5176:31): [True: 3.65k, False: 0]
  ------------------
 5177|  3.65k|    {
 5178|  3.65k|        if (at2[i].valence == 1 &&
  ------------------
  |  Branch (5178:13): [True: 6, False: 3.65k]
  ------------------
 5179|  3.65k|             at2[i].num_H == 0 &&
  ------------------
  |  Branch (5179:14): [True: 6, False: 0]
  ------------------
 5180|  3.65k|             at2[i].chem_bonds_valence == 3 &&
  ------------------
  |  Branch (5180:14): [True: 0, False: 6]
  ------------------
 5181|  3.65k|             at2[i].charge == 0 &&
  ------------------
  |  Branch (5181:14): [True: 0, False: 0]
  ------------------
 5182|  3.65k|             at2[i].radical == 0 &&
  ------------------
  |  Branch (5182:14): [True: 0, False: 0]
  ------------------
 5183|  3.65k|             pVA[i].cNumValenceElectrons == 5 &&  /* terminal N# */
  ------------------
  |  Branch (5183:14): [True: 0, False: 0]
  ------------------
 5184|  3.65k|             ( eNMinusEdge = pVA[i].nCMinusGroupEdge - 1 ) >= 0 && pBNS->edge[eNMinusEdge].flow == 0 &&
  ------------------
  |  Branch (5184:14): [True: 0, False: 0]
  |  Branch (5184:68): [True: 0, False: 0]
  ------------------
 5185|  3.65k|             !pBNS->edge[eNMinusEdge].forbidden &&
  ------------------
  |  Branch (5185:14): [True: 0, False: 0]
  ------------------
 5186|  3.65k|             at2[j = at2[i].neighbor[0]].valence == 2 &&
  ------------------
  |  Branch (5186:14): [True: 0, False: 0]
  ------------------
 5187|  3.65k|             at2[j].num_H == 0 &&
  ------------------
  |  Branch (5187:14): [True: 0, False: 0]
  ------------------
 5188|  3.65k|             at2[j].chem_bonds_valence == 4 &&
  ------------------
  |  Branch (5188:14): [True: 0, False: 0]
  ------------------
 5189|  3.65k|             at2[j].charge == 1 &&
  ------------------
  |  Branch (5189:14): [True: 0, False: 0]
  ------------------
 5190|  3.65k|             at2[j].radical == 0 &&
  ------------------
  |  Branch (5190:14): [True: 0, False: 0]
  ------------------
 5191|  3.65k|             pVA[j].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (5191:14): [True: 0, False: 0]
  ------------------
 5192|  3.65k|             ( eNPlusEdge = pVA[j].nCPlusGroupEdge - 1 ) >= 0 && pBNS->edge[eNPlusEdge].flow == 0 &&
  ------------------
  |  Branch (5192:14): [True: 0, False: 0]
  |  Branch (5192:66): [True: 0, False: 0]
  ------------------
 5193|  3.65k|             !pBNS->edge[eNPlusEdge].forbidden &&
  ------------------
  |  Branch (5193:14): [True: 0, False: 0]
  ------------------
 5194|  3.65k|             at2[k = at2[j].neighbor[at2[j].neighbor[0] == i]].valence == 2 &&
  ------------------
  |  Branch (5194:14): [True: 0, False: 0]
  ------------------
 5195|  3.65k|             at2[k].num_H == 0 &&
  ------------------
  |  Branch (5195:14): [True: 0, False: 0]
  ------------------
 5196|  3.65k|             at2[k].chem_bonds_valence == 3 &&
  ------------------
  |  Branch (5196:14): [True: 0, False: 0]
  ------------------
 5197|  3.65k|             pVA[k].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (5197:14): [True: 0, False: 0]
  ------------------
 5198|  3.65k|             ( eNPlusEdge2 = pVA[k].nCPlusGroupEdge - 1 ) >= 0 && pBNS->edge[eNPlusEdge2].flow == 1 &&
  ------------------
  |  Branch (5198:14): [True: 0, False: 0]
  |  Branch (5198:67): [True: 0, False: 0]
  ------------------
 5199|  3.65k|             !pBNS->edge[eNPlusEdge2].forbidden &&
  ------------------
  |  Branch (5199:14): [True: 0, False: 0]
  ------------------
 5200|  3.65k|             pVA[i].cnListIndex > 0 &&
  ------------------
  |  Branch (5200:14): [True: 0, False: 0]
  ------------------
 5201|  3.65k|             cnList[pVA[i].cnListIndex - 1].bits == cn_bits_MN)
  ------------------
  |  |  464|      0|#define cn_bits_MN  MAKE_CN_BITS(cn_bits_M, cn_bits_N, 0, 0)
  |  |  ------------------
  |  |  |  |  449|      0|#define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  |  |  ------------------
  |  |  |  |  |  |  447|      0|#define cn_bits_shift 3
  |  |  |  |  ------------------
  |  |  |  |               #define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  |  |  ------------------
  |  |  |  |  |  |  447|      0|#define cn_bits_shift 3
  |  |  |  |  ------------------
  |  |  |  |               #define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  |  |  ------------------
  |  |  |  |  |  |  447|      0|#define cn_bits_shift 3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (5201:14): [True: 0, False: 0]
  ------------------
 5202|      0|        {
 5203|       |            /* found N#N(+)-N~ where the last N (at2[k]) may be charged */
 5204|      0|            pe = pBNS->edge + pBNS->vert[i].iedge[0]; /* N#N(+) triple bond edge */
 5205|       |
 5206|      0|            v1 = pe->neighbor1;
 5207|      0|            v2 = pe->neighbor12 ^ v1;
 5208|      0|            pe->flow--;
 5209|      0|            pBNS->vert[v1].st_edge.flow--;
 5210|      0|            pBNS->vert[v2].st_edge.flow--;
 5211|      0|            pBNS->tot_st_flow -= 2;
 5212|       |
 5213|      0|            pe->forbidden |= forbidden_edge_mask;
 5214|      0|            pBNS->edge[eNPlusEdge].forbidden |= forbidden_edge_mask;
 5215|      0|            pBNS->edge[eNPlusEdge2].forbidden |= forbidden_edge_mask;
 5216|       |
 5217|       |
 5218|      0|            if (!CarbonChargeEdges.num_edges)
  ------------------
  |  Branch (5218:17): [True: 0, False: 0]
  ------------------
 5219|      0|            {
 5220|       |                /* do not let carbon atoms get charged */
 5221|      0|                AllocEdgeList( &CarbonChargeEdges, INC_EDGE_LIST );
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
 5222|      0|                if (0 > ( ret = ForbidCarbonChargeEdges( pBNS, pTCGroups, &CarbonChargeEdges, forbidden_edge_mask ) ))
  ------------------
  |  Branch (5222:21): [True: 0, False: 0]
  ------------------
 5223|      0|                {
 5224|      0|                    goto exit_function;
 5225|      0|                }
 5226|      0|            }
 5227|      0|            else
 5228|      0|            {
 5229|      0|                SetForbiddenEdgeMask( pBNS, &CarbonChargeEdges, forbidden_edge_mask );
 5230|      0|            }
 5231|      0|            ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 5232|      0|                                  &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 5233|       |
 5234|      0|            if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (5234:17): [True: 0, False: 0]
  |  Branch (5234:31): [True: 0, False: 0]
  |  Branch (5234:49): [True: 0, False: 0]
  ------------------
 5235|      0|                vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge <= 0)
  ------------------
  |  Branch (5235:17): [True: 0, False: 0]
  |  Branch (5235:35): [True: 0, False: 0]
  |  Branch (5235:57): [True: 0, False: 0]
  ------------------
 5236|      0|            {
 5237|      0|                ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 5238|      0|                ( *pnNumRunBNS )++;
 5239|      0|                *pnTotalDelta += ret;
 5240|      0|                num_success++;
 5241|       |                /* fix charges on N(-)=N(+)=N- */
 5242|      0|                if (ret = AddToEdgeList( &CarbonChargeEdges, eNMinusEdge, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5242:21): [True: 0, False: 0]
  ------------------
 5243|      0|                {
 5244|      0|                    goto exit_function;
 5245|      0|                }
 5246|      0|                if (ret = AddToEdgeList( &CarbonChargeEdges, eNPlusEdge, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5246:21): [True: 0, False: 0]
  ------------------
 5247|      0|                {
 5248|      0|                    goto exit_function;
 5249|      0|                }
 5250|      0|            }
 5251|      0|            else
 5252|      0|            {
 5253|      0|                pe->flow++;
 5254|      0|                pBNS->vert[v1].st_edge.flow++;
 5255|      0|                pBNS->vert[v2].st_edge.flow++;
 5256|      0|                pBNS->tot_st_flow += 2;
 5257|      0|                num_failed++;
 5258|      0|            }
 5259|      0|            RemoveForbiddenEdgeMask( pBNS, &CarbonChargeEdges, forbidden_edge_mask );
 5260|       |
 5261|      0|            pe->forbidden &= inv_forbidden_edge_mask;
 5262|      0|            pBNS->edge[eNPlusEdge].forbidden &= inv_forbidden_edge_mask;
 5263|      0|            pBNS->edge[eNPlusEdge2].forbidden &= inv_forbidden_edge_mask;
 5264|      0|        }
 5265|  3.65k|    }
 5266|       |
 5267|       |    /* 2nd attempt: take care of N#N(+)-N=-...=N-N(-) */
 5268|       |    /* This would produce nDeltaCharge >= 2 */
 5269|       |
 5270|    801|    AllChargeEdges.num_edges = 0;
 5271|    801|    AllNNNTermAtoms.num_edges = 0;
 5272|    801|    NNNChargeEdges.num_edges = 0;
 5273|    801|    AllNIIIChargeEdges.num_edges = 0;
 5274|       |
 5275|  4.46k|    for (i = 0; i < num_at && 0 <= ret; i++)
  ------------------
  |  Branch (5275:17): [True: 3.65k, False: 801]
  |  Branch (5275:31): [True: 3.65k, False: 0]
  ------------------
 5276|  3.65k|    {
 5277|  3.65k|        if (( eNMinusEdge = pVA[i].nCMinusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (5277:13): [True: 11, False: 3.64k]
  ------------------
 5278|  3.65k|             !pBNS->edge[eNMinusEdge].forbidden)
  ------------------
  |  Branch (5278:14): [True: 11, False: 0]
  ------------------
 5279|     11|        {
 5280|     11|            if (ret = AddToEdgeList( &AllChargeEdges, eNMinusEdge, INC_EDGE_LIST ))
  ------------------
  |  | 5141|     11|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5280:17): [True: 0, False: 11]
  ------------------
 5281|      0|            {
 5282|      0|                goto exit_function;
 5283|      0|            }
 5284|     11|        }
 5285|  3.64k|        else
 5286|  3.64k|        {
 5287|  3.64k|            eNMinusEdge = -1;
 5288|  3.64k|        }
 5289|  3.65k|        if (( eNPlusEdge = pVA[i].nCPlusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (5289:13): [True: 14, False: 3.64k]
  ------------------
 5290|  3.65k|             !pBNS->edge[eNPlusEdge].forbidden)
  ------------------
  |  Branch (5290:14): [True: 14, False: 0]
  ------------------
 5291|     14|        {
 5292|     14|            if (ret = AddToEdgeList( &AllChargeEdges, eNPlusEdge, INC_EDGE_LIST ))
  ------------------
  |  | 5141|     14|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5292:17): [True: 0, False: 14]
  ------------------
 5293|      0|            {
 5294|      0|                goto exit_function;
 5295|      0|            }
 5296|     14|            if (pVA[i].cNumValenceElectrons == 5 && at2[i].valence == 3 && at2[i].chem_bonds_valence == 3)
  ------------------
  |  Branch (5296:17): [True: 1, False: 13]
  |  Branch (5296:53): [True: 0, False: 1]
  |  Branch (5296:76): [True: 0, False: 0]
  ------------------
 5297|      0|            {
 5298|      0|                if (ret = AddToEdgeList( &AllNIIIChargeEdges, eNPlusEdge, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5298:21): [True: 0, False: 0]
  ------------------
 5299|      0|                {
 5300|      0|                    goto exit_function;
 5301|      0|                }
 5302|      0|            }
 5303|       |            /* N flower edge */
 5304|     14|            if (pVA[i].cNumValenceElectrons == 5 && pVA[i].cPeriodicRowNumber == 1 &&
  ------------------
  |  Branch (5304:17): [True: 1, False: 13]
  |  Branch (5304:53): [True: 1, False: 0]
  ------------------
 5305|     14|                 NO_VERTEX != ( eNFlowerEdge1 = GetChargeFlowerUpperEdge( pBNS, pVA, eNPlusEdge ) ) &&
  ------------------
  |  |  146|      1|#define NO_VERTEX    -2
  ------------------
  |  Branch (5305:18): [True: 0, False: 1]
  ------------------
 5306|     14|                 pBNS->edge[eNFlowerEdge1].flow == 0 &&
  ------------------
  |  Branch (5306:18): [True: 0, False: 0]
  ------------------
 5307|     14|                 ( ret = AddToEdgeList( &AllChargeEdges, eNFlowerEdge1, INC_EDGE_LIST ) ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5307:18): [True: 0, False: 0]
  ------------------
 5308|      0|            {
 5309|      0|                goto exit_function;
 5310|      0|            }
 5311|     14|        }
 5312|  3.64k|        else
 5313|  3.64k|        {
 5314|  3.64k|            eNPlusEdge = -1;
 5315|  3.64k|        }
 5316|       |
 5317|  3.65k|        if (0 <= eNMinusEdge &&
  ------------------
  |  Branch (5317:13): [True: 11, False: 3.64k]
  ------------------
 5318|  3.65k|             at2[i].valence == 1 &&
  ------------------
  |  Branch (5318:14): [True: 6, False: 5]
  ------------------
 5319|  3.65k|             at2[i].num_H == 0 &&
  ------------------
  |  Branch (5319:14): [True: 6, False: 0]
  ------------------
 5320|  3.65k|             at2[i].radical == 0 &&
  ------------------
  |  Branch (5320:14): [True: 5, False: 1]
  ------------------
 5321|  3.65k|             pVA[i].cNumValenceElectrons == 5 &&  /* terminal N# */
  ------------------
  |  Branch (5321:14): [True: 0, False: 5]
  ------------------
 5322|       |
 5323|  3.65k|             at2[j = at2[i].neighbor[0]].valence == 2 &&
  ------------------
  |  Branch (5323:14): [True: 0, False: 0]
  ------------------
 5324|  3.65k|             at2[j].num_H == 0 &&
  ------------------
  |  Branch (5324:14): [True: 0, False: 0]
  ------------------
 5325|  3.65k|             at2[j].radical == 0 &&
  ------------------
  |  Branch (5325:14): [True: 0, False: 0]
  ------------------
 5326|  3.65k|             pVA[j].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (5326:14): [True: 0, False: 0]
  ------------------
 5327|  3.65k|             ( eNMinusEdge1 = pVA[j].nCMinusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (5327:14): [True: 0, False: 0]
  ------------------
 5328|  3.65k|             ( eNPlusEdge1 = pVA[j].nCPlusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (5328:14): [True: 0, False: 0]
  ------------------
 5329|  3.65k|             !pBNS->edge[eNMinusEdge1].forbidden &&
  ------------------
  |  Branch (5329:14): [True: 0, False: 0]
  ------------------
 5330|  3.65k|             !pBNS->edge[eNPlusEdge1].forbidden &&
  ------------------
  |  Branch (5330:14): [True: 0, False: 0]
  ------------------
 5331|       |
 5332|  3.65k|             at2[k = at2[j].neighbor[at2[j].neighbor[0] == i]].valence == 2 &&
  ------------------
  |  Branch (5332:14): [True: 0, False: 0]
  ------------------
 5333|  3.65k|             at2[k].num_H == 0 &&
  ------------------
  |  Branch (5333:14): [True: 0, False: 0]
  ------------------
 5334|  3.65k|             at2[k].radical == 0 &&
  ------------------
  |  Branch (5334:14): [True: 0, False: 0]
  ------------------
 5335|  3.65k|             pVA[k].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (5335:14): [True: 0, False: 0]
  ------------------
 5336|  3.65k|             ( eNMinusEdge2 = pVA[k].nCMinusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (5336:14): [True: 0, False: 0]
  ------------------
 5337|  3.65k|             ( eNPlusEdge2 = pVA[k].nCPlusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (5337:14): [True: 0, False: 0]
  ------------------
 5338|  3.65k|             !pBNS->edge[eNMinusEdge2].forbidden &&
  ------------------
  |  Branch (5338:14): [True: 0, False: 0]
  ------------------
 5339|  3.65k|             !pBNS->edge[eNPlusEdge2].forbidden &&
  ------------------
  |  Branch (5339:14): [True: 0, False: 0]
  ------------------
 5340|       |
 5341|  3.65k|             pVA[i].cnListIndex > 0 &&
  ------------------
  |  Branch (5341:14): [True: 0, False: 0]
  ------------------
 5342|  3.65k|             cnList[pVA[i].cnListIndex - 1].bits == cn_bits_MN)
  ------------------
  |  |  464|      0|#define cn_bits_MN  MAKE_CN_BITS(cn_bits_M, cn_bits_N, 0, 0)
  |  |  ------------------
  |  |  |  |  449|      0|#define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  |  |  ------------------
  |  |  |  |  |  |  447|      0|#define cn_bits_shift 3
  |  |  |  |  ------------------
  |  |  |  |               #define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  |  |  ------------------
  |  |  |  |  |  |  447|      0|#define cn_bits_shift 3
  |  |  |  |  ------------------
  |  |  |  |               #define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  |  |  ------------------
  |  |  |  |  |  |  447|      0|#define cn_bits_shift 3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (5342:14): [True: 0, False: 0]
  ------------------
 5343|      0|        {
 5344|       |            /* found N#N(+)-N~ or N(-)=N-N= where the last N (at2[k]) may be charged */
 5345|       |
 5346|       |            /* 1. N(-)=N(+)=N- */
 5347|      0|            if (pBNS->edge[eNMinusEdge].flow == 1 &&  /* N(-) */
  ------------------
  |  Branch (5347:17): [True: 0, False: 0]
  ------------------
 5348|      0|                 pBNS->edge[eNMinusEdge1].flow == 0 && pBNS->edge[eNPlusEdge1].flow == 0 && /* N(+) */
  ------------------
  |  Branch (5348:18): [True: 0, False: 0]
  |  Branch (5348:56): [True: 0, False: 0]
  ------------------
 5349|      0|                 pBNS->edge[eNMinusEdge2].flow == 0 && pBNS->edge[eNPlusEdge2].flow == 1    /* N */)
  ------------------
  |  Branch (5349:18): [True: 0, False: 0]
  |  Branch (5349:56): [True: 0, False: 0]
  ------------------
 5350|      0|            {
 5351|      0|                continue; /* already good */
 5352|      0|            }
 5353|       |            /* accumulate terminal atoms of all other NNN */
 5354|      0|            if (ret = AddToEdgeList( &AllNNNTermAtoms, i, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5354:17): [True: 0, False: 0]
  ------------------
 5355|      0|            {
 5356|      0|                goto exit_function;
 5357|      0|            }
 5358|       |            /* 2. N#N(+)-N= */
 5359|      0|            if (pBNS->edge[eNMinusEdge].flow == 0 && /* N */
  ------------------
  |  Branch (5359:17): [True: 0, False: 0]
  ------------------
 5360|      0|                 pBNS->edge[eNMinusEdge1].flow == 0 && pBNS->edge[eNPlusEdge1].flow == 0 && /* N(+) */
  ------------------
  |  Branch (5360:18): [True: 0, False: 0]
  |  Branch (5360:56): [True: 0, False: 0]
  ------------------
 5361|      0|                 pBNS->edge[eNMinusEdge2].flow == 0 && pBNS->edge[eNPlusEdge2].flow == 1    /* N */)
  ------------------
  |  Branch (5361:18): [True: 0, False: 0]
  |  Branch (5361:56): [True: 0, False: 0]
  ------------------
 5362|      0|            {
 5363|       |/* unfix (-) edge on terminal N# */
 5364|      0|                if (ret = AddToEdgeList( &NNNChargeEdges, eNMinusEdge, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5364:21): [True: 0, False: 0]
  ------------------
 5365|      0|                {
 5366|      0|                    goto exit_function;
 5367|      0|                }
 5368|      0|                continue;
 5369|      0|            }
 5370|       |            /* 3. N(-)=N-N= */
 5371|      0|            if (pBNS->edge[eNMinusEdge].flow == 1 && /* N(-) */
  ------------------
  |  Branch (5371:17): [True: 0, False: 0]
  ------------------
 5372|      0|                 pBNS->edge[eNMinusEdge1].flow == 0 && pBNS->edge[eNPlusEdge1].flow == 1 && /* N */
  ------------------
  |  Branch (5372:18): [True: 0, False: 0]
  |  Branch (5372:56): [True: 0, False: 0]
  ------------------
 5373|      0|                 pBNS->edge[eNMinusEdge2].flow == 0 && pBNS->edge[eNPlusEdge2].flow == 1    /* N */)
  ------------------
  |  Branch (5373:18): [True: 0, False: 0]
  |  Branch (5373:56): [True: 0, False: 0]
  ------------------
 5374|      0|            {
 5375|       |                /* unfix (+) edge on middle N */
 5376|      0|                if (ret = AddToEdgeList( &NNNChargeEdges, eNPlusEdge1, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5376:21): [True: 0, False: 0]
  ------------------
 5377|      0|                {
 5378|      0|                    goto exit_function;
 5379|      0|                }
 5380|      0|                continue;
 5381|      0|            }
 5382|       |            /* 4. N#N(+)-N(-)- */
 5383|      0|            if (pBNS->edge[eNMinusEdge].flow == 0 &&  /* N */
  ------------------
  |  Branch (5383:17): [True: 0, False: 0]
  ------------------
 5384|      0|                 pBNS->edge[eNMinusEdge1].flow == 0 && pBNS->edge[eNPlusEdge1].flow == 0 && /* N(+) */
  ------------------
  |  Branch (5384:18): [True: 0, False: 0]
  |  Branch (5384:56): [True: 0, False: 0]
  ------------------
 5385|      0|                 pBNS->edge[eNMinusEdge2].flow == 1 && pBNS->edge[eNPlusEdge2].flow == 1    /* N(-) */)
  ------------------
  |  Branch (5385:18): [True: 0, False: 0]
  |  Branch (5385:56): [True: 0, False: 0]
  ------------------
 5386|      0|            {
 5387|       |                /* unfix (-) edge on the 1st and 3rd N */
 5388|      0|                if (ret = AddToEdgeList( &NNNChargeEdges, eNMinusEdge, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5388:21): [True: 0, False: 0]
  ------------------
 5389|      0|                {
 5390|      0|                    goto exit_function;
 5391|      0|                }
 5392|      0|                if (ret = AddToEdgeList( &NNNChargeEdges, eNMinusEdge2, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5392:21): [True: 0, False: 0]
  ------------------
 5393|      0|                {
 5394|      0|                    goto exit_function;
 5395|      0|                }
 5396|      0|                continue;
 5397|      0|            }
 5398|       |            /* 5. N#N(+)-N(+)# */
 5399|      0|            if (pBNS->edge[eNMinusEdge].flow == 0 &&  /* N */
  ------------------
  |  Branch (5399:17): [True: 0, False: 0]
  ------------------
 5400|      0|                 pBNS->edge[eNMinusEdge1].flow == 0 && pBNS->edge[eNPlusEdge1].flow == 0 && /* N(+) */
  ------------------
  |  Branch (5400:18): [True: 0, False: 0]
  |  Branch (5400:56): [True: 0, False: 0]
  ------------------
 5401|      0|                 pBNS->edge[eNMinusEdge2].flow == 0 && pBNS->edge[eNPlusEdge2].flow == 0    /* N(+) */)
  ------------------
  |  Branch (5401:18): [True: 0, False: 0]
  |  Branch (5401:56): [True: 0, False: 0]
  ------------------
 5402|      0|            {
 5403|       |                /* unfix (-) edge on the 1st and (+) edge on the 3rd N */
 5404|      0|                if (ret = AddToEdgeList( &NNNChargeEdges, eNMinusEdge, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5404:21): [True: 0, False: 0]
  ------------------
 5405|      0|                {
 5406|      0|                    goto exit_function;
 5407|      0|                }
 5408|      0|                if (ret = AddToEdgeList( &NNNChargeEdges, eNPlusEdge2, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5408:21): [True: 0, False: 0]
  ------------------
 5409|      0|                {
 5410|      0|                    goto exit_function;
 5411|      0|                }
 5412|      0|                continue;
 5413|      0|            }
 5414|      0|        }
 5415|  3.65k|    }
 5416|       |    /* try to fix each NNN */
 5417|    801|    for (n = AllNNNTermAtoms.num_edges - 1; 0 <= n; n--)
  ------------------
  |  Branch (5417:45): [True: 0, False: 801]
  ------------------
 5418|      0|    {
 5419|      0|        i = AllNNNTermAtoms.pnEdges[n];
 5420|      0|        eNMinusEdge = pVA[i].nCMinusGroupEdge - 1;
 5421|       |        /*eNPlusEdge = pVA[i].nCPlusGroupEdge - 1;*/
 5422|      0|        j = at2[i].neighbor[0];
 5423|      0|        eNMinusEdge1 = pVA[j].nCMinusGroupEdge - 1;
 5424|      0|        eNPlusEdge1 = pVA[j].nCPlusGroupEdge - 1;
 5425|      0|        k = at2[j].neighbor[at2[j].neighbor[0] == i];
 5426|      0|        eNMinusEdge2 = pVA[k].nCMinusGroupEdge - 1;
 5427|      0|        eNPlusEdge2 = pVA[k].nCPlusGroupEdge - 1;
 5428|       |        /*SetForbiddenEdgeMask( pBNS, &CarbonChargeEdges, forbidden_edge_mask );*/
 5429|       |        /* 1. N(-)=N(+)=N- */
 5430|      0|        if (pBNS->edge[eNMinusEdge].flow == 1 &&  /* N(-) */
  ------------------
  |  Branch (5430:13): [True: 0, False: 0]
  ------------------
 5431|      0|             pBNS->edge[eNMinusEdge1].flow == 0 && pBNS->edge[eNPlusEdge1].flow == 0 && /* N(+) */
  ------------------
  |  Branch (5431:14): [True: 0, False: 0]
  |  Branch (5431:52): [True: 0, False: 0]
  ------------------
 5432|      0|             pBNS->edge[eNMinusEdge2].flow == 0 && pBNS->edge[eNPlusEdge2].flow == 1    /* N */)
  ------------------
  |  Branch (5432:14): [True: 0, False: 0]
  |  Branch (5432:52): [True: 0, False: 0]
  ------------------
 5433|      0|        {
 5434|       |
 5435|      0|            RemoveFromEdgeListByValue( &NNNChargeEdges, eNMinusEdge );
 5436|      0|            RemoveFromEdgeListByValue( &NNNChargeEdges, eNMinusEdge1 );
 5437|      0|            RemoveFromEdgeListByValue( &NNNChargeEdges, eNPlusEdge1 );
 5438|      0|            RemoveFromEdgeListByValue( &NNNChargeEdges, eNMinusEdge2 );
 5439|      0|            RemoveFromEdgeListByValue( &NNNChargeEdges, eNPlusEdge2 );
 5440|       |
 5441|      0|            pe = NULL;
 5442|      0|        }
 5443|       |
 5444|      0|        else
 5445|      0|        {
 5446|       |            /* 2. N#N(+)-N= */
 5447|      0|            if (pBNS->edge[eNMinusEdge].flow == 0 &&  /* N */
  ------------------
  |  Branch (5447:17): [True: 0, False: 0]
  ------------------
 5448|      0|                 pBNS->edge[eNMinusEdge1].flow == 0 && pBNS->edge[eNPlusEdge1].flow == 0 && /* N(+) */
  ------------------
  |  Branch (5448:18): [True: 0, False: 0]
  |  Branch (5448:56): [True: 0, False: 0]
  ------------------
 5449|      0|                 pBNS->edge[eNMinusEdge2].flow == 0 && pBNS->edge[eNPlusEdge2].flow == 1    /* N */)
  ------------------
  |  Branch (5449:18): [True: 0, False: 0]
  |  Branch (5449:56): [True: 0, False: 0]
  ------------------
 5450|      0|            {
 5451|       |                /* decrement triple bond on terminal N# */
 5452|      0|                pe = pBNS->edge + pBNS->vert[i].iedge[0];
 5453|      0|            }
 5454|      0|            else
 5455|      0|            {
 5456|       |                /* 3. N(-)=N-N= */
 5457|      0|                if (pBNS->edge[eNMinusEdge].flow == 1 &&  /* N(-) */
  ------------------
  |  Branch (5457:21): [True: 0, False: 0]
  ------------------
 5458|      0|                     pBNS->edge[eNMinusEdge1].flow == 0 && pBNS->edge[eNPlusEdge1].flow == 1 && /* N */
  ------------------
  |  Branch (5458:22): [True: 0, False: 0]
  |  Branch (5458:60): [True: 0, False: 0]
  ------------------
 5459|      0|                     pBNS->edge[eNMinusEdge2].flow == 0 && pBNS->edge[eNPlusEdge2].flow == 1    /* N */)
  ------------------
  |  Branch (5459:22): [True: 0, False: 0]
  |  Branch (5459:60): [True: 0, False: 0]
  ------------------
 5460|      0|                {
 5461|       |                    /* decrement flow on (+) charge edge of the middle =N- */
 5462|      0|                    pe = pBNS->edge + eNPlusEdge1;
 5463|      0|                }
 5464|      0|                else
 5465|      0|                {
 5466|       |                    /* 4. N#N(+)-N(-)- */
 5467|      0|                    if (pBNS->edge[eNMinusEdge].flow == 0 &&  /* N */
  ------------------
  |  Branch (5467:25): [True: 0, False: 0]
  ------------------
 5468|      0|                         pBNS->edge[eNMinusEdge1].flow == 0 && pBNS->edge[eNPlusEdge1].flow == 0 && /* N(+) */
  ------------------
  |  Branch (5468:26): [True: 0, False: 0]
  |  Branch (5468:64): [True: 0, False: 0]
  ------------------
 5469|      0|                         pBNS->edge[eNMinusEdge2].flow == 1 && pBNS->edge[eNPlusEdge2].flow == 1    /* N(-) */)
  ------------------
  |  Branch (5469:26): [True: 0, False: 0]
  |  Branch (5469:64): [True: 0, False: 0]
  ------------------
 5470|      0|                    {
 5471|       |                        /* decrement triple bond on terminal N# */
 5472|      0|                        pe = pBNS->edge + pBNS->vert[i].iedge[0];
 5473|      0|                    }
 5474|      0|                    else
 5475|      0|                    {/* 5. N#N(+)-N(+)# */
 5476|      0|                        if (pBNS->edge[eNMinusEdge].flow == 0 &&  /* N */
  ------------------
  |  Branch (5476:29): [True: 0, False: 0]
  ------------------
 5477|      0|                             pBNS->edge[eNMinusEdge1].flow == 0 && pBNS->edge[eNPlusEdge1].flow == 0 && /* N(+) */
  ------------------
  |  Branch (5477:30): [True: 0, False: 0]
  |  Branch (5477:68): [True: 0, False: 0]
  ------------------
 5478|      0|                             pBNS->edge[eNMinusEdge2].flow == 0 && pBNS->edge[eNPlusEdge2].flow == 0    /* N(+) */)
  ------------------
  |  Branch (5478:30): [True: 0, False: 0]
  |  Branch (5478:68): [True: 0, False: 0]
  ------------------
 5479|      0|                        {
 5480|       |                            /* decrement triple bond on terminal N# */
 5481|      0|                            pe = pBNS->edge + pBNS->vert[i].iedge[0];
 5482|      0|                        }
 5483|      0|                        else
 5484|      0|                        {
 5485|      0|                            pe = NULL; /* unknown case */
 5486|      0|                        }
 5487|      0|                    }
 5488|      0|                }
 5489|      0|            }
 5490|      0|        }
 5491|       |
 5492|      0|        if (pe)
  ------------------
  |  Branch (5492:13): [True: 0, False: 0]
  ------------------
 5493|      0|        {
 5494|      0|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 5495|      0|            RemoveForbiddenEdgeMask( pBNS, &NNNChargeEdges, forbidden_edge_mask );
 5496|       |
 5497|      0|            v1 = pe->neighbor1;
 5498|      0|            v2 = pe->neighbor12 ^ v1;
 5499|      0|            pe->flow--;
 5500|      0|            pBNS->vert[v1].st_edge.flow--;
 5501|      0|            pBNS->vert[v2].st_edge.flow--;
 5502|      0|            pBNS->tot_st_flow -= 2;
 5503|       |
 5504|      0|            pe->forbidden |= forbidden_edge_mask;
 5505|       |
 5506|      0|            ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 5507|      0|                                  &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 5508|       |
 5509|      0|            if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (5509:17): [True: 0, False: 0]
  |  Branch (5509:31): [True: 0, False: 0]
  |  Branch (5509:49): [True: 0, False: 0]
  ------------------
 5510|      0|                vPathEnd == v2 && vPathStart == v1 ) /*&& nDeltaCharge <= 2*/)
  ------------------
  |  Branch (5510:17): [True: 0, False: 0]
  |  Branch (5510:35): [True: 0, False: 0]
  ------------------
 5511|      0|            {
 5512|      0|                ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 5513|      0|                ( *pnNumRunBNS )++;
 5514|      0|                *pnTotalDelta += ret;
 5515|      0|                num_success++;
 5516|       |                /* fix charges on N(-)=N(+)=N- */
 5517|      0|                RemoveFromEdgeListByValue( &NNNChargeEdges, eNMinusEdge );
 5518|      0|                RemoveFromEdgeListByValue( &NNNChargeEdges, eNMinusEdge1 );
 5519|      0|                RemoveFromEdgeListByValue( &NNNChargeEdges, eNPlusEdge1 );
 5520|      0|                RemoveFromEdgeListByValue( &NNNChargeEdges, eNMinusEdge2 );
 5521|      0|                RemoveFromEdgeListByValue( &NNNChargeEdges, eNPlusEdge2 );
 5522|      0|            }
 5523|      0|            else
 5524|      0|            {
 5525|      0|                pe->flow++;
 5526|      0|                pBNS->vert[v1].st_edge.flow++;
 5527|      0|                pBNS->vert[v2].st_edge.flow++;
 5528|      0|                pBNS->tot_st_flow += 2;
 5529|      0|                num_failed++;
 5530|      0|            }
 5531|      0|            pe->forbidden &= inv_forbidden_edge_mask;
 5532|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 5533|      0|        }
 5534|      0|    }
 5535|       |
 5536|       |    /* 3rd attempt */
 5537|       |
 5538|       |    /*
 5539|       |    AllChargeEdges.num_edges = 0;
 5540|       |    AllNNNTermAtoms.num_edges = 0;
 5541|       |    NNNChargeEdges.num_edges = 0;
 5542|       |    */
 5543|  4.46k|    for (i = 0; i < num_at && 0 <= ret; i++)
  ------------------
  |  Branch (5543:17): [True: 3.65k, False: 801]
  |  Branch (5543:31): [True: 3.65k, False: 0]
  ------------------
 5544|  3.65k|    {
 5545|       |
 5546|  3.65k|        eNMinusEdge = pVA[i].nCMinusGroupEdge - 1;
 5547|       |        /*eNPlusEdge = pVA[i].nCPlusGroupEdge - 1;*/
 5548|       |
 5549|  3.65k|        if (0 <= eNMinusEdge &&
  ------------------
  |  Branch (5549:13): [True: 11, False: 3.64k]
  ------------------
 5550|  3.65k|             at2[i].valence == 1 &&
  ------------------
  |  Branch (5550:14): [True: 6, False: 5]
  ------------------
 5551|  3.65k|             at2[i].num_H == 0 &&
  ------------------
  |  Branch (5551:14): [True: 6, False: 0]
  ------------------
 5552|  3.65k|             at2[i].radical == 0 &&
  ------------------
  |  Branch (5552:14): [True: 5, False: 1]
  ------------------
 5553|  3.65k|             pVA[i].cNumValenceElectrons == 5 &&  /* terminal N# */
  ------------------
  |  Branch (5553:14): [True: 0, False: 5]
  ------------------
 5554|       |
 5555|  3.65k|             at2[j = at2[i].neighbor[0]].valence == 2 &&
  ------------------
  |  Branch (5555:14): [True: 0, False: 0]
  ------------------
 5556|  3.65k|             at2[j].num_H == 0 &&
  ------------------
  |  Branch (5556:14): [True: 0, False: 0]
  ------------------
 5557|  3.65k|             at2[j].radical == 0 &&
  ------------------
  |  Branch (5557:14): [True: 0, False: 0]
  ------------------
 5558|  3.65k|             pVA[j].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (5558:14): [True: 0, False: 0]
  ------------------
 5559|  3.65k|             ( eNMinusEdge1 = pVA[j].nCMinusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (5559:14): [True: 0, False: 0]
  ------------------
 5560|  3.65k|             ( eNPlusEdge1 = pVA[j].nCPlusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (5560:14): [True: 0, False: 0]
  ------------------
 5561|  3.65k|             !pBNS->edge[eNMinusEdge1].forbidden &&
  ------------------
  |  Branch (5561:14): [True: 0, False: 0]
  ------------------
 5562|  3.65k|             !pBNS->edge[eNPlusEdge1].forbidden &&
  ------------------
  |  Branch (5562:14): [True: 0, False: 0]
  ------------------
 5563|       |
 5564|  3.65k|             at2[k = at2[j].neighbor[at2[j].neighbor[0] == i]].valence == 2 &&
  ------------------
  |  Branch (5564:14): [True: 0, False: 0]
  ------------------
 5565|  3.65k|             at2[k].num_H == 0 &&
  ------------------
  |  Branch (5565:14): [True: 0, False: 0]
  ------------------
 5566|  3.65k|             at2[k].radical == 0 &&
  ------------------
  |  Branch (5566:14): [True: 0, False: 0]
  ------------------
 5567|  3.65k|             pVA[k].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (5567:14): [True: 0, False: 0]
  ------------------
 5568|  3.65k|             ( eNMinusEdge2 = pVA[k].nCMinusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (5568:14): [True: 0, False: 0]
  ------------------
 5569|  3.65k|             ( eNPlusEdge2 = pVA[k].nCPlusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (5569:14): [True: 0, False: 0]
  ------------------
 5570|  3.65k|             !pBNS->edge[eNMinusEdge2].forbidden &&
  ------------------
  |  Branch (5570:14): [True: 0, False: 0]
  ------------------
 5571|  3.65k|             !pBNS->edge[eNPlusEdge2].forbidden &&
  ------------------
  |  Branch (5571:14): [True: 0, False: 0]
  ------------------
 5572|       |
 5573|  3.65k|             pVA[i].cnListIndex > 0 &&
  ------------------
  |  Branch (5573:14): [True: 0, False: 0]
  ------------------
 5574|  3.65k|             cnList[pVA[i].cnListIndex - 1].bits == cn_bits_MN)
  ------------------
  |  |  464|      0|#define cn_bits_MN  MAKE_CN_BITS(cn_bits_M, cn_bits_N, 0, 0)
  |  |  ------------------
  |  |  |  |  449|      0|#define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  |  |  ------------------
  |  |  |  |  |  |  447|      0|#define cn_bits_shift 3
  |  |  |  |  ------------------
  |  |  |  |               #define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  |  |  ------------------
  |  |  |  |  |  |  447|      0|#define cn_bits_shift 3
  |  |  |  |  ------------------
  |  |  |  |               #define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  |  |  ------------------
  |  |  |  |  |  |  447|      0|#define cn_bits_shift 3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (5574:14): [True: 0, False: 0]
  ------------------
 5575|      0|        {
 5576|       |            /* found N#N(+)-N~ or N(-)=N-N= where the last N (at2[k]) may be charged */
 5577|      0|            NNNChargeEdges.num_edges = 0;
 5578|       |
 5579|      0|            eNFlowerEdge1 = GetChargeFlowerUpperEdge( pBNS, pVA, eNPlusEdge1 );
 5580|      0|            eNFlowerEdge2 = GetChargeFlowerUpperEdge( pBNS, pVA, eNPlusEdge2 );
 5581|       |
 5582|       |            /* 1. N(-)=N(+)=N- */
 5583|      0|            if (pBNS->edge[eNMinusEdge].flow == 1 &&  /* N(-) */
  ------------------
  |  Branch (5583:17): [True: 0, False: 0]
  ------------------
 5584|      0|                 pBNS->edge[eNMinusEdge1].flow == 0 && pBNS->edge[eNPlusEdge1].flow == 0 && /* N(+) */
  ------------------
  |  Branch (5584:18): [True: 0, False: 0]
  |  Branch (5584:56): [True: 0, False: 0]
  ------------------
 5585|      0|                 pBNS->edge[eNMinusEdge2].flow == 0 && pBNS->edge[eNPlusEdge2].flow == 1    /* N */)
  ------------------
  |  Branch (5585:18): [True: 0, False: 0]
  |  Branch (5585:56): [True: 0, False: 0]
  ------------------
 5586|      0|            {
 5587|       |                /* fix charges on N(-)=N(+)=N- */
 5588|      0|                if (ret = AddToEdgeList( &CarbonChargeEdges, eNMinusEdge, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5588:21): [True: 0, False: 0]
  ------------------
 5589|      0|                {
 5590|      0|                    goto exit_function;
 5591|      0|                }
 5592|      0|                if (ret = AddToEdgeList( &CarbonChargeEdges, eNPlusEdge1, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5592:21): [True: 0, False: 0]
  ------------------
 5593|      0|                {
 5594|      0|                    goto exit_function;
 5595|      0|                }
 5596|      0|                if (ret = AddToEdgeList( &CarbonChargeEdges, eNMinusEdge1, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5596:21): [True: 0, False: 0]
  ------------------
 5597|      0|                {
 5598|      0|                    goto exit_function;
 5599|      0|                }
 5600|      0|                if (ret = AddToEdgeList( &CarbonChargeEdges, eNPlusEdge2, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5600:21): [True: 0, False: 0]
  ------------------
 5601|      0|                {
 5602|      0|                    goto exit_function;
 5603|      0|                }
 5604|      0|                if (ret = AddToEdgeList( &CarbonChargeEdges, eNMinusEdge2, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5604:21): [True: 0, False: 0]
  ------------------
 5605|      0|                {
 5606|      0|                    goto exit_function;
 5607|      0|                }
 5608|      0|                continue; /* already good */
 5609|      0|            }
 5610|       |            /* 2. N#N(+)-N= */
 5611|      0|            if (pBNS->edge[eNMinusEdge].flow == 0 && /* N */
  ------------------
  |  Branch (5611:17): [True: 0, False: 0]
  ------------------
 5612|      0|                 pBNS->edge[eNMinusEdge1].flow == 0 && pBNS->edge[eNPlusEdge1].flow == 0 && /* N(+) */
  ------------------
  |  Branch (5612:18): [True: 0, False: 0]
  |  Branch (5612:56): [True: 0, False: 0]
  ------------------
 5613|      0|                 pBNS->edge[eNMinusEdge2].flow == 0 && pBNS->edge[eNPlusEdge2].flow == 1    /* N */)
  ------------------
  |  Branch (5613:18): [True: 0, False: 0]
  |  Branch (5613:56): [True: 0, False: 0]
  ------------------
 5614|      0|            {
 5615|       |                /* unfix (-) edge on terminal N# */
 5616|      0|                if (ret = AddToEdgeList( &NNNChargeEdges, eNPlusEdge1, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5616:21): [True: 0, False: 0]
  ------------------
 5617|      0|                {
 5618|      0|                    goto exit_function;
 5619|      0|                }
 5620|      0|                if (ret = AddToEdgeList( &NNNChargeEdges, eNMinusEdge1, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5620:21): [True: 0, False: 0]
  ------------------
 5621|      0|                {
 5622|      0|                    goto exit_function;
 5623|      0|                }
 5624|      0|                if (ret = AddToEdgeList( &NNNChargeEdges, eNPlusEdge2, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5624:21): [True: 0, False: 0]
  ------------------
 5625|      0|                {
 5626|      0|                    goto exit_function;
 5627|      0|                }
 5628|      0|                if (ret = AddToEdgeList( &NNNChargeEdges, eNMinusEdge2, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5628:21): [True: 0, False: 0]
  ------------------
 5629|      0|                {
 5630|      0|                    goto exit_function;
 5631|      0|                }
 5632|      0|                pe = pBNS->edge + pBNS->vert[i].iedge[0];
 5633|      0|                nDeltaChargeMax = 0;
 5634|      0|                nDeltaChargeMax = ( num_failed && !num_success && pStruct->nNumRemovedProtonsMobHInChI > 0 ) ? 2 : 0;
  ------------------
  |  Branch (5634:37): [True: 0, False: 0]
  |  Branch (5634:51): [True: 0, False: 0]
  |  Branch (5634:67): [True: 0, False: 0]
  ------------------
 5635|      0|            }
 5636|      0|            else
 5637|      0|            {
 5638|       |                /* 3. N(-)=N-N= */
 5639|      0|                if (pBNS->edge[eNMinusEdge].flow == 1 && /* N(-) */
  ------------------
  |  Branch (5639:21): [True: 0, False: 0]
  ------------------
 5640|      0|                     pBNS->edge[eNMinusEdge1].flow == 0 && pBNS->edge[eNPlusEdge1].flow == 1 && /* N */
  ------------------
  |  Branch (5640:22): [True: 0, False: 0]
  |  Branch (5640:60): [True: 0, False: 0]
  ------------------
 5641|      0|                     pBNS->edge[eNMinusEdge2].flow == 0 && pBNS->edge[eNPlusEdge2].flow == 1    /* N */)
  ------------------
  |  Branch (5641:22): [True: 0, False: 0]
  |  Branch (5641:60): [True: 0, False: 0]
  ------------------
 5642|      0|                {
 5643|       |                    /* unfix (+) edge on middle N */
 5644|      0|                    if (ret = AddToEdgeList( &NNNChargeEdges, eNMinusEdge, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5644:25): [True: 0, False: 0]
  ------------------
 5645|      0|                    {
 5646|      0|                        goto exit_function;
 5647|      0|                    }
 5648|      0|                    if (ret = AddToEdgeList( &NNNChargeEdges, eNMinusEdge1, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5648:25): [True: 0, False: 0]
  ------------------
 5649|      0|                    {
 5650|      0|                        goto exit_function;
 5651|      0|                    }
 5652|      0|                    if (ret = AddToEdgeList( &NNNChargeEdges, eNPlusEdge2, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5652:25): [True: 0, False: 0]
  ------------------
 5653|      0|                    {
 5654|      0|                        goto exit_function;
 5655|      0|                    }
 5656|      0|                    if (ret = AddToEdgeList( &NNNChargeEdges, eNMinusEdge2, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5656:25): [True: 0, False: 0]
  ------------------
 5657|      0|                    {
 5658|      0|                        goto exit_function;
 5659|      0|                    }
 5660|      0|                    if (NO_VERTEX != eNFlowerEdge1 &&
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (5660:25): [True: 0, False: 0]
  ------------------
 5661|      0|                        ( ret = AddToEdgeList( &NNNChargeEdges, eNFlowerEdge1, INC_EDGE_LIST ) ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5661:25): [True: 0, False: 0]
  ------------------
 5662|      0|                    {
 5663|      0|                        goto exit_function;
 5664|      0|                    }
 5665|       |                    /* decrement flow on (+) charge edge of the middle =N- */
 5666|      0|                    pe = pBNS->edge + eNPlusEdge1;
 5667|      0|                    nDeltaChargeMax = 2;
 5668|      0|                }
 5669|      0|                else
 5670|      0|                {
 5671|       |                    /* 4. N#N(+)-N(-)- */
 5672|      0|                    if (pBNS->edge[eNMinusEdge].flow == 0 &&  /* N */
  ------------------
  |  Branch (5672:25): [True: 0, False: 0]
  ------------------
 5673|      0|                         pBNS->edge[eNMinusEdge1].flow == 0 && pBNS->edge[eNPlusEdge1].flow == 0 && /* N(+) */
  ------------------
  |  Branch (5673:26): [True: 0, False: 0]
  |  Branch (5673:64): [True: 0, False: 0]
  ------------------
 5674|      0|                         pBNS->edge[eNMinusEdge2].flow == 1 && pBNS->edge[eNPlusEdge2].flow == 1    /* N(-) */)
  ------------------
  |  Branch (5674:26): [True: 0, False: 0]
  |  Branch (5674:64): [True: 0, False: 0]
  ------------------
 5675|      0|                    {
 5676|       |                        /* unfix (-) edge on the 1st and 3rd N */
 5677|      0|                        if (ret = AddToEdgeList( &NNNChargeEdges, eNPlusEdge1, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5677:29): [True: 0, False: 0]
  ------------------
 5678|      0|                        {
 5679|      0|                            goto exit_function;
 5680|      0|                        }
 5681|      0|                        if (ret = AddToEdgeList( &NNNChargeEdges, eNMinusEdge1, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5681:29): [True: 0, False: 0]
  ------------------
 5682|      0|                        {
 5683|      0|                            goto exit_function;
 5684|      0|                        }
 5685|      0|                        if (ret = AddToEdgeList( &NNNChargeEdges, eNPlusEdge2, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5685:29): [True: 0, False: 0]
  ------------------
 5686|      0|                        {
 5687|      0|                            goto exit_function;
 5688|      0|                        }
 5689|       |                        /* decrement triple bond on terminal N# */
 5690|      0|                        pe = pBNS->edge + pBNS->vert[i].iedge[0];
 5691|      0|                        nDeltaChargeMax = 0;
 5692|      0|                    }
 5693|      0|                    else
 5694|      0|                    {
 5695|       |                        /* 5. N#N(+)-N(+)# */
 5696|      0|                        if (pBNS->edge[eNMinusEdge].flow == 0 &&  /* N */
  ------------------
  |  Branch (5696:29): [True: 0, False: 0]
  ------------------
 5697|      0|                             pBNS->edge[eNMinusEdge1].flow == 0 && pBNS->edge[eNPlusEdge1].flow == 0 && /* N(+) */
  ------------------
  |  Branch (5697:30): [True: 0, False: 0]
  |  Branch (5697:68): [True: 0, False: 0]
  ------------------
 5698|      0|                             pBNS->edge[eNMinusEdge2].flow == 0 && pBNS->edge[eNPlusEdge2].flow == 0    /* N(+) */)
  ------------------
  |  Branch (5698:30): [True: 0, False: 0]
  |  Branch (5698:68): [True: 0, False: 0]
  ------------------
 5699|      0|                        {
 5700|       |                            /* unfix (-) edge on the 1st and (+) edge on the 3rd N */
 5701|      0|                            if (ret = AddToEdgeList( &NNNChargeEdges, eNPlusEdge1, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5701:33): [True: 0, False: 0]
  ------------------
 5702|      0|                            {
 5703|      0|                                goto exit_function;
 5704|      0|                            }
 5705|      0|                            if (ret = AddToEdgeList( &NNNChargeEdges, eNMinusEdge1, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5705:33): [True: 0, False: 0]
  ------------------
 5706|      0|                            {
 5707|      0|                                goto exit_function;
 5708|      0|                            }
 5709|      0|                            if (ret = AddToEdgeList( &NNNChargeEdges, eNMinusEdge2, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5709:33): [True: 0, False: 0]
  ------------------
 5710|      0|                            {
 5711|      0|                                goto exit_function;
 5712|      0|                            }
 5713|       |                            /* decrement triple bond on terminal N# */
 5714|      0|                            pe = pBNS->edge + pBNS->vert[i].iedge[0];
 5715|      0|                            nDeltaChargeMax = 0;
 5716|      0|                        }
 5717|      0|                        else
 5718|      0|                        {
 5719|      0|                            continue;
 5720|      0|                        }
 5721|      0|                    }
 5722|      0|                }
 5723|      0|            }
 5724|       |
 5725|      0|            if (NO_VERTEX != eNFlowerEdge1 && !pBNS->edge[eNFlowerEdge1].flow)
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (5725:17): [True: 0, False: 0]
  |  Branch (5725:47): [True: 0, False: 0]
  ------------------
 5726|      0|            {
 5727|      0|                if (ret = AddToEdgeList( &NNNChargeEdges, eNFlowerEdge1, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5727:21): [True: 0, False: 0]
  ------------------
 5728|      0|                {
 5729|      0|                    goto exit_function;
 5730|      0|                }
 5731|      0|            }
 5732|      0|            if (NO_VERTEX != eNFlowerEdge2 && !pBNS->edge[eNFlowerEdge2].flow)
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (5732:17): [True: 0, False: 0]
  |  Branch (5732:47): [True: 0, False: 0]
  ------------------
 5733|      0|            {
 5734|      0|                if (ret = AddToEdgeList( &NNNChargeEdges, eNFlowerEdge2, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5734:21): [True: 0, False: 0]
  ------------------
 5735|      0|                {
 5736|      0|                    goto exit_function;
 5737|      0|                }
 5738|      0|            }
 5739|       |
 5740|      0|            v1 = pe->neighbor1;
 5741|      0|            v2 = pe->neighbor12 ^ v1;
 5742|      0|            pe->flow--;
 5743|      0|            pBNS->vert[v1].st_edge.flow--;
 5744|      0|            pBNS->vert[v2].st_edge.flow--;
 5745|      0|            pBNS->tot_st_flow -= 2;
 5746|       |
 5747|      0|            pe->forbidden |= forbidden_edge_mask;
 5748|       |
 5749|      0|            if (!CarbonChargeEdges.num_edges)
  ------------------
  |  Branch (5749:17): [True: 0, False: 0]
  ------------------
 5750|      0|            {
 5751|       |                /* do not let carbon atoms get charged */
 5752|      0|                AllocEdgeList( &CarbonChargeEdges, INC_EDGE_LIST );
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
 5753|      0|                if (0 > ( ret = ForbidCarbonChargeEdges( pBNS, pTCGroups, &CarbonChargeEdges, forbidden_edge_mask ) ))
  ------------------
  |  Branch (5753:21): [True: 0, False: 0]
  ------------------
 5754|      0|                {
 5755|      0|                    goto exit_function;
 5756|      0|                }
 5757|      0|            }
 5758|      0|            else
 5759|      0|            {
 5760|      0|                SetForbiddenEdgeMask( pBNS, &CarbonChargeEdges, forbidden_edge_mask );
 5761|      0|            }
 5762|      0|            SetForbiddenEdgeMask( pBNS, &NNNChargeEdges, forbidden_edge_mask );
 5763|       |
 5764|      0|            ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 5765|      0|                                  &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 5766|       |
 5767|      0|            if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (5767:17): [True: 0, False: 0]
  |  Branch (5767:31): [True: 0, False: 0]
  |  Branch (5767:49): [True: 0, False: 0]
  ------------------
 5768|      0|                vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge <= nDeltaChargeMax)
  ------------------
  |  Branch (5768:17): [True: 0, False: 0]
  |  Branch (5768:35): [True: 0, False: 0]
  |  Branch (5768:57): [True: 0, False: 0]
  ------------------
 5769|      0|            {
 5770|      0|                ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 5771|      0|                ( *pnNumRunBNS )++;
 5772|      0|                *pnTotalDelta += ret;
 5773|      0|                num_success++;
 5774|       |                /* fix charges on N(-)=N(+)=N- */
 5775|      0|                if (ret = AddToEdgeList( &CarbonChargeEdges, eNMinusEdge, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5775:21): [True: 0, False: 0]
  ------------------
 5776|      0|                {
 5777|      0|                    goto exit_function;
 5778|      0|                }
 5779|      0|                if (ret = AddToEdgeList( &CarbonChargeEdges, eNPlusEdge1, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5779:21): [True: 0, False: 0]
  ------------------
 5780|      0|                {
 5781|      0|                    goto exit_function;
 5782|      0|                }
 5783|      0|                if (ret = AddToEdgeList( &CarbonChargeEdges, eNMinusEdge1, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5783:21): [True: 0, False: 0]
  ------------------
 5784|      0|                {
 5785|      0|                    goto exit_function;
 5786|      0|                }
 5787|      0|                if (ret = AddToEdgeList( &CarbonChargeEdges, eNPlusEdge2, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5787:21): [True: 0, False: 0]
  ------------------
 5788|      0|                {
 5789|      0|                    goto exit_function;
 5790|      0|                }
 5791|      0|                if (ret = AddToEdgeList( &CarbonChargeEdges, eNMinusEdge2, INC_EDGE_LIST ))
  ------------------
  |  | 5141|      0|#define INC_EDGE_LIST 16
  ------------------
  |  Branch (5791:21): [True: 0, False: 0]
  ------------------
 5792|      0|                {
 5793|      0|                    goto exit_function;
 5794|      0|                }
 5795|      0|            }
 5796|      0|            else
 5797|      0|            {
 5798|      0|                pe->flow++;
 5799|      0|                pBNS->vert[v1].st_edge.flow++;
 5800|      0|                pBNS->vert[v2].st_edge.flow++;
 5801|      0|                pBNS->tot_st_flow += 2;
 5802|      0|                num_failed++;
 5803|      0|            }
 5804|      0|            RemoveForbiddenEdgeMask( pBNS, &CarbonChargeEdges, forbidden_edge_mask );
 5805|      0|            RemoveForbiddenEdgeMask( pBNS, &NNNChargeEdges, forbidden_edge_mask );
 5806|      0|            pe->forbidden &= inv_forbidden_edge_mask;
 5807|       |            /*pBNS->edge[eNPlusEdge].forbidden &= inv_forbidden_edge_mask;*/ /* BC: array index out of range */
 5808|      0|        }
 5809|  3.65k|    }
 5810|    801|    RemoveForbiddenEdgeMask( pBNS, &CarbonChargeEdges, forbidden_edge_mask );
 5811|       |
 5812|       |
 5813|    801|exit_function:
 5814|       |
 5815|    801|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|    801|#define EDGE_LIST_FREE   (-2)
  ------------------
 5816|    801|    AllocEdgeList( &AllChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|    801|#define EDGE_LIST_FREE   (-2)
  ------------------
 5817|    801|    AllocEdgeList( &NNNChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|    801|#define EDGE_LIST_FREE   (-2)
  ------------------
 5818|    801|    AllocEdgeList( &CurNNNChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|    801|#define EDGE_LIST_FREE   (-2)
  ------------------
 5819|    801|    AllocEdgeList( &AllNNNTermAtoms, EDGE_LIST_FREE );
  ------------------
  |  |  271|    801|#define EDGE_LIST_FREE   (-2)
  ------------------
 5820|    801|    AllocEdgeList( &AllNIIIChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|    801|#define EDGE_LIST_FREE   (-2)
  ------------------
 5821|       |
 5822|    801|    return ret;
 5823|    801|#undef INC_EDGE_LIST
 5824|    801|}
EliminateNitrogen5Val3Bonds:
 5838|    801|{
 5839|    801|    int i, j, k, bForbiddenCarbonCharges, ret2, ret;
 5840|    801|    int num_at = pStruct->num_atoms;
 5841|    801|    int num_deleted_H = pStruct->num_deleted_H;
 5842|    801|    int len_at = num_at + num_deleted_H;
 5843|    801|    int inv_forbidden_edge_mask = ~forbidden_edge_mask;
 5844|    801|    EDGE_LIST CarbonChargeEdges;
 5845|       |
 5846|    801|    ret = 0;
 5847|    801|    bForbiddenCarbonCharges = 0;
 5848|    801|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|    801|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 5849|       |
 5850|    801|    memcpy( at2, at, len_at * sizeof( at2[0] ) );
 5851|    801|    pStruct->at = at2;
 5852|    801|    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 5853|    801|    if (ret2 < 0)
  ------------------
  |  Branch (5853:9): [True: 0, False: 801]
  ------------------
 5854|      0|    {
 5855|      0|        ret = ret2;
 5856|      0|        goto exit_function;
 5857|      0|    }
 5858|       |
 5859|       |    /* forbid creation of other N(V) atoms */
 5860|       |    /* fix single bonds to metals */
 5861|  4.46k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (5861:17): [True: 3.65k, False: 801]
  ------------------
 5862|  3.65k|    {
 5863|  3.65k|        if (pVA[i].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (5863:13): [True: 480, False: 3.17k]
  ------------------
 5864|  3.65k|             0 <= ( k = GetChargeFlowerUpperEdge( pBNS, pVA, pVA[i].nCPlusGroupEdge - 1 ) ) &&
  ------------------
  |  Branch (5864:14): [True: 0, False: 480]
  ------------------
 5865|  3.65k|             1 == pBNS->edge[k].flow)
  ------------------
  |  Branch (5865:14): [True: 0, False: 0]
  ------------------
 5866|      0|        {
 5867|      0|            pBNS->edge[k].forbidden |= forbidden_edge_mask;
 5868|      0|        }
 5869|  3.65k|        else
 5870|  3.65k|            if (pVA[i].cMetal)
  ------------------
  |  Branch (5870:17): [True: 1.94k, False: 1.71k]
  ------------------
 5871|  1.94k|            {
 5872|  1.94k|                for (j = 0; j < at2[i].valence; j++)
  ------------------
  |  Branch (5872:29): [True: 0, False: 1.94k]
  ------------------
 5873|      0|                {
 5874|      0|                    if (BOND_TYPE_SINGLE == ( at2[i].bond_type[j] & BOND_TYPE_MASK ))
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
                                  if (BOND_TYPE_SINGLE == ( at2[i].bond_type[j] & BOND_TYPE_MASK ))
  ------------------
  |  |  217|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
  |  Branch (5874:25): [True: 0, False: 0]
  ------------------
 5875|      0|                    {
 5876|      0|                        pBNS->edge[pBNS->vert[i].iedge[j]].forbidden |= forbidden_edge_mask;
 5877|      0|                    }
 5878|      0|                }
 5879|  1.94k|            }
 5880|  3.65k|    }
 5881|       |
 5882|       |    /*------------------------------------------------------------------------------
 5883|       |                 (+)  single line => flow = 0                            (+)-(Y)=(+)super
 5884|       |            01  //    double line => flow = 1                fix-> 01   // <-- fix
 5885|       |         1 --- 0                                                 1 === 0
 5886|       |          \\ //         edge eij connects vertices i < j:         \   /  02
 5887|       |        12  2   02 <--- edge number: e02 connects vertices v0   12  2(..) <- double 'radical'
 5888|       |            |                        v0 and v2                      |
 5889|       |           =N=      vertex N has number i                          =N=
 5890|       |            |                                                       |
 5891|       |    --------------------------------------------------------------------------------*/
 5892|  4.46k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (5892:17): [True: 3.65k, False: 801]
  ------------------
 5893|  3.65k|    {
 5894|  3.65k|        if (pVA[i].cNumValenceElectrons == 5 && at2[i].valence == 3 &&
  ------------------
  |  Branch (5894:13): [True: 480, False: 3.17k]
  |  Branch (5894:49): [True: 0, False: 480]
  ------------------
 5895|  3.65k|             at2[i].chem_bonds_valence == 5 && !at2[i].charge && !at2[i].radical &&
  ------------------
  |  Branch (5895:14): [True: 0, False: 0]
  |  Branch (5895:48): [True: 0, False: 0]
  |  Branch (5895:66): [True: 0, False: 0]
  ------------------
 5896|  3.65k|             !( at2[i].endpoint || pStruct->endpoint && pStruct->endpoint[i] ) && pVA[i].cnListIndex > 0 &&
  ------------------
  |  Branch (5896:17): [True: 0, False: 0]
  |  Branch (5896:36): [True: 0, False: 0]
  |  Branch (5896:57): [True: 0, False: 0]
  |  Branch (5896:83): [True: 0, False: 0]
  ------------------
 5897|  3.65k|             cnList[pVA[i].cnListIndex - 1].bits == cn_bits_NPN &&
  ------------------
  |  |  453|      0|#define cn_bits_NPN MAKE_CN_BITS(cn_bits_N, cn_bits_P, cn_bits_N, 0)
  |  |  ------------------
  |  |  |  |  449|  3.65k|#define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  |  |  ------------------
  |  |  |  |  |  |  447|      0|#define cn_bits_shift 3
  |  |  |  |  ------------------
  |  |  |  |               #define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  |  |  ------------------
  |  |  |  |  |  |  447|      0|#define cn_bits_shift 3
  |  |  |  |  ------------------
  |  |  |  |               #define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  |  |  ------------------
  |  |  |  |  |  |  447|      0|#define cn_bits_shift 3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (5897:14): [True: 0, False: 0]
  ------------------
 5898|  3.65k|             pVA[i].nCPlusGroupEdge > 0)
  ------------------
  |  Branch (5898:14): [True: 0, False: 0]
  ------------------
 5899|      0|        {
 5900|       |
 5901|      0|            Vertex v, v0 = NO_VERTEX, v1 = NO_VERTEX, v2 = NO_VERTEX;
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
                          Vertex v, v0 = NO_VERTEX, v1 = NO_VERTEX, v2 = NO_VERTEX;
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
                          Vertex v, v0 = NO_VERTEX, v1 = NO_VERTEX, v2 = NO_VERTEX;
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
 5902|      0|            EdgeIndex iePlus, ie, ie12 = NO_VERTEX, ie02, ie01;
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
 5903|      0|            BNS_VERTEX *pv0, *pv1, *pv2 = NULL;
 5904|      0|            BNS_EDGE   *pePlus, *pe, *pe12 = NULL, *pe02 = NULL, *pe01 = NULL;
 5905|      0|            Vertex     vPathStart, vPathEnd;
 5906|      0|            int        nPathLen;
 5907|      0|            int        nDeltaH, nDeltaCharge, nNumVisitedAtoms;
 5908|       |
 5909|      0|            iePlus = pVA[i].nCPlusGroupEdge - 1;
 5910|      0|            pePlus = pBNS->edge + iePlus;
 5911|       |
 5912|      0|            v0 = IS_BNS_VT_C_GR( pBNS->vert[pePlus->neighbor1].type ) ?
  ------------------
  |  |  106|      0|#define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   99|      0|#define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|      0|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  |  |  ------------------
  |  |  |  |               #define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|      0|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   77|      0|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  |  |  |  Branch (106:37): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 5913|      0|                ( pePlus->neighbor1 ^ pePlus->neighbor12 ) : pePlus->neighbor1;
 5914|      0|            pv0 = pBNS->vert + v0;
 5915|      0|            for (j = 0; j < pv0->num_adj_edges; j++)
  ------------------
  |  Branch (5915:25): [True: 0, False: 0]
  ------------------
 5916|      0|            {
 5917|      0|                ie = pv0->iedge[j];
 5918|      0|                if (ie == iePlus)
  ------------------
  |  Branch (5918:21): [True: 0, False: 0]
  ------------------
 5919|      0|                {
 5920|      0|                    continue;
 5921|      0|                }
 5922|      0|                pe = pBNS->edge + ie;
 5923|      0|                if (pe->flow == 1 && v2 == NO_VERTEX)
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (5923:21): [True: 0, False: 0]
  |  Branch (5923:38): [True: 0, False: 0]
  ------------------
 5924|      0|                {
 5925|       |                    /* 0 - 2, edge 02 */
 5926|      0|                    v2 = pe->neighbor12 ^ v0;
 5927|      0|                    pv2 = pBNS->vert + v2;
 5928|      0|                    ie02 = ie;
 5929|      0|                    pe02 = pe;
 5930|      0|                }
 5931|      0|                else
 5932|      0|                {
 5933|      0|                    if (pe->flow == 0 && v1 == NO_VERTEX)
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (5933:25): [True: 0, False: 0]
  |  Branch (5933:42): [True: 0, False: 0]
  ------------------
 5934|      0|                    {
 5935|       |                        /* 0 - 1, edge 01 */
 5936|      0|                        v1 = pe->neighbor12 ^ v0;
 5937|      0|                        pv1 = pBNS->vert + v2;
 5938|      0|                        ie01 = ie;
 5939|      0|                        pe01 = pe;
 5940|      0|                    }
 5941|      0|                    else
 5942|      0|                    {
 5943|      0|                        ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 5944|      0|                        goto exit_function;
 5945|      0|                    }
 5946|      0|                }
 5947|      0|            }
 5948|      0|            if (v1 == NO_VERTEX || v2 == NO_VERTEX)
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
                          if (v1 == NO_VERTEX || v2 == NO_VERTEX)
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (5948:17): [True: 0, False: 0]
  |  Branch (5948:36): [True: 0, False: 0]
  ------------------
 5949|      0|            {
 5950|      0|                ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 5951|      0|                goto exit_function;
 5952|      0|            }
 5953|      0|            for (j = 0; j < pv2->num_adj_edges; j++)
  ------------------
  |  Branch (5953:25): [True: 0, False: 0]
  ------------------
 5954|      0|            {
 5955|      0|                ie = pv2->iedge[j];
 5956|      0|                pe = pBNS->edge + ie;
 5957|      0|                v = pe->neighbor12 ^ v2;
 5958|      0|                if (v == v0 || v == i)
  ------------------
  |  Branch (5958:21): [True: 0, False: 0]
  |  Branch (5958:32): [True: 0, False: 0]
  ------------------
 5959|      0|                {
 5960|      0|                    continue;
 5961|      0|                }
 5962|      0|                else
 5963|      0|                {
 5964|      0|                    if (v == v1 && pe->flow == 1)
  ------------------
  |  Branch (5964:25): [True: 0, False: 0]
  |  Branch (5964:36): [True: 0, False: 0]
  ------------------
 5965|      0|                    {
 5966|       |                        /* 1 - 2, edge 12 */
 5967|      0|                        ie12 = ie;
 5968|      0|                        pe12 = pe;
 5969|      0|                    }
 5970|      0|                    else
 5971|      0|                    {
 5972|      0|                        ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 5973|      0|                        goto exit_function;
 5974|      0|                    }
 5975|      0|                }
 5976|      0|            }
 5977|      0|            if (ie12 == NO_VERTEX)
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (5977:17): [True: 0, False: 0]
  ------------------
 5978|      0|            {
 5979|      0|                ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 5980|      0|                goto exit_function;
 5981|      0|            }
 5982|       |            /* rearrange cap and flow, forbid 2 edges */
 5983|      0|            pe01->flow = 1;
 5984|      0|            pe12->flow = 0;
 5985|      0|            pe02->flow = 0;
 5986|      0|            pv2->st_edge.flow -= 2;
 5987|      0|            pBNS->tot_st_flow -= 2;
 5988|      0|            pePlus->forbidden |= forbidden_edge_mask;
 5989|      0|            pe01->forbidden |= forbidden_edge_mask;
 5990|       |
 5991|      0|            if (!bForbiddenCarbonCharges)
  ------------------
  |  Branch (5991:17): [True: 0, False: 0]
  ------------------
 5992|      0|            {
 5993|      0|                if (0 > ( ret = ForbidCarbonChargeEdges( pBNS, pTCGroups, &CarbonChargeEdges, forbidden_edge_mask ) ))
  ------------------
  |  Branch (5993:21): [True: 0, False: 0]
  ------------------
 5994|      0|                {
 5995|      0|                    goto exit_function;
 5996|      0|                }
 5997|      0|                bForbiddenCarbonCharges = 1;
 5998|      0|            }
 5999|       |
 6000|       |
 6001|      0|            ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 6002|      0|                                  &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 6003|      0|            if (ret == 1 && vPathEnd == v2 && vPathStart == v2 && nDeltaCharge <= ( pVA[i].cNumBondsToMetal ? 2 : 0 ))
  ------------------
  |  Branch (6003:17): [True: 0, False: 0]
  |  Branch (6003:29): [True: 0, False: 0]
  |  Branch (6003:47): [True: 0, False: 0]
  |  Branch (6003:67): [True: 0, False: 0]
  |  Branch (6003:85): [True: 0, False: 0]
  ------------------
 6004|      0|            {
 6005|      0|                ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 6006|      0|            }
 6007|      0|            else
 6008|      0|            {
 6009|      0|                pe01->flow = 0;
 6010|      0|                pe12->flow = 1;
 6011|      0|                pe02->flow = 1;
 6012|      0|                pv2->st_edge.flow += 2;
 6013|      0|                pBNS->tot_st_flow += 2;
 6014|      0|            }
 6015|      0|            pePlus->forbidden &= inv_forbidden_edge_mask;
 6016|      0|            pe01->forbidden &= inv_forbidden_edge_mask;
 6017|       |
 6018|      0|            if (ret < 0)
  ------------------
  |  Branch (6018:17): [True: 0, False: 0]
  ------------------
 6019|      0|            {
 6020|      0|                goto exit_function;
 6021|      0|            }
 6022|      0|            else
 6023|      0|            {
 6024|      0|                if (ret)
  ------------------
  |  Branch (6024:21): [True: 0, False: 0]
  ------------------
 6025|      0|                {
 6026|      0|                    memcpy( at2, at, len_at * sizeof( at2[0] ) );
 6027|      0|                    pStruct->at = at2;
 6028|      0|                    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 6029|      0|                    if (ret2 < 0)
  ------------------
  |  Branch (6029:25): [True: 0, False: 0]
  ------------------
 6030|      0|                    {
 6031|      0|                        ret = ret2;
 6032|      0|                        goto exit_function;
 6033|      0|                    }
 6034|      0|                }
 6035|      0|            }
 6036|      0|        }
 6037|  3.65k|    }
 6038|       |
 6039|    801|exit_function:
 6040|       |
 6041|       |    /* allow creation of other N(V) atoms */
 6042|  4.46k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (6042:17): [True: 3.65k, False: 801]
  ------------------
 6043|  3.65k|    {
 6044|  3.65k|        if (pVA[i].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (6044:13): [True: 480, False: 3.17k]
  ------------------
 6045|  3.65k|             0 <= ( k = GetChargeFlowerUpperEdge( pBNS, pVA, pVA[i].nCPlusGroupEdge - 1 ) ) &&
  ------------------
  |  Branch (6045:14): [True: 0, False: 480]
  ------------------
 6046|  3.65k|             1 == pBNS->edge[k].flow && ( pBNS->edge[k].forbidden & forbidden_edge_mask ))
  ------------------
  |  Branch (6046:14): [True: 0, False: 0]
  |  Branch (6046:41): [True: 0, False: 0]
  ------------------
 6047|      0|        {
 6048|      0|            pBNS->edge[k].forbidden &= inv_forbidden_edge_mask;
 6049|      0|        }
 6050|  3.65k|        else
 6051|  3.65k|        {
 6052|  3.65k|            if (pVA[i].cMetal)
  ------------------
  |  Branch (6052:17): [True: 1.94k, False: 1.71k]
  ------------------
 6053|  1.94k|            {
 6054|  1.94k|                for (j = 0; j < at2[i].valence; j++)
  ------------------
  |  Branch (6054:29): [True: 0, False: 1.94k]
  ------------------
 6055|      0|                {
 6056|      0|                    if (BOND_TYPE_SINGLE == ( at2[i].bond_type[j] & BOND_TYPE_MASK ))
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
                                  if (BOND_TYPE_SINGLE == ( at2[i].bond_type[j] & BOND_TYPE_MASK ))
  ------------------
  |  |  217|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
  |  Branch (6056:25): [True: 0, False: 0]
  ------------------
 6057|      0|                    {
 6058|      0|                        pBNS->edge[pBNS->vert[i].iedge[j]].forbidden &= inv_forbidden_edge_mask;
 6059|      0|                    }
 6060|      0|                }
 6061|  1.94k|            }
 6062|  3.65k|        }
 6063|  3.65k|    }
 6064|    801|    RemoveForbiddenEdgeMask( pBNS, &CarbonChargeEdges, forbidden_edge_mask );
 6065|    801|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|    801|#define EDGE_LIST_FREE   (-2)
  ------------------
 6066|       |
 6067|    801|    return ret;
 6068|    801|}
Convert_SIV_to_SVI:
 6082|    801|{
 6083|    801|    int i, j, k, neigh, bForbiddenCarbonCharges, nFlowerEdge, delta, ret2, ret;
 6084|    801|    int num_at = pStruct->num_atoms;
 6085|    801|    int num_deleted_H = pStruct->num_deleted_H;
 6086|    801|    int len_at = num_at + num_deleted_H;
 6087|    801|    int inv_forbidden_edge_mask = ~forbidden_edge_mask;
 6088|    801|    EDGE_LIST CarbonChargeEdges, FlowerEdgesList;
 6089|       |
 6090|    801|    ret = 0;
 6091|    801|    bForbiddenCarbonCharges = 0;
 6092|    801|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|    801|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 6093|    801|    AllocEdgeList( &FlowerEdgesList, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|    801|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 6094|       |
 6095|    801|    memcpy( at2, at, len_at * sizeof( at2[0] ) );
 6096|    801|    pStruct->at = at2;
 6097|    801|    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 6098|    801|    if (ret2 < 0)
  ------------------
  |  Branch (6098:9): [True: 0, False: 801]
  ------------------
 6099|      0|    {
 6100|      0|        ret = ret2;
 6101|      0|        goto exit_function;
 6102|      0|    }
 6103|       |
 6104|       |    /* forbid creation of other S(IV) atoms */
 6105|       |    /* fix single bonds to metals and (N(IV), flow=1), (S(IV), flow=0) */
 6106|  4.46k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (6106:17): [True: 3.65k, False: 801]
  ------------------
 6107|  3.65k|    {
 6108|  3.65k|        if (( pVA[i].cNumValenceElectrons == 5 /* N(IV)*/ || pVA[i].cNumValenceElectrons == 6 /* S(VI)*/ ) &&
  ------------------
  |  Branch (6108:15): [True: 480, False: 3.17k]
  |  Branch (6108:62): [True: 208, False: 2.97k]
  ------------------
 6109|  3.65k|             0 <= ( k = GetChargeFlowerUpperEdge( pBNS, pVA, pVA[i].nCPlusGroupEdge - 1 ) ) &&
  ------------------
  |  Branch (6109:14): [True: 2, False: 686]
  ------------------
 6110|  3.65k|             !pBNS->edge[k].forbidden &&
  ------------------
  |  Branch (6110:14): [True: 2, False: 0]
  ------------------
 6111|  3.65k|             6 == pVA[i].cNumValenceElectrons + pBNS->edge[k].flow)
  ------------------
  |  Branch (6111:14): [True: 2, False: 0]
  ------------------
 6112|      2|        {
 6113|       |
 6114|      2|            pBNS->edge[k].forbidden |= forbidden_edge_mask;
 6115|      2|            if (ret = AddToEdgeList( &FlowerEdgesList, k, 64 ))
  ------------------
  |  Branch (6115:17): [True: 0, False: 2]
  ------------------
 6116|      0|            {
 6117|      0|                goto exit_function;
 6118|      0|            }
 6119|      2|        }
 6120|  3.65k|        else
 6121|  3.65k|        {
 6122|  3.65k|            if (pVA[i].cMetal)
  ------------------
  |  Branch (6122:17): [True: 1.94k, False: 1.70k]
  ------------------
 6123|  1.94k|            {
 6124|  1.94k|                for (j = 0; j < at2[i].valence; j++)
  ------------------
  |  Branch (6124:29): [True: 0, False: 1.94k]
  ------------------
 6125|      0|                {
 6126|      0|                    if (BOND_TYPE_SINGLE == ( at2[i].bond_type[j] & BOND_TYPE_MASK ))
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
                                  if (BOND_TYPE_SINGLE == ( at2[i].bond_type[j] & BOND_TYPE_MASK ))
  ------------------
  |  |  217|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
  |  Branch (6126:25): [True: 0, False: 0]
  ------------------
 6127|      0|                    {
 6128|       |
 6129|      0|                        pBNS->edge[k = pBNS->vert[i].iedge[j]].forbidden |= forbidden_edge_mask;
 6130|      0|                        if (ret = AddToEdgeList( &FlowerEdgesList, k, 64 ))
  ------------------
  |  Branch (6130:29): [True: 0, False: 0]
  ------------------
 6131|      0|                        {
 6132|      0|                            goto exit_function;
 6133|      0|                        }
 6134|      0|                    }
 6135|      0|                }
 6136|  1.94k|            }
 6137|  1.70k|            else
 6138|  1.70k|            {
 6139|       |                /* fix bonds to neighbors of S(IV) if they are not O,S,Se,Te with 2 or more bonds */
 6140|       |                 /* exactly same if(..) as below */
 6141|  1.70k|                if (pVA[i].cNumValenceElectrons == 6 && at2[i].valence == 4 &&
  ------------------
  |  Branch (6141:21): [True: 206, False: 1.50k]
  |  Branch (6141:57): [True: 0, False: 206]
  ------------------
 6142|  1.70k|                     at2[i].chem_bonds_valence == 4 && !at2[i].charge && !at2[i].radical &&
  ------------------
  |  Branch (6142:22): [True: 0, False: 0]
  |  Branch (6142:56): [True: 0, False: 0]
  |  Branch (6142:74): [True: 0, False: 0]
  ------------------
 6143|  1.70k|                     !at2[i].endpoint && pVA[i].cnListIndex > 0 &&
  ------------------
  |  Branch (6143:22): [True: 0, False: 0]
  |  Branch (6143:42): [True: 0, False: 0]
  ------------------
 6144|  1.70k|                     cnList[pVA[i].cnListIndex - 1].bits == cn_bits_NPN &&
  ------------------
  |  |  453|      0|#define cn_bits_NPN MAKE_CN_BITS(cn_bits_N, cn_bits_P, cn_bits_N, 0)
  |  |  ------------------
  |  |  |  |  449|  1.70k|#define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  |  |  ------------------
  |  |  |  |  |  |  447|      0|#define cn_bits_shift 3
  |  |  |  |  ------------------
  |  |  |  |               #define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  |  |  ------------------
  |  |  |  |  |  |  447|      0|#define cn_bits_shift 3
  |  |  |  |  ------------------
  |  |  |  |               #define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  |  |  ------------------
  |  |  |  |  |  |  447|      0|#define cn_bits_shift 3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (6144:22): [True: 0, False: 0]
  ------------------
 6145|  1.70k|                     0 <= ( nFlowerEdge = GetChargeFlowerUpperEdge( pBNS, pVA, pVA[i].nCPlusGroupEdge - 1 ) ) &&
  ------------------
  |  Branch (6145:22): [True: 0, False: 0]
  ------------------
 6146|  1.70k|                     pBNS->edge[nFlowerEdge].flow > 0)
  ------------------
  |  Branch (6146:22): [True: 0, False: 0]
  ------------------
 6147|      0|                {
 6148|       |
 6149|      0|                    for (j = 0; j < at2[i].valence; j++)
  ------------------
  |  Branch (6149:33): [True: 0, False: 0]
  ------------------
 6150|      0|                    {
 6151|      0|                        neigh = at2[i].neighbor[j];
 6152|      0|                        if (pVA[neigh].cNumValenceElectrons != 6 && at2[neigh].valence > 1)
  ------------------
  |  Branch (6152:29): [True: 0, False: 0]
  |  Branch (6152:69): [True: 0, False: 0]
  ------------------
 6153|      0|                        {
 6154|      0|                            k = pBNS->vert[i].iedge[j];
 6155|      0|                            if (!pBNS->edge[k].forbidden)
  ------------------
  |  Branch (6155:33): [True: 0, False: 0]
  ------------------
 6156|      0|                            {
 6157|      0|                                if (ret = AddToEdgeList( &FlowerEdgesList, k, 64 ))
  ------------------
  |  Branch (6157:37): [True: 0, False: 0]
  ------------------
 6158|      0|                                {
 6159|      0|                                    goto exit_function;
 6160|      0|                                }
 6161|      0|                                pBNS->edge[k].forbidden |= forbidden_edge_mask;
 6162|      0|                            }
 6163|      0|                        }
 6164|      0|                    }
 6165|      0|                }
 6166|  1.70k|            }
 6167|  3.65k|        }
 6168|  3.65k|    }
 6169|       |
 6170|       |    /*------------------------------------------------------------------------------
 6171|       |                        example: struct #301,
 6172|       |      |          |               disconnected porphyrin with four -SO3(-)
 6173|       |     -S-   =>   =S=
 6174|       |      |          |
 6175|       |
 6176|       |    -------------------------------------------------------------------------------*/
 6177|       |
 6178|       |    /*-------------------------------------------------------------------------------
 6179|       |     found:                                       super(+)=(Y)        super(+)=(Y)
 6180|       |                                                              \                   \
 6181|       |             (+)  single line => flow = 0                     (+)                 (+)
 6182|       |        01  //    double line => flow = 1         fix-> 01   //             01   //
 6183|       |     1 === 0      triple line => flow = 2          (.)1 --- 0(.)  --->    1 --- 0
 6184|       |      \   /       edge eij connects vertices i<j:      \   /  02  run      \\ //  02
 6185|       |    12  2   02 <--- edge number: e02 connects        12  2        BFS    12  2
 6186|       |       |||              vertices v0 and v2              |||                  |
 6187|       |       -S-      vertex S has number i                   -S-                 =S=
 6188|       |       / \                                              / \                 / \
 6189|       |    --------------------------------------------------------------------------------*/
 6190|  4.46k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (6190:17): [True: 3.65k, False: 801]
  ------------------
 6191|  3.65k|    {
 6192|  3.65k|        if (pVA[i].cNumValenceElectrons == 6 && at2[i].valence == 4 &&
  ------------------
  |  Branch (6192:13): [True: 208, False: 3.45k]
  |  Branch (6192:49): [True: 0, False: 208]
  ------------------
 6193|  3.65k|             at2[i].chem_bonds_valence == 4 && !at2[i].charge && !at2[i].radical &&
  ------------------
  |  Branch (6193:14): [True: 0, False: 0]
  |  Branch (6193:48): [True: 0, False: 0]
  |  Branch (6193:66): [True: 0, False: 0]
  ------------------
 6194|  3.65k|             !at2[i].endpoint && pVA[i].cnListIndex > 0 &&
  ------------------
  |  Branch (6194:14): [True: 0, False: 0]
  |  Branch (6194:34): [True: 0, False: 0]
  ------------------
 6195|  3.65k|             cnList[pVA[i].cnListIndex - 1].bits == cn_bits_NPN &&
  ------------------
  |  |  453|      0|#define cn_bits_NPN MAKE_CN_BITS(cn_bits_N, cn_bits_P, cn_bits_N, 0)
  |  |  ------------------
  |  |  |  |  449|  3.65k|#define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  |  |  ------------------
  |  |  |  |  |  |  447|      0|#define cn_bits_shift 3
  |  |  |  |  ------------------
  |  |  |  |               #define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  |  |  ------------------
  |  |  |  |  |  |  447|      0|#define cn_bits_shift 3
  |  |  |  |  ------------------
  |  |  |  |               #define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  |  |  ------------------
  |  |  |  |  |  |  447|      0|#define cn_bits_shift 3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (6195:14): [True: 0, False: 0]
  ------------------
 6196|       |             /* 01 is nFlowerEdge */
 6197|  3.65k|             0 <= ( nFlowerEdge = GetChargeFlowerUpperEdge( pBNS, pVA, pVA[i].nCPlusGroupEdge - 1 ) ) &&
  ------------------
  |  Branch (6197:14): [True: 0, False: 0]
  ------------------
 6198|  3.65k|             pBNS->edge[nFlowerEdge].flow > 0)
  ------------------
  |  Branch (6198:14): [True: 0, False: 0]
  ------------------
 6199|      0|        {
 6200|       |
 6201|      0|            Vertex     v1 = NO_VERTEX, v2 = NO_VERTEX;
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
                          Vertex     v1 = NO_VERTEX, v2 = NO_VERTEX;
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
 6202|      0|            BNS_VERTEX *pv1, *pv2;
 6203|      0|            BNS_EDGE   *pe;
 6204|      0|            Vertex     vPathStart, vPathEnd;
 6205|      0|            int        nPathLen;
 6206|      0|            int        nDeltaH, nDeltaCharge, nNumVisitedAtoms;
 6207|       |
 6208|      0|            if (!bForbiddenCarbonCharges)
  ------------------
  |  Branch (6208:17): [True: 0, False: 0]
  ------------------
 6209|      0|            {
 6210|      0|                if (0 > ( ret = ForbidCarbonChargeEdges( pBNS, pTCGroups, &CarbonChargeEdges, forbidden_edge_mask ) ))
  ------------------
  |  Branch (6210:21): [True: 0, False: 0]
  ------------------
 6211|      0|                {
 6212|      0|                    goto exit_function;
 6213|      0|                }
 6214|      0|                bForbiddenCarbonCharges = 1;
 6215|      0|            }
 6216|       |
 6217|      0|            delta = 1;
 6218|      0|            pe = pBNS->edge + nFlowerEdge;                 /* edge  01 */
 6219|      0|            pv1 = pBNS->vert + ( v1 = pe->neighbor1 );       /* vertex 0 */
 6220|      0|            pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 ); /* vertex 1 */
 6221|       |
 6222|      0|            pe->forbidden |= forbidden_edge_mask;
 6223|      0|            pe->flow -= delta;
 6224|      0|            pv1->st_edge.flow -= delta;
 6225|      0|            pv2->st_edge.flow -= delta;
 6226|      0|            pBNS->tot_st_flow -= 2 * delta;
 6227|       |
 6228|      0|            ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 6229|      0|                                  &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 6230|      0|            if (ret == 1 &&
  ------------------
  |  Branch (6230:17): [True: 0, False: 0]
  ------------------
 6231|      0|                ( vPathEnd == v1 && vPathStart == v2 || vPathEnd == v2 && vPathStart == v1 ) &&
  ------------------
  |  Branch (6231:19): [True: 0, False: 0]
  |  Branch (6231:37): [True: 0, False: 0]
  |  Branch (6231:57): [True: 0, False: 0]
  |  Branch (6231:75): [True: 0, False: 0]
  ------------------
 6232|      0|                 nDeltaCharge <= ( pVA[i].cNumBondsToMetal ? 2 : 0 ))
  ------------------
  |  Branch (6232:18): [True: 0, False: 0]
  |  Branch (6232:36): [True: 0, False: 0]
  ------------------
 6233|      0|            {
 6234|      0|                ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 6235|      0|            }
 6236|      0|            else
 6237|      0|            {
 6238|      0|                pe->forbidden &= inv_forbidden_edge_mask;
 6239|      0|                pe->flow += delta;
 6240|      0|                pv1->st_edge.flow += delta;
 6241|      0|                pv2->st_edge.flow += delta;
 6242|      0|                pBNS->tot_st_flow += 2 * delta;
 6243|      0|            }
 6244|      0|            if (ret < 0)
  ------------------
  |  Branch (6244:17): [True: 0, False: 0]
  ------------------
 6245|      0|            {
 6246|      0|                goto exit_function;
 6247|      0|            }
 6248|      0|            else
 6249|      0|            {
 6250|      0|                if (ret)
  ------------------
  |  Branch (6250:21): [True: 0, False: 0]
  ------------------
 6251|      0|                {
 6252|      0|                    memcpy( at2, at, len_at * sizeof( at2[0] ) );
 6253|      0|                    pStruct->at = at2;
 6254|      0|                    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 6255|      0|                    if (ret2 < 0)
  ------------------
  |  Branch (6255:25): [True: 0, False: 0]
  ------------------
 6256|      0|                    {
 6257|      0|                        ret = ret2;
 6258|      0|                        goto exit_function;
 6259|      0|                    }
 6260|       |                    /* store the fixed edge to unfix it upon exit */
 6261|      0|                    if (ret = AddToEdgeList( &FlowerEdgesList, nFlowerEdge, 64 ))
  ------------------
  |  Branch (6261:25): [True: 0, False: 0]
  ------------------
 6262|      0|                    {
 6263|      0|                        goto exit_function;
 6264|      0|                    }
 6265|      0|                }
 6266|      0|            }
 6267|      0|        }
 6268|  3.65k|    }
 6269|       |
 6270|    801|exit_function:
 6271|       |
 6272|    801|    RemoveForbiddenEdgeMask( pBNS, &CarbonChargeEdges, forbidden_edge_mask );
 6273|    801|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|    801|#define EDGE_LIST_FREE   (-2)
  ------------------
 6274|    801|    RemoveForbiddenEdgeMask( pBNS, &FlowerEdgesList, forbidden_edge_mask );
 6275|    801|    AllocEdgeList( &FlowerEdgesList, EDGE_LIST_FREE );
  ------------------
  |  |  271|    801|#define EDGE_LIST_FREE   (-2)
  ------------------
 6276|       |
 6277|    801|    return ret;
 6278|    801|}
PlusFromDB_N_DB_O_to_Metal:
 6298|    801|{
 6299|    801|    int i, j, k, n, bForbiddenCarbonCharges, delta, ret2, ret, num_NO, num_M;
 6300|    801|    int num_at = pStruct->num_atoms;
 6301|    801|    int num_deleted_H = pStruct->num_deleted_H;
 6302|    801|    int len_at = num_at + num_deleted_H;
 6303|    801|    int inv_forbidden_edge_mask = ~forbidden_edge_mask;
 6304|    801|    EDGE_LIST CarbonChargeEdges, NO_ChargeEdgeList, NO_EdgeList;
 6305|       |
 6306|    801|    Vertex     v1, v2;
 6307|    801|    BNS_VERTEX *pv1, *pv2;
 6308|    801|    BNS_EDGE   *pe;
 6309|    801|    Vertex     vPathStart, vPathEnd;
 6310|    801|    int        nPathLen;
 6311|    801|    int        nDeltaH, nDeltaCharge, nNumVisitedAtoms;
 6312|       |
 6313|       |
 6314|    801|    if (!pTCGroups->num_metal_atoms)
  ------------------
  |  Branch (6314:9): [True: 162, False: 639]
  ------------------
 6315|    162|    {
 6316|    162|        return 0;
 6317|    162|    }
 6318|       |
 6319|    639|    ret = 0;
 6320|    639|    bForbiddenCarbonCharges = 0;
 6321|    639|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_CLEAR ); /* all charges */
  ------------------
  |  |  270|    639|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 6322|    639|    AllocEdgeList( &NO_ChargeEdgeList, EDGE_LIST_CLEAR ); /* charges to be changed */
  ------------------
  |  |  270|    639|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 6323|    639|    AllocEdgeList( &NO_EdgeList, EDGE_LIST_CLEAR );       /* N(+)=O edges */
  ------------------
  |  |  270|    639|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 6324|       |
 6325|    639|    memcpy( at2, at, len_at * sizeof( at2[0] ) );
 6326|    639|    pStruct->at = at2;
 6327|    639|    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 6328|    639|    if (ret2 < 0)
  ------------------
  |  Branch (6328:9): [True: 0, False: 639]
  ------------------
 6329|      0|    {
 6330|      0|        ret = ret2;
 6331|      0|        goto exit_function;
 6332|      0|    }
 6333|       |
 6334|    639|    num_NO = num_M = 0;
 6335|       |
 6336|       |    /* forbid creation of other S(IV) atoms */
 6337|       |    /* fix single bonds to metals and (N(IV), flow=1), (S(IV), flow=0) */
 6338|  3.57k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (6338:17): [True: 2.93k, False: 639]
  ------------------
 6339|  2.93k|    {
 6340|  2.93k|        if (!pVA[i].cMetal)
  ------------------
  |  Branch (6340:13): [True: 989, False: 1.94k]
  ------------------
 6341|    989|        {
 6342|    989|            if (( k = pVA[i].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[k].forbidden)
  ------------------
  |  Branch (6342:17): [True: 0, False: 989]
  |  Branch (6342:60): [True: 0, False: 0]
  ------------------
 6343|      0|            {
 6344|      0|                if (ret = AddToEdgeList( &CarbonChargeEdges, k, 64 ))
  ------------------
  |  Branch (6344:21): [True: 0, False: 0]
  ------------------
 6345|      0|                {
 6346|      0|                    goto exit_function;
 6347|      0|                }
 6348|      0|            }
 6349|    989|            if (( k = pVA[i].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[k].forbidden)
  ------------------
  |  Branch (6349:17): [True: 0, False: 989]
  |  Branch (6349:61): [True: 0, False: 0]
  ------------------
 6350|      0|            {
 6351|      0|                if (ret = AddToEdgeList( &CarbonChargeEdges, k, 64 ))
  ------------------
  |  Branch (6351:21): [True: 0, False: 0]
  ------------------
 6352|      0|                {
 6353|      0|                    goto exit_function;
 6354|      0|                }
 6355|      0|            }
 6356|    989|        }
 6357|  1.94k|        else
 6358|  1.94k|        {
 6359|  1.94k|            num_M++;
 6360|  1.94k|        }
 6361|       |        /*
 6362|       |        if ( pVA[i].cMetal )
 6363|       |        {
 6364|       |            if ( (k = pVA[i].nCPlusGroupEdge-1) >= 0 && !pBNS->edge[k].forbidden )
 6365|       |            {
 6366|       |                if ( ret = AddToEdgeList( &NO_ChargeEdgeList, k, 64 ) )
 6367|       |                {
 6368|       |                    goto exit_function;
 6369|       |                }
 6370|       |            }
 6371|       |            if ( (k = pVA[i].nCMinusGroupEdge-1) >= 0 && !pBNS->edge[k].forbidden )
 6372|       |            {
 6373|       |                if ( ret = AddToEdgeList( &NO_ChargeEdgeList, k, 64 ) )
 6374|       |                {
 6375|       |                    goto exit_function;
 6376|       |                }
 6377|       |            }
 6378|       |        }
 6379|       |        else
 6380|       |        */
 6381|  2.93k|        if (!pVA[i].cMetal &&
  ------------------
  |  Branch (6381:13): [True: 989, False: 1.94k]
  ------------------
 6382|  2.93k|             pVA[i].cNumValenceElectrons == 6 &&
  ------------------
  |  Branch (6382:14): [True: 127, False: 862]
  ------------------
 6383|  2.93k|             at2[i].charge == 0 && !at2[i].num_H &&
  ------------------
  |  Branch (6383:14): [True: 127, False: 0]
  |  Branch (6383:36): [True: 127, False: 0]
  ------------------
 6384|  2.93k|             1 == at2[i].valence && 2 == at2[i].chem_bonds_valence &&
  ------------------
  |  Branch (6384:14): [True: 0, False: 127]
  |  Branch (6384:37): [True: 0, False: 0]
  ------------------
 6385|  2.93k|             pVA[j = at2[i].neighbor[0]].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (6385:14): [True: 0, False: 0]
  ------------------
 6386|  2.93k|             at2[j].charge == 1 && !at2[j].num_H &&
  ------------------
  |  Branch (6386:14): [True: 0, False: 0]
  |  Branch (6386:36): [True: 0, False: 0]
  ------------------
 6387|  2.93k|             2 == at2[j].valence && 4 == at2[j].chem_bonds_valence)
  ------------------
  |  Branch (6387:14): [True: 0, False: 0]
  |  Branch (6387:37): [True: 0, False: 0]
  ------------------
 6388|      0|        {
 6389|       |            /* found =N(+)=O */
 6390|      0|            if (( k = pVA[i].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[k].forbidden /* O */ &&
  ------------------
  |  Branch (6390:17): [True: 0, False: 0]
  |  Branch (6390:61): [True: 0, False: 0]
  ------------------
 6391|      0|                ( n = pVA[j].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[j].forbidden /* N */)
  ------------------
  |  Branch (6391:17): [True: 0, False: 0]
  |  Branch (6391:60): [True: 0, False: 0]
  ------------------
 6392|      0|            {
 6393|      0|                if (( ret = AddToEdgeList( &NO_ChargeEdgeList, k, 64 ) ) ||
  ------------------
  |  Branch (6393:21): [True: 0, False: 0]
  ------------------
 6394|      0|                    ( ret = AddToEdgeList( &NO_ChargeEdgeList, n, 64 ) ))
  ------------------
  |  Branch (6394:21): [True: 0, False: 0]
  ------------------
 6395|      0|                {
 6396|      0|                    goto exit_function;
 6397|      0|                }
 6398|      0|                k = pBNS->vert[i].iedge[0];  /* N(+)=O bond */
 6399|      0|                if (!pBNS->edge[k].forbidden)
  ------------------
  |  Branch (6399:21): [True: 0, False: 0]
  ------------------
 6400|      0|                {
 6401|      0|                    if (ret = AddToEdgeList( &NO_EdgeList, k, 64 ))
  ------------------
  |  Branch (6401:25): [True: 0, False: 0]
  ------------------
 6402|      0|                    {
 6403|      0|                        goto exit_function;
 6404|      0|                    }
 6405|      0|                    num_NO++;
 6406|      0|                }
 6407|      0|            }
 6408|      0|        }
 6409|  2.93k|    }
 6410|    639|    if (num_M && num_NO)
  ------------------
  |  Branch (6410:9): [True: 639, False: 0]
  |  Branch (6410:18): [True: 0, False: 639]
  ------------------
 6411|      0|    {
 6412|      0|        SetForbiddenEdgeMask( pBNS, &CarbonChargeEdges, forbidden_edge_mask );
 6413|      0|        SetForbiddenEdgeMask( pBNS, &NO_EdgeList, forbidden_edge_mask );
 6414|      0|        RemoveForbiddenEdgeMask( pBNS, &NO_ChargeEdgeList, forbidden_edge_mask );
 6415|       |        /* now only N(+), O(-) and metal charges are allowed to change */
 6416|      0|        for (i = 0; i < NO_EdgeList.num_edges; i++)
  ------------------
  |  Branch (6416:21): [True: 0, False: 0]
  ------------------
 6417|      0|        {
 6418|      0|            k = NO_EdgeList.pnEdges[i];
 6419|      0|            delta = 1;
 6420|      0|            pe = pBNS->edge + k;                 /* edge  N(+)=O */
 6421|      0|            pv1 = pBNS->vert + ( v1 = pe->neighbor1 );       /* vertex 0 */
 6422|      0|            pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 ); /* vertex 1 */
 6423|       |
 6424|      0|            pe->flow -= delta;
 6425|      0|            pv1->st_edge.flow -= delta;
 6426|      0|            pv2->st_edge.flow -= delta;
 6427|      0|            pBNS->tot_st_flow -= 2 * delta;
 6428|       |
 6429|      0|            ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 6430|      0|                                  &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 6431|      0|            if (ret == 1 &&
  ------------------
  |  Branch (6431:17): [True: 0, False: 0]
  ------------------
 6432|      0|                ( vPathEnd == v1 && vPathStart == v2 || vPathEnd == v2 && vPathStart == v1 ) &&
  ------------------
  |  Branch (6432:19): [True: 0, False: 0]
  |  Branch (6432:37): [True: 0, False: 0]
  |  Branch (6432:57): [True: 0, False: 0]
  |  Branch (6432:75): [True: 0, False: 0]
  ------------------
 6433|      0|                 nDeltaCharge == 0)
  ------------------
  |  Branch (6433:18): [True: 0, False: 0]
  ------------------
 6434|      0|            {
 6435|      0|                ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 6436|      0|            }
 6437|      0|            else
 6438|      0|            {
 6439|      0|                pe->forbidden &= inv_forbidden_edge_mask;
 6440|      0|                pe->flow += delta;
 6441|      0|                pv1->st_edge.flow += delta;
 6442|      0|                pv2->st_edge.flow += delta;
 6443|      0|                pBNS->tot_st_flow += 2 * delta;
 6444|      0|            }
 6445|      0|            if (ret < 0)
  ------------------
  |  Branch (6445:17): [True: 0, False: 0]
  ------------------
 6446|      0|            {
 6447|      0|                goto exit_function;
 6448|      0|            }
 6449|      0|        }
 6450|      0|    }
 6451|       |
 6452|    639|exit_function:
 6453|    639|    RemoveForbiddenEdgeMask( pBNS, &CarbonChargeEdges, forbidden_edge_mask );
 6454|    639|    RemoveForbiddenEdgeMask( pBNS, &NO_EdgeList, forbidden_edge_mask );
 6455|    639|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|    639|#define EDGE_LIST_FREE   (-2)
  ------------------
 6456|    639|    AllocEdgeList( &NO_EdgeList, EDGE_LIST_FREE );
  ------------------
  |  |  271|    639|#define EDGE_LIST_FREE   (-2)
  ------------------
 6457|    639|    AllocEdgeList( &NO_ChargeEdgeList, EDGE_LIST_FREE );
  ------------------
  |  |  271|    639|#define EDGE_LIST_FREE   (-2)
  ------------------
 6458|       |
 6459|    639|    return ret;
 6460|    639|}
MoveMobileHToAvoidFixedBonds:
 6474|    801|{
 6475|    801|    int ret2, ret;
 6476|    801|    int num_at = pStruct->num_atoms;
 6477|    801|    int num_deleted_H = pStruct->num_deleted_H;
 6478|    801|    int len_at = num_at + num_deleted_H;
 6479|    801|    int nNumFixedEdges, nNumAdjEdges;
 6480|       |
 6481|    801|    ret = 0;
 6482|       |
 6483|    801|    if (pTCGroups->num_tgroups)
  ------------------
  |  Branch (6483:9): [True: 0, False: 801]
  ------------------
 6484|      0|    {
 6485|      0|        memcpy( at2, at, len_at * sizeof( at2[0] ) );
 6486|      0|        pStruct->at = at2;
 6487|      0|        ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 6488|      0|        pStruct->at = at;
 6489|      0|        if (ret2 < 0)
  ------------------
  |  Branch (6489:13): [True: 0, False: 0]
  ------------------
 6490|      0|        {
 6491|      0|            ret = ret2;
 6492|      0|            goto exit_function;
 6493|      0|        }
 6494|      0|#if ( FIND_RING_SYSTEMS == 1 )
 6495|      0|        ret2 = MarkRingSystemsInp( at2, num_at, 0 );
 6496|      0|        if (ret2 < 0)
  ------------------
  |  Branch (6496:13): [True: 0, False: 0]
  ------------------
 6497|      0|        {
 6498|      0|            ret = ret2;
 6499|      0|            goto exit_function;
 6500|      0|        }
 6501|      0|#endif
 6502|       |        /* --- forbidden edges --- */
 6503|      0|        ret2 = SetForbiddenEdges( pBNS, at2, num_at, forbidden_edge_mask, 0, NULL );
 6504|       |
 6505|      0|        if (ret2 < 0)
  ------------------
  |  Branch (6505:13): [True: 0, False: 0]
  ------------------
 6506|      0|        {
 6507|      0|            ret2 = -( ret + 1 );
 6508|      0|        }
 6509|      0|        nNumFixedEdges = ret2;
 6510|      0|        ret = AdjustTgroupsToForbiddenEdges2( pBNS, at2, pVA, num_at, forbidden_edge_mask );
 6511|      0|        nNumAdjEdges = ret;
 6512|      0|        if (ret)
  ------------------
  |  Branch (6512:13): [True: 0, False: 0]
  ------------------
 6513|      0|        {
 6514|      0|            pBNS->edge_forbidden_mask |= forbidden_edge_mask;
 6515|      0|            ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 6516|      0|            ( *pnNumRunBNS )++;
 6517|      0|            if (ret < 0)
  ------------------
  |  Branch (6517:17): [True: 0, False: 0]
  ------------------
 6518|      0|            {
 6519|      0|                goto exit_function;
 6520|      0|            }
 6521|      0|            else
 6522|      0|            {
 6523|      0|                *pnTotalDelta += ret;
 6524|      0|            }
 6525|      0|        }
 6526|      0|        if (nNumFixedEdges || nNumAdjEdges)
  ------------------
  |  Branch (6526:13): [True: 0, False: 0]
  |  Branch (6526:31): [True: 0, False: 0]
  ------------------
 6527|      0|        {
 6528|       |            /* removes this edge mask from ALL edges */
 6529|      0|            RemoveForbiddenBondFlowBits( pBNS, forbidden_edge_mask );
 6530|      0|        }
 6531|      0|    }
 6532|       |
 6533|    801|exit_function:
 6534|       |
 6535|    801|    return ret;
 6536|    801|}
RemoveRadFromMobileHEndpoint:
 6553|    796|{
 6554|    796|    int i, num_fixes, tot_num_fixes = 0;
 6555|       |
 6556|    796|    int ret2, ret;
 6557|    796|    int num_at = pStruct->num_atoms;
 6558|    796|    int num_deleted_H = pStruct->num_deleted_H;
 6559|    796|    int len_at = num_at + num_deleted_H;
 6560|       |
 6561|    796|    int         itg, j, k, n, m;
 6562|    796|    Vertex      vtg1, endpoint0 = NO_VERTEX, endpoint1, endpoint2, centerpoint;
  ------------------
  |  |  146|    796|#define NO_VERTEX    -2
  ------------------
 6563|    796|    Vertex      centerpoint_found = NO_VERTEX;
  ------------------
  |  |  146|    796|#define NO_VERTEX    -2
  ------------------
 6564|    796|    BNS_VERTEX *ptg1, *pEndp0 = NULL, *pEndp1, *pEndp2, *pCentp, *pCentp_found, *pEndp2_found = NULL;
 6565|    796|    BNS_EDGE   *etg0 = NULL, *etg1, *etg2, *ecp0, *ecp1, *ecp2;
 6566|    796|    BNS_EDGE   *etg1_found = NULL, *ecp0_found = NULL, *ecp1_found = NULL, *ecp2_found = NULL;
 6567|    796|    int         tgroup_number, num_endpoints;
 6568|       |
 6569|    796|    ret = 0;
 6570|       |
 6571|    796|    memcpy( at2, at, len_at * sizeof( at2[0] ) );
 6572|    796|    pStruct->at = at2;
 6573|    796|    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 6574|    796|    if (ret2 < 0)
  ------------------
  |  Branch (6574:9): [True: 0, False: 796]
  ------------------
 6575|      0|    {
 6576|      0|        ret = ret2;
 6577|      0|        goto exit_function;
 6578|      0|    }
 6579|    796|    while (pBNS->tot_st_cap > pBNS->tot_st_flow && pTCGroups->num_tgroups)
  ------------------
  |  Branch (6579:12): [True: 1, False: 795]
  |  Branch (6579:52): [True: 0, False: 1]
  ------------------
 6580|      0|    {
 6581|      0|        num_fixes = 0;
 6582|      0|        for (itg = 0; itg < pTCGroups->num_tgroups; itg++)
  ------------------
  |  Branch (6582:23): [True: 0, False: 0]
  ------------------
 6583|      0|        {
 6584|      0|            pCentp_found = NULL;
 6585|      0|            tgroup_number = pTCGroups->pTCG[itg].ord_num;
 6586|      0|            vtg1 = pTCGroups->pTCG[itg].nVertexNumber;      /* taut group vertex index */
 6587|      0|            ptg1 = pBNS->vert + vtg1;                       /* taut group vertex */
 6588|      0|            num_endpoints = pTCGroups->pTCG[itg].num_edges;
 6589|      0|            for (i = 0; i < num_endpoints; i++)
  ------------------
  |  Branch (6589:25): [True: 0, False: 0]
  ------------------
 6590|      0|            {
 6591|      0|                etg0 = pBNS->edge + ptg1->iedge[i];         /* edge from t-group to endpoint */
 6592|      0|                endpoint0 = etg0->neighbor12 ^ vtg1;        /* taut endpoint vertex index */
 6593|      0|                pEndp0 = pBNS->vert + endpoint0;            /* taut endpoint vertex (possible location of mobile H */
 6594|      0|                if (pEndp0->st_edge.cap > pEndp0->st_edge.flow)
  ------------------
  |  Branch (6594:21): [True: 0, False: 0]
  ------------------
 6595|      0|                {
 6596|       |                /* radical endpoint1 has been detected */
 6597|       |                /* find a 1-3 centerpoint that has two or more endpoints */
 6598|       |                /* connected to the t-group vertex by edges with flow>0 and */
 6599|       |                /* to the centerpoint by edges with flow = 0 */
 6600|       |                /* after that: (1) increment etg1 flow to eliminate radical */
 6601|       |                /* (2) increment flow on one of the two other edges to the t-group */
 6602|       |                /* (3) increment st_cap on the found centerpoint */
 6603|       |                /* (4) rerun the BNS and re-create the structure */
 6604|      0|                    break;
 6605|      0|                }
 6606|      0|            }
 6607|      0|            if (i == num_endpoints)
  ------------------
  |  Branch (6607:17): [True: 0, False: 0]
  ------------------
 6608|      0|            {
 6609|      0|                continue;
 6610|      0|            }
 6611|      0|            if (i < num_endpoints)
  ------------------
  |  Branch (6611:17): [True: 0, False: 0]
  ------------------
 6612|      0|            {
 6613|       |                /* tautomeric endpoint found; traverse its t-group edges */
 6614|      0|                for (j = 0; j < num_endpoints; j++)
  ------------------
  |  Branch (6614:29): [True: 0, False: 0]
  ------------------
 6615|      0|                {
 6616|      0|                    if (i == j)
  ------------------
  |  Branch (6616:25): [True: 0, False: 0]
  ------------------
 6617|      0|                    {
 6618|      0|                        continue; /* avoid the already found radical endpoint */
 6619|      0|                    }
 6620|      0|                    etg1 = pBNS->edge + ptg1->iedge[j];  /* another edge from t-group to another endpoinr */
 6621|      0|                    endpoint1 = etg1->neighbor12 ^ vtg1; /* another endpoint vertex index */
 6622|      0|                    pEndp1 = pBNS->vert + endpoint1;     /* another endpoint vertex */
 6623|      0|                    if (pEndp1->st_edge.cap > pEndp1->st_edge.flow)
  ------------------
  |  Branch (6623:25): [True: 0, False: 0]
  ------------------
 6624|      0|                    {
 6625|      0|                        continue; /* one more radical-endpoint! What is going on here??? */
 6626|      0|                    }
 6627|      0|                    if (!etg1->flow)
  ------------------
  |  Branch (6627:25): [True: 0, False: 0]
  ------------------
 6628|      0|                    {
 6629|      0|                        continue; /* avoid enpoints that do not have an attachment */
 6630|      0|                    }
 6631|      0|                    if (!( pEndp1->type & BNS_VERT_TYPE_ENDPOINT ))
  ------------------
  |  |   74|      0|#define BNS_VERT_TYPE_ENDPOINT      0x0002  /* attribute */
  ------------------
  |  Branch (6631:25): [True: 0, False: 0]
  ------------------
 6632|      0|                    {
 6633|      0|                        continue; /* should not happen */
 6634|      0|                    }
 6635|       |                    /* traverse endpoint1 edges to find a single bond connecting it to the centerpoint */
 6636|      0|                    for (k = 0; k < at2[endpoint1].valence; k++)
  ------------------
  |  Branch (6636:33): [True: 0, False: 0]
  ------------------
 6637|      0|                    {
 6638|      0|                        ecp1 = pBNS->edge + pEndp1->iedge[k];
 6639|      0|                        if (ecp1->flow)
  ------------------
  |  Branch (6639:29): [True: 0, False: 0]
  ------------------
 6640|      0|                        {
 6641|      0|                            continue;
 6642|      0|                        }
 6643|      0|                        centerpoint = ecp1->neighbor12 ^ endpoint1;
 6644|      0|                        pCentp = pBNS->vert + centerpoint;
 6645|       |                        /* traverse centerpoint edges to find a single bond to the 2nd endpoint */
 6646|      0|                        for (n = 0; n < at2[centerpoint].valence; n++)
  ------------------
  |  Branch (6646:37): [True: 0, False: 0]
  ------------------
 6647|      0|                        {
 6648|      0|                            ecp2 = pBNS->edge + pCentp->iedge[n];
 6649|      0|                            if (ecp2->flow)
  ------------------
  |  Branch (6649:33): [True: 0, False: 0]
  ------------------
 6650|      0|                            {
 6651|      0|                                continue;
 6652|      0|                            }
 6653|      0|                            endpoint2 = ecp2->neighbor12 ^ centerpoint;
 6654|      0|                            if (endpoint2 <= endpoint1 || !pVA[endpoint2].nTautGroupEdge)
  ------------------
  |  Branch (6654:33): [True: 0, False: 0]
  |  Branch (6654:59): [True: 0, False: 0]
  ------------------
 6655|      0|                            {
 6656|      0|                                continue; /* don't go back: neighbors are in order of ascending ord. numbers */
 6657|      0|                            }
 6658|      0|                            pEndp2 = pBNS->vert + endpoint2;
 6659|      0|                            if (!( pEndp2->type & BNS_VERT_TYPE_ENDPOINT ))
  ------------------
  |  |   74|      0|#define BNS_VERT_TYPE_ENDPOINT      0x0002  /* attribute */
  ------------------
  |  Branch (6659:33): [True: 0, False: 0]
  ------------------
 6660|      0|                            {
 6661|      0|                                continue;
 6662|      0|                            }
 6663|      0|                            etg2 = pBNS->edge + pVA[endpoint2].nTautGroupEdge - 1;
 6664|      0|                            if (!etg2->flow || ( etg2->neighbor12 ^ endpoint2 ) != vtg1)
  ------------------
  |  Branch (6664:33): [True: 0, False: 0]
  |  Branch (6664:48): [True: 0, False: 0]
  ------------------
 6665|      0|                            {
 6666|      0|                                continue;
 6667|      0|                            }
 6668|       |                            /* we have found the path:
 6669|       |                                              Endp1                                Endp1
 6670|       |                                       etg1 //     \ ecp1                   etg1 /     \\ ecp1
 6671|       |                                  etg0     //       \                  etg0     /       \\
 6672|       |                             Endp0-----tg1           Centp  -->   Endp0=====tg1           Centp
 6673|       |                              ^            \\       /                           \\       /
 6674|       |                      radical |        etg2 \\     / ecp2                   etg2 \\     / ecp2
 6675|       |                                              Endp2                                Endp2
 6676|       |                            */
 6677|       |
 6678|       |                            /* compare centerpoints */
 6679|      0|                            if (!pCentp_found ||
  ------------------
  |  Branch (6679:33): [True: 0, False: 0]
  ------------------
 6680|       |                                 /* try to avoid carbons */
 6681|      0|                                ( pVA[centerpoint].cNumValenceElectrons != 4 ||
  ------------------
  |  Branch (6681:35): [True: 0, False: 0]
  ------------------
 6682|      0|                                    pVA[centerpoint].cPeriodicRowNumber != 1 ) &&
  ------------------
  |  Branch (6682:37): [True: 0, False: 0]
  ------------------
 6683|      0|                                 pVA[centerpoint_found].cNumValenceElectrons == 4 &&
  ------------------
  |  Branch (6683:34): [True: 0, False: 0]
  ------------------
 6684|      0|                                 pVA[centerpoint_found].cPeriodicRowNumber == 1 ||
  ------------------
  |  Branch (6684:34): [True: 0, False: 0]
  ------------------
 6685|       |                                 /* try a better non-carbon */
 6686|      0|                                 ( pVA[centerpoint].cNumValenceElectrons != 4 ||
  ------------------
  |  Branch (6686:36): [True: 0, False: 0]
  ------------------
 6687|      0|                                     pVA[centerpoint].cPeriodicRowNumber != 1 ) &&
  ------------------
  |  Branch (6687:38): [True: 0, False: 0]
  ------------------
 6688|      0|                                     ( at[centerpoint].valence > at[centerpoint_found].valence ||
  ------------------
  |  Branch (6688:40): [True: 0, False: 0]
  ------------------
 6689|      0|                                         at[centerpoint].valence == at[centerpoint_found].valence &&
  ------------------
  |  Branch (6689:42): [True: 0, False: 0]
  ------------------
 6690|      0|                                         at[centerpoint].el_number > at[centerpoint_found].el_number ))
  ------------------
  |  Branch (6690:42): [True: 0, False: 0]
  ------------------
 6691|      0|                            {
 6692|       |
 6693|      0|                                pCentp_found = pCentp;
 6694|      0|                                etg1_found = etg1;
 6695|      0|                                ecp1_found = ecp1;
 6696|      0|                                centerpoint_found = centerpoint;
 6697|      0|                                break;
 6698|      0|                            }
 6699|      0|                        }
 6700|      0|                    }
 6701|      0|                }
 6702|      0|            }
 6703|      0|            if (pCentp_found)
  ------------------
  |  Branch (6703:17): [True: 0, False: 0]
  ------------------
 6704|      0|            {
 6705|       |                /* ---- (1) */
 6706|      0|                etg0->flow++;
 6707|      0|                pEndp0->st_edge.flow++;
 6708|       |                /* ---- (2) */
 6709|      0|                etg1_found->flow--;
 6710|       |                /* ---- (3) */
 6711|      0|                ecp1_found->flow++;
 6712|       |                /* ---- (4) */
 6713|      0|                pCentp_found->st_edge.flow++;
 6714|      0|                pCentp_found->st_edge.cap++;
 6715|       |
 6716|      0|                pBNS->tot_st_flow += 2;
 6717|      0|                pBNS->tot_st_cap += 1;
 6718|      0|                pCentp_found = NULL;
 6719|      0|                num_fixes++;
 6720|      0|                tot_num_fixes++;   /* #1 Mob-H */
 6721|      0|                continue;
 6722|      0|            }
 6723|       |
 6724|       |            /* 2nd attempt: increment flow in centerpoint---radical_endpint edge */
 6725|      0|            if (i < num_endpoints)
  ------------------
  |  Branch (6725:17): [True: 0, False: 0]
  ------------------
 6726|      0|            {
 6727|       |                /* tautomeric endpoint found; traverse its t-group edges */
 6728|      0|                for (j = 0; j < num_endpoints; j++)
  ------------------
  |  Branch (6728:29): [True: 0, False: 0]
  ------------------
 6729|      0|                {
 6730|      0|                    if (i == j)
  ------------------
  |  Branch (6730:25): [True: 0, False: 0]
  ------------------
 6731|      0|                    {
 6732|      0|                        continue; /* avoid the found radical endpoint */
 6733|      0|                    }
 6734|      0|                    etg1 = pBNS->edge + ptg1->iedge[j];
 6735|      0|                    endpoint1 = etg1->neighbor12 ^ vtg1;
 6736|      0|                    pEndp1 = pBNS->vert + endpoint1;     /* another endpoint */
 6737|      0|                    if (pEndp1->st_edge.cap > pEndp1->st_edge.flow)
  ------------------
  |  Branch (6737:25): [True: 0, False: 0]
  ------------------
 6738|      0|                    {
 6739|      0|                        continue; /* one more radical-endpoint! What is going on here??? */
 6740|      0|                    }
 6741|      0|                    if (!etg1->flow)
  ------------------
  |  Branch (6741:25): [True: 0, False: 0]
  ------------------
 6742|      0|                    {
 6743|      0|                        continue; /* avoid enpoints that do not have an attachment */
 6744|      0|                    }
 6745|      0|                    if (!( pEndp1->type & BNS_VERT_TYPE_ENDPOINT ))
  ------------------
  |  |   74|      0|#define BNS_VERT_TYPE_ENDPOINT      0x0002  /* attribute */
  ------------------
  |  Branch (6745:25): [True: 0, False: 0]
  ------------------
 6746|      0|                    {
 6747|      0|                        continue; /* should not happen */
 6748|      0|                    }
 6749|       |                    /* traverse endpoint1 edges to find the edge connecting it to the centerpoint */
 6750|      0|                    for (k = 0; k < at2[endpoint1].valence; k++)
  ------------------
  |  Branch (6750:33): [True: 0, False: 0]
  ------------------
 6751|      0|                    {
 6752|      0|                        ecp1 = pBNS->edge + pEndp1->iedge[k];
 6753|      0|                        if (ecp1->flow)
  ------------------
  |  Branch (6753:29): [True: 0, False: 0]
  ------------------
 6754|      0|                        {
 6755|      0|                            continue;
 6756|      0|                        }
 6757|      0|                        centerpoint = ecp1->neighbor12 ^ endpoint1;
 6758|      0|                        pCentp = pBNS->vert + centerpoint;
 6759|      0|                        if (pCentp->type & BNS_VERT_TYPE_ENDPOINT)
  ------------------
  |  |   74|      0|#define BNS_VERT_TYPE_ENDPOINT      0x0002  /* attribute */
  ------------------
  |  Branch (6759:29): [True: 0, False: 0]
  ------------------
 6760|      0|                        {
 6761|      0|                            continue; /* do not set another endpoint's valence = an unusual value */
 6762|      0|                        }
 6763|       |
 6764|       |                        /* traverse centerpoint edges to find edge connecting it to the endpoint0 */
 6765|      0|                        ecp2 = NULL;
 6766|      0|                        pEndp2 = NULL;
 6767|      0|                        for (n = 0; n < at2[centerpoint].valence; n++)
  ------------------
  |  Branch (6767:37): [True: 0, False: 0]
  ------------------
 6768|      0|                        {
 6769|      0|                            ecp0 = pBNS->edge + pCentp->iedge[n];
 6770|      0|                            if (ecp0->flow)
  ------------------
  |  Branch (6770:33): [True: 0, False: 0]
  ------------------
 6771|      0|                            {
 6772|      0|                                endpoint2 = ecp0->neighbor12 ^ centerpoint;
 6773|      0|                                if (( pBNS->vert[endpoint2].type & BNS_VERT_TYPE_ENDPOINT ))
  ------------------
  |  |   74|      0|#define BNS_VERT_TYPE_ENDPOINT      0x0002  /* attribute */
  ------------------
  |  Branch (6773:37): [True: 0, False: 0]
  ------------------
 6774|      0|                                {
 6775|      0|                                    continue; /* ignore endpoint2 if it is tautomeric endpoint */
 6776|      0|                                }
 6777|       |                                /* check whether ecp0 is stereogenic: if it is then we cannot decrement its flow */
 6778|      0|                                for (m = 0; m < MAX_NUM_STEREO_BONDS && at[centerpoint].sb_parity[m]; m++)
  ------------------
  |  |  876|      0|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (6778:45): [True: 0, False: 0]
  |  Branch (6778:73): [True: 0, False: 0]
  ------------------
 6779|      0|                                {
 6780|      0|                                    if (at[centerpoint].sb_ord[m] == n)
  ------------------
  |  Branch (6780:41): [True: 0, False: 0]
  ------------------
 6781|      0|                                    {
 6782|      0|                                        endpoint2 = NO_VERTEX;
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
 6783|      0|                                        break;
 6784|      0|                                    }
 6785|      0|                                }
 6786|      0|                                if (endpoint2 == NO_VERTEX)
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (6786:37): [True: 0, False: 0]
  ------------------
 6787|      0|                                {
 6788|      0|                                    continue;
 6789|      0|                                }
 6790|      0|                                pEndp2 = pBNS->vert + endpoint2;  /* found */
 6791|      0|                                ecp2 = ecp0;
 6792|      0|                                break;
 6793|      0|                            }
 6794|      0|                        }
 6795|      0|                        for (n = 0; n < at[centerpoint].valence; n++)
  ------------------
  |  Branch (6795:37): [True: 0, False: 0]
  ------------------
 6796|      0|                        {
 6797|      0|                            ecp0 = pBNS->edge + pCentp->iedge[n];
 6798|      0|                            if (ecp0->flow)
  ------------------
  |  Branch (6798:33): [True: 0, False: 0]
  ------------------
 6799|      0|                            {
 6800|      0|                                continue;
 6801|      0|                            }
 6802|      0|                            if (endpoint0 != ( ecp0->neighbor12 ^ centerpoint ))
  ------------------
  |  Branch (6802:33): [True: 0, False: 0]
  ------------------
 6803|      0|                            {
 6804|      0|                                continue;
 6805|      0|                            }
 6806|       |                            /* Found:
 6807|       |                                              Endp2(not endpoint)           Endp2(not radical)
 6808|       |                                               ||                             |
 6809|       |                                               ||ecp2                         |ecp2
 6810|       |                                          ecp0 ||  ecp1                 ecp0  |  ecp1
 6811|       |                                     Endp0----Centp----Endp1       Endp0====Centp----Endp1
 6812|       |                                      ^  \             /      -->      \             /
 6813|       |                              radical |   \           /                 \           /
 6814|       |                                           \         /                   \         /
 6815|       |                                       etg0 \       / etg1           etg0 \       / etg1
 6816|       |                                             \     /                       \     /
 6817|       |                                               tg1                           tg1
 6818|       |
 6819|       |                             */
 6820|       |
 6821|       |                            /* compare centerpoints */
 6822|      0|                            if (!pCentp_found ||
  ------------------
  |  Branch (6822:33): [True: 0, False: 0]
  ------------------
 6823|       |                                 /* try to avoid carbons */
 6824|      0|                                ( pVA[centerpoint].cNumValenceElectrons != 4 ||
  ------------------
  |  Branch (6824:35): [True: 0, False: 0]
  ------------------
 6825|      0|                                    pVA[centerpoint].cPeriodicRowNumber != 1 ) &&
  ------------------
  |  Branch (6825:37): [True: 0, False: 0]
  ------------------
 6826|      0|                                 pVA[centerpoint_found].cNumValenceElectrons == 4 &&
  ------------------
  |  Branch (6826:34): [True: 0, False: 0]
  ------------------
 6827|      0|                                 pVA[centerpoint_found].cPeriodicRowNumber == 1 ||
  ------------------
  |  Branch (6827:34): [True: 0, False: 0]
  ------------------
 6828|       |                                 /* try a better non-carbon */
 6829|      0|                                 ( pVA[centerpoint].cNumValenceElectrons != 4 ||
  ------------------
  |  Branch (6829:36): [True: 0, False: 0]
  ------------------
 6830|      0|                                     pVA[centerpoint].cPeriodicRowNumber != 1 ) &&
  ------------------
  |  Branch (6830:38): [True: 0, False: 0]
  ------------------
 6831|      0|                                     ( at[centerpoint].valence > at[centerpoint_found].valence ||
  ------------------
  |  Branch (6831:40): [True: 0, False: 0]
  ------------------
 6832|      0|                                         at[centerpoint].valence == at[centerpoint_found].valence &&
  ------------------
  |  Branch (6832:42): [True: 0, False: 0]
  ------------------
 6833|      0|                                         at[centerpoint].el_number > at[centerpoint_found].el_number ))
  ------------------
  |  Branch (6833:42): [True: 0, False: 0]
  ------------------
 6834|      0|                            {
 6835|       |
 6836|      0|                                pCentp_found = pCentp;
 6837|      0|                                etg1_found = etg1;
 6838|      0|                                ecp0_found = ecp0;
 6839|      0|                                centerpoint_found = centerpoint;
 6840|      0|                                pEndp2_found = pEndp2;
 6841|      0|                                ecp2_found = ecp2;
 6842|      0|                                break;
 6843|      0|                            }
 6844|      0|                        }
 6845|      0|                    }
 6846|      0|                }
 6847|      0|            }
 6848|      0|            if (pCentp_found)
  ------------------
  |  Branch (6848:17): [True: 0, False: 0]
  ------------------
 6849|      0|            {
 6850|      0|                ecp0_found->flow++;
 6851|      0|                if (ecp0_found->cap < ecp0_found->flow)
  ------------------
  |  Branch (6851:21): [True: 0, False: 0]
  ------------------
 6852|      0|                {
 6853|      0|                    ecp0_found->cap = ecp0_found->flow;
 6854|      0|                }
 6855|      0|                pEndp0->st_edge.flow++;
 6856|      0|                if (pEndp2_found && ecp2_found)
  ------------------
  |  Branch (6856:21): [True: 0, False: 0]
  |  Branch (6856:37): [True: 0, False: 0]
  ------------------
 6857|      0|                {
 6858|      0|                    ecp2_found->flow--;
 6859|      0|                    pEndp2_found->st_edge.flow--;
 6860|      0|                }
 6861|      0|                else
 6862|      0|                {
 6863|       |                    /* Endp2 not found */
 6864|      0|                    pCentp_found->st_edge.flow++;
 6865|      0|                    pCentp_found->st_edge.cap++;
 6866|      0|                    pBNS->tot_st_flow += 2; /* radical elimination */
 6867|      0|                    pBNS->tot_st_cap += 1;
 6868|      0|                }
 6869|       |
 6870|      0|                pCentp_found = NULL;
 6871|      0|                num_fixes++;
 6872|      0|                tot_num_fixes++;      /* #2 Mob-H */
 6873|      0|                continue;
 6874|      0|            }
 6875|       |            /* 3rd attempt: find =C= and move radical to it */
 6876|      0|            if (i < num_endpoints)
  ------------------
  |  Branch (6876:17): [True: 0, False: 0]
  ------------------
 6877|      0|            {
 6878|      0|                int jj, delta, bNotFixed = 1;
 6879|      0|                Vertex     vPathStart, vPathEnd, v1, v2;
 6880|      0|                int        nPathLen, nDeltaH, nDeltaCharge, nNumVisitedAtoms;
 6881|      0|                for (jj = 0; jj < num_at && bNotFixed; jj++)
  ------------------
  |  Branch (6881:30): [True: 0, False: 0]
  |  Branch (6881:45): [True: 0, False: 0]
  ------------------
 6882|      0|                {
 6883|      0|                    if (at2[i].endpoint)
  ------------------
  |  Branch (6883:25): [True: 0, False: 0]
  ------------------
 6884|      0|                    {
 6885|      0|                        continue;
 6886|      0|                    }
 6887|      0|                    if (2 == at2[jj].valence && pBNS->vert[jj].st_edge.cap == pBNS->vert[jj].st_edge.flow &&
  ------------------
  |  Branch (6887:25): [True: 0, False: 0]
  |  Branch (6887:49): [True: 0, False: 0]
  ------------------
 6888|      0|                         4 == pVA[jj].cNumValenceElectrons &&
  ------------------
  |  Branch (6888:26): [True: 0, False: 0]
  ------------------
 6889|      0|                         !( ecp0 = pBNS->edge + pBNS->vert[jj].iedge[0] )->forbidden &&
  ------------------
  |  Branch (6889:26): [True: 0, False: 0]
  ------------------
 6890|      0|                         !( ecp1 = pBNS->edge + pBNS->vert[jj].iedge[1] )->forbidden &&
  ------------------
  |  Branch (6890:26): [True: 0, False: 0]
  ------------------
 6891|      0|                         1 == ecp0->flow && 1 == ecp1->flow &&
  ------------------
  |  Branch (6891:26): [True: 0, False: 0]
  |  Branch (6891:45): [True: 0, False: 0]
  ------------------
 6892|      0|                         !at2[(int) at2[i].neighbor[0]].sb_parity[0] &&
  ------------------
  |  Branch (6892:26): [True: 0, False: 0]
  ------------------
 6893|      0|                         !at2[(int) at2[i].neighbor[1]].sb_parity[0])
  ------------------
  |  Branch (6893:26): [True: 0, False: 0]
  ------------------
 6894|      0|                    {
 6895|       |                        /* found =C=; make a radical and try to cancel the two radicals */
 6896|      0|                        k = ecp0->neighbor12 ^ jj;
 6897|      0|                        if (at2[k].endpoint)
  ------------------
  |  Branch (6897:29): [True: 0, False: 0]
  ------------------
 6898|      0|                        {
 6899|      0|                            ecp0 = ecp1;
 6900|      0|                            k = ecp0->neighbor12 ^ jj;
 6901|      0|                            if (at2[k].endpoint)
  ------------------
  |  Branch (6901:33): [True: 0, False: 0]
  ------------------
 6902|      0|                            {
 6903|      0|                                continue;
 6904|      0|                            }
 6905|      0|                        }
 6906|      0|                        delta = 1;
 6907|       |                        /* decrement C valence */
 6908|      0|                        pBNS->vert[jj].st_edge.flow -= delta;
 6909|      0|                        pBNS->vert[jj].st_edge.cap -= delta;
 6910|       |                        /* decrement bond order */
 6911|      0|                        ecp0->flow -= delta;
 6912|       |                        /* reflect the changes in at2[k] to make it a radical */
 6913|      0|                        pBNS->vert[k].st_edge.flow -= delta;
 6914|      0|                        pBNS->tot_st_cap -= delta;
 6915|      0|                        pBNS->tot_st_flow -= 2 * delta;
 6916|       |
 6917|      0|                        v1 = endpoint0;
 6918|      0|                        v2 = k;
 6919|       |
 6920|      0|                        ret2 = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 6921|      0|                                              &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 6922|       |
 6923|      0|                        if (ret2 == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (6923:29): [True: 0, False: 0]
  |  Branch (6923:44): [True: 0, False: 0]
  |  Branch (6923:62): [True: 0, False: 0]
  ------------------
 6924|      0|                            vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == 0)
  ------------------
  |  Branch (6924:29): [True: 0, False: 0]
  |  Branch (6924:47): [True: 0, False: 0]
  |  Branch (6924:69): [True: 0, False: 0]
  ------------------
 6925|      0|                        {
 6926|      0|                            ret2 = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 6927|      0|                            if (ret2 > 0)
  ------------------
  |  Branch (6927:33): [True: 0, False: 0]
  ------------------
 6928|      0|                            {
 6929|      0|                                num_fixes++;
 6930|      0|                                tot_num_fixes++;   /* #3 Mob-H */
 6931|      0|                                pBNS->vert[jj].st_edge.cap += delta; /* create radical on =C- */
 6932|      0|                                pBNS->tot_st_cap += delta;
 6933|      0|                                pCentp_found = NULL;
 6934|      0|                                bNotFixed = 0; /* exit from the cycle */
 6935|      0|                                break;
 6936|      0|                            }
 6937|      0|                        }
 6938|      0|                        else
 6939|      0|                        {
 6940|       |                            /* failed */
 6941|      0|                            pBNS->vert[jj].st_edge.flow += delta;
 6942|      0|                            pBNS->vert[jj].st_edge.cap += delta;
 6943|       |                            /* decrement bond order */
 6944|      0|                            ecp0->flow += delta;
 6945|       |                            /* reflect the changes in at2[k] to make it a radical */
 6946|      0|                            pBNS->vert[k].st_edge.flow += delta;
 6947|      0|                            pBNS->tot_st_cap += delta;
 6948|      0|                            pBNS->tot_st_flow += 2 * delta;
 6949|      0|                        }
 6950|      0|                        if (ret2 < 0)
  ------------------
  |  Branch (6950:29): [True: 0, False: 0]
  ------------------
 6951|      0|                        {
 6952|      0|                            ret = ret2;
 6953|      0|                            goto exit_function;
 6954|      0|                        }
 6955|      0|                    }
 6956|      0|                }
 6957|      0|            }
 6958|      0|        }
 6959|      0|        if (!num_fixes)
  ------------------
  |  Branch (6959:13): [True: 0, False: 0]
  ------------------
 6960|      0|        {
 6961|      0|            break;
 6962|      0|        }
 6963|      0|    }
 6964|    796|    ret = tot_num_fixes;
 6965|       |
 6966|    796|exit_function:
 6967|    796|    pStruct->at = at;
 6968|    796|    memcpy( at2, at, len_at * sizeof( at2[0] ) );
 6969|       |
 6970|    796|    return ret;
 6971|    796|}
RemoveRadFromMobileHEndpointFixH:
 6988|      5|{
 6989|      5|#define IS_C(x) (NO_VERTEX != x && pVA[x].cNumValenceElectrons == 4 && pVA[x].cPeriodicRowNumber == 1)
 6990|      5|    int i, num_fixes, tot_num_fixes = 0;
 6991|       |
 6992|      5|    int ret2, ret;
 6993|      5|    int num_at = pStruct->num_atoms;
 6994|      5|    int num_deleted_H = pStruct->num_deleted_H;
 6995|      5|    int len_at = num_at + num_deleted_H;
 6996|      5|    int inv_forbidden_edge_mask = ~forbidden_edge_mask;
 6997|      5|    EDGE_LIST ChargeEdgeList, BondEdgeList;
 6998|      5|    int         itg, j, k, n, m, num_endp;
 6999|      5|    Vertex      endpoint0 = NO_VERTEX, endpoint1, endpoint2 = NO_VERTEX, centerpoint;
  ------------------
  |  |  146|      5|#define NO_VERTEX    -2
  ------------------
                  Vertex      endpoint0 = NO_VERTEX, endpoint1, endpoint2 = NO_VERTEX, centerpoint;
  ------------------
  |  |  146|      5|#define NO_VERTEX    -2
  ------------------
 7000|      5|    Vertex      centerpoint_found = NO_VERTEX, endpoint2_found = NO_VERTEX;
  ------------------
  |  |  146|      5|#define NO_VERTEX    -2
  ------------------
                  Vertex      centerpoint_found = NO_VERTEX, endpoint2_found = NO_VERTEX;
  ------------------
  |  |  146|      5|#define NO_VERTEX    -2
  ------------------
 7001|      5|    BNS_VERTEX *pEndp0 = NULL, *pEndp1, *pEndp2, *pCentp, *pCentp_found, *pEndp2_found = NULL;
 7002|      5|    BNS_EDGE   *ecp0, *ecp1, *ecp2, *ecp0_found = NULL, *ecp1_found = NULL, *ecp2_found = NULL;
 7003|      5|    int          tgroup_number, num_endpoints;
 7004|       |
 7005|      5|    ret = 0;
 7006|       |
 7007|      5|    if (pStruct->iMobileH != TAUT_NON)
  ------------------
  |  |  579|      5|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (7007:9): [True: 0, False: 5]
  ------------------
 7008|      0|        return ret;
 7009|       |
 7010|      5|    AllocEdgeList( &ChargeEdgeList, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      5|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 7011|      5|    AllocEdgeList( &BondEdgeList, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      5|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 7012|       |
 7013|      5|    memcpy( at2, at, len_at * sizeof( at2[0] ) );
 7014|      5|    pStruct->at = at2;
 7015|      5|    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 7016|      5|    if (ret2 < 0)
  ------------------
  |  Branch (7016:9): [True: 0, False: 5]
  ------------------
 7017|      0|    {
 7018|      0|        ret = ret2;
 7019|      0|        goto exit_function;
 7020|      0|    }
 7021|      5|    while (pBNS->tot_st_cap > pBNS->tot_st_flow && pStruct->ti.num_t_groups)
  ------------------
  |  Branch (7021:12): [True: 2, False: 3]
  |  Branch (7021:52): [True: 0, False: 2]
  ------------------
 7022|      0|    {
 7023|      0|        int iEndpoint = 0;
 7024|      0|        num_fixes = 0;
 7025|      0|        for (itg = 0; itg < pStruct->ti.num_t_groups; iEndpoint += num_endpoints, itg++)
  ------------------
  |  Branch (7025:23): [True: 0, False: 0]
  ------------------
 7026|      0|        {
 7027|      0|            pCentp_found = NULL;
 7028|      0|            tgroup_number = pStruct->ti.t_group[itg].nGroupNumber;
 7029|      0|            num_endpoints = pStruct->ti.t_group[itg].nNumEndpoints;
 7030|      0|            for (i = 0; i < num_endpoints; i++)
  ------------------
  |  Branch (7030:25): [True: 0, False: 0]
  ------------------
 7031|      0|            {
 7032|      0|                endpoint0 = pStruct->ti.nEndpointAtomNumber[iEndpoint + i];
 7033|      0|                pEndp0 = pBNS->vert + endpoint0;  /* taut endpoint vertex (possible location of mobile H */
 7034|      0|                if (pEndp0->st_edge.cap > pEndp0->st_edge.flow)
  ------------------
  |  Branch (7034:21): [True: 0, False: 0]
  ------------------
 7035|      0|                {
 7036|       |                    /* radical endpoint1 has been detected */
 7037|       |                    /* find a 1-3 centerpoint that has two or more endpoints */
 7038|       |                    /* connected to the t-group vertex by edges with flow>0 and */
 7039|       |                    /* to the centerpoint by edges with flow = 0 */
 7040|       |                    /* after that: (1) increment etg1 flow to eliminate radical */
 7041|       |                    /* (2) increment flow on one of the two other edges to the t-group */
 7042|       |                    /* (3) increment st_cap on the found centerpoint */
 7043|       |                    /* (4) rerun the BNS and re-create the structure */
 7044|      0|                    break;
 7045|      0|                }
 7046|      0|            }
 7047|       |
 7048|       |            /* 2nd attempt: increment flow in centerpoint---radical_endpoint edge */
 7049|      0|            pCentp_found = NULL;
 7050|      0|            if (i < num_endpoints)
  ------------------
  |  Branch (7050:17): [True: 0, False: 0]
  ------------------
 7051|      0|            {
 7052|       |                /* tautomeric endpoint found; traverse its t-group edges */
 7053|      0|                for (j = 0; j < num_endpoints; j++)
  ------------------
  |  Branch (7053:29): [True: 0, False: 0]
  ------------------
 7054|      0|                {
 7055|      0|                    if (i == j)
  ------------------
  |  Branch (7055:25): [True: 0, False: 0]
  ------------------
 7056|      0|                    {
 7057|      0|                        continue; /* avoid the found radical endpoint */
 7058|      0|                    }
 7059|      0|                    endpoint1 = pStruct->ti.nEndpointAtomNumber[iEndpoint + j];
 7060|      0|                    pEndp1 = pBNS->vert + endpoint1;     /* another endpoint */
 7061|       |
 7062|      0|                    if (pEndp1->st_edge.cap > pEndp1->st_edge.flow)
  ------------------
  |  Branch (7062:25): [True: 0, False: 0]
  ------------------
 7063|      0|                    {
 7064|      0|                        continue; /* one more radical-endpoint! What is going on here??? */
 7065|      0|                    }
 7066|      0|                    if (!at2[endpoint1].num_H && at2[endpoint1].charge != -1)
  ------------------
  |  Branch (7066:25): [True: 0, False: 0]
  |  Branch (7066:50): [True: 0, False: 0]
  ------------------
 7067|      0|                    {
 7068|      0|                        continue; /* avoid enpoints that do not have an attachment */
 7069|      0|                    }
 7070|      0|                    if (!pStruct->endpoint[endpoint1])
  ------------------
  |  Branch (7070:25): [True: 0, False: 0]
  ------------------
 7071|      0|                    {
 7072|      0|                        continue; /* should not happen */
 7073|      0|                    }
 7074|       |                    /* traverse endpoint1 edges to find the edge connecting it to the centerpoint */
 7075|      0|                    for (k = 0; k < pEndp1->num_adj_edges; k++)
  ------------------
  |  Branch (7075:33): [True: 0, False: 0]
  ------------------
 7076|      0|                    {
 7077|      0|                        ecp1 = pBNS->edge + pEndp1->iedge[k];
 7078|      0|                        if (ecp1->flow)
  ------------------
  |  Branch (7078:29): [True: 0, False: 0]
  ------------------
 7079|      0|                        {
 7080|      0|                            continue;
 7081|      0|                        }
 7082|      0|                        centerpoint = ecp1->neighbor12 ^ endpoint1;
 7083|      0|                        if (centerpoint >= pBNS->num_atoms)
  ------------------
  |  Branch (7083:29): [True: 0, False: 0]
  ------------------
 7084|      0|                        {
 7085|      0|                            break; /* no more edges to atoms */
 7086|      0|                        }
 7087|      0|                        pCentp = pBNS->vert + centerpoint;
 7088|      0|                        if (pStruct->endpoint[centerpoint])
  ------------------
  |  Branch (7088:29): [True: 0, False: 0]
  ------------------
 7089|      0|                        {
 7090|      0|                            continue; /* do not set another endpoint's valence = an unusual value */
 7091|      0|                        }
 7092|       |                        /* traverse centerpoint edges to find edge connecting it to the endpoint0 */
 7093|       |                        /* 1. Find a double bond to an endpoint */
 7094|      0|                        ecp2 = NULL;
 7095|      0|                        pEndp2 = NULL;
 7096|      0|                        for (n = 0, num_endp = 0; n < at2[centerpoint].valence; n++)
  ------------------
  |  Branch (7096:51): [True: 0, False: 0]
  ------------------
 7097|      0|                        {
 7098|      0|                            ecp0 = pBNS->edge + pCentp->iedge[n];
 7099|      0|                            if (ecp0->flow)
  ------------------
  |  Branch (7099:33): [True: 0, False: 0]
  ------------------
 7100|      0|                            {
 7101|      0|                                endpoint2 = ecp0->neighbor12 ^ centerpoint;
 7102|      0|                                if (pStruct->endpoint[endpoint2] /* ??? */)
  ------------------
  |  Branch (7102:37): [True: 0, False: 0]
  ------------------
 7103|      0|                                {
 7104|      0|                                    continue;
 7105|      0|                                }
 7106|       |                                /* check whether ecp0 is stereogenic: if it is then we cannot decrement its flow */
 7107|      0|                                for (m = 0; m < MAX_NUM_STEREO_BONDS && at[centerpoint].sb_parity[m]; m++)
  ------------------
  |  |  876|      0|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (7107:45): [True: 0, False: 0]
  |  Branch (7107:73): [True: 0, False: 0]
  ------------------
 7108|      0|                                {
 7109|      0|                                    if (at[centerpoint].sb_ord[m] == n)
  ------------------
  |  Branch (7109:41): [True: 0, False: 0]
  ------------------
 7110|      0|                                    {
 7111|      0|                                        endpoint2 = NO_VERTEX;
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
 7112|      0|                                        break;
 7113|      0|                                    }
 7114|      0|                                }
 7115|      0|                                if (endpoint2 == NO_VERTEX)
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (7115:37): [True: 0, False: 0]
  ------------------
 7116|      0|                                {
 7117|      0|                                    continue;
 7118|      0|                                }
 7119|      0|                                pEndp2 = pBNS->vert + endpoint2;
 7120|      0|                                ecp2 = ecp0;
 7121|      0|                                break;
 7122|      0|                            }
 7123|      0|                        }
 7124|      0|                        if (!ecp2)
  ------------------
  |  Branch (7124:29): [True: 0, False: 0]
  ------------------
 7125|      0|                        {
 7126|      0|                            continue;
 7127|      0|                        }
 7128|       |                        /* 2. Find a single bond to an endpoint0 */
 7129|      0|                        for (n = 0, num_endp = 0; n < at2[centerpoint].valence; n++)
  ------------------
  |  Branch (7129:51): [True: 0, False: 0]
  ------------------
 7130|      0|                        {
 7131|      0|                            ecp0 = pBNS->edge + pCentp->iedge[n];
 7132|      0|                            if (ecp0->flow)
  ------------------
  |  Branch (7132:33): [True: 0, False: 0]
  ------------------
 7133|      0|                            {
 7134|      0|                                continue;
 7135|      0|                            }
 7136|      0|                            if (endpoint0 != ( ecp0->neighbor12 ^ centerpoint ))
  ------------------
  |  Branch (7136:33): [True: 0, False: 0]
  ------------------
 7137|      0|                            {
 7138|      0|                                continue;
 7139|      0|                            }
 7140|       |                            /* Found:
 7141|       |                                              Endp2                         Endp2(not radical)
 7142|       |                                               ||                             |
 7143|       |                                               ||ecp2                         |ecp2
 7144|       |                                          ecp0 ||  ecp1                 ecp0  |  ecp1
 7145|       |                                     Endp0----Centp----Endp1       Endp0====Centp----Endp1
 7146|       |                                      ^  \             /      -->      \             /
 7147|       |                              radical |   \           /                 \           /
 7148|       |                                           \         /                   \         /
 7149|       |                                       etg0 \       / etg1           etg0 \       / etg1
 7150|       |                                             \     /                       \     /
 7151|       |                                               tg1                           tg1
 7152|       |
 7153|       |                             */
 7154|       |
 7155|       |                            /* compare centerpoints */
 7156|      0|                            if (!pCentp_found ||
  ------------------
  |  Branch (7156:33): [True: 0, False: 0]
  ------------------
 7157|       |                                 /* try to avoid carbons */
 7158|      0|                                ( pVA[centerpoint].cNumValenceElectrons != 4 ||
  ------------------
  |  Branch (7158:35): [True: 0, False: 0]
  ------------------
 7159|      0|                                    pVA[centerpoint].cPeriodicRowNumber != 1 ) &&
  ------------------
  |  Branch (7159:37): [True: 0, False: 0]
  ------------------
 7160|      0|                                 pVA[centerpoint_found].cNumValenceElectrons == 4 &&
  ------------------
  |  Branch (7160:34): [True: 0, False: 0]
  ------------------
 7161|      0|                                 pVA[centerpoint_found].cPeriodicRowNumber == 1 ||
  ------------------
  |  Branch (7161:34): [True: 0, False: 0]
  ------------------
 7162|       |                                 /* try a better non-carbon */
 7163|      0|                                 ( pVA[centerpoint].cNumValenceElectrons != 4 ||
  ------------------
  |  Branch (7163:36): [True: 0, False: 0]
  ------------------
 7164|      0|                                     pVA[centerpoint].cPeriodicRowNumber != 1 ) &&
  ------------------
  |  Branch (7164:38): [True: 0, False: 0]
  ------------------
 7165|      0|                                     ( at[centerpoint].valence > at[centerpoint_found].valence ||
  ------------------
  |  Branch (7165:40): [True: 0, False: 0]
  ------------------
 7166|      0|                                         at[centerpoint].valence == at[centerpoint_found].valence &&
  ------------------
  |  Branch (7166:42): [True: 0, False: 0]
  ------------------
 7167|      0|                                         at[centerpoint].el_number > at[centerpoint_found].el_number ))
  ------------------
  |  Branch (7167:42): [True: 0, False: 0]
  ------------------
 7168|      0|                            {
 7169|       |
 7170|      0|                                pCentp_found = pCentp;
 7171|      0|                                ecp0_found = ecp0;
 7172|      0|                                centerpoint_found = centerpoint;
 7173|      0|                                pEndp2_found = pEndp2;
 7174|      0|                                ecp2_found = ecp2;
 7175|      0|                                break;
 7176|      0|                            }
 7177|      0|                        }
 7178|      0|                    }
 7179|      0|                }
 7180|      0|            }
 7181|       |            /* decrement st_flow, st_cap on Endp2; decrement flow on ecp2; decrement st_flow on Centp */
 7182|       |            /* result: radicals on Endp0 and Centp => run BNS */
 7183|      0|            if (pCentp_found)
  ------------------
  |  Branch (7183:17): [True: 0, False: 0]
  ------------------
 7184|      0|            {
 7185|       |                /* make ecp0 a double bond, make ecp2 a single bond, remove radical */
 7186|      0|                ecp0_found->flow++;
 7187|      0|                if (ecp0_found->cap < ecp0_found->flow)
  ------------------
  |  Branch (7187:21): [True: 0, False: 0]
  ------------------
 7188|      0|                {
 7189|      0|                    ecp0_found->cap = ecp0_found->flow;
 7190|      0|                }
 7191|      0|                pEndp0->st_edge.flow++;
 7192|      0|                if (pEndp2_found && ecp2_found)
  ------------------
  |  Branch (7192:21): [True: 0, False: 0]
  |  Branch (7192:37): [True: 0, False: 0]
  ------------------
 7193|      0|                {
 7194|      0|                    ecp2_found->flow--;
 7195|      0|                    pEndp2_found->st_edge.flow--;
 7196|      0|                }
 7197|      0|                else
 7198|      0|                {
 7199|       |                             /* Endp2 not found: only make ecp0 a double bond */
 7200|      0|                    pCentp_found->st_edge.flow++;
 7201|      0|                    pCentp_found->st_edge.cap++;
 7202|      0|                    pBNS->tot_st_flow += 2; /* radical elimination */
 7203|      0|                    pBNS->tot_st_cap += 1;
 7204|      0|                }
 7205|       |
 7206|      0|                pCentp_found = NULL;
 7207|      0|                num_fixes++;    /* #2 */
 7208|      0|                tot_num_fixes++;
 7209|      0|                continue;
 7210|      0|            }
 7211|       |            /* 1st attempt */
 7212|      0|            pCentp_found = NULL;
 7213|      0|            if (i < num_endpoints)
  ------------------
  |  Branch (7213:17): [True: 0, False: 0]
  ------------------
 7214|      0|            {
 7215|       |                /* tautomeric endpoint found; traverse its t-group edges */
 7216|      0|                for (j = 0; j < num_endpoints; j++)
  ------------------
  |  Branch (7216:29): [True: 0, False: 0]
  ------------------
 7217|      0|                {
 7218|      0|                    if (i == j)
  ------------------
  |  Branch (7218:25): [True: 0, False: 0]
  ------------------
 7219|      0|                    {
 7220|      0|                        continue; /* avoid the found radical endpoint */
 7221|      0|                    }
 7222|      0|                    endpoint1 = pStruct->ti.nEndpointAtomNumber[iEndpoint + j];
 7223|      0|                    pEndp1 = pBNS->vert + endpoint1;     /* another endpoint */
 7224|      0|                    if (pEndp1->st_edge.cap > pEndp1->st_edge.flow)
  ------------------
  |  Branch (7224:25): [True: 0, False: 0]
  ------------------
 7225|      0|                    {
 7226|      0|                        continue; /* one more radical-endpoint! What is going on here??? */
 7227|      0|                    }
 7228|      0|                    if (!at2[endpoint1].num_H && at2[endpoint1].charge != -1)
  ------------------
  |  Branch (7228:25): [True: 0, False: 0]
  |  Branch (7228:50): [True: 0, False: 0]
  ------------------
 7229|      0|                    {
 7230|      0|                        continue; /* avoid enpoints that do not have an attachment */
 7231|      0|                    }
 7232|      0|                    if (!pStruct->endpoint[endpoint1])
  ------------------
  |  Branch (7232:25): [True: 0, False: 0]
  ------------------
 7233|      0|                    {
 7234|      0|                        continue; /* should not happen */
 7235|      0|                    }
 7236|       |                    /* traverse endpoint1 edges to find the edge connecting it to the centerpoint */
 7237|      0|                    for (k = 0; k < pEndp1->num_adj_edges; k++)
  ------------------
  |  Branch (7237:33): [True: 0, False: 0]
  ------------------
 7238|      0|                    {
 7239|      0|                        ecp1 = pBNS->edge + pEndp1->iedge[k];
 7240|      0|                        if (ecp1->flow)
  ------------------
  |  Branch (7240:29): [True: 0, False: 0]
  ------------------
 7241|      0|                        {
 7242|      0|                            continue;
 7243|      0|                        }
 7244|      0|                        centerpoint = ecp1->neighbor12 ^ endpoint1;
 7245|      0|                        if (centerpoint >= pBNS->num_atoms)
  ------------------
  |  Branch (7245:29): [True: 0, False: 0]
  ------------------
 7246|      0|                        {
 7247|      0|                            break;
 7248|      0|                        }
 7249|      0|                        pCentp = pBNS->vert + centerpoint;
 7250|       |                        /* traverse centerpoint edges to find the 2nd endpoint */
 7251|      0|                        for (n = 0, num_endp = 0; n < pCentp->num_adj_edges; n++)
  ------------------
  |  Branch (7251:51): [True: 0, False: 0]
  ------------------
 7252|      0|                        {
 7253|      0|                            ecp2 = pBNS->edge + pCentp->iedge[n];
 7254|      0|                            if (ecp2->flow)
  ------------------
  |  Branch (7254:33): [True: 0, False: 0]
  ------------------
 7255|      0|                            {
 7256|      0|                                continue;
 7257|      0|                            }
 7258|      0|                            endpoint2 = ecp2->neighbor12 ^ centerpoint;
 7259|      0|                            if (endpoint2 >= pBNS->num_atoms)
  ------------------
  |  Branch (7259:33): [True: 0, False: 0]
  ------------------
 7260|      0|                            {
 7261|      0|                                break;
 7262|      0|                            }
 7263|      0|                            if (!pStruct->endpoint[endpoint2])
  ------------------
  |  Branch (7263:33): [True: 0, False: 0]
  ------------------
 7264|      0|                            {
 7265|      0|                                continue;
 7266|      0|                            }
 7267|      0|                            pEndp2 = pBNS->vert + endpoint2;
 7268|       |
 7269|      0|                            if (at2[endpoint2].num_H || at2[endpoint1].charge == -1)
  ------------------
  |  Branch (7269:33): [True: 0, False: 0]
  |  Branch (7269:57): [True: 0, False: 0]
  ------------------
 7270|      0|                            {
 7271|      0|                                continue;
 7272|      0|                            }
 7273|       |
 7274|       |                            /* we have found the path:
 7275|       |
 7276|       |                            Endp1 has no attachments, Endp2 has.
 7277|       |
 7278|       |                                              Endp1                                Endp1
 7279|       |                                       etg1 //     \ ecp1                   etg1 /     \\ ecp1
 7280|       |                                  etg0     //       \                  etg0     /       \\
 7281|       |                             Endp0-----tg1           Centp  -->   Endp0=====tg1           Centp
 7282|       |                              ^            \\       /                           \\       /
 7283|       |                      radical |        etg2 \\     / ecp2                   etg2 \\     / ecp2
 7284|       |                                              Endp2                                Endp2
 7285|       |                            */
 7286|       |
 7287|       |                            /* compare centerpoints */
 7288|      0|                            if (!pCentp_found ||
  ------------------
  |  Branch (7288:33): [True: 0, False: 0]
  ------------------
 7289|       |                                 /* try to avoid carbons */
 7290|      0|                                ( pVA[centerpoint].cNumValenceElectrons != 4 ||
  ------------------
  |  Branch (7290:35): [True: 0, False: 0]
  ------------------
 7291|      0|                                    pVA[centerpoint].cPeriodicRowNumber != 1 ) &&
  ------------------
  |  Branch (7291:37): [True: 0, False: 0]
  ------------------
 7292|      0|                                 pVA[centerpoint_found].cNumValenceElectrons == 4 &&
  ------------------
  |  Branch (7292:34): [True: 0, False: 0]
  ------------------
 7293|      0|                                 pVA[centerpoint_found].cPeriodicRowNumber == 1 ||
  ------------------
  |  Branch (7293:34): [True: 0, False: 0]
  ------------------
 7294|       |                                 /* try a better non-carbon */
 7295|      0|                                 ( pVA[centerpoint].cNumValenceElectrons != 4 ||
  ------------------
  |  Branch (7295:36): [True: 0, False: 0]
  ------------------
 7296|      0|                                     pVA[centerpoint].cPeriodicRowNumber != 1 ) &&
  ------------------
  |  Branch (7296:38): [True: 0, False: 0]
  ------------------
 7297|      0|                                     ( at[centerpoint].valence > at[centerpoint_found].valence ||
  ------------------
  |  Branch (7297:40): [True: 0, False: 0]
  ------------------
 7298|      0|                                         at[centerpoint].valence == at[centerpoint_found].valence &&
  ------------------
  |  Branch (7298:42): [True: 0, False: 0]
  ------------------
 7299|      0|                                         at[centerpoint].el_number > at[centerpoint_found].el_number ))
  ------------------
  |  Branch (7299:42): [True: 0, False: 0]
  ------------------
 7300|      0|                            {
 7301|       |
 7302|      0|                                pCentp_found = pCentp;
 7303|      0|                                ecp1_found = ecp1;
 7304|      0|                                centerpoint_found = centerpoint;
 7305|      0|                                break;
 7306|      0|                            }
 7307|      0|                        }
 7308|      0|                    }
 7309|      0|                }
 7310|      0|            }
 7311|      0|            if (pCentp_found)
  ------------------
  |  Branch (7311:17): [True: 0, False: 0]
  ------------------
 7312|      0|            {
 7313|       |                /* create a new radical at the centerpoint and try to cancel them */
 7314|      0|                int delta = 1, ret3;
 7315|      0|                Vertex     vPathStart, vPathEnd, v1, v2;
 7316|      0|                int        nPathLen, nDeltaH, nDeltaCharge, nNumVisitedAtoms;
 7317|       |
 7318|      0|                pCentp_found->st_edge.cap += delta;
 7319|      0|                pBNS->tot_st_cap += delta;
 7320|       |
 7321|      0|                v1 = (int) ( pCentp_found - pBNS->vert );
 7322|      0|                v2 = (int) ( pEndp0 - pBNS->vert );
 7323|       |
 7324|      0|                ret3 = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 7325|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 7326|       |
 7327|      0|                if (ret3 == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (7327:21): [True: 0, False: 0]
  |  Branch (7327:36): [True: 0, False: 0]
  |  Branch (7327:54): [True: 0, False: 0]
  ------------------
 7328|      0|                    vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge % 2 == 0)
  ------------------
  |  Branch (7328:21): [True: 0, False: 0]
  |  Branch (7328:39): [True: 0, False: 0]
  |  Branch (7328:61): [True: 0, False: 0]
  ------------------
 7329|      0|                {
 7330|      0|                    ret3 = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 7331|      0|                    if (ret3 > 0)
  ------------------
  |  Branch (7331:25): [True: 0, False: 0]
  ------------------
 7332|      0|                    {
 7333|      0|                        num_fixes++;
 7334|      0|                        tot_num_fixes++;   /* #1 */
 7335|      0|                        pCentp_found = NULL;
 7336|      0|                        continue;
 7337|      0|                    }
 7338|      0|                }
 7339|      0|                else
 7340|      0|                {
 7341|      0|                    pCentp_found->st_edge.cap -= delta;
 7342|      0|                    pBNS->tot_st_cap -= delta;
 7343|      0|                }
 7344|      0|                if (ret3 < 0)
  ------------------
  |  Branch (7344:21): [True: 0, False: 0]
  ------------------
 7345|      0|                {
 7346|      0|                    ret = ret3;
 7347|      0|                    goto exit_function;
 7348|      0|                }
 7349|      0|            }
 7350|       |            /*----------------------------------------------------------------------------------------
 7351|       |               3rd attempt:                                                         add radical to keep
 7352|       |              ==============           u,f=>unfixed, fixed edges                    (N electrons)%2
 7353|       |                        (-)                       (-)                      (-)          |
 7354|       |                     e0/  \\ e1          =>     u/  \\u            =>     //  \         v
 7355|       |                      /    \\ ecp1 ecp2         /    \\   u    f         //    \
 7356|       |                  C--X*     Y(-)--C==Z      C--X*     Y(-)--C*--Z      --X(-)   Y===C---Z*
 7357|       |                    rad.    endp     not      rad.   endp  rad not      rad.   endp    not
 7358|       |                   Endp0   Endp1     endp     endp         to  endp     endp           endp
 7359|       |                                    Endp2                cancel
 7360|       |
 7361|       |               Note: endpoints X and Y may belong to different t-groups
 7362|       |             ----------------------------------------------------------------------------------------*/
 7363|      0|            pCentp_found = NULL;
 7364|      0|            if (i < num_endpoints)
  ------------------
  |  Branch (7364:17): [True: 0, False: 0]
  ------------------
 7365|      0|            {
 7366|      0|                int  e0, e1;
 7367|      0|                if (( e0 = pVA[endpoint0].nCMinusGroupEdge - 1 ) < 0 || pBNS->edge[e0].forbidden)
  ------------------
  |  Branch (7367:21): [True: 0, False: 0]
  |  Branch (7367:73): [True: 0, False: 0]
  ------------------
 7368|      0|                {
 7369|      0|                    continue; /* no negative charge on Endp0 is possible */
 7370|      0|                }
 7371|       |                /* a radical-tautomeric endpoint found; traverse all endpoints */
 7372|      0|                for (j = 0; j < pStruct->ti.nNumEndpoints; j++)
  ------------------
  |  Branch (7372:29): [True: 0, False: 0]
  ------------------
 7373|      0|                {
 7374|      0|                    if (iEndpoint + i == j)
  ------------------
  |  Branch (7374:25): [True: 0, False: 0]
  ------------------
 7375|      0|                    {
 7376|      0|                        continue; /* avoid the found radical endpoint */
 7377|      0|                    }
 7378|       |
 7379|      0|                    endpoint1 = pStruct->ti.nEndpointAtomNumber[j];
 7380|      0|                    pEndp1 = pBNS->vert + endpoint1;     /* another endpoint */
 7381|       |
 7382|      0|                    if (pEndp1->st_edge.cap > pEndp1->st_edge.flow)
  ------------------
  |  Branch (7382:25): [True: 0, False: 0]
  ------------------
 7383|      0|                    {
 7384|      0|                        continue; /* one more radical-endpoint! What is going on here??? */
 7385|      0|                    }
 7386|      0|                    if (( ( e1 = pVA[endpoint1].nCMinusGroupEdge - 1 ) < 0 || !pBNS->edge[e1].flow ) || pBNS->edge[e1].forbidden)
  ------------------
  |  Branch (7386:27): [True: 0, False: 0]
  |  Branch (7386:79): [True: 0, False: 0]
  |  Branch (7386:105): [True: 0, False: 0]
  ------------------
 7387|      0|                    {
 7388|      0|                        continue; /* no negative charge on Endp1 */
 7389|      0|                    }
 7390|      0|                    if (!pStruct->endpoint[endpoint1])
  ------------------
  |  Branch (7390:25): [True: 0, False: 0]
  ------------------
 7391|      0|                    {
 7392|      0|                        continue; /* should not happen */
 7393|      0|                    }
 7394|       |                    /* traverse endpoint1 edges to find the edge connecting it to the centerpoint */
 7395|      0|                    for (k = 0; k < pEndp1->num_adj_edges; k++)
  ------------------
  |  Branch (7395:33): [True: 0, False: 0]
  ------------------
 7396|      0|                    {
 7397|      0|                        ecp1 = pBNS->edge + pEndp1->iedge[k];   /* e1C */
 7398|      0|                        if (ecp1->flow || ecp1->forbidden)
  ------------------
  |  Branch (7398:29): [True: 0, False: 0]
  |  Branch (7398:43): [True: 0, False: 0]
  ------------------
 7399|      0|                        {
 7400|      0|                            continue;
 7401|      0|                        }
 7402|      0|                        centerpoint = ecp1->neighbor12 ^ endpoint1;
 7403|      0|                        if (centerpoint >= pBNS->num_atoms)
  ------------------
  |  Branch (7403:29): [True: 0, False: 0]
  ------------------
 7404|      0|                        {
 7405|      0|                            break; /* no more edges to atoms */
 7406|      0|                        }
 7407|      0|                        pCentp = pBNS->vert + centerpoint;
 7408|      0|                        if (pStruct->endpoint[centerpoint])
  ------------------
  |  Branch (7408:29): [True: 0, False: 0]
  ------------------
 7409|      0|                        {
 7410|      0|                            continue; /* do not set another endpoint's valence = an unusual value */
 7411|      0|                        }
 7412|       |                        /* traverse centerpoint edges to find edge connecting it to the endpoint0 */
 7413|       |                        /* 1. Find a double bond to a not endpoint */
 7414|      0|                        ecp2 = NULL;
 7415|      0|                        pEndp2 = NULL;
 7416|      0|                        for (n = 0, num_endp = 0; n < pCentp->num_adj_edges; n++)
  ------------------
  |  Branch (7416:51): [True: 0, False: 0]
  ------------------
 7417|      0|                        {
 7418|      0|                            ecp0 = pBNS->edge + pCentp->iedge[n];
 7419|      0|                            if (ecp0->flow && !ecp0->forbidden)
  ------------------
  |  Branch (7419:33): [True: 0, False: 0]
  |  Branch (7419:47): [True: 0, False: 0]
  ------------------
 7420|      0|                            {
 7421|      0|                                endpoint2 = ecp0->neighbor12 ^ centerpoint;
 7422|      0|                                if (endpoint2 >= pBNS->num_atoms || pStruct->endpoint[endpoint2])
  ------------------
  |  Branch (7422:37): [True: 0, False: 0]
  |  Branch (7422:69): [True: 0, False: 0]
  ------------------
 7423|      0|                                {
 7424|      0|                                    continue;
 7425|      0|                                }
 7426|       |                                /* check whether ecp0 is stereogenic: if it is then we cannot decrement its flow */
 7427|      0|                                for (m = 0; m < MAX_NUM_STEREO_BONDS && at[centerpoint].sb_parity[m]; m++)
  ------------------
  |  |  876|      0|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (7427:45): [True: 0, False: 0]
  |  Branch (7427:73): [True: 0, False: 0]
  ------------------
 7428|      0|                                {
 7429|      0|                                    if (at[centerpoint].sb_ord[m] == n)
  ------------------
  |  Branch (7429:41): [True: 0, False: 0]
  ------------------
 7430|      0|                                    {
 7431|      0|                                        endpoint2 = NO_VERTEX;
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
 7432|      0|                                        break;
 7433|      0|                                    }
 7434|      0|                                }
 7435|      0|                                if (endpoint2 == NO_VERTEX)
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (7435:37): [True: 0, False: 0]
  ------------------
 7436|      0|                                {
 7437|      0|                                    continue;
 7438|      0|                                }
 7439|      0|                                pEndp2 = pBNS->vert + endpoint2;
 7440|      0|                                ecp2 = ecp0;           /* e2C */
 7441|      0|                                break;
 7442|      0|                            }
 7443|      0|                        }
 7444|      0|                        if (!ecp2)
  ------------------
  |  Branch (7444:29): [True: 0, False: 0]
  ------------------
 7445|      0|                        {
 7446|      0|                            continue;
 7447|      0|                        }
 7448|       |                        /* compare centerpoints */
 7449|      0|                        if (!pCentp_found ||
  ------------------
  |  Branch (7449:29): [True: 0, False: 0]
  ------------------
 7450|       |                             /* try to find carbons */
 7451|      0|                             !IS_C( endpoint2_found ) && IS_C( endpoint2 ) ||
  ------------------
  |  | 6989|      0|#define IS_C(x) (NO_VERTEX != x && pVA[x].cNumValenceElectrons == 4 && pVA[x].cPeriodicRowNumber == 1)
  |  |  ------------------
  |  |  |  |  146|      0|#define NO_VERTEX    -2
  |  |  ------------------
  |  |  |  Branch (6989:18): [True: 0, False: 0]
  |  |  |  Branch (6989:36): [True: 0, False: 0]
  |  |  |  Branch (6989:72): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                                           !IS_C( endpoint2_found ) && IS_C( endpoint2 ) ||
  ------------------
  |  | 6989|      0|#define IS_C(x) (NO_VERTEX != x && pVA[x].cNumValenceElectrons == 4 && pVA[x].cPeriodicRowNumber == 1)
  |  |  ------------------
  |  |  |  |  146|      0|#define NO_VERTEX    -2
  |  |  ------------------
  |  |  |  Branch (6989:18): [True: 0, False: 0]
  |  |  |  Branch (6989:36): [True: 0, False: 0]
  |  |  |  Branch (6989:72): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 7452|      0|                             IS_C( endpoint2_found ) && IS_C( endpoint2 ) &&
  ------------------
  |  | 6989|      0|#define IS_C(x) (NO_VERTEX != x && pVA[x].cNumValenceElectrons == 4 && pVA[x].cPeriodicRowNumber == 1)
  |  |  ------------------
  |  |  |  |  146|      0|#define NO_VERTEX    -2
  |  |  ------------------
  |  |  |  Branch (6989:18): [True: 0, False: 0]
  |  |  |  Branch (6989:36): [True: 0, False: 0]
  |  |  |  Branch (6989:72): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                                           IS_C( endpoint2_found ) && IS_C( endpoint2 ) &&
  ------------------
  |  | 6989|      0|#define IS_C(x) (NO_VERTEX != x && pVA[x].cNumValenceElectrons == 4 && pVA[x].cPeriodicRowNumber == 1)
  |  |  ------------------
  |  |  |  |  146|      0|#define NO_VERTEX    -2
  |  |  ------------------
  |  |  |  Branch (6989:18): [True: 0, False: 0]
  |  |  |  Branch (6989:36): [True: 0, False: 0]
  |  |  |  Branch (6989:72): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 7453|      0|                             !IS_C( centerpoint_found ) && IS_C( centerpoint ))
  ------------------
  |  | 6989|      0|#define IS_C(x) (NO_VERTEX != x && pVA[x].cNumValenceElectrons == 4 && pVA[x].cPeriodicRowNumber == 1)
  |  |  ------------------
  |  |  |  |  146|      0|#define NO_VERTEX    -2
  |  |  ------------------
  |  |  |  Branch (6989:18): [True: 0, False: 0]
  |  |  |  Branch (6989:36): [True: 0, False: 0]
  |  |  |  Branch (6989:72): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                                           !IS_C( centerpoint_found ) && IS_C( centerpoint ))
  ------------------
  |  | 6989|      0|#define IS_C(x) (NO_VERTEX != x && pVA[x].cNumValenceElectrons == 4 && pVA[x].cPeriodicRowNumber == 1)
  |  |  ------------------
  |  |  |  |  146|      0|#define NO_VERTEX    -2
  |  |  ------------------
  |  |  |  Branch (6989:18): [True: 0, False: 0]
  |  |  |  Branch (6989:36): [True: 0, False: 0]
  |  |  |  Branch (6989:72): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 7454|      0|                        {
 7455|       |
 7456|      0|                            pCentp_found = pCentp;
 7457|      0|                            centerpoint_found = centerpoint;
 7458|      0|                            endpoint2_found = endpoint2;
 7459|      0|                            ecp2_found = ecp2;
 7460|      0|                            ecp1_found = ecp1;
 7461|      0|                            ecp0_found = pBNS->edge + e0;
 7462|      0|                            break;
 7463|      0|                        }
 7464|      0|                    }
 7465|      0|                }
 7466|      0|            }
 7467|       |            /* decrement st_flow, st_cap on Endp2; decrement flow on ecp2; decrement st_flow on Centp */
 7468|       |            /* result: radicals on Endp0 and Centp => run BNS */
 7469|      0|            if (pCentp_found)
  ------------------
  |  Branch (7469:17): [True: 0, False: 0]
  ------------------
 7470|      0|            {
 7471|      0|                Vertex     vPathStart, vPathEnd, v1, v2;
 7472|      0|                int        nPathLen, nDeltaH, nDeltaCharge, nNumVisitedAtoms;
 7473|      0|                int        delta;
 7474|       |
 7475|      0|                Vertex    vEndp0 = ecp0_found->neighbor1;
 7476|      0|                Vertex    vEndp1 = ecp1_found->neighbor12 ^ centerpoint_found;
 7477|      0|                Vertex    vEndp2 = ecp2_found->neighbor12 ^ centerpoint_found;
 7478|      0|                BNS_EDGE *pe0 = ecp0_found;
 7479|      0|                BNS_EDGE *pe1 = pBNS->edge + ( pVA[vEndp1].nCMinusGroupEdge - 1 );
 7480|      0|                pEndp1 = pBNS->vert + vEndp1;
 7481|      0|                pEndp2 = pBNS->vert + vEndp2;
 7482|      0|                pCentp = pCentp_found;
 7483|      0|                if (!ChargeEdgeList.num_alloc)
  ------------------
  |  Branch (7483:21): [True: 0, False: 0]
  ------------------
 7484|      0|                {
 7485|      0|                    for (n = 0; n < pStruct->num_atoms; n++)
  ------------------
  |  Branch (7485:33): [True: 0, False: 0]
  ------------------
 7486|      0|                    {
 7487|      0|                        if (( k = pVA[n].nCMinusGroupEdge ) >= 0 && !pBNS->edge[k].forbidden &&
  ------------------
  |  Branch (7487:29): [True: 0, False: 0]
  |  Branch (7487:69): [True: 0, False: 0]
  ------------------
 7488|      0|                            ( ret = AddToEdgeList( &ChargeEdgeList, k, pStruct->num_atoms ) ))
  ------------------
  |  Branch (7488:29): [True: 0, False: 0]
  ------------------
 7489|      0|                        {
 7490|      0|                            goto exit_function;
 7491|      0|                        }
 7492|      0|                        if (( k = pVA[n].nCPlusGroupEdge ) >= 0 && !pBNS->edge[k].forbidden &&
  ------------------
  |  Branch (7492:29): [True: 0, False: 0]
  |  Branch (7492:68): [True: 0, False: 0]
  ------------------
 7493|      0|                            ( ret = AddToEdgeList( &ChargeEdgeList, k, pStruct->num_atoms ) ))
  ------------------
  |  Branch (7493:29): [True: 0, False: 0]
  ------------------
 7494|      0|                        {
 7495|      0|                            goto exit_function;
 7496|      0|                        }
 7497|      0|                    }
 7498|      0|                }
 7499|      0|                if (!BondEdgeList.num_alloc)
  ------------------
  |  Branch (7499:21): [True: 0, False: 0]
  ------------------
 7500|      0|                {
 7501|      0|                    for (n = 0; n < pBNS->num_bonds; n++)
  ------------------
  |  Branch (7501:33): [True: 0, False: 0]
  ------------------
 7502|      0|                    {
 7503|      0|                        if (( ret = AddToEdgeList( &BondEdgeList, n, pBNS->num_bonds ) ))
  ------------------
  |  Branch (7503:29): [True: 0, False: 0]
  ------------------
 7504|      0|                        {
 7505|      0|                            goto exit_function;
 7506|      0|                        }
 7507|      0|                    }
 7508|      0|                }
 7509|       |                /* fix all bonds and charges */
 7510|      0|                SetForbiddenEdgeMask( pBNS, &ChargeEdgeList, forbidden_edge_mask );
 7511|      0|                SetForbiddenEdgeMask( pBNS, &BondEdgeList, forbidden_edge_mask );
 7512|       |                /* prepare flow for testing */
 7513|      0|                delta = 1;
 7514|      0|                ecp2_found->flow -= delta;
 7515|      0|                pCentp->st_edge.flow -= delta;
 7516|      0|                pEndp2->st_edge.flow -= delta;
 7517|      0|                pBNS->tot_st_flow -= 2 * delta;
 7518|       |                /* unfix edges to be changed */
 7519|      0|                pe0->forbidden &= inv_forbidden_edge_mask;
 7520|      0|                pe1->forbidden &= inv_forbidden_edge_mask;
 7521|      0|                ecp1_found->forbidden &= inv_forbidden_edge_mask;
 7522|       |
 7523|      0|                pBNS->tot_st_cap += delta;
 7524|       |
 7525|      0|                v1 = vEndp0;
 7526|      0|                v2 = centerpoint_found;
 7527|      0|                ret2 = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 7528|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 7529|       |
 7530|      0|                if (ret2 == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (7530:21): [True: 0, False: 0]
  |  Branch (7530:36): [True: 0, False: 0]
  |  Branch (7530:54): [True: 0, False: 0]
  ------------------
 7531|      0|                    vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == 0)
  ------------------
  |  Branch (7531:21): [True: 0, False: 0]
  |  Branch (7531:39): [True: 0, False: 0]
  |  Branch (7531:61): [True: 0, False: 0]
  ------------------
 7532|      0|                {
 7533|      0|                    ret2 = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 7534|      0|                    if (ret2 > 0)
  ------------------
  |  Branch (7534:25): [True: 0, False: 0]
  ------------------
 7535|      0|                    {
 7536|      0|                        num_fixes++;
 7537|      0|                        tot_num_fixes++; /* #3 */
 7538|      0|                        pCentp_found = NULL;
 7539|      0|                    }
 7540|      0|                }
 7541|      0|                else
 7542|      0|                {
 7543|       |                    /* roll back */
 7544|      0|                    ecp2_found->flow += delta;
 7545|      0|                    pCentp->st_edge.flow += delta;
 7546|      0|                    pEndp2->st_edge.flow += delta;
 7547|      0|                    pBNS->tot_st_flow += 2 * delta;
 7548|      0|                }
 7549|      0|                RemoveForbiddenEdgeMask( pBNS, &ChargeEdgeList, forbidden_edge_mask );
 7550|      0|                RemoveForbiddenEdgeMask( pBNS, &BondEdgeList, forbidden_edge_mask );
 7551|      0|                if (ret2 < 0)
  ------------------
  |  Branch (7551:21): [True: 0, False: 0]
  ------------------
 7552|      0|                {
 7553|      0|                    ret = ret2;
 7554|      0|                    goto exit_function;
 7555|      0|                }
 7556|      0|                if (!pCentp_found)
  ------------------
  |  Branch (7556:21): [True: 0, False: 0]
  ------------------
 7557|      0|                    continue;
 7558|      0|            }
 7559|      0|        }
 7560|      0|        if (!num_fixes)
  ------------------
  |  Branch (7560:13): [True: 0, False: 0]
  ------------------
 7561|      0|        {
 7562|      0|            break;
 7563|      0|        }
 7564|      0|    }
 7565|       |
 7566|       |    /************ again ***********************************************************/
 7567|      5|    while (pBNS->tot_st_cap > pBNS->tot_st_flow && pStruct->ti.num_t_groups)
  ------------------
  |  Branch (7567:12): [True: 2, False: 3]
  |  Branch (7567:52): [True: 0, False: 2]
  ------------------
 7568|      0|    {
 7569|      0|        int iEndpoint = 0;
 7570|      0|        num_fixes = 0;
 7571|      0|        for (itg = 0; itg < pStruct->ti.num_t_groups; iEndpoint += num_endpoints, itg++)
  ------------------
  |  Branch (7571:23): [True: 0, False: 0]
  ------------------
 7572|      0|        {
 7573|      0|            pCentp_found = NULL;
 7574|      0|            tgroup_number = pStruct->ti.t_group[itg].nGroupNumber;
 7575|      0|            num_endpoints = pStruct->ti.t_group[itg].nNumEndpoints;
 7576|      0|            for (i = 0; i < num_endpoints; i++)
  ------------------
  |  Branch (7576:25): [True: 0, False: 0]
  ------------------
 7577|      0|            {
 7578|      0|                endpoint0 = pStruct->ti.nEndpointAtomNumber[iEndpoint + i];
 7579|      0|                pEndp0 = pBNS->vert + endpoint0;  /* taut endpoint vertex (possible location of mobile H */
 7580|      0|                if (pEndp0->st_edge.cap > pEndp0->st_edge.flow)
  ------------------
  |  Branch (7580:21): [True: 0, False: 0]
  ------------------
 7581|      0|                {
 7582|       |                    /* radical endpoint1 has been detected */
 7583|       |                    /* find a 1-3 centerpoint that has two or more endpoints */
 7584|       |                    /* connected to the t-group vertex by edges with flow>0 and */
 7585|       |                    /* to the centerpoint by edges with flow = 0 */
 7586|       |                    /* after that: (1) increment etg1 flow to eliminate radical */
 7587|       |                    /* (2) increment flow on one of the two other edges to the t-group */
 7588|       |                    /* (3) increment st_cap on the found centerpoint */
 7589|       |                    /* (4) rerun the BNS and re-create the structure */
 7590|      0|                    break;
 7591|      0|                }
 7592|      0|            }
 7593|       |            /* 4th attempt */
 7594|      0|            if (i < num_endpoints)
  ------------------
  |  Branch (7594:17): [True: 0, False: 0]
  ------------------
 7595|      0|            {
 7596|       |                /* tautomeric endpoint found; traverse its t-group edges */
 7597|      0|                pEndp2_found = NULL;
 7598|      0|                for (j = 0; j < pEndp0->num_adj_edges; j++)
  ------------------
  |  Branch (7598:29): [True: 0, False: 0]
  ------------------
 7599|      0|                {
 7600|      0|                    ecp0 = pBNS->edge + pEndp0->iedge[j];
 7601|      0|                    centerpoint = ecp0->neighbor12 ^ endpoint0;
 7602|      0|                    if (centerpoint >= pBNS->num_atoms || ecp0->flow || pStruct->endpoint[centerpoint])
  ------------------
  |  Branch (7602:25): [True: 0, False: 0]
  |  Branch (7602:59): [True: 0, False: 0]
  |  Branch (7602:73): [True: 0, False: 0]
  ------------------
 7603|      0|                    {
 7604|      0|                        continue; /* ignore non-single bonds, orig. InChI endpoints, and fictitious atoms */
 7605|      0|                    }
 7606|      0|                    pCentp = pBNS->vert + centerpoint;
 7607|      0|                    for (k = 0; k < pCentp->num_adj_edges; k++)
  ------------------
  |  Branch (7607:33): [True: 0, False: 0]
  ------------------
 7608|      0|                    {
 7609|      0|                        ecp1 = pBNS->edge + pCentp->iedge[k];
 7610|      0|                        endpoint1 = ecp1->neighbor12 ^ centerpoint;
 7611|      0|                        if (endpoint1 >= pBNS->num_atoms || !ecp1->flow || pStruct->endpoint[endpoint1])
  ------------------
  |  Branch (7611:29): [True: 0, False: 0]
  |  Branch (7611:61): [True: 0, False: 0]
  |  Branch (7611:76): [True: 0, False: 0]
  ------------------
 7612|      0|                        {
 7613|      0|                            continue; /* ignore single bonds, orig. InChI endpoints, and fictitious atoms */
 7614|      0|                        }
 7615|      0|                        pEndp1 = pBNS->vert + endpoint1;
 7616|      0|                        if (endpoint1 == endpoint0 || pEndp1->st_edge.cap != pEndp1->st_edge.flow)
  ------------------
  |  Branch (7616:29): [True: 0, False: 0]
  |  Branch (7616:55): [True: 0, False: 0]
  ------------------
 7617|      0|                        {
 7618|      0|                            continue; /* ignore radicals */
 7619|      0|                        }
 7620|      0|                        if (!pEndp2_found ||
  ------------------
  |  Branch (7620:29): [True: 0, False: 0]
  ------------------
 7621|       |                             /* try to find carbons */
 7622|      0|                             !IS_C( endpoint2_found ) && IS_C( endpoint1 ) ||
  ------------------
  |  | 6989|      0|#define IS_C(x) (NO_VERTEX != x && pVA[x].cNumValenceElectrons == 4 && pVA[x].cPeriodicRowNumber == 1)
  |  |  ------------------
  |  |  |  |  146|      0|#define NO_VERTEX    -2
  |  |  ------------------
  |  |  |  Branch (6989:18): [True: 0, False: 0]
  |  |  |  Branch (6989:36): [True: 0, False: 0]
  |  |  |  Branch (6989:72): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                                           !IS_C( endpoint2_found ) && IS_C( endpoint1 ) ||
  ------------------
  |  | 6989|      0|#define IS_C(x) (NO_VERTEX != x && pVA[x].cNumValenceElectrons == 4 && pVA[x].cPeriodicRowNumber == 1)
  |  |  ------------------
  |  |  |  |  146|      0|#define NO_VERTEX    -2
  |  |  ------------------
  |  |  |  Branch (6989:18): [True: 0, False: 0]
  |  |  |  Branch (6989:36): [True: 0, False: 0]
  |  |  |  Branch (6989:72): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 7623|      0|                             IS_C( endpoint2_found ) && IS_C( endpoint1 ) &&
  ------------------
  |  | 6989|      0|#define IS_C(x) (NO_VERTEX != x && pVA[x].cNumValenceElectrons == 4 && pVA[x].cPeriodicRowNumber == 1)
  |  |  ------------------
  |  |  |  |  146|      0|#define NO_VERTEX    -2
  |  |  ------------------
  |  |  |  Branch (6989:18): [True: 0, False: 0]
  |  |  |  Branch (6989:36): [True: 0, False: 0]
  |  |  |  Branch (6989:72): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                                           IS_C( endpoint2_found ) && IS_C( endpoint1 ) &&
  ------------------
  |  | 6989|      0|#define IS_C(x) (NO_VERTEX != x && pVA[x].cNumValenceElectrons == 4 && pVA[x].cPeriodicRowNumber == 1)
  |  |  ------------------
  |  |  |  |  146|      0|#define NO_VERTEX    -2
  |  |  ------------------
  |  |  |  Branch (6989:18): [True: 0, False: 0]
  |  |  |  Branch (6989:36): [True: 0, False: 0]
  |  |  |  Branch (6989:72): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 7624|      0|                             !IS_C( centerpoint_found ) && IS_C( centerpoint ))
  ------------------
  |  | 6989|      0|#define IS_C(x) (NO_VERTEX != x && pVA[x].cNumValenceElectrons == 4 && pVA[x].cPeriodicRowNumber == 1)
  |  |  ------------------
  |  |  |  |  146|      0|#define NO_VERTEX    -2
  |  |  ------------------
  |  |  |  Branch (6989:18): [True: 0, False: 0]
  |  |  |  Branch (6989:36): [True: 0, False: 0]
  |  |  |  Branch (6989:72): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                                           !IS_C( centerpoint_found ) && IS_C( centerpoint ))
  ------------------
  |  | 6989|      0|#define IS_C(x) (NO_VERTEX != x && pVA[x].cNumValenceElectrons == 4 && pVA[x].cPeriodicRowNumber == 1)
  |  |  ------------------
  |  |  |  |  146|      0|#define NO_VERTEX    -2
  |  |  ------------------
  |  |  |  Branch (6989:18): [True: 0, False: 0]
  |  |  |  Branch (6989:36): [True: 0, False: 0]
  |  |  |  Branch (6989:72): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 7625|      0|                        {
 7626|      0|                            pEndp2_found = pEndp1;
 7627|      0|                            pCentp_found = pCentp;
 7628|      0|                            endpoint2_found = endpoint1;
 7629|      0|                            centerpoint_found = centerpoint;
 7630|      0|                            ecp1_found = ecp0;
 7631|      0|                            ecp2_found = ecp1;
 7632|      0|                        }
 7633|      0|                    }
 7634|      0|                }
 7635|      0|                if (pEndp2_found)
  ------------------
  |  Branch (7635:21): [True: 0, False: 0]
  ------------------
 7636|      0|                {
 7637|       |                    /* move radical from pEndp0 to pEndp2 */
 7638|      0|                    pEndp0->st_edge.flow++;
 7639|      0|                    ecp1_found->flow++;
 7640|      0|                    ecp2_found->flow--;
 7641|      0|                    pEndp2_found->st_edge.flow--;
 7642|      0|                    pEndp2_found = NULL;
 7643|      0|                    pCentp_found = NULL;
 7644|      0|                    num_fixes++;    /* #4 */
 7645|      0|                    tot_num_fixes++;
 7646|      0|                    continue;
 7647|      0|                }
 7648|      0|            }
 7649|      0|        }
 7650|      0|        if (!num_fixes)
  ------------------
  |  Branch (7650:13): [True: 0, False: 0]
  ------------------
 7651|      0|        {
 7652|      0|            break;
 7653|      0|        }
 7654|      0|    }
 7655|       |
 7656|      5|    ret = tot_num_fixes;
 7657|       |
 7658|      5|exit_function:
 7659|      5|    AllocEdgeList( &ChargeEdgeList, EDGE_LIST_FREE );
  ------------------
  |  |  271|      5|#define EDGE_LIST_FREE   (-2)
  ------------------
 7660|      5|    AllocEdgeList( &BondEdgeList, EDGE_LIST_FREE );
  ------------------
  |  |  271|      5|#define EDGE_LIST_FREE   (-2)
  ------------------
 7661|       |
 7662|      5|    pStruct->at = at;
 7663|      5|    memcpy( at2, at, len_at * sizeof( at2[0] ) );
 7664|       |
 7665|      5|    return ret;
 7666|      5|#undef IS_C
 7667|      5|}
MoveChargeToMakeCenerpoints:
 7683|    801|{
 7684|    801|    int i, j, neigh, num_endpoints, tg_group = 0, num_success;
 7685|    801|    int ret2, ret, delta;
 7686|    801|    int num_at = pStruct->num_atoms;
 7687|    801|    int num_deleted_H = pStruct->num_deleted_H;
 7688|    801|    int len_at = num_at + num_deleted_H;
 7689|    801|    int inv_forbidden_edge_mask = ~forbidden_edge_mask;
 7690|       |
 7691|       |    /* for RunBnsTestOnce */
 7692|    801|    Vertex     vPathStart, vPathEnd;
 7693|    801|    int        nPathLen, nDeltaH, nDeltaCharge, nNumVisitedAtoms;
 7694|       |
 7695|    801|    BNS_EDGE   *pEdgePlus, *pEdgeMinus;
 7696|    801|    Vertex      v1p, v2p, v1m, v2m;
 7697|    801|    BNS_VERTEX *pv1p, *pv2p, *pv1m, *pv2m;
 7698|       |
 7699|    801|    ret = 0;
 7700|    801|    num_success = 0;
 7701|       |
 7702|       |    /* to simplify, prepare new at[] from pBNS */
 7703|    801|    memcpy( at2, at, len_at * sizeof( at2[0] ) );
 7704|    801|    pStruct->at = at2;
 7705|    801|    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 7706|    801|    pStruct->at = at;
 7707|    801|    if (ret2 < 0)
  ------------------
  |  Branch (7707:9): [True: 0, False: 801]
  ------------------
 7708|      0|    {
 7709|      0|        ret = ret2;
 7710|      0|        goto exit_function;
 7711|      0|    }
 7712|       |
 7713|  4.46k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (7713:17): [True: 3.65k, False: 801]
  ------------------
 7714|  3.65k|    {
 7715|  3.65k|        if (pVA[i].cNumValenceElectrons != 4 && /* not C, Si, Ge */
  ------------------
  |  Branch (7715:13): [True: 3.60k, False: 51]
  ------------------
 7716|  3.65k|             !pVA[i].cMetal && !pVA[i].nTautGroupEdge &&
  ------------------
  |  Branch (7716:14): [True: 1.65k, False: 1.94k]
  |  Branch (7716:32): [True: 1.65k, False: 0]
  ------------------
 7717|  3.65k|             !at2[i].num_H && at2[i].valence >= 3 &&
  ------------------
  |  Branch (7717:14): [True: 1.65k, False: 0]
  |  Branch (7717:31): [True: 0, False: 1.65k]
  ------------------
 7718|  3.65k|             at2[i].valence == at2[i].chem_bonds_valence &&
  ------------------
  |  Branch (7718:14): [True: 0, False: 0]
  ------------------
 7719|  3.65k|             !at2[i].charge && pVA[i].nCPlusGroupEdge > 0 &&
  ------------------
  |  Branch (7719:14): [True: 0, False: 0]
  |  Branch (7719:32): [True: 0, False: 0]
  ------------------
 7720|  3.65k|             is_centerpoint_elem( at2[i].el_number ))
  ------------------
  |  Branch (7720:14): [True: 0, False: 0]
  ------------------
 7721|      0|        {
 7722|      0|            for (j = 0, num_endpoints = 0; j < at2[i].valence; j++)
  ------------------
  |  Branch (7722:44): [True: 0, False: 0]
  ------------------
 7723|      0|            {
 7724|      0|                neigh = at2[i].neighbor[j];
 7725|      0|                if (at2[neigh].endpoint)
  ------------------
  |  Branch (7725:21): [True: 0, False: 0]
  ------------------
 7726|      0|                {
 7727|      0|                    if (!num_endpoints)
  ------------------
  |  Branch (7727:25): [True: 0, False: 0]
  ------------------
 7728|      0|                    {
 7729|      0|                        tg_group = at2[neigh].endpoint;
 7730|      0|                    }
 7731|      0|                    else if (tg_group != at2[neigh].endpoint)
  ------------------
  |  Branch (7731:30): [True: 0, False: 0]
  ------------------
 7732|      0|                    {
 7733|      0|                        break; /* not a centerpoint */
 7734|      0|                    }
 7735|      0|                    num_endpoints++;
 7736|      0|                }
 7737|      0|            }
 7738|       |
 7739|      0|            if (j == at2[i].valence && num_endpoints > 1)
  ------------------
  |  Branch (7739:17): [True: 0, False: 0]
  |  Branch (7739:40): [True: 0, False: 0]
  ------------------
 7740|      0|            {
 7741|       |                /* found possible centerpoint */
 7742|      0|                pEdgePlus = pBNS->edge + ( pVA[i].nCPlusGroupEdge - 1 );
 7743|      0|                pEdgeMinus = ( pVA[i].nCMinusGroupEdge > 0 ) ? pBNS->edge + ( pVA[i].nCMinusGroupEdge - 1 ) : NULL;
  ------------------
  |  Branch (7743:30): [True: 0, False: 0]
  ------------------
 7744|      0|                if (pEdgePlus->flow + ( pEdgeMinus ? pEdgeMinus->flow : 0 ) != 1)
  ------------------
  |  Branch (7744:21): [True: 0, False: 0]
  |  Branch (7744:41): [True: 0, False: 0]
  ------------------
 7745|      0|                {
 7746|      0|                    continue;
 7747|      0|                }
 7748|      0|                v1p = pEdgePlus->neighbor1;
 7749|      0|                v2p = pEdgePlus->neighbor12 ^ v1p;
 7750|      0|                pv1p = pBNS->vert + v1p;
 7751|      0|                pv2p = pBNS->vert + v2p;
 7752|      0|                if (pEdgeMinus)
  ------------------
  |  Branch (7752:21): [True: 0, False: 0]
  ------------------
 7753|      0|                {
 7754|      0|                    v1m = pEdgeMinus->neighbor1;
 7755|      0|                    v2m = pEdgeMinus->neighbor12 ^ v1m;
 7756|      0|                    pv1m = pBNS->vert + v1m;
 7757|      0|                    pv2m = pBNS->vert + v2m;
 7758|      0|                }
 7759|      0|                else
 7760|      0|                {
 7761|      0|                    v1m = NO_VERTEX;
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
 7762|      0|                    v2m = NO_VERTEX;
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
 7763|      0|                    pv1m = NULL;
 7764|      0|                    pv2m = NULL;
 7765|      0|                }
 7766|      0|                ret = 0;
 7767|       |
 7768|       |                /* set new flow to run BNS Search */
 7769|      0|                if (delta = pEdgePlus->flow)
  ------------------
  |  Branch (7769:21): [True: 0, False: 0]
  ------------------
 7770|      0|                {
 7771|       |                    /* positive charge <=> flow=0 on (=) edge */
 7772|      0|                    pEdgePlus->flow -= delta;
 7773|      0|                    pv1p->st_edge.flow -= delta;
 7774|      0|                    pv2p->st_edge.flow -= delta;
 7775|      0|                    pBNS->tot_st_flow -= 2 * delta;
 7776|      0|                    pEdgePlus->forbidden |= forbidden_edge_mask;
 7777|      0|                    if (pEdgeMinus)
  ------------------
  |  Branch (7777:25): [True: 0, False: 0]
  ------------------
 7778|      0|                    {
 7779|      0|                        pEdgeMinus->forbidden |= forbidden_edge_mask;
 7780|      0|                    }
 7781|       |
 7782|      0|                    ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 7783|      0|                                          &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 7784|       |
 7785|      0|                    if (ret < 0)
  ------------------
  |  Branch (7785:25): [True: 0, False: 0]
  ------------------
 7786|      0|                    {
 7787|      0|                        goto exit_function;
 7788|      0|                    }
 7789|       |
 7790|      0|                    if (ret == 1 && ( vPathEnd == v1p && vPathStart == v2p ||
  ------------------
  |  Branch (7790:25): [True: 0, False: 0]
  |  Branch (7790:39): [True: 0, False: 0]
  |  Branch (7790:58): [True: 0, False: 0]
  ------------------
 7791|      0|                        vPathEnd == v2p && vPathStart == v1p ) &&
  ------------------
  |  Branch (7791:25): [True: 0, False: 0]
  |  Branch (7791:44): [True: 0, False: 0]
  ------------------
 7792|      0|                                      nDeltaCharge == -1 /* charge moving to this atom disappers*/)
  ------------------
  |  Branch (7792:39): [True: 0, False: 0]
  ------------------
 7793|      0|                    {
 7794|      0|                        ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 7795|      0|                        ( *pnNumRunBNS )++;
 7796|      0|                        if (ret < 0)
  ------------------
  |  Branch (7796:29): [True: 0, False: 0]
  ------------------
 7797|      0|                        {
 7798|      0|                            goto exit_function;
 7799|      0|                        }
 7800|      0|                        else if (ret == 1)
  ------------------
  |  Branch (7800:34): [True: 0, False: 0]
  ------------------
 7801|      0|                        {
 7802|      0|                            *pnTotalDelta += ret;
 7803|      0|                        }
 7804|      0|                        else
 7805|      0|                        {
 7806|      0|                            ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 7807|      0|                            goto exit_function;
 7808|      0|                        }
 7809|      0|                    }
 7810|      0|                    else
 7811|      0|                    {
 7812|      0|                        ret = 0;
 7813|      0|                        pEdgePlus->flow += delta;
 7814|      0|                        pv1p->st_edge.flow += delta;
 7815|      0|                        pv2p->st_edge.flow += delta;
 7816|      0|                        pBNS->tot_st_flow += 2 * delta;
 7817|      0|                    }
 7818|      0|                    pEdgePlus->forbidden &= inv_forbidden_edge_mask;
 7819|      0|                    if (pEdgeMinus)
  ------------------
  |  Branch (7819:25): [True: 0, False: 0]
  ------------------
 7820|      0|                    {
 7821|      0|                        pEdgeMinus->forbidden &= inv_forbidden_edge_mask;
 7822|      0|                    }
 7823|      0|                }
 7824|      0|                else
 7825|      0|                {
 7826|      0|                    if (pEdgeMinus && ( delta == pEdgeMinus->flow ) && pEdgePlus->flow == 0)
  ------------------
  |  Branch (7826:25): [True: 0, False: 0]
  |  Branch (7826:39): [True: 0, False: 0]
  |  Branch (7826:72): [True: 0, False: 0]
  ------------------
 7827|      0|                    {
 7828|       |                        /* positive charge <=> flow=0 on (=) edge and flow=0 on (-) edge */
 7829|      0|                        pEdgeMinus->flow -= delta;
 7830|      0|                        pv1m->st_edge.flow -= delta;
 7831|      0|                        pv2m->st_edge.flow -= delta;
 7832|      0|                        pBNS->tot_st_flow -= 2 * delta;
 7833|      0|                        pEdgePlus->forbidden |= forbidden_edge_mask;
 7834|      0|                        pEdgeMinus->forbidden |= forbidden_edge_mask;
 7835|      0|                        ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 7836|      0|                                              &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 7837|      0|                        if (ret < 0)
  ------------------
  |  Branch (7837:29): [True: 0, False: 0]
  ------------------
 7838|      0|                        {
 7839|      0|                            goto exit_function;
 7840|      0|                        }
 7841|      0|                        if (ret == 1 && ( vPathEnd == v1m && vPathStart == v2m ||
  ------------------
  |  Branch (7841:29): [True: 0, False: 0]
  |  Branch (7841:43): [True: 0, False: 0]
  |  Branch (7841:62): [True: 0, False: 0]
  ------------------
 7842|      0|                                          vPathEnd == v2m && vPathStart == v1m ) &&
  ------------------
  |  Branch (7842:43): [True: 0, False: 0]
  |  Branch (7842:62): [True: 0, False: 0]
  ------------------
 7843|      0|                                          nDeltaCharge == -1  /* charge moving to this atom disappers*/)
  ------------------
  |  Branch (7843:43): [True: 0, False: 0]
  ------------------
 7844|      0|                        {
 7845|      0|                            ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 7846|      0|                            ( *pnNumRunBNS )++;
 7847|      0|                            if (ret < 0)
  ------------------
  |  Branch (7847:33): [True: 0, False: 0]
  ------------------
 7848|      0|                            {
 7849|      0|                                goto exit_function;
 7850|      0|                            }
 7851|      0|                            else if (ret == 1)
  ------------------
  |  Branch (7851:38): [True: 0, False: 0]
  ------------------
 7852|      0|                            {
 7853|      0|                                *pnTotalDelta += ret;
 7854|      0|                            }
 7855|      0|                            else
 7856|      0|                            {
 7857|      0|                                ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 7858|      0|                                goto exit_function;
 7859|      0|                            }
 7860|      0|                        }
 7861|      0|                        else
 7862|      0|                        {
 7863|      0|                            ret = 0;
 7864|      0|                            pEdgeMinus->flow += delta;
 7865|      0|                            pv1m->st_edge.flow += delta;
 7866|      0|                            pv2m->st_edge.flow += delta;
 7867|      0|                            pBNS->tot_st_flow += 2 * delta;
 7868|      0|                        }
 7869|      0|                        pEdgePlus->forbidden &= inv_forbidden_edge_mask;
 7870|      0|                        pEdgeMinus->forbidden &= inv_forbidden_edge_mask;
 7871|      0|                    }
 7872|      0|                }
 7873|      0|                if (ret)
  ------------------
  |  Branch (7873:21): [True: 0, False: 0]
  ------------------
 7874|      0|                {
 7875|      0|                    num_success++;
 7876|      0|                    memcpy( at2, at, len_at * sizeof( at2[0] ) );
 7877|      0|                    pStruct->at = at2;
 7878|      0|                    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 7879|      0|                    pStruct->at = at;
 7880|      0|                    if (ret2 < 0)
  ------------------
  |  Branch (7880:25): [True: 0, False: 0]
  ------------------
 7881|      0|                    {
 7882|      0|                        ret = ret2;
 7883|      0|                        goto exit_function;
 7884|      0|                    }
 7885|      0|                }
 7886|      0|            }
 7887|      0|        }
 7888|  3.65k|    }
 7889|       |
 7890|       |
 7891|    801|    ret = num_success;
 7892|       |
 7893|    801|exit_function:
 7894|       |
 7895|    801|    return ret;
 7896|    801|}

bHas_N_V:
   86|      1|{
   87|      1|    int i, num_found = 0;
   88|      6|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (88:17): [True: 5, False: 1]
  ------------------
   89|      5|    {
   90|      5|        if (at2[i].el_number == EL_NUMBER_N &&
  ------------------
  |  |   44|     10|#define EL_NUMBER_N ((U_CHAR) 7)
  ------------------
  |  Branch (90:13): [True: 0, False: 5]
  ------------------
   91|      5|             !at2[i].charge &&
  ------------------
  |  Branch (91:14): [True: 0, False: 0]
  ------------------
   92|      5|             !at2[i].num_H &&
  ------------------
  |  Branch (92:14): [True: 0, False: 0]
  ------------------
   93|      5|             !at2[i].radical &&
  ------------------
  |  Branch (93:14): [True: 0, False: 0]
  ------------------
   94|      5|             at2[i].chem_bonds_valence == 5 &&
  ------------------
  |  Branch (94:14): [True: 0, False: 0]
  ------------------
   95|      5|             ( at2[i].valence == 3 ))
  ------------------
  |  Branch (95:14): [True: 0, False: 0]
  ------------------
   96|      0|        {
   97|      0|            num_found++;
   98|      0|        }
   99|      5|    }
  100|       |
  101|      1|    return num_found;
  102|      1|}
FixFixedHRestoredStructure:
  336|      2|{
  337|       |    /*--------- process extra or missing Fixed-H on non-tautomeric atoms ------*/
  338|       |    /* at2 should be the most recently restored atom, Fixed-H */
  339|      2|    int i, j, k, delta, num_try, tot_succes, cur_success, ret = 0, bAllowedNFlowerEdges = 0, num_zero_ret;
  340|      2|    CMP2FHINCHI c2i;
  341|      2|    CMP2FHINCHI *pc2i = &c2i;
  342|       |
  343|      2|    EDGE_LIST AllChargeEdges, CurrEdges, SFlowerEdges, NFlowerEdges, OtherNFlowerEdges, FixedLargeRingStereoEdges;
  344|      2|    EDGE_LIST AllBondEdges;
  345|       |
  346|      2|    EdgeIndex e;
  347|      2|    BNS_EDGE  *pe;
  348|      2|    Vertex v1, v2;
  349|      2|    BNS_VERTEX *pv1, *pv2;
  350|       |
  351|      2|    Vertex     vPathStart, vPathEnd;
  352|      2|    int        nPathLen, nDeltaH, nDeltaCharge, nNumVisitedAtoms;
  353|       |
  354|      2|    int        nNumRunBNS = 0, forbidden_edge_mask_inv = ~forbidden_edge_mask;
  355|       |
  356|       |    INCHI_HEAPCHK
  357|       |
  358|      2|        AllocEdgeList( &AllChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      2|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  359|      2|    AllocEdgeList( &CurrEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      2|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  360|      2|    AllocEdgeList( &NFlowerEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      2|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  361|      2|    AllocEdgeList( &SFlowerEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      2|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  362|      2|    AllocEdgeList( &OtherNFlowerEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      2|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  363|      2|    AllocEdgeList( &FixedLargeRingStereoEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      2|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  364|      2|    AllocEdgeList( &AllBondEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      2|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  365|       |
  366|      2|    tot_succes = 0;
  367|       |
  368|      2|    if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (368:9): [True: 2, False: 0]
  |  Branch (368:37): [True: 0, False: 2]
  ------------------
  369|      0|    {
  370|      0|        goto exit_function;  /* no fixed-H found */
  371|      0|    }
  372|       |
  373|     12|    for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (373:17): [True: 10, False: 2]
  ------------------
  374|     10|    {
  375|     10|        if (( e = pVA[i].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (375:13): [True: 7, False: 3]
  |  Branch (375:57): [True: 7, False: 0]
  ------------------
  376|     10|            ( ret = AddToEdgeList( &AllChargeEdges, e, INC_ADD_EDGE ) ))
  ------------------
  |  |   46|      7|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (376:13): [True: 0, False: 7]
  ------------------
  377|      0|        {
  378|      0|            goto exit_function;
  379|      0|        }
  380|     10|        if (( e = pVA[i].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (380:13): [True: 9, False: 1]
  |  Branch (380:56): [True: 9, False: 0]
  ------------------
  381|      9|        {
  382|      9|            if (ret = AddToEdgeList( &AllChargeEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      9|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (382:17): [True: 0, False: 9]
  ------------------
  383|      0|            {
  384|      0|                goto exit_function;
  385|      0|            }
  386|       |
  387|       |            /* in addition, disallow N(V) creation by forbidding charge flower edge that has flow=1 */
  388|      9|            if (pVA[i].cNumValenceElectrons == 5 && !pVA[i].cMetal && /* N, P, As */
  ------------------
  |  Branch (388:17): [True: 1, False: 8]
  |  Branch (388:53): [True: 1, False: 0]
  ------------------
  389|      9|                 NO_VERTEX != ( j = GetChargeFlowerUpperEdge( pBNS, pVA, e ) ))
  ------------------
  |  |  146|      1|#define NO_VERTEX    -2
  ------------------
  |  Branch (389:18): [True: 0, False: 1]
  ------------------
  390|      0|            {
  391|       |
  392|      0|                if (pBNS->edge[j].forbidden)
  ------------------
  |  Branch (392:21): [True: 0, False: 0]
  ------------------
  393|      0|                {
  394|      0|                    continue;
  395|      0|                }
  396|       |
  397|      0|                if (pBNS->edge[j].flow)
  ------------------
  |  Branch (397:21): [True: 0, False: 0]
  ------------------
  398|      0|                {
  399|      0|                    if (ret = AddToEdgeList( &AllChargeEdges, j, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (399:25): [True: 0, False: 0]
  ------------------
  400|      0|                    {
  401|      0|                        goto exit_function;
  402|      0|                    }
  403|      0|                    if (ret = AddToEdgeList( &NFlowerEdges, j, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (403:25): [True: 0, False: 0]
  ------------------
  404|      0|                    {
  405|      0|                        goto exit_function;
  406|      0|                    }
  407|      0|                }
  408|      0|                else
  409|      0|                {
  410|      0|                    if (ret = AddToEdgeList( &OtherNFlowerEdges, j, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (410:25): [True: 0, False: 0]
  ------------------
  411|      0|                    {
  412|      0|                        goto exit_function;
  413|      0|                    }
  414|      0|                }
  415|      0|            }
  416|      9|            else
  417|      9|            {
  418|       |                /* in addition, disallow N(V) creation by forbidding charge flower edge that has flow=1 */
  419|      9|                if (pVA[i].cNumValenceElectrons == 6 && !pVA[i].cMetal && /* N, P, As */
  ------------------
  |  Branch (419:21): [True: 6, False: 3]
  |  Branch (419:57): [True: 6, False: 0]
  ------------------
  420|      9|                     NO_VERTEX != ( j = GetChargeFlowerUpperEdge( pBNS, pVA, e ) ))
  ------------------
  |  |  146|      6|#define NO_VERTEX    -2
  ------------------
  |  Branch (420:22): [True: 2, False: 4]
  ------------------
  421|      2|                {
  422|       |
  423|      2|                    if (pBNS->edge[j].forbidden)
  ------------------
  |  Branch (423:25): [True: 0, False: 2]
  ------------------
  424|      0|                    {
  425|      0|                        continue;
  426|      0|                    }
  427|       |
  428|      2|                    if (pBNS->edge[j].flow)
  ------------------
  |  Branch (428:25): [True: 0, False: 2]
  ------------------
  429|      0|                    {
  430|      0|                        if (ret = AddToEdgeList( &SFlowerEdges, j, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (430:29): [True: 0, False: 0]
  ------------------
  431|      0|                        {
  432|      0|                            goto exit_function;
  433|      0|                        }
  434|      0|                    }
  435|      2|                }
  436|      9|            }
  437|      9|        }
  438|     26|        for (j = 0; j < at2[i].valence; j++)
  ------------------
  |  Branch (438:21): [True: 16, False: 10]
  ------------------
  439|     16|        {
  440|     16|            k = at2[i].neighbor[j];
  441|     16|            if (k < i && !pBNS->edge[e = pBNS->vert[i].iedge[j]].forbidden)
  ------------------
  |  Branch (441:17): [True: 8, False: 8]
  |  Branch (441:26): [True: 8, False: 0]
  ------------------
  442|      8|            {
  443|      8|                if (ret = AddToEdgeList( &AllBondEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      8|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (443:21): [True: 0, False: 8]
  ------------------
  444|      0|                {
  445|      0|                    goto exit_function;
  446|      0|                }
  447|      8|            }
  448|     16|        }
  449|     10|    }
  450|      2|    if (forbidden_stereo_edge_mask)
  ------------------
  |  Branch (450:9): [True: 2, False: 0]
  ------------------
  451|      2|    {
  452|     12|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (452:21): [True: 10, False: 2]
  ------------------
  453|     10|        {
  454|     26|            for (j = 0; j < at2[i].valence; j++)
  ------------------
  |  Branch (454:25): [True: 16, False: 10]
  ------------------
  455|     16|            {
  456|     16|                if (pBNS->edge[k = pBNS->vert[i].iedge[j]].forbidden == forbidden_stereo_edge_mask)
  ------------------
  |  Branch (456:21): [True: 0, False: 16]
  ------------------
  457|      0|                {
  458|      0|                    int nMinRingSize = is_bond_in_Nmax_memb_ring( at2, i, j, pStruct->pbfsq->q,
  459|      0|                                                                  pStruct->pbfsq->nAtomLevel,
  460|      0|                                                                  pStruct->pbfsq->cSource, 99 /* max ring size */ );
  461|      0|                    if (0 < nMinRingSize && ( ret = AddToEdgeList( &FixedLargeRingStereoEdges, k, INC_ADD_EDGE ) ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (461:25): [True: 0, False: 0]
  |  Branch (461:45): [True: 0, False: 0]
  ------------------
  462|      0|                    {
  463|      0|                        goto exit_function;
  464|      0|                    }
  465|      0|                }
  466|     16|            }
  467|     10|        }
  468|      2|    }
  469|       |
  470|      2|    INCHI_HEAPCHK
  471|      2|        if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (471:13): [True: 0, False: 2]
  ------------------
  472|      0|        {
  473|      0|            goto exit_function;
  474|      0|        }
  475|      2|    INCHI_HEAPCHK
  476|      2|        if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (476:13): [True: 0, False: 2]
  ------------------
  477|      0|        {
  478|      0|            goto exit_function;
  479|      0|        }
  480|       |
  481|       |    INCHI_HEAPCHK
  482|       |
  483|      2|        if (!pc2i->bHasDifference ||
  ------------------
  |  Branch (483:13): [True: 1, False: 1]
  ------------------
  484|      2|             !pc2i->len_c2at && pc2i->nNumTgRevrs == pc2i->nNumTgInChI &&
  ------------------
  |  Branch (484:14): [True: 0, False: 1]
  |  Branch (484:33): [True: 0, False: 0]
  ------------------
  485|      1|             pc2i->nNumEndpRevrs == pc2i->nNumRemHInChI &&
  ------------------
  |  Branch (485:14): [True: 0, False: 0]
  ------------------
  486|      1|             pc2i->nNumEndpRevrs == pc2i->nNumEndpInChI &&
  ------------------
  |  Branch (486:14): [True: 0, False: 0]
  ------------------
  487|      1|             !pc2i->nNumTgDiffMinus && !pc2i->nNumTgDiffH)
  ------------------
  |  Branch (487:14): [True: 0, False: 0]
  |  Branch (487:40): [True: 0, False: 0]
  ------------------
  488|      1|        {
  489|      1|            goto exit_function; /* nothing to do */
  490|      1|        }
  491|       |
  492|       |    /*goto exit_function;*/ /* debug only*/
  493|       |
  494|      1|    if (pc2i->len_c2at >= 2)
  ------------------
  |  Branch (494:9): [True: 1, False: 0]
  ------------------
  495|      1|    {
  496|       |        /*----------------------------------------------------*/
  497|       |        /* case 01: restored: O=AB-O(-)  original:  (-)O-AB=O */
  498|       |        /* FixH:              0    -1                 -1    0 */
  499|       |        /* MobH:              0     1                  1    0 */
  500|       |        /*                         non-taut      non-taut     */
  501|       |        /* O = O, S, Se; charged atoms O are not tautomeric   */
  502|       |        /* Solution: move (-) from B-O(-) to O=A              */
  503|       |        /*----------------------------------------------------*/
  504|      1|        int num_DB_O = 0, num_SB_O_Minus = 0, iat;
  505|      1|        short iat_DB_O[MAX_DIFF_FIXH], iat_SB_O_Minus[MAX_DIFF_FIXH];
  506|      1|        cur_success = 0;
  507|      3|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (507:21): [True: 2, False: 1]
  ------------------
  508|      2|        {
  509|      2|            iat = pc2i->c2at[i].atomNumber;
  510|      2|            if (pc2i->c2at[i].nValElectr == 6 /* && !pc2i->c2at[i].endptInChI -- mod#1*/ &&
  ------------------
  |  Branch (510:17): [True: 2, False: 0]
  ------------------
  511|      2|                ( e = pVA[iat].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (511:17): [True: 2, False: 0]
  |  Branch (511:63): [True: 2, False: 0]
  ------------------
  512|      2|            {
  513|      2|                if ( /* orig. InChI info: */
  514|      2|                     num_SB_O_Minus < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|      4|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (514:22): [True: 2, False: 0]
  ------------------
  515|      2|                     pc2i->c2at[i].nFixHInChI == 0 && pc2i->c2at[i].nMobHInChI == 0 &&
  ------------------
  |  Branch (515:22): [True: 2, False: 0]
  |  Branch (515:55): [True: 2, False: 0]
  ------------------
  516|       |                     /* reversed structure info: */
  517|      2|                     pc2i->c2at[i].nFixHRevrs == -1 && pc2i->c2at[i].nMobHRevrs == 1 &&
  ------------------
  |  Branch (517:22): [True: 0, False: 2]
  |  Branch (517:56): [True: 0, False: 0]
  ------------------
  518|      2|                     pc2i->c2at[i].nAtChargeRevrs == -1 && !at2[iat].num_H && /* at2 is Fixed-H */
  ------------------
  |  Branch (518:22): [True: 0, False: 0]
  |  Branch (518:60): [True: 0, False: 0]
  ------------------
  519|      2|                     at2[iat].valence == 1 && at2[iat].chem_bonds_valence == 1)
  ------------------
  |  Branch (519:22): [True: 0, False: 0]
  |  Branch (519:47): [True: 0, False: 0]
  ------------------
  520|      0|                {
  521|      0|                    iat_SB_O_Minus[num_SB_O_Minus++] = iat;
  522|      0|                    if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (522:25): [True: 0, False: 0]
  ------------------
  523|      0|                    {
  524|      0|                        goto exit_function;
  525|      0|                    }
  526|      0|                }
  527|      2|                else
  528|      2|                {
  529|      2|                    if ( /* orig. InChI info: */
  530|      2|                         num_DB_O < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|      4|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (530:26): [True: 2, False: 0]
  ------------------
  531|      2|                         pc2i->c2at[i].nFixHInChI == -1 && pc2i->c2at[i].nMobHInChI == 1 &&
  ------------------
  |  Branch (531:26): [True: 0, False: 2]
  |  Branch (531:60): [True: 0, False: 0]
  ------------------
  532|       |                         /* reversed structure info: */
  533|      2|                         pc2i->c2at[i].nFixHRevrs == 0 && pc2i->c2at[i].nMobHRevrs == 0 &&
  ------------------
  |  Branch (533:26): [True: 0, False: 0]
  |  Branch (533:59): [True: 0, False: 0]
  ------------------
  534|      2|                         pc2i->c2at[i].nAtChargeRevrs == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (534:26): [True: 0, False: 0]
  |  Branch (534:63): [True: 0, False: 0]
  ------------------
  535|      2|                         at2[iat].valence == 1 && at2[iat].chem_bonds_valence == 2)
  ------------------
  |  Branch (535:26): [True: 0, False: 0]
  |  Branch (535:51): [True: 0, False: 0]
  ------------------
  536|      0|                    {
  537|      0|                        iat_DB_O[num_DB_O++] = iat;
  538|      0|                        if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (538:29): [True: 0, False: 0]
  ------------------
  539|      0|                        {
  540|      0|                            goto exit_function;
  541|      0|                        }
  542|      0|                    }
  543|      2|                }
  544|      2|            }
  545|      2|        }
  546|      1|        if (num_try = inchi_min( num_SB_O_Minus, num_DB_O ))
  ------------------
  |  |  167|      1|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (546:13): [True: 0, False: 1]
  ------------------
  547|      0|        {
  548|       |            /* detected; attempt to fix */
  549|      0|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
  550|      0|            RemoveForbiddenEdgeMask( pBNS, &CurrEdges, forbidden_edge_mask );
  551|      0|            delta = 1;
  552|      0|            for (i = 0; i < num_SB_O_Minus && cur_success < num_try; i++)
  ------------------
  |  Branch (552:25): [True: 0, False: 0]
  |  Branch (552:47): [True: 0, False: 0]
  ------------------
  553|      0|            {
  554|      0|                iat = iat_SB_O_Minus[i];
  555|      0|                pe = pBNS->edge + pVA[iat].nCMinusGroupEdge - 1;
  556|      0|                if (!pe->flow)
  ------------------
  |  Branch (556:21): [True: 0, False: 0]
  ------------------
  557|      0|                    continue;
  558|      0|                pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
  559|      0|                pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
  560|       |
  561|      0|                pe->forbidden |= forbidden_edge_mask;
  562|      0|                pe->flow -= delta; /* remove (-) from AB-O(-) */
  563|      0|                pv1->st_edge.flow -= delta;
  564|      0|                pv2->st_edge.flow -= delta;
  565|      0|                pBNS->tot_st_flow -= 2 * delta;
  566|       |
  567|      0|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
  568|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
  569|       |
  570|      0|                if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (570:21): [True: 0, False: 0]
  |  Branch (570:35): [True: 0, False: 0]
  |  Branch (570:53): [True: 0, False: 0]
  ------------------
  571|      0|                                  vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == 1)
  ------------------
  |  Branch (571:35): [True: 0, False: 0]
  |  Branch (571:53): [True: 0, False: 0]
  |  Branch (571:75): [True: 0, False: 0]
  ------------------
  572|      0|                {
  573|       |                    /* Added (-)charge to O=AB => nDeltaCharge == -1 */
  574|       |                    /* Flow change on pe (-)charge edge (atom B-O(-)) is not known to RunBnsTestOnce()) */
  575|      0|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
  576|      0|                    if (ret > 0)
  ------------------
  |  Branch (576:25): [True: 0, False: 0]
  ------------------
  577|      0|                    {
  578|      0|                        nNumRunBNS++;
  579|      0|                        cur_success++; /* 01 */
  580|      0|                    }
  581|      0|                }
  582|      0|                else
  583|      0|                {
  584|      0|                    pe->forbidden &= forbidden_edge_mask_inv;
  585|      0|                    pe->flow += delta;
  586|      0|                    pv1->st_edge.flow += delta;
  587|      0|                    pv2->st_edge.flow += delta;
  588|      0|                    pBNS->tot_st_flow += 2 * delta;
  589|      0|                }
  590|      0|                INCHI_HEAPCHK
  591|      0|            }
  592|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
  593|      0|            CurrEdges.num_edges = 0; /* clear current edge list */
  594|      0|        }
  595|      1|        if (cur_success)
  ------------------
  |  Branch (595:13): [True: 0, False: 1]
  ------------------
  596|      0|        {
  597|      0|            tot_succes += cur_success;
  598|       |            /* recalculate InChI from the structure */
  599|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic,
  ------------------
  |  Branch (599:17): [True: 0, False: 0]
  ------------------
  600|      0|                                                            ip, sd, pBNS, pStruct,
  601|      0|                                                            at, at2, at3, pVA,
  602|      0|                                                            pTCGroups,
  603|      0|                                                            ppt_group_info, ppat_norm,
  604|      0|                                                            ppat_prep ) ))
  605|      0|            {
  606|      0|                goto exit_function;
  607|      0|            }
  608|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (608:17): [True: 0, False: 0]
  ------------------
  609|      0|            {
  610|      0|                goto exit_function;
  611|      0|            }
  612|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (612:17): [True: 0, False: 0]
  |  Branch (612:45): [True: 0, False: 0]
  ------------------
  613|      0|            {
  614|      0|                goto exit_function;  /* no fixed-H found */
  615|      0|            }
  616|      0|            if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (616:17): [True: 0, False: 0]
  ------------------
  617|      0|            {
  618|      0|                goto exit_function;
  619|      0|            }
  620|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (620:17): [True: 0, False: 0]
  ------------------
  621|      0|            {
  622|      0|                goto exit_function; /* nothing to do */
  623|      0|            }
  624|      0|        }
  625|      1|    }
  626|       |
  627|      1|    if (pc2i->len_c2at >= 1)
  ------------------
  |  Branch (627:9): [True: 1, False: 0]
  ------------------
  628|      1|    {
  629|       |        /*--------------------------------------------------------------*/
  630|       |        /* case 02: restored: -O(+)=AB-NH2  original:  -O-AB=NH2(+)     */
  631|       |        /* FixH:               0        0               0      1        */
  632|       |        /* MobH:               0        2               0      1        */
  633|       |        /* O = P, As, Sb, O, S, Se, F, Cl, Br, I; not taut. in InChI    */
  634|       |        /* N = N, O, S, Se, Te; has H; tautomeric or not tautomeric     */
  635|       |        /* Solution: move (+) from O(+) to NH2                          */
  636|       |        /*--------------------------------------------------------------*/
  637|      1|        int num_DB_O_Plus = 0, num_SB_NH = 0, iat;
  638|      1|        short iat_DB_O_Plus[MAX_DIFF_FIXH], iat_SB_NH[MAX_DIFF_FIXH];
  639|      1|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
  640|      1|        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H ? pInChI[1]->nNum_H :
  ------------------
  |  Branch (640:32): [True: 1, False: 0]
  |  Branch (640:45): [True: 1, False: 0]
  ------------------
  641|      1|            pInChI[0] && pInChI[0]->nNum_H ? pInChI[0]->nNum_H : NULL;
  ------------------
  |  Branch (641:13): [True: 0, False: 0]
  |  Branch (641:26): [True: 0, False: 0]
  ------------------
  642|      1|        cur_success = 0;
  643|      1|        num_zero_ret = 0;
  644|      3|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (644:21): [True: 2, False: 1]
  ------------------
  645|      2|        {
  646|      2|            iat = pc2i->c2at[i].atomNumber;
  647|      2|            if ( /* orig. InChI info: =NH2(+), =OH(+) */
  648|      2|                 num_SB_NH < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|      4|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (648:18): [True: 2, False: 0]
  ------------------
  649|      2|                 ( pc2i->c2at[i].nValElectr == 5 && pc2i->c2at[i].nPeriodNum == 1 ||
  ------------------
  |  Branch (649:20): [True: 0, False: 2]
  |  Branch (649:53): [True: 0, False: 0]
  ------------------
  650|      2|                   pc2i->c2at[i].nValElectr == 6 ) /* N, O, S, Se, Te */ &&
  ------------------
  |  Branch (650:20): [True: 2, False: 0]
  ------------------
  651|       |                 /*!pc2i->c2at[i].endptInChI &&*/ /* <=== relaxation */
  652|      2|                   ( e = pVA[iat].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (652:20): [True: 2, False: 0]
  |  Branch (652:65): [True: 2, False: 0]
  ------------------
  653|      2|                 pc2i->c2at[i].nFixHInChI>0 /*== 1 --modification#2*/ && /*pc2i->c2at[i].nMobHInChI ==  1 &&*/
  ------------------
  |  Branch (653:18): [True: 0, False: 2]
  ------------------
  654|       |                                                                         /* reversed structure info: */
  655|      2|                 pc2i->c2at[i].nFixHRevrs == 0 && /* pc2i->c2at[i].nMobHRevrs == 0 &&*/
  ------------------
  |  Branch (655:18): [True: 0, False: 0]
  ------------------
  656|      2|                 pc2i->c2at[i].nAtChargeRevrs == 0 && at2[iat].num_H &&
  ------------------
  |  Branch (656:18): [True: 0, False: 0]
  |  Branch (656:55): [True: 0, False: 0]
  ------------------
  657|      2|                 at2[iat].valence == at2[iat].chem_bonds_valence)
  ------------------
  |  Branch (657:18): [True: 0, False: 0]
  ------------------
  658|      0|            {
  659|      0|                iat_SB_NH[num_SB_NH++] = iat;
  660|      0|                if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (660:21): [True: 0, False: 0]
  ------------------
  661|      0|                {
  662|      0|                    goto exit_function;
  663|      0|                }
  664|      0|            }
  665|      2|        }
  666|      6|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (666:21): [True: 5, False: 1]
  ------------------
  667|      5|        {
  668|       |            /* i = canonical number - 1 */
  669|      5|            iat = nCanon2AtnoRevrs[i];
  670|      5|            if ( /* in restored atom: charge=+1, no H, has double bond, P, As, O, S, Se, Te, F, Cl, Br, I */
  671|      5|                 num_DB_O_Plus < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|     10|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (671:18): [True: 5, False: 0]
  ------------------
  672|      5|                 at2[iat].charge == 1 && !at2[iat].num_H &&
  ------------------
  |  Branch (672:18): [True: 0, False: 5]
  |  Branch (672:42): [True: 0, False: 0]
  ------------------
  673|      5|                 at2[iat].valence < at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (673:18): [True: 0, False: 0]
  |  Branch (673:68): [True: 0, False: 0]
  ------------------
  674|      5|                 ( pVA[iat].cNumValenceElectrons == 6 || pVA[iat].cNumValenceElectrons == 7 ||
  ------------------
  |  Branch (674:20): [True: 0, False: 0]
  |  Branch (674:58): [True: 0, False: 0]
  ------------------
  675|      0|                   pVA[iat].cNumValenceElectrons == 5 && pVA[iat].cPeriodicRowNumber > 1 ) &&
  ------------------
  |  Branch (675:20): [True: 0, False: 0]
  |  Branch (675:58): [True: 0, False: 0]
  ------------------
  676|       |                 /* in orig.InChI: not an endpoint, has no H */
  677|      5|                 !pStruct->endpoint[i] &&
  ------------------
  |  Branch (677:18): [True: 0, False: 0]
  ------------------
  678|      5|                 !( pStruct->fixed_H && pStruct->fixed_H[i] ) &&
  ------------------
  |  Branch (678:21): [True: 0, False: 0]
  |  Branch (678:41): [True: 0, False: 0]
  ------------------
  679|      5|                 !( nMobHInChI && nMobHInChI[i] ) &&
  ------------------
  |  Branch (679:21): [True: 0, False: 0]
  |  Branch (679:35): [True: 0, False: 0]
  ------------------
  680|       |                 /* has (+) edge */
  681|      5|                 ( e = pVA[iat].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (681:18): [True: 0, False: 0]
  |  Branch (681:63): [True: 0, False: 0]
  ------------------
  682|      0|            {
  683|      0|                iat_DB_O_Plus[num_DB_O_Plus++] = iat;
  684|      0|                if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (684:21): [True: 0, False: 0]
  ------------------
  685|      0|                {
  686|      0|                    goto exit_function;
  687|      0|                }
  688|      0|            }
  689|      5|        }
  690|      1|        if (num_try = inchi_min( num_DB_O_Plus, num_SB_NH ))
  ------------------
  |  |  167|      1|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (690:13): [True: 0, False: 1]
  ------------------
  691|      0|        {
  692|       |            /* detected; attempt to fix */
  693|      0|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
  694|      0|            RemoveForbiddenEdgeMask( pBNS, &CurrEdges, forbidden_edge_mask );
  695|      0|            delta = 1;
  696|      0|        repeat_02_allow_NV:
  697|      0|            for (i = 0; i < num_SB_NH && cur_success < num_try; i++)
  ------------------
  |  Branch (697:25): [True: 0, False: 0]
  |  Branch (697:42): [True: 0, False: 0]
  ------------------
  698|      0|            {
  699|      0|                iat = iat_SB_NH[i];
  700|      0|                pe = pBNS->edge + pVA[iat].nCPlusGroupEdge - 1;
  701|      0|                if (!pe->flow)
  ------------------
  |  Branch (701:21): [True: 0, False: 0]
  ------------------
  702|      0|                    continue;
  703|      0|                pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
  704|      0|                pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
  705|       |
  706|      0|                pe->forbidden |= forbidden_edge_mask;
  707|      0|                pe->flow -= delta;
  708|      0|                pv1->st_edge.flow -= delta;
  709|      0|                pv2->st_edge.flow -= delta;
  710|      0|                pBNS->tot_st_flow -= 2 * delta;
  711|       |
  712|      0|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
  713|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
  714|       |
  715|      0|                if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (715:21): [True: 0, False: 0]
  |  Branch (715:35): [True: 0, False: 0]
  |  Branch (715:53): [True: 0, False: 0]
  ------------------
  716|      0|                                  vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == -1)
  ------------------
  |  Branch (716:35): [True: 0, False: 0]
  |  Branch (716:53): [True: 0, False: 0]
  |  Branch (716:75): [True: 0, False: 0]
  ------------------
  717|      0|                {
  718|       |                    /* Removed charge from O(+) => nDeltaCharge == -1 */
  719|       |                    /* Flow change on pe (+)charge edge (atom NH2) is not known to RunBnsTestOnce()) */
  720|      0|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
  721|      0|                    if (ret > 0)
  ------------------
  |  Branch (721:25): [True: 0, False: 0]
  ------------------
  722|      0|                    {
  723|      0|                        nNumRunBNS++;
  724|      0|                        cur_success++; /* 02 */
  725|      0|                    }
  726|      0|                }
  727|      0|                else
  728|      0|                {
  729|      0|                    num_zero_ret += !ret;
  730|      0|                    pe->forbidden &= forbidden_edge_mask_inv;
  731|      0|                    pe->flow += delta;
  732|      0|                    pv1->st_edge.flow += delta;
  733|      0|                    pv2->st_edge.flow += delta;
  734|      0|                    pBNS->tot_st_flow += 2 * delta;
  735|      0|                }
  736|      0|                INCHI_HEAPCHK
  737|      0|            }
  738|      0|            if (num_zero_ret == num_try && !bAllowedNFlowerEdges && NFlowerEdges.num_edges)
  ------------------
  |  Branch (738:17): [True: 0, False: 0]
  |  Branch (738:44): [True: 0, False: 0]
  |  Branch (738:69): [True: 0, False: 0]
  ------------------
  739|      0|            {
  740|      0|                RemoveForbiddenEdgeMask( pBNS, &NFlowerEdges, forbidden_edge_mask );
  741|      0|                bAllowedNFlowerEdges = 1;
  742|      0|                goto repeat_02_allow_NV;
  743|      0|            }
  744|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
  745|      0|            bAllowedNFlowerEdges = 0;
  746|      0|        }
  747|      1|        CurrEdges.num_edges = 0; /* clear current edge list */
  748|      1|        if (cur_success)
  ------------------
  |  Branch (748:13): [True: 0, False: 1]
  ------------------
  749|      0|        {
  750|      0|            tot_succes += cur_success;
  751|       |            /* recalculate InChI from the structure */
  752|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (752:17): [True: 0, False: 0]
  ------------------
  753|      0|                                                            ppt_group_info, ppat_norm, ppat_prep ) ))
  754|      0|            {
  755|      0|                goto exit_function;
  756|      0|            }
  757|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (757:17): [True: 0, False: 0]
  ------------------
  758|      0|            {
  759|      0|                goto exit_function;
  760|      0|            }
  761|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (761:17): [True: 0, False: 0]
  |  Branch (761:45): [True: 0, False: 0]
  ------------------
  762|      0|            {
  763|      0|                goto exit_function;  /* no fixed-H found */
  764|      0|            }
  765|      0|            if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (765:17): [True: 0, False: 0]
  ------------------
  766|      0|            {
  767|      0|                goto exit_function;
  768|      0|            }
  769|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (769:17): [True: 0, False: 0]
  ------------------
  770|      0|            {
  771|      0|                goto exit_function; /* nothing to do */
  772|      0|            }
  773|      0|        }
  774|      1|    }
  775|       |
  776|      1|    if (pc2i->len_c2at >= 1 && pc2i->nNumTgRevrs == 1 &&
  ------------------
  |  Branch (776:9): [True: 1, False: 0]
  |  Branch (776:32): [True: 1, False: 0]
  ------------------
  777|      1|        ( pc2i->nNumEndpRevrs > pc2i->nNumEndpInChI || pc2i->nNumTgInChI > 1 ) /* ADP in Revrs */)
  ------------------
  |  Branch (777:11): [True: 1, False: 0]
  |  Branch (777:56): [True: 0, False: 0]
  ------------------
  778|      1|    {
  779|       |        /*--------------------------------------------------------------*/
  780|       |        /* case 03: restored: -N(-)-AB=O    original:  -N=AB-O(-)       */
  781|       |        /* FixH:               0       0                0     -1        */
  782|       |        /* MobH:               0       0                0      1        */
  783|       |        /* O = O, S, Se; N = N;                                         */
  784|       |        /* restored atoms are tautomeric; original atoms are not taut.  */
  785|       |        /* restored struct has 1 t-group; original has less endpoints   */
  786|       |        /*                                and possibly >1 t-groups      */
  787|       |        /* Solution: move (-) from N(-) to =O                           */
  788|       |        /*           these atoms are tautomeric in restored structure   */
  789|       |        /*--------------------------------------------------------------*/
  790|      1|        int num_SB_N_Minus = 0, num_DB_O = 0, iat;
  791|      1|        short iat_SB_N_Minus[MAX_DIFF_FIXH], iat_DB_O[MAX_DIFF_FIXH];
  792|      1|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
  793|      1|        inp_ATOM *at_Mobile_H_Revrs = ( pStruct->pOne_norm_data[1] &&
  ------------------
  |  Branch (793:41): [True: 1, False: 0]
  ------------------
  794|      1|                                        pStruct->pOne_norm_data[1]->at ) ? pStruct->pOne_norm_data[1]->at : NULL;
  ------------------
  |  Branch (794:41): [True: 1, False: 0]
  ------------------
  795|       |        /*
  796|       |        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H? pInChI[1]->nNum_H :
  797|       |        pInChI[0] && pInChI[0]->nNum_H? pInChI[0]->nNum_H : 0;
  798|       |        */
  799|      1|        cur_success = 0;
  800|      3|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (800:21): [True: 2, False: 1]
  ------------------
  801|      2|        {
  802|      2|            iat = pc2i->c2at[i].atomNumber;
  803|      2|            if ( /* orig. InChI info: -O(-) */
  804|      2|                 num_DB_O < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|      4|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (804:18): [True: 2, False: 0]
  ------------------
  805|      2|                 pc2i->c2at[i].nValElectr == 6 /* O, S, Se, Te */ &&
  ------------------
  |  Branch (805:18): [True: 2, False: 0]
  ------------------
  806|      2|                 !pc2i->c2at[i].endptInChI &&
  ------------------
  |  Branch (806:18): [True: 2, False: 0]
  ------------------
  807|      2|                 ( e = pVA[iat].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (807:18): [True: 2, False: 0]
  |  Branch (807:64): [True: 2, False: 0]
  ------------------
  808|      2|                 pc2i->c2at[i].nFixHInChI == -1 && pc2i->c2at[i].nMobHInChI == 1 &&
  ------------------
  |  Branch (808:18): [True: 0, False: 2]
  |  Branch (808:52): [True: 0, False: 0]
  ------------------
  809|       |                 /* reversed structure info: */
  810|      2|                 pc2i->c2at[i].endptRevrs &&
  ------------------
  |  Branch (810:18): [True: 0, False: 0]
  ------------------
  811|      2|                 pc2i->c2at[i].nFixHRevrs == 0 && pc2i->c2at[i].nMobHRevrs == 0 &&
  ------------------
  |  Branch (811:18): [True: 0, False: 0]
  |  Branch (811:51): [True: 0, False: 0]
  ------------------
  812|      2|                 pc2i->c2at[i].nAtChargeRevrs == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (812:18): [True: 0, False: 0]
  |  Branch (812:55): [True: 0, False: 0]
  ------------------
  813|      2|                 at2[iat].valence == 1 && at2[iat].chem_bonds_valence == 2)
  ------------------
  |  Branch (813:18): [True: 0, False: 0]
  |  Branch (813:43): [True: 0, False: 0]
  ------------------
  814|      0|            {
  815|      0|                iat_DB_O[num_DB_O++] = iat;
  816|      0|                if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (816:21): [True: 0, False: 0]
  ------------------
  817|      0|                {
  818|      0|                    goto exit_function;
  819|      0|                }
  820|      0|            }
  821|      2|        }
  822|      6|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (822:21): [True: 5, False: 1]
  ------------------
  823|      5|        {
  824|       |            /* i = canonical number - 1 */
  825|      5|            iat = nCanon2AtnoRevrs[i];
  826|      5|            if ( /* in restored atom N: charge=-1, no H, has no double bond, endpoint */
  827|      5|                 num_SB_N_Minus < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|     10|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (827:18): [True: 5, False: 0]
  ------------------
  828|      5|                 at2[iat].charge == -1 && /*!at2[iat].num_H &&*/
  ------------------
  |  Branch (828:18): [True: 3, False: 2]
  ------------------
  829|      5|                 at2[iat].valence == at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (829:18): [True: 2, False: 1]
  |  Branch (829:69): [True: 2, False: 0]
  ------------------
  830|      5|                 pVA[iat].cNumValenceElectrons == 5 && pVA[iat].cPeriodicRowNumber == 1 &&
  ------------------
  |  Branch (830:18): [True: 0, False: 2]
  |  Branch (830:56): [True: 0, False: 0]
  ------------------
  831|      5|                 at_Mobile_H_Revrs && at_Mobile_H_Revrs[iat].endpoint &&
  ------------------
  |  Branch (831:18): [True: 0, False: 0]
  |  Branch (831:39): [True: 0, False: 0]
  ------------------
  832|       |                 /* in orig.InChI: not an endpoint, has no H */
  833|       |                 /* !pStruct->endpoint[i] && */
  834|       |                 /*
  835|       |                 !(pStruct->fixed_H && pStruct->fixed_H[i]) &&
  836|       |                 !(nMobHInChI && nMobHInChI[i] ) &&
  837|       |                 */
  838|       |                 /* has (-) edge */
  839|      5|                 ( e = pVA[iat].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (839:18): [True: 0, False: 0]
  |  Branch (839:64): [True: 0, False: 0]
  ------------------
  840|      0|            {
  841|      0|                iat_SB_N_Minus[num_SB_N_Minus++] = iat;
  842|      0|                if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (842:21): [True: 0, False: 0]
  ------------------
  843|      0|                {
  844|      0|                    goto exit_function;
  845|      0|                }
  846|      0|            }
  847|      5|        }
  848|      1|        if (num_try = inchi_min( num_SB_N_Minus, num_DB_O ))
  ------------------
  |  |  167|      1|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (848:13): [True: 0, False: 1]
  ------------------
  849|      0|        {
  850|       |            /* detected; attempt to fix */
  851|      0|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
  852|      0|            RemoveForbiddenEdgeMask( pBNS, &CurrEdges, forbidden_edge_mask );
  853|      0|            delta = 1;
  854|      0|            for (i = 0; i < num_SB_N_Minus && cur_success < num_try; i++)
  ------------------
  |  Branch (854:25): [True: 0, False: 0]
  |  Branch (854:47): [True: 0, False: 0]
  ------------------
  855|      0|            {
  856|      0|                iat = iat_SB_N_Minus[i];
  857|      0|                pe = pBNS->edge + pVA[iat].nCMinusGroupEdge - 1; /* 2006-03-03: changed from CPlusGroupEdge */
  858|      0|                if (!pe->flow)
  ------------------
  |  Branch (858:21): [True: 0, False: 0]
  ------------------
  859|      0|                    continue;
  860|      0|                pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
  861|      0|                pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
  862|       |
  863|      0|                pe->forbidden |= forbidden_edge_mask;
  864|      0|                pe->flow -= delta;
  865|      0|                pv1->st_edge.flow -= delta;
  866|      0|                pv2->st_edge.flow -= delta;
  867|      0|                pBNS->tot_st_flow -= 2 * delta;
  868|       |
  869|      0|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
  870|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
  871|       |
  872|      0|                if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (872:21): [True: 0, False: 0]
  |  Branch (872:35): [True: 0, False: 0]
  |  Branch (872:53): [True: 0, False: 0]
  ------------------
  873|      0|                                  vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == 1)
  ------------------
  |  Branch (873:35): [True: 0, False: 0]
  |  Branch (873:53): [True: 0, False: 0]
  |  Branch (873:75): [True: 0, False: 0]
  ------------------
  874|      0|                {
  875|       |                    /* Added (-) charge to =O => nDeltaCharge == 1 */
  876|       |                    /* Flow change on pe (-)charge edge (atom -N(-)-) is not known to RunBnsTestOnce()) */
  877|      0|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
  878|      0|                    if (ret > 0)
  ------------------
  |  Branch (878:25): [True: 0, False: 0]
  ------------------
  879|      0|                    {
  880|      0|                        nNumRunBNS++;
  881|      0|                        cur_success++; /* 03 */
  882|      0|                    }
  883|      0|                }
  884|      0|                else
  885|      0|                {
  886|      0|                    pe->forbidden &= forbidden_edge_mask_inv;
  887|      0|                    pe->flow += delta;
  888|      0|                    pv1->st_edge.flow += delta;
  889|      0|                    pv2->st_edge.flow += delta;
  890|      0|                    pBNS->tot_st_flow += 2 * delta;
  891|      0|                }
  892|      0|                INCHI_HEAPCHK
  893|      0|            }
  894|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
  895|      0|        }
  896|      1|        CurrEdges.num_edges = 0; /* clear current edge list */
  897|      1|        if (cur_success)
  ------------------
  |  Branch (897:13): [True: 0, False: 1]
  ------------------
  898|      0|        {
  899|      0|            tot_succes += cur_success;
  900|       |            /* recalculate InChI from the structure */
  901|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (901:17): [True: 0, False: 0]
  ------------------
  902|      0|                                                            ppt_group_info, ppat_norm, ppat_prep ) ))
  903|      0|            {
  904|      0|                goto exit_function;
  905|      0|            }
  906|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (906:17): [True: 0, False: 0]
  ------------------
  907|      0|            {
  908|      0|                goto exit_function;
  909|      0|            }
  910|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (910:17): [True: 0, False: 0]
  |  Branch (910:45): [True: 0, False: 0]
  ------------------
  911|      0|            {
  912|      0|                goto exit_function;  /* no fixed-H found */
  913|      0|            }
  914|      0|            if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (914:17): [True: 0, False: 0]
  ------------------
  915|      0|            {
  916|      0|                goto exit_function;
  917|      0|            }
  918|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (918:17): [True: 0, False: 0]
  ------------------
  919|      0|            {
  920|      0|                goto exit_function; /* nothing to do */
  921|      0|            }
  922|      0|        }
  923|      1|    }
  924|       |
  925|      1|    if (pc2i->nNumTgRevrs == 1 && /* pc2i->nNumRemHInChI < 0 &&*/
  ------------------
  |  Branch (925:9): [True: 1, False: 0]
  ------------------
  926|      1|        ( pc2i->nNumEndpRevrs > pc2i->nNumEndpInChI || pc2i->nNumTgInChI > 1 ) /* ADP in Revrs */)
  ------------------
  |  Branch (926:11): [True: 1, False: 0]
  |  Branch (926:56): [True: 0, False: 0]
  ------------------
  927|      1|    {
  928|       |        /*--------------------------------------------------------------*/
  929|       |        /* case 03a:restored: -N(-)-AB=O    original:  -N=AB-O(-)       */
  930|       |        /* FixH:               0       0                0      0        */
  931|       |        /* MobH:               0       0                0      0        */
  932|       |        /* O = O, S, Se; N = N;                              taut       */
  933|       |        /* restored atoms are tautomeric; original atom is; N may be.   */
  934|       |        /* restored struct has 1 t-group; original has less endpoints   */
  935|       |        /*                                and possibly >1 t-groups      */
  936|       |        /* Solution: move (-) from N(-) to =O                           */
  937|       |        /*           these atoms are tautomeric in restored structure   */
  938|       |        /*--------------------------------------------------------------*/
  939|      1|        int num_SB_N_Minus = 0, num_DB_O = 0, iat;
  940|      1|        short iat_SB_N_Minus[MAX_DIFF_FIXH], iat_DB_O[MAX_DIFF_FIXH];
  941|      1|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
  942|      1|        inp_ATOM *at_Mobile_H_Revrs = ( pStruct->pOne_norm_data[1] &&
  ------------------
  |  Branch (942:41): [True: 1, False: 0]
  ------------------
  943|      1|                                        pStruct->pOne_norm_data[1]->at ) ? pStruct->pOne_norm_data[1]->at : NULL;
  ------------------
  |  Branch (943:41): [True: 1, False: 0]
  ------------------
  944|      1|        S_CHAR   *pnMobHInChI = ( pInChI[1] && pInChI[1]->nNum_H ) ? pInChI[1]->nNum_H :
  ------------------
  |  Branch (944:35): [True: 1, False: 0]
  |  Branch (944:48): [True: 1, False: 0]
  ------------------
  945|      1|            ( pInChI[0] && pInChI[0]->nNum_H ) ? pInChI[0]->nNum_H : NULL;
  ------------------
  |  Branch (945:15): [True: 0, False: 0]
  |  Branch (945:28): [True: 0, False: 0]
  ------------------
  946|      1|        S_CHAR   *pnFixHInChI = pStruct->fixed_H;
  947|       |
  948|      1|        cur_success = 0;
  949|      1|        CurrEdges.num_edges = 0;
  950|      6|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (950:21): [True: 5, False: 1]
  ------------------
  951|      5|        { /* i = canonical number - 1 */
  952|      5|            iat = nCanon2AtnoRevrs[i];
  953|      5|            if ( /* in restored atom N: charge=-1, no H, has no double bond, endpoint */
  954|      5|                 num_SB_N_Minus < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|     10|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (954:18): [True: 5, False: 0]
  ------------------
  955|      5|                 at2[iat].charge == -1 && /*!at2[iat].num_H &&*/
  ------------------
  |  Branch (955:18): [True: 3, False: 2]
  ------------------
  956|      5|                 at2[iat].valence == at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (956:18): [True: 2, False: 1]
  |  Branch (956:69): [True: 2, False: 0]
  ------------------
  957|      5|                 pVA[iat].cNumValenceElectrons == 5 && pVA[iat].cPeriodicRowNumber == 1 &&
  ------------------
  |  Branch (957:18): [True: 0, False: 2]
  |  Branch (957:56): [True: 0, False: 0]
  ------------------
  958|      5|                 at_Mobile_H_Revrs && at_Mobile_H_Revrs[iat].endpoint &&
  ------------------
  |  Branch (958:18): [True: 0, False: 0]
  |  Branch (958:39): [True: 0, False: 0]
  ------------------
  959|       |                 /* in orig.InChI: may be an endpoint, has no H */
  960|       |                 /* has (-) edge */
  961|      5|                 ( e = pVA[iat].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (961:18): [True: 0, False: 0]
  |  Branch (961:64): [True: 0, False: 0]
  ------------------
  962|      0|            {
  963|      0|                iat_SB_N_Minus[num_SB_N_Minus++] = iat;
  964|      0|            }
  965|      5|            else
  966|      5|                if (num_DB_O < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|     10|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (966:21): [True: 5, False: 0]
  ------------------
  967|      5|                     at2[iat].charge == 0 && /*!at2[iat].num_H &&*/
  ------------------
  |  Branch (967:22): [True: 1, False: 4]
  ------------------
  968|      5|                     at2[iat].valence + 1 == at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (968:22): [True: 0, False: 1]
  |  Branch (968:77): [True: 0, False: 0]
  ------------------
  969|      5|                     pVA[iat].cNumValenceElectrons == 6 &&
  ------------------
  |  Branch (969:22): [True: 0, False: 0]
  ------------------
  970|      5|                     at_Mobile_H_Revrs && at_Mobile_H_Revrs[iat].endpoint && /* endpoint in Reconstructed */
  ------------------
  |  Branch (970:22): [True: 0, False: 0]
  |  Branch (970:43): [True: 0, False: 0]
  ------------------
  971|      5|                     ( pStruct->endpoint[i] || /* endpoint or H(+) acceptor in original */
  ------------------
  |  Branch (971:24): [True: 0, False: 0]
  ------------------
  972|      0|                       pnMobHInChI && pnMobHInChI[i] == 1 && pnFixHInChI && pnFixHInChI[i] == -1 ) &&
  ------------------
  |  Branch (972:24): [True: 0, False: 0]
  |  Branch (972:39): [True: 0, False: 0]
  |  Branch (972:62): [True: 0, False: 0]
  |  Branch (972:77): [True: 0, False: 0]
  ------------------
  973|       |                     /* has (-) edge */
  974|      5|                       ( e = pVA[iat].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (974:24): [True: 0, False: 0]
  |  Branch (974:70): [True: 0, False: 0]
  ------------------
  975|      0|                {
  976|      0|                    iat_DB_O[num_DB_O++] = iat;
  977|      0|                    if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (977:25): [True: 0, False: 0]
  ------------------
  978|      0|                    {
  979|      0|                        goto exit_function;
  980|      0|                    }
  981|      0|                }
  982|      5|        }
  983|      1|        if (num_try = inchi_min( num_SB_N_Minus, num_DB_O ))
  ------------------
  |  |  167|      1|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (983:13): [True: 0, False: 1]
  ------------------
  984|      0|        {
  985|       |            /* detected; attempt to fix */
  986|      0|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
  987|       |            /* allow charge transfer to all found =O */
  988|      0|            RemoveForbiddenEdgeMask( pBNS, &CurrEdges, forbidden_edge_mask );
  989|      0|            delta = 1;
  990|      0|            for (i = 0; i < num_SB_N_Minus && cur_success < num_try; i++)
  ------------------
  |  Branch (990:25): [True: 0, False: 0]
  |  Branch (990:47): [True: 0, False: 0]
  ------------------
  991|      0|            {
  992|      0|                iat = iat_SB_N_Minus[i];
  993|      0|                pe = pBNS->edge + pVA[iat].nCMinusGroupEdge - 1;
  994|      0|                if (!pe->flow)
  ------------------
  |  Branch (994:21): [True: 0, False: 0]
  ------------------
  995|      0|                    continue;
  996|      0|                pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
  997|      0|                pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
  998|       |
  999|      0|                pe->forbidden |= forbidden_edge_mask;
 1000|      0|                pe->flow -= delta;
 1001|      0|                pv1->st_edge.flow -= delta;
 1002|      0|                pv2->st_edge.flow -= delta;
 1003|      0|                pBNS->tot_st_flow -= 2 * delta;
 1004|       |
 1005|      0|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 1006|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 1007|       |
 1008|      0|                if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (1008:21): [True: 0, False: 0]
  |  Branch (1008:35): [True: 0, False: 0]
  |  Branch (1008:53): [True: 0, False: 0]
  ------------------
 1009|      0|                                  vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == 1)
  ------------------
  |  Branch (1009:35): [True: 0, False: 0]
  |  Branch (1009:53): [True: 0, False: 0]
  |  Branch (1009:75): [True: 0, False: 0]
  ------------------
 1010|      0|                {
 1011|       |                    /* Added (-) charge to =O => nDeltaCharge == 1 */
 1012|       |                    /* Flow change on pe (-)charge edge (atom -N(-)-) is not known to RunBnsTestOnce()) */
 1013|      0|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 1014|      0|                    if (ret > 0)
  ------------------
  |  Branch (1014:25): [True: 0, False: 0]
  ------------------
 1015|      0|                    {
 1016|      0|                        nNumRunBNS++;
 1017|      0|                        cur_success++; /* 03a */
 1018|      0|                    }
 1019|      0|                }
 1020|      0|                else
 1021|      0|                {
 1022|      0|                    pe->forbidden &= forbidden_edge_mask_inv;
 1023|      0|                    pe->flow += delta;
 1024|      0|                    pv1->st_edge.flow += delta;
 1025|      0|                    pv2->st_edge.flow += delta;
 1026|      0|                    pBNS->tot_st_flow += 2 * delta;
 1027|      0|                }
 1028|      0|                INCHI_HEAPCHK
 1029|      0|            }
 1030|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 1031|      0|        }
 1032|      1|        CurrEdges.num_edges = 0; /* clear current edge list */
 1033|      1|        if (cur_success)
  ------------------
  |  Branch (1033:13): [True: 0, False: 1]
  ------------------
 1034|      0|        {
 1035|      0|            tot_succes += cur_success;
 1036|       |            /* recalculate InChI from the structure */
 1037|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (1037:17): [True: 0, False: 0]
  ------------------
 1038|      0|                                                            ppt_group_info, ppat_norm, ppat_prep ) ))
 1039|      0|            {
 1040|      0|                goto exit_function;
 1041|      0|            }
 1042|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (1042:17): [True: 0, False: 0]
  ------------------
 1043|      0|            {
 1044|      0|                goto exit_function;
 1045|      0|            }
 1046|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (1046:17): [True: 0, False: 0]
  |  Branch (1046:45): [True: 0, False: 0]
  ------------------
 1047|      0|            {
 1048|      0|                goto exit_function;  /* no fixed-H found */
 1049|      0|            }
 1050|      0|            if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (1050:17): [True: 0, False: 0]
  ------------------
 1051|      0|            {
 1052|      0|                goto exit_function;
 1053|      0|            }
 1054|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (1054:17): [True: 0, False: 0]
  ------------------
 1055|      0|            {
 1056|      0|                goto exit_function; /* nothing to do */
 1057|      0|            }
 1058|      0|        }
 1059|      1|    }
 1060|       |
 1061|      1|    if (pc2i->len_c2at >= 1 && pc2i->nNumTgInChI == 1 && /* ADP in InChI */
  ------------------
  |  Branch (1061:9): [True: 1, False: 0]
  |  Branch (1061:32): [True: 0, False: 1]
  ------------------
 1062|      1|        ( pc2i->nNumEndpRevrs < pc2i->nNumEndpInChI || pc2i->nNumTgRevrs > 1 ))
  ------------------
  |  Branch (1062:11): [True: 0, False: 0]
  |  Branch (1062:56): [True: 0, False: 0]
  ------------------
 1063|      0|    {
 1064|       |        /*--------------------------------------------------------------*/
 1065|       |        /* case 04: restored: OH(+)=AB-O- OH- orig.  HO-AB=O(+)- OH-    */
 1066|       |        /* FixH:               1       0   0          1      0   1      */
 1067|       |        /* MobH:               0       0   1          0      0   0      */
 1068|       |        /*                 non-taut.                taut        taut    */
 1069|       |        /*                                    ADP: one t-group or more endpoints */
 1070|       |        /* O(+) = N, P, As, As, O, S, Se; OH = N, O, S, Se, Te          */
 1071|       |        /* Solution: move (+) from O(+) to NH2                          */
 1072|       |        /*--------------------------------------------------------------*/
 1073|      0|        int num_SB_Neutr = 0, num_DB_Charged = 0, iat;
 1074|      0|        short iat_SB_Neutr[MAX_DIFF_FIXH], iat_DB_Charged[MAX_DIFF_FIXH];
 1075|      0|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 1076|      0|        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H ? pInChI[1]->nNum_H :
  ------------------
  |  Branch (1076:32): [True: 0, False: 0]
  |  Branch (1076:45): [True: 0, False: 0]
  ------------------
 1077|      0|            pInChI[0] && pInChI[0]->nNum_H ? pInChI[0]->nNum_H : 0;
  ------------------
  |  Branch (1077:13): [True: 0, False: 0]
  |  Branch (1077:26): [True: 0, False: 0]
  ------------------
 1078|      0|        cur_success = 0;
 1079|      0|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (1079:21): [True: 0, False: 0]
  ------------------
 1080|      0|        { /* i = canonical number - 1 */
 1081|      0|            iat = nCanon2AtnoRevrs[i];
 1082|      0|            if ( /* in restored atom: charge=+1, has H, has double bond, N, O, S, Se, Te */
 1083|      0|                 num_DB_Charged < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|      0|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (1083:18): [True: 0, False: 0]
  ------------------
 1084|      0|                 at2[iat].charge == 1 && at2[iat].num_H &&
  ------------------
  |  Branch (1084:18): [True: 0, False: 0]
  |  Branch (1084:42): [True: 0, False: 0]
  ------------------
 1085|      0|                 at2[iat].valence < at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (1085:18): [True: 0, False: 0]
  |  Branch (1085:68): [True: 0, False: 0]
  ------------------
 1086|      0|                 ( pVA[iat].cNumValenceElectrons == 6 ||
  ------------------
  |  Branch (1086:20): [True: 0, False: 0]
  ------------------
 1087|      0|                   pVA[iat].cNumValenceElectrons == 5 && pVA[iat].cPeriodicRowNumber == 1 ) &&
  ------------------
  |  Branch (1087:20): [True: 0, False: 0]
  |  Branch (1087:58): [True: 0, False: 0]
  ------------------
 1088|       |                 /* in orig.InChI: an endpoint, has fixed-H */
 1089|      0|                 pStruct->endpoint[i] &&
  ------------------
  |  Branch (1089:18): [True: 0, False: 0]
  ------------------
 1090|      0|                 ( pStruct->fixed_H && pStruct->fixed_H[i] ) &&
  ------------------
  |  Branch (1090:20): [True: 0, False: 0]
  |  Branch (1090:40): [True: 0, False: 0]
  ------------------
 1091|       |                 /*!(nMobHInChI && nMobHInChI[i] ) &&*/
 1092|       |                 /* has (+) edge */
 1093|      0|                 ( e = pVA[iat].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (1093:18): [True: 0, False: 0]
  |  Branch (1093:63): [True: 0, False: 0]
  ------------------
 1094|      0|            {
 1095|       |
 1096|      0|                iat_DB_Charged[num_DB_Charged++] = iat;
 1097|       |
 1098|      0|                if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1098:21): [True: 0, False: 0]
  ------------------
 1099|      0|                {
 1100|      0|                    goto exit_function;
 1101|      0|                }
 1102|      0|            }
 1103|      0|            else
 1104|      0|            {
 1105|      0|                if ( /* in restored atom: charge=0, has no H, has no double bond, N, P, O, S, Se, Te */
 1106|      0|                     num_SB_Neutr < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|      0|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (1106:22): [True: 0, False: 0]
  ------------------
 1107|      0|                     at2[iat].charge == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (1107:22): [True: 0, False: 0]
  |  Branch (1107:46): [True: 0, False: 0]
  ------------------
 1108|      0|                     at2[iat].valence == at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (1108:22): [True: 0, False: 0]
  |  Branch (1108:73): [True: 0, False: 0]
  ------------------
 1109|      0|                     ( pVA[iat].cNumValenceElectrons == 6 ||
  ------------------
  |  Branch (1109:24): [True: 0, False: 0]
  ------------------
 1110|      0|                       pVA[iat].cNumValenceElectrons == 5 ) &&
  ------------------
  |  Branch (1110:24): [True: 0, False: 0]
  ------------------
 1111|       |                     /* in orig.InChI: an endpoint, has fixed-H */
 1112|       |                     /* pStruct->endpoint[i] && */
 1113|      0|                     !( pStruct->fixed_H && pStruct->fixed_H[i] ) &&
  ------------------
  |  Branch (1113:25): [True: 0, False: 0]
  |  Branch (1113:45): [True: 0, False: 0]
  ------------------
 1114|      0|                     !( nMobHInChI && nMobHInChI[i] ) &&
  ------------------
  |  Branch (1114:25): [True: 0, False: 0]
  |  Branch (1114:39): [True: 0, False: 0]
  ------------------
 1115|       |                     /* has (+) edge */
 1116|      0|                     ( e = pVA[iat].nCPlusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (1116:22): [True: 0, False: 0]
  ------------------
 1117|      0|                     0 == pBNS->edge[e].forbidden)
  ------------------
  |  Branch (1117:22): [True: 0, False: 0]
  ------------------
 1118|      0|                {
 1119|       |
 1120|      0|                    iat_SB_Neutr[num_SB_Neutr++] = iat;
 1121|       |
 1122|      0|                    if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1122:25): [True: 0, False: 0]
  ------------------
 1123|      0|                    {
 1124|      0|                        goto exit_function;
 1125|      0|                    }
 1126|      0|                }
 1127|      0|            }
 1128|      0|        }
 1129|      0|        if (num_try = inchi_min( num_SB_Neutr, num_DB_Charged ))
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1129:13): [True: 0, False: 0]
  ------------------
 1130|      0|        {
 1131|       |            /* detected; attempt to fix */
 1132|      0|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 1133|      0|            RemoveForbiddenEdgeMask( pBNS, &CurrEdges, forbidden_edge_mask );
 1134|      0|            delta = 1;
 1135|      0|            for (i = 0; i < num_SB_Neutr && cur_success < num_try; i++)
  ------------------
  |  Branch (1135:25): [True: 0, False: 0]
  |  Branch (1135:45): [True: 0, False: 0]
  ------------------
 1136|      0|            {
 1137|      0|                iat = iat_SB_Neutr[i];
 1138|      0|                pe = pBNS->edge + pVA[iat].nCPlusGroupEdge - 1;
 1139|      0|                if (!pe->flow)
  ------------------
  |  Branch (1139:21): [True: 0, False: 0]
  ------------------
 1140|      0|                    continue;
 1141|      0|                pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 1142|      0|                pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 1143|       |
 1144|      0|                pe->forbidden |= forbidden_edge_mask;
 1145|      0|                pe->flow -= delta;
 1146|      0|                pv1->st_edge.flow -= delta;
 1147|      0|                pv2->st_edge.flow -= delta;
 1148|      0|                pBNS->tot_st_flow -= 2 * delta;
 1149|       |
 1150|      0|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 1151|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 1152|       |
 1153|      0|                if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (1153:21): [True: 0, False: 0]
  |  Branch (1153:35): [True: 0, False: 0]
  |  Branch (1153:53): [True: 0, False: 0]
  ------------------
 1154|      0|                                  vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == -1)
  ------------------
  |  Branch (1154:35): [True: 0, False: 0]
  |  Branch (1154:53): [True: 0, False: 0]
  |  Branch (1154:75): [True: 0, False: 0]
  ------------------
 1155|      0|                {
 1156|       |                    /* Removed charge from O(+) => nDeltaCharge == -1 */
 1157|       |                    /* Flow change on pe (+)charge edge (atom NH2) is not known to RunBnsTestOnce()) */
 1158|      0|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 1159|      0|                    if (ret > 0)
  ------------------
  |  Branch (1159:25): [True: 0, False: 0]
  ------------------
 1160|      0|                    {
 1161|      0|                        nNumRunBNS++;
 1162|      0|                        cur_success++; /* 04 */
 1163|      0|                    }
 1164|      0|                }
 1165|      0|                else
 1166|      0|                {
 1167|      0|                    pe->forbidden &= forbidden_edge_mask_inv;
 1168|      0|                    pe->flow += delta;
 1169|      0|                    pv1->st_edge.flow += delta;
 1170|      0|                    pv2->st_edge.flow += delta;
 1171|      0|                    pBNS->tot_st_flow += 2 * delta;
 1172|      0|                }
 1173|      0|                INCHI_HEAPCHK
 1174|      0|            }
 1175|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 1176|      0|        }
 1177|      0|        CurrEdges.num_edges = 0; /* clear current edge list */
 1178|      0|        if (cur_success)
  ------------------
  |  Branch (1178:13): [True: 0, False: 0]
  ------------------
 1179|      0|        {
 1180|      0|            tot_succes += cur_success;
 1181|       |            /* recalculate InChI from the structure */
 1182|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (1182:17): [True: 0, False: 0]
  ------------------
 1183|      0|                                                            ppt_group_info, ppat_norm, ppat_prep ) ))
 1184|      0|            {
 1185|      0|                goto exit_function;
 1186|      0|            }
 1187|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (1187:17): [True: 0, False: 0]
  ------------------
 1188|      0|            {
 1189|      0|                goto exit_function;
 1190|      0|            }
 1191|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (1191:17): [True: 0, False: 0]
  |  Branch (1191:45): [True: 0, False: 0]
  ------------------
 1192|      0|            {
 1193|      0|                goto exit_function;  /* no fixed-H found */
 1194|      0|            }
 1195|      0|            if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (1195:17): [True: 0, False: 0]
  ------------------
 1196|      0|            {
 1197|      0|                goto exit_function;
 1198|      0|            }
 1199|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (1199:17): [True: 0, False: 0]
  ------------------
 1200|      0|            {
 1201|      0|                goto exit_function; /* nothing to do */
 1202|      0|            }
 1203|      0|        }
 1204|      0|    }
 1205|       |
 1206|      1|    if (pc2i->len_c2at > 1)
  ------------------
  |  Branch (1206:9): [True: 1, False: 0]
  ------------------
 1207|      1|    {
 1208|       |        /*--------------------------------------------------------------*/
 1209|       |        /* case 05: restored:  O=AB-NH      original:(-)O-AB=NH(+)      */
 1210|       |        /* FixH:               0     0                 -1     1         */
 1211|       |        /* MobH:               0     1                  1     0         */
 1212|       |        /* O = O, S, Se; N = N, O, S, Se, Te; all atoms not tautomeric  */
 1213|       |        /* Solution: Separate charges                                   */
 1214|       |        /*--------------------------------------------------------------*/
 1215|      1|        int num_DB_O = 0, num_SB_NH = 0, iat;
 1216|      1|        short iat_DB_O[MAX_DIFF_FIXH], iat_SB_NH[MAX_DIFF_FIXH];
 1217|      1|        cur_success = 0;
 1218|      3|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (1218:21): [True: 2, False: 1]
  ------------------
 1219|      2|        {
 1220|      2|            iat = pc2i->c2at[i].atomNumber;
 1221|      2|            if ( /* orig. InChI info: =NH2(+), =OH(+) */
 1222|      2|                 num_SB_NH < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|      4|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (1222:18): [True: 2, False: 0]
  ------------------
 1223|      2|                 ( pc2i->c2at[i].nValElectr == 5 && pc2i->c2at[i].nPeriodNum == 1 ||
  ------------------
  |  Branch (1223:20): [True: 0, False: 2]
  |  Branch (1223:53): [True: 0, False: 0]
  ------------------
 1224|      2|                   pc2i->c2at[i].nValElectr == 6 ) /* N, O, S, Se, Te */ &&
  ------------------
  |  Branch (1224:20): [True: 2, False: 0]
  ------------------
 1225|      2|                 !pc2i->c2at[i].endptInChI &&
  ------------------
  |  Branch (1225:18): [True: 2, False: 0]
  ------------------
 1226|      2|                 ( e = pVA[iat].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (1226:18): [True: 2, False: 0]
  |  Branch (1226:63): [True: 2, False: 0]
  ------------------
 1227|      2|                 pc2i->c2at[i].nFixHInChI == 1 && /*pc2i->c2at[i].nMobHInChI ==  1 &&*/
  ------------------
  |  Branch (1227:18): [True: 0, False: 2]
  ------------------
 1228|       |                                                  /* reversed structure info: */
 1229|      2|                 pc2i->c2at[i].nFixHRevrs == 0 && pc2i->c2at[i].nMobHRevrs &&
  ------------------
  |  Branch (1229:18): [True: 0, False: 0]
  |  Branch (1229:51): [True: 0, False: 0]
  ------------------
 1230|      2|                 pc2i->c2at[i].nAtChargeRevrs == 0 && at2[iat].num_H &&
  ------------------
  |  Branch (1230:18): [True: 0, False: 0]
  |  Branch (1230:55): [True: 0, False: 0]
  ------------------
 1231|      2|                 !pc2i->c2at[i].endptRevrs &&
  ------------------
  |  Branch (1231:18): [True: 0, False: 0]
  ------------------
 1232|      2|                 at2[iat].valence == at2[iat].chem_bonds_valence)
  ------------------
  |  Branch (1232:18): [True: 0, False: 0]
  ------------------
 1233|      0|            {
 1234|      0|                iat_SB_NH[num_SB_NH++] = iat;
 1235|      0|                if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1235:21): [True: 0, False: 0]
  ------------------
 1236|      0|                {
 1237|      0|                    goto exit_function;
 1238|      0|                }
 1239|      0|            }
 1240|      2|            else
 1241|      2|            {
 1242|      2|                if ( /* orig. InChI info: -O(-) */
 1243|      2|                     num_DB_O < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|      4|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (1243:22): [True: 2, False: 0]
  ------------------
 1244|      2|                     ( pc2i->c2at[i].nValElectr == 6 ) /* O, S, Se, Te */ &&
  ------------------
  |  Branch (1244:22): [True: 2, False: 0]
  ------------------
 1245|      2|                     !pc2i->c2at[i].endptInChI &&
  ------------------
  |  Branch (1245:22): [True: 2, False: 0]
  ------------------
 1246|      2|                     ( e = pVA[iat].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (1246:22): [True: 2, False: 0]
  |  Branch (1246:68): [True: 2, False: 0]
  ------------------
 1247|      2|                     pc2i->c2at[i].nFixHInChI == -1 && pc2i->c2at[i].nMobHInChI == 1 &&
  ------------------
  |  Branch (1247:22): [True: 0, False: 2]
  |  Branch (1247:56): [True: 0, False: 0]
  ------------------
 1248|       |                     /* reversed structure info: */
 1249|      2|                     pc2i->c2at[i].nFixHRevrs == 0 && pc2i->c2at[i].nMobHRevrs == 0 &&
  ------------------
  |  Branch (1249:22): [True: 0, False: 0]
  |  Branch (1249:55): [True: 0, False: 0]
  ------------------
 1250|      2|                     pc2i->c2at[i].nAtChargeRevrs == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (1250:22): [True: 0, False: 0]
  |  Branch (1250:59): [True: 0, False: 0]
  ------------------
 1251|      2|                     !pc2i->c2at[i].endptRevrs &&
  ------------------
  |  Branch (1251:22): [True: 0, False: 0]
  ------------------
 1252|      2|                     at2[iat].valence + 1 == at2[iat].chem_bonds_valence)
  ------------------
  |  Branch (1252:22): [True: 0, False: 0]
  ------------------
 1253|      0|                {
 1254|      0|                    iat_DB_O[num_DB_O++] = iat;
 1255|      0|                    if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1255:25): [True: 0, False: 0]
  ------------------
 1256|      0|                    {
 1257|      0|                        goto exit_function;
 1258|      0|                    }
 1259|      0|                }
 1260|      2|            }
 1261|      2|        }
 1262|      1|        if (num_try = inchi_min( num_DB_O, num_SB_NH ))
  ------------------
  |  |  167|      1|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (1262:13): [True: 0, False: 1]
  ------------------
 1263|      0|        {
 1264|       |            /* detected; attempt to fix */
 1265|      0|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 1266|      0|            RemoveForbiddenEdgeMask( pBNS, &CurrEdges, forbidden_edge_mask );
 1267|      0|            delta = 1;
 1268|      0|            for (i = 0; i < num_SB_NH && cur_success < num_try; i++)
  ------------------
  |  Branch (1268:25): [True: 0, False: 0]
  |  Branch (1268:42): [True: 0, False: 0]
  ------------------
 1269|      0|            {
 1270|      0|                iat = iat_SB_NH[i];
 1271|      0|                pe = pBNS->edge + pVA[iat].nCPlusGroupEdge - 1;
 1272|      0|                if (!pe->flow)
  ------------------
  |  Branch (1272:21): [True: 0, False: 0]
  ------------------
 1273|      0|                    continue;
 1274|      0|                pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 1275|      0|                pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 1276|       |
 1277|      0|                pe->forbidden |= forbidden_edge_mask;
 1278|      0|                pe->flow -= delta;
 1279|      0|                pv1->st_edge.flow -= delta;
 1280|      0|                pv2->st_edge.flow -= delta;
 1281|      0|                pBNS->tot_st_flow -= 2 * delta;
 1282|       |
 1283|      0|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 1284|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 1285|       |
 1286|      0|                if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (1286:21): [True: 0, False: 0]
  |  Branch (1286:35): [True: 0, False: 0]
  |  Branch (1286:53): [True: 0, False: 0]
  ------------------
 1287|      0|                                  vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == 1)
  ------------------
  |  Branch (1287:35): [True: 0, False: 0]
  |  Branch (1287:53): [True: 0, False: 0]
  |  Branch (1287:75): [True: 0, False: 0]
  ------------------
 1288|      0|                {
 1289|       |                    /* Added charge to =O => nDeltaCharge == 1 */
 1290|       |                    /* Flow change on pe (+)charge edge (atom NH2) is not known to RunBnsTestOnce()) */
 1291|      0|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 1292|      0|                    if (ret > 0)
  ------------------
  |  Branch (1292:25): [True: 0, False: 0]
  ------------------
 1293|      0|                    {
 1294|      0|                        nNumRunBNS++;
 1295|      0|                        cur_success++; /* 05 */
 1296|      0|                    }
 1297|      0|                }
 1298|      0|                else
 1299|      0|                {
 1300|      0|                    pe->forbidden &= forbidden_edge_mask_inv;
 1301|      0|                    pe->flow += delta;
 1302|      0|                    pv1->st_edge.flow += delta;
 1303|      0|                    pv2->st_edge.flow += delta;
 1304|      0|                    pBNS->tot_st_flow += 2 * delta;
 1305|      0|                }
 1306|      0|                INCHI_HEAPCHK
 1307|      0|            }
 1308|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 1309|      0|        }
 1310|      1|        CurrEdges.num_edges = 0; /* clear current edge list */
 1311|      1|        if (cur_success)
  ------------------
  |  Branch (1311:13): [True: 0, False: 1]
  ------------------
 1312|      0|        {
 1313|      0|            tot_succes += cur_success;
 1314|       |            /* recalculate InChI from the structure */
 1315|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (1315:17): [True: 0, False: 0]
  ------------------
 1316|      0|                                                            ppt_group_info, ppat_norm, ppat_prep ) ))
 1317|      0|            {
 1318|      0|                goto exit_function;
 1319|      0|            }
 1320|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (1320:17): [True: 0, False: 0]
  ------------------
 1321|      0|            {
 1322|      0|                goto exit_function;
 1323|      0|            }
 1324|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (1324:17): [True: 0, False: 0]
  |  Branch (1324:45): [True: 0, False: 0]
  ------------------
 1325|      0|            {
 1326|      0|                goto exit_function;  /* no fixed-H found */
 1327|      0|            }
 1328|      0|            if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (1328:17): [True: 0, False: 0]
  ------------------
 1329|      0|            {
 1330|      0|                goto exit_function;
 1331|      0|            }
 1332|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (1332:17): [True: 0, False: 0]
  ------------------
 1333|      0|            {
 1334|      0|                goto exit_function; /* nothing to do */
 1335|      0|            }
 1336|      0|        }
 1337|      1|    }
 1338|       |
 1339|      1|    if (pStruct->fixed_H && pStruct->endpoint && pc2i->nChargeFixHInChI > 0 && pc2i->nChargeFixHInChI > pc2i->nChargeMobHInChI)
  ------------------
  |  Branch (1339:9): [True: 1, False: 0]
  |  Branch (1339:29): [True: 1, False: 0]
  |  Branch (1339:50): [True: 0, False: 1]
  |  Branch (1339:80): [True: 0, False: 0]
  ------------------
 1340|      0|    {
 1341|       |        /*----------------------------------------------------------*/
 1342|       |        /* case 06c: restored -NH- or -NH(+)  orig: -NH-            */
 1343|       |        /*  Fixed-H            1       1             0              */
 1344|       |        /*  Mobile-H           0       0             1              */
 1345|       |        /*                     not tautomeric    not tautomeric     */
 1346|       |        /*           has adjacent (+)                               */
 1347|       |        /*           charges                                        */
 1348|       |        /*  Solution: move (+) charges to the -NH- unless it already*/
 1349|       |        /*            N = N, O, S, Se, Te                           */
 1350|       |        /*            has (+) charge blocked by adjacent (+)        */
 1351|       |        /*----------------------------------------------------------*/
 1352|      0|        int iat;
 1353|      0|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 1354|       |        /*
 1355|       |        inp_ATOM *at_Mobile_H_Revrs = (pStruct->pOne_norm_data[1] &&
 1356|       |        pStruct->pOne_norm_data[1]->at)? pStruct->pOne_norm_data[1]->at : NULL;
 1357|       |        inp_ATOM *atfMobile_H_Revrs = pStruct->pOne_norm_data[TAUT_YES] &&
 1358|       |        pStruct->pOne_norm_data[TAUT_YES]->at_fixed_bonds?
 1359|       |        pStruct->pOne_norm_data[TAUT_YES]->at_fixed_bonds : NULL;
 1360|       |        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H? pInChI[1]->nNum_H :
 1361|       |        pInChI[0] && pInChI[0]->nNum_H? pInChI[0]->nNum_H : NULL;
 1362|       |        */
 1363|      0|        EDGE_LIST CurChargeEdges;
 1364|      0|        EdgeIndex e2;
 1365|      0|        cur_success = 0;
 1366|      0|        AllocEdgeList( &CurChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      0|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 1367|      0|        CurrEdges.num_edges = 0;
 1368|      0|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (1368:21): [True: 0, False: 0]
  ------------------
 1369|      0|        {
 1370|       |            /* atoms -NH- from which H(+) were removed by the Normalization in orig. InChI */
 1371|      0|            iat = pc2i->c2at[i].atomNumber;
 1372|      0|            if (( pc2i->c2at[i].nValElectr == 6 ||
  ------------------
  |  Branch (1372:19): [True: 0, False: 0]
  ------------------
 1373|      0|                  pc2i->c2at[i].nValElectr == 5 && pc2i->c2at[i].nPeriodNum == 1 ) &&
  ------------------
  |  Branch (1373:19): [True: 0, False: 0]
  |  Branch (1373:52): [True: 0, False: 0]
  ------------------
 1374|      0|                 !pc2i->c2at[i].endptInChI &&
  ------------------
  |  Branch (1374:18): [True: 0, False: 0]
  ------------------
 1375|      0|                 ( e = pVA[iat].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (1375:18): [True: 0, False: 0]
  |  Branch (1375:63): [True: 0, False: 0]
  ------------------
 1376|      0|            {
 1377|      0|                if ( /* orig. InChI info: -NH- */
 1378|      0|                     pc2i->c2at[i].nFixHInChI == 1 && pc2i->c2at[i].nMobHInChI == 0 &&
  ------------------
  |  Branch (1378:22): [True: 0, False: 0]
  |  Branch (1378:55): [True: 0, False: 0]
  ------------------
 1379|       |                     /* reversed structure info: */
 1380|      0|                     pc2i->c2at[i].nFixHRevrs == 0 && pc2i->c2at[i].nMobHRevrs == 1 && /* was not removed */
  ------------------
  |  Branch (1380:22): [True: 0, False: 0]
  |  Branch (1380:55): [True: 0, False: 0]
  ------------------
 1381|      0|                     /*pc2i->c2at[i].nAtChargeRevrs == 0 &&*/ at2[iat].num_H && /* at2 is Fixed-H */
  ------------------
  |  Branch (1381:63): [True: 0, False: 0]
  ------------------
 1382|      0|                     at2[iat].valence == at2[iat].chem_bonds_valence)
  ------------------
  |  Branch (1382:22): [True: 0, False: 0]
  ------------------
 1383|      0|                {
 1384|      0|                    if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1384:25): [True: 0, False: 0]
  ------------------
 1385|      0|                    {
 1386|      0|                        goto exit_function;
 1387|      0|                    }
 1388|      0|                }
 1389|      0|            }
 1390|      0|        }
 1391|      0|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (1391:21): [True: 0, False: 0]
  ------------------
 1392|      0|        {
 1393|       |            /* find adjacent charged atoms */
 1394|      0|            iat = nCanon2AtnoRevrs[i];
 1395|      0|            if (pStruct->endpoint[i] || at2[iat].charge != 1 || at2[iat].radical || pVA[iat].cMetal)
  ------------------
  |  Branch (1395:17): [True: 0, False: 0]
  |  Branch (1395:41): [True: 0, False: 0]
  |  Branch (1395:65): [True: 0, False: 0]
  |  Branch (1395:85): [True: 0, False: 0]
  ------------------
 1396|      0|            {
 1397|      0|                continue;
 1398|      0|            }
 1399|      0|            if (0 <= ( e = pVA[iat].nCPlusGroupEdge - 1 ) && !pBNS->edge[e].forbidden && !pBNS->edge[e].flow && pVA[iat].cNumValenceElectrons >= 5)
  ------------------
  |  Branch (1399:17): [True: 0, False: 0]
  |  Branch (1399:62): [True: 0, False: 0]
  |  Branch (1399:90): [True: 0, False: 0]
  |  Branch (1399:113): [True: 0, False: 0]
  ------------------
 1400|      0|            {
 1401|       |                /* positively charged atom */
 1402|      0|                for (j = 0; j < at2[iat].valence; j++)
  ------------------
  |  Branch (1402:29): [True: 0, False: 0]
  ------------------
 1403|      0|                {
 1404|      0|                    if (at2[k = (int) at2[iat].neighbor[j]].charge == 1 && !pVA[k].cMetal &&
  ------------------
  |  Branch (1404:25): [True: 0, False: 0]
  |  Branch (1404:76): [True: 0, False: 0]
  ------------------
 1405|      0|                         0 <= ( e2 = pVA[k].nCPlusGroupEdge - 1 ) && !pBNS->edge[e2].forbidden && !pBNS->edge[e2].flow)
  ------------------
  |  Branch (1405:26): [True: 0, False: 0]
  |  Branch (1405:70): [True: 0, False: 0]
  |  Branch (1405:99): [True: 0, False: 0]
  ------------------
 1406|      0|                    {
 1407|      0|                        if (0 > FindInEdgeList( &CurrEdges, e ) &&
  ------------------
  |  Branch (1407:29): [True: 0, False: 0]
  ------------------
 1408|      0|                             0 > FindInEdgeList( &CurChargeEdges, e ) &&
  ------------------
  |  Branch (1408:30): [True: 0, False: 0]
  ------------------
 1409|      0|                             ( ret = AddToEdgeList( &CurChargeEdges, e, INC_ADD_EDGE ) ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1409:30): [True: 0, False: 0]
  ------------------
 1410|      0|                        {
 1411|      0|                            goto exit_case_06c;
 1412|      0|                        }
 1413|      0|                        if (0 > FindInEdgeList( &CurrEdges, e2 ) &&
  ------------------
  |  Branch (1413:29): [True: 0, False: 0]
  ------------------
 1414|      0|                             0 > FindInEdgeList( &CurChargeEdges, e2 ) &&
  ------------------
  |  Branch (1414:30): [True: 0, False: 0]
  ------------------
 1415|      0|                             ( ret = AddToEdgeList( &CurChargeEdges, e2, INC_ADD_EDGE ) ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1415:30): [True: 0, False: 0]
  ------------------
 1416|      0|                        {
 1417|      0|                            goto exit_case_06c;
 1418|      0|                        }
 1419|      0|                    }
 1420|      0|                }
 1421|      0|            }
 1422|      0|        }
 1423|      0|        if (num_try = inchi_min( CurrEdges.num_edges, CurChargeEdges.num_edges ))
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1423:13): [True: 0, False: 0]
  ------------------
 1424|      0|        {
 1425|       |            /* detected; attempt to fix */
 1426|      0|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 1427|      0|            RemoveForbiddenEdgeMask( pBNS, &CurChargeEdges, forbidden_edge_mask );
 1428|      0|            delta = 1;
 1429|      0|            for (i = 0; i < CurrEdges.num_edges && cur_success < num_try; i++)
  ------------------
  |  Branch (1429:25): [True: 0, False: 0]
  |  Branch (1429:52): [True: 0, False: 0]
  ------------------
 1430|      0|            {
 1431|      0|                e = CurrEdges.pnEdges[i];
 1432|      0|                pe = pBNS->edge + e; /* (+)charge edge of -NH- or -OH */
 1433|      0|                if (!pe->flow)
  ------------------
  |  Branch (1433:21): [True: 0, False: 0]
  ------------------
 1434|      0|                    continue;
 1435|      0|                pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 1436|      0|                pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 1437|       |
 1438|      0|                pe->flow -= delta; /* add (+) to -NHm */
 1439|      0|                pv1->st_edge.flow -= delta;
 1440|      0|                pv2->st_edge.flow -= delta;
 1441|      0|                pBNS->tot_st_flow -= 2 * delta;
 1442|       |
 1443|      0|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 1444|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 1445|       |
 1446|      0|                if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (1446:21): [True: 0, False: 0]
  |  Branch (1446:35): [True: 0, False: 0]
  |  Branch (1446:53): [True: 0, False: 0]
  ------------------
 1447|      0|                                  vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == -1)
  ------------------
  |  Branch (1447:35): [True: 0, False: 0]
  |  Branch (1447:53): [True: 0, False: 0]
  |  Branch (1447:75): [True: 0, False: 0]
  ------------------
 1448|      0|                {
 1449|       |                    /* Removed (+)charge from -NH- => nDeltaCharge == -1 */
 1450|       |                    /* Flow change on pe (+)charge edge (atom NHm(+)) is not known to RunBnsTestOnce()) */
 1451|      0|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 1452|      0|                    if (ret > 0)
  ------------------
  |  Branch (1452:25): [True: 0, False: 0]
  ------------------
 1453|      0|                    {
 1454|      0|                        nNumRunBNS++;
 1455|      0|                        cur_success++; /* 06c */
 1456|      0|                    }
 1457|      0|                }
 1458|      0|                else
 1459|      0|                {
 1460|      0|                    pe->flow += delta;
 1461|      0|                    pv1->st_edge.flow += delta;
 1462|      0|                    pv2->st_edge.flow += delta;
 1463|      0|                    pBNS->tot_st_flow += 2 * delta;
 1464|      0|                }
 1465|      0|                INCHI_HEAPCHK
 1466|      0|            }
 1467|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 1468|      0|        }
 1469|      0|    exit_case_06c:
 1470|      0|        CurrEdges.num_edges = 0; /* clear current edge list */
 1471|      0|        AllocEdgeList( &CurChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|      0|#define EDGE_LIST_FREE   (-2)
  ------------------
 1472|      0|        if (ret < 0)
  ------------------
  |  Branch (1472:13): [True: 0, False: 0]
  ------------------
 1473|      0|        {
 1474|      0|            goto exit_function;
 1475|      0|        }
 1476|      0|        if (cur_success)
  ------------------
  |  Branch (1476:13): [True: 0, False: 0]
  ------------------
 1477|      0|        {
 1478|      0|            tot_succes += cur_success;
 1479|       |            /* recalculate InChI from the structure */
 1480|      0|            if (0 >( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (1480:17): [True: 0, False: 0]
  ------------------
 1481|      0|                                                           ppt_group_info, ppat_norm, ppat_prep ) ))
 1482|      0|            {
 1483|      0|                goto exit_function;
 1484|      0|            }
 1485|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (1485:17): [True: 0, False: 0]
  ------------------
 1486|      0|            {
 1487|      0|                goto exit_function;
 1488|      0|            }
 1489|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (1489:17): [True: 0, False: 0]
  |  Branch (1489:45): [True: 0, False: 0]
  ------------------
 1490|      0|            {
 1491|      0|                goto exit_function;  /* no fixed-H found */
 1492|      0|            }
 1493|      0|            if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (1493:17): [True: 0, False: 0]
  ------------------
 1494|      0|            {
 1495|      0|                goto exit_function;
 1496|      0|            }
 1497|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (1497:17): [True: 0, False: 0]
  ------------------
 1498|      0|            {
 1499|      0|                goto exit_function; /* nothing to do */
 1500|      0|            }
 1501|      0|        }
 1502|      0|    }
 1503|       |
 1504|      1|    if (pc2i->len_c2at >= 2)
  ------------------
  |  Branch (1504:9): [True: 1, False: 0]
  ------------------
 1505|      1|    {
 1506|       |        /*------------------------------------------------------------*/
 1507|       |        /* case 06d: restored: XH(+)=-AB-NH    orig.: XH-=AB=NH(+)    */
 1508|       |        /* FixH:                1       1 0          0 1      1       */
 1509|       |        /* MobH:                0    taut 1          1 taut   0       */
 1510|       |        /*                                                            */
 1511|       |        /*                                                            */
 1512|       |        /* N  = N, O, S, Se; atoms N are not tautomeric in orig InChI */
 1513|       |        /* X  = N, O, S, Se, Te, F, Cl, Br, I; atom X is non-taut     */
 1514|       |        /* Solution: move (+) from X  to NH                           */
 1515|       |        /*------------------------------------------------------------*/
 1516|      1|        int iat;
 1517|       |        /*
 1518|       |        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 1519|       |        inp_ATOM *at_Mobile_H_Revrs = (pStruct->pOne_norm_data[1] &&
 1520|       |        pStruct->pOne_norm_data[1]->at)? pStruct->pOne_norm_data[1]->at : NULL;
 1521|       |        inp_ATOM *atfMobile_H_Revrs = pStruct->pOne_norm_data[TAUT_YES] &&
 1522|       |        pStruct->pOne_norm_data[TAUT_YES]->at_fixed_bonds?
 1523|       |        pStruct->pOne_norm_data[TAUT_YES]->at_fixed_bonds :
 1524|       |        pStruct->pOne_norm_data[TAUT_NON]->at;
 1525|       |        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H? pInChI[1]->nNum_H :
 1526|       |        pInChI[0] && pInChI[0]->nNum_H? pInChI[0]->nNum_H : 0;
 1527|       |        */
 1528|      1|        EDGE_LIST CurChargeEdges;
 1529|      1|        cur_success = 0;
 1530|      1|        AllocEdgeList( &CurChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      1|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 1531|      1|        CurrEdges.num_edges = 0;
 1532|      3|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (1532:21): [True: 2, False: 1]
  ------------------
 1533|      2|        {
 1534|      2|            iat = pc2i->c2at[i].atomNumber;
 1535|       |            /* XH(+) */
 1536|      2|            if ( /* reconstructed: non-taut and (+) */
 1537|      2|                ( pc2i->c2at[i].nMobHRevrs + 1 == pc2i->c2at[i].nFixHRevrs &&
  ------------------
  |  Branch (1537:19): [True: 0, False: 2]
  ------------------
 1538|      2|                  pc2i->c2at[i].nFixHRevrs > 0 && !pc2i->c2at[i].endptRevrs &&
  ------------------
  |  Branch (1538:19): [True: 0, False: 0]
  |  Branch (1538:51): [True: 0, False: 0]
  ------------------
 1539|      2|                  pc2i->c2at[i].nAtChargeRevrs == 1 &&
  ------------------
  |  Branch (1539:19): [True: 0, False: 0]
  ------------------
 1540|       |                  /* original InChI: non-taut & has H or an endpoint, has Fixed H */
 1541|      2|                  ( !pc2i->c2at[i].nFixHInChI && pc2i->c2at[i].nMobHInChI == pc2i->c2at[i].nFixHRevrs ||
  ------------------
  |  Branch (1541:21): [True: 0, False: 0]
  |  Branch (1541:50): [True: 0, False: 0]
  ------------------
 1542|      0|                    pc2i->c2at[i].nFixHInChI == pc2i->c2at[i].nFixHRevrs && pc2i->c2at[i].endptInChI ) ) &&
  ------------------
  |  Branch (1542:21): [True: 0, False: 0]
  |  Branch (1542:77): [True: 0, False: 0]
  ------------------
 1543|      2|                 0 <= ( e = pVA[iat].nCPlusGroupEdge - 1 ) && !pBNS->edge[e].forbidden && !pBNS->edge[e].flow)
  ------------------
  |  Branch (1543:18): [True: 0, False: 0]
  |  Branch (1543:63): [True: 0, False: 0]
  |  Branch (1543:91): [True: 0, False: 0]
  ------------------
 1544|      0|            {
 1545|       |
 1546|      0|                if (ret = AddToEdgeList( &CurChargeEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1546:21): [True: 0, False: 0]
  ------------------
 1547|      0|                {
 1548|      0|                    goto exit_case_06d;
 1549|      0|                }
 1550|      0|            }
 1551|      2|            else
 1552|      2|            {
 1553|       |                /* -NH- */
 1554|      2|                if ( /* original InChI: has H and is not an endpoint */
 1555|      2|                    ( pc2i->c2at[i].nMobHInChI + 1 == pc2i->c2at[i].nFixHInChI &&
  ------------------
  |  Branch (1555:23): [True: 0, False: 2]
  ------------------
 1556|      2|                      pc2i->c2at[i].nFixHInChI > 0 && !pc2i->c2at[i].endptInChI &&
  ------------------
  |  Branch (1556:23): [True: 0, False: 0]
  |  Branch (1556:55): [True: 0, False: 0]
  ------------------
 1557|      2|                      pc2i->c2at[i].nAtChargeRevrs == 0 &&
  ------------------
  |  Branch (1557:23): [True: 0, False: 0]
  ------------------
 1558|       |                      /* reconstructed InChI: non-taut & has H or an endpoint, has Fixed H */
 1559|      2|                      ( !pc2i->c2at[i].nFixHRevrs && pc2i->c2at[i].nMobHRevrs == pc2i->c2at[i].nFixHInChI ||
  ------------------
  |  Branch (1559:25): [True: 0, False: 0]
  |  Branch (1559:54): [True: 0, False: 0]
  ------------------
 1560|      0|                        pc2i->c2at[i].nFixHRevrs == pc2i->c2at[i].nFixHInChI && pc2i->c2at[i].endptRevrs ) ) &&
  ------------------
  |  Branch (1560:25): [True: 0, False: 0]
  |  Branch (1560:81): [True: 0, False: 0]
  ------------------
 1561|      2|                     0 <= ( e = pVA[iat].nCPlusGroupEdge - 1 ) && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (1561:22): [True: 0, False: 0]
  |  Branch (1561:67): [True: 0, False: 0]
  ------------------
 1562|      2|                     pBNS->edge[e].flow)
  ------------------
  |  Branch (1562:22): [True: 0, False: 0]
  ------------------
 1563|      0|                {
 1564|       |
 1565|      0|                    if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1565:25): [True: 0, False: 0]
  ------------------
 1566|      0|                    {
 1567|      0|                        goto exit_case_06d;
 1568|      0|                    }
 1569|      0|                }
 1570|      2|            }
 1571|      2|        }
 1572|      1|        if (num_try = inchi_min( CurrEdges.num_edges, CurChargeEdges.num_edges ))
  ------------------
  |  |  167|      1|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (1572:13): [True: 0, False: 1]
  ------------------
 1573|      0|        {
 1574|       |            /* detected; attempt to fix */
 1575|      0|            int bSFlowerEdgesMayBeForbidden = ( SFlowerEdges.num_edges > 0 );
 1576|      0|            int bSFlowerEdgesIsForbidden;
 1577|      0|            for (bSFlowerEdgesIsForbidden = bSFlowerEdgesMayBeForbidden;
 1578|      0|                  0 <= bSFlowerEdgesIsForbidden; bSFlowerEdgesIsForbidden--)
  ------------------
  |  Branch (1578:19): [True: 0, False: 0]
  ------------------
 1579|      0|            {
 1580|      0|                if (bSFlowerEdgesIsForbidden)
  ------------------
  |  Branch (1580:21): [True: 0, False: 0]
  ------------------
 1581|      0|                {
 1582|       |                    /* on the 1st pass disallow -S(+)= => =S=, allow only -S(+)= => -S- */
 1583|      0|                    SetForbiddenEdgeMask( pBNS, &SFlowerEdges, forbidden_edge_mask );
 1584|      0|                }
 1585|      0|                SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 1586|      0|                RemoveForbiddenEdgeMask( pBNS, &CurChargeEdges, forbidden_edge_mask );
 1587|      0|                delta = 1;
 1588|      0|                for (i = 0; i < CurrEdges.num_edges && cur_success < num_try; i++)
  ------------------
  |  Branch (1588:29): [True: 0, False: 0]
  |  Branch (1588:56): [True: 0, False: 0]
  ------------------
 1589|      0|                {
 1590|      0|                    e = CurrEdges.pnEdges[i];
 1591|      0|                    pe = pBNS->edge + e; /* (+)charge edge of -NH- or -OH */
 1592|      0|                    if (!pe->flow)
  ------------------
  |  Branch (1592:25): [True: 0, False: 0]
  ------------------
 1593|      0|                        continue;
 1594|      0|                    pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 1595|      0|                    pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 1596|       |
 1597|      0|                    pe->flow -= delta; /* add (+) to -NHm */
 1598|      0|                    pv1->st_edge.flow -= delta;
 1599|      0|                    pv2->st_edge.flow -= delta;
 1600|      0|                    pBNS->tot_st_flow -= 2 * delta;
 1601|       |
 1602|      0|                    ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 1603|      0|                                          &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 1604|       |
 1605|      0|                    if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (1605:25): [True: 0, False: 0]
  |  Branch (1605:39): [True: 0, False: 0]
  |  Branch (1605:57): [True: 0, False: 0]
  ------------------
 1606|      0|                                      vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == -1)
  ------------------
  |  Branch (1606:39): [True: 0, False: 0]
  |  Branch (1606:57): [True: 0, False: 0]
  |  Branch (1606:79): [True: 0, False: 0]
  ------------------
 1607|      0|                    {
 1608|       |                        /* Removed (+)charge from -NH- => nDeltaCharge == -1 */
 1609|       |                        /* Flow change on pe (+)charge edge (atom NHm(+)) is not known to RunBnsTestOnce()) */
 1610|      0|                        ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 1611|      0|                        if (ret > 0)
  ------------------
  |  Branch (1611:29): [True: 0, False: 0]
  ------------------
 1612|      0|                        {
 1613|      0|                            nNumRunBNS++;
 1614|      0|                            cur_success++; /* 06d */
 1615|      0|                        }
 1616|      0|                    }
 1617|      0|                    else
 1618|      0|                    {
 1619|      0|                        pe->flow += delta;
 1620|      0|                        pv1->st_edge.flow += delta;
 1621|      0|                        pv2->st_edge.flow += delta;
 1622|      0|                        pBNS->tot_st_flow += 2 * delta;
 1623|      0|                    }
 1624|      0|                    INCHI_HEAPCHK
 1625|      0|                }
 1626|      0|                RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 1627|      0|                RemoveForbiddenEdgeMask( pBNS, &SFlowerEdges, forbidden_edge_mask );
 1628|      0|            }
 1629|      0|        }
 1630|      1|    exit_case_06d:
 1631|      1|        CurrEdges.num_edges = 0; /* clear current edge list */
 1632|      1|        AllocEdgeList( &CurChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|      1|#define EDGE_LIST_FREE   (-2)
  ------------------
 1633|      1|        if (cur_success)
  ------------------
  |  Branch (1633:13): [True: 0, False: 1]
  ------------------
 1634|      0|        {
 1635|      0|            tot_succes += cur_success;
 1636|       |            /* recalculate InChI from the structure */
 1637|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (1637:17): [True: 0, False: 0]
  ------------------
 1638|      0|                                                            ppt_group_info, ppat_norm, ppat_prep ) ))
 1639|      0|            {
 1640|      0|                goto exit_function;
 1641|      0|            }
 1642|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (1642:17): [True: 0, False: 0]
  ------------------
 1643|      0|            {
 1644|      0|                goto exit_function;
 1645|      0|            }
 1646|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (1646:17): [True: 0, False: 0]
  |  Branch (1646:45): [True: 0, False: 0]
  ------------------
 1647|      0|            {
 1648|      0|                goto exit_function;  /* no fixed-H found */
 1649|      0|            }
 1650|      0|            if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (1650:17): [True: 0, False: 0]
  ------------------
 1651|      0|            {
 1652|      0|                goto exit_function;
 1653|      0|            }
 1654|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (1654:17): [True: 0, False: 0]
  ------------------
 1655|      0|            {
 1656|      0|                goto exit_function; /* nothing to do */
 1657|      0|            }
 1658|      0|        }
 1659|      1|    }
 1660|       |
 1661|      1|    if (pc2i->len_c2at >= 2)
  ------------------
  |  Branch (1661:9): [True: 1, False: 0]
  ------------------
 1662|      1|    {
 1663|       |        /*--------------------------------------------------------*/
 1664|       |        /* case 06: restored: NHn(+)=AB-NHm  orig.: NHn-AB=NHm(+) */
 1665|       |        /* FixH:               1        0            0     1      */
 1666|       |        /* MobH:              n-1       m            n    m-1     */
 1667|       |        /* N = N, O, S, Se; atoms N are not tautomeric            */
 1668|       |        /* Solution: move (+) from NHn(+) to NHn                  */
 1669|       |        /*--------------------------------------------------------*/
 1670|      1|        int num_DB_NHn_Plus = 0, num_SB_NHm_Neutr = 0, iat;
 1671|      1|        short iat_DB_NHn_Plus[MAX_DIFF_FIXH], iat_SB_NHm_Neutr[MAX_DIFF_FIXH];
 1672|      1|        cur_success = 0;
 1673|      3|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (1673:21): [True: 2, False: 1]
  ------------------
 1674|      2|        {
 1675|      2|            iat = pc2i->c2at[i].atomNumber;
 1676|      2|            if (( pc2i->c2at[i].nValElectr == 6 ||
  ------------------
  |  Branch (1676:19): [True: 2, False: 0]
  ------------------
 1677|      2|                  pc2i->c2at[i].nValElectr == 5 && pc2i->c2at[i].nPeriodNum == 1 ) &&
  ------------------
  |  Branch (1677:19): [True: 0, False: 0]
  |  Branch (1677:52): [True: 0, False: 0]
  ------------------
 1678|      2|                 !pc2i->c2at[i].endptInChI &&
  ------------------
  |  Branch (1678:18): [True: 2, False: 0]
  ------------------
 1679|      2|                 ( e = pVA[iat].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (1679:18): [True: 2, False: 0]
  |  Branch (1679:63): [True: 2, False: 0]
  ------------------
 1680|      2|            {
 1681|      2|                if ( /* orig. InChI info: NHm */
 1682|      2|                     num_SB_NHm_Neutr < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|      4|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (1682:22): [True: 2, False: 0]
  ------------------
 1683|      2|                     pc2i->c2at[i].nFixHInChI == 1 && /*pc2i->c2at[i].nMobHInChI == 0 &&*/
  ------------------
  |  Branch (1683:22): [True: 0, False: 2]
  ------------------
 1684|       |                                                      /* reversed structure info: */
 1685|      2|                     pc2i->c2at[i].nFixHRevrs == 0 && /*pc2i->c2at[i].nMobHRevrs == 1 &&*/
  ------------------
  |  Branch (1685:22): [True: 0, False: 0]
  ------------------
 1686|      2|                     pc2i->c2at[i].nAtChargeRevrs == 0 && at2[iat].num_H && /* at2 is Fixed-H */
  ------------------
  |  Branch (1686:22): [True: 0, False: 0]
  |  Branch (1686:59): [True: 0, False: 0]
  ------------------
 1687|      2|                     at2[iat].valence == at2[iat].chem_bonds_valence)
  ------------------
  |  Branch (1687:22): [True: 0, False: 0]
  ------------------
 1688|      0|                {
 1689|      0|                    iat_SB_NHm_Neutr[num_SB_NHm_Neutr++] = iat;
 1690|      0|                    if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1690:25): [True: 0, False: 0]
  ------------------
 1691|      0|                    {
 1692|      0|                        goto exit_function;
 1693|      0|                    }
 1694|      0|                }
 1695|      2|                else
 1696|      2|                {
 1697|      2|                    if ( /* orig. InChI info: */
 1698|      2|                         num_DB_NHn_Plus < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|      4|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (1698:26): [True: 2, False: 0]
  ------------------
 1699|      2|                         pc2i->c2at[i].nFixHInChI == 0 && /*pc2i->c2at[i].nMobHInChI &&*/
  ------------------
  |  Branch (1699:26): [True: 2, False: 0]
  ------------------
 1700|       |                                                          /* reversed structure info: */
 1701|      2|                         pc2i->c2at[i].nFixHRevrs == 1 && /*pc2i->c2at[i].nMobHRevrs ==  0 &&*/
  ------------------
  |  Branch (1701:26): [True: 0, False: 2]
  ------------------
 1702|      2|                         pc2i->c2at[i].nAtChargeRevrs == 1 && at2[iat].num_H &&
  ------------------
  |  Branch (1702:26): [True: 0, False: 0]
  |  Branch (1702:63): [True: 0, False: 0]
  ------------------
 1703|      2|                         at2[iat].valence < at2[iat].chem_bonds_valence)
  ------------------
  |  Branch (1703:26): [True: 0, False: 0]
  ------------------
 1704|      0|                    {
 1705|      0|                        iat_DB_NHn_Plus[num_DB_NHn_Plus++] = iat;
 1706|      0|                        if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1706:29): [True: 0, False: 0]
  ------------------
 1707|      0|                        {
 1708|      0|                            goto exit_function;
 1709|      0|                        }
 1710|      0|                    }
 1711|      2|                }
 1712|      2|            }
 1713|      2|        }
 1714|      1|        if (num_try = inchi_min( num_SB_NHm_Neutr, num_DB_NHn_Plus ))
  ------------------
  |  |  167|      1|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (1714:13): [True: 0, False: 1]
  ------------------
 1715|      0|        {
 1716|       |            /* detected; attempt to fix */
 1717|      0|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 1718|      0|            RemoveForbiddenEdgeMask( pBNS, &CurrEdges, forbidden_edge_mask );
 1719|      0|            delta = 1;
 1720|      0|            for (i = 0; i < num_SB_NHm_Neutr && cur_success < num_try; i++)
  ------------------
  |  Branch (1720:25): [True: 0, False: 0]
  |  Branch (1720:49): [True: 0, False: 0]
  ------------------
 1721|      0|            {
 1722|      0|                iat = iat_SB_NHm_Neutr[i];
 1723|      0|                pe = pBNS->edge + pVA[iat].nCPlusGroupEdge - 1;
 1724|      0|                if (!pe->flow)
  ------------------
  |  Branch (1724:21): [True: 0, False: 0]
  ------------------
 1725|      0|                    continue;
 1726|      0|                pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 1727|      0|                pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 1728|       |
 1729|      0|                pe->forbidden |= forbidden_edge_mask;
 1730|      0|                pe->flow -= delta; /* add (+) to -NHm */
 1731|      0|                pv1->st_edge.flow -= delta;
 1732|      0|                pv2->st_edge.flow -= delta;
 1733|      0|                pBNS->tot_st_flow -= 2 * delta;
 1734|       |
 1735|      0|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 1736|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 1737|       |
 1738|      0|                if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (1738:21): [True: 0, False: 0]
  |  Branch (1738:35): [True: 0, False: 0]
  |  Branch (1738:53): [True: 0, False: 0]
  ------------------
 1739|      0|                                  vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == -1)
  ------------------
  |  Branch (1739:35): [True: 0, False: 0]
  |  Branch (1739:53): [True: 0, False: 0]
  |  Branch (1739:75): [True: 0, False: 0]
  ------------------
 1740|      0|                {
 1741|       |                    /* Removed (+)charge from -NHn => nDeltaCharge == -1 */
 1742|       |                    /* Flow change on pe (+)charge edge (atom NHm(+)) is not known to RunBnsTestOnce()) */
 1743|      0|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 1744|      0|                    if (ret > 0)
  ------------------
  |  Branch (1744:25): [True: 0, False: 0]
  ------------------
 1745|      0|                    {
 1746|      0|                        nNumRunBNS++;
 1747|      0|                        cur_success++; /* 06 */
 1748|      0|                    }
 1749|      0|                }
 1750|      0|                else
 1751|      0|                {
 1752|      0|                    pe->forbidden &= forbidden_edge_mask_inv;
 1753|      0|                    pe->flow += delta;
 1754|      0|                    pv1->st_edge.flow += delta;
 1755|      0|                    pv2->st_edge.flow += delta;
 1756|      0|                    pBNS->tot_st_flow += 2 * delta;
 1757|      0|                }
 1758|      0|                INCHI_HEAPCHK
 1759|      0|            }
 1760|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 1761|      0|        }
 1762|      1|        CurrEdges.num_edges = 0; /* clear current edge list */
 1763|      1|        if (cur_success)
  ------------------
  |  Branch (1763:13): [True: 0, False: 1]
  ------------------
 1764|      0|        {
 1765|      0|            tot_succes += cur_success;
 1766|       |            /* recalculate InChI from the structure */
 1767|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (1767:17): [True: 0, False: 0]
  ------------------
 1768|      0|                                                            ppt_group_info, ppat_norm, ppat_prep ) ))
 1769|      0|            {
 1770|      0|                goto exit_function;
 1771|      0|            }
 1772|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (1772:17): [True: 0, False: 0]
  ------------------
 1773|      0|            {
 1774|      0|                goto exit_function;
 1775|      0|            }
 1776|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (1776:17): [True: 0, False: 0]
  |  Branch (1776:45): [True: 0, False: 0]
  ------------------
 1777|      0|            {
 1778|      0|                goto exit_function;  /* no fixed-H found */
 1779|      0|            }
 1780|      0|            if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (1780:17): [True: 0, False: 0]
  ------------------
 1781|      0|            {
 1782|      0|                goto exit_function;
 1783|      0|            }
 1784|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (1784:17): [True: 0, False: 0]
  ------------------
 1785|      0|            {
 1786|      0|                goto exit_function; /* nothing to do */
 1787|      0|            }
 1788|      0|        }
 1789|      1|    }
 1790|       |
 1791|      1|    if (( pc2i->nNumTgInChI > pc2i->nNumTgRevrs && pc2i->nNumTgRevrs == 1 ||
  ------------------
  |  Branch (1791:11): [True: 0, False: 1]
  |  Branch (1791:52): [True: 0, False: 0]
  ------------------
 1792|      1|          pc2i->nNumEndpInChI < pc2i->nNumEndpRevrs ) &&
  ------------------
  |  Branch (1792:11): [True: 1, False: 0]
  ------------------
 1793|      1|         pStruct->nNumRemovedProtonsMobHInChI == pStruct->One_ti.tni.nNumRemovedProtons &&
  ------------------
  |  Branch (1793:10): [True: 0, False: 1]
  ------------------
 1794|      1|         pStruct->fixed_H && pStruct->endpoint && pStruct->pOne_norm_data[TAUT_YES]->at_fixed_bonds)
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1794:10): [True: 0, False: 0]
  |  Branch (1794:30): [True: 0, False: 0]
  |  Branch (1794:51): [True: 0, False: 0]
  ------------------
 1795|      0|    {
 1796|       |        /*----------------------------------------------------------*/
 1797|       |        /* case 06a: restored: N'(+)=-AB-NH    orig.: N'-=AB=NH(+)  */
 1798|       |        /* FixH:               0         1            0      1      */
 1799|       |        /* MobH:               0         0            0      0      */
 1800|       |        /*                    single t-group      multiple t-groups */
 1801|       |        /* N  = N, O, S, Se; atoms N are not tautomeric             */
 1802|       |        /* N' = N            atom N' is not tautomeric              */
 1803|       |        /* Solution: move (+) from N' to NH                         */
 1804|       |        /*----------------------------------------------------------*/
 1805|      0|        int iat;
 1806|      0|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 1807|       |        /*
 1808|       |        inp_ATOM *at_Mobile_H_Revrs = (pStruct->pOne_norm_data[1] &&
 1809|       |        pStruct->pOne_norm_data[1]->at)? pStruct->pOne_norm_data[1]->at : NULL;
 1810|       |        */
 1811|      0|        inp_ATOM *atfMobile_H_Revrs = pStruct->pOne_norm_data[TAUT_YES] &&
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1811:39): [True: 0, False: 0]
  ------------------
 1812|      0|            pStruct->pOne_norm_data[TAUT_YES]->at_fixed_bonds ?
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1812:13): [True: 0, False: 0]
  ------------------
 1813|      0|            pStruct->pOne_norm_data[TAUT_YES]->at_fixed_bonds : NULL;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1814|      0|        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H ? pInChI[1]->nNum_H :
  ------------------
  |  Branch (1814:32): [True: 0, False: 0]
  |  Branch (1814:45): [True: 0, False: 0]
  ------------------
 1815|      0|            pInChI[0] && pInChI[0]->nNum_H ? pInChI[0]->nNum_H : 0;
  ------------------
  |  Branch (1815:13): [True: 0, False: 0]
  |  Branch (1815:26): [True: 0, False: 0]
  ------------------
 1816|      0|        EDGE_LIST CurChargeEdges;
 1817|      0|        cur_success = 0;
 1818|      0|        AllocEdgeList( &CurChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      0|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 1819|      0|        CurrEdges.num_edges = 0;
 1820|      0|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (1820:21): [True: 0, False: 0]
  ------------------
 1821|      0|        {
 1822|      0|            iat = nCanon2AtnoRevrs[i];
 1823|      0|            if (pStruct->endpoint[i])
  ------------------
  |  Branch (1823:17): [True: 0, False: 0]
  ------------------
 1824|      0|            {
 1825|      0|                continue;
 1826|      0|            }
 1827|       |            /* -NH-, -OH */
 1828|      0|            if (pStruct->fixed_H[i] && !nMobHInChI[i] &&
  ------------------
  |  Branch (1828:17): [True: 0, False: 0]
  |  Branch (1828:40): [True: 0, False: 0]
  ------------------
 1829|      0|                 at2[iat].charge == 0 && at2[iat].radical == 0 &&
  ------------------
  |  Branch (1829:18): [True: 0, False: 0]
  |  Branch (1829:42): [True: 0, False: 0]
  ------------------
 1830|      0|                 0 <= ( e = pVA[iat].nCPlusGroupEdge - 1 ) && !pBNS->edge[e].forbidden && pBNS->edge[e].flow &&
  ------------------
  |  Branch (1830:18): [True: 0, False: 0]
  |  Branch (1830:63): [True: 0, False: 0]
  |  Branch (1830:91): [True: 0, False: 0]
  ------------------
 1831|      0|                 ( ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ) ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1831:18): [True: 0, False: 0]
  ------------------
 1832|      0|            {
 1833|      0|                goto exit_case_06a;
 1834|      0|            }
 1835|      0|            else
 1836|      0|            {
 1837|       |                /* >N(+)= */
 1838|      0|                if (at2[iat].charge == 1 && !at2[iat].num_H &&
  ------------------
  |  Branch (1838:21): [True: 0, False: 0]
  |  Branch (1838:45): [True: 0, False: 0]
  ------------------
 1839|      0|                     pVA[iat].cNumValenceElectrons == 5 && pVA[iat].cPeriodicRowNumber == 1 &&
  ------------------
  |  Branch (1839:22): [True: 0, False: 0]
  |  Branch (1839:60): [True: 0, False: 0]
  ------------------
 1840|      0|                     atfMobile_H_Revrs && atfMobile_H_Revrs[iat].charge == 0 &&
  ------------------
  |  Branch (1840:22): [True: 0, False: 0]
  |  Branch (1840:43): [True: 0, False: 0]
  ------------------
 1841|      0|                     0 <= ( e = pVA[iat].nCPlusGroupEdge - 1 ) && !pBNS->edge[e].forbidden && !pBNS->edge[e].flow &&
  ------------------
  |  Branch (1841:22): [True: 0, False: 0]
  |  Branch (1841:67): [True: 0, False: 0]
  |  Branch (1841:95): [True: 0, False: 0]
  ------------------
 1842|      0|                     ( ret = AddToEdgeList( &CurChargeEdges, e, INC_ADD_EDGE ) ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1842:22): [True: 0, False: 0]
  ------------------
 1843|      0|                {
 1844|      0|                    goto exit_case_06a;
 1845|      0|                }
 1846|      0|            }
 1847|      0|        }
 1848|      0|        if (num_try = inchi_min( CurrEdges.num_edges, CurChargeEdges.num_edges ))
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1848:13): [True: 0, False: 0]
  ------------------
 1849|      0|        {
 1850|       |            /* detected; attempt to fix */
 1851|      0|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 1852|      0|            RemoveForbiddenEdgeMask( pBNS, &CurChargeEdges, forbidden_edge_mask );
 1853|      0|            delta = 1;
 1854|      0|            for (i = 0; i < CurrEdges.num_edges && cur_success < num_try; i++)
  ------------------
  |  Branch (1854:25): [True: 0, False: 0]
  |  Branch (1854:52): [True: 0, False: 0]
  ------------------
 1855|      0|            {
 1856|      0|                e = CurrEdges.pnEdges[i];
 1857|      0|                pe = pBNS->edge + e; /* (+)charge edge of -NH- or -OH */
 1858|      0|                if (!pe->flow)
  ------------------
  |  Branch (1858:21): [True: 0, False: 0]
  ------------------
 1859|      0|                    continue;
 1860|      0|                pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 1861|      0|                pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 1862|       |
 1863|      0|                pe->flow -= delta; /* add (+) to -NHm */
 1864|      0|                pv1->st_edge.flow -= delta;
 1865|      0|                pv2->st_edge.flow -= delta;
 1866|      0|                pBNS->tot_st_flow -= 2 * delta;
 1867|       |
 1868|      0|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 1869|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 1870|       |
 1871|      0|                if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (1871:21): [True: 0, False: 0]
  |  Branch (1871:35): [True: 0, False: 0]
  |  Branch (1871:53): [True: 0, False: 0]
  ------------------
 1872|      0|                                  vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == -1)
  ------------------
  |  Branch (1872:35): [True: 0, False: 0]
  |  Branch (1872:53): [True: 0, False: 0]
  |  Branch (1872:75): [True: 0, False: 0]
  ------------------
 1873|      0|                {
 1874|       |                    /* Removed (+)charge from -NH- => nDeltaCharge == -1 */
 1875|       |                    /* Flow change on pe (+)charge edge (atom NHm(+)) is not known to RunBnsTestOnce()) */
 1876|      0|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 1877|      0|                    if (ret > 0)
  ------------------
  |  Branch (1877:25): [True: 0, False: 0]
  ------------------
 1878|      0|                    {
 1879|      0|                        nNumRunBNS++;
 1880|      0|                        cur_success++; /* 06a */
 1881|      0|                    }
 1882|      0|                }
 1883|      0|                else
 1884|      0|                {
 1885|      0|                    pe->flow += delta;
 1886|      0|                    pv1->st_edge.flow += delta;
 1887|      0|                    pv2->st_edge.flow += delta;
 1888|      0|                    pBNS->tot_st_flow += 2 * delta;
 1889|      0|                }
 1890|      0|                INCHI_HEAPCHK
 1891|      0|            }
 1892|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 1893|      0|        }
 1894|      0|    exit_case_06a:
 1895|      0|        CurrEdges.num_edges = 0; /* clear current edge list */
 1896|      0|        AllocEdgeList( &CurChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|      0|#define EDGE_LIST_FREE   (-2)
  ------------------
 1897|      0|        if (cur_success)
  ------------------
  |  Branch (1897:13): [True: 0, False: 0]
  ------------------
 1898|      0|        {
 1899|      0|            tot_succes += cur_success;
 1900|       |            /* recalculate InChI from the structure */
 1901|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (1901:17): [True: 0, False: 0]
  ------------------
 1902|      0|                                                            ppt_group_info, ppat_norm, ppat_prep ) ))
 1903|      0|            {
 1904|      0|                goto exit_function;
 1905|      0|            }
 1906|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (1906:17): [True: 0, False: 0]
  ------------------
 1907|      0|            {
 1908|      0|                goto exit_function;
 1909|      0|            }
 1910|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (1910:17): [True: 0, False: 0]
  |  Branch (1910:45): [True: 0, False: 0]
  ------------------
 1911|      0|            {
 1912|      0|                goto exit_function;  /* no fixed-H found */
 1913|      0|            }
 1914|      0|            if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (1914:17): [True: 0, False: 0]
  ------------------
 1915|      0|            {
 1916|      0|                goto exit_function;
 1917|      0|            }
 1918|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (1918:17): [True: 0, False: 0]
  ------------------
 1919|      0|            {
 1920|      0|                goto exit_function; /* nothing to do */
 1921|      0|            }
 1922|      0|        }
 1923|      0|    }
 1924|      1|    if (( pc2i->nNumTgInChI > pc2i->nNumTgRevrs && pc2i->nNumTgRevrs == 1 ||
  ------------------
  |  Branch (1924:11): [True: 0, False: 1]
  |  Branch (1924:52): [True: 0, False: 0]
  ------------------
 1925|      1|          pc2i->nNumEndpInChI < pc2i->nNumEndpRevrs ) &&
  ------------------
  |  Branch (1925:11): [True: 1, False: 0]
  ------------------
 1926|      1|          ( pStruct->nNumRemovedProtonsMobHInChI == pStruct->One_ti.tni.nNumRemovedProtons ||
  ------------------
  |  Branch (1926:13): [True: 0, False: 1]
  ------------------
 1927|      1|            pStruct->nNumRemovedProtonsMobHInChI > pStruct->One_ti.tni.nNumRemovedProtons ) &&
  ------------------
  |  Branch (1927:13): [True: 1, False: 0]
  ------------------
 1928|      1|         pStruct->fixed_H && pStruct->endpoint && pStruct->pOne_norm_data[TAUT_YES]->at_fixed_bonds)
  ------------------
  |  |  580|      1|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1928:10): [True: 1, False: 0]
  |  Branch (1928:30): [True: 1, False: 0]
  |  Branch (1928:51): [True: 1, False: 0]
  ------------------
 1929|      1|    {
 1930|       |        /*----------------------------------------------------------*/
 1931|       |        /* case 06b: restored: X(+)=-AB-NH    orig.: X-=AB=NH(+)    */
 1932|       |        /* FixH:               0        1 1          0      1       */
 1933|       |        /* MobH:               0        0 t          0      0       */
 1934|       |        /*                    single t-group      multiple t-groups */
 1935|       |        /*                                        or no t-groupd    */
 1936|       |        /* N  = N, O, S, Se; atoms N are not tautomeric             */
 1937|       |        /* X  = O, S, Se, Te, F, Cl, Br, I; atom X is not tautomeric*/
 1938|       |        /* Solution: move (+) from X  to NH                         */
 1939|       |        /*----------------------------------------------------------*/
 1940|      1|        int iat;
 1941|      1|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 1942|       |        /*
 1943|       |        inp_ATOM *at_Mobile_H_Revrs = (pStruct->pOne_norm_data[1] &&
 1944|       |        pStruct->pOne_norm_data[1]->at)? pStruct->pOne_norm_data[1]->at : NULL;
 1945|       |        */
 1946|      1|        inp_ATOM *atfMobile_H_Revrs = pStruct->pOne_norm_data[TAUT_YES] &&
  ------------------
  |  |  580|      1|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1946:39): [True: 1, False: 0]
  ------------------
 1947|      1|            pStruct->pOne_norm_data[TAUT_YES]->at_fixed_bonds ?
  ------------------
  |  |  580|      1|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1947:13): [True: 1, False: 0]
  ------------------
 1948|      1|            pStruct->pOne_norm_data[TAUT_YES]->at_fixed_bonds : NULL;
  ------------------
  |  |  580|      1|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1949|      1|        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H ? pInChI[1]->nNum_H :
  ------------------
  |  Branch (1949:32): [True: 1, False: 0]
  |  Branch (1949:45): [True: 1, False: 0]
  ------------------
 1950|      1|            pInChI[0] && pInChI[0]->nNum_H ? pInChI[0]->nNum_H : 0;
  ------------------
  |  Branch (1950:13): [True: 0, False: 0]
  |  Branch (1950:26): [True: 0, False: 0]
  ------------------
 1951|      1|        EDGE_LIST CurChargeEdges;
 1952|      1|        cur_success = 0;
 1953|      1|        AllocEdgeList( &CurChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      1|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 1954|      1|        CurrEdges.num_edges = 0;
 1955|      6|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (1955:21): [True: 5, False: 1]
  ------------------
 1956|      5|        {
 1957|      5|            iat = nCanon2AtnoRevrs[i];
 1958|      5|            if (pStruct->endpoint[i])
  ------------------
  |  Branch (1958:17): [True: 0, False: 5]
  ------------------
 1959|      0|            {
 1960|      0|                continue;
 1961|      0|            }
 1962|       |            /* -NH-, -OH */
 1963|      5|            if (pStruct->fixed_H[i] && !nMobHInChI[i] &&
  ------------------
  |  Branch (1963:17): [True: 0, False: 5]
  |  Branch (1963:40): [True: 0, False: 0]
  ------------------
 1964|      5|                 at2[iat].charge == 0 && at2[iat].radical == 0 &&
  ------------------
  |  Branch (1964:18): [True: 0, False: 0]
  |  Branch (1964:42): [True: 0, False: 0]
  ------------------
 1965|      5|                 0 <= ( e = pVA[iat].nCPlusGroupEdge - 1 ) && !pBNS->edge[e].forbidden && pBNS->edge[e].flow &&
  ------------------
  |  Branch (1965:18): [True: 0, False: 0]
  |  Branch (1965:63): [True: 0, False: 0]
  |  Branch (1965:91): [True: 0, False: 0]
  ------------------
 1966|      5|                 ( ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ) ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1966:18): [True: 0, False: 0]
  ------------------
 1967|      0|            {
 1968|      0|                goto exit_case_06b;
 1969|      0|            }
 1970|      5|            else
 1971|      5|            {
 1972|       |                /* X(+)= */
 1973|      5|                if (at2[iat].charge == 1 && !at2[iat].num_H &&
  ------------------
  |  Branch (1973:21): [True: 0, False: 5]
  |  Branch (1973:45): [True: 0, False: 0]
  ------------------
 1974|      5|                    ( pVA[iat].cNumValenceElectrons == 6 || pVA[iat].cPeriodicRowNumber == 7 ) &&
  ------------------
  |  Branch (1974:23): [True: 0, False: 0]
  |  Branch (1974:61): [True: 0, False: 0]
  ------------------
 1975|      5|                     atfMobile_H_Revrs && atfMobile_H_Revrs[iat].charge == 1 &&
  ------------------
  |  Branch (1975:22): [True: 0, False: 0]
  |  Branch (1975:43): [True: 0, False: 0]
  ------------------
 1976|      5|                     0 <= ( e = pVA[iat].nCPlusGroupEdge - 1 ) && !pBNS->edge[e].forbidden && !pBNS->edge[e].flow &&
  ------------------
  |  Branch (1976:22): [True: 0, False: 0]
  |  Branch (1976:67): [True: 0, False: 0]
  |  Branch (1976:95): [True: 0, False: 0]
  ------------------
 1977|      5|                     ( ret = AddToEdgeList( &CurChargeEdges, e, INC_ADD_EDGE ) ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1977:22): [True: 0, False: 0]
  ------------------
 1978|      0|                {
 1979|      0|                    goto exit_case_06b;
 1980|      0|                }
 1981|      5|            }
 1982|      5|        }
 1983|      1|        if (num_try = inchi_min( CurrEdges.num_edges, CurChargeEdges.num_edges ))
  ------------------
  |  |  167|      1|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (1983:13): [True: 0, False: 1]
  ------------------
 1984|      0|        {
 1985|       |            /* detected; attempt to fix */
 1986|      0|            int bSFlowerEdgesMayBeForbidden = ( SFlowerEdges.num_edges > 0 );
 1987|      0|            int bSFlowerEdgesIsForbidden;
 1988|      0|            for (bSFlowerEdgesIsForbidden = bSFlowerEdgesMayBeForbidden;
 1989|      0|                  0 <= bSFlowerEdgesIsForbidden; bSFlowerEdgesIsForbidden--)
  ------------------
  |  Branch (1989:19): [True: 0, False: 0]
  ------------------
 1990|      0|            {
 1991|      0|                if (bSFlowerEdgesIsForbidden)
  ------------------
  |  Branch (1991:21): [True: 0, False: 0]
  ------------------
 1992|      0|                {
 1993|       |                    /* on the 1st pass disallow -S(+)= => =S=, allow only -S(+)= => -S- */
 1994|      0|                    SetForbiddenEdgeMask( pBNS, &SFlowerEdges, forbidden_edge_mask );
 1995|      0|                }
 1996|      0|                SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 1997|      0|                RemoveForbiddenEdgeMask( pBNS, &CurChargeEdges, forbidden_edge_mask );
 1998|      0|                delta = 1;
 1999|      0|                for (i = 0; i < CurrEdges.num_edges && cur_success < num_try; i++)
  ------------------
  |  Branch (1999:29): [True: 0, False: 0]
  |  Branch (1999:56): [True: 0, False: 0]
  ------------------
 2000|      0|                {
 2001|      0|                    e = CurrEdges.pnEdges[i];
 2002|      0|                    pe = pBNS->edge + e; /* (+)charge edge of -NH- or -OH */
 2003|      0|                    if (!pe->flow)
  ------------------
  |  Branch (2003:25): [True: 0, False: 0]
  ------------------
 2004|      0|                        continue;
 2005|      0|                    pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 2006|      0|                    pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 2007|       |
 2008|      0|                    pe->flow -= delta; /* add (+) to -NHm */
 2009|      0|                    pv1->st_edge.flow -= delta;
 2010|      0|                    pv2->st_edge.flow -= delta;
 2011|      0|                    pBNS->tot_st_flow -= 2 * delta;
 2012|       |
 2013|      0|                    ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 2014|      0|                                          &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 2015|       |
 2016|      0|                    if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (2016:25): [True: 0, False: 0]
  |  Branch (2016:39): [True: 0, False: 0]
  |  Branch (2016:57): [True: 0, False: 0]
  ------------------
 2017|      0|                                      vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == -1)
  ------------------
  |  Branch (2017:39): [True: 0, False: 0]
  |  Branch (2017:57): [True: 0, False: 0]
  |  Branch (2017:79): [True: 0, False: 0]
  ------------------
 2018|      0|                    {
 2019|       |                        /* Removed (+)charge from -NH- => nDeltaCharge == -1 */
 2020|       |                        /* Flow change on pe (+)charge edge (atom NHm(+)) is not known to RunBnsTestOnce()) */
 2021|      0|                        ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 2022|      0|                        if (ret > 0)
  ------------------
  |  Branch (2022:29): [True: 0, False: 0]
  ------------------
 2023|      0|                        {
 2024|      0|                            nNumRunBNS++;
 2025|      0|                            cur_success++; /* 06b */
 2026|      0|                        }
 2027|      0|                    }
 2028|      0|                    else
 2029|      0|                    {
 2030|      0|                        pe->flow += delta;
 2031|      0|                        pv1->st_edge.flow += delta;
 2032|      0|                        pv2->st_edge.flow += delta;
 2033|      0|                        pBNS->tot_st_flow += 2 * delta;
 2034|      0|                    }
 2035|      0|                    INCHI_HEAPCHK
 2036|      0|                }
 2037|      0|                RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 2038|      0|                RemoveForbiddenEdgeMask( pBNS, &SFlowerEdges, forbidden_edge_mask );
 2039|      0|            }
 2040|      0|        }
 2041|      1|    exit_case_06b:
 2042|      1|        CurrEdges.num_edges = 0; /* clear current edge list */
 2043|      1|        AllocEdgeList( &CurChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|      1|#define EDGE_LIST_FREE   (-2)
  ------------------
 2044|      1|        if (cur_success)
  ------------------
  |  Branch (2044:13): [True: 0, False: 1]
  ------------------
 2045|      0|        {
 2046|      0|            tot_succes += cur_success;
 2047|       |            /* recalculate InChI from the structure */
 2048|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (2048:17): [True: 0, False: 0]
  ------------------
 2049|      0|                                                            ppt_group_info, ppat_norm, ppat_prep ) ))
 2050|      0|            {
 2051|      0|                goto exit_function;
 2052|      0|            }
 2053|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (2053:17): [True: 0, False: 0]
  ------------------
 2054|      0|            {
 2055|      0|                goto exit_function;
 2056|      0|            }
 2057|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (2057:17): [True: 0, False: 0]
  |  Branch (2057:45): [True: 0, False: 0]
  ------------------
 2058|      0|            {
 2059|      0|                goto exit_function;  /* no fixed-H found */
 2060|      0|            }
 2061|      0|            if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (2061:17): [True: 0, False: 0]
  ------------------
 2062|      0|            {
 2063|      0|                goto exit_function;
 2064|      0|            }
 2065|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (2065:17): [True: 0, False: 0]
  ------------------
 2066|      0|            {
 2067|      0|                goto exit_function; /* nothing to do */
 2068|      0|            }
 2069|      0|        }
 2070|      1|    }
 2071|       |
 2072|      1|    if (pc2i->nNumTgInChI > 1 &&
  ------------------
  |  Branch (2072:9): [True: 0, False: 1]
  ------------------
 2073|      1|        ( pStruct->nNumRemovedProtonsMobHInChI > 0 || pStruct->ti.tni.nNumRemovedProtons > 0 ) &&
  ------------------
  |  Branch (2073:11): [True: 0, False: 0]
  |  Branch (2073:55): [True: 0, False: 0]
  ------------------
 2074|      1|         pStruct->fixed_H && pStruct->endpoint &&
  ------------------
  |  Branch (2074:10): [True: 0, False: 0]
  |  Branch (2074:30): [True: 0, False: 0]
  ------------------
 2075|      1|         pStruct->pOne_norm_data[TAUT_YES] && pStruct->pOne_norm_data[TAUT_YES]->at_fixed_bonds)
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                       pStruct->pOne_norm_data[TAUT_YES] && pStruct->pOne_norm_data[TAUT_YES]->at_fixed_bonds)
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2075:10): [True: 0, False: 0]
  |  Branch (2075:47): [True: 0, False: 0]
  ------------------
 2076|      0|    {
 2077|       |        /*----------------------------------------------------------*/
 2078|       |        /* case 06e:restored: XHn(+)=-AB-YHm  orig.: XHn-=AB=YHm(+) */
 2079|       |        /* FixH:               1          0           1      1      */
 2080|       |        /* MobH:               0          1           t      t      */
 2081|       |        /*                   non-taut atoms       multiple t-groups */
 2082|       |        /*                                                          */
 2083|       |        /* 1. orig. t-group has more H on its endpoints counted     */
 2084|       |        /*          in atf and has no (+) on endpoint that has H    */
 2085|       |        /* 2. orig. t-group has less H on its endpoints counted     */
 2086|       |        /*          in atf and has (+) on endpoint that has H       */
 2087|       |        /*          in reconstructed struct and less H in atf       */
 2088|       |        /* Solution: move (+) from (2) to atom in (1) that has H    */
 2089|       |        /*                                                          */
 2090|       |        /*   tg1  reconstr:   XHn and more H than in orig t-group   */
 2091|       |        /*             atf:   XHn                                   */
 2092|       |        /*   tg2  reconstr:   XHm(+) and less H than in             */
 2093|       |        /*             atf:   XH(m-1)           orig in t-group     */
 2094|       |        /*                                                          */
 2095|       |        /* N  = N, O, S, Se; atoms N are not tautomeric             */
 2096|       |        /* X  = O, S, Se, Te, F, Cl, Br, I; atom X is not tautomeric*/
 2097|       |        /* Solution: move (+) from X  to NH                         */
 2098|       |        /*----------------------------------------------------------*/
 2099|       |
 2100|      0|        int iat, nNumWrongTg, jjoffs, jj, nNum2RemovePlus, nNum2AddPlus, nNum2MovePlus;
 2101|      0|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 2102|       |        /*
 2103|       |        inp_ATOM *at_Mobile_H_Revrs = (pStruct->pOne_norm_data[1] &&
 2104|       |        pStruct->pOne_norm_data[1]->at)? pStruct->pOne_norm_data[1]->at : NULL;
 2105|       |        */
 2106|      0|        inp_ATOM *atfMobile_H_Revrs = pStruct->pOne_norm_data[TAUT_YES] &&
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2106:39): [True: 0, False: 0]
  ------------------
 2107|      0|            pStruct->pOne_norm_data[TAUT_YES]->at_fixed_bonds ?
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2107:13): [True: 0, False: 0]
  ------------------
 2108|      0|            pStruct->pOne_norm_data[TAUT_YES]->at_fixed_bonds :
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2109|      0|            pStruct->pOne_norm_data[TAUT_YES] &&
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2109:13): [True: 0, False: 0]
  ------------------
 2110|      0|            pStruct->pOne_norm_data[TAUT_YES]->at ?
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2110:13): [True: 0, False: 0]
  ------------------
 2111|      0|            pStruct->pOne_norm_data[TAUT_YES]->at : NULL;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2112|       |        /*
 2113|       |        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H? pInChI[1]->nNum_H :
 2114|       |        pInChI[0] && pInChI[0]->nNum_H? pInChI[0]->nNum_H : 0;
 2115|       |        */
 2116|      0|        EDGE_LIST CurChargeEdges /* source of (+)*/, EndpList;
 2117|      0|        TgDiffHChgFH tdhc[MAX_DIFF_FIXH];
 2118|      0|        BNS_VERTEX *pv1n, *pv2n;
 2119|      0|        BNS_EDGE   *pe1n, *pe2n;
 2120|      0|        Vertex      v1n, v2n;
 2121|       |
 2122|      0|        cur_success = 0;
 2123|      0|        AllocEdgeList( &CurChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      0|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 2124|      0|        AllocEdgeList( &EndpList, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      0|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 2125|      0|        CurrEdges.num_edges = 0; /* receptors of (+) */
 2126|      0|        if (!atfMobile_H_Revrs)
  ------------------
  |  Branch (2126:13): [True: 0, False: 0]
  ------------------
 2127|      0|        {
 2128|      0|            goto exit_case_06e;
 2129|      0|        }
 2130|      0|        nNumWrongTg = FillTgDiffHChgFH( tdhc, MAX_DIFF_FIXH, at2, atfMobile_H_Revrs,
  ------------------
  |  |  484|      0|#define MAX_DIFF_FIXH 256
  ------------------
 2131|      0|                                        nCanon2AtnoRevrs, pVA, &pStruct->ti, &EndpList );
 2132|      0|        if (nNumWrongTg < 1)
  ------------------
  |  Branch (2132:13): [True: 0, False: 0]
  ------------------
 2133|      0|        {
 2134|      0|            goto exit_case_06e; /* for now only transfer (+) from one Mobile-H group to another */
 2135|      0|        }
 2136|      0|        nNum2RemovePlus = nNum2AddPlus = nNum2MovePlus = 0;
 2137|      0|        for (i = 0; i < nNumWrongTg; i++)
  ------------------
  |  Branch (2137:21): [True: 0, False: 0]
  ------------------
 2138|      0|        {
 2139|       |            /* detect t-group that has extra (+) on H */
 2140|      0|            if (tdhc[i].nNumHInchi > tdhc[i].nNumHNorml &&
  ------------------
  |  Branch (2140:17): [True: 0, False: 0]
  ------------------
 2141|      0|                 tdhc[i].nNumPRevrs > tdhc[i].nNumPNorml && tdhc[i].n[fNumRPosChgH])
  ------------------
  |  |   51|      0|#define fNumRPosChgH 0 /* number of positive charges on endpoints that have H in at2[] */
  ------------------
  |  Branch (2141:18): [True: 0, False: 0]
  |  Branch (2141:61): [True: 0, False: 0]
  ------------------
 2142|      0|            {
 2143|       |                /* count how many (+) to remove */
 2144|       |                /* store XH(+) atom numbers */
 2145|      0|                int nNumNeeded = inchi_min( tdhc[i].nNumHInchi - tdhc[i].nNumHNorml, tdhc[i].n[fNumRPosChgH] );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2146|      0|                nNum2RemovePlus += nNumNeeded;
 2147|      0|                jjoffs = tdhc[i].i[fNumRPosChgH];
  ------------------
  |  |   51|      0|#define fNumRPosChgH 0 /* number of positive charges on endpoints that have H in at2[] */
  ------------------
 2148|      0|                for (jj = 0; jj < tdhc[i].n[fNumRPosChgH]; jj++)
  ------------------
  |  |   51|      0|#define fNumRPosChgH 0 /* number of positive charges on endpoints that have H in at2[] */
  ------------------
  |  Branch (2148:30): [True: 0, False: 0]
  ------------------
 2149|      0|                {
 2150|      0|                    iat = EndpList.pnEdges[jjoffs + jj];
 2151|      0|                    e = pVA[iat].nCPlusGroupEdge - 1;
 2152|      0|                    if (ret = AddToEdgeList( &CurChargeEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (2152:25): [True: 0, False: 0]
  ------------------
 2153|      0|                    {
 2154|      0|                        goto exit_case_06e;
 2155|      0|                    }
 2156|      0|                }
 2157|      0|            }
 2158|      0|            else
 2159|      0|            {
 2160|       |                /* detect t-group that needs (+) on XH to reduce number of H */
 2161|      0|                if (tdhc[i].nNumHInchi < tdhc[i].nNumHNorml && tdhc[i].n[fNumRNeutrlH])
  ------------------
  |  |   55|      0|#define fNumRNeutrlH 4 /* number of neutral endp that have H in at2[] */
  ------------------
  |  Branch (2161:21): [True: 0, False: 0]
  |  Branch (2161:64): [True: 0, False: 0]
  ------------------
 2162|      0|                {
 2163|       |                    /* store XH atom numbers */
 2164|      0|                    int nNumNeeded = inchi_min( tdhc[i].nNumHNorml - tdhc[i].nNumHInchi, tdhc[i].n[fNumRNeutrlH] );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2165|      0|                    nNum2AddPlus += nNumNeeded;
 2166|      0|                    jjoffs = tdhc[i].i[fNumRNeutrlH];
  ------------------
  |  |   55|      0|#define fNumRNeutrlH 4 /* number of neutral endp that have H in at2[] */
  ------------------
 2167|      0|                    for (jj = 0; jj < tdhc[i].n[fNumRNeutrlH]; jj++)
  ------------------
  |  |   55|      0|#define fNumRNeutrlH 4 /* number of neutral endp that have H in at2[] */
  ------------------
  |  Branch (2167:34): [True: 0, False: 0]
  ------------------
 2168|      0|                    {
 2169|      0|                        iat = EndpList.pnEdges[jjoffs + jj];
 2170|      0|                        e = pVA[iat].nCPlusGroupEdge - 1;
 2171|      0|                        if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (2171:29): [True: 0, False: 0]
  ------------------
 2172|      0|                        {
 2173|      0|                            goto exit_case_06e;
 2174|      0|                        }
 2175|      0|                    }
 2176|      0|                }
 2177|      0|            }
 2178|      0|        }
 2179|      0|        nNum2MovePlus = inchi_min( nNum2RemovePlus, nNum2AddPlus );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2180|      0|        if (CurrEdges.num_edges > 0 && CurChargeEdges.num_edges > 0)
  ------------------
  |  Branch (2180:13): [True: 0, False: 0]
  |  Branch (2180:40): [True: 0, False: 0]
  ------------------
 2181|      0|        {
 2182|      0|            for (i = 0; 0 < nNum2MovePlus && i < nNumWrongTg; i++)
  ------------------
  |  Branch (2182:25): [True: 0, False: 0]
  |  Branch (2182:46): [True: 0, False: 0]
  ------------------
 2183|      0|            {
 2184|       |                /* detect t-group that has extra (+) on H */
 2185|      0|                if (tdhc[i].nNumHInchi > tdhc[i].nNumHNorml &&
  ------------------
  |  Branch (2185:21): [True: 0, False: 0]
  ------------------
 2186|      0|                     tdhc[i].nNumPRevrs > tdhc[i].nNumPNorml && tdhc[i].n[fNumRPosChgH])
  ------------------
  |  |   51|      0|#define fNumRPosChgH 0 /* number of positive charges on endpoints that have H in at2[] */
  ------------------
  |  Branch (2186:22): [True: 0, False: 0]
  |  Branch (2186:65): [True: 0, False: 0]
  ------------------
 2187|      0|                {
 2188|      0|                    int nNum2Remove = tdhc[i].nNumHInchi - tdhc[i].nNumHNorml;
 2189|      0|                    if (nNum2Remove < tdhc[i].n[fNumRPosChgH])
  ------------------
  |  |   51|      0|#define fNumRPosChgH 0 /* number of positive charges on endpoints that have H in at2[] */
  ------------------
  |  Branch (2189:25): [True: 0, False: 0]
  ------------------
 2190|      0|                    {
 2191|      0|                        nNum2Remove = tdhc[i].n[fNumRPosChgH];
  ------------------
  |  |   51|      0|#define fNumRPosChgH 0 /* number of positive charges on endpoints that have H in at2[] */
  ------------------
 2192|      0|                    }
 2193|       |                    /* store XH(+) atom numbers */
 2194|      0|                    jjoffs = tdhc[i].i[fNumRPosChgH];
  ------------------
  |  |   51|      0|#define fNumRPosChgH 0 /* number of positive charges on endpoints that have H in at2[] */
  ------------------
 2195|      0|                    SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 2196|      0|                    RemoveForbiddenEdgeMask( pBNS, &CurrEdges, forbidden_edge_mask );
 2197|      0|                    for (jj = 0; 0 < nNum2MovePlus && 0 < nNum2Remove && jj < tdhc[i].n[fNumRPosChgH]; jj++)
  ------------------
  |  |   51|      0|#define fNumRPosChgH 0 /* number of positive charges on endpoints that have H in at2[] */
  ------------------
  |  Branch (2197:34): [True: 0, False: 0]
  |  Branch (2197:55): [True: 0, False: 0]
  |  Branch (2197:74): [True: 0, False: 0]
  ------------------
 2198|      0|                    {
 2199|      0|                        iat = EndpList.pnEdges[jjoffs + jj];
 2200|      0|                        e = pVA[iat].nCPlusGroupEdge - 1;
 2201|      0|                        pe = pBNS->edge + pVA[iat].nCPlusGroupEdge - 1;
 2202|      0|                        if (pe->flow)
  ------------------
  |  Branch (2202:29): [True: 0, False: 0]
  ------------------
 2203|      0|                            continue;
 2204|      0|                        pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 2205|      0|                        pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 2206|       |
 2207|      0|                        for (j = pv1->num_adj_edges - 1; 0 <= j; j--)
  ------------------
  |  Branch (2207:58): [True: 0, False: 0]
  ------------------
 2208|      0|                        {
 2209|      0|                            pe1n = pBNS->edge + pv1->iedge[j];
 2210|      0|                            if (pe1n->flow && !pe1n->forbidden)
  ------------------
  |  Branch (2210:33): [True: 0, False: 0]
  |  Branch (2210:47): [True: 0, False: 0]
  ------------------
 2211|      0|                            {
 2212|      0|                                pv1n = pBNS->vert + ( v1n = pe1n->neighbor12 ^ v1 );
 2213|      0|                                break;
 2214|      0|                            }
 2215|      0|                        }
 2216|      0|                        if (j < 0)
  ------------------
  |  Branch (2216:29): [True: 0, False: 0]
  ------------------
 2217|      0|                        {
 2218|      0|                            continue; /* not found */
 2219|      0|                        }
 2220|      0|                        for (j = pv2->num_adj_edges - 2; 0 <= j; j--)
  ------------------
  |  Branch (2220:58): [True: 0, False: 0]
  ------------------
 2221|      0|                        {
 2222|      0|                            pe2n = pBNS->edge + pv2->iedge[j];
 2223|      0|                            if (pe2n->flow && !pe2n->forbidden)
  ------------------
  |  Branch (2223:33): [True: 0, False: 0]
  |  Branch (2223:47): [True: 0, False: 0]
  ------------------
 2224|      0|                            {
 2225|      0|                                pv2n = pBNS->vert + ( v2n = pe2n->neighbor12 ^ v2 );
 2226|      0|                                break;
 2227|      0|                            }
 2228|      0|                        }
 2229|      0|                        if (j < 0)
  ------------------
  |  Branch (2229:29): [True: 0, False: 0]
  ------------------
 2230|      0|                        {
 2231|      0|                            continue; /* not found */
 2232|      0|                        }
 2233|      0|                        delta = 1;
 2234|      0|                        pe->flow += delta;
 2235|      0|                        pe1n->flow -= delta;
 2236|      0|                        pe2n->flow -= delta;
 2237|      0|                        pv1n->st_edge.flow -= delta;
 2238|      0|                        pv2n->st_edge.flow -= delta;
 2239|      0|                        pBNS->tot_st_flow -= 2 * delta;
 2240|       |
 2241|      0|                        ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 2242|      0|                                              &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 2243|       |
 2244|      0|                        if (ret == 1 && ( vPathEnd == v1n && vPathStart == v2n ||
  ------------------
  |  Branch (2244:29): [True: 0, False: 0]
  |  Branch (2244:43): [True: 0, False: 0]
  |  Branch (2244:62): [True: 0, False: 0]
  ------------------
 2245|      0|                                          vPathEnd == v2n && vPathStart == v1n ) &&
  ------------------
  |  Branch (2245:43): [True: 0, False: 0]
  |  Branch (2245:62): [True: 0, False: 0]
  ------------------
 2246|      0|                                          ( nDeltaCharge == 0 || nDeltaCharge == 1 ))
  ------------------
  |  Branch (2246:45): [True: 0, False: 0]
  |  Branch (2246:66): [True: 0, False: 0]
  ------------------
 2247|      0|                        {
 2248|      0|                            ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 2249|      0|                            if (ret > 0)
  ------------------
  |  Branch (2249:33): [True: 0, False: 0]
  ------------------
 2250|      0|                            {
 2251|      0|                                nNumRunBNS++;
 2252|      0|                                nNum2Remove--;
 2253|      0|                                nNum2MovePlus--;
 2254|      0|                                cur_success++; /* 06e */
 2255|      0|                            }
 2256|      0|                        }
 2257|      0|                        else
 2258|      0|                        {
 2259|      0|                            pe->flow -= delta;
 2260|      0|                            pe1n->flow += delta;
 2261|      0|                            pe2n->flow += delta;
 2262|      0|                            pv1n->st_edge.flow += delta;
 2263|      0|                            pv2n->st_edge.flow += delta;
 2264|      0|                            pBNS->tot_st_flow += 2 * delta;
 2265|      0|                        }
 2266|      0|                        if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (2266:29): [True: 0, False: 0]
  ------------------
 2267|      0|                        {
 2268|      0|                            goto exit_case_06e;
 2269|      0|                        }
 2270|      0|                    }
 2271|      0|                    RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 2272|      0|                }
 2273|      0|            }
 2274|      0|        }
 2275|      0|    exit_case_06e:
 2276|      0|        CurrEdges.num_edges = 0; /* clear current edge list */
 2277|      0|        AllocEdgeList( &CurChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|      0|#define EDGE_LIST_FREE   (-2)
  ------------------
 2278|      0|        AllocEdgeList( &EndpList, EDGE_LIST_FREE );
  ------------------
  |  |  271|      0|#define EDGE_LIST_FREE   (-2)
  ------------------
 2279|      0|        if (cur_success)
  ------------------
  |  Branch (2279:13): [True: 0, False: 0]
  ------------------
 2280|      0|        {
 2281|      0|            tot_succes += cur_success;
 2282|       |            /* recalculate InChI from the structure */
 2283|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (2283:17): [True: 0, False: 0]
  ------------------
 2284|      0|                                                            ppt_group_info, ppat_norm, ppat_prep ) ))
 2285|      0|            {
 2286|      0|                goto exit_function;
 2287|      0|            }
 2288|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (2288:17): [True: 0, False: 0]
  ------------------
 2289|      0|            {
 2290|      0|                goto exit_function;
 2291|      0|            }
 2292|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (2292:17): [True: 0, False: 0]
  |  Branch (2292:45): [True: 0, False: 0]
  ------------------
 2293|      0|            {
 2294|      0|                goto exit_function;  /* no fixed-H found */
 2295|      0|            }
 2296|      0|            if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (2296:17): [True: 0, False: 0]
  ------------------
 2297|      0|            {
 2298|      0|                goto exit_function;
 2299|      0|            }
 2300|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (2300:17): [True: 0, False: 0]
  ------------------
 2301|      0|            {
 2302|      0|                goto exit_function; /* nothing to do */
 2303|      0|            }
 2304|      0|        }
 2305|      0|    }
 2306|       |
 2307|      1|    if (pc2i->len_c2at >= 1)
  ------------------
  |  Branch (2307:9): [True: 1, False: 0]
  ------------------
 2308|      1|    {
 2309|       |        /*--------------------------------------------------------------*/
 2310|       |        /* case 07: restored:  O(-)-AB=O  original:  O=AB-O(-)          */
 2311|       |        /* FixH:               0       0             0     -1           */
 2312|       |        /* MobH:               0       0             0      1           */
 2313|       |        /*                    taut  (non-taut)     (taut) non-taut      */
 2314|       |        /*                    taut  (taut)     (non-taut) non-taut      */
 2315|       |        /* O = O, S, Se, Te                                             */
 2316|       |        /* Solution: move (-) from O(-)-AB to AB=O                      */
 2317|       |        /*--------------------------------------------------------------*/
 2318|      1|        int num_SB_O_Minus = 0, num_DB_O_Neutr = 0, iat;
 2319|      1|        short iat_SB_O_Minus[MAX_DIFF_FIXH], iat_DB_O_Neutr[MAX_DIFF_FIXH];
 2320|      1|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 2321|      1|        inp_ATOM *at_Mobile_H_Revrs = ( pStruct->pOne_norm_data[1] &&
  ------------------
  |  Branch (2321:41): [True: 1, False: 0]
  ------------------
 2322|      1|                                        pStruct->pOne_norm_data[1]->at ) ? pStruct->pOne_norm_data[1]->at : NULL;
  ------------------
  |  Branch (2322:41): [True: 1, False: 0]
  ------------------
 2323|      1|        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H ? pInChI[1]->nNum_H :
  ------------------
  |  Branch (2323:32): [True: 1, False: 0]
  |  Branch (2323:45): [True: 1, False: 0]
  ------------------
 2324|      1|            pInChI[0] && pInChI[0]->nNum_H ? pInChI[0]->nNum_H : 0;
  ------------------
  |  Branch (2324:13): [True: 0, False: 0]
  |  Branch (2324:26): [True: 0, False: 0]
  ------------------
 2325|      1|        cur_success = 0;
 2326|      3|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (2326:21): [True: 2, False: 1]
  ------------------
 2327|      2|        {
 2328|      2|            iat = pc2i->c2at[i].atomNumber;
 2329|      2|            if ( /* orig. InChI info: -O(-), non-taut */
 2330|      2|                 num_DB_O_Neutr < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|      4|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (2330:18): [True: 2, False: 0]
  ------------------
 2331|      2|                 pc2i->c2at[i].nValElectr == 6 /* O, S, Se, Te */ &&
  ------------------
  |  Branch (2331:18): [True: 2, False: 0]
  ------------------
 2332|      2|                 !pc2i->c2at[i].endptInChI &&
  ------------------
  |  Branch (2332:18): [True: 2, False: 0]
  ------------------
 2333|      2|                 ( e = pVA[iat].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (2333:18): [True: 2, False: 0]
  |  Branch (2333:64): [True: 2, False: 0]
  ------------------
 2334|      2|                 pc2i->c2at[i].nFixHInChI == -1 && pc2i->c2at[i].nMobHInChI == 1 &&
  ------------------
  |  Branch (2334:18): [True: 0, False: 2]
  |  Branch (2334:52): [True: 0, False: 0]
  ------------------
 2335|       |                 /* reversed structure info: */
 2336|      2|                 pc2i->c2at[i].nFixHRevrs == 0 && pc2i->c2at[i].nMobHRevrs == 0 &&
  ------------------
  |  Branch (2336:18): [True: 0, False: 0]
  |  Branch (2336:51): [True: 0, False: 0]
  ------------------
 2337|      2|                 pc2i->c2at[i].nAtChargeRevrs == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (2337:18): [True: 0, False: 0]
  |  Branch (2337:55): [True: 0, False: 0]
  ------------------
 2338|      2|                 at2[iat].valence < at2[iat].chem_bonds_valence)
  ------------------
  |  Branch (2338:18): [True: 0, False: 0]
  ------------------
 2339|      0|            {
 2340|      0|                iat_DB_O_Neutr[num_DB_O_Neutr++] = iat;
 2341|      0|                if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (2341:21): [True: 0, False: 0]
  ------------------
 2342|      0|                {
 2343|      0|                    goto exit_function;
 2344|      0|                }
 2345|      0|            }
 2346|      2|        }
 2347|      6|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (2347:21): [True: 5, False: 1]
  ------------------
 2348|      5|        {
 2349|       |            /* i = canonical number - 1 */
 2350|      5|            iat = nCanon2AtnoRevrs[i];
 2351|      5|            if ( /* in restored atom: charge=-1, no H, has single bond, O, S, Se, Te */
 2352|      5|                 num_SB_O_Minus < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|     10|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (2352:18): [True: 5, False: 0]
  ------------------
 2353|      5|                 at2[iat].charge == -1 && !at2[iat].num_H &&
  ------------------
  |  Branch (2353:18): [True: 3, False: 2]
  |  Branch (2353:43): [True: 3, False: 0]
  ------------------
 2354|      5|                 at2[iat].valence == at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (2354:18): [True: 2, False: 1]
  |  Branch (2354:69): [True: 2, False: 0]
  ------------------
 2355|      5|                 pVA[iat].cNumValenceElectrons == 6 &&
  ------------------
  |  Branch (2355:18): [True: 2, False: 0]
  ------------------
 2356|      5|                 at_Mobile_H_Revrs && at_Mobile_H_Revrs[iat].endpoint &&
  ------------------
  |  Branch (2356:18): [True: 2, False: 0]
  |  Branch (2356:39): [True: 2, False: 0]
  ------------------
 2357|       |                 /* in orig.InChI: not an endpoint, has no H */
 2358|       |                 /*pStruct->endpoint[i] && -- modificatuion#1 */
 2359|      5|                 !( pStruct->fixed_H && pStruct->fixed_H[i] ) &&
  ------------------
  |  Branch (2359:21): [True: 2, False: 0]
  |  Branch (2359:41): [True: 0, False: 2]
  ------------------
 2360|      5|                 !( nMobHInChI && nMobHInChI[i] ) &&
  ------------------
  |  Branch (2360:21): [True: 2, False: 0]
  |  Branch (2360:35): [True: 0, False: 2]
  ------------------
 2361|       |                 /* has (-) edge */
 2362|      5|                 ( e = pVA[iat].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (2362:18): [True: 2, False: 0]
  |  Branch (2362:64): [True: 2, False: 0]
  ------------------
 2363|      2|            {
 2364|      2|                iat_SB_O_Minus[num_SB_O_Minus++] = iat;
 2365|      2|                if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      2|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (2365:21): [True: 0, False: 2]
  ------------------
 2366|      0|                {
 2367|      0|                    goto exit_function;
 2368|      0|                }
 2369|      2|            }
 2370|      5|        }
 2371|      1|        if (num_try = inchi_min( num_SB_O_Minus, num_DB_O_Neutr ))
  ------------------
  |  |  167|      1|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (2371:13): [True: 0, False: 1]
  ------------------
 2372|      0|        {
 2373|       |            /* detected; attempt to fix */
 2374|      0|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 2375|      0|            RemoveForbiddenEdgeMask( pBNS, &CurrEdges, forbidden_edge_mask );
 2376|      0|            delta = 1;
 2377|      0|            for (i = 0; i < num_SB_O_Minus && cur_success < num_try; i++)
  ------------------
  |  Branch (2377:25): [True: 0, False: 0]
  |  Branch (2377:47): [True: 0, False: 0]
  ------------------
 2378|      0|            {
 2379|      0|                iat = iat_SB_O_Minus[i];
 2380|      0|                pe = pBNS->edge + pVA[iat].nCMinusGroupEdge - 1;
 2381|      0|                if (!pe->flow)
  ------------------
  |  Branch (2381:21): [True: 0, False: 0]
  ------------------
 2382|      0|                    continue;
 2383|      0|                pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 2384|      0|                pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 2385|       |
 2386|      0|                pe->forbidden |= forbidden_edge_mask;
 2387|      0|                pe->flow -= delta;
 2388|      0|                pv1->st_edge.flow -= delta;
 2389|      0|                pv2->st_edge.flow -= delta;
 2390|      0|                pBNS->tot_st_flow -= 2 * delta;
 2391|       |
 2392|      0|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 2393|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 2394|       |
 2395|      0|                if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (2395:21): [True: 0, False: 0]
  |  Branch (2395:35): [True: 0, False: 0]
  |  Branch (2395:53): [True: 0, False: 0]
  ------------------
 2396|      0|                                  vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == 1)
  ------------------
  |  Branch (2396:35): [True: 0, False: 0]
  |  Branch (2396:53): [True: 0, False: 0]
  |  Branch (2396:75): [True: 0, False: 0]
  ------------------
 2397|      0|                {
 2398|       |                    /* Moved (-) charge to AB=O => nDeltaCharge == 1 */
 2399|       |                    /* Flow change on pe (-)charge edge (O(-)-AB) is not known to RunBnsTestOnce()) */
 2400|      0|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 2401|      0|                    if (ret > 0)
  ------------------
  |  Branch (2401:25): [True: 0, False: 0]
  ------------------
 2402|      0|                    {
 2403|      0|                        nNumRunBNS++;
 2404|      0|                        cur_success++; /* 07 */
 2405|      0|                    }
 2406|      0|                }
 2407|      0|                else
 2408|      0|                {
 2409|      0|                    pe->forbidden &= forbidden_edge_mask_inv;
 2410|      0|                    pe->flow += delta;
 2411|      0|                    pv1->st_edge.flow += delta;
 2412|      0|                    pv2->st_edge.flow += delta;
 2413|      0|                    pBNS->tot_st_flow += 2 * delta;
 2414|      0|                }
 2415|      0|                INCHI_HEAPCHK
 2416|      0|            }
 2417|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 2418|      0|        }
 2419|      1|        CurrEdges.num_edges = 0; /* clear current edge list */
 2420|      1|        if (cur_success)
  ------------------
  |  Branch (2420:13): [True: 0, False: 1]
  ------------------
 2421|      0|        {
 2422|      0|            tot_succes += cur_success;
 2423|       |            /* recalculate InChI from the structure */
 2424|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (2424:17): [True: 0, False: 0]
  ------------------
 2425|      0|                                                            ppt_group_info, ppat_norm, ppat_prep ) ))
 2426|      0|            {
 2427|      0|                goto exit_function;
 2428|      0|            }
 2429|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (2429:17): [True: 0, False: 0]
  ------------------
 2430|      0|            {
 2431|      0|                goto exit_function;
 2432|      0|            }
 2433|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (2433:17): [True: 0, False: 0]
  |  Branch (2433:45): [True: 0, False: 0]
  ------------------
 2434|      0|            {
 2435|      0|                goto exit_function;  /* no fixed-H found */
 2436|      0|            }
 2437|      0|            if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (2437:17): [True: 0, False: 0]
  ------------------
 2438|      0|            {
 2439|      0|                goto exit_function;
 2440|      0|            }
 2441|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (2441:17): [True: 0, False: 0]
  ------------------
 2442|      0|            {
 2443|      0|                goto exit_function; /* nothing to do */
 2444|      0|            }
 2445|      0|        }
 2446|      1|    }
 2447|       |
 2448|      1|    if (pc2i->len_c2at >= 1)
  ------------------
  |  Branch (2448:9): [True: 1, False: 0]
  ------------------
 2449|      1|    {
 2450|       |        /*--------------------------------------------------------------*/
 2451|       |        /* case 07a: restored: O(-)-N(V)B=O  original:  O=N(V)B-O(-)    */
 2452|       |        /* FixH:               0          0             0      -1       */
 2453|       |        /* MobH:               0          0             0       1       */
 2454|       |        /*                non-taut  (non-taut)  non-taut  non-taut      */
 2455|       |        /*                non-taut  (taut)      non-taut  non-taut      */
 2456|       |        /* O = O, S, Se, Te                                             */
 2457|       |        /* Solution: move (-) from O(-)-AB to AB=O                      */
 2458|       |        /*--------------------------------------------------------------*/
 2459|      1|        int num_SB_O_Minus = 0, num_DB_O_Neutr = 0, iat, iN;
 2460|      1|        short iat_SB_O_Minus[MAX_DIFF_FIXH], iat_DB_O_Neutr[MAX_DIFF_FIXH];
 2461|      1|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 2462|      1|        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H ? pInChI[1]->nNum_H :
  ------------------
  |  Branch (2462:32): [True: 1, False: 0]
  |  Branch (2462:45): [True: 1, False: 0]
  ------------------
 2463|      1|            pInChI[0] && pInChI[0]->nNum_H ? pInChI[0]->nNum_H : 0;
  ------------------
  |  Branch (2463:13): [True: 0, False: 0]
  |  Branch (2463:26): [True: 0, False: 0]
  ------------------
 2464|      1|        cur_success = 0;
 2465|      3|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (2465:21): [True: 2, False: 1]
  ------------------
 2466|      2|        {
 2467|      2|            iat = pc2i->c2at[i].atomNumber;
 2468|      2|            if ( /* orig. InChI info: -O(-), non-taut */
 2469|      2|                 num_DB_O_Neutr < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|      4|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (2469:18): [True: 2, False: 0]
  ------------------
 2470|      2|                 pc2i->c2at[i].nValElectr == 6 /* O, S, Se, Te */ &&
  ------------------
  |  Branch (2470:18): [True: 2, False: 0]
  ------------------
 2471|      2|                 !pc2i->c2at[i].endptInChI &&
  ------------------
  |  Branch (2471:18): [True: 2, False: 0]
  ------------------
 2472|      2|                 ( e = pVA[iat].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (2472:18): [True: 2, False: 0]
  |  Branch (2472:64): [True: 2, False: 0]
  ------------------
 2473|      2|                 pc2i->c2at[i].nFixHInChI == -1 && pc2i->c2at[i].nMobHInChI == 1 &&
  ------------------
  |  Branch (2473:18): [True: 0, False: 2]
  |  Branch (2473:52): [True: 0, False: 0]
  ------------------
 2474|       |                 /* reversed structure info: */
 2475|      2|                 pc2i->c2at[i].nFixHRevrs == 0 && pc2i->c2at[i].nMobHRevrs == 0 &&
  ------------------
  |  Branch (2475:18): [True: 0, False: 0]
  |  Branch (2475:51): [True: 0, False: 0]
  ------------------
 2476|      2|                 pc2i->c2at[i].nAtChargeRevrs == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (2476:18): [True: 0, False: 0]
  |  Branch (2476:55): [True: 0, False: 0]
  ------------------
 2477|      2|                 at2[iat].valence < at2[iat].chem_bonds_valence)
  ------------------
  |  Branch (2477:18): [True: 0, False: 0]
  ------------------
 2478|      0|            {
 2479|      0|                iat_DB_O_Neutr[num_DB_O_Neutr++] = iat;
 2480|      0|                if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (2480:21): [True: 0, False: 0]
  ------------------
 2481|      0|                {
 2482|      0|                    goto exit_function;
 2483|      0|                }
 2484|      0|            }
 2485|      2|        }
 2486|      6|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (2486:21): [True: 5, False: 1]
  ------------------
 2487|      5|        {
 2488|       |            /* i = canonical number - 1 */
 2489|      5|            iat = nCanon2AtnoRevrs[i];
 2490|      5|            if ( /* in restored atom: charge=-1, no H, has single bond, O, S, Se, Te */
 2491|      5|                 num_SB_O_Minus < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|     10|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (2491:18): [True: 5, False: 0]
  ------------------
 2492|      5|                 at2[iat].charge == -1 && !at2[iat].num_H &&
  ------------------
  |  Branch (2492:18): [True: 3, False: 2]
  |  Branch (2492:43): [True: 3, False: 0]
  ------------------
 2493|      5|                 at2[iat].valence == at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (2493:18): [True: 2, False: 1]
  |  Branch (2493:69): [True: 2, False: 0]
  ------------------
 2494|      5|                 pVA[iat].cNumValenceElectrons == 6 &&
  ------------------
  |  Branch (2494:18): [True: 2, False: 0]
  ------------------
 2495|       |                 /*at_Mobile_H_Revrs && !at_Mobile_H_Revrs[iat].endpoint &&*/
 2496|       |                 /* in orig.InChI: not an endpoint, has no H */
 2497|      5|                 !pStruct->endpoint[i] &&
  ------------------
  |  Branch (2497:18): [True: 2, False: 0]
  ------------------
 2498|      5|                 !( pStruct->fixed_H && pStruct->fixed_H[i] ) &&
  ------------------
  |  Branch (2498:21): [True: 2, False: 0]
  |  Branch (2498:41): [True: 0, False: 2]
  ------------------
 2499|      5|                 !( nMobHInChI && nMobHInChI[i] ) &&
  ------------------
  |  Branch (2499:21): [True: 2, False: 0]
  |  Branch (2499:35): [True: 0, False: 2]
  ------------------
 2500|       |                 /* has N(V) neighbor */
 2501|      5|                 1 == at2[iat].valence && at2[iN = at2[iat].neighbor[0]].chem_bonds_valence == 5 &&
  ------------------
  |  Branch (2501:18): [True: 2, False: 0]
  |  Branch (2501:43): [True: 0, False: 2]
  ------------------
 2502|      5|                 !at2[iN].charge && pVA[iN].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (2502:18): [True: 0, False: 0]
  |  Branch (2502:37): [True: 0, False: 0]
  ------------------
 2503|       |                 /* has (-) edge */
 2504|      5|                 ( e = pVA[iat].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (2504:18): [True: 0, False: 0]
  |  Branch (2504:64): [True: 0, False: 0]
  ------------------
 2505|      0|            {
 2506|      0|                iat_SB_O_Minus[num_SB_O_Minus++] = iat;
 2507|      0|                if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (2507:21): [True: 0, False: 0]
  ------------------
 2508|      0|                {
 2509|      0|                    goto exit_function;
 2510|      0|                }
 2511|      0|            }
 2512|      5|        }
 2513|      1|        if (num_try = inchi_min( num_SB_O_Minus, num_DB_O_Neutr ))
  ------------------
  |  |  167|      1|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (2513:13): [True: 0, False: 1]
  ------------------
 2514|      0|        {
 2515|       |            /* detected; attempt to fix */
 2516|      0|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 2517|      0|            RemoveForbiddenEdgeMask( pBNS, &CurrEdges, forbidden_edge_mask );
 2518|      0|            delta = 1;
 2519|      0|            for (i = 0; i < num_SB_O_Minus && cur_success < num_try; i++)
  ------------------
  |  Branch (2519:25): [True: 0, False: 0]
  |  Branch (2519:47): [True: 0, False: 0]
  ------------------
 2520|      0|            {
 2521|      0|                iat = iat_SB_O_Minus[i];
 2522|      0|                pe = pBNS->edge + pVA[iat].nCMinusGroupEdge - 1;
 2523|      0|                if (!pe->flow)
  ------------------
  |  Branch (2523:21): [True: 0, False: 0]
  ------------------
 2524|      0|                    continue;
 2525|      0|                pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 2526|      0|                pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 2527|       |
 2528|      0|                pe->forbidden |= forbidden_edge_mask;
 2529|      0|                pe->flow -= delta;
 2530|      0|                pv1->st_edge.flow -= delta;
 2531|      0|                pv2->st_edge.flow -= delta;
 2532|      0|                pBNS->tot_st_flow -= 2 * delta;
 2533|       |
 2534|      0|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 2535|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 2536|       |
 2537|      0|                if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (2537:21): [True: 0, False: 0]
  |  Branch (2537:35): [True: 0, False: 0]
  |  Branch (2537:53): [True: 0, False: 0]
  ------------------
 2538|      0|                                  vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == 1)
  ------------------
  |  Branch (2538:35): [True: 0, False: 0]
  |  Branch (2538:53): [True: 0, False: 0]
  |  Branch (2538:75): [True: 0, False: 0]
  ------------------
 2539|      0|                {
 2540|       |                    /* Moved (-) charge to AB=O => nDeltaCharge == 1 */
 2541|       |                    /* Flow change on pe (-)charge edge (O(-)-AB) is not known to RunBnsTestOnce()) */
 2542|      0|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 2543|      0|                    if (ret > 0)
  ------------------
  |  Branch (2543:25): [True: 0, False: 0]
  ------------------
 2544|      0|                    {
 2545|      0|                        nNumRunBNS++;
 2546|      0|                        cur_success++; /* 07 */
 2547|      0|                    }
 2548|      0|                }
 2549|      0|                else
 2550|      0|                {
 2551|      0|                    pe->forbidden &= forbidden_edge_mask_inv;
 2552|      0|                    pe->flow += delta;
 2553|      0|                    pv1->st_edge.flow += delta;
 2554|      0|                    pv2->st_edge.flow += delta;
 2555|      0|                    pBNS->tot_st_flow += 2 * delta;
 2556|      0|                }
 2557|      0|                INCHI_HEAPCHK
 2558|      0|            }
 2559|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 2560|      0|        }
 2561|      1|        CurrEdges.num_edges = 0; /* clear current edge list */
 2562|      1|        if (cur_success)
  ------------------
  |  Branch (2562:13): [True: 0, False: 1]
  ------------------
 2563|      0|        {
 2564|      0|            tot_succes += cur_success;
 2565|       |            /* recalculate InChI from the structure */
 2566|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (2566:17): [True: 0, False: 0]
  ------------------
 2567|      0|                                                            ppt_group_info, ppat_norm, ppat_prep ) ))
 2568|      0|            {
 2569|      0|                goto exit_function;
 2570|      0|            }
 2571|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (2571:17): [True: 0, False: 0]
  ------------------
 2572|      0|            {
 2573|      0|                goto exit_function;
 2574|      0|            }
 2575|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (2575:17): [True: 0, False: 0]
  |  Branch (2575:45): [True: 0, False: 0]
  ------------------
 2576|      0|            {
 2577|      0|                goto exit_function;  /* no fixed-H found */
 2578|      0|            }
 2579|      0|            if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (2579:17): [True: 0, False: 0]
  ------------------
 2580|      0|            {
 2581|      0|                goto exit_function;
 2582|      0|            }
 2583|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (2583:17): [True: 0, False: 0]
  ------------------
 2584|      0|            {
 2585|      0|                goto exit_function; /* nothing to do */
 2586|      0|            }
 2587|      0|        }
 2588|      1|    }
 2589|      1|    if ( /*(pc2i->len_c2at >= 1 || pc2i->nNumRemHRevrs) &&*/ pc2i->nNumTgInChI == 1 && /* ADP in InChI */
  ------------------
  |  Branch (2589:62): [True: 0, False: 1]
  ------------------
 2590|      1|        ( pc2i->nNumEndpRevrs < pc2i->nNumEndpInChI || pc2i->nNumTgRevrs > 1 ))
  ------------------
  |  Branch (2590:11): [True: 0, False: 0]
  |  Branch (2590:56): [True: 0, False: 0]
  ------------------
 2591|      0|    {
 2592|       |        /*----------------------------------------------------------------*/
 2593|       |        /* case 08: restored: O(-)-AB=N- OH- orig.   O=AB-N(-)- OH-       */
 2594|       |        /* FixH:               1      0   0          0      0   1         */
 2595|       |        /* MobH:               0      0   1          0      0   0         */
 2596|       |        /*           may be taut or not  non-taut   taut  taut taut       */
 2597|       |        /*                                    ADP: one t-group or more endpoints */
 2598|       |        /* O(-) = S, Se, Te; N = N;                                       */
 2599|       |        /* Solution: move (-) from O(-) to =N-; avoid stereogenic DB on N */
 2600|       |        /*----------------------------------------------------------------*/
 2601|      0|        int num_DB_N_Neutr = 0, num_SB_O_Minus = 0, iat;
 2602|      0|        short iat_DB_N_Neutr[MAX_DIFF_FIXH], iat_SB_O_Minus[MAX_DIFF_FIXH];
 2603|      0|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 2604|      0|        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H ? pInChI[1]->nNum_H :
  ------------------
  |  Branch (2604:32): [True: 0, False: 0]
  |  Branch (2604:45): [True: 0, False: 0]
  ------------------
 2605|      0|            pInChI[0] && pInChI[0]->nNum_H ? pInChI[0]->nNum_H : 0;
  ------------------
  |  Branch (2605:13): [True: 0, False: 0]
  |  Branch (2605:26): [True: 0, False: 0]
  ------------------
 2606|      0|        cur_success = 0;
 2607|      0|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (2607:21): [True: 0, False: 0]
  ------------------
 2608|      0|        {
 2609|       |            /* i = canonical number - 1 */
 2610|      0|            iat = nCanon2AtnoRevrs[i];
 2611|      0|            if ( /* in restored atom: charge=-1, has no H, has single bond, O, S, Se, Te */
 2612|      0|                 num_SB_O_Minus < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|      0|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (2612:18): [True: 0, False: 0]
  ------------------
 2613|      0|                 at2[iat].charge == -1 && !at2[iat].num_H &&
  ------------------
  |  Branch (2613:18): [True: 0, False: 0]
  |  Branch (2613:43): [True: 0, False: 0]
  ------------------
 2614|      0|                 at2[iat].valence == at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (2614:18): [True: 0, False: 0]
  |  Branch (2614:69): [True: 0, False: 0]
  ------------------
 2615|      0|                 pVA[iat].cNumValenceElectrons == 6 &&
  ------------------
  |  Branch (2615:18): [True: 0, False: 0]
  ------------------
 2616|       |                 /* in orig.InChI: an endpoint, may have fixed-H */
 2617|      0|                 pStruct->endpoint[i] &&
  ------------------
  |  Branch (2617:18): [True: 0, False: 0]
  ------------------
 2618|       |                 /*!(pStruct->fixed_H && pStruct->fixed_H[i]) &&*/
 2619|      0|                 !( nMobHInChI && nMobHInChI[i] ) &&
  ------------------
  |  Branch (2619:21): [True: 0, False: 0]
  |  Branch (2619:35): [True: 0, False: 0]
  ------------------
 2620|       |                 /* has (-) edge */
 2621|      0|                 ( e = pVA[iat].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (2621:18): [True: 0, False: 0]
  |  Branch (2621:64): [True: 0, False: 0]
  ------------------
 2622|      0|            {
 2623|       |
 2624|      0|                iat_SB_O_Minus[num_SB_O_Minus++] = iat;
 2625|       |
 2626|      0|                if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (2626:21): [True: 0, False: 0]
  ------------------
 2627|      0|                {
 2628|      0|                    goto exit_function;
 2629|      0|                }
 2630|      0|            }
 2631|      0|            else
 2632|      0|            {
 2633|      0|                if ( /* in restored atom: charge=0, has no H, has double non-stereogenic bond, N */
 2634|      0|                     num_DB_N_Neutr < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|      0|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (2634:22): [True: 0, False: 0]
  ------------------
 2635|      0|                     at2[iat].charge == 0 && !at2[iat].num_H && !at2[iat].sb_parity[0] &&
  ------------------
  |  Branch (2635:22): [True: 0, False: 0]
  |  Branch (2635:46): [True: 0, False: 0]
  |  Branch (2635:65): [True: 0, False: 0]
  ------------------
 2636|      0|                     at2[iat].valence < at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (2636:22): [True: 0, False: 0]
  |  Branch (2636:72): [True: 0, False: 0]
  ------------------
 2637|      0|                     pVA[iat].cNumValenceElectrons == 5 && pVA[iat].cPeriodicRowNumber == 1 &&
  ------------------
  |  Branch (2637:22): [True: 0, False: 0]
  |  Branch (2637:60): [True: 0, False: 0]
  ------------------
 2638|       |                     /* in orig.InChI: an endpoint, has no fixed-H */
 2639|      0|                     pStruct->endpoint[i] &&
  ------------------
  |  Branch (2639:22): [True: 0, False: 0]
  ------------------
 2640|      0|                     !( pStruct->fixed_H && pStruct->fixed_H[i] ) &&
  ------------------
  |  Branch (2640:25): [True: 0, False: 0]
  |  Branch (2640:45): [True: 0, False: 0]
  ------------------
 2641|      0|                     !( nMobHInChI && nMobHInChI[i] ) &&
  ------------------
  |  Branch (2641:25): [True: 0, False: 0]
  |  Branch (2641:39): [True: 0, False: 0]
  ------------------
 2642|       |                     /* has (-) edge */
 2643|      0|                     ( e = pVA[iat].nCMinusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (2643:22): [True: 0, False: 0]
  ------------------
 2644|      0|                     0 == pBNS->edge[e].forbidden)
  ------------------
  |  Branch (2644:22): [True: 0, False: 0]
  ------------------
 2645|      0|                {
 2646|       |
 2647|      0|                    iat_DB_N_Neutr[num_DB_N_Neutr++] = iat;
 2648|       |
 2649|      0|                    if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (2649:25): [True: 0, False: 0]
  ------------------
 2650|      0|                    {
 2651|      0|                        goto exit_function;
 2652|      0|                    }
 2653|      0|                }
 2654|      0|            }
 2655|      0|        }
 2656|      0|        if (num_try = inchi_min( num_DB_N_Neutr, num_SB_O_Minus ))
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (2656:13): [True: 0, False: 0]
  ------------------
 2657|      0|        {
 2658|       |            /* detected; attempt to fix */
 2659|      0|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 2660|      0|            RemoveForbiddenEdgeMask( pBNS, &CurrEdges, forbidden_edge_mask );
 2661|       |            /* allow stereobonds in rings change */
 2662|      0|            if (forbidden_stereo_edge_mask)
  ------------------
  |  Branch (2662:17): [True: 0, False: 0]
  ------------------
 2663|      0|                RemoveForbiddenEdgeMask( pBNS, &FixedLargeRingStereoEdges, forbidden_stereo_edge_mask );
 2664|       |
 2665|      0|            delta = 1;
 2666|      0|            for (i = 0; i < num_SB_O_Minus && cur_success < num_try; i++)
  ------------------
  |  Branch (2666:25): [True: 0, False: 0]
  |  Branch (2666:47): [True: 0, False: 0]
  ------------------
 2667|      0|            {
 2668|      0|                iat = iat_SB_O_Minus[i];
 2669|      0|                pe = pBNS->edge + pVA[iat].nCMinusGroupEdge - 1;
 2670|      0|                if (!pe->flow)
  ------------------
  |  Branch (2670:21): [True: 0, False: 0]
  ------------------
 2671|      0|                    continue;
 2672|      0|                pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 2673|      0|                pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 2674|       |
 2675|      0|                pe->forbidden |= forbidden_edge_mask;
 2676|      0|                pe->flow -= delta;
 2677|      0|                pv1->st_edge.flow -= delta;
 2678|      0|                pv2->st_edge.flow -= delta;
 2679|      0|                pBNS->tot_st_flow -= 2 * delta;
 2680|       |
 2681|      0|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 2682|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 2683|       |
 2684|      0|                if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (2684:21): [True: 0, False: 0]
  |  Branch (2684:35): [True: 0, False: 0]
  |  Branch (2684:53): [True: 0, False: 0]
  ------------------
 2685|      0|                                  vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == 1)
  ------------------
  |  Branch (2685:35): [True: 0, False: 0]
  |  Branch (2685:53): [True: 0, False: 0]
  |  Branch (2685:75): [True: 0, False: 0]
  ------------------
 2686|      0|                {
 2687|       |                    /* Moved (-) charge to =N- => nDeltaCharge == 1 */
 2688|       |                    /* Flow change on pe (-)charge edge (atom (-)O-) is not known to RunBnsTestOnce()) */
 2689|      0|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 2690|      0|                    if (ret > 0)
  ------------------
  |  Branch (2690:25): [True: 0, False: 0]
  ------------------
 2691|      0|                    {
 2692|      0|                        nNumRunBNS++;
 2693|      0|                        cur_success++; /* 08 */
 2694|      0|                    }
 2695|      0|                }
 2696|      0|                else
 2697|      0|                {
 2698|      0|                    pe->forbidden &= forbidden_edge_mask_inv;
 2699|      0|                    pe->flow += delta;
 2700|      0|                    pv1->st_edge.flow += delta;
 2701|      0|                    pv2->st_edge.flow += delta;
 2702|      0|                    pBNS->tot_st_flow += 2 * delta;
 2703|      0|                }
 2704|      0|                INCHI_HEAPCHK
 2705|      0|            }
 2706|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 2707|      0|            if (forbidden_stereo_edge_mask)
  ------------------
  |  Branch (2707:17): [True: 0, False: 0]
  ------------------
 2708|      0|                SetForbiddenEdgeMask( pBNS, &FixedLargeRingStereoEdges, forbidden_stereo_edge_mask );
 2709|      0|        }
 2710|      0|        CurrEdges.num_edges = 0; /* clear current edge list */
 2711|      0|        if (cur_success)
  ------------------
  |  Branch (2711:13): [True: 0, False: 0]
  ------------------
 2712|      0|        {
 2713|      0|            tot_succes += cur_success;
 2714|       |            /* recalculate InChI from the structure */
 2715|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (2715:17): [True: 0, False: 0]
  ------------------
 2716|      0|                                                            ppt_group_info, ppat_norm, ppat_prep ) ))
 2717|      0|            {
 2718|      0|                goto exit_function;
 2719|      0|            }
 2720|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (2720:17): [True: 0, False: 0]
  ------------------
 2721|      0|            {
 2722|      0|                goto exit_function;
 2723|      0|            }
 2724|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (2724:17): [True: 0, False: 0]
  |  Branch (2724:45): [True: 0, False: 0]
  ------------------
 2725|      0|            {
 2726|      0|                goto exit_function;  /* no fixed-H found */
 2727|      0|            }
 2728|      0|            if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (2728:17): [True: 0, False: 0]
  ------------------
 2729|      0|            {
 2730|      0|                goto exit_function;
 2731|      0|            }
 2732|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (2732:17): [True: 0, False: 0]
  ------------------
 2733|      0|            {
 2734|      0|                goto exit_function; /* nothing to do */
 2735|      0|            }
 2736|      0|        }
 2737|      0|    }
 2738|       |
 2739|      1|    if (pc2i->len_c2at >= 2)
  ------------------
  |  Branch (2739:9): [True: 1, False: 0]
  ------------------
 2740|      1|    {
 2741|       |        /*--------------------------------------------------------*/
 2742|       |        /* case 09: restored: NH2(+)=C--NH2 orig.: NH2-C(+)-NH2   */
 2743|       |        /* FixH:               2     |  2            0  |   0     */
 2744|       |        /* MobH:               0        0            2      2     */
 2745|       |        /* N = N,            taut      taut     non-taut  non-taut*/
 2746|       |        /* Solution: move (+) from NH2(+) to C                    */
 2747|       |        /*--------------------------------------------------------*/
 2748|      1|        int iat;
 2749|      1|        cur_success = 0;
 2750|      3|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (2750:21): [True: 2, False: 1]
  ------------------
 2751|      2|        {
 2752|      2|            iat = pc2i->c2at[i].atomNumber;
 2753|      2|            if (( pc2i->c2at[i].nValElectr == 5 && pc2i->c2at[i].nPeriodNum == 1 ) &&
  ------------------
  |  Branch (2753:19): [True: 0, False: 2]
  |  Branch (2753:52): [True: 0, False: 0]
  ------------------
 2754|       |                 /* orig. InChI info: */
 2755|      2|                 !pc2i->c2at[i].endptInChI &&
  ------------------
  |  Branch (2755:18): [True: 0, False: 0]
  ------------------
 2756|      2|                 pc2i->c2at[i].nFixHInChI == 0 && pc2i->c2at[i].nMobHInChI &&
  ------------------
  |  Branch (2756:18): [True: 0, False: 0]
  |  Branch (2756:51): [True: 0, False: 0]
  ------------------
 2757|       |                 /* reversed structure info: */
 2758|      2|                 pc2i->c2at[i].endptRevrs &&
  ------------------
  |  Branch (2758:18): [True: 0, False: 0]
  ------------------
 2759|      2|                 pc2i->c2at[i].nFixHRevrs && !pc2i->c2at[i].nMobHRevrs &&
  ------------------
  |  Branch (2759:18): [True: 0, False: 0]
  |  Branch (2759:46): [True: 0, False: 0]
  ------------------
 2760|      2|                 pc2i->c2at[i].nAtChargeRevrs == 1 &&
  ------------------
  |  Branch (2760:18): [True: 0, False: 0]
  ------------------
 2761|      2|                 at2[iat].valence + 1 == at2[iat].chem_bonds_valence &&
  ------------------
  |  Branch (2761:18): [True: 0, False: 0]
  ------------------
 2762|      2|                 ( e = pVA[iat].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (2762:18): [True: 0, False: 0]
  |  Branch (2762:63): [True: 0, False: 0]
  ------------------
 2763|      0|            {
 2764|      0|                EdgeIndex eNC = NO_VERTEX, eCPlusC;
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
 2765|      0|                int       iNH2, iatC, iatNH2, icNH2;
 2766|       |                /* found NH2(+)=; locate =C< and find whether it has -NH2 neighbor */
 2767|      0|                for (j = 0; j < at2[iat].valence; j++)
  ------------------
  |  Branch (2767:29): [True: 0, False: 0]
  ------------------
 2768|      0|                {
 2769|      0|                    if (at2[iat].bond_type[j] == BOND_TYPE_DOUBLE)
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (2769:25): [True: 0, False: 0]
  ------------------
 2770|      0|                        break;
 2771|      0|                }
 2772|      0|                if (j == at2[iat].valence)
  ------------------
  |  Branch (2772:21): [True: 0, False: 0]
  ------------------
 2773|      0|                {
 2774|      0|                    continue;
 2775|      0|                }
 2776|      0|                eNC = pBNS->vert[iat].iedge[j]; /* edge NH2(+)=C */
 2777|      0|                iatC = at2[iat].neighbor[j];
 2778|      0|                if (pVA[iatC].cNumValenceElectrons != 4 || pVA[iatC].cMetal || at2[iatC].charge ||
  ------------------
  |  Branch (2778:21): [True: 0, False: 0]
  |  Branch (2778:60): [True: 0, False: 0]
  |  Branch (2778:80): [True: 0, False: 0]
  ------------------
 2779|      0|                     at2[iatC].valence != 3 || at2[iatC].valence + 1 != at2[iatC].chem_bonds_valence ||
  ------------------
  |  Branch (2779:22): [True: 0, False: 0]
  |  Branch (2779:48): [True: 0, False: 0]
  ------------------
 2780|      0|                     ( eCPlusC = pVA[iatC].nCPlusGroupEdge - 1 ) < 0 || pBNS->edge[eCPlusC].forbidden)
  ------------------
  |  Branch (2780:22): [True: 0, False: 0]
  |  Branch (2780:73): [True: 0, False: 0]
  ------------------
 2781|      0|                {
 2782|      0|                    continue;
 2783|      0|                }
 2784|      0|                for (j = 0; j < at2[iatC].valence; j++)
  ------------------
  |  Branch (2784:29): [True: 0, False: 0]
  ------------------
 2785|      0|                {
 2786|      0|                    iatNH2 = at2[iatC].neighbor[j];
 2787|      0|                    if (iatNH2 == iat || pVA[iatNH2].cNumValenceElectrons != 5 ||
  ------------------
  |  Branch (2787:25): [True: 0, False: 0]
  |  Branch (2787:42): [True: 0, False: 0]
  ------------------
 2788|      0|                         pVA[iatNH2].cPeriodicRowNumber != 1 || !at2[iatNH2].num_H || at2[iatNH2].charge)
  ------------------
  |  Branch (2788:26): [True: 0, False: 0]
  |  Branch (2788:65): [True: 0, False: 0]
  |  Branch (2788:87): [True: 0, False: 0]
  ------------------
 2789|      0|                        continue;
 2790|      0|                    icNH2 = pStruct->nAtno2Canon[0][iatNH2];
 2791|      0|                    for (iNH2 = 0; iNH2 < pc2i->len_c2at; iNH2++)
  ------------------
  |  Branch (2791:36): [True: 0, False: 0]
  ------------------
 2792|      0|                    {
 2793|      0|                        if (iatNH2 == pc2i->c2at[iNH2].atomNumber)
  ------------------
  |  Branch (2793:29): [True: 0, False: 0]
  ------------------
 2794|      0|                            break;
 2795|      0|                    }
 2796|      0|                    if (iNH2 == pc2i->len_c2at)
  ------------------
  |  Branch (2796:25): [True: 0, False: 0]
  ------------------
 2797|      0|                    {
 2798|      0|                        continue;
 2799|      0|                    }
 2800|       |
 2801|      0|                    if (( pc2i->c2at[iNH2].nValElectr == 5 && pc2i->c2at[iNH2].nPeriodNum == 1 ) &&
  ------------------
  |  Branch (2801:27): [True: 0, False: 0]
  |  Branch (2801:63): [True: 0, False: 0]
  ------------------
 2802|       |                         /* orig. InChI info: */
 2803|      0|                         !pc2i->c2at[iNH2].endptInChI &&
  ------------------
  |  Branch (2803:26): [True: 0, False: 0]
  ------------------
 2804|      0|                         pc2i->c2at[iNH2].nFixHInChI == 0 && pc2i->c2at[iNH2].nMobHInChI &&
  ------------------
  |  Branch (2804:26): [True: 0, False: 0]
  |  Branch (2804:62): [True: 0, False: 0]
  ------------------
 2805|       |                         /* reversed structure info: */
 2806|      0|                         pc2i->c2at[iNH2].endptRevrs &&
  ------------------
  |  Branch (2806:26): [True: 0, False: 0]
  ------------------
 2807|      0|                         pc2i->c2at[iNH2].nFixHRevrs && !pc2i->c2at[iNH2].nMobHRevrs &&
  ------------------
  |  Branch (2807:26): [True: 0, False: 0]
  |  Branch (2807:57): [True: 0, False: 0]
  ------------------
 2808|      0|                         pc2i->c2at[iNH2].nAtChargeRevrs == 0 &&
  ------------------
  |  Branch (2808:26): [True: 0, False: 0]
  ------------------
 2809|      0|                         at2[iatNH2].valence == at2[iatNH2].chem_bonds_valence)
  ------------------
  |  Branch (2809:26): [True: 0, False: 0]
  ------------------
 2810|      0|                    {
 2811|       |                        /* we have found NH2(+)=, =C<, and bond between them */
 2812|       |
 2813|      0|                        if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (2813:29): [True: 0, False: 0]
  ------------------
 2814|      0|                        {
 2815|      0|                            goto exit_function;
 2816|      0|                        }
 2817|      0|                        if (ret = AddToEdgeList( &CurrEdges, eCPlusC, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (2817:29): [True: 0, False: 0]
  ------------------
 2818|      0|                        {
 2819|      0|                            goto exit_function;
 2820|      0|                        }
 2821|      0|                        SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 2822|      0|                        RemoveForbiddenEdgeMask( pBNS, &CurrEdges, forbidden_edge_mask );
 2823|      0|                        delta = 1;
 2824|       |
 2825|      0|                        pe = pBNS->edge + eNC;
 2826|      0|                        if (!pe->flow)
  ------------------
  |  Branch (2826:29): [True: 0, False: 0]
  ------------------
 2827|      0|                            continue;
 2828|      0|                        pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 2829|      0|                        pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 2830|       |
 2831|      0|                        pe->forbidden |= forbidden_edge_mask;
 2832|      0|                        pe->flow -= delta; /* add (+) to -NHm */
 2833|      0|                        pv1->st_edge.flow -= delta;
 2834|      0|                        pv2->st_edge.flow -= delta;
 2835|      0|                        pBNS->tot_st_flow -= 2 * delta;
 2836|       |
 2837|      0|                        ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 2838|      0|                                              &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 2839|       |
 2840|      0|                        if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (2840:29): [True: 0, False: 0]
  |  Branch (2840:43): [True: 0, False: 0]
  |  Branch (2840:61): [True: 0, False: 0]
  ------------------
 2841|      0|                                          vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == 0)
  ------------------
  |  Branch (2841:43): [True: 0, False: 0]
  |  Branch (2841:61): [True: 0, False: 0]
  |  Branch (2841:83): [True: 0, False: 0]
  ------------------
 2842|      0|                        {
 2843|       |                            /* Removed (+)charge from -NHn => nDeltaCharge == -1 */
 2844|       |                            /* Flow change on pe (+)charge edge (atom NHm(+)) is not known to RunBnsTestOnce()) */
 2845|      0|                            ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 2846|      0|                            if (ret > 0)
  ------------------
  |  Branch (2846:33): [True: 0, False: 0]
  ------------------
 2847|      0|                            {
 2848|      0|                                nNumRunBNS++;
 2849|      0|                                cur_success++; /* 09 */
 2850|      0|                            }
 2851|      0|                        }
 2852|      0|                        else
 2853|      0|                        {
 2854|      0|                            pe->flow += delta;
 2855|      0|                            pv1->st_edge.flow += delta;
 2856|      0|                            pv2->st_edge.flow += delta;
 2857|      0|                            pBNS->tot_st_flow += 2 * delta;
 2858|      0|                        }
 2859|      0|                        INCHI_HEAPCHK
 2860|      0|                            pe->forbidden &= forbidden_edge_mask_inv;
 2861|      0|                        RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 2862|      0|                        CurrEdges.num_edges = 0; /* clear current edge list */
 2863|      0|                        break;
 2864|      0|                    }
 2865|      0|                }
 2866|      0|            }
 2867|      2|        }
 2868|      1|        if (cur_success)
  ------------------
  |  Branch (2868:13): [True: 0, False: 1]
  ------------------
 2869|      0|        {
 2870|      0|            tot_succes += cur_success;
 2871|       |            /* recalculate InChI from the structure */
 2872|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (2872:17): [True: 0, False: 0]
  ------------------
 2873|      0|                                                            ppt_group_info, ppat_norm, ppat_prep ) ))
 2874|      0|            {
 2875|      0|                goto exit_function;
 2876|      0|            }
 2877|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (2877:17): [True: 0, False: 0]
  ------------------
 2878|      0|            {
 2879|      0|                goto exit_function;
 2880|      0|            }
 2881|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (2881:17): [True: 0, False: 0]
  |  Branch (2881:45): [True: 0, False: 0]
  ------------------
 2882|      0|            {
 2883|      0|                goto exit_function;  /* no fixed-H found */
 2884|      0|            }
 2885|      0|            if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (2885:17): [True: 0, False: 0]
  ------------------
 2886|      0|            {
 2887|      0|                goto exit_function;
 2888|      0|            }
 2889|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (2889:17): [True: 0, False: 0]
  ------------------
 2890|      0|            {
 2891|      0|                goto exit_function; /* nothing to do */
 2892|      0|            }
 2893|      0|        }
 2894|      1|    }
 2895|       |
 2896|      1|    if (pc2i->len_c2at >= 2)
  ------------------
  |  Branch (2896:9): [True: 1, False: 0]
  ------------------
 2897|      1|    {
 2898|       |        /*--------------------------------------------------------*/
 2899|       |        /* case 10: restored: NH2-X(+)-NH-  orig.: NH2(+)=X-NH-   */
 2900|       |        /* FixH:               0        0            2      1     */
 2901|       |        /* MobH:               2        1            0      0     */
 2902|       |        /* N = N,O,S,Se,Te non-taut  non-taut       taut   taut   */
 2903|       |        /* Solution: move (+) from X(+) to NH2 or NH              */
 2904|       |        /*--------------------------------------------------------*/
 2905|      1|        int iat;
 2906|      1|        cur_success = 0;
 2907|      3|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (2907:21): [True: 2, False: 1]
  ------------------
 2908|      2|        {
 2909|      2|            if (pc2i->c2at[i].nValue)
  ------------------
  |  Branch (2909:17): [True: 0, False: 2]
  ------------------
 2910|      0|                continue;
 2911|      2|            iat = pc2i->c2at[i].atomNumber;
 2912|      2|            if (( pc2i->c2at[i].nValElectr == 6 ||
  ------------------
  |  Branch (2912:19): [True: 2, False: 0]
  ------------------
 2913|      2|                  pc2i->c2at[i].nValElectr == 5 && pc2i->c2at[i].nPeriodNum == 1 ) &&
  ------------------
  |  Branch (2913:19): [True: 0, False: 0]
  |  Branch (2913:52): [True: 0, False: 0]
  ------------------
 2914|       |                 /* orig. InChI info: */
 2915|      2|                 pc2i->c2at[i].endptInChI &&
  ------------------
  |  Branch (2915:18): [True: 0, False: 2]
  ------------------
 2916|      2|                 pc2i->c2at[i].nFixHInChI && !pc2i->c2at[i].nMobHInChI &&
  ------------------
  |  Branch (2916:18): [True: 0, False: 0]
  |  Branch (2916:46): [True: 0, False: 0]
  ------------------
 2917|       |                 /* reversed structure info: */
 2918|      2|                 !pc2i->c2at[i].endptRevrs &&
  ------------------
  |  Branch (2918:18): [True: 0, False: 0]
  ------------------
 2919|      2|                 !pc2i->c2at[i].nFixHRevrs && pc2i->c2at[i].nMobHRevrs &&
  ------------------
  |  Branch (2919:18): [True: 0, False: 0]
  |  Branch (2919:47): [True: 0, False: 0]
  ------------------
 2920|      2|                 pc2i->c2at[i].nAtChargeRevrs == 0 &&
  ------------------
  |  Branch (2920:18): [True: 0, False: 0]
  ------------------
 2921|      2|                 at2[iat].valence == at2[iat].chem_bonds_valence &&
  ------------------
  |  Branch (2921:18): [True: 0, False: 0]
  ------------------
 2922|      2|                 ( e = pVA[iat].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (2922:18): [True: 0, False: 0]
  |  Branch (2922:63): [True: 0, False: 0]
  ------------------
 2923|      0|            {
 2924|       |
 2925|      0|                EdgeIndex eCPlusC, eCPlusNH2, bContinue = 1;
 2926|      0|                int       iNH2, iatC, iatNH2, icNH2, j1, j2;
 2927|      0|                BNS_EDGE *pe_iat, *pe_iNH2;
 2928|       |                /* found NH2- locate -X(+) and find whether it has another -NH2 neighbor */
 2929|      0|                for (j1 = 0; j1 < at2[iat].valence && bContinue; j1++)
  ------------------
  |  Branch (2929:30): [True: 0, False: 0]
  |  Branch (2929:55): [True: 0, False: 0]
  ------------------
 2930|      0|                {
 2931|      0|                    if (at2[iat].bond_type[j1] == BOND_TYPE_SINGLE &&
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2931:25): [True: 0, False: 0]
  ------------------
 2932|      0|                         at2[iatC = at2[iat].neighbor[j1]].charge == 1 &&
  ------------------
  |  Branch (2932:26): [True: 0, False: 0]
  ------------------
 2933|      0|                         ( 4 <= pVA[iatC].cNumValenceElectrons && pVA[iatC].cNumValenceElectrons <= 6 ) &&
  ------------------
  |  Branch (2933:28): [True: 0, False: 0]
  |  Branch (2933:67): [True: 0, False: 0]
  ------------------
 2934|      0|                         at2[iatC].valence == at2[iatC].chem_bonds_valence &&
  ------------------
  |  Branch (2934:26): [True: 0, False: 0]
  ------------------
 2935|      0|                         ( eCPlusC = pVA[iatC].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[eCPlusC].forbidden)
  ------------------
  |  Branch (2935:26): [True: 0, False: 0]
  |  Branch (2935:78): [True: 0, False: 0]
  ------------------
 2936|      0|                    {
 2937|       |                        /* found a candidate for X; find another NH2 */
 2938|      0|                        for (j2 = 0; j2 < at2[iatC].valence && bContinue; j2++)
  ------------------
  |  Branch (2938:38): [True: 0, False: 0]
  |  Branch (2938:64): [True: 0, False: 0]
  ------------------
 2939|      0|                        {
 2940|      0|                            if (at2[iatC].bond_type[j2] == BOND_TYPE_SINGLE &&
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2940:33): [True: 0, False: 0]
  ------------------
 2941|      0|                                 iat != ( iatNH2 = at2[iatC].neighbor[j2] ) &&
  ------------------
  |  Branch (2941:34): [True: 0, False: 0]
  ------------------
 2942|      0|                                 at2[iatNH2].charge == 0 && at2[iatNH2].num_H &&
  ------------------
  |  Branch (2942:34): [True: 0, False: 0]
  |  Branch (2942:61): [True: 0, False: 0]
  ------------------
 2943|      0|                                 ( pVA[iatNH2].cNumValenceElectrons == 5 || pVA[iatNH2].cNumValenceElectrons == 6 ) &&
  ------------------
  |  Branch (2943:36): [True: 0, False: 0]
  |  Branch (2943:77): [True: 0, False: 0]
  ------------------
 2944|      0|                                 at2[iatNH2].valence == at2[iatNH2].chem_bonds_valence &&
  ------------------
  |  Branch (2944:34): [True: 0, False: 0]
  ------------------
 2945|      0|                                 ( eCPlusNH2 = pVA[iatNH2].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[eCPlusNH2].forbidden)
  ------------------
  |  Branch (2945:34): [True: 0, False: 0]
  |  Branch (2945:90): [True: 0, False: 0]
  ------------------
 2946|      0|                            {
 2947|      0|                                for (iNH2 = 0; iNH2 < pc2i->len_c2at; iNH2++)
  ------------------
  |  Branch (2947:48): [True: 0, False: 0]
  ------------------
 2948|      0|                                {
 2949|      0|                                    if (iatNH2 != pc2i->c2at[iNH2].atomNumber || pc2i->c2at[iNH2].nValue)
  ------------------
  |  Branch (2949:41): [True: 0, False: 0]
  |  Branch (2949:82): [True: 0, False: 0]
  ------------------
 2950|      0|                                        continue;
 2951|       |                                    /* check the second -NH */
 2952|      0|                                    icNH2 = pStruct->nAtno2Canon[0][iatNH2]; /* canon number -1 */
 2953|      0|                                    if ( /* orig. InChI info: */
 2954|      0|                                         pc2i->c2at[iNH2].endptInChI &&
  ------------------
  |  Branch (2954:42): [True: 0, False: 0]
  ------------------
 2955|      0|                                         pc2i->c2at[iNH2].nFixHInChI && !pc2i->c2at[iNH2].nMobHInChI &&
  ------------------
  |  Branch (2955:42): [True: 0, False: 0]
  |  Branch (2955:73): [True: 0, False: 0]
  ------------------
 2956|       |                                         /* reversed structure info: */
 2957|      0|                                         !pc2i->c2at[iNH2].endptRevrs &&
  ------------------
  |  Branch (2957:42): [True: 0, False: 0]
  ------------------
 2958|      0|                                         !pc2i->c2at[iNH2].nFixHRevrs && pc2i->c2at[iNH2].nMobHRevrs &&
  ------------------
  |  Branch (2958:42): [True: 0, False: 0]
  |  Branch (2958:74): [True: 0, False: 0]
  ------------------
 2959|      0|                                         pc2i->c2at[iNH2].nAtChargeRevrs == 0)
  ------------------
  |  Branch (2959:42): [True: 0, False: 0]
  ------------------
 2960|      0|                                    {
 2961|       |                                        /* we have found NH-X(+)-NH; remove charge from X(+) */
 2962|      0|                                        pe_iat = pBNS->edge + pBNS->vert[iat].iedge[j1];
 2963|      0|                                        pe_iNH2 = pBNS->edge + pBNS->vert[iatC].iedge[j2];
 2964|       |                                        /* pick up one of -NH to move (+) to it */
 2965|      0|                                        if (!pe_iat->forbidden && pBNS->edge[e].flow)
  ------------------
  |  Branch (2965:45): [True: 0, False: 0]
  |  Branch (2965:67): [True: 0, False: 0]
  ------------------
 2966|      0|                                        {
 2967|      0|                                            pe = pBNS->edge + e;
 2968|      0|                                        }
 2969|      0|                                        else
 2970|      0|                                            if (!pe_iNH2->forbidden && pBNS->edge[eCPlusNH2].flow)
  ------------------
  |  Branch (2970:49): [True: 0, False: 0]
  |  Branch (2970:72): [True: 0, False: 0]
  ------------------
 2971|      0|                                            {
 2972|      0|                                                pe = pBNS->edge + eCPlusNH2;
 2973|      0|                                            }
 2974|      0|                                            else
 2975|      0|                                            {
 2976|      0|                                                continue; /* none of the two -X(+)- bonds may be changed */
 2977|      0|                                            }
 2978|      0|                                        if (ret = AddToEdgeList( &CurrEdges, eCPlusC, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (2978:45): [True: 0, False: 0]
  ------------------
 2979|      0|                                        {
 2980|      0|                                            goto exit_function;
 2981|      0|                                        }
 2982|      0|                                        SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 2983|      0|                                        RemoveForbiddenEdgeMask( pBNS, &CurrEdges, forbidden_edge_mask );
 2984|      0|                                        delta = 1;
 2985|       |
 2986|      0|                                        pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 2987|      0|                                        pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 2988|       |
 2989|       |                                        /*pe->forbidden |= forbidden_edge_mask;*/
 2990|      0|                                        pe->flow -= delta; /* add (+) to -NHm */
 2991|      0|                                        pv1->st_edge.flow -= delta;
 2992|      0|                                        pv2->st_edge.flow -= delta;
 2993|      0|                                        pBNS->tot_st_flow -= 2 * delta;
 2994|       |
 2995|      0|                                        ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 2996|      0|                                                              &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 2997|       |
 2998|      0|                                        if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (2998:45): [True: 0, False: 0]
  |  Branch (2998:59): [True: 0, False: 0]
  |  Branch (2998:77): [True: 0, False: 0]
  ------------------
 2999|      0|                                                          vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == -1)
  ------------------
  |  Branch (2999:59): [True: 0, False: 0]
  |  Branch (2999:77): [True: 0, False: 0]
  |  Branch (2999:99): [True: 0, False: 0]
  ------------------
 3000|      0|                                        {
 3001|       |                                            /* Removed (+)charge from -NHn => nDeltaCharge == -1 */
 3002|       |                                            /* Flow change on pe (+)charge edge (atom NHm(+)) is not known to RunBnsTestOnce()) */
 3003|      0|                                            ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 3004|      0|                                            if (ret > 0)
  ------------------
  |  Branch (3004:49): [True: 0, False: 0]
  ------------------
 3005|      0|                                            {
 3006|      0|                                                nNumRunBNS++;
 3007|      0|                                                cur_success++; /* 10 */
 3008|      0|                                                bContinue = 0;
 3009|      0|                                                pc2i->c2at[i].nValue = 1;    /* mark as used */
 3010|      0|                                                pc2i->c2at[iNH2].nValue = 1; /* mark as used */
 3011|      0|                                            }
 3012|      0|                                        }
 3013|      0|                                        else
 3014|      0|                                        {
 3015|      0|                                            pe->flow += delta;
 3016|      0|                                            pv1->st_edge.flow += delta;
 3017|      0|                                            pv2->st_edge.flow += delta;
 3018|      0|                                            pBNS->tot_st_flow += 2 * delta;
 3019|      0|                                        }
 3020|      0|                                        INCHI_HEAPCHK
 3021|       |
 3022|       |                                            /*pe->forbidden &= forbidden_edge_mask_inv;*/
 3023|      0|                                            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 3024|      0|                                        CurrEdges.num_edges = 0; /* clear current edge list */
 3025|      0|                                        break;
 3026|      0|                                    }
 3027|      0|                                } /* iNH2: pc2i->c2at[iNH2] cycle */
 3028|      0|                            }
 3029|      0|                        } /* j2: iatC neighbors cycle */
 3030|      0|                    }
 3031|      0|                } /* j1: iat neighbors cycle */
 3032|      0|            }
 3033|      2|        } /* i: pc2i->c2at[i] cycle */
 3034|       |
 3035|      1|        if (cur_success)
  ------------------
  |  Branch (3035:13): [True: 0, False: 1]
  ------------------
 3036|      0|        {
 3037|       |            /*
 3038|       |            for ( i = 0; i < pc2i->len_c2at; i ++ ) {
 3039|       |            pc2i->c2at[i].nValue = 0;
 3040|       |            }
 3041|       |            */
 3042|      0|            tot_succes += cur_success;
 3043|       |            /* recalculate InChI from the structure */
 3044|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (3044:17): [True: 0, False: 0]
  ------------------
 3045|      0|                                                            ppt_group_info, ppat_norm, ppat_prep ) ))
 3046|      0|            {
 3047|      0|                goto exit_function;
 3048|      0|            }
 3049|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (3049:17): [True: 0, False: 0]
  ------------------
 3050|      0|            {
 3051|      0|                goto exit_function;
 3052|      0|            }
 3053|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (3053:17): [True: 0, False: 0]
  |  Branch (3053:45): [True: 0, False: 0]
  ------------------
 3054|      0|            {
 3055|      0|                goto exit_function;  /* no fixed-H found */
 3056|      0|            }
 3057|      0|            if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (3057:17): [True: 0, False: 0]
  ------------------
 3058|      0|            {
 3059|      0|                goto exit_function;
 3060|      0|            }
 3061|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (3061:17): [True: 0, False: 0]
  ------------------
 3062|      0|            {
 3063|      0|                goto exit_function; /* nothing to do */
 3064|      0|            }
 3065|      0|        }
 3066|      1|    }
 3067|       |
 3068|      1|    if ( /*pc2i->len_c2at >= 1 &&*/ pc2i->nNumTgInChI == 1 && /* ADP in InChI */
  ------------------
  |  Branch (3068:37): [True: 0, False: 1]
  ------------------
 3069|      1|        ( pc2i->nNumEndpRevrs < pc2i->nNumEndpInChI || pc2i->nNumTgRevrs > 1 ))
  ------------------
  |  Branch (3069:11): [True: 0, False: 0]
  |  Branch (3069:56): [True: 0, False: 0]
  ------------------
 3070|      0|    {
 3071|       |        /*--------------------------------------------------------------*/
 3072|       |        /* case 11: restored: NH(+)=AB-N< OH- orig.  NH-AB=N(+)< OH-    */
 3073|       |        /* FixH:               0       0   0          1      0   1      */
 3074|       |        /* MobH:               1       0   1          0      0   0      */
 3075|       |        /*                 non-taut.                taut        taut    */
 3076|       |        /*                                    ADP: one t-group or more endpoints */
 3077|       |        /* NH(+)= => N, O, S, Se; -N< => N                              */
 3078|       |        /* Solution: move (+) from NH(+) to -N<                         */
 3079|       |        /*--------------------------------------------------------------*/
 3080|      0|        int num_SB_Neutr = 0, num_DB_Charged = 0, iat;
 3081|      0|        short iat_SB_Neutr[MAX_DIFF_FIXH], iat_DB_Charged[MAX_DIFF_FIXH];
 3082|      0|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 3083|      0|        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H ? pInChI[1]->nNum_H :
  ------------------
  |  Branch (3083:32): [True: 0, False: 0]
  |  Branch (3083:45): [True: 0, False: 0]
  ------------------
 3084|      0|            pInChI[0] && pInChI[0]->nNum_H ? pInChI[0]->nNum_H : 0;
  ------------------
  |  Branch (3084:13): [True: 0, False: 0]
  |  Branch (3084:26): [True: 0, False: 0]
  ------------------
 3085|      0|        cur_success = 0;
 3086|       |        /* search for NH(+)= */
 3087|       |        /* search for -N< */
 3088|      0|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (3088:21): [True: 0, False: 0]
  ------------------
 3089|      0|        { /* i = canonical number - 1 */
 3090|      0|            iat = nCanon2AtnoRevrs[i];
 3091|      0|            if ( /* in restored atom: charge=0, has no H, has no double bond, N only */
 3092|      0|                 num_DB_Charged < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|      0|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (3092:18): [True: 0, False: 0]
  ------------------
 3093|      0|                 at2[iat].charge == 1 && at2[iat].num_H &&
  ------------------
  |  Branch (3093:18): [True: 0, False: 0]
  |  Branch (3093:42): [True: 0, False: 0]
  ------------------
 3094|      0|                 at2[iat].valence < at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (3094:18): [True: 0, False: 0]
  |  Branch (3094:68): [True: 0, False: 0]
  ------------------
 3095|      0|                 ( pVA[iat].cNumValenceElectrons == 5 && pVA[iat].cPeriodicRowNumber == 1 ||
  ------------------
  |  Branch (3095:20): [True: 0, False: 0]
  |  Branch (3095:58): [True: 0, False: 0]
  ------------------
 3096|      0|                   pVA[iat].cNumValenceElectrons == 6 ) &&
  ------------------
  |  Branch (3096:20): [True: 0, False: 0]
  ------------------
 3097|       |                 /* in orig.InChI: an endpoint, has fixed-H */
 3098|       |                 /*pStruct->endpoint[i] &&*/
 3099|      0|                   ( pStruct->fixed_H && pStruct->fixed_H[i] ) &&
  ------------------
  |  Branch (3099:22): [True: 0, False: 0]
  |  Branch (3099:42): [True: 0, False: 0]
  ------------------
 3100|       |                 /*!(nMobHInChI && nMobHInChI[i] ) &&*/
 3101|       |                 /* has (+) edge */
 3102|      0|                 ( e = pVA[iat].nCPlusGroupEdge - 1 ) >= 0 && 0 == pBNS->edge[e].forbidden)
  ------------------
  |  Branch (3102:18): [True: 0, False: 0]
  |  Branch (3102:63): [True: 0, False: 0]
  ------------------
 3103|      0|            {
 3104|       |
 3105|      0|                iat_DB_Charged[num_DB_Charged++] = iat;
 3106|       |                /*
 3107|       |                if ( ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ) ) {
 3108|       |                goto exit_function;
 3109|       |                }
 3110|       |                */
 3111|      0|            }
 3112|      0|            else
 3113|      0|            {
 3114|      0|                if ( /* in restored atom: charge=0, has no H, has no double bond, N only */
 3115|      0|                     num_SB_Neutr < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|      0|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (3115:22): [True: 0, False: 0]
  ------------------
 3116|      0|                     at2[iat].charge == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (3116:22): [True: 0, False: 0]
  |  Branch (3116:46): [True: 0, False: 0]
  ------------------
 3117|      0|                     at2[iat].valence == at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (3117:22): [True: 0, False: 0]
  |  Branch (3117:73): [True: 0, False: 0]
  ------------------
 3118|      0|                     ( pVA[iat].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (3118:24): [True: 0, False: 0]
  ------------------
 3119|      0|                       pVA[iat].cPeriodicRowNumber == 1 ) &&
  ------------------
  |  Branch (3119:24): [True: 0, False: 0]
  ------------------
 3120|       |                     /* in orig.InChI: an endpoint, has fixed-H */
 3121|       |                     /*pStruct->endpoint[i] &&*/
 3122|      0|                     !( pStruct->fixed_H && pStruct->fixed_H[i] ) &&
  ------------------
  |  Branch (3122:25): [True: 0, False: 0]
  |  Branch (3122:45): [True: 0, False: 0]
  ------------------
 3123|      0|                     !( nMobHInChI && nMobHInChI[i] ) &&
  ------------------
  |  Branch (3123:25): [True: 0, False: 0]
  |  Branch (3123:39): [True: 0, False: 0]
  ------------------
 3124|       |                     /* has (+) edge */
 3125|      0|                     ( e = pVA[iat].nCPlusGroupEdge - 1 ) >= 0 && 0 == pBNS->edge[e].forbidden)
  ------------------
  |  Branch (3125:22): [True: 0, False: 0]
  |  Branch (3125:67): [True: 0, False: 0]
  ------------------
 3126|      0|                {
 3127|       |
 3128|      0|                    iat_SB_Neutr[num_SB_Neutr++] = iat;
 3129|      0|                    if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (3129:25): [True: 0, False: 0]
  ------------------
 3130|      0|                    {
 3131|      0|                        goto exit_function;
 3132|      0|                    }
 3133|      0|                }
 3134|      0|            }
 3135|      0|        }
 3136|      0|        if (num_try = inchi_min( num_SB_Neutr, num_DB_Charged ))
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (3136:13): [True: 0, False: 0]
  ------------------
 3137|      0|        {
 3138|       |            /* detected; attempt to fix */
 3139|      0|            BNS_VERTEX *pv1n, *pv2n;
 3140|      0|            BNS_EDGE   *pe1n, *pe2n;
 3141|      0|            Vertex      v1n, v2n;
 3142|      0|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 3143|      0|            RemoveForbiddenEdgeMask( pBNS, &CurrEdges, forbidden_edge_mask );
 3144|      0|            delta = 1;
 3145|      0|            for (i = 0; i < num_DB_Charged && cur_success < num_try; i++)
  ------------------
  |  Branch (3145:25): [True: 0, False: 0]
  |  Branch (3145:47): [True: 0, False: 0]
  ------------------
 3146|      0|            {
 3147|      0|                iat = iat_DB_Charged[i];
 3148|      0|                pe = pBNS->edge + pVA[iat].nCPlusGroupEdge - 1;
 3149|      0|                if (pe->flow)
  ------------------
  |  Branch (3149:21): [True: 0, False: 0]
  ------------------
 3150|      0|                    continue;
 3151|      0|                pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 3152|      0|                pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 3153|       |
 3154|      0|                for (j = pv1->num_adj_edges - 1; 0 <= j; j--)
  ------------------
  |  Branch (3154:50): [True: 0, False: 0]
  ------------------
 3155|      0|                {
 3156|      0|                    pe1n = pBNS->edge + pv1->iedge[j];
 3157|      0|                    if (pe1n->flow && !pe1n->forbidden)
  ------------------
  |  Branch (3157:25): [True: 0, False: 0]
  |  Branch (3157:39): [True: 0, False: 0]
  ------------------
 3158|      0|                    {
 3159|      0|                        pv1n = pBNS->vert + ( v1n = pe1n->neighbor12 ^ v1 );
 3160|      0|                        break;
 3161|      0|                    }
 3162|      0|                }
 3163|      0|                if (j < 0)
  ------------------
  |  Branch (3163:21): [True: 0, False: 0]
  ------------------
 3164|      0|                {
 3165|      0|                    continue; /* not found */
 3166|      0|                }
 3167|       |
 3168|      0|                for (j = pv2->num_adj_edges - 2; 0 <= j; j--)
  ------------------
  |  Branch (3168:50): [True: 0, False: 0]
  ------------------
 3169|      0|                {
 3170|      0|                    pe2n = pBNS->edge + pv2->iedge[j];
 3171|      0|                    if (pe2n->flow && !pe2n->forbidden)
  ------------------
  |  Branch (3171:25): [True: 0, False: 0]
  |  Branch (3171:39): [True: 0, False: 0]
  ------------------
 3172|      0|                    {
 3173|      0|                        pv2n = pBNS->vert + ( v2n = pe2n->neighbor12 ^ v2 );
 3174|      0|                        break;
 3175|      0|                    }
 3176|      0|                }
 3177|      0|                if (j < 0)
  ------------------
  |  Branch (3177:21): [True: 0, False: 0]
  ------------------
 3178|      0|                {
 3179|      0|                    continue; /* not found */
 3180|      0|                }
 3181|       |
 3182|      0|                pe->flow += delta;
 3183|      0|                pe1n->flow -= delta;
 3184|      0|                pe2n->flow -= delta;
 3185|      0|                pv1n->st_edge.flow -= delta;
 3186|      0|                pv2n->st_edge.flow -= delta;
 3187|      0|                pBNS->tot_st_flow -= 2 * delta;
 3188|       |
 3189|      0|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 3190|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 3191|       |
 3192|      0|                if (ret == 1 && ( vPathEnd == v1n && vPathStart == v2n ||
  ------------------
  |  Branch (3192:21): [True: 0, False: 0]
  |  Branch (3192:35): [True: 0, False: 0]
  |  Branch (3192:54): [True: 0, False: 0]
  ------------------
 3193|      0|                                  vPathEnd == v2n && vPathStart == v1n ) &&
  ------------------
  |  Branch (3193:35): [True: 0, False: 0]
  |  Branch (3193:54): [True: 0, False: 0]
  ------------------
 3194|      0|                                  ( nDeltaCharge == 0 || nDeltaCharge == 1 ))
  ------------------
  |  Branch (3194:37): [True: 0, False: 0]
  |  Branch (3194:58): [True: 0, False: 0]
  ------------------
 3195|      0|                {
 3196|       |                    /* before setting flows the structure could be:
 3197|       |                    [NH+ neigh, v1n]=e1n=[NH+,v1]-pe-[+,v2]=e2n=[another at or its chargeStruct]
 3198|       |                    or
 3199|       |
 3200|       |                    [NH+ or ChStr, v1n]=pe1n=[NH+ or ChStr, v1]-pe-[+,v2]=pe2n=[at2 or ChStr, v2n]
 3201|       |                    ^    ^    ^
 3202|       |                    NH+(+)edge |  N (+) edge: only
 3203|       |                    |  these are not forbidden
 3204|       |                    |
 3205|       |                    hetero (+) vertex
 3206|       |
 3207|       |                    After setting flows (* mark radicals, =pe= is forbidden):
 3208|       |
 3209|       |                    *[NH+ or ChStr, v1n]-pe1n-[NH+ or ChStr, v1]=pe=[+,v2]-pe2n-[at2 or ChStr, v2n]*
 3210|       |                    ^    ^    ^
 3211|       |                    NH+(+)edge |  N (+) edge: only
 3212|       |                    |  these are not forbidden
 3213|       |                    |
 3214|       |                    hetero (+) vertex
 3215|       |
 3216|       |                    Flow in
 3217|       |                    pe1n and pe2n will or will not change, depending on the structure.
 3218|       |
 3219|       |                    Consider what happens if pe2n changes. It may only increment.
 3220|       |                    If pe2n flow increments then another (+)edge flow dectrements. If
 3221|       |                    [at2 or ChStr, v2n] is at2 then at2 charge would change from (+) to 0,
 3222|       |                    and another N charge would change from 0 to (+), giving tot. change of
 3223|       |                    number of charges  (-1)+(+1)=0. However, if [at2 or ChStr, v2n] is
 3224|       |                    ChargeStruct then at2 will not be on the alt path and only the creation
 3225|       |                    of another (+) will be detected.
 3226|       |                    */
 3227|       |                    /* Removed charge from O(+) => nDeltaCharge == -1 */
 3228|       |                    /* Flow change on pe (+)charge edge (atom NH2) is not known to RunBnsTestOnce()) */
 3229|      0|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 3230|      0|                    if (ret > 0)
  ------------------
  |  Branch (3230:25): [True: 0, False: 0]
  ------------------
 3231|      0|                    {
 3232|      0|                        nNumRunBNS++;
 3233|      0|                        cur_success++; /* 11 */
 3234|      0|                    }
 3235|      0|                }
 3236|      0|                else
 3237|      0|                {
 3238|      0|                    pe->flow -= delta;
 3239|      0|                    pe1n->flow += delta;
 3240|      0|                    pe2n->flow += delta;
 3241|      0|                    pv1n->st_edge.flow += delta;
 3242|      0|                    pv2n->st_edge.flow += delta;
 3243|      0|                    pBNS->tot_st_flow += 2 * delta;
 3244|      0|                }
 3245|      0|                INCHI_HEAPCHK
 3246|      0|            }
 3247|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 3248|      0|        }
 3249|      0|        CurrEdges.num_edges = 0; /* clear current edge list */
 3250|      0|        if (cur_success)
  ------------------
  |  Branch (3250:13): [True: 0, False: 0]
  ------------------
 3251|      0|        {
 3252|      0|            tot_succes += cur_success;
 3253|       |            /* recalculate InChI from the structure */
 3254|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (3254:17): [True: 0, False: 0]
  ------------------
 3255|      0|                                                            ppt_group_info, ppat_norm, ppat_prep ) ))
 3256|      0|            {
 3257|      0|                goto exit_function;
 3258|      0|            }
 3259|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (3259:17): [True: 0, False: 0]
  ------------------
 3260|      0|            {
 3261|      0|                goto exit_function;
 3262|      0|            }
 3263|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (3263:17): [True: 0, False: 0]
  |  Branch (3263:45): [True: 0, False: 0]
  ------------------
 3264|      0|            {
 3265|      0|                goto exit_function;  /* no fixed-H found */
 3266|      0|            }
 3267|      0|            if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (3267:17): [True: 0, False: 0]
  ------------------
 3268|      0|            {
 3269|      0|                goto exit_function;
 3270|      0|            }
 3271|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (3271:17): [True: 0, False: 0]
  ------------------
 3272|      0|            {
 3273|      0|                goto exit_function; /* nothing to do */
 3274|      0|            }
 3275|      0|        }
 3276|      0|    }
 3277|       |
 3278|      1|    if (pc2i->len_c2at >= 1 && pc2i->nNumTgInChI == 1 &&
  ------------------
  |  Branch (3278:9): [True: 1, False: 0]
  |  Branch (3278:32): [True: 0, False: 1]
  ------------------
 3279|      1|         pc2i->nNumRemHInChI >= -1 && /* 2006-03-03 */
  ------------------
  |  Branch (3279:10): [True: 0, False: 0]
  ------------------
 3280|      1|         ( pc2i->nNumEndpInChI > pc2i->nNumEndpRevrs || pc2i->nNumTgRevrs > 1 ) /* ADP in InChI */)
  ------------------
  |  Branch (3280:12): [True: 0, False: 0]
  |  Branch (3280:57): [True: 0, False: 0]
  ------------------
 3281|      0|    {
 3282|       |        /*--------------------------------------------------------------*/
 3283|       |        /* case 12: restored: O=AB-N<         original: (-)O-AB=N(+)<   */
 3284|       |        /* FixH:              0    0                     0        0     */
 3285|       |        /* MobH:              0    0                     0        0     */
 3286|       |        /*                   non-taut                   taut            */
 3287|       |        /* O = O, S, Se, N; N = N;                                         */
 3288|       |        /* restored atom O is not tautomeric; original atom O is taut.  */
 3289|       |        /* original struct has 1 t-group; restored has less endpoints   */
 3290|       |        /*                             and/or possibly >1 t-groups      */
 3291|       |        /* Solution: separate charges between O= and -N<                */
 3292|       |        /*           allow moving charge to N(V) to make it N(IV)(+)    */
 3293|       |        /*--------------------------------------------------------------*/
 3294|      0|        int bOnly_N_V = 1;
 3295|      0|        cur_success = 0;
 3296|      0|        while (1)
  ------------------
  |  Branch (3296:16): [Folded - Ignored]
  ------------------
 3297|      0|        {
 3298|      0|            int num_SB_N_Neutr = 0, num_DB_O = 0, iat, num_N_V = 0, bN_V;
 3299|      0|            short iat_SB_N_Neutr[MAX_DIFF_FIXH], iat_DB_O[MAX_DIFF_FIXH];
 3300|      0|            AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 3301|      0|            inp_ATOM *at_Mobile_H_Revrs = ( pStruct->pOne_norm_data[1] &&
  ------------------
  |  Branch (3301:45): [True: 0, False: 0]
  ------------------
 3302|      0|                                            pStruct->pOne_norm_data[1]->at ) ? pStruct->pOne_norm_data[1]->at : NULL;
  ------------------
  |  Branch (3302:45): [True: 0, False: 0]
  ------------------
 3303|      0|            S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H ? pInChI[1]->nNum_H :
  ------------------
  |  Branch (3303:36): [True: 0, False: 0]
  |  Branch (3303:49): [True: 0, False: 0]
  ------------------
 3304|      0|                pInChI[0] && pInChI[0]->nNum_H ? pInChI[0]->nNum_H : 0;
  ------------------
  |  Branch (3304:17): [True: 0, False: 0]
  |  Branch (3304:30): [True: 0, False: 0]
  ------------------
 3305|      0|            cur_success = 0;
 3306|      0|            for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (3306:25): [True: 0, False: 0]
  ------------------
 3307|      0|            {
 3308|      0|                iat = pc2i->c2at[i].atomNumber;
 3309|      0|                if ( /* orig. InChI info: -O(-) */
 3310|      0|                     num_DB_O < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|      0|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (3310:22): [True: 0, False: 0]
  ------------------
 3311|      0|                     ( pc2i->c2at[i].nValElectr == 6 /* O, S, Se, Te */ ||
  ------------------
  |  Branch (3311:24): [True: 0, False: 0]
  ------------------
 3312|      0|                       pc2i->c2at[i].nValElectr == 5 &&
  ------------------
  |  Branch (3312:24): [True: 0, False: 0]
  ------------------
 3313|      0|                       pc2i->c2at[i].nPeriodNum == 1 /* N */ ) &&
  ------------------
  |  Branch (3313:24): [True: 0, False: 0]
  ------------------
 3314|      0|                     pc2i->c2at[i].endptInChI &&
  ------------------
  |  Branch (3314:22): [True: 0, False: 0]
  ------------------
 3315|      0|                     ( e = pVA[iat].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (3315:22): [True: 0, False: 0]
  |  Branch (3315:68): [True: 0, False: 0]
  ------------------
 3316|      0|                     pc2i->c2at[i].nFixHInChI == 0 && pc2i->c2at[i].nMobHInChI == 0 &&
  ------------------
  |  Branch (3316:22): [True: 0, False: 0]
  |  Branch (3316:55): [True: 0, False: 0]
  ------------------
 3317|       |                     /* reversed structure info: */
 3318|      0|                     !pc2i->c2at[i].endptRevrs &&
  ------------------
  |  Branch (3318:22): [True: 0, False: 0]
  ------------------
 3319|      0|                     pc2i->c2at[i].nFixHRevrs == 0 && pc2i->c2at[i].nMobHRevrs == 0 &&
  ------------------
  |  Branch (3319:22): [True: 0, False: 0]
  |  Branch (3319:55): [True: 0, False: 0]
  ------------------
 3320|      0|                     pc2i->c2at[i].nAtChargeRevrs == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (3320:22): [True: 0, False: 0]
  |  Branch (3320:59): [True: 0, False: 0]
  ------------------
 3321|      0|                     ( ( pc2i->c2at[i].nValElectr == 6 ) ?
  ------------------
  |  Branch (3321:22): [True: 0, False: 0]
  |  Branch (3321:24): [True: 0, False: 0]
  ------------------
 3322|      0|                     ( at2[iat].valence == 1 && at2[iat].chem_bonds_valence == 2 ) :
  ------------------
  |  Branch (3322:24): [True: 0, False: 0]
  |  Branch (3322:49): [True: 0, False: 0]
  ------------------
 3323|      0|                       ( pc2i->c2at[i].nValElectr == 5 ) ?
  ------------------
  |  Branch (3323:24): [True: 0, False: 0]
  ------------------
 3324|      0|                       ( at2[iat].valence == 2 && at2[iat].chem_bonds_valence == 3 ) :
  ------------------
  |  Branch (3324:26): [True: 0, False: 0]
  |  Branch (3324:51): [True: 0, False: 0]
  ------------------
 3325|      0|                       0 ))
 3326|      0|                {
 3327|       |
 3328|      0|                    iat_DB_O[num_DB_O++] = iat;
 3329|       |                    /*
 3330|       |                    if ( ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ) ) {
 3331|       |                    goto exit_function;
 3332|       |                    }
 3333|       |                    */
 3334|      0|                }
 3335|      0|            }
 3336|      0|            for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (3336:25): [True: 0, False: 0]
  ------------------
 3337|      0|            {
 3338|       |                /* i = canonical number - 1 */
 3339|      0|                iat = nCanon2AtnoRevrs[i];
 3340|      0|                bN_V = 0;
 3341|      0|                if ( /* in restored atom N: charge=0, no H, has no double bond, not an endpoint */
 3342|      0|                     num_SB_N_Neutr < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|      0|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (3342:22): [True: 0, False: 0]
  ------------------
 3343|      0|                     at2[iat].charge == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (3343:22): [True: 0, False: 0]
  |  Branch (3343:46): [True: 0, False: 0]
  ------------------
 3344|      0|                     ( at2[iat].valence == at2[iat].chem_bonds_valence ||
  ------------------
  |  Branch (3344:24): [True: 0, False: 0]
  ------------------
 3345|      0|                     ( bN_V = at2[iat].valence + 2 == at2[iat].chem_bonds_valence ) ) &&
  ------------------
  |  Branch (3345:22): [True: 0, False: 0]
  ------------------
 3346|      0|                     !pVA[iat].cMetal &&
  ------------------
  |  Branch (3346:22): [True: 0, False: 0]
  ------------------
 3347|      0|                     pVA[iat].cNumValenceElectrons == 5 && pVA[iat].cPeriodicRowNumber == 1 &&
  ------------------
  |  Branch (3347:22): [True: 0, False: 0]
  |  Branch (3347:60): [True: 0, False: 0]
  ------------------
 3348|      0|                     !( at_Mobile_H_Revrs && at_Mobile_H_Revrs[iat].endpoint ) &&
  ------------------
  |  Branch (3348:25): [True: 0, False: 0]
  |  Branch (3348:46): [True: 0, False: 0]
  ------------------
 3349|       |                     /* in orig.InChI: not an endpoint, has no H */
 3350|      0|                     !pStruct->endpoint[i] &&
  ------------------
  |  Branch (3350:22): [True: 0, False: 0]
  ------------------
 3351|      0|                     !( pStruct->fixed_H && pStruct->fixed_H[i] ) &&
  ------------------
  |  Branch (3351:25): [True: 0, False: 0]
  |  Branch (3351:45): [True: 0, False: 0]
  ------------------
 3352|      0|                     !( nMobHInChI && nMobHInChI[i] ) &&
  ------------------
  |  Branch (3352:25): [True: 0, False: 0]
  |  Branch (3352:39): [True: 0, False: 0]
  ------------------
 3353|       |                     /* has (+) edge */
 3354|      0|                     ( e = pVA[iat].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (3354:22): [True: 0, False: 0]
  |  Branch (3354:67): [True: 0, False: 0]
  ------------------
 3355|      0|                {
 3356|       |
 3357|      0|                    if (bOnly_N_V && bN_V &&
  ------------------
  |  Branch (3357:25): [True: 0, False: 0]
  |  Branch (3357:38): [True: 0, False: 0]
  ------------------
 3358|      0|                         NO_VERTEX != ( j = GetChargeFlowerUpperEdge( pBNS, pVA, e ) ) &&
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (3358:26): [True: 0, False: 0]
  ------------------
 3359|      0|                         !pBNS->edge[j].forbidden && !pBNS->edge[j].flow)
  ------------------
  |  Branch (3359:26): [True: 0, False: 0]
  |  Branch (3359:54): [True: 0, False: 0]
  ------------------
 3360|      0|                    {
 3361|      0|                        if (!num_N_V)
  ------------------
  |  Branch (3361:29): [True: 0, False: 0]
  ------------------
 3362|      0|                        {
 3363|       |                            /* switch to N(V) only mode */
 3364|      0|                            CurrEdges.num_edges = 0;
 3365|      0|                            num_SB_N_Neutr = 0;
 3366|      0|                        }
 3367|      0|                        iat_SB_N_Neutr[num_SB_N_Neutr++] = iat;
 3368|      0|                        num_N_V++;
 3369|      0|                        if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (3369:29): [True: 0, False: 0]
  ------------------
 3370|      0|                        {
 3371|      0|                            goto exit_function;
 3372|      0|                        }
 3373|      0|                        if (ret = AddToEdgeList( &CurrEdges, j, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (3373:29): [True: 0, False: 0]
  ------------------
 3374|      0|                        {
 3375|      0|                            goto exit_function;
 3376|      0|                        }
 3377|      0|                    }
 3378|      0|                    else
 3379|      0|                    {
 3380|      0|                        if (!num_N_V)
  ------------------
  |  Branch (3380:29): [True: 0, False: 0]
  ------------------
 3381|      0|                        {
 3382|      0|                            iat_SB_N_Neutr[num_SB_N_Neutr++] = iat;
 3383|      0|                            if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (3383:33): [True: 0, False: 0]
  ------------------
 3384|      0|                            {
 3385|      0|                                goto exit_function;
 3386|      0|                            }
 3387|       |                            /* in addition, permit N(V)=>N(IV)(+) change by allowing charge flower edge change flow */
 3388|      0|                            if (bN_V && NO_VERTEX != ( j = GetChargeFlowerUpperEdge( pBNS, pVA, e ) ) &&
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (3388:33): [True: 0, False: 0]
  |  Branch (3388:41): [True: 0, False: 0]
  ------------------
 3389|      0|                                 !pBNS->edge[j].forbidden && !pBNS->edge[j].flow)
  ------------------
  |  Branch (3389:34): [True: 0, False: 0]
  |  Branch (3389:62): [True: 0, False: 0]
  ------------------
 3390|      0|                            {
 3391|      0|                                if (ret = AddToEdgeList( &CurrEdges, j, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (3391:37): [True: 0, False: 0]
  ------------------
 3392|      0|                                {
 3393|      0|                                    goto exit_function;
 3394|      0|                                }
 3395|      0|                            }
 3396|      0|                        }
 3397|      0|                    }
 3398|      0|                }
 3399|      0|            }
 3400|      0|            if (num_try = inchi_min( num_SB_N_Neutr, num_DB_O ))
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (3400:17): [True: 0, False: 0]
  ------------------
 3401|      0|            {
 3402|       |                /* detected; attempt to fix */
 3403|      0|                BNS_EDGE *pe_CMinus;
 3404|      0|                SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 3405|      0|                RemoveForbiddenEdgeMask( pBNS, &CurrEdges, forbidden_edge_mask );
 3406|      0|                delta = 1;
 3407|      0|                for (i = 0; i < num_DB_O && cur_success < num_try; i++)
  ------------------
  |  Branch (3407:29): [True: 0, False: 0]
  |  Branch (3407:45): [True: 0, False: 0]
  ------------------
 3408|      0|                {
 3409|      0|                    iat = iat_DB_O[i];
 3410|      0|                    pe_CMinus = pBNS->edge + pVA[iat].nCMinusGroupEdge - 1;
 3411|      0|                    pe_CMinus->forbidden &= forbidden_edge_mask_inv;
 3412|       |
 3413|      0|                    pe = pBNS->edge + pBNS->vert[iat].iedge[0]; /* double bond O=...*/
 3414|      0|                    if (!pe->flow)
  ------------------
  |  Branch (3414:25): [True: 0, False: 0]
  ------------------
 3415|      0|                        continue;
 3416|      0|                    pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 3417|      0|                    pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 3418|       |
 3419|      0|                    pe->forbidden |= forbidden_edge_mask; /* change bond O=X to O(rad)-X(rad) */
 3420|      0|                    pe->flow -= delta;
 3421|      0|                    pv1->st_edge.flow -= delta;
 3422|      0|                    pv2->st_edge.flow -= delta;
 3423|      0|                    pBNS->tot_st_flow -= 2 * delta;
 3424|       |
 3425|      0|                    ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 3426|      0|                                          &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 3427|       |
 3428|      0|                    if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (3428:25): [True: 0, False: 0]
  |  Branch (3428:39): [True: 0, False: 0]
  |  Branch (3428:57): [True: 0, False: 0]
  ------------------
 3429|      0|                                      vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == 2)
  ------------------
  |  Branch (3429:39): [True: 0, False: 0]
  |  Branch (3429:57): [True: 0, False: 0]
  |  Branch (3429:79): [True: 0, False: 0]
  ------------------
 3430|      0|                    {
 3431|       |                        /* Added (-) charge to =O and (+) charge to N => nDeltaCharge == 2 */
 3432|      0|                        ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 3433|      0|                        if (ret > 0)
  ------------------
  |  Branch (3433:29): [True: 0, False: 0]
  ------------------
 3434|      0|                        {
 3435|      0|                            nNumRunBNS++;
 3436|      0|                            cur_success++; /* 12 */
 3437|      0|                        }
 3438|      0|                    }
 3439|      0|                    else
 3440|      0|                    {
 3441|      0|                        pe->flow += delta;
 3442|      0|                        pv1->st_edge.flow += delta;
 3443|      0|                        pv2->st_edge.flow += delta;
 3444|      0|                        pBNS->tot_st_flow += 2 * delta;
 3445|      0|                    }
 3446|      0|                    pe->forbidden &= forbidden_edge_mask_inv; /* allow changes to O=X bond */
 3447|      0|                    INCHI_HEAPCHK
 3448|      0|                }
 3449|      0|                RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 3450|      0|            }
 3451|      0|            CurrEdges.num_edges = 0; /* clear current edge list */
 3452|      0|            if (cur_success)
  ------------------
  |  Branch (3452:17): [True: 0, False: 0]
  ------------------
 3453|      0|            {
 3454|      0|                tot_succes += cur_success;
 3455|       |                /* recalculate InChI from the structure */
 3456|      0|                if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (3456:21): [True: 0, False: 0]
  ------------------
 3457|      0|                                                                ppt_group_info, ppat_norm, ppat_prep ) ))
 3458|      0|                {
 3459|      0|                    goto exit_function;
 3460|      0|                }
 3461|      0|                if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (3461:21): [True: 0, False: 0]
  ------------------
 3462|      0|                {
 3463|      0|                    goto exit_function;
 3464|      0|                }
 3465|      0|                if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (3465:21): [True: 0, False: 0]
  |  Branch (3465:49): [True: 0, False: 0]
  ------------------
 3466|      0|                {
 3467|      0|                    goto exit_function;  /* no fixed-H found */
 3468|      0|                }
 3469|      0|                if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (3469:21): [True: 0, False: 0]
  ------------------
 3470|      0|                {
 3471|      0|                    goto exit_function;
 3472|      0|                }
 3473|      0|                if (!pc2i->bHasDifference)
  ------------------
  |  Branch (3473:21): [True: 0, False: 0]
  ------------------
 3474|      0|                {
 3475|      0|                    goto exit_function; /* nothing to do */
 3476|      0|                }
 3477|      0|                break;
 3478|      0|            }
 3479|      0|            else
 3480|      0|            {
 3481|      0|                if (bOnly_N_V)
  ------------------
  |  Branch (3481:21): [True: 0, False: 0]
  ------------------
 3482|      0|                {
 3483|      0|                    bOnly_N_V = 0;
 3484|      0|                }
 3485|      0|                else
 3486|      0|                {
 3487|      0|                    break;
 3488|      0|                }
 3489|      0|            }
 3490|      0|        }
 3491|      0|    }
 3492|       |
 3493|      1|    if (pc2i->nNumTgDiffMinus /*|| pc2i->nNumTgDiffH */ /* no ADP in InChI needed */)
  ------------------
  |  Branch (3493:9): [True: 0, False: 1]
  ------------------
 3494|      0|    {
 3495|       |        /*--------------------------------------------------------------*/
 3496|       |        /*                         |                            |       */
 3497|       |        /* case 13: restored: O=AB=N=         original: (-)O-AB-N(+)=   */
 3498|       |        /* FixH:              0    0                     0        0     */
 3499|       |        /* MobH:              0    0                     0        0     */
 3500|       |        /*                        non-taut              taut   non-taut */
 3501|       |        /* O = O, S, Se, N; N = N, P, ...                               */
 3502|       |        /* t-group in original has same num. endpoints                  */
 3503|       |        /*       same num_H and less (-) than in the restored structure */
 3504|       |        /* original atom O is tautomeric, N is not taut in both         */
 3505|       |        /* original struct has 1 t-group; restored has less endpoints   */
 3506|       |        /*                             and/or possibly >1 t-groups      */
 3507|       |        /* Solution: separate charges between O= and -N<                */
 3508|       |        /*           allow moving charge to N(V) to make it N(IV)(+)    */
 3509|       |        /*--------------------------------------------------------------*/
 3510|      0|        int itg;
 3511|      0|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 3512|      0|        inp_ATOM *at_Mobile_H_Revrs = ( pStruct->pOne_norm_data[1] &&
  ------------------
  |  Branch (3512:41): [True: 0, False: 0]
  ------------------
 3513|      0|                                        pStruct->pOne_norm_data[1]->at ) ? pStruct->pOne_norm_data[1]->at : NULL;
  ------------------
  |  Branch (3513:41): [True: 0, False: 0]
  ------------------
 3514|       |
 3515|      0|        S_CHAR   *num_Fixed_H_Revrs = pStruct->pOneINChI[0]->nNum_H_fixed ? pStruct->pOneINChI[0]->nNum_H_fixed : NULL;
  ------------------
  |  Branch (3515:39): [True: 0, False: 0]
  ------------------
 3516|      0|        S_CHAR   *pnMobHRevrs = ( pStruct->pOneINChI[1] && pStruct->pOneINChI[1]->nNum_H ) ?
  ------------------
  |  Branch (3516:35): [True: 0, False: 0]
  |  Branch (3516:60): [True: 0, False: 0]
  ------------------
 3517|      0|            pStruct->pOneINChI[1]->nNum_H :
 3518|      0|            ( pStruct->pOneINChI[0] && pStruct->pOneINChI[0]->nNum_H ) ?
  ------------------
  |  Branch (3518:15): [True: 0, False: 0]
  |  Branch (3518:40): [True: 0, False: 0]
  ------------------
 3519|      0|            pStruct->pOneINChI[0]->nNum_H : NULL;
 3520|      0|        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H ? pInChI[1]->nNum_H :
  ------------------
  |  Branch (3520:32): [True: 0, False: 0]
  |  Branch (3520:45): [True: 0, False: 0]
  ------------------
 3521|      0|            pInChI[0] && pInChI[0]->nNum_H ? pInChI[0]->nNum_H : 0;
  ------------------
  |  Branch (3521:13): [True: 0, False: 0]
  |  Branch (3521:26): [True: 0, False: 0]
  ------------------
 3522|      0|        cur_success = 0;
 3523|       |        /* find whether this may help */
 3524|      0|        for (itg = 0; itg < pStruct->ti.num_t_groups && itg < pStruct->One_ti.num_t_groups; itg++)
  ------------------
  |  Branch (3524:23): [True: 0, False: 0]
  |  Branch (3524:57): [True: 0, False: 0]
  ------------------
 3525|      0|        {
 3526|      0|            if (pStruct->ti.t_group[itg].nNumEndpoints == pStruct->One_ti.t_group[itg].nNumEndpoints &&
  ------------------
  |  Branch (3526:17): [True: 0, False: 0]
  ------------------
 3527|      0|                 pStruct->ti.t_group[itg].num[0] - pStruct->ti.t_group[itg].num[1] ==
  ------------------
  |  Branch (3527:18): [True: 0, False: 0]
  ------------------
 3528|      0|                 pStruct->One_ti.t_group[itg].num[0] - pStruct->One_ti.t_group[itg].num[1] &&
 3529|      0|                 pStruct->ti.t_group[itg].num[1] > pStruct->One_ti.t_group[itg].num[1])
  ------------------
  |  Branch (3529:18): [True: 0, False: 0]
  ------------------
 3530|      0|            {
 3531|       |                /* restored InChI t-group has more (-) and same number of H */
 3532|      0|                int num_SB_N_Neutr = 0, num_DB_O = 0, iat;
 3533|      0|                short iat_SB_N_Neutr[MAX_DIFF_FIXH], iat_DB_O[MAX_DIFF_FIXH];
 3534|      0|                cur_success = 0;
 3535|      0|                for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (3535:29): [True: 0, False: 0]
  ------------------
 3536|      0|                { /* i = canonical number - 1 */
 3537|      0|                    iat = nCanon2AtnoRevrs[i];
 3538|      0|                    if ( /* orig. InChI info: -O(-) */
 3539|      0|                         num_DB_O < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|      0|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (3539:26): [True: 0, False: 0]
  ------------------
 3540|      0|                         ( pVA[i].cNumValenceElectrons == 6 /* O, S, Se, Te */ ) &&
  ------------------
  |  Branch (3540:26): [True: 0, False: 0]
  ------------------
 3541|      0|                         pStruct->endpoint[i] == itg + 1 &&
  ------------------
  |  Branch (3541:26): [True: 0, False: 0]
  ------------------
 3542|      0|                         ( e = pVA[i].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (3542:26): [True: 0, False: 0]
  |  Branch (3542:70): [True: 0, False: 0]
  ------------------
 3543|      0|                         !( pStruct->fixed_H && pStruct->fixed_H[i] ) &&
  ------------------
  |  Branch (3543:29): [True: 0, False: 0]
  |  Branch (3543:49): [True: 0, False: 0]
  ------------------
 3544|      0|                         !( nMobHInChI && nMobHInChI[i] ) &&
  ------------------
  |  Branch (3544:29): [True: 0, False: 0]
  |  Branch (3544:43): [True: 0, False: 0]
  ------------------
 3545|       |                         /* reversed structure info: */
 3546|       |                         /*!pc2i->c2at[i].endptRevrs &&*/
 3547|      0|                         !( num_Fixed_H_Revrs && num_Fixed_H_Revrs[iat] ) &&
  ------------------
  |  Branch (3547:29): [True: 0, False: 0]
  |  Branch (3547:50): [True: 0, False: 0]
  ------------------
 3548|      0|                         !( pnMobHRevrs && pnMobHRevrs[iat] ) &&
  ------------------
  |  Branch (3548:29): [True: 0, False: 0]
  |  Branch (3548:44): [True: 0, False: 0]
  ------------------
 3549|      0|                         at2[iat].charge == 0 && at2[iat].num_H == 0 &&
  ------------------
  |  Branch (3549:26): [True: 0, False: 0]
  |  Branch (3549:50): [True: 0, False: 0]
  ------------------
 3550|      0|                         at2[iat].valence == 1 && at2[iat].chem_bonds_valence == 2)
  ------------------
  |  Branch (3550:26): [True: 0, False: 0]
  |  Branch (3550:51): [True: 0, False: 0]
  ------------------
 3551|      0|                    {
 3552|       |
 3553|      0|                        iat_DB_O[num_DB_O++] = iat;
 3554|       |                        /*
 3555|       |                        if ( ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ) ) {
 3556|       |                        goto exit_function;
 3557|       |                        }
 3558|       |                        */
 3559|      0|                    }
 3560|      0|                    else
 3561|      0|                    {
 3562|      0|                        if ( /* in restored atom N: charge=0, no H, has no double bond, not an endpoint */
 3563|      0|                             num_SB_N_Neutr < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|      0|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (3563:30): [True: 0, False: 0]
  ------------------
 3564|      0|                             at2[iat].charge == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (3564:30): [True: 0, False: 0]
  |  Branch (3564:54): [True: 0, False: 0]
  ------------------
 3565|       |                             /*at2[iat].valence == at2[iat].chem_bonds_valence ||*/
 3566|      0|                             ( at2[iat].valence == 4 && at2[iat].chem_bonds_valence == 5 ) &&
  ------------------
  |  Branch (3566:32): [True: 0, False: 0]
  |  Branch (3566:57): [True: 0, False: 0]
  ------------------
 3567|      0|                             !pVA[iat].cMetal &&
  ------------------
  |  Branch (3567:30): [True: 0, False: 0]
  ------------------
 3568|      0|                             pVA[iat].cNumValenceElectrons == 5 && pVA[iat].cPeriodicRowNumber >= 1 &&
  ------------------
  |  Branch (3568:30): [True: 0, False: 0]
  |  Branch (3568:68): [True: 0, False: 0]
  ------------------
 3569|      0|                             !( at_Mobile_H_Revrs && at_Mobile_H_Revrs[iat].endpoint ) &&
  ------------------
  |  Branch (3569:33): [True: 0, False: 0]
  |  Branch (3569:54): [True: 0, False: 0]
  ------------------
 3570|       |                             /* in orig.InChI: not an endpoint, has no H */
 3571|      0|                             !pStruct->endpoint[i] &&
  ------------------
  |  Branch (3571:30): [True: 0, False: 0]
  ------------------
 3572|      0|                             !( pStruct->fixed_H && pStruct->fixed_H[i] ) &&
  ------------------
  |  Branch (3572:33): [True: 0, False: 0]
  |  Branch (3572:53): [True: 0, False: 0]
  ------------------
 3573|      0|                             !( nMobHInChI && nMobHInChI[i] ) &&
  ------------------
  |  Branch (3573:33): [True: 0, False: 0]
  |  Branch (3573:47): [True: 0, False: 0]
  ------------------
 3574|       |                             /* has (+) edge */
 3575|      0|                             ( e = pVA[iat].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (3575:30): [True: 0, False: 0]
  |  Branch (3575:75): [True: 0, False: 0]
  ------------------
 3576|      0|                        {
 3577|       |
 3578|      0|                            iat_SB_N_Neutr[num_SB_N_Neutr++] = iat;
 3579|      0|                            if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (3579:33): [True: 0, False: 0]
  ------------------
 3580|      0|                            {
 3581|      0|                                goto exit_function;
 3582|      0|                            }
 3583|      0|                        }
 3584|      0|                    }
 3585|      0|                }
 3586|      0|                if (num_try = inchi_min( num_SB_N_Neutr, num_DB_O ))
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (3586:21): [True: 0, False: 0]
  ------------------
 3587|      0|                {
 3588|       |                    /* detected; attempt to fix */
 3589|      0|                    BNS_EDGE *pe_CMinus;
 3590|      0|                    SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 3591|      0|                    RemoveForbiddenEdgeMask( pBNS, &CurrEdges, forbidden_edge_mask );
 3592|      0|                    delta = 1;
 3593|      0|                    for (i = 0; i < num_DB_O && cur_success < num_try; i++)
  ------------------
  |  Branch (3593:33): [True: 0, False: 0]
  |  Branch (3593:49): [True: 0, False: 0]
  ------------------
 3594|      0|                    {
 3595|      0|                        iat = iat_DB_O[i];
 3596|      0|                        pe_CMinus = pBNS->edge + pVA[iat].nCMinusGroupEdge - 1;
 3597|      0|                        pe_CMinus->forbidden &= forbidden_edge_mask_inv;
 3598|       |
 3599|      0|                        pe = pBNS->edge + pBNS->vert[iat].iedge[0]; /* double bond O=...*/
 3600|      0|                        if (!pe->flow)
  ------------------
  |  Branch (3600:29): [True: 0, False: 0]
  ------------------
 3601|      0|                            continue;
 3602|      0|                        pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 3603|      0|                        pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 3604|       |
 3605|      0|                        pe->forbidden |= forbidden_edge_mask; /* change bond O=X to O(rad)-X(rad) */
 3606|      0|                        pe->flow -= delta;
 3607|      0|                        pv1->st_edge.flow -= delta;
 3608|      0|                        pv2->st_edge.flow -= delta;
 3609|      0|                        pBNS->tot_st_flow -= 2 * delta;
 3610|       |
 3611|      0|                        ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 3612|      0|                                              &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 3613|       |
 3614|      0|                        if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (3614:29): [True: 0, False: 0]
  |  Branch (3614:43): [True: 0, False: 0]
  |  Branch (3614:61): [True: 0, False: 0]
  ------------------
 3615|      0|                                          vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == 2)
  ------------------
  |  Branch (3615:43): [True: 0, False: 0]
  |  Branch (3615:61): [True: 0, False: 0]
  |  Branch (3615:83): [True: 0, False: 0]
  ------------------
 3616|      0|                        {
 3617|       |                            /* Added (-) charge to =O and (+) charge to N => nDeltaCharge == 2 */
 3618|      0|                            ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 3619|      0|                            if (ret > 0)
  ------------------
  |  Branch (3619:33): [True: 0, False: 0]
  ------------------
 3620|      0|                            {
 3621|      0|                                nNumRunBNS++;
 3622|      0|                                cur_success++; /* 13 */
 3623|      0|                            }
 3624|      0|                        }
 3625|      0|                        else
 3626|      0|                        {
 3627|      0|                            pe->flow += delta;
 3628|      0|                            pv1->st_edge.flow += delta;
 3629|      0|                            pv2->st_edge.flow += delta;
 3630|      0|                            pBNS->tot_st_flow += 2 * delta;
 3631|      0|                        }
 3632|      0|                        pe->forbidden &= forbidden_edge_mask_inv; /* allow changes to O=X bond */
 3633|      0|                        INCHI_HEAPCHK
 3634|      0|                    }
 3635|      0|                    RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 3636|      0|                }
 3637|      0|                CurrEdges.num_edges = 0; /* clear current edge list */
 3638|      0|                if (cur_success)
  ------------------
  |  Branch (3638:21): [True: 0, False: 0]
  ------------------
 3639|      0|                {
 3640|      0|                    tot_succes += cur_success;
 3641|       |                    /* recalculate InChI from the structure */
 3642|      0|                    if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (3642:25): [True: 0, False: 0]
  ------------------
 3643|      0|                                                                    ppt_group_info, ppat_norm, ppat_prep ) ))
 3644|      0|                    {
 3645|      0|                        goto exit_function;
 3646|      0|                    }
 3647|      0|                    if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (3647:25): [True: 0, False: 0]
  ------------------
 3648|      0|                    {
 3649|      0|                        goto exit_function;
 3650|      0|                    }
 3651|      0|                    if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (3651:25): [True: 0, False: 0]
  |  Branch (3651:53): [True: 0, False: 0]
  ------------------
 3652|      0|                    {
 3653|      0|                        goto exit_function;  /* no fixed-H found */
 3654|      0|                    }
 3655|      0|                    if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (3655:25): [True: 0, False: 0]
  ------------------
 3656|      0|                    {
 3657|      0|                        goto exit_function;
 3658|      0|                    }
 3659|      0|                    if (!pc2i->bHasDifference)
  ------------------
  |  Branch (3659:25): [True: 0, False: 0]
  ------------------
 3660|      0|                    {
 3661|      0|                        goto exit_function; /* nothing to do */
 3662|      0|                    }
 3663|      0|                    break;
 3664|      0|                }/* else
 3665|       |                 if ( bOnly_N_V ) {
 3666|       |                 bOnly_N_V = 0;
 3667|       |                 }
 3668|       |                 */
 3669|      0|                break;
 3670|      0|            }
 3671|      0|        }
 3672|      0|    }
 3673|       |
 3674|      1|    if (( pc2i->nNumTgInChI <= 1 &&
  ------------------
  |  Branch (3674:11): [True: 1, False: 0]
  ------------------
 3675|      1|          pc2i->nNumRemHInChI > pc2i->nNumRemHRevrs || pc2i->len_c2at ) &&
  ------------------
  |  Branch (3675:11): [True: 1, False: 0]
  |  Branch (3675:56): [True: 0, False: 0]
  ------------------
 3676|      1|         bHas_N_V( at2, pStruct->num_atoms ))
  ------------------
  |  Branch (3676:10): [True: 0, False: 1]
  ------------------
 3677|      0|    {
 3678|       |        /*-----------------------------------------------------------------*/
 3679|       |        /*                         |                         |             */
 3680|       |        /* case 14: restored:-N=AB=N=CD-XH original: (-)N-AB-N(+)=CD-XH    */
 3681|       |        /* FixH:              0    0   0/1              0            1     */
 3682|       |        /* MobH:              0    0   1/0              0            0     */
 3683|       |        /*                   non-taut  n/t             any  non     any    */
 3684|       |        /*                                                  taut           */
 3685|       |        /* X = O, S, Se, N; N = N                                          */
 3686|       |        /* t-group in original may have more (-) than in restored          */
 3687|       |        /*       same num_H and less (-) than in the restored structure    */
 3688|       |        /* atom N(V)/N(IV)(+) is not taut in both                          */
 3689|       |        /* The following transformation should be possible:                */
 3690|       |        /*        |                         |                              */
 3691|       |        /*   N=AB=N=CD-XH    ->     (-)N-AB-N-CD=XH(+)                     */
 3692|       |        /* This allows ADP to remove H(+) from -XH                         */
 3693|       |        /* As the result, the original structure has 0 or 1 t-group        */
 3694|       |        /* Solution: separate charges between -N(III)= and  N(V)           */
 3695|       |        /*-----------------------------------------------------------------*/
 3696|      0|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 3697|      0|        inp_ATOM *at_Mobile_H_Revrs = ( pStruct->pOne_norm_data[1] &&
  ------------------
  |  Branch (3697:41): [True: 0, False: 0]
  ------------------
 3698|      0|                                        pStruct->pOne_norm_data[1]->at ) ? pStruct->pOne_norm_data[1]->at : NULL;
  ------------------
  |  Branch (3698:41): [True: 0, False: 0]
  ------------------
 3699|       |
 3700|      0|        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H ? pInChI[1]->nNum_H :
  ------------------
  |  Branch (3700:32): [True: 0, False: 0]
  |  Branch (3700:45): [True: 0, False: 0]
  ------------------
 3701|      0|            pInChI[0] && pInChI[0]->nNum_H ? pInChI[0]->nNum_H : 0;
  ------------------
  |  Branch (3701:13): [True: 0, False: 0]
  |  Branch (3701:26): [True: 0, False: 0]
  ------------------
 3702|      0|        int num_N_V = 0, iat, i1, i2, i3, e1Flower, e1Plus, e2Plus, e2Minus, e3Plus;
 3703|      0|        int max_success = pc2i->nNumRemHInChI - pc2i->nNumRemHRevrs;
 3704|      0|        short iat_N_V_Array[MAX_DIFF_FIXH];
 3705|      0|        EDGE_LIST iat_X_List, iat_N_III_List;
 3706|      0|        AllocEdgeList( &iat_X_List, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      0|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 3707|      0|        AllocEdgeList( &iat_N_III_List, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      0|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 3708|      0|        cur_success = 0;
 3709|      0|        ret = 0;
 3710|      0|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (3710:21): [True: 0, False: 0]
  ------------------
 3711|      0|        {
 3712|      0|            iat = nCanon2AtnoRevrs[i];
 3713|       |            /* search for N(V), 3 bonds */
 3714|      0|            if ( /* restored structure */
 3715|      0|                 num_N_V < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|      0|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (3715:18): [True: 0, False: 0]
  ------------------
 3716|      0|                 at2[iat].chem_bonds_valence == 5 && at2[iat].valence == 3 &&
  ------------------
  |  Branch (3716:18): [True: 0, False: 0]
  |  Branch (3716:54): [True: 0, False: 0]
  ------------------
 3717|      0|                 !at2[iat].charge && !at2[iat].radical &&
  ------------------
  |  Branch (3717:18): [True: 0, False: 0]
  |  Branch (3717:38): [True: 0, False: 0]
  ------------------
 3718|      0|                 pVA[iat].cNumValenceElectrons == 5 && pVA[iat].cPeriodicRowNumber == 1 &&
  ------------------
  |  Branch (3718:18): [True: 0, False: 0]
  |  Branch (3718:56): [True: 0, False: 0]
  ------------------
 3719|      0|                 !( at_Mobile_H_Revrs && at_Mobile_H_Revrs[i].endpoint ) &&
  ------------------
  |  Branch (3719:21): [True: 0, False: 0]
  |  Branch (3719:42): [True: 0, False: 0]
  ------------------
 3720|      0|                 !at2[iat].num_H &&
  ------------------
  |  Branch (3720:18): [True: 0, False: 0]
  ------------------
 3721|      0|                 ( e = pVA[iat].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (3721:18): [True: 0, False: 0]
  |  Branch (3721:63): [True: 0, False: 0]
  ------------------
 3722|      0|                 pBNS->edge[e].flow /* no charge */ &&
  ------------------
  |  Branch (3722:18): [True: 0, False: 0]
  ------------------
 3723|      0|                 NO_VERTEX != ( j = GetChargeFlowerUpperEdge( pBNS, pVA, e ) ) && !pBNS->edge[j].forbidden &&
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (3723:18): [True: 0, False: 0]
  |  Branch (3723:83): [True: 0, False: 0]
  ------------------
 3724|      0|                 !pBNS->edge[j].flow /* neutral, valence=5 */ &&
  ------------------
  |  Branch (3724:18): [True: 0, False: 0]
  ------------------
 3725|       |                 /* orig. InChI */
 3726|      0|                 !pStruct->endpoint[i] &&
  ------------------
  |  Branch (3726:18): [True: 0, False: 0]
  ------------------
 3727|      0|                 !( nMobHInChI && nMobHInChI[i] ) && !pStruct->fixed_H[i])
  ------------------
  |  Branch (3727:21): [True: 0, False: 0]
  |  Branch (3727:35): [True: 0, False: 0]
  |  Branch (3727:54): [True: 0, False: 0]
  ------------------
 3728|      0|            {
 3729|      0|                iat_N_V_Array[num_N_V++] = iat;
 3730|      0|            }
 3731|      0|            else
 3732|      0|            {
 3733|       |                /* search for -N= */
 3734|      0|                if ( /* restored structure */
 3735|      0|                     at2[iat].chem_bonds_valence == 3 && at2[iat].valence == 2 &&
  ------------------
  |  Branch (3735:22): [True: 0, False: 0]
  |  Branch (3735:58): [True: 0, False: 0]
  ------------------
 3736|      0|                     !at2[iat].charge && !at2[iat].radical &&
  ------------------
  |  Branch (3736:22): [True: 0, False: 0]
  |  Branch (3736:42): [True: 0, False: 0]
  ------------------
 3737|      0|                     pVA[iat].cNumValenceElectrons == 5 && pVA[iat].cPeriodicRowNumber == 1 &&
  ------------------
  |  Branch (3737:22): [True: 0, False: 0]
  |  Branch (3737:60): [True: 0, False: 0]
  ------------------
 3738|      0|                     !( at_Mobile_H_Revrs && at_Mobile_H_Revrs[i].endpoint ) &&
  ------------------
  |  Branch (3738:25): [True: 0, False: 0]
  |  Branch (3738:46): [True: 0, False: 0]
  ------------------
 3739|      0|                     !at2[iat].num_H &&
  ------------------
  |  Branch (3739:22): [True: 0, False: 0]
  ------------------
 3740|      0|                     ( e = pVA[iat].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (3740:22): [True: 0, False: 0]
  |  Branch (3740:68): [True: 0, False: 0]
  ------------------
 3741|      0|                     !pBNS->edge[e].flow /* no charge */ &&
  ------------------
  |  Branch (3741:22): [True: 0, False: 0]
  ------------------
 3742|       |                     /* orig. InChI */
 3743|       |                     /*!pStruct->endpoint[i] &&*/
 3744|      0|                     !( nMobHInChI && nMobHInChI[i] ) && !pStruct->fixed_H[i])
  ------------------
  |  Branch (3744:25): [True: 0, False: 0]
  |  Branch (3744:39): [True: 0, False: 0]
  |  Branch (3744:58): [True: 0, False: 0]
  ------------------
 3745|      0|                {
 3746|       |
 3747|      0|                    if (ret = AddToEdgeList( &iat_N_III_List, iat, 32 ))
  ------------------
  |  Branch (3747:25): [True: 0, False: 0]
  ------------------
 3748|      0|                    {
 3749|      0|                        goto exit_case_14;
 3750|      0|                    }
 3751|      0|                }
 3752|      0|                else
 3753|      0|                {
 3754|       |                    /* search for -OH -NH-, -NH2 */
 3755|      0|                    if ( /* restored structure */
 3756|      0|                         at2[iat].chem_bonds_valence == at2[iat].valence &&
  ------------------
  |  Branch (3756:26): [True: 0, False: 0]
  ------------------
 3757|      0|                         !at2[iat].charge && !at2[iat].radical &&
  ------------------
  |  Branch (3757:26): [True: 0, False: 0]
  |  Branch (3757:46): [True: 0, False: 0]
  ------------------
 3758|      0|                         ( pVA[iat].cNumValenceElectrons == 5 && pVA[iat].cPeriodicRowNumber == 1 ||
  ------------------
  |  Branch (3758:28): [True: 0, False: 0]
  |  Branch (3758:66): [True: 0, False: 0]
  ------------------
 3759|      0|                           pVA[iat].cNumValenceElectrons == 6 ) &&
  ------------------
  |  Branch (3759:28): [True: 0, False: 0]
  ------------------
 3760|      0|                         at2[iat].num_H &&
  ------------------
  |  Branch (3760:26): [True: 0, False: 0]
  ------------------
 3761|      0|                         ( e = pVA[iat].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (3761:26): [True: 0, False: 0]
  |  Branch (3761:71): [True: 0, False: 0]
  ------------------
 3762|      0|                         pBNS->edge[e].flow /* no charge */ &&
  ------------------
  |  Branch (3762:26): [True: 0, False: 0]
  ------------------
 3763|       |                         /* orig. InChI */
 3764|      0|                         !( nMobHInChI && nMobHInChI[i] ) && pStruct->fixed_H[i])
  ------------------
  |  Branch (3764:29): [True: 0, False: 0]
  |  Branch (3764:43): [True: 0, False: 0]
  |  Branch (3764:62): [True: 0, False: 0]
  ------------------
 3765|      0|                    {
 3766|       |
 3767|      0|                        if (ret = AddToEdgeList( &iat_X_List, iat, 32 ))
  ------------------
  |  Branch (3767:29): [True: 0, False: 0]
  ------------------
 3768|      0|                        {
 3769|      0|                            goto exit_case_14;
 3770|      0|                        }
 3771|      0|                    }
 3772|      0|                }
 3773|      0|            }
 3774|      0|        }
 3775|      0|        if (!max_success)
  ------------------
  |  Branch (3775:13): [True: 0, False: 0]
  ------------------
 3776|      0|        {
 3777|      0|            max_success = inchi_min( num_N_V, iat_N_III_List.num_edges );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3778|      0|            max_success = inchi_min( max_success, iat_X_List.num_edges );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3779|      0|        }
 3780|      0|        if (num_N_V && iat_N_III_List.num_edges && iat_X_List.num_edges)
  ------------------
  |  Branch (3780:13): [True: 0, False: 0]
  |  Branch (3780:24): [True: 0, False: 0]
  |  Branch (3780:52): [True: 0, False: 0]
  ------------------
 3781|      0|        {
 3782|      0|            for (i1 = 0; i1 < num_N_V && cur_success < max_success; i1++)
  ------------------
  |  Branch (3782:26): [True: 0, False: 0]
  |  Branch (3782:42): [True: 0, False: 0]
  ------------------
 3783|      0|            {
 3784|      0|                int iat_N_V = iat_N_V_Array[i1];
 3785|      0|                if (NO_VERTEX == iat_N_V ||
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (3785:21): [True: 0, False: 0]
  ------------------
 3786|      0|                     0 >= ( e1Plus = pVA[iat_N_V].nCPlusGroupEdge - 1 ) ||
  ------------------
  |  Branch (3786:22): [True: 0, False: 0]
  ------------------
 3787|      0|                     NO_VERTEX == ( e1Flower = GetChargeFlowerUpperEdge( pBNS, pVA, e1Plus ) ) ||
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (3787:22): [True: 0, False: 0]
  ------------------
 3788|      0|                     1 != pBNS->edge[e1Plus].flow ||
  ------------------
  |  Branch (3788:22): [True: 0, False: 0]
  ------------------
 3789|      0|                     0 != pBNS->edge[e1Flower].flow)
  ------------------
  |  Branch (3789:22): [True: 0, False: 0]
  ------------------
 3790|      0|                {
 3791|      0|                    continue;
 3792|      0|                }
 3793|      0|                for (i2 = iat_N_III_List.num_edges - 1; 0 <= i2 && cur_success < max_success; i2--)
  ------------------
  |  Branch (3793:57): [True: 0, False: 0]
  |  Branch (3793:68): [True: 0, False: 0]
  ------------------
 3794|      0|                {
 3795|      0|                    int iat_N_III = iat_N_III_List.pnEdges[i2];
 3796|      0|                    if (NO_VERTEX == iat_N_III ||
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (3796:25): [True: 0, False: 0]
  ------------------
 3797|      0|                         0 >= ( e2Minus = pVA[iat_N_III].nCMinusGroupEdge - 1 ) ||
  ------------------
  |  Branch (3797:26): [True: 0, False: 0]
  ------------------
 3798|      0|                         0 >= ( e2Plus = pVA[iat_N_III].nCPlusGroupEdge - 1 ) ||
  ------------------
  |  Branch (3798:26): [True: 0, False: 0]
  ------------------
 3799|      0|                         0 != pBNS->edge[e2Minus].flow ||
  ------------------
  |  Branch (3799:26): [True: 0, False: 0]
  ------------------
 3800|      0|                         1 != pBNS->edge[e2Plus].flow)
  ------------------
  |  Branch (3800:26): [True: 0, False: 0]
  ------------------
 3801|      0|                    {
 3802|       |                        /* do not consider this atom anymore */
 3803|      0|                        iat_N_III_List.pnEdges[i2] = NO_VERTEX;
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
 3804|      0|                        continue;
 3805|      0|                    }
 3806|      0|                    for (i3 = iat_X_List.num_edges - 1; 0 <= i3 && cur_success < max_success; i3--)
  ------------------
  |  Branch (3806:57): [True: 0, False: 0]
  |  Branch (3806:68): [True: 0, False: 0]
  ------------------
 3807|      0|                    {
 3808|      0|                        int iat_X = iat_X_List.pnEdges[i3];
 3809|      0|                        BNS_VERTEX *pv1n, *pv2n;
 3810|      0|                        BNS_EDGE   *pe1n, *pe2n, *pe1Plus, *pe2Minus, *pe3Plus;
 3811|      0|                        Vertex      v1n, v2n;
 3812|      0|                        ret = 0;
 3813|      0|                        if (NO_VERTEX == iat_X ||
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (3813:29): [True: 0, False: 0]
  ------------------
 3814|      0|                             0 >= ( e3Plus = pVA[iat_X].nCPlusGroupEdge - 1 ) ||
  ------------------
  |  Branch (3814:30): [True: 0, False: 0]
  ------------------
 3815|      0|                             1 != pBNS->edge[e3Plus].flow)
  ------------------
  |  Branch (3815:30): [True: 0, False: 0]
  ------------------
 3816|      0|                        {
 3817|       |                            /* do not consider this atom anymore */
 3818|      0|                            iat_X_List.pnEdges[i3] = NO_VERTEX;
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
 3819|      0|                            continue;
 3820|      0|                        }
 3821|       |                        /* all is ready to check whether the following applies:
 3822|       |                        forbid changes of all charges and N,P,... flowers
 3823|       |                        allow to change edges: e2Minus, e3Plus
 3824|       |                        Increment flow in e1Flower
 3825|       |                        The result should be: increase in number of charges by 2
 3826|       |                        */
 3827|      0|                        pe1Plus = pBNS->edge + e1Plus;  /* N(V) positive charge edge */
 3828|      0|                        pe2Minus = pBNS->edge + e2Minus; /* =N- negative charge edge */
 3829|      0|                        pe3Plus = pBNS->edge + e3Plus;  /* -XH positive charge edge */
 3830|      0|                        pe = pBNS->edge + e1Flower; /* N(V) flower edge */
 3831|      0|                        pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 3832|      0|                        pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 3833|      0|                        for (j = pv1->num_adj_edges - 1; 0 <= j; j--)
  ------------------
  |  Branch (3833:58): [True: 0, False: 0]
  ------------------
 3834|      0|                        {
 3835|      0|                            pe1n = pBNS->edge + pv1->iedge[j];
 3836|      0|                            if (pe1n->flow && !pe1n->forbidden && pe1n != pe1Plus)
  ------------------
  |  Branch (3836:33): [True: 0, False: 0]
  |  Branch (3836:47): [True: 0, False: 0]
  |  Branch (3836:67): [True: 0, False: 0]
  ------------------
 3837|      0|                            {
 3838|      0|                                pv1n = pBNS->vert + ( v1n = pe1n->neighbor12 ^ v1 );
 3839|      0|                                break;
 3840|      0|                            }
 3841|      0|                        }
 3842|      0|                        if (j < 0)
  ------------------
  |  Branch (3842:29): [True: 0, False: 0]
  ------------------
 3843|      0|                        {
 3844|      0|                            continue; /* not found -- should not happen */
 3845|      0|                        }
 3846|      0|                        for (j = pv2->num_adj_edges - 1; 0 <= j; j--)
  ------------------
  |  Branch (3846:58): [True: 0, False: 0]
  ------------------
 3847|      0|                        { /* was -2; changed 2006-2-28 12:35pm*/
 3848|      0|                            pe2n = pBNS->edge + pv2->iedge[j];
 3849|      0|                            if (pe2n->flow && !pe2n->forbidden && pe2n != pe1Plus)
  ------------------
  |  Branch (3849:33): [True: 0, False: 0]
  |  Branch (3849:47): [True: 0, False: 0]
  |  Branch (3849:67): [True: 0, False: 0]
  ------------------
 3850|      0|                            {
 3851|      0|                                pv2n = pBNS->vert + ( v2n = pe2n->neighbor12 ^ v2 );
 3852|      0|                                break;
 3853|      0|                            }
 3854|      0|                        }
 3855|      0|                        if (j < 0)
  ------------------
  |  Branch (3855:29): [True: 0, False: 0]
  ------------------
 3856|      0|                        {
 3857|      0|                            continue; /* not found -- should not happen */
 3858|      0|                        }
 3859|      0|                        delta = 1;
 3860|      0|                        pe->flow += delta;
 3861|      0|                        pe1n->flow -= delta;
 3862|      0|                        pe2n->flow -= delta;
 3863|      0|                        pv1n->st_edge.flow -= delta;
 3864|      0|                        pv2n->st_edge.flow -= delta;
 3865|      0|                        pBNS->tot_st_flow -= 2 * delta;
 3866|       |
 3867|      0|                        SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 3868|      0|                        SetForbiddenEdgeMask( pBNS, &OtherNFlowerEdges, forbidden_edge_mask );
 3869|       |
 3870|       |                        /* allow two charges to change */
 3871|      0|                        pe2Minus->forbidden &= forbidden_edge_mask_inv;
 3872|      0|                        pe3Plus->forbidden &= forbidden_edge_mask_inv;
 3873|       |                        /* test #1 */
 3874|      0|                        ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 3875|      0|                                              &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 3876|      0|                        INCHI_HEAPCHK
 3877|      0|                            if (ret < 0)
  ------------------
  |  Branch (3877:33): [True: 0, False: 0]
  ------------------
 3878|      0|                            {
 3879|      0|                                goto exit_case_14;
 3880|      0|                            }
 3881|      0|                            else
 3882|      0|                            {
 3883|      0|                                if (ret == 1 && ( vPathEnd == v1n && vPathStart == v2n ||
  ------------------
  |  Branch (3883:37): [True: 0, False: 0]
  |  Branch (3883:51): [True: 0, False: 0]
  |  Branch (3883:70): [True: 0, False: 0]
  ------------------
 3884|      0|                                                  vPathEnd == v2n && vPathStart == v1n ) &&
  ------------------
  |  Branch (3884:51): [True: 0, False: 0]
  |  Branch (3884:70): [True: 0, False: 0]
  ------------------
 3885|      0|                                     nDeltaCharge == 2)
  ------------------
  |  Branch (3885:38): [True: 0, False: 0]
  ------------------
 3886|      0|                                {
 3887|      0|                                    ; /* success */
 3888|      0|                                }
 3889|      0|                                else
 3890|      0|                                {
 3891|      0|                                    ret = 0;
 3892|      0|                                }
 3893|      0|                            }
 3894|       |                        /* restore BNS */
 3895|      0|                        pe2Minus->forbidden |= forbidden_edge_mask;
 3896|      0|                        pe3Plus->forbidden |= forbidden_edge_mask;
 3897|      0|                        pe->flow -= delta;
 3898|      0|                        pe1n->flow += delta;
 3899|      0|                        pe2n->flow += delta;
 3900|      0|                        pv1n->st_edge.flow += delta;
 3901|      0|                        pv2n->st_edge.flow += delta;
 3902|      0|                        pBNS->tot_st_flow += 2 * delta;
 3903|      0|                        if (ret == 1)
  ------------------
  |  Branch (3903:29): [True: 0, False: 0]
  ------------------
 3904|      0|                        {
 3905|       |                            /* test #2: check if charge separation is possible */
 3906|      0|                            pe->flow += delta;
 3907|      0|                            pe1n->flow -= delta;
 3908|      0|                            pe2n->flow -= delta;
 3909|      0|                            pv1n->st_edge.flow -= delta;
 3910|      0|                            pv2n->st_edge.flow -= delta;
 3911|      0|                            pBNS->tot_st_flow -= 2 * delta;
 3912|       |
 3913|       |                            /* allow two charges (N(V) and N(III)) to change */
 3914|      0|                            pe2Minus->forbidden &= forbidden_edge_mask_inv;
 3915|      0|                            pe1Plus->forbidden &= forbidden_edge_mask_inv;
 3916|       |                            /* test #2 */
 3917|      0|                            ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 3918|      0|                                                  &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 3919|      0|                            if (ret == 1 && ( vPathEnd == v1n && vPathStart == v2n ||
  ------------------
  |  Branch (3919:33): [True: 0, False: 0]
  |  Branch (3919:47): [True: 0, False: 0]
  |  Branch (3919:66): [True: 0, False: 0]
  ------------------
 3920|      0|                                              vPathEnd == v2n && vPathStart == v1n ) &&
  ------------------
  |  Branch (3920:47): [True: 0, False: 0]
  |  Branch (3920:66): [True: 0, False: 0]
  ------------------
 3921|      0|                                 nDeltaCharge == 2)
  ------------------
  |  Branch (3921:34): [True: 0, False: 0]
  ------------------
 3922|      0|                            {
 3923|       |                                /* success; actually change charges */
 3924|      0|                                ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 3925|      0|                                if (ret > 0)
  ------------------
  |  Branch (3925:37): [True: 0, False: 0]
  ------------------
 3926|      0|                                {
 3927|      0|                                    nNumRunBNS++;
 3928|      0|                                    cur_success++; /* 14 */
 3929|      0|                                }
 3930|      0|                            }
 3931|      0|                            if (ret <= 0)
  ------------------
  |  Branch (3931:33): [True: 0, False: 0]
  ------------------
 3932|      0|                            {
 3933|       |                                /* failed: restore BNS flow */
 3934|      0|                                pe->flow -= delta;
 3935|      0|                                pe1n->flow += delta;
 3936|      0|                                pe2n->flow += delta;
 3937|      0|                                pv1n->st_edge.flow += delta;
 3938|      0|                                pv2n->st_edge.flow += delta;
 3939|      0|                                pBNS->tot_st_flow += 2 * delta;
 3940|      0|                            }
 3941|      0|                            INCHI_HEAPCHK
 3942|      0|                        }
 3943|      0|                        RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 3944|      0|                        RemoveForbiddenEdgeMask( pBNS, &OtherNFlowerEdges, forbidden_edge_mask );
 3945|      0|                        if (ret > 0)
  ------------------
  |  Branch (3945:29): [True: 0, False: 0]
  ------------------
 3946|      0|                        {
 3947|       |                            /* do not repeat for the same atoms */
 3948|      0|                            iat_N_V_Array[i1] = NO_VERTEX;
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
 3949|      0|                            iat_N_III_List.pnEdges[i2] = NO_VERTEX;
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
 3950|      0|                            iat_X_List.pnEdges[i3] = NO_VERTEX;
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
 3951|      0|                        }
 3952|      0|                        if (ret < 0)
  ------------------
  |  Branch (3952:29): [True: 0, False: 0]
  ------------------
 3953|      0|                        {
 3954|      0|                            goto exit_case_14;
 3955|      0|                        }
 3956|      0|                        if (ret > 0)
  ------------------
  |  Branch (3956:29): [True: 0, False: 0]
  ------------------
 3957|      0|                        {
 3958|      0|                            break;
 3959|      0|                        }
 3960|      0|                    } /* i3 cycle */
 3961|      0|                    if (ret > 0)
  ------------------
  |  Branch (3961:25): [True: 0, False: 0]
  ------------------
 3962|      0|                    {
 3963|      0|                        break;
 3964|      0|                    }
 3965|      0|                } /* i2 cycle */
 3966|      0|            }
 3967|      0|        }
 3968|      0|    exit_case_14:
 3969|      0|        AllocEdgeList( &iat_X_List, EDGE_LIST_FREE );
  ------------------
  |  |  271|      0|#define EDGE_LIST_FREE   (-2)
  ------------------
 3970|      0|        AllocEdgeList( &iat_N_III_List, EDGE_LIST_FREE );
  ------------------
  |  |  271|      0|#define EDGE_LIST_FREE   (-2)
  ------------------
 3971|      0|        RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 3972|      0|        RemoveForbiddenEdgeMask( pBNS, &OtherNFlowerEdges, forbidden_edge_mask );
 3973|      0|        CurrEdges.num_edges = 0; /* clear current edge list */
 3974|      0|        if (ret < 0)
  ------------------
  |  Branch (3974:13): [True: 0, False: 0]
  ------------------
 3975|      0|        {
 3976|      0|            goto exit_function;
 3977|      0|        }
 3978|      0|        if (cur_success)
  ------------------
  |  Branch (3978:13): [True: 0, False: 0]
  ------------------
 3979|      0|        {
 3980|      0|            tot_succes += cur_success;
 3981|       |            /* recalculate InChI from the structure */
 3982|      0|            if (0 >( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (3982:17): [True: 0, False: 0]
  ------------------
 3983|      0|                                                           ppt_group_info, ppat_norm, ppat_prep ) ))
 3984|      0|            {
 3985|      0|                goto exit_function;
 3986|      0|            }
 3987|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (3987:17): [True: 0, False: 0]
  ------------------
 3988|      0|            {
 3989|      0|                goto exit_function;
 3990|      0|            }
 3991|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (3991:17): [True: 0, False: 0]
  |  Branch (3991:45): [True: 0, False: 0]
  ------------------
 3992|      0|            {
 3993|      0|                goto exit_function;  /* no fixed-H found */
 3994|      0|            }
 3995|      0|            if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (3995:17): [True: 0, False: 0]
  ------------------
 3996|      0|            {
 3997|      0|                goto exit_function;
 3998|      0|            }
 3999|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (3999:17): [True: 0, False: 0]
  ------------------
 4000|      0|            {
 4001|      0|                goto exit_function; /* nothing to do */
 4002|      0|            }
 4003|      0|        }
 4004|      0|    }
 4005|       |
 4006|      1|    if (pc2i->nNumTgMRevrs > pc2i->nNumTgMInChI ||
  ------------------
  |  Branch (4006:9): [True: 1, False: 0]
  ------------------
 4007|      1|         pc2i->nNumRemHRevrs < pc2i->nNumRemHInChI ||
  ------------------
  |  Branch (4007:10): [True: 0, False: 0]
  ------------------
 4008|      1|         pc2i->nNumEndpRevrs < pc2i->nNumEndpInChI ||
  ------------------
  |  Branch (4008:10): [True: 0, False: 0]
  ------------------
 4009|      1|         pc2i->nNumTgInChI <= 1 && pc2i->nNumTgRevrs > pc2i->nNumTgInChI)
  ------------------
  |  Branch (4009:10): [True: 0, False: 0]
  |  Branch (4009:36): [True: 0, False: 0]
  ------------------
 4010|      1|    {
 4011|       |        /*--------------------------------------------------------------*/
 4012|       |        /* case 15: restored: -(+)O=AB-N<  orig: -O-AB=N(+)<            */
 4013|       |        /* (a) restored t-groups have more (-) than in original InChI   */
 4014|       |        /* (b) Mobile-H    charge: restored > original InChI *and*      */
 4015|       |        /*              removed H: restored < original InChI            */
 4016|       |        /* (c) restored t-groups have less endpnoits than in orig InChI */
 4017|       |        /* O = O, S, Se, Te; N = N                                      */
 4018|       |        /* Solution: move (+) from -O(+)= to -N<                        */
 4019|       |        /*--------------------------------------------------------------*/
 4020|      1|        int num_SB_Neutr = 0, num_DB_Charged = 0, iat;
 4021|      1|        short iat_SB_Neutr[MAX_DIFF_FIXH], iat_DB_Charged[MAX_DIFF_FIXH];
 4022|      1|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 4023|      1|        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H ? pInChI[1]->nNum_H :
  ------------------
  |  Branch (4023:32): [True: 1, False: 0]
  |  Branch (4023:45): [True: 1, False: 0]
  ------------------
 4024|      1|            pInChI[0] && pInChI[0]->nNum_H ? pInChI[0]->nNum_H : 0;
  ------------------
  |  Branch (4024:13): [True: 0, False: 0]
  |  Branch (4024:26): [True: 0, False: 0]
  ------------------
 4025|      1|        cur_success = 0;
 4026|       |        /* search for -O(+)= */
 4027|       |        /* search for -N< */
 4028|      6|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (4028:21): [True: 5, False: 1]
  ------------------
 4029|      5|        { /* i = canonical number - 1 */
 4030|      5|            iat = nCanon2AtnoRevrs[i];
 4031|      5|            if ( /* -O(+)= in restored atom: charge=1, has no H, a double bond */
 4032|      5|                 num_DB_Charged < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|     10|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (4032:18): [True: 5, False: 0]
  ------------------
 4033|      5|                 at2[iat].charge == 1 && !at2[iat].num_H &&
  ------------------
  |  Branch (4033:18): [True: 0, False: 5]
  |  Branch (4033:42): [True: 0, False: 0]
  ------------------
 4034|      5|                 at2[iat].valence < at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (4034:18): [True: 0, False: 0]
  |  Branch (4034:68): [True: 0, False: 0]
  ------------------
 4035|      5|                 ( pVA[iat].cNumValenceElectrons == 6 ) &&
  ------------------
  |  Branch (4035:18): [True: 0, False: 0]
  ------------------
 4036|       |                 /* in orig.InChI: an endpoint, has fixed-H */
 4037|       |                 /*pStruct->endpoint[i] &&*/
 4038|      5|                 !( pStruct->fixed_H && pStruct->fixed_H[i] ) &&
  ------------------
  |  Branch (4038:21): [True: 0, False: 0]
  |  Branch (4038:41): [True: 0, False: 0]
  ------------------
 4039|      5|                 !( nMobHInChI && nMobHInChI[i] ) &&
  ------------------
  |  Branch (4039:21): [True: 0, False: 0]
  |  Branch (4039:35): [True: 0, False: 0]
  ------------------
 4040|       |                 /* has (+) edge */
 4041|      5|                 ( e = pVA[iat].nCPlusGroupEdge - 1 ) >= 0 && 0 == pBNS->edge[e].forbidden)
  ------------------
  |  Branch (4041:18): [True: 0, False: 0]
  |  Branch (4041:63): [True: 0, False: 0]
  ------------------
 4042|      0|            {
 4043|       |
 4044|      0|                iat_DB_Charged[num_DB_Charged++] = iat;
 4045|       |                /*
 4046|       |                if ( ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ) ) {
 4047|       |                goto exit_function;
 4048|       |                }
 4049|       |                */
 4050|      0|            }
 4051|      5|            else
 4052|      5|            {
 4053|      5|                if ( /* -N< in restored atom: charge=0, has no H, has no double bond, N only */
 4054|      5|                     num_SB_Neutr < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|     10|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (4054:22): [True: 5, False: 0]
  ------------------
 4055|      5|                     at2[iat].charge == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (4055:22): [True: 1, False: 4]
  |  Branch (4055:46): [True: 1, False: 0]
  ------------------
 4056|      5|                     at2[iat].valence == at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (4056:22): [True: 1, False: 0]
  |  Branch (4056:73): [True: 1, False: 0]
  ------------------
 4057|      5|                     ( pVA[iat].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (4057:24): [True: 0, False: 1]
  ------------------
 4058|      1|                       pVA[iat].cPeriodicRowNumber == 1 ) &&
  ------------------
  |  Branch (4058:24): [True: 0, False: 0]
  ------------------
 4059|       |                     /* in orig.InChI: an endpoint, has fixed-H */
 4060|       |                     /*pStruct->endpoint[i] &&*/
 4061|      5|                     !( pStruct->fixed_H && pStruct->fixed_H[i] ) &&
  ------------------
  |  Branch (4061:25): [True: 0, False: 0]
  |  Branch (4061:45): [True: 0, False: 0]
  ------------------
 4062|      5|                     !( nMobHInChI && nMobHInChI[i] ) &&
  ------------------
  |  Branch (4062:25): [True: 0, False: 0]
  |  Branch (4062:39): [True: 0, False: 0]
  ------------------
 4063|       |                     /* has (+) edge */
 4064|      5|                     ( e = pVA[iat].nCPlusGroupEdge - 1 ) >= 0 && 0 == pBNS->edge[e].forbidden)
  ------------------
  |  Branch (4064:22): [True: 0, False: 0]
  |  Branch (4064:67): [True: 0, False: 0]
  ------------------
 4065|      0|                {
 4066|       |
 4067|      0|                    iat_SB_Neutr[num_SB_Neutr++] = iat;
 4068|      0|                    if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (4068:25): [True: 0, False: 0]
  ------------------
 4069|      0|                    {
 4070|      0|                        goto exit_function;
 4071|      0|                    }
 4072|      0|                }
 4073|      5|            }
 4074|      5|        }
 4075|      1|        if (num_try = inchi_min( num_SB_Neutr, num_DB_Charged ))
  ------------------
  |  |  167|      1|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (4075:13): [True: 0, False: 1]
  ------------------
 4076|      0|        {
 4077|       |            /* detected; attempt to fix */
 4078|      0|            BNS_VERTEX *pv1n, *pv2n;
 4079|      0|            BNS_EDGE   *pe1n, *pe2n;
 4080|      0|            Vertex      v1n, v2n;
 4081|      0|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 4082|      0|            RemoveForbiddenEdgeMask( pBNS, &CurrEdges, forbidden_edge_mask );
 4083|      0|            delta = 1;
 4084|      0|            for (i = 0; i < num_DB_Charged && cur_success < num_try; i++)
  ------------------
  |  Branch (4084:25): [True: 0, False: 0]
  |  Branch (4084:47): [True: 0, False: 0]
  ------------------
 4085|      0|            {
 4086|      0|                iat = iat_DB_Charged[i];
 4087|      0|                pe = pBNS->edge + pVA[iat].nCPlusGroupEdge - 1;
 4088|      0|                if (pe->flow)
  ------------------
  |  Branch (4088:21): [True: 0, False: 0]
  ------------------
 4089|      0|                    continue;
 4090|      0|                pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 4091|      0|                pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 4092|       |
 4093|      0|                for (j = pv1->num_adj_edges - 1; 0 <= j; j--)
  ------------------
  |  Branch (4093:50): [True: 0, False: 0]
  ------------------
 4094|      0|                {
 4095|      0|                    pe1n = pBNS->edge + pv1->iedge[j];
 4096|      0|                    if (pe1n->flow && !pe1n->forbidden)
  ------------------
  |  Branch (4096:25): [True: 0, False: 0]
  |  Branch (4096:39): [True: 0, False: 0]
  ------------------
 4097|      0|                    {
 4098|      0|                        pv1n = pBNS->vert + ( v1n = pe1n->neighbor12 ^ v1 );
 4099|      0|                        break;
 4100|      0|                    }
 4101|      0|                }
 4102|      0|                if (j < 0)
  ------------------
  |  Branch (4102:21): [True: 0, False: 0]
  ------------------
 4103|      0|                {
 4104|      0|                    continue; /* not found */
 4105|      0|                }
 4106|       |
 4107|      0|                for (j = pv2->num_adj_edges - 1; 0 <= j; j--)
  ------------------
  |  Branch (4107:50): [True: 0, False: 0]
  ------------------
 4108|      0|                { /* was -2; changed 2006-2-28 12:35pm*/
 4109|      0|                    pe2n = pBNS->edge + pv2->iedge[j];
 4110|      0|                    if (pe2n->flow && !pe2n->forbidden)
  ------------------
  |  Branch (4110:25): [True: 0, False: 0]
  |  Branch (4110:39): [True: 0, False: 0]
  ------------------
 4111|      0|                    {
 4112|      0|                        pv2n = pBNS->vert + ( v2n = pe2n->neighbor12 ^ v2 );
 4113|      0|                        break;
 4114|      0|                    }
 4115|      0|                }
 4116|      0|                if (j < 0)
  ------------------
  |  Branch (4116:21): [True: 0, False: 0]
  ------------------
 4117|      0|                {
 4118|      0|                    continue; /* not found */
 4119|      0|                }
 4120|       |
 4121|      0|                pe->flow += delta;
 4122|      0|                pe1n->flow -= delta;
 4123|      0|                pe2n->flow -= delta;
 4124|      0|                pv1n->st_edge.flow -= delta;
 4125|      0|                pv2n->st_edge.flow -= delta;
 4126|      0|                pBNS->tot_st_flow -= 2 * delta;
 4127|       |
 4128|      0|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 4129|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 4130|       |
 4131|      0|                if (ret == 1 && ( vPathEnd == v1n && vPathStart == v2n ||
  ------------------
  |  Branch (4131:21): [True: 0, False: 0]
  |  Branch (4131:35): [True: 0, False: 0]
  |  Branch (4131:54): [True: 0, False: 0]
  ------------------
 4132|      0|                                  vPathEnd == v2n && vPathStart == v1n ) &&
  ------------------
  |  Branch (4132:35): [True: 0, False: 0]
  |  Branch (4132:54): [True: 0, False: 0]
  ------------------
 4133|      0|                                  ( nDeltaCharge == 0 || nDeltaCharge == 1 ))
  ------------------
  |  Branch (4133:37): [True: 0, False: 0]
  |  Branch (4133:58): [True: 0, False: 0]
  ------------------
 4134|      0|                {
 4135|       |                    /* Moved charge from O(+) to -N< => nDeltaCharge == 1 or 0 if pe2n = -N< charge edge */
 4136|       |                    /* Flow change on pe (+)charge edge (atom NH2) is not known to RunBnsTestOnce()) */
 4137|      0|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 4138|      0|                    if (ret > 0)
  ------------------
  |  Branch (4138:25): [True: 0, False: 0]
  ------------------
 4139|      0|                    {
 4140|      0|                        nNumRunBNS++;
 4141|      0|                        cur_success++; /* 15 */
 4142|      0|                    }
 4143|      0|                }
 4144|      0|                else
 4145|      0|                {
 4146|      0|                    pe->flow -= delta;
 4147|      0|                    pe1n->flow += delta;
 4148|      0|                    pe2n->flow += delta;
 4149|      0|                    pv1n->st_edge.flow += delta;
 4150|      0|                    pv2n->st_edge.flow += delta;
 4151|      0|                    pBNS->tot_st_flow += 2 * delta;
 4152|      0|                }
 4153|      0|                INCHI_HEAPCHK
 4154|      0|            }
 4155|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 4156|      0|        }
 4157|      1|        CurrEdges.num_edges = 0; /* clear current edge list */
 4158|      1|        if (cur_success)
  ------------------
  |  Branch (4158:13): [True: 0, False: 1]
  ------------------
 4159|      0|        {
 4160|      0|            tot_succes += cur_success;
 4161|       |            /* recalculate InChI from the structure */
 4162|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (4162:17): [True: 0, False: 0]
  ------------------
 4163|      0|                                                            ppt_group_info, ppat_norm, ppat_prep ) ))
 4164|      0|            {
 4165|      0|                goto exit_function;
 4166|      0|            }
 4167|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (4167:17): [True: 0, False: 0]
  ------------------
 4168|      0|            {
 4169|      0|                goto exit_function;
 4170|      0|            }
 4171|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (4171:17): [True: 0, False: 0]
  |  Branch (4171:45): [True: 0, False: 0]
  ------------------
 4172|      0|            {
 4173|      0|                goto exit_function;  /* no fixed-H found */
 4174|      0|            }
 4175|      0|            if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (4175:17): [True: 0, False: 0]
  ------------------
 4176|      0|            {
 4177|      0|                goto exit_function;
 4178|      0|            }
 4179|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (4179:17): [True: 0, False: 0]
  ------------------
 4180|      0|            {
 4181|      0|                goto exit_function; /* nothing to do */
 4182|      0|            }
 4183|      0|        }
 4184|      1|    }
 4185|       |
 4186|      1|    if (pc2i->nNumTgDiffMinus)
  ------------------
  |  Branch (4186:9): [True: 0, False: 1]
  ------------------
 4187|      0|    {
 4188|       |        /*----------------------------------------------------------------*/
 4189|       |        /* case 16: restored: O=X-NH(-)      orig.:  O(-)-X=NH            */
 4190|       |        /*            t-group: (H,-)                  (2H)                */
 4191|       |        /* O(-) = S, Se, Te; N = N;                                       */
 4192|       |        /* Solution: move (-) from O(-) to -NH(-)                         */
 4193|       |        /*----------------------------------------------------------------*/
 4194|      0|        int num_SB_N_Minus = 0, num_DB_O_Neutr = 0, iat, itg;
 4195|      0|        short iat_SB_N_Minus[MAX_DIFF_FIXH], iat_DB_O_Neutr[MAX_DIFF_FIXH];
 4196|      0|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 4197|      0|        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H ? pInChI[1]->nNum_H :
  ------------------
  |  Branch (4197:32): [True: 0, False: 0]
  |  Branch (4197:45): [True: 0, False: 0]
  ------------------
 4198|      0|            pInChI[0] && pInChI[0]->nNum_H ? pInChI[0]->nNum_H : 0;
  ------------------
  |  Branch (4198:13): [True: 0, False: 0]
  |  Branch (4198:26): [True: 0, False: 0]
  ------------------
 4199|      0|        cur_success = 0;
 4200|      0|        for (itg = 0; itg < pStruct->ti.num_t_groups && itg < pStruct->One_ti.num_t_groups; itg++)
  ------------------
  |  Branch (4200:23): [True: 0, False: 0]
  |  Branch (4200:57): [True: 0, False: 0]
  ------------------
 4201|      0|        {
 4202|      0|            if (pStruct->ti.t_group[itg].nNumEndpoints != pStruct->One_ti.t_group[itg].nNumEndpoints ||
  ------------------
  |  Branch (4202:17): [True: 0, False: 0]
  ------------------
 4203|      0|                 pStruct->ti.t_group[itg].num[1] >= pStruct->One_ti.t_group[itg].num[1])
  ------------------
  |  Branch (4203:18): [True: 0, False: 0]
  ------------------
 4204|      0|            {
 4205|      0|                continue;
 4206|      0|            }
 4207|      0|            CurrEdges.num_edges = num_SB_N_Minus = num_DB_O_Neutr = 0;
 4208|      0|            cur_success = 0;
 4209|      0|            for (j = 0, k = pStruct->One_ti.t_group[itg].nFirstEndpointAtNoPos;
 4210|      0|                  j < pStruct->One_ti.t_group[itg].nNumEndpoints; j++)
  ------------------
  |  Branch (4210:19): [True: 0, False: 0]
  ------------------
 4211|      0|            {
 4212|      0|                i = pStruct->One_ti.nEndpointAtomNumber[k + j]; /* canonical number in restored struct. */
 4213|      0|                iat = nCanon2AtnoRevrs[i];
 4214|      0|                if ( /* in restored atom: charge=0, has no H, has double bond, O, S, Se, Te */
 4215|      0|                     num_DB_O_Neutr < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|      0|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (4215:22): [True: 0, False: 0]
  ------------------
 4216|      0|                     at2[iat].charge == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (4216:22): [True: 0, False: 0]
  |  Branch (4216:46): [True: 0, False: 0]
  ------------------
 4217|      0|                     at2[iat].valence < at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (4217:22): [True: 0, False: 0]
  |  Branch (4217:72): [True: 0, False: 0]
  ------------------
 4218|      0|                     pVA[iat].cNumValenceElectrons == 6 &&
  ------------------
  |  Branch (4218:22): [True: 0, False: 0]
  ------------------
 4219|       |                     /* in orig.InChI: an endpoint, may have fixed-H */
 4220|      0|                     pStruct->endpoint[i] &&
  ------------------
  |  Branch (4220:22): [True: 0, False: 0]
  ------------------
 4221|       |                     /*!(pStruct->fixed_H && pStruct->fixed_H[i]) &&*/
 4222|      0|                     !( nMobHInChI && nMobHInChI[i] ) &&
  ------------------
  |  Branch (4222:25): [True: 0, False: 0]
  |  Branch (4222:39): [True: 0, False: 0]
  ------------------
 4223|       |                     /* has (-) edge */
 4224|      0|                     ( e = pVA[iat].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (4224:22): [True: 0, False: 0]
  |  Branch (4224:68): [True: 0, False: 0]
  ------------------
 4225|      0|                {
 4226|       |
 4227|      0|                    iat_DB_O_Neutr[num_DB_O_Neutr++] = iat;
 4228|       |
 4229|      0|                    if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (4229:25): [True: 0, False: 0]
  ------------------
 4230|      0|                    {
 4231|      0|                        goto exit_function;
 4232|      0|                    }
 4233|      0|                }
 4234|      0|                else
 4235|      0|                {
 4236|      0|                    if ( /* in restored atom: charge=-1, has H, has double bond, N */
 4237|      0|                         num_SB_N_Minus < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|      0|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (4237:26): [True: 0, False: 0]
  ------------------
 4238|      0|                         at2[iat].charge == -1 && at2[iat].num_H &&
  ------------------
  |  Branch (4238:26): [True: 0, False: 0]
  |  Branch (4238:51): [True: 0, False: 0]
  ------------------
 4239|      0|                         at2[iat].valence == at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (4239:26): [True: 0, False: 0]
  |  Branch (4239:77): [True: 0, False: 0]
  ------------------
 4240|      0|                         pVA[iat].cNumValenceElectrons == 5 && pVA[iat].cPeriodicRowNumber == 1 &&
  ------------------
  |  Branch (4240:26): [True: 0, False: 0]
  |  Branch (4240:64): [True: 0, False: 0]
  ------------------
 4241|       |                         /* in orig.InChI: an endpoint, has no fixed-H */
 4242|      0|                         pStruct->endpoint[i] &&
  ------------------
  |  Branch (4242:26): [True: 0, False: 0]
  ------------------
 4243|      0|                         ( pStruct->fixed_H && pStruct->fixed_H[i] ) &&
  ------------------
  |  Branch (4243:28): [True: 0, False: 0]
  |  Branch (4243:48): [True: 0, False: 0]
  ------------------
 4244|      0|                         !( nMobHInChI && nMobHInChI[i] ) &&
  ------------------
  |  Branch (4244:29): [True: 0, False: 0]
  |  Branch (4244:43): [True: 0, False: 0]
  ------------------
 4245|       |                         /* has (-) edge */
 4246|      0|                         ( e = pVA[iat].nCMinusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (4246:26): [True: 0, False: 0]
  ------------------
 4247|      0|                         0 == pBNS->edge[e].forbidden)
  ------------------
  |  Branch (4247:26): [True: 0, False: 0]
  ------------------
 4248|      0|                    {
 4249|       |
 4250|      0|                        iat_SB_N_Minus[num_SB_N_Minus++] = iat;
 4251|       |                        /*
 4252|       |                        if ( ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ) ) {
 4253|       |                        goto exit_function;
 4254|       |                        }
 4255|       |                        */
 4256|      0|                    }
 4257|      0|                }
 4258|      0|            }
 4259|      0|            if (num_try = inchi_min( num_SB_N_Minus, num_DB_O_Neutr ))
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (4259:17): [True: 0, False: 0]
  ------------------
 4260|      0|            {
 4261|       |                /* detected; attempt to fix */
 4262|      0|                SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 4263|      0|                RemoveForbiddenEdgeMask( pBNS, &CurrEdges, forbidden_edge_mask );
 4264|       |                /* allow stereobonds in rings change */
 4265|       |                /*
 4266|       |                if ( forbidden_stereo_edge_mask )
 4267|       |                RemoveForbiddenEdgeMask( pBNS, &FixedLargeRingStereoEdges, forbidden_stereo_edge_mask );
 4268|       |                */
 4269|      0|                delta = 1;
 4270|      0|                for (i = 0; i < num_SB_N_Minus && cur_success < num_try; i++)
  ------------------
  |  Branch (4270:29): [True: 0, False: 0]
  |  Branch (4270:51): [True: 0, False: 0]
  ------------------
 4271|      0|                {
 4272|      0|                    iat = iat_SB_N_Minus[i];
 4273|      0|                    pe = pBNS->edge + pVA[iat].nCMinusGroupEdge - 1;
 4274|      0|                    if (!pe->flow)
  ------------------
  |  Branch (4274:25): [True: 0, False: 0]
  ------------------
 4275|      0|                        continue;
 4276|      0|                    pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 4277|      0|                    pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 4278|       |
 4279|       |                    /*pe->forbidden |= forbidden_edge_mask;*/
 4280|      0|                    pe->flow -= delta;
 4281|      0|                    pv1->st_edge.flow -= delta;
 4282|      0|                    pv2->st_edge.flow -= delta;
 4283|      0|                    pBNS->tot_st_flow -= 2 * delta;
 4284|       |
 4285|      0|                    ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 4286|      0|                                          &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 4287|       |
 4288|      0|                    if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (4288:25): [True: 0, False: 0]
  |  Branch (4288:39): [True: 0, False: 0]
  |  Branch (4288:57): [True: 0, False: 0]
  ------------------
 4289|      0|                                      vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == 1)
  ------------------
  |  Branch (4289:39): [True: 0, False: 0]
  |  Branch (4289:57): [True: 0, False: 0]
  |  Branch (4289:79): [True: 0, False: 0]
  ------------------
 4290|      0|                    {
 4291|       |                        /* Moved (-) charge to =O => nDeltaCharge == 1 */
 4292|       |                        /* Flow change on pe (-)charge edge (atom -NH(-)) is not known to RunBnsTestOnce()) */
 4293|      0|                        ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 4294|      0|                        if (ret > 0)
  ------------------
  |  Branch (4294:29): [True: 0, False: 0]
  ------------------
 4295|      0|                        {
 4296|      0|                            nNumRunBNS++;
 4297|      0|                            cur_success++; /* 16 */
 4298|      0|                        }
 4299|      0|                    }
 4300|      0|                    else
 4301|      0|                    {
 4302|      0|                        pe->forbidden &= forbidden_edge_mask_inv;
 4303|      0|                        pe->flow += delta;
 4304|      0|                        pv1->st_edge.flow += delta;
 4305|      0|                        pv2->st_edge.flow += delta;
 4306|      0|                        pBNS->tot_st_flow += 2 * delta;
 4307|      0|                    }
 4308|      0|                    INCHI_HEAPCHK
 4309|      0|                }
 4310|      0|                RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 4311|       |                /*
 4312|       |                if ( forbidden_stereo_edge_mask )
 4313|       |                SetForbiddenEdgeMask( pBNS, &FixedLargeRingStereoEdges, forbidden_stereo_edge_mask );
 4314|       |                */
 4315|      0|            }
 4316|      0|            CurrEdges.num_edges = 0; /* clear current edge list */
 4317|      0|            if (cur_success)
  ------------------
  |  Branch (4317:17): [True: 0, False: 0]
  ------------------
 4318|      0|            {
 4319|      0|                tot_succes += cur_success;
 4320|       |                /* recalculate InChI from the structure */
 4321|      0|                if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (4321:21): [True: 0, False: 0]
  ------------------
 4322|      0|                                                                ppt_group_info, ppat_norm, ppat_prep ) ))
 4323|      0|                {
 4324|      0|                    goto exit_function;
 4325|      0|                }
 4326|      0|                if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (4326:21): [True: 0, False: 0]
  ------------------
 4327|      0|                {
 4328|      0|                    goto exit_function;
 4329|      0|                }
 4330|      0|                if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (4330:21): [True: 0, False: 0]
  |  Branch (4330:49): [True: 0, False: 0]
  ------------------
 4331|      0|                {
 4332|      0|                    goto exit_function;  /* no fixed-H found */
 4333|      0|                }
 4334|      0|                if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (4334:21): [True: 0, False: 0]
  ------------------
 4335|      0|                {
 4336|      0|                    goto exit_function;
 4337|      0|                }
 4338|      0|                if (!pc2i->bHasDifference)
  ------------------
  |  Branch (4338:21): [True: 0, False: 0]
  ------------------
 4339|      0|                {
 4340|      0|                    goto exit_function; /* nothing to do */
 4341|      0|                }
 4342|      0|            }
 4343|      0|        }
 4344|      0|    }
 4345|       |
 4346|      1|    if (pc2i->nNumRemHInChI < pc2i->nNumRemHRevrs)
  ------------------
  |  Branch (4346:9): [True: 0, False: 1]
  ------------------
 4347|      0|    {
 4348|       |        /*--------------------------------------------------------------*/
 4349|       |        /* case 17: restored: OH(+)=AB-O-     orig.  HO-AB=O(+)-        */
 4350|       |        /* number of removed H:  n+m                     n              */
 4351|       |        /* OH(+) = N, O, S, Se; -O- = P,As,O,S,Se,Te,F,Cl,Br,I          */
 4352|       |        /* Solution: move (+) from OH(+) to -O-                         */
 4353|       |        /*--------------------------------------------------------------*/
 4354|      0|        int num_SB_Neutr = 0, num_DB_Charged = 0, iat;
 4355|      0|        short iat_SB_Neutr[MAX_DIFF_FIXH], iat_DB_Charged[MAX_DIFF_FIXH];
 4356|      0|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 4357|      0|        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H ? pInChI[1]->nNum_H :
  ------------------
  |  Branch (4357:32): [True: 0, False: 0]
  |  Branch (4357:45): [True: 0, False: 0]
  ------------------
 4358|      0|            pInChI[0] && pInChI[0]->nNum_H ? pInChI[0]->nNum_H : 0;
  ------------------
  |  Branch (4358:13): [True: 0, False: 0]
  |  Branch (4358:26): [True: 0, False: 0]
  ------------------
 4359|      0|        cur_success = 0;
 4360|      0|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (4360:21): [True: 0, False: 0]
  ------------------
 4361|      0|        { /* i = canonical number - 1 */
 4362|      0|            iat = nCanon2AtnoRevrs[i];
 4363|      0|            if ( /* in restored atom: charge=+1, has H, has double bond, N, O, S, Se, Te */
 4364|      0|                 num_DB_Charged < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|      0|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (4364:18): [True: 0, False: 0]
  ------------------
 4365|      0|                 at2[iat].charge == 1 && at2[iat].num_H &&
  ------------------
  |  Branch (4365:18): [True: 0, False: 0]
  |  Branch (4365:42): [True: 0, False: 0]
  ------------------
 4366|      0|                 at2[iat].valence < at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (4366:18): [True: 0, False: 0]
  |  Branch (4366:68): [True: 0, False: 0]
  ------------------
 4367|      0|                 ( pVA[iat].cNumValenceElectrons == 6 ||
  ------------------
  |  Branch (4367:20): [True: 0, False: 0]
  ------------------
 4368|      0|                   pVA[iat].cNumValenceElectrons == 5 && pVA[iat].cPeriodicRowNumber == 1 ) &&
  ------------------
  |  Branch (4368:20): [True: 0, False: 0]
  |  Branch (4368:58): [True: 0, False: 0]
  ------------------
 4369|       |                 /* has (+) edge */
 4370|      0|                   ( e = pVA[iat].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (4370:20): [True: 0, False: 0]
  |  Branch (4370:65): [True: 0, False: 0]
  ------------------
 4371|      0|            {
 4372|       |
 4373|      0|                iat_DB_Charged[num_DB_Charged++] = iat;
 4374|       |                /*
 4375|       |                if ( ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ) ) {
 4376|       |                goto exit_function;
 4377|       |                }
 4378|       |                */
 4379|      0|            }
 4380|      0|            else
 4381|      0|            {
 4382|      0|                if ( /* in restored atom: charge=0, has no H, has no double bond, N, P, O, S, Se, Te */
 4383|      0|                     num_SB_Neutr < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|      0|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (4383:22): [True: 0, False: 0]
  ------------------
 4384|      0|                     at2[iat].charge == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (4384:22): [True: 0, False: 0]
  |  Branch (4384:46): [True: 0, False: 0]
  ------------------
 4385|      0|                     at2[iat].valence == at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (4385:22): [True: 0, False: 0]
  |  Branch (4385:73): [True: 0, False: 0]
  ------------------
 4386|      0|                     ( pVA[iat].cNumValenceElectrons == 6 || pVA[iat].cNumValenceElectrons == 7 ||
  ------------------
  |  Branch (4386:24): [True: 0, False: 0]
  |  Branch (4386:62): [True: 0, False: 0]
  ------------------
 4387|      0|                       pVA[iat].cNumValenceElectrons == 5 && pVA[iat].cPeriodicRowNumber > 1 ) &&
  ------------------
  |  Branch (4387:24): [True: 0, False: 0]
  |  Branch (4387:62): [True: 0, False: 0]
  ------------------
 4388|       |                     /* in orig.InChI: not an endpoint */
 4389|      0|                     !pStruct->endpoint[i] &&
  ------------------
  |  Branch (4389:22): [True: 0, False: 0]
  ------------------
 4390|      0|                     !( pStruct->fixed_H && pStruct->fixed_H[i] ) &&
  ------------------
  |  Branch (4390:25): [True: 0, False: 0]
  |  Branch (4390:45): [True: 0, False: 0]
  ------------------
 4391|      0|                     !( nMobHInChI && nMobHInChI[i] ) &&
  ------------------
  |  Branch (4391:25): [True: 0, False: 0]
  |  Branch (4391:39): [True: 0, False: 0]
  ------------------
 4392|       |                     /* has (+) edge */
 4393|      0|                     ( e = pVA[iat].nCPlusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (4393:22): [True: 0, False: 0]
  ------------------
 4394|      0|                     0 == pBNS->edge[e].forbidden)
  ------------------
  |  Branch (4394:22): [True: 0, False: 0]
  ------------------
 4395|      0|                {
 4396|       |
 4397|      0|                    iat_SB_Neutr[num_SB_Neutr++] = iat;
 4398|       |
 4399|      0|                    if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (4399:25): [True: 0, False: 0]
  ------------------
 4400|      0|                    {
 4401|      0|                        goto exit_function;
 4402|      0|                    }
 4403|      0|                }
 4404|      0|            }
 4405|      0|        }
 4406|      0|        if (num_try = inchi_min( num_SB_Neutr, num_DB_Charged ))
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (4406:13): [True: 0, False: 0]
  ------------------
 4407|      0|        {
 4408|      0|            BNS_VERTEX *pv1n, *pv2n;
 4409|      0|            BNS_EDGE   *pe1n, *pe2n;
 4410|      0|            Vertex      v1n, v2n;
 4411|       |
 4412|      0|            num_try = inchi_min( num_try, pc2i->nNumRemHRevrs - pc2i->nNumRemHInChI );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4413|       |            /* detected; attempt to fix */
 4414|      0|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 4415|      0|            RemoveForbiddenEdgeMask( pBNS, &CurrEdges, forbidden_edge_mask );
 4416|      0|            delta = 1;
 4417|      0|            for (i = 0; i < num_DB_Charged && cur_success < num_try; i++)
  ------------------
  |  Branch (4417:25): [True: 0, False: 0]
  |  Branch (4417:47): [True: 0, False: 0]
  ------------------
 4418|      0|            {
 4419|      0|                iat = iat_DB_Charged[i];
 4420|      0|                pe = pBNS->edge + pVA[iat].nCPlusGroupEdge - 1;
 4421|      0|                if (pe->flow)
  ------------------
  |  Branch (4421:21): [True: 0, False: 0]
  ------------------
 4422|      0|                {
 4423|      0|                    continue;
 4424|      0|                }
 4425|      0|                pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 4426|      0|                pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 4427|       |
 4428|      0|                for (j = pv1->num_adj_edges - 1; 0 <= j; j--)
  ------------------
  |  Branch (4428:50): [True: 0, False: 0]
  ------------------
 4429|      0|                {
 4430|      0|                    pe1n = pBNS->edge + pv1->iedge[j];
 4431|      0|                    if (pe1n->flow && !pe1n->forbidden)
  ------------------
  |  Branch (4431:25): [True: 0, False: 0]
  |  Branch (4431:39): [True: 0, False: 0]
  ------------------
 4432|      0|                    {
 4433|      0|                        pv1n = pBNS->vert + ( v1n = pe1n->neighbor12 ^ v1 );
 4434|      0|                        break;
 4435|      0|                    }
 4436|      0|                }
 4437|      0|                if (j < 0)
  ------------------
  |  Branch (4437:21): [True: 0, False: 0]
  ------------------
 4438|      0|                {
 4439|      0|                    continue; /* not found */
 4440|      0|                }
 4441|       |
 4442|      0|                for (j = pv2->num_adj_edges - 1; 0 <= j; j--)
  ------------------
  |  Branch (4442:50): [True: 0, False: 0]
  ------------------
 4443|      0|                { /* was -2; changed 2006-2-28 12:35pm*/
 4444|      0|                    pe2n = pBNS->edge + pv2->iedge[j];
 4445|      0|                    if (pe2n->flow && !pe2n->forbidden)
  ------------------
  |  Branch (4445:25): [True: 0, False: 0]
  |  Branch (4445:39): [True: 0, False: 0]
  ------------------
 4446|      0|                    {
 4447|      0|                        pv2n = pBNS->vert + ( v2n = pe2n->neighbor12 ^ v2 );
 4448|      0|                        break;
 4449|      0|                    }
 4450|      0|                }
 4451|      0|                if (j < 0)
  ------------------
  |  Branch (4451:21): [True: 0, False: 0]
  ------------------
 4452|      0|                    continue; /* not found */
 4453|       |
 4454|      0|                pe->flow += delta;
 4455|      0|                pe1n->flow -= delta;
 4456|      0|                pe2n->flow -= delta;
 4457|      0|                pv1n->st_edge.flow -= delta;
 4458|      0|                pv2n->st_edge.flow -= delta;
 4459|      0|                pBNS->tot_st_flow -= 2 * delta;
 4460|       |
 4461|      0|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 4462|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 4463|       |
 4464|      0|                if (ret == 1 && ( vPathEnd == v1n && vPathStart == v2n ||
  ------------------
  |  Branch (4464:21): [True: 0, False: 0]
  |  Branch (4464:35): [True: 0, False: 0]
  |  Branch (4464:54): [True: 0, False: 0]
  ------------------
 4465|      0|                                  vPathEnd == v2n && vPathStart == v1n ) &&
  ------------------
  |  Branch (4465:35): [True: 0, False: 0]
  |  Branch (4465:54): [True: 0, False: 0]
  ------------------
 4466|      0|                                  ( nDeltaCharge == 0 || nDeltaCharge == 1 ))
  ------------------
  |  Branch (4466:37): [True: 0, False: 0]
  |  Branch (4466:58): [True: 0, False: 0]
  ------------------
 4467|      0|                {
 4468|       |                    /* Moved charge from OH(+) to -O- => nDeltaCharge == 1 or 0 if pe2n = -O- charge edge */
 4469|       |                    /* Flow change on pe (+)charge edge (atom OH(+)) is not known to RunBnsTestOnce()) */
 4470|      0|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 4471|      0|                    if (ret > 0)
  ------------------
  |  Branch (4471:25): [True: 0, False: 0]
  ------------------
 4472|      0|                    {
 4473|      0|                        nNumRunBNS++;
 4474|      0|                        cur_success++; /* 17 */
 4475|      0|                    }
 4476|      0|                }
 4477|      0|                else
 4478|      0|                {
 4479|      0|                    pe->flow -= delta;
 4480|      0|                    pe1n->flow += delta;
 4481|      0|                    pe2n->flow += delta;
 4482|      0|                    pv1n->st_edge.flow += delta;
 4483|      0|                    pv2n->st_edge.flow += delta;
 4484|      0|                    pBNS->tot_st_flow += 2 * delta;
 4485|      0|                }
 4486|      0|                INCHI_HEAPCHK
 4487|      0|            }
 4488|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 4489|      0|        }
 4490|      0|        CurrEdges.num_edges = 0; /* clear current edge list */
 4491|      0|        if (cur_success)
  ------------------
  |  Branch (4491:13): [True: 0, False: 0]
  ------------------
 4492|      0|        {
 4493|      0|            tot_succes += cur_success;
 4494|       |            /* recalculate InChI from the structure */
 4495|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (4495:17): [True: 0, False: 0]
  ------------------
 4496|      0|                                                            ppt_group_info, ppat_norm, ppat_prep ) ))
 4497|      0|            {
 4498|      0|                goto exit_function;
 4499|      0|            }
 4500|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (4500:17): [True: 0, False: 0]
  ------------------
 4501|      0|            {
 4502|      0|                goto exit_function;
 4503|      0|            }
 4504|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (4504:17): [True: 0, False: 0]
  |  Branch (4504:45): [True: 0, False: 0]
  ------------------
 4505|      0|            {
 4506|      0|                goto exit_function;  /* no fixed-H found */
 4507|      0|            }
 4508|      0|            if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (4508:17): [True: 0, False: 0]
  ------------------
 4509|      0|            {
 4510|      0|                goto exit_function;
 4511|      0|            }
 4512|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (4512:17): [True: 0, False: 0]
  ------------------
 4513|      0|            {
 4514|      0|                goto exit_function; /* nothing to do */
 4515|      0|            }
 4516|      0|        }
 4517|      0|    }
 4518|       |
 4519|      1|    if (( pc2i->nNumTgInChI && pStruct->endpoint &&
  ------------------
  |  Branch (4519:11): [True: 0, False: 1]
  |  Branch (4519:32): [True: 0, False: 0]
  ------------------
 4520|      1|          pc2i->nNumTgMInChI > pc2i->nNumTgMRevrs && pc2i->nNumEndpInChI > pc2i->nNumEndpRevrs ))
  ------------------
  |  Branch (4520:11): [True: 0, False: 0]
  |  Branch (4520:54): [True: 0, False: 0]
  ------------------
 4521|      0|    {
 4522|       |        /*-----------------------------------------------------------------*/
 4523|       |        /*                                                                 */
 4524|       |        /* case 18: restored:-N=AB-X                -(-)N-AB-X(+)          */
 4525|       |        /* FixH:              0    0                    0    0             */
 4526|       |        /* MobH:              0    0                    0    0             */
 4527|       |        /*                   non  non                 taut  non            */
 4528|       |        /*                  taut  taut                      taut           */
 4529|       |        /* X = any heteroatom   N=N                                        */
 4530|       |        /* t-group in original has (Hn,-m) in the restored: (Hn,-m+1)      */
 4531|       |        /*       same num_H and more (-) than in the restored structure    */
 4532|       |        /* atom X is not taut in both                                      */
 4533|       |        /* Solution: separate charges between -N(III)= and  X              */
 4534|       |        /*-----------------------------------------------------------------*/
 4535|      0|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 4536|      0|        inp_ATOM *at_Mobile_H_Revrs = ( pStruct->pOne_norm_data[1] &&
  ------------------
  |  Branch (4536:41): [True: 0, False: 0]
  ------------------
 4537|      0|                                        pStruct->pOne_norm_data[1]->at ) ? pStruct->pOne_norm_data[1]->at : NULL;
  ------------------
  |  Branch (4537:41): [True: 0, False: 0]
  ------------------
 4538|      0|        int iat, e1, itg, max_success;
 4539|      0|        CurrEdges.num_edges = 0;
 4540|      0|        cur_success = 0;
 4541|      0|        ret = 0;
 4542|       |        /* search for -N= */
 4543|      0|        for (itg = 0; itg < pStruct->ti.num_t_groups && itg < pStruct->One_ti.num_t_groups; itg++)
  ------------------
  |  Branch (4543:23): [True: 0, False: 0]
  |  Branch (4543:57): [True: 0, False: 0]
  ------------------
 4544|      0|        {
 4545|      0|            if (pStruct->ti.t_group[itg].nNumEndpoints <= pStruct->One_ti.t_group[itg].nNumEndpoints ||
  ------------------
  |  Branch (4545:17): [True: 0, False: 0]
  ------------------
 4546|      0|                 pStruct->ti.t_group[itg].num[1] <= pStruct->One_ti.t_group[itg].num[1])
  ------------------
  |  Branch (4546:18): [True: 0, False: 0]
  ------------------
 4547|      0|            {
 4548|      0|                continue;
 4549|      0|            }
 4550|      0|            CurrEdges.num_edges = 0;
 4551|      0|            cur_success = 0;
 4552|      0|            for (j = 0, k = pStruct->ti.t_group[itg].nFirstEndpointAtNoPos;
 4553|      0|                  j < pStruct->ti.t_group[itg].nNumEndpoints; j++)
  ------------------
  |  Branch (4553:19): [True: 0, False: 0]
  ------------------
 4554|      0|            {
 4555|      0|                i = pStruct->ti.nEndpointAtomNumber[k + j]; /* canonical number in restored struct. */
 4556|      0|                iat = nCanon2AtnoRevrs[i];
 4557|      0|                if (!pStruct->endpoint[i] || !at_Mobile_H_Revrs || at_Mobile_H_Revrs[iat].endpoint ||
  ------------------
  |  Branch (4557:21): [True: 0, False: 0]
  |  Branch (4557:46): [True: 0, False: 0]
  |  Branch (4557:68): [True: 0, False: 0]
  ------------------
 4558|      0|                     pVA[i].cNumValenceElectrons != 5 || pVA[i].cPeriodicRowNumber != 1 ||
  ------------------
  |  Branch (4558:22): [True: 0, False: 0]
  |  Branch (4558:58): [True: 0, False: 0]
  ------------------
 4559|      0|                     2 != at2[iat].valence || at2[iat].num_H || at2[iat].radical ||
  ------------------
  |  Branch (4559:22): [True: 0, False: 0]
  |  Branch (4559:47): [True: 0, False: 0]
  |  Branch (4559:65): [True: 0, False: 0]
  ------------------
 4560|      0|                     0 <= ( e1 = pVA[iat].nCPlusGroupEdge - 1 ) && !pBNS->edge[e1].flow ||
  ------------------
  |  Branch (4560:22): [True: 0, False: 0]
  |  Branch (4560:68): [True: 0, False: 0]
  ------------------
 4561|      0|                     0 >( e = pVA[iat].nCMinusGroupEdge - 1 ) || pBNS->edge[e].forbidden || pBNS->edge[e].flow)
  ------------------
  |  Branch (4561:22): [True: 0, False: 0]
  |  Branch (4561:66): [True: 0, False: 0]
  |  Branch (4561:93): [True: 0, False: 0]
  ------------------
 4562|      0|                {
 4563|      0|                    continue;
 4564|      0|                }
 4565|       |                /* found -N= */
 4566|      0|                if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (4566:21): [True: 0, False: 0]
  ------------------
 4567|      0|                {
 4568|      0|                    goto exit_function;
 4569|      0|                }
 4570|      0|            }
 4571|      0|        }
 4572|      0|        if (!( max_success = CurrEdges.num_edges ))
  ------------------
  |  Branch (4572:13): [True: 0, False: 0]
  ------------------
 4573|      0|        {
 4574|      0|            goto exit_case_18;
 4575|      0|        }
 4576|       |        /* search for X */
 4577|      0|        for (i = 0; i < pStruct->num_atoms && cur_success < max_success; i++)
  ------------------
  |  Branch (4577:21): [True: 0, False: 0]
  |  Branch (4577:47): [True: 0, False: 0]
  ------------------
 4578|      0|        {
 4579|      0|            iat = nCanon2AtnoRevrs[i];
 4580|      0|            if (pStruct->endpoint[i] || !pVA[i].cNumValenceElectrons || pVA[i].cNumValenceElectrons == 4 ||
  ------------------
  |  Branch (4580:17): [True: 0, False: 0]
  |  Branch (4580:41): [True: 0, False: 0]
  |  Branch (4580:73): [True: 0, False: 0]
  ------------------
 4581|      0|                 at2[iat].num_H || at2[iat].radical ||
  ------------------
  |  Branch (4581:18): [True: 0, False: 0]
  |  Branch (4581:36): [True: 0, False: 0]
  ------------------
 4582|      0|                 0 <= ( e1 = pVA[iat].nCMinusGroupEdge - 1 ) && !pBNS->edge[e1].flow ||
  ------------------
  |  Branch (4582:18): [True: 0, False: 0]
  |  Branch (4582:65): [True: 0, False: 0]
  ------------------
 4583|      0|                 0 >( e = pVA[iat].nCPlusGroupEdge - 1 ) || pBNS->edge[e].forbidden || pBNS->edge[e].flow != 1)
  ------------------
  |  Branch (4583:18): [True: 0, False: 0]
  |  Branch (4583:61): [True: 0, False: 0]
  |  Branch (4583:88): [True: 0, False: 0]
  ------------------
 4584|      0|            {
 4585|      0|                continue;
 4586|      0|            }
 4587|       |            /* try to move the charge */
 4588|      0|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 4589|      0|            SetForbiddenEdgeMask( pBNS, &OtherNFlowerEdges, forbidden_edge_mask );
 4590|      0|            RemoveForbiddenEdgeMask( pBNS, &CurrEdges, forbidden_edge_mask );
 4591|       |
 4592|      0|            pe = pBNS->edge + e;
 4593|      0|            if (!pe->flow)
  ------------------
  |  Branch (4593:17): [True: 0, False: 0]
  ------------------
 4594|      0|                continue;
 4595|      0|            pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 4596|      0|            pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 4597|       |
 4598|      0|            delta = 1;
 4599|      0|            pe->flow -= delta;
 4600|      0|            pv1->st_edge.flow -= delta;
 4601|      0|            pv2->st_edge.flow -= delta;
 4602|      0|            pBNS->tot_st_flow -= 2 * delta;
 4603|       |
 4604|      0|            ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 4605|      0|                                  &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 4606|       |
 4607|      0|            if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (4607:17): [True: 0, False: 0]
  |  Branch (4607:31): [True: 0, False: 0]
  |  Branch (4607:49): [True: 0, False: 0]
  ------------------
 4608|      0|                              vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == 1)
  ------------------
  |  Branch (4608:31): [True: 0, False: 0]
  |  Branch (4608:49): [True: 0, False: 0]
  |  Branch (4608:71): [True: 0, False: 0]
  ------------------
 4609|      0|            {
 4610|       |                /* Created (-) charge on -N= => nDeltaCharge == 1 */
 4611|       |                /* Flow change on pe (+)charge edge (atom X) is not known to RunBnsTestOnce()) */
 4612|      0|                ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 4613|      0|                if (ret > 0)
  ------------------
  |  Branch (4613:21): [True: 0, False: 0]
  ------------------
 4614|      0|                {
 4615|      0|                    nNumRunBNS++;
 4616|      0|                    cur_success++; /* 18 */
 4617|      0|                }
 4618|      0|            }
 4619|      0|            else
 4620|      0|            {
 4621|      0|                pe->flow += delta;
 4622|      0|                pv1->st_edge.flow += delta;
 4623|      0|                pv2->st_edge.flow += delta;
 4624|      0|                pBNS->tot_st_flow += 2 * delta;
 4625|      0|            }
 4626|      0|            INCHI_HEAPCHK
 4627|      0|        }
 4628|      0|    exit_case_18:
 4629|      0|        RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 4630|      0|        RemoveForbiddenEdgeMask( pBNS, &OtherNFlowerEdges, forbidden_edge_mask );
 4631|      0|        CurrEdges.num_edges = 0; /* clear current edge list */
 4632|      0|        if (ret < 0)
  ------------------
  |  Branch (4632:13): [True: 0, False: 0]
  ------------------
 4633|      0|        {
 4634|      0|            goto exit_function;
 4635|      0|        }
 4636|      0|        if (cur_success)
  ------------------
  |  Branch (4636:13): [True: 0, False: 0]
  ------------------
 4637|      0|        {
 4638|      0|            tot_succes += cur_success;
 4639|       |            /* recalculate InChI from the structure */
 4640|      0|            if (0 >( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (4640:17): [True: 0, False: 0]
  ------------------
 4641|      0|                                                           ppt_group_info, ppat_norm, ppat_prep ) ))
 4642|      0|            {
 4643|      0|                goto exit_function;
 4644|      0|            }
 4645|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (4645:17): [True: 0, False: 0]
  ------------------
 4646|      0|            {
 4647|      0|                goto exit_function;
 4648|      0|            }
 4649|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (4649:17): [True: 0, False: 0]
  |  Branch (4649:45): [True: 0, False: 0]
  ------------------
 4650|      0|            {
 4651|      0|                goto exit_function;  /* no fixed-H found */
 4652|      0|            }
 4653|      0|            if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (4653:17): [True: 0, False: 0]
  ------------------
 4654|      0|            {
 4655|      0|                goto exit_function;
 4656|      0|            }
 4657|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (4657:17): [True: 0, False: 0]
  ------------------
 4658|      0|            {
 4659|      0|                goto exit_function; /* nothing to do */
 4660|      0|            }
 4661|      0|        }
 4662|      0|    }
 4663|      1|    if (pc2i->len_c2at >= 1)
  ------------------
  |  Branch (4663:9): [True: 1, False: 0]
  ------------------
 4664|      1|    {
 4665|       |        /*--------------------------------------------------------------*/
 4666|       |        /* case 19 restored:       M--OH   original:  M(-)==OH(+)       */
 4667|       |        /* FixH:               metal  0                      1          */
 4668|       |        /* MobH:                      1                      0          */
 4669|       |        /* O =  O, S, Se, Te; not taut. in InChI                        */
 4670|       |        /* In restored structure has H; tautomeric or not tautomeric    */
 4671|       |        /* Solution: move (+) from -OH to M; charhe on M may vary       */
 4672|       |        /*--------------------------------------------------------------*/
 4673|      1|        int iat;
 4674|      1|        EdgeIndex eOHPlus, eMPlus, eMMinus, eOMBond;
 4675|      1|        BNS_EDGE  *peOHPlus, *peMPlus, *peMMinus, *peOMBond;
 4676|      1|        int       iatMetal, ChargeOnMetal, DeltaChargeExpected;
 4677|      1|        cur_success = 0;
 4678|      1|        num_zero_ret = 0;
 4679|      3|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (4679:21): [True: 2, False: 1]
  ------------------
 4680|      2|        {
 4681|      2|            iat = pc2i->c2at[i].atomNumber;
 4682|      2|            if ( /* orig. InChI info: =NH2(+), =OH(+) */
 4683|      2|                ( pc2i->c2at[i].nValElectr == 6 ) /* N, O, S, Se, Te */ &&
  ------------------
  |  Branch (4683:17): [True: 2, False: 0]
  ------------------
 4684|       |                 /*!pc2i->c2at[i].endptInChI &&*/ /* <=== relaxation */
 4685|      2|                 ( e = pVA[iat].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden && pBNS->edge[e].flow &&
  ------------------
  |  Branch (4685:18): [True: 2, False: 0]
  |  Branch (4685:63): [True: 2, False: 0]
  |  Branch (4685:91): [True: 2, False: 0]
  ------------------
 4686|      2|                 pc2i->c2at[i].nFixHInChI == 1 && pc2i->c2at[i].nMobHInChI == 0 &&
  ------------------
  |  Branch (4686:18): [True: 0, False: 2]
  |  Branch (4686:51): [True: 0, False: 0]
  ------------------
 4687|       |                 /* reversed structure info: */
 4688|      2|                 pc2i->c2at[i].nFixHRevrs == 0 && pc2i->c2at[i].nMobHRevrs == 1 &&
  ------------------
  |  Branch (4688:18): [True: 0, False: 0]
  |  Branch (4688:51): [True: 0, False: 0]
  ------------------
 4689|      2|                 pc2i->c2at[i].nAtChargeRevrs == 0 && at2[iat].num_H &&
  ------------------
  |  Branch (4689:18): [True: 0, False: 0]
  |  Branch (4689:55): [True: 0, False: 0]
  ------------------
 4690|      2|                 at2[iat].valence == 1 &&
  ------------------
  |  Branch (4690:18): [True: 0, False: 0]
  ------------------
 4691|      2|                 at2[iat].valence == at2[iat].chem_bonds_valence &&
  ------------------
  |  Branch (4691:18): [True: 0, False: 0]
  ------------------
 4692|       |                 /* metal atom */
 4693|      2|                 pVA[iatMetal = at2[iat].neighbor[0]].cMetal &&
  ------------------
  |  Branch (4693:18): [True: 0, False: 0]
  ------------------
 4694|      2|                 ( eMPlus = pVA[iatMetal].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[eMPlus].forbidden &&
  ------------------
  |  Branch (4694:18): [True: 0, False: 0]
  |  Branch (4694:73): [True: 0, False: 0]
  ------------------
 4695|      2|                 ( eMMinus = pVA[iatMetal].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[eMMinus].forbidden &&
  ------------------
  |  Branch (4695:18): [True: 0, False: 0]
  |  Branch (4695:75): [True: 0, False: 0]
  ------------------
 4696|      2|                 !pBNS->edge[eOMBond = pBNS->vert[iat].iedge[0]].forbidden
  ------------------
  |  Branch (4696:18): [True: 0, False: 0]
  ------------------
 4697|      2|                 )
 4698|      0|            {
 4699|       |                /* -OH charge edges */
 4700|      0|                if (ret = AddToEdgeList( &CurrEdges, iat, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (4700:21): [True: 0, False: 0]
  ------------------
 4701|      0|                {
 4702|      0|                    goto exit_function;
 4703|      0|                }
 4704|      0|            }
 4705|      2|        }
 4706|      1|        if (CurrEdges.num_edges)
  ------------------
  |  Branch (4706:13): [True: 0, False: 1]
  ------------------
 4707|      0|        {
 4708|       |            /* detected; fix */
 4709|      0|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 4710|      0|            SetForbiddenEdgeMask( pBNS, &NFlowerEdges, forbidden_edge_mask );
 4711|      0|            SetForbiddenEdgeMask( pBNS, &AllBondEdges, forbidden_edge_mask );
 4712|      0|            for (i = 0; i < CurrEdges.num_edges; i++)
  ------------------
  |  Branch (4712:25): [True: 0, False: 0]
  ------------------
 4713|      0|            {
 4714|       |                /* v1 is -OH, v2 is adjacent to it Metal */
 4715|      0|                iat = CurrEdges.pnEdges[i];
 4716|      0|                iatMetal = at2[iat].neighbor[0];
 4717|      0|                peOHPlus = pBNS->edge + ( eOHPlus = pVA[iat].nCPlusGroupEdge - 1 );
 4718|      0|                peMPlus = pBNS->edge + ( eMPlus = pVA[iatMetal].nCPlusGroupEdge - 1 );
 4719|      0|                peMMinus = pBNS->edge + ( eMMinus = pVA[iatMetal].nCMinusGroupEdge - 1 );
 4720|      0|                peOMBond = pBNS->edge + ( eOMBond = pBNS->vert[iat].iedge[0] );
 4721|       |                /* remove forbidden edge masks */
 4722|      0|                peMPlus->forbidden &= forbidden_edge_mask_inv;
 4723|      0|                peMMinus->forbidden &= forbidden_edge_mask_inv;
 4724|      0|                peOMBond->forbidden &= forbidden_edge_mask_inv;
 4725|       |
 4726|      0|                ChargeOnMetal = ( peMPlus->cap - peMPlus->flow ) - peMMinus->flow;
 4727|      0|                if (1 == ChargeOnMetal)
  ------------------
  |  Branch (4727:21): [True: 0, False: 0]
  ------------------
 4728|      0|                {
 4729|       |                    /* We are going to subtract 1 from the charge on Metal */
 4730|       |                    /* Added (+)charge to -OH is not known to RunBnsTestOnce() */
 4731|      0|                    DeltaChargeExpected = -1; /* charge will become = 0 */
 4732|      0|                }
 4733|      0|                else
 4734|      0|                {
 4735|      0|                    if (0 == ChargeOnMetal)
  ------------------
  |  Branch (4735:25): [True: 0, False: 0]
  ------------------
 4736|      0|                    {
 4737|      0|                        DeltaChargeExpected = 1; /* charge on Metal will be created */
 4738|      0|                    }
 4739|      0|                    else
 4740|      0|                    {
 4741|      0|                        DeltaChargeExpected = 0;
 4742|      0|                    }
 4743|      0|                }
 4744|       |
 4745|      0|                delta = 1;
 4746|      0|                pe = peOHPlus;
 4747|      0|                if (!pe->flow)
  ------------------
  |  Branch (4747:21): [True: 0, False: 0]
  ------------------
 4748|      0|                    continue;
 4749|      0|                pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 4750|      0|                pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 4751|       |
 4752|      0|                pe->flow -= delta; /* remove (-) from AB-O(-) */
 4753|      0|                pv1->st_edge.flow -= delta;
 4754|      0|                pv2->st_edge.flow -= delta;
 4755|      0|                pBNS->tot_st_flow -= 2 * delta;
 4756|       |
 4757|      0|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 4758|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 4759|       |
 4760|      0|                if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (4760:21): [True: 0, False: 0]
  |  Branch (4760:35): [True: 0, False: 0]
  |  Branch (4760:53): [True: 0, False: 0]
  ------------------
 4761|      0|                                  vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == DeltaChargeExpected)
  ------------------
  |  Branch (4761:35): [True: 0, False: 0]
  |  Branch (4761:53): [True: 0, False: 0]
  |  Branch (4761:75): [True: 0, False: 0]
  ------------------
 4762|      0|                {
 4763|      0|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 4764|      0|                    if (ret > 0)
  ------------------
  |  Branch (4764:25): [True: 0, False: 0]
  ------------------
 4765|      0|                    {
 4766|      0|                        nNumRunBNS++;
 4767|      0|                        cur_success++; /* 19 */
 4768|      0|                    }
 4769|      0|                }
 4770|      0|                else
 4771|      0|                {
 4772|      0|                    pe->flow += delta;
 4773|      0|                    pv1->st_edge.flow += delta;
 4774|      0|                    pv2->st_edge.flow += delta;
 4775|      0|                    pBNS->tot_st_flow += 2 * delta;
 4776|      0|                }
 4777|      0|                INCHI_HEAPCHK
 4778|       |                    /* set forbidden edge masks back */
 4779|      0|                    peMPlus->forbidden |= forbidden_edge_mask;
 4780|      0|                peMMinus->forbidden |= forbidden_edge_mask;
 4781|      0|                peOMBond->forbidden |= forbidden_edge_mask;
 4782|      0|            }
 4783|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 4784|      0|            RemoveForbiddenEdgeMask( pBNS, &NFlowerEdges, forbidden_edge_mask );
 4785|      0|            RemoveForbiddenEdgeMask( pBNS, &AllBondEdges, forbidden_edge_mask );
 4786|       |
 4787|      0|            CurrEdges.num_edges = 0; /* clear current edge list */
 4788|      0|            if (cur_success)
  ------------------
  |  Branch (4788:17): [True: 0, False: 0]
  ------------------
 4789|      0|            {
 4790|      0|                tot_succes += cur_success;
 4791|       |                /* recalculate InChI from the structure */
 4792|      0|                if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (4792:21): [True: 0, False: 0]
  ------------------
 4793|      0|                                                                ppt_group_info, ppat_norm, ppat_prep ) ))
 4794|      0|                {
 4795|      0|                    goto exit_function;
 4796|      0|                }
 4797|      0|                if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (4797:21): [True: 0, False: 0]
  ------------------
 4798|      0|                {
 4799|      0|                    goto exit_function;
 4800|      0|                }
 4801|      0|                if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (4801:21): [True: 0, False: 0]
  |  Branch (4801:49): [True: 0, False: 0]
  ------------------
 4802|      0|                {
 4803|      0|                    goto exit_function;  /* no fixed-H found */
 4804|      0|                }
 4805|      0|                if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (4805:21): [True: 0, False: 0]
  ------------------
 4806|      0|                {
 4807|      0|                    goto exit_function;
 4808|      0|                }
 4809|      0|                if (!pc2i->bHasDifference)
  ------------------
  |  Branch (4809:21): [True: 0, False: 0]
  ------------------
 4810|      0|                {
 4811|      0|                    goto exit_function; /* nothing to do */
 4812|      0|                }
 4813|      0|            }
 4814|      0|        }
 4815|      1|    }
 4816|      1|    if (pc2i->len_c2at > 1 && pc2i->nNumTgRevrs && pc2i->nNumTgInChI)
  ------------------
  |  Branch (4816:9): [True: 1, False: 0]
  |  Branch (4816:31): [True: 1, False: 0]
  |  Branch (4816:52): [True: 0, False: 1]
  ------------------
 4817|      0|    {
 4818|       |        /*--------------------------------------------------------------*/
 4819|       |        /* case 20: restored:  O(-)-AB=N-   original:   O=AB-N(-)-      */
 4820|       |        /* FixH:               0       0                0     -1        */
 4821|       |        /* MobH:               0       0                0      1        */
 4822|       |        /*                   taut    non-taut       non-taut taut       */
 4823|       |        /*                           or taut                  no H      */
 4824|       |        /*                           no H                               */
 4825|       |        /* O = O, S, Se; N = N, O, S, Se, Te;                           */
 4826|       |        /* restored atoms are taut/non-taut; original are opposite.     */
 4827|       |        /* Solution: move (-) from O(-) to =N-                          */
 4828|       |        /*--------------------------------------------------------------*/
 4829|      0|        int num_SB_O_Minus = 0, num_DB_N = 0, iat;
 4830|      0|        short iat_SB_O_Minus[MAX_DIFF_FIXH], iat_DB_N[MAX_DIFF_FIXH];
 4831|       |
 4832|      0|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 4833|       |        /*
 4834|       |        inp_ATOM *at_Mobile_H_Revrs = (pStruct->pOne_norm_data[1] &&
 4835|       |        pStruct->pOne_norm_data[1]->at)? pStruct->pOne_norm_data[1]->at : NULL;
 4836|       |        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H? pInChI[1]->nNum_H :
 4837|       |        pInChI[0] && pInChI[0]->nNum_H? pInChI[0]->nNum_H : 0;
 4838|       |        */
 4839|      0|        cur_success = 0;
 4840|      0|        CurrEdges.num_edges = 0; /* clear current edge list */
 4841|      0|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (4841:21): [True: 0, False: 0]
  ------------------
 4842|      0|        {
 4843|      0|            iat = pc2i->c2at[i].atomNumber;
 4844|      0|            if ( /* orig. InChI info: =O or -N= */
 4845|      0|                 num_DB_N < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|      0|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (4845:18): [True: 0, False: 0]
  ------------------
 4846|      0|                 pc2i->c2at[i].endptInChI &&
  ------------------
  |  Branch (4846:18): [True: 0, False: 0]
  ------------------
 4847|      0|                 ( e = pVA[iat].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (4847:18): [True: 0, False: 0]
  |  Branch (4847:64): [True: 0, False: 0]
  ------------------
 4848|      0|                 pBNS->edge[e].flow == 0 &&
  ------------------
  |  Branch (4848:18): [True: 0, False: 0]
  ------------------
 4849|      0|                 pc2i->c2at[i].nFixHInChI == 0 && pc2i->c2at[i].nMobHInChI == 0 &&
  ------------------
  |  Branch (4849:18): [True: 0, False: 0]
  |  Branch (4849:51): [True: 0, False: 0]
  ------------------
 4850|       |                 /* if  more than 1 t-group are in orig. InChI then do not move (-) to N */
 4851|      0|                 ( pc2i->nNumTgInChI == 1 || pc2i->c2at[i].nValElectr == 6 ) &&
  ------------------
  |  Branch (4851:20): [True: 0, False: 0]
  |  Branch (4851:46): [True: 0, False: 0]
  ------------------
 4852|       |                 /* reversed structure info: */
 4853|      0|                 !pc2i->c2at[i].endptRevrs &&
  ------------------
  |  Branch (4853:18): [True: 0, False: 0]
  ------------------
 4854|      0|                 pc2i->c2at[i].nFixHRevrs == 0 && /*pc2i->c2at[i].nMobHRevrs == 0 &&*/
  ------------------
  |  Branch (4854:18): [True: 0, False: 0]
  ------------------
 4855|      0|                 pc2i->c2at[i].nAtChargeRevrs == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (4855:18): [True: 0, False: 0]
  |  Branch (4855:55): [True: 0, False: 0]
  ------------------
 4856|      0|                 at2[iat].valence + 1 == at2[iat].chem_bonds_valence)
  ------------------
  |  Branch (4856:18): [True: 0, False: 0]
  ------------------
 4857|      0|            {
 4858|      0|                iat_DB_N[num_DB_N++] = iat;
 4859|      0|                if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (4859:21): [True: 0, False: 0]
  ------------------
 4860|      0|                {
 4861|      0|                    goto exit_function;
 4862|      0|                }
 4863|      0|            }
 4864|      0|            else
 4865|      0|            {
 4866|      0|                if ( /* orig. InChI info: -O(-) */
 4867|      0|                     num_SB_O_Minus < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|      0|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (4867:22): [True: 0, False: 0]
  ------------------
 4868|      0|                     !pc2i->c2at[i].endptInChI &&
  ------------------
  |  Branch (4868:22): [True: 0, False: 0]
  ------------------
 4869|      0|                     ( e = pVA[iat].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (4869:22): [True: 0, False: 0]
  |  Branch (4869:68): [True: 0, False: 0]
  ------------------
 4870|      0|                     pBNS->edge[e].flow == 1 &&
  ------------------
  |  Branch (4870:22): [True: 0, False: 0]
  ------------------
 4871|      0|                     pc2i->c2at[i].nFixHInChI == 0 && pc2i->c2at[i].nMobHInChI == 0 &&
  ------------------
  |  Branch (4871:22): [True: 0, False: 0]
  |  Branch (4871:55): [True: 0, False: 0]
  ------------------
 4872|      0|                     pc2i->c2at[i].nValElectr == 6 &&
  ------------------
  |  Branch (4872:22): [True: 0, False: 0]
  ------------------
 4873|       |                     /* reversed structure info: */
 4874|      0|                     pc2i->c2at[i].endptRevrs &&
  ------------------
  |  Branch (4874:22): [True: 0, False: 0]
  ------------------
 4875|      0|                     pc2i->c2at[i].nFixHRevrs == 0 && pc2i->c2at[i].nMobHRevrs == 0 &&
  ------------------
  |  Branch (4875:22): [True: 0, False: 0]
  |  Branch (4875:55): [True: 0, False: 0]
  ------------------
 4876|      0|                     pc2i->c2at[i].nAtChargeRevrs == -1 && !at2[iat].num_H &&
  ------------------
  |  Branch (4876:22): [True: 0, False: 0]
  |  Branch (4876:60): [True: 0, False: 0]
  ------------------
 4877|      0|                     at2[iat].valence == 1 && at2[iat].chem_bonds_valence == 1)
  ------------------
  |  Branch (4877:22): [True: 0, False: 0]
  |  Branch (4877:47): [True: 0, False: 0]
  ------------------
 4878|      0|                {
 4879|      0|                    iat_SB_O_Minus[num_SB_O_Minus++] = iat;
 4880|      0|                }
 4881|      0|            }
 4882|      0|        }
 4883|      0|        if (!num_DB_N)
  ------------------
  |  Branch (4883:13): [True: 0, False: 0]
  ------------------
 4884|      0|        {
 4885|       |            /* search among N that are tautomeric in both cases */
 4886|      0|            for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (4886:25): [True: 0, False: 0]
  ------------------
 4887|      0|            { /* i = canonical number - 1 */
 4888|      0|                if (!pStruct->endpoint[i])
  ------------------
  |  Branch (4888:21): [True: 0, False: 0]
  ------------------
 4889|      0|                {
 4890|      0|                    continue;
 4891|      0|                }
 4892|      0|                iat = nCanon2AtnoRevrs[i];
 4893|      0|                if ( /* in restored atom O: charge=-1, no H, has no double bond, endpoint */
 4894|      0|                     num_DB_N < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|      0|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (4894:22): [True: 0, False: 0]
  ------------------
 4895|      0|                     at2[iat].charge == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (4895:22): [True: 0, False: 0]
  |  Branch (4895:46): [True: 0, False: 0]
  ------------------
 4896|      0|                     at2[iat].valence + 1 == at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (4896:22): [True: 0, False: 0]
  |  Branch (4896:77): [True: 0, False: 0]
  ------------------
 4897|       |                     /* in orig.InChI: an endpoint, has no H */
 4898|      0|                     !( pStruct->fixed_H && pStruct->fixed_H[i] ) &&
  ------------------
  |  Branch (4898:25): [True: 0, False: 0]
  |  Branch (4898:45): [True: 0, False: 0]
  ------------------
 4899|       |                     /*!(nMobHInChI && nMobHInChI[i] ) &&*/
 4900|       |                     /* has (-) edge */
 4901|      0|                     ( e = pVA[iat].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (4901:22): [True: 0, False: 0]
  |  Branch (4901:68): [True: 0, False: 0]
  ------------------
 4902|      0|                     !pBNS->edge[e].flow)
  ------------------
  |  Branch (4902:22): [True: 0, False: 0]
  ------------------
 4903|      0|                {
 4904|       |
 4905|      0|                    iat_DB_N[num_DB_N++] = iat;
 4906|      0|                    if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (4906:25): [True: 0, False: 0]
  ------------------
 4907|      0|                    {
 4908|      0|                        goto exit_function;
 4909|      0|                    }
 4910|      0|                }
 4911|      0|            }
 4912|      0|        }
 4913|      0|        if (num_try = inchi_min( num_SB_O_Minus, num_DB_N ))
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (4913:13): [True: 0, False: 0]
  ------------------
 4914|      0|        {
 4915|       |            /* detected; attempt to fix */
 4916|      0|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 4917|      0|            RemoveForbiddenEdgeMask( pBNS, &CurrEdges, forbidden_edge_mask );
 4918|      0|            delta = 1;
 4919|      0|            for (i = 0; i < num_SB_O_Minus && cur_success < num_try; i++)
  ------------------
  |  Branch (4919:25): [True: 0, False: 0]
  |  Branch (4919:47): [True: 0, False: 0]
  ------------------
 4920|      0|            {
 4921|      0|                iat = iat_SB_O_Minus[i];
 4922|      0|                pe = pBNS->edge + pVA[iat].nCMinusGroupEdge - 1;
 4923|      0|                if (!pe->flow)
  ------------------
  |  Branch (4923:21): [True: 0, False: 0]
  ------------------
 4924|      0|                    continue;
 4925|      0|                pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 4926|      0|                pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 4927|       |
 4928|      0|                pe->flow -= delta;
 4929|      0|                pv1->st_edge.flow -= delta;
 4930|      0|                pv2->st_edge.flow -= delta;
 4931|      0|                pBNS->tot_st_flow -= 2 * delta;
 4932|       |
 4933|      0|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 4934|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 4935|       |
 4936|      0|                if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (4936:21): [True: 0, False: 0]
  |  Branch (4936:35): [True: 0, False: 0]
  |  Branch (4936:53): [True: 0, False: 0]
  ------------------
 4937|      0|                                  vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == 1)
  ------------------
  |  Branch (4937:35): [True: 0, False: 0]
  |  Branch (4937:53): [True: 0, False: 0]
  |  Branch (4937:75): [True: 0, False: 0]
  ------------------
 4938|      0|                {
 4939|       |                    /* Added (-) charge to =N- => nDeltaCharge == 1 */
 4940|       |                    /* Flow change on pe (-)charge edge (atom -O(-)) is not known to RunBnsTestOnce()) */
 4941|      0|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 4942|      0|                    if (ret > 0)
  ------------------
  |  Branch (4942:25): [True: 0, False: 0]
  ------------------
 4943|      0|                    {
 4944|      0|                        nNumRunBNS++;
 4945|      0|                        cur_success++; /* 20 */
 4946|      0|                    }
 4947|      0|                }
 4948|      0|                else
 4949|      0|                {
 4950|      0|                    pe->flow += delta;
 4951|      0|                    pv1->st_edge.flow += delta;
 4952|      0|                    pv2->st_edge.flow += delta;
 4953|      0|                    pBNS->tot_st_flow += 2 * delta;
 4954|      0|                }
 4955|      0|                INCHI_HEAPCHK
 4956|      0|            }
 4957|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 4958|      0|        }
 4959|      0|        CurrEdges.num_edges = 0; /* clear current edge list */
 4960|      0|        if (cur_success)
  ------------------
  |  Branch (4960:13): [True: 0, False: 0]
  ------------------
 4961|      0|        {
 4962|      0|            tot_succes += cur_success;
 4963|       |            /* recalculate InChI from the structure */
 4964|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (4964:17): [True: 0, False: 0]
  ------------------
 4965|      0|                                                            ppt_group_info, ppat_norm, ppat_prep ) ))
 4966|      0|            {
 4967|      0|                goto exit_function;
 4968|      0|            }
 4969|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (4969:17): [True: 0, False: 0]
  ------------------
 4970|      0|            {
 4971|      0|                goto exit_function;
 4972|      0|            }
 4973|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (4973:17): [True: 0, False: 0]
  |  Branch (4973:45): [True: 0, False: 0]
  ------------------
 4974|      0|            {
 4975|      0|                goto exit_function;  /* no fixed-H found */
 4976|      0|            }
 4977|      0|            if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (4977:17): [True: 0, False: 0]
  ------------------
 4978|      0|            {
 4979|      0|                goto exit_function;
 4980|      0|            }
 4981|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (4981:17): [True: 0, False: 0]
  ------------------
 4982|      0|            {
 4983|      0|                goto exit_function; /* nothing to do */
 4984|      0|            }
 4985|      0|        }
 4986|      0|    }
 4987|      1|    if (pc2i->len_c2at && pc2i->nNumTgRevrs && pc2i->nNumTgHInChI && pStruct->endpoint)
  ------------------
  |  Branch (4987:9): [True: 1, False: 0]
  |  Branch (4987:27): [True: 1, False: 0]
  |  Branch (4987:48): [True: 0, False: 1]
  |  Branch (4987:70): [True: 0, False: 0]
  ------------------
 4988|      0|    {
 4989|       |        /*--------------------------------------------------------------*/
 4990|       |        /*                      O(-)                      O             */
 4991|       |        /*                      |                         ||            */
 4992|       |        /* case 21: restored: R=S=O         original:   R-S=O           */
 4993|       |        /*                      |                         |             */
 4994|       |        /*                      O(-)                      O(-)          */
 4995|       |        /*                           All O are taut     R is not taut   */
 4996|       |        /*                                                              */
 4997|       |        /* In addition, another atom O that should have been tautomeric */
 4998|       |        /* or has H(+) added in Mobile-H layer is not like that         */
 4999|       |        /* O = O, S, Se;  S=S, Se, Te                                  */
 5000|       |        /* Solution: move (-) from O(-) to =O                           */
 5001|       |        /*           these atoms are tautomeric in restored structure   */
 5002|       |        /*--------------------------------------------------------------*/
 5003|      0|        int num_SB_O_Minus = 0, num_DB_O = 0, iat, iS;
 5004|      0|        short iat_SB_O_Minus[MAX_DIFF_FIXH], iat_Central[MAX_DIFF_FIXH], iat_DB_O[MAX_DIFF_FIXH];
 5005|      0|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 5006|      0|        inp_ATOM *at_Mobile_H_Revrs = ( pStruct->pOne_norm_data[1] &&
  ------------------
  |  Branch (5006:41): [True: 0, False: 0]
  ------------------
 5007|      0|                                        pStruct->pOne_norm_data[1]->at ) ? pStruct->pOne_norm_data[1]->at : NULL;
  ------------------
  |  Branch (5007:41): [True: 0, False: 0]
  ------------------
 5008|       |        /*
 5009|       |        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H? pInChI[1]->nNum_H :
 5010|       |        pInChI[0] && pInChI[0]->nNum_H? pInChI[0]->nNum_H : 0;
 5011|       |        */
 5012|      0|        CurrEdges.num_edges = 0; /* clear current edge list */
 5013|      0|        cur_success = 0;
 5014|      0|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (5014:21): [True: 0, False: 0]
  ------------------
 5015|      0|        {
 5016|      0|            iat = pc2i->c2at[i].atomNumber;
 5017|      0|            if ( /* orig. InChI info: =O    */
 5018|      0|                 num_DB_O < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|      0|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (5018:18): [True: 0, False: 0]
  ------------------
 5019|      0|                 pc2i->c2at[i].nValElectr == 6 /* O, S, Se, Te */ &&
  ------------------
  |  Branch (5019:18): [True: 0, False: 0]
  ------------------
 5020|      0|                 ( pc2i->c2at[i].endptInChI || pc2i->c2at[i].nMobHInChI ) &&
  ------------------
  |  Branch (5020:20): [True: 0, False: 0]
  |  Branch (5020:48): [True: 0, False: 0]
  ------------------
 5021|      0|                 ( e = pVA[iat].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (5021:18): [True: 0, False: 0]
  |  Branch (5021:64): [True: 0, False: 0]
  ------------------
 5022|      0|                 pc2i->c2at[i].nFixHInChI == 0 && /*pc2i->c2at[i].nMobHInChI ==  1 &&*/
  ------------------
  |  Branch (5022:18): [True: 0, False: 0]
  ------------------
 5023|       |                                                  /* reversed structure info: */
 5024|      0|                 !( pc2i->c2at[i].endptRevrs || pc2i->c2at[i].nMobHRevrs ) &&
  ------------------
  |  Branch (5024:21): [True: 0, False: 0]
  |  Branch (5024:49): [True: 0, False: 0]
  ------------------
 5025|      0|                 pc2i->c2at[i].nFixHRevrs == 0 &&
  ------------------
  |  Branch (5025:18): [True: 0, False: 0]
  ------------------
 5026|      0|                 pc2i->c2at[i].nAtChargeRevrs == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (5026:18): [True: 0, False: 0]
  |  Branch (5026:55): [True: 0, False: 0]
  ------------------
 5027|      0|                 at2[iat].valence == 1 && at2[iat].chem_bonds_valence == 2)
  ------------------
  |  Branch (5027:18): [True: 0, False: 0]
  |  Branch (5027:43): [True: 0, False: 0]
  ------------------
 5028|      0|            {
 5029|      0|                iat_DB_O[num_DB_O++] = iat;
 5030|      0|                if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (5030:21): [True: 0, False: 0]
  ------------------
 5031|      0|                {
 5032|      0|                    goto exit_function;
 5033|      0|                }
 5034|      0|            }
 5035|      0|        }
 5036|      0|        for (i = 0; num_DB_O && i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (5036:21): [True: 0, False: 0]
  |  Branch (5036:33): [True: 0, False: 0]
  ------------------
 5037|      0|        {
 5038|       |            /* i = canonical number - 1 */
 5039|      0|            if (!pStruct->endpoint[i])
  ------------------
  |  Branch (5039:17): [True: 0, False: 0]
  ------------------
 5040|      0|            {
 5041|      0|                continue;
 5042|      0|            }
 5043|      0|            iat = nCanon2AtnoRevrs[i];
 5044|      0|            if ( /* in restored atom O: charge=-1, no H, has no double bond, endpoint */
 5045|      0|                 num_SB_O_Minus < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|      0|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (5045:18): [True: 0, False: 0]
  ------------------
 5046|      0|                 at2[iat].charge == -1 && !at2[iat].num_H &&
  ------------------
  |  Branch (5046:18): [True: 0, False: 0]
  |  Branch (5046:43): [True: 0, False: 0]
  ------------------
 5047|      0|                 at2[iat].valence == 1 && at2[iat].chem_bonds_valence && !pVA[iat].cMetal &&
  ------------------
  |  Branch (5047:18): [True: 0, False: 0]
  |  Branch (5047:43): [True: 0, False: 0]
  |  Branch (5047:74): [True: 0, False: 0]
  ------------------
 5048|      0|                 pVA[iat].cNumValenceElectrons == 6 &&
  ------------------
  |  Branch (5048:18): [True: 0, False: 0]
  ------------------
 5049|      0|                 ( at_Mobile_H_Revrs && at_Mobile_H_Revrs[iat].endpoint ) &&
  ------------------
  |  Branch (5049:20): [True: 0, False: 0]
  |  Branch (5049:41): [True: 0, False: 0]
  ------------------
 5050|       |                 /* in orig.InChI: an endpoint, has no H */
 5051|      0|                 !( pStruct->fixed_H && pStruct->fixed_H[i] ) &&
  ------------------
  |  Branch (5051:21): [True: 0, False: 0]
  |  Branch (5051:41): [True: 0, False: 0]
  ------------------
 5052|       |                 /*!(nMobHInChI && nMobHInChI[i] ) &&*/
 5053|       |                 /* has (-) edge */
 5054|      0|                 ( e = pVA[iat].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (5054:18): [True: 0, False: 0]
  |  Branch (5054:64): [True: 0, False: 0]
  ------------------
 5055|      0|                 pBNS->edge[e].flow)
  ------------------
  |  Branch (5055:18): [True: 0, False: 0]
  ------------------
 5056|      0|            {
 5057|      0|                int nNumTautSB = 0, nNumTautDB = 0, nNumOtherDB = 0, nNumOtherSB = 0, nNumOthers = 0, nNumNegEndp = 0;
 5058|       |                /* traverse neighbors of the centerpoint iS */
 5059|      0|                iS = at2[i].neighbor[0];
 5060|      0|                for (j = 0; j < num_SB_O_Minus; j++)
  ------------------
  |  Branch (5060:29): [True: 0, False: 0]
  ------------------
 5061|      0|                {
 5062|      0|                    if (iat_Central[j] == iS)
  ------------------
  |  Branch (5062:25): [True: 0, False: 0]
  ------------------
 5063|      0|                        break;
 5064|      0|                }
 5065|      0|                if (j < num_SB_O_Minus)
  ------------------
  |  Branch (5065:21): [True: 0, False: 0]
  ------------------
 5066|      0|                {
 5067|      0|                    continue;  /* have already been there */
 5068|      0|                }
 5069|      0|                for (j = 0; j < at[iS].valence; j++)
  ------------------
  |  Branch (5069:29): [True: 0, False: 0]
  ------------------
 5070|      0|                {
 5071|      0|                    int bond_type = at2[iS].bond_type[j];
 5072|      0|                    k = at2[iS].neighbor[j];
 5073|      0|                    if (k == i)
  ------------------
  |  Branch (5073:25): [True: 0, False: 0]
  ------------------
 5074|      0|                    {
 5075|      0|                        continue;
 5076|      0|                    }
 5077|      0|                    if (pStruct->endpoint[k] == pStruct->endpoint[i])
  ------------------
  |  Branch (5077:25): [True: 0, False: 0]
  ------------------
 5078|      0|                    {
 5079|      0|                        nNumTautSB += ( bond_type == BOND_TYPE_SINGLE );
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
 5080|      0|                        nNumTautDB += ( bond_type == BOND_TYPE_DOUBLE );
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
 5081|      0|                    }
 5082|      0|                    else
 5083|      0|                    {
 5084|      0|                        if (bond_type == BOND_TYPE_DOUBLE)
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (5084:29): [True: 0, False: 0]
  ------------------
 5085|      0|                        {
 5086|      0|                            nNumOtherDB++;
 5087|      0|                        }
 5088|      0|                        else
 5089|      0|                        {
 5090|      0|                            if (bond_type == BOND_TYPE_SINGLE)
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (5090:33): [True: 0, False: 0]
  ------------------
 5091|      0|                            {
 5092|      0|                                nNumOtherSB++;
 5093|      0|                            }
 5094|      0|                            else
 5095|      0|                            {
 5096|      0|                                nNumOthers++;
 5097|      0|                            }
 5098|      0|                        }
 5099|      0|                    }
 5100|      0|                    if (at2[k].endpoint == at2[i].endpoint && at2[k].valence == 1 &&
  ------------------
  |  Branch (5100:25): [True: 0, False: 0]
  |  Branch (5100:63): [True: 0, False: 0]
  ------------------
 5101|      0|                         at2[k].charge == -1 && pVA[k].cNumValenceElectrons == 6)
  ------------------
  |  Branch (5101:26): [True: 0, False: 0]
  |  Branch (5101:49): [True: 0, False: 0]
  ------------------
 5102|      0|                    {
 5103|      0|                        nNumNegEndp++;
 5104|      0|                    }
 5105|      0|                }
 5106|      0|                if (!nNumTautSB)
  ------------------
  |  Branch (5106:21): [True: 0, False: 0]
  ------------------
 5107|      0|                {
 5108|      0|                    continue;
 5109|      0|                }
 5110|      0|                if (!( nNumOtherDB && nNumTautDB ))
  ------------------
  |  Branch (5110:24): [True: 0, False: 0]
  |  Branch (5110:39): [True: 0, False: 0]
  ------------------
 5111|      0|                {
 5112|      0|                    continue; /* ignore */
 5113|      0|                }
 5114|       |
 5115|      0|                iat_SB_O_Minus[num_SB_O_Minus] = iat;
 5116|      0|                iat_Central[num_SB_O_Minus++] = iS;
 5117|      0|            }
 5118|      0|        }
 5119|      0|        if (num_try = inchi_min( num_SB_O_Minus, num_DB_O ))
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (5119:13): [True: 0, False: 0]
  ------------------
 5120|      0|        {
 5121|       |            /* detected; attempt to fix */
 5122|      0|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 5123|      0|            RemoveForbiddenEdgeMask( pBNS, &CurrEdges, forbidden_edge_mask );
 5124|      0|            delta = 1;
 5125|      0|            for (i = 0; i < num_SB_O_Minus && cur_success < num_try; i++)
  ------------------
  |  Branch (5125:25): [True: 0, False: 0]
  |  Branch (5125:47): [True: 0, False: 0]
  ------------------
 5126|      0|            {
 5127|      0|                iat = iat_SB_O_Minus[i];
 5128|      0|                pe = pBNS->edge + pVA[iat].nCMinusGroupEdge - 1;
 5129|      0|                if (!pe->flow)
  ------------------
  |  Branch (5129:21): [True: 0, False: 0]
  ------------------
 5130|      0|                    continue;
 5131|      0|                pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 5132|      0|                pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 5133|       |
 5134|      0|                pe->forbidden |= forbidden_edge_mask;
 5135|      0|                pe->flow -= delta;
 5136|      0|                pv1->st_edge.flow -= delta;
 5137|      0|                pv2->st_edge.flow -= delta;
 5138|      0|                pBNS->tot_st_flow -= 2 * delta;
 5139|       |
 5140|      0|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 5141|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 5142|       |
 5143|      0|                if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (5143:21): [True: 0, False: 0]
  |  Branch (5143:35): [True: 0, False: 0]
  |  Branch (5143:53): [True: 0, False: 0]
  ------------------
 5144|      0|                                  vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == 1)
  ------------------
  |  Branch (5144:35): [True: 0, False: 0]
  |  Branch (5144:53): [True: 0, False: 0]
  |  Branch (5144:75): [True: 0, False: 0]
  ------------------
 5145|      0|                {
 5146|       |                    /* Added (-) charge to =O => nDeltaCharge == 1 */
 5147|       |                    /* Flow change on pe (-)charge edge (atom -N(-)-) is not known to RunBnsTestOnce()) */
 5148|      0|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 5149|      0|                    if (ret > 0)
  ------------------
  |  Branch (5149:25): [True: 0, False: 0]
  ------------------
 5150|      0|                    {
 5151|      0|                        nNumRunBNS++;
 5152|      0|                        cur_success++; /* 21 */
 5153|      0|                    }
 5154|      0|                }
 5155|      0|                else
 5156|      0|                {
 5157|      0|                    pe->flow += delta;
 5158|      0|                    pv1->st_edge.flow += delta;
 5159|      0|                    pv2->st_edge.flow += delta;
 5160|      0|                    pBNS->tot_st_flow += 2 * delta;
 5161|      0|                }
 5162|      0|                INCHI_HEAPCHK
 5163|      0|            }
 5164|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 5165|      0|        }
 5166|      0|        CurrEdges.num_edges = 0; /* clear current edge list */
 5167|      0|        if (cur_success)
  ------------------
  |  Branch (5167:13): [True: 0, False: 0]
  ------------------
 5168|      0|        {
 5169|      0|            tot_succes += cur_success;
 5170|       |            /* recalculate InChI from the structure */
 5171|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (5171:17): [True: 0, False: 0]
  ------------------
 5172|      0|                                                            ppt_group_info, ppat_norm, ppat_prep ) ))
 5173|      0|            {
 5174|      0|                goto exit_function;
 5175|      0|            }
 5176|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (5176:17): [True: 0, False: 0]
  ------------------
 5177|      0|            {
 5178|      0|                goto exit_function;
 5179|      0|            }
 5180|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (5180:17): [True: 0, False: 0]
  |  Branch (5180:45): [True: 0, False: 0]
  ------------------
 5181|      0|            {
 5182|      0|                goto exit_function;  /* no fixed-H found */
 5183|      0|            }
 5184|      0|            if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (5184:17): [True: 0, False: 0]
  ------------------
 5185|      0|            {
 5186|      0|                goto exit_function;
 5187|      0|            }
 5188|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (5188:17): [True: 0, False: 0]
  ------------------
 5189|      0|            {
 5190|      0|                goto exit_function; /* nothing to do */
 5191|      0|            }
 5192|      0|        }
 5193|      0|    }
 5194|       |
 5195|      1|    if (pc2i->len_c2at && pc2i->nNumTgRevrs && pc2i->nNumEndpInChI < pc2i->nNumEndpRevrs)
  ------------------
  |  Branch (5195:9): [True: 1, False: 0]
  |  Branch (5195:27): [True: 1, False: 0]
  |  Branch (5195:48): [True: 1, False: 0]
  ------------------
 5196|      1|    {
 5197|       |        /*--------------------------------------------------------------*/
 5198|       |        /*                      O                         O             */
 5199|       |        /*                      ||                        ||            */
 5200|       |        /* case 21a:restored: R=S-R' =X     original:   R-S-R' -X(-)    */
 5201|       |        /*                      |                         ||            */
 5202|       |        /*                      O(-)                      O(-)          */
 5203|       |        /*             All O and X are taut      O and X are not taut   */
 5204|       |        /*             it is possible that X is R                       */
 5205|       |        /*                                                              */
 5206|       |        /* O = O, S, Se;  S=S, Se, Te; X = N, O, S, Se, Te              */
 5207|       |        /* Solution: move (-) from O(-) to =X                           */
 5208|       |        /*           these atoms are tautomeric in restored structure   */
 5209|       |        /*--------------------------------------------------------------*/
 5210|      1|        int iat, iS;
 5211|       |        /*
 5212|       |        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 5213|       |        */
 5214|      1|        inp_ATOM *at_Mobile_H_Revrs = ( pStruct->pOne_norm_data[1] &&
  ------------------
  |  Branch (5214:41): [True: 1, False: 0]
  ------------------
 5215|      1|                                        pStruct->pOne_norm_data[1]->at ) ? pStruct->pOne_norm_data[1]->at : NULL;
  ------------------
  |  Branch (5215:41): [True: 1, False: 0]
  ------------------
 5216|       |        /*
 5217|       |        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H? pInChI[1]->nNum_H :
 5218|       |        pInChI[0] && pInChI[0]->nNum_H? pInChI[0]->nNum_H : 0;
 5219|       |        */
 5220|      1|        EDGE_LIST  OtherSO, CentralS, SOMinus, MinusAcceptord;
 5221|      1|        CurrEdges.num_edges = 0; /* clear current edge list */
 5222|      1|        AllocEdgeList( &OtherSO, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      1|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 5223|      1|        AllocEdgeList( &CentralS, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      1|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 5224|      1|        AllocEdgeList( &SOMinus, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      1|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 5225|      1|        AllocEdgeList( &MinusAcceptord, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      1|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 5226|      1|        cur_success = 0;
 5227|      1|        if (!at_Mobile_H_Revrs)
  ------------------
  |  Branch (5227:13): [True: 0, False: 1]
  ------------------
 5228|      0|        {
 5229|      0|            goto exit_case_21a;
 5230|      0|        }
 5231|      3|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (5231:21): [True: 2, False: 1]
  ------------------
 5232|      2|        {
 5233|      2|            iat = pc2i->c2at[i].atomNumber;
 5234|      2|            if ( /* orig. InChI info: -X(-)    */
 5235|       |                 /*num_DB_O < MAX_DIFF_FIXH &&*/
 5236|       |                 /*pc2i->c2at[i].nValElectr == 6 */ /* O, S, Se, Te */
 5237|      2|                 !pc2i->c2at[i].endptInChI &&
  ------------------
  |  Branch (5237:18): [True: 2, False: 0]
  ------------------
 5238|      2|                 ( e = pVA[iat].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (5238:18): [True: 2, False: 0]
  |  Branch (5238:64): [True: 2, False: 0]
  ------------------
 5239|      2|                 pc2i->c2at[i].nFixHInChI == 0 && /*pc2i->c2at[i].nMobHInChI ==  1 &&*/
  ------------------
  |  Branch (5239:18): [True: 2, False: 0]
  ------------------
 5240|       |                                                  /* reversed structure info: */
 5241|      2|                 ( pc2i->c2at[i].endptRevrs || pc2i->c2at[i].nMobHRevrs ) &&
  ------------------
  |  Branch (5241:20): [True: 2, False: 0]
  |  Branch (5241:48): [True: 0, False: 0]
  ------------------
 5242|      2|                 pc2i->c2at[i].nFixHRevrs == 0 &&
  ------------------
  |  Branch (5242:18): [True: 2, False: 0]
  ------------------
 5243|      2|                 /*pc2i->c2at[i].nAtChargeRevrs == 0 &&*/ !at2[iat].num_H)
  ------------------
  |  Branch (5243:59): [True: 2, False: 0]
  ------------------
 5244|      2|            {
 5245|      2|                if (pVA[iat].cNumValenceElectrons == 6 && at2[iat].charge == -1 &&
  ------------------
  |  Branch (5245:21): [True: 2, False: 0]
  |  Branch (5245:59): [True: 2, False: 0]
  ------------------
 5246|      2|                     pBNS->edge[e].flow &&
  ------------------
  |  Branch (5246:22): [True: 2, False: 0]
  ------------------
 5247|      2|                     at2[iat].valence == 1 && at2[iat].chem_bonds_valence == 1 &&
  ------------------
  |  Branch (5247:22): [True: 2, False: 0]
  |  Branch (5247:47): [True: 2, False: 0]
  ------------------
 5248|      2|                     pVA[iS = (int) at2[iat].neighbor[0]].cNumValenceElectrons == 6 && pVA[iS].cPeriodicRowNumber > 1 &&
  ------------------
  |  Branch (5248:22): [True: 1, False: 1]
  |  Branch (5248:88): [True: 0, False: 1]
  ------------------
 5249|      2|                     at2[iS].valence >= 4)
  ------------------
  |  Branch (5249:22): [True: 0, False: 0]
  ------------------
 5250|      0|                {
 5251|       |                    /* a candidate for S in -SO2- */
 5252|      0|                    int nNumTautSB = 0, nNumTautDB = 0, nNumOtherDB = 0, nNumOtherSB = 0;
 5253|      0|                    int nNumOthers = 0, nNumNegEndp = 0, nNumEndpO = 0;
 5254|       |                    /* check whether we have already found it */
 5255|      0|                    if (0 <= FindInEdgeList( &CentralS, iS ))
  ------------------
  |  Branch (5255:25): [True: 0, False: 0]
  ------------------
 5256|      0|                    {
 5257|      0|                        continue;
 5258|      0|                    }
 5259|      0|                    for (j = 0; j < at[iS].valence; j++)
  ------------------
  |  Branch (5259:33): [True: 0, False: 0]
  ------------------
 5260|      0|                    {
 5261|      0|                        int bond_type = at2[iS].bond_type[j];
 5262|      0|                        k = at2[iS].neighbor[j];
 5263|      0|                        if (k == iat)
  ------------------
  |  Branch (5263:29): [True: 0, False: 0]
  ------------------
 5264|      0|                        {
 5265|      0|                            continue;
 5266|      0|                        }
 5267|      0|                        if (pc2i->c2at[i].endptRevrs == at_Mobile_H_Revrs[k].endpoint && !at2[k].endpoint)
  ------------------
  |  Branch (5267:29): [True: 0, False: 0]
  |  Branch (5267:90): [True: 0, False: 0]
  ------------------
 5268|      0|                        {
 5269|      0|                            nNumTautSB += ( bond_type == BOND_TYPE_SINGLE );
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
 5270|      0|                            nNumTautDB += ( bond_type == BOND_TYPE_DOUBLE );
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
 5271|      0|                            nNumEndpO += ( pVA[k].cNumValenceElectrons == 6 && at2[k].valence == 1 );
  ------------------
  |  Branch (5271:44): [True: 0, False: 0]
  |  Branch (5271:80): [True: 0, False: 0]
  ------------------
 5272|      0|                        }
 5273|      0|                        else
 5274|      0|                        {
 5275|      0|                            if (bond_type == BOND_TYPE_DOUBLE)
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (5275:33): [True: 0, False: 0]
  ------------------
 5276|      0|                            {
 5277|      0|                                nNumOtherDB++;
 5278|      0|                            }
 5279|      0|                            else
 5280|      0|                            {
 5281|      0|                                if (bond_type == BOND_TYPE_SINGLE)
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (5281:37): [True: 0, False: 0]
  ------------------
 5282|      0|                                {
 5283|      0|                                    nNumOtherSB++;
 5284|      0|                                }
 5285|      0|                                else
 5286|      0|                                {
 5287|      0|                                    nNumOthers++;
 5288|      0|                                }
 5289|      0|                            }
 5290|      0|                        }
 5291|      0|                        if (at2[k].endpoint == at2[i].endpoint && at2[k].valence == 1 &&
  ------------------
  |  Branch (5291:29): [True: 0, False: 0]
  |  Branch (5291:67): [True: 0, False: 0]
  ------------------
 5292|      0|                             at2[k].charge == -1 && pVA[k].cNumValenceElectrons == 6)
  ------------------
  |  Branch (5292:30): [True: 0, False: 0]
  |  Branch (5292:53): [True: 0, False: 0]
  ------------------
 5293|      0|                        {
 5294|      0|                            nNumNegEndp++;
 5295|      0|                        }
 5296|      0|                    }
 5297|      0|                    if (!nNumEndpO)
  ------------------
  |  Branch (5297:25): [True: 0, False: 0]
  ------------------
 5298|      0|                    {
 5299|      0|                        continue;
 5300|      0|                    }
 5301|      0|                    if (nNumTautSB + nNumTautDB + nNumOtherDB <= nNumEndpO)
  ------------------
  |  Branch (5301:25): [True: 0, False: 0]
  ------------------
 5302|      0|                    {
 5303|      0|                        continue; /* ignore */
 5304|      0|                    }
 5305|       |                    /* collect double bond taut =O */
 5306|      0|                    for (j = 0; j < at[iS].valence; j++)
  ------------------
  |  Branch (5306:33): [True: 0, False: 0]
  ------------------
 5307|      0|                    {
 5308|      0|                        int bond_type = at2[iS].bond_type[j];
 5309|      0|                        k = at2[iS].neighbor[j];
 5310|      0|                        if (pc2i->c2at[i].endptRevrs == at_Mobile_H_Revrs[k].endpoint &&
  ------------------
  |  Branch (5310:29): [True: 0, False: 0]
  ------------------
 5311|      0|                             !at2[k].endpoint && pVA[k].cNumValenceElectrons == 6 && at2[k].valence == 1 &&
  ------------------
  |  Branch (5311:30): [True: 0, False: 0]
  |  Branch (5311:50): [True: 0, False: 0]
  |  Branch (5311:86): [True: 0, False: 0]
  ------------------
 5312|      0|                             0 <= ( e = pVA[k].nCMinusGroupEdge - 1 ) && !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (5312:30): [True: 0, False: 0]
  |  Branch (5312:74): [True: 0, False: 0]
  ------------------
 5313|      0|                        {
 5314|      0|                            if (bond_type == BOND_TYPE_DOUBLE && !at2[k].charge && !pBNS->edge[e].flow)
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (5314:33): [True: 0, False: 0]
  |  Branch (5314:66): [True: 0, False: 0]
  |  Branch (5314:84): [True: 0, False: 0]
  ------------------
 5315|      0|                            {
 5316|       |                                /* charges to be unchanged */
 5317|      0|                                if (ret = AddToEdgeList( &OtherSO, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (5317:37): [True: 0, False: 0]
  ------------------
 5318|      0|                                {
 5319|      0|                                    goto exit_case_21a;
 5320|      0|                                }
 5321|      0|                            }
 5322|      0|                            else
 5323|      0|                            {
 5324|      0|                                if (bond_type == BOND_TYPE_SINGLE && at2[k].charge == -1 && pBNS->edge[e].flow)
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (5324:37): [True: 0, False: 0]
  |  Branch (5324:70): [True: 0, False: 0]
  |  Branch (5324:93): [True: 0, False: 0]
  ------------------
 5325|      0|                                {
 5326|       |                                    /* charges to be removed */
 5327|      0|                                    if (ret = AddToEdgeList( &SOMinus, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (5327:41): [True: 0, False: 0]
  ------------------
 5328|      0|                                    {
 5329|      0|                                        goto exit_case_21a;
 5330|      0|                                    }
 5331|      0|                                }
 5332|      0|                            }
 5333|      0|                        }
 5334|      0|                    }
 5335|      0|                    if (ret = AddToEdgeList( &CentralS, iS, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (5335:25): [True: 0, False: 0]
  ------------------
 5336|      0|                    {
 5337|      0|                        goto exit_case_21a;
 5338|      0|                    }
 5339|      0|                }
 5340|      2|                else
 5341|      2|                    if (at2[iat].charge == 0 && !pBNS->edge[e].flow &&
  ------------------
  |  Branch (5341:25): [True: 0, False: 2]
  |  Branch (5341:49): [True: 0, False: 0]
  ------------------
 5342|      2|                         at2[iat].valence + 1 == at2[iat].chem_bonds_valence)
  ------------------
  |  Branch (5342:26): [True: 0, False: 0]
  ------------------
 5343|      0|                    {
 5344|       |                        /* changeable charges */
 5345|      0|                        if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (5345:29): [True: 0, False: 0]
  ------------------
 5346|      0|                        {
 5347|      0|                            goto exit_function;
 5348|      0|                        }
 5349|      0|                    }
 5350|      2|            }
 5351|      2|        }
 5352|       |        /* remove unchangeable from changeable */
 5353|      1|        for (i = 0; i < OtherSO.num_edges; i++)
  ------------------
  |  Branch (5353:21): [True: 0, False: 1]
  ------------------
 5354|      0|        {
 5355|      0|            RemoveFromEdgeListByValue( &CurrEdges, OtherSO.pnEdges[i] );
 5356|      0|        }
 5357|       |
 5358|      1|        if (num_try = inchi_min( SOMinus.num_edges, CurrEdges.num_edges ))
  ------------------
  |  |  167|      1|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (5358:13): [True: 0, False: 1]
  ------------------
 5359|      0|        {
 5360|       |            /* detected; attempt to fix */
 5361|      0|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 5362|      0|            RemoveForbiddenEdgeMask( pBNS, &CurrEdges, forbidden_edge_mask );
 5363|      0|            delta = 1;
 5364|      0|            for (i = 0; i < SOMinus.num_edges && cur_success < num_try; i++)
  ------------------
  |  Branch (5364:25): [True: 0, False: 0]
  |  Branch (5364:50): [True: 0, False: 0]
  ------------------
 5365|      0|            {
 5366|      0|                pe = pBNS->edge + SOMinus.pnEdges[i];
 5367|      0|                if (!pe->flow)
  ------------------
  |  Branch (5367:21): [True: 0, False: 0]
  ------------------
 5368|      0|                    continue;
 5369|      0|                pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 5370|      0|                pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 5371|       |
 5372|       |                /*pe->forbidden |= forbidden_edge_mask;*/
 5373|      0|                pe->flow -= delta;
 5374|      0|                pv1->st_edge.flow -= delta;
 5375|      0|                pv2->st_edge.flow -= delta;
 5376|      0|                pBNS->tot_st_flow -= 2 * delta;
 5377|       |
 5378|      0|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 5379|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 5380|       |
 5381|      0|                if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (5381:21): [True: 0, False: 0]
  |  Branch (5381:35): [True: 0, False: 0]
  |  Branch (5381:53): [True: 0, False: 0]
  ------------------
 5382|      0|                                  vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == 1)
  ------------------
  |  Branch (5382:35): [True: 0, False: 0]
  |  Branch (5382:53): [True: 0, False: 0]
  |  Branch (5382:75): [True: 0, False: 0]
  ------------------
 5383|      0|                {
 5384|       |                    /* Added (-) charge to =O => nDeltaCharge == 1 */
 5385|       |                    /* Flow change on pe (-)charge edge (atom -N(-)-) is not known to RunBnsTestOnce()) */
 5386|      0|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 5387|      0|                    if (ret > 0)
  ------------------
  |  Branch (5387:25): [True: 0, False: 0]
  ------------------
 5388|      0|                    {
 5389|      0|                        nNumRunBNS++;
 5390|      0|                        cur_success++; /* 21a */
 5391|      0|                    }
 5392|      0|                }
 5393|      0|                else
 5394|      0|                {
 5395|      0|                    pe->flow += delta;
 5396|      0|                    pv1->st_edge.flow += delta;
 5397|      0|                    pv2->st_edge.flow += delta;
 5398|      0|                    pBNS->tot_st_flow += 2 * delta;
 5399|      0|                }
 5400|      0|                INCHI_HEAPCHK
 5401|      0|            }
 5402|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 5403|      0|        }
 5404|      1|    exit_case_21a:
 5405|      1|        CurrEdges.num_edges = 0; /* clear current edge list */
 5406|      1|        AllocEdgeList( &OtherSO, EDGE_LIST_FREE );
  ------------------
  |  |  271|      1|#define EDGE_LIST_FREE   (-2)
  ------------------
 5407|      1|        AllocEdgeList( &CentralS, EDGE_LIST_FREE );
  ------------------
  |  |  271|      1|#define EDGE_LIST_FREE   (-2)
  ------------------
 5408|      1|        AllocEdgeList( &SOMinus, EDGE_LIST_FREE );
  ------------------
  |  |  271|      1|#define EDGE_LIST_FREE   (-2)
  ------------------
 5409|      1|        AllocEdgeList( &MinusAcceptord, EDGE_LIST_FREE );
  ------------------
  |  |  271|      1|#define EDGE_LIST_FREE   (-2)
  ------------------
 5410|      1|        if (cur_success)
  ------------------
  |  Branch (5410:13): [True: 0, False: 1]
  ------------------
 5411|      0|        {
 5412|      0|            tot_succes += cur_success;
 5413|       |            /* recalculate InChI from the structure */
 5414|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (5414:17): [True: 0, False: 0]
  ------------------
 5415|      0|                                                            ppt_group_info, ppat_norm, ppat_prep ) ))
 5416|      0|            {
 5417|      0|                goto exit_function;
 5418|      0|            }
 5419|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (5419:17): [True: 0, False: 0]
  ------------------
 5420|      0|            {
 5421|      0|                goto exit_function;
 5422|      0|            }
 5423|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (5423:17): [True: 0, False: 0]
  |  Branch (5423:45): [True: 0, False: 0]
  ------------------
 5424|      0|            {
 5425|      0|                goto exit_function;  /* no fixed-H found */
 5426|      0|            }
 5427|      0|            if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (5427:17): [True: 0, False: 0]
  ------------------
 5428|      0|            {
 5429|      0|                goto exit_function;
 5430|      0|            }
 5431|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (5431:17): [True: 0, False: 0]
  ------------------
 5432|      0|            {
 5433|      0|                goto exit_function; /* nothing to do */
 5434|      0|            }
 5435|      0|        }
 5436|      1|    }
 5437|       |
 5438|      1|    if (pc2i->len_c2at)
  ------------------
  |  Branch (5438:9): [True: 1, False: 0]
  ------------------
 5439|      1|    {
 5440|       |        /*------------------------------------------------------------------*/
 5441|       |        /* case 22: restored: N(-)=N(+)=C...=O orig: N#N-N=...-O(-)         */
 5442|       |        /*     im InChI        -O(-) may have H(+) added by Normalization   */
 5443|       |        /*                           or may be tautomeric                   */
 5444|       |        /* Solution: move (-) from N(-) to =O                               */
 5445|       |        /*                                                                  */
 5446|       |        /*------------------------------------------------------------------*/
 5447|      1|        int num_DB_O = 0, iat;
 5448|      1|        short iat_DB_O[MAX_DIFF_FIXH];
 5449|      1|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 5450|      1|        inp_ATOM *at_Mobile_H_Revrs = ( pStruct->pOne_norm_data[1] &&
  ------------------
  |  Branch (5450:41): [True: 1, False: 0]
  ------------------
 5451|      1|                                        pStruct->pOne_norm_data[1]->at ) ? pStruct->pOne_norm_data[1]->at : NULL;
  ------------------
  |  Branch (5451:41): [True: 1, False: 0]
  ------------------
 5452|      1|        int iN2, iC;
 5453|      1|        BNS_EDGE *peDB_O_Minus;
 5454|       |        /*
 5455|       |        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H? pInChI[1]->nNum_H :
 5456|       |        pInChI[0] && pInChI[0]->nNum_H? pInChI[0]->nNum_H : 0;
 5457|       |        */
 5458|      1|        CurrEdges.num_edges = 0; /* clear current edge list */
 5459|      1|        cur_success = 0;
 5460|      3|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (5460:21): [True: 2, False: 1]
  ------------------
 5461|      2|        {
 5462|      2|            iat = pc2i->c2at[i].atomNumber;
 5463|      2|            if ( /* orig. InChI info: =O    */
 5464|      2|                 num_DB_O < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|      4|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (5464:18): [True: 2, False: 0]
  ------------------
 5465|      2|                 pc2i->c2at[i].nValElectr == 6 /* O, S, Se, Te */ &&
  ------------------
  |  Branch (5465:18): [True: 2, False: 0]
  ------------------
 5466|      2|                 ( pc2i->c2at[i].endptInChI || pc2i->c2at[i].nMobHInChI ) &&
  ------------------
  |  Branch (5466:20): [True: 0, False: 2]
  |  Branch (5466:48): [True: 0, False: 2]
  ------------------
 5467|      2|                 ( e = pVA[iat].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (5467:18): [True: 0, False: 0]
  |  Branch (5467:64): [True: 0, False: 0]
  ------------------
 5468|      2|                 pc2i->c2at[i].nFixHInChI == 0 && /*pc2i->c2at[i].nMobHInChI ==  1 &&*/
  ------------------
  |  Branch (5468:18): [True: 0, False: 0]
  ------------------
 5469|       |                                                  /* reversed structure info: */
 5470|      2|                 !( pc2i->c2at[i].endptRevrs || pc2i->c2at[i].nMobHRevrs ) &&
  ------------------
  |  Branch (5470:21): [True: 0, False: 0]
  |  Branch (5470:49): [True: 0, False: 0]
  ------------------
 5471|      2|                 pc2i->c2at[i].nFixHRevrs == 0 &&
  ------------------
  |  Branch (5471:18): [True: 0, False: 0]
  ------------------
 5472|      2|                 pc2i->c2at[i].nAtChargeRevrs == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (5472:18): [True: 0, False: 0]
  |  Branch (5472:55): [True: 0, False: 0]
  ------------------
 5473|      2|                 at2[iat].valence == 1 && at2[iat].chem_bonds_valence == 2)
  ------------------
  |  Branch (5473:18): [True: 0, False: 0]
  |  Branch (5473:43): [True: 0, False: 0]
  ------------------
 5474|      0|            {
 5475|      0|                iat_DB_O[num_DB_O++] = iat;
 5476|      0|            }
 5477|      2|        }
 5478|      1|        for (i = 0; num_DB_O && i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (5478:21): [True: 0, False: 1]
  |  Branch (5478:33): [True: 0, False: 0]
  ------------------
 5479|      0|        {
 5480|       |            /* i = canonical number - 1 */
 5481|      0|            iat = nCanon2AtnoRevrs[i];
 5482|      0|            if ( /* in restored atom O: charge=-1, no H, has no double bond, endpoint */
 5483|      0|                 at2[iat].charge == -1 && !at2[iat].num_H &&
  ------------------
  |  Branch (5483:18): [True: 0, False: 0]
  |  Branch (5483:43): [True: 0, False: 0]
  ------------------
 5484|      0|                 at2[iat].valence == 1 && at2[iat].chem_bonds_valence == 2 && !pVA[iat].cMetal &&
  ------------------
  |  Branch (5484:18): [True: 0, False: 0]
  |  Branch (5484:43): [True: 0, False: 0]
  |  Branch (5484:79): [True: 0, False: 0]
  ------------------
 5485|      0|                 pVA[iat].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (5485:18): [True: 0, False: 0]
  ------------------
 5486|      0|                 ( e = pVA[iat].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (5486:18): [True: 0, False: 0]
  |  Branch (5486:64): [True: 0, False: 0]
  ------------------
 5487|      0|                 pBNS->edge[e].flow &&
  ------------------
  |  Branch (5487:18): [True: 0, False: 0]
  ------------------
 5488|      0|                 !( at_Mobile_H_Revrs && at_Mobile_H_Revrs[iat].endpoint ) &&
  ------------------
  |  Branch (5488:21): [True: 0, False: 0]
  |  Branch (5488:42): [True: 0, False: 0]
  ------------------
 5489|      0|                 pVA[iN2 = at2[iat].neighbor[0]].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (5489:18): [True: 0, False: 0]
  ------------------
 5490|      0|                 at2[iat].bond_type[0] == BOND_TYPE_DOUBLE &&
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (5490:18): [True: 0, False: 0]
  ------------------
 5491|      0|                 at2[iN2].charge == 1 && at2[iN2].valence == 2 && at2[iN2].chem_bonds_valence == 4 &&
  ------------------
  |  Branch (5491:18): [True: 0, False: 0]
  |  Branch (5491:42): [True: 0, False: 0]
  |  Branch (5491:67): [True: 0, False: 0]
  ------------------
 5492|      0|                 pVA[iC = at2[iN2].neighbor[at2[iN2].neighbor[0] == iN2]].cNumValenceElectrons == 4)
  ------------------
  |  Branch (5492:18): [True: 0, False: 0]
  ------------------
 5493|      0|            {
 5494|       |
 5495|      0|                if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (5495:21): [True: 0, False: 0]
  ------------------
 5496|      0|                {
 5497|      0|                    goto exit_function;
 5498|      0|                }
 5499|      0|            }
 5500|      0|        }
 5501|      1|        if (num_try = inchi_min( CurrEdges.num_edges, num_DB_O ))
  ------------------
  |  |  167|      1|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (5501:13): [True: 0, False: 1]
  ------------------
 5502|      0|        {
 5503|       |            /* detected; attempt to fix */
 5504|      0|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 5505|      0|            RemoveForbiddenEdgeMask( pBNS, &CurrEdges, forbidden_edge_mask );
 5506|      0|            delta = 1;
 5507|      0|            for (i = 0; i < num_DB_O && cur_success < num_try; i++)
  ------------------
  |  Branch (5507:25): [True: 0, False: 0]
  |  Branch (5507:41): [True: 0, False: 0]
  ------------------
 5508|      0|            {
 5509|      0|                iat = iat_DB_O[i];
 5510|       |
 5511|      0|                peDB_O_Minus = pBNS->edge + ( pVA[iat].nCMinusGroupEdge - 1 );
 5512|      0|                pe = pBNS->edge + pBNS->vert[iat].iedge[0];
 5513|      0|                if (!pe->flow)
  ------------------
  |  Branch (5513:21): [True: 0, False: 0]
  ------------------
 5514|      0|                    continue;
 5515|      0|                pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 5516|      0|                pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 5517|       |
 5518|      0|                pe->forbidden |= forbidden_edge_mask;
 5519|      0|                peDB_O_Minus->forbidden &= forbidden_edge_mask_inv;
 5520|       |
 5521|      0|                pe->flow -= delta;
 5522|      0|                pv1->st_edge.flow -= delta;
 5523|      0|                pv2->st_edge.flow -= delta;
 5524|      0|                pBNS->tot_st_flow -= 2 * delta;
 5525|       |
 5526|      0|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 5527|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 5528|       |
 5529|      0|                if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (5529:21): [True: 0, False: 0]
  |  Branch (5529:35): [True: 0, False: 0]
  |  Branch (5529:53): [True: 0, False: 0]
  ------------------
 5530|      0|                                  vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == 0)
  ------------------
  |  Branch (5530:35): [True: 0, False: 0]
  |  Branch (5530:53): [True: 0, False: 0]
  |  Branch (5530:75): [True: 0, False: 0]
  ------------------
 5531|      0|                {
 5532|       |                    /* Added (-) charge to =O and removed from =N(-) => nDeltaCharge == 0 */
 5533|      0|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 5534|      0|                    if (ret > 0)
  ------------------
  |  Branch (5534:25): [True: 0, False: 0]
  ------------------
 5535|      0|                    {
 5536|      0|                        nNumRunBNS++;
 5537|      0|                        cur_success++; /* 22 */
 5538|      0|                    }
 5539|      0|                }
 5540|      0|                else
 5541|      0|                {
 5542|      0|                    pe->flow += delta;
 5543|      0|                    pv1->st_edge.flow += delta;
 5544|      0|                    pv2->st_edge.flow += delta;
 5545|      0|                    pBNS->tot_st_flow += 2 * delta;
 5546|      0|                }
 5547|      0|                INCHI_HEAPCHK
 5548|      0|                    pe->forbidden &= forbidden_edge_mask_inv;
 5549|      0|                peDB_O_Minus->forbidden |= forbidden_edge_mask;
 5550|      0|            }
 5551|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 5552|      0|        }
 5553|      1|        CurrEdges.num_edges = 0; /* clear current edge list */
 5554|      1|        if (cur_success)
  ------------------
  |  Branch (5554:13): [True: 0, False: 1]
  ------------------
 5555|      0|        {
 5556|      0|            tot_succes += cur_success;
 5557|       |            /* recalculate InChI from the structure */
 5558|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (5558:17): [True: 0, False: 0]
  ------------------
 5559|      0|                                                            ppt_group_info, ppat_norm, ppat_prep ) ))
 5560|      0|            {
 5561|      0|                goto exit_function;
 5562|      0|            }
 5563|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (5563:17): [True: 0, False: 0]
  ------------------
 5564|      0|            {
 5565|      0|                goto exit_function;
 5566|      0|            }
 5567|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (5567:17): [True: 0, False: 0]
  |  Branch (5567:45): [True: 0, False: 0]
  ------------------
 5568|      0|            {
 5569|      0|                goto exit_function;  /* no fixed-H found */
 5570|      0|            }
 5571|      0|            if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (5571:17): [True: 0, False: 0]
  ------------------
 5572|      0|            {
 5573|      0|                goto exit_function;
 5574|      0|            }
 5575|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (5575:17): [True: 0, False: 0]
  ------------------
 5576|      0|            {
 5577|      0|                goto exit_function; /* nothing to do */
 5578|      0|            }
 5579|      0|        }
 5580|      1|    }
 5581|      1|    if (pc2i->len_c2at && pc2i->nNumTgInChI == 1)
  ------------------
  |  Branch (5581:9): [True: 1, False: 0]
  |  Branch (5581:27): [True: 0, False: 1]
  ------------------
 5582|      0|    {
 5583|       |        /*------------------------------------------------------------------*/
 5584|       |        /* case 23: -NO2 are to be tautomeric but they are not AND          */
 5585|       |        /*          InChI has a SINGLE tautomeric group                     */
 5586|       |        /*                                                                  */
 5587|       |        /*                   (-)O                   (-)O                    */
 5588|       |        /* Solution: convert     \                      \                   */
 5589|       |        /*                        N-X=...-Z(-)   =>      N(+)=X- ...=Z      */
 5590|       |        /*                      //                      /                   */
 5591|       |        /*                     O                    (-)O                    */
 5592|       |        /*                                                                  */
 5593|       |        /*                     O                       O                    */
 5594|       |        /*        or            \\                      \\                  */
 5595|       |        /*                        N-X=...-Z(-)    =>      N=X-  ...=Z       */
 5596|       |        /*                      //                       /                  */
 5597|       |        /*                     O                     (-)O                   */
 5598|       |        /*                                                                  */
 5599|       |        /*                                                                  */
 5600|       |        /*  (a) move (-) from other tautomeric atom to O in O=N-X           */
 5601|       |        /*          or   from other atom that has to be tautomeric          */
 5602|       |        /*               but is not                                         */
 5603|       |        /*  (b) create (+) [ion pair creation] on N as in                   */
 5604|       |        /*                                                                  */
 5605|       |        /*       OH             OH                                          */
 5606|       |        /*      /              /                                            */
 5607|       |        /*  -C=N     =>  =C-N(+)                                            */
 5608|       |        /*     \\             \\                                            */
 5609|       |        /*       O              O                                           */
 5610|       |        /*                                                                  */
 5611|       |        /*------------------------------------------------------------------*/
 5612|      0|        int num_DB_O = 0, iat;
 5613|      0|        short iat_DB_O[MAX_DIFF_FIXH], iat_NO2[MAX_DIFF_FIXH];
 5614|      0|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 5615|      0|        inp_ATOM *at_Mobile_H_Revrs = ( pStruct->pOne_norm_data[1] &&
  ------------------
  |  Branch (5615:41): [True: 0, False: 0]
  ------------------
 5616|      0|                                        pStruct->pOne_norm_data[1]->at ) ? pStruct->pOne_norm_data[1]->at : NULL;
  ------------------
  |  Branch (5616:41): [True: 0, False: 0]
  ------------------
 5617|       |        /*
 5618|       |        inp_ATOM *atfMobile_H_Revrs = (pStruct->pOne_norm_data[1] &&
 5619|       |        pStruct->pOne_norm_data[1]->at_fixed_bonds)?
 5620|       |        pStruct->pOne_norm_data[1]->at_fixed_bonds : NULL;
 5621|       |        */
 5622|      0|        S_CHAR   *num_Fixed_H_Revrs = pStruct->pOneINChI[0]->nNum_H_fixed ? pStruct->pOneINChI[0]->nNum_H_fixed : NULL;
  ------------------
  |  Branch (5622:39): [True: 0, False: 0]
  ------------------
 5623|      0|        S_CHAR   *pnMobHRevrs = ( pStruct->pOneINChI[1] && pStruct->pOneINChI[1]->nNum_H ) ?
  ------------------
  |  Branch (5623:35): [True: 0, False: 0]
  |  Branch (5623:60): [True: 0, False: 0]
  ------------------
 5624|      0|            pStruct->pOneINChI[1]->nNum_H :
 5625|      0|            ( pStruct->pOneINChI[0] && pStruct->pOneINChI[0]->nNum_H ) ?
  ------------------
  |  Branch (5625:15): [True: 0, False: 0]
  |  Branch (5625:40): [True: 0, False: 0]
  ------------------
 5626|      0|            pStruct->pOneINChI[0]->nNum_H : NULL;
 5627|      0|        int iN, one_success;
 5628|      0|        BNS_EDGE *peDB_O_Minus;
 5629|      0|        int neigh, nNumO, nNumOthers;
 5630|      0|#define CHG_SET_NOOH         0
 5631|      0|#define CHG_SET_WRONG_TAUT   1
 5632|      0|#define CHG_SET_TAUT         2
 5633|      0|#define CHG_LAST_SET         2 /* the last index in trying */
 5634|      0|#define CHG_SET_O_FIXED      3
 5635|      0|#define CHG_SET_NUM          4
 5636|      0|        EDGE_LIST ChangeableEdges[CHG_SET_NUM];
 5637|      0|        memset( ChangeableEdges, 0, sizeof( ChangeableEdges ) );
 5638|       |        /* equivalent to AllocEdgeList( &EdgeList, EDGE_LIST_CLEAR ); */
 5639|       |        /*
 5640|       |        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H? pInChI[1]->nNum_H :
 5641|       |        pInChI[0] && pInChI[0]->nNum_H? pInChI[0]->nNum_H : 0;
 5642|       |        */
 5643|      0|        CurrEdges.num_edges = 0; /* clear current edge list */
 5644|      0|        cur_success = 0;
 5645|      0|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (5645:21): [True: 0, False: 0]
  ------------------
 5646|      0|        {
 5647|      0|            iat = pc2i->c2at[i].atomNumber;
 5648|      0|            if ( /* orig. InChI info: taut in orig. InChI =O located in -NO2 that is not taut in Reconstructed InChI */
 5649|      0|                 num_DB_O < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|      0|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (5649:18): [True: 0, False: 0]
  ------------------
 5650|      0|                 pc2i->c2at[i].nValElectr == 6 /* O, S, Se, Te */ &&
  ------------------
  |  Branch (5650:18): [True: 0, False: 0]
  ------------------
 5651|      0|                 ( pc2i->c2at[i].endptInChI /*|| pc2i->c2at[i].nMobHInChI*/ ) &&
  ------------------
  |  Branch (5651:18): [True: 0, False: 0]
  ------------------
 5652|      0|                 ( e = pVA[iat].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (5652:18): [True: 0, False: 0]
  |  Branch (5652:64): [True: 0, False: 0]
  ------------------
 5653|      0|                 pc2i->c2at[i].nFixHInChI == 0 && /*pc2i->c2at[i].nMobHInChI ==  1 &&*/
  ------------------
  |  Branch (5653:18): [True: 0, False: 0]
  ------------------
 5654|       |                                                  /* reversed structure info: */
 5655|      0|                 !( pc2i->c2at[i].endptRevrs /*|| pc2i->c2at[i].nMobHRevrs*/ ) &&
  ------------------
  |  Branch (5655:18): [True: 0, False: 0]
  ------------------
 5656|      0|                 pc2i->c2at[i].nFixHRevrs == 0 &&
  ------------------
  |  Branch (5656:18): [True: 0, False: 0]
  ------------------
 5657|      0|                 pc2i->c2at[i].nAtChargeRevrs == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (5657:18): [True: 0, False: 0]
  |  Branch (5657:55): [True: 0, False: 0]
  ------------------
 5658|      0|                 at2[iat].valence == 1 && at2[iat].chem_bonds_valence == 2 &&
  ------------------
  |  Branch (5658:18): [True: 0, False: 0]
  |  Branch (5658:43): [True: 0, False: 0]
  ------------------
 5659|       |                 /* find whether it belongs to NO2 */
 5660|      0|                 pVA[iN = at2[iat].neighbor[0]].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (5660:18): [True: 0, False: 0]
  ------------------
 5661|      0|                 at2[iN].valence == 3 && ( at2[iN].charge == 0 || at2[iN].charge == 1 ) &&
  ------------------
  |  Branch (5661:18): [True: 0, False: 0]
  |  Branch (5661:44): [True: 0, False: 0]
  |  Branch (5661:67): [True: 0, False: 0]
  ------------------
 5662|      0|                 at2[iN].chem_bonds_valence == 5 - at2[iN].charge)
  ------------------
  |  Branch (5662:18): [True: 0, False: 0]
  ------------------
 5663|      0|            {
 5664|       |                /* find the second O */
 5665|      0|                nNumO = nNumOthers = 0;
 5666|      0|                for (k = 0; k < at2[iN].valence; k++)
  ------------------
  |  Branch (5666:29): [True: 0, False: 0]
  ------------------
 5667|      0|                {
 5668|      0|                    neigh = at2[iN].neighbor[k];
 5669|      0|                    if (neigh == iat)
  ------------------
  |  Branch (5669:25): [True: 0, False: 0]
  ------------------
 5670|      0|                    {
 5671|      0|                        continue;
 5672|      0|                    }
 5673|      0|                    if (pVA[neigh].cNumValenceElectrons == 6 &&
  ------------------
  |  Branch (5673:25): [True: 0, False: 0]
  ------------------
 5674|      0|                         pStruct->endpoint[neigh] &&
  ------------------
  |  Branch (5674:26): [True: 0, False: 0]
  ------------------
 5675|      0|                         !( at_Mobile_H_Revrs && at_Mobile_H_Revrs[neigh].endpoint ) &&
  ------------------
  |  Branch (5675:29): [True: 0, False: 0]
  |  Branch (5675:50): [True: 0, False: 0]
  ------------------
 5676|      0|                         at2[neigh].valence == 1 && at2[neigh].num_H == 0 &&
  ------------------
  |  Branch (5676:26): [True: 0, False: 0]
  |  Branch (5676:53): [True: 0, False: 0]
  ------------------
 5677|      0|                         at2[neigh].radical == 0 && ( at2[neigh].charge == 0 || at2[neigh].charge == -1 ) &&
  ------------------
  |  Branch (5677:26): [True: 0, False: 0]
  |  Branch (5677:55): [True: 0, False: 0]
  |  Branch (5677:81): [True: 0, False: 0]
  ------------------
 5678|      0|                         at2[neigh].chem_bonds_valence - at2[neigh].charge == 2)
  ------------------
  |  Branch (5678:26): [True: 0, False: 0]
  ------------------
 5679|      0|                    {
 5680|      0|                        nNumO++;
 5681|      0|                    }
 5682|      0|                    else
 5683|      0|                    {
 5684|      0|                        if (at2[iN].bond_type[k] == BOND_TYPE_SINGLE &&
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (5684:29): [True: 0, False: 0]
  ------------------
 5685|      0|                             at2[neigh].valence > 1 &&
  ------------------
  |  Branch (5685:30): [True: 0, False: 0]
  ------------------
 5686|      0|                             at2[neigh].valence < at2[neigh].chem_bonds_valence)
  ------------------
  |  Branch (5686:30): [True: 0, False: 0]
  ------------------
 5687|      0|                        {
 5688|      0|                            nNumOthers++;
 5689|      0|                        }
 5690|      0|                    }
 5691|      0|                }
 5692|      0|                if (nNumO != 1 || nNumOthers != 1)
  ------------------
  |  Branch (5692:21): [True: 0, False: 0]
  |  Branch (5692:35): [True: 0, False: 0]
  ------------------
 5693|      0|                {
 5694|      0|                    continue;
 5695|      0|                }
 5696|      0|                for (k = 0; k < num_DB_O; k++)
  ------------------
  |  Branch (5696:29): [True: 0, False: 0]
  ------------------
 5697|      0|                {
 5698|      0|                    if (iat_NO2[k] == iN)
  ------------------
  |  Branch (5698:25): [True: 0, False: 0]
  ------------------
 5699|      0|                    {
 5700|      0|                        break;
 5701|      0|                    }
 5702|      0|                }
 5703|      0|                if (k == num_DB_O)
  ------------------
  |  Branch (5703:21): [True: 0, False: 0]
  ------------------
 5704|      0|                {
 5705|      0|                    iat_NO2[num_DB_O] = iN;
 5706|      0|                    iat_DB_O[num_DB_O++] = iat;
 5707|      0|                }
 5708|       |                /* save the edge to avoid interference */
 5709|      0|                if (ret = AddToEdgeList( &ChangeableEdges[CHG_SET_O_FIXED], e, INC_ADD_EDGE ))
  ------------------
  |  | 5634|      0|#define CHG_SET_O_FIXED      3
  ------------------
                              if (ret = AddToEdgeList( &ChangeableEdges[CHG_SET_O_FIXED], e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (5709:21): [True: 0, False: 0]
  ------------------
 5710|      0|                {
 5711|      0|                    goto exit_case_23;
 5712|      0|                }
 5713|      0|            }
 5714|      0|        }
 5715|      0|        if (num_DB_O)
  ------------------
  |  Branch (5715:13): [True: 0, False: 0]
  ------------------
 5716|      0|        {
 5717|       |            /* 1. search for =N(=O)-OH; assume =N(+)(-O(-))(-OH) does not happen */
 5718|      0|            for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (5718:25): [True: 0, False: 0]
  ------------------
 5719|      0|            {
 5720|       |                /* i = canonical number - 1 */
 5721|       |                /* find O=N(V) */
 5722|      0|                iat = nCanon2AtnoRevrs[i];
 5723|      0|                if (!pStruct->endpoint[i] || pVA[i].cNumValenceElectrons != 6 ||
  ------------------
  |  Branch (5723:21): [True: 0, False: 0]
  |  Branch (5723:46): [True: 0, False: 0]
  ------------------
 5724|      0|                     at2[iat].valence != 1 || at2[iat].charge ||
  ------------------
  |  Branch (5724:22): [True: 0, False: 0]
  |  Branch (5724:47): [True: 0, False: 0]
  ------------------
 5725|      0|                     0 >( e = pVA[iat].nCMinusGroupEdge - 1 ) ||
  ------------------
  |  Branch (5725:22): [True: 0, False: 0]
  ------------------
 5726|      0|                     at2[iat].num_H + at2[iat].chem_bonds_valence != 2 ||
  ------------------
  |  Branch (5726:22): [True: 0, False: 0]
  ------------------
 5727|      0|                     pVA[iN = at2[iat].neighbor[0]].cNumValenceElectrons != 5 ||
  ------------------
  |  Branch (5727:22): [True: 0, False: 0]
  ------------------
 5728|      0|                     0 > ( e = pVA[iN].nCPlusGroupEdge - 1 ) ||
  ------------------
  |  Branch (5728:22): [True: 0, False: 0]
  ------------------
 5729|      0|                     pBNS->edge[e].forbidden || !pBNS->edge[e].flow ||
  ------------------
  |  Branch (5729:22): [True: 0, False: 0]
  |  Branch (5729:49): [True: 0, False: 0]
  ------------------
 5730|      0|                     at2[iN].charge || at2[iN].valence != 3 || at2[iN].chem_bonds_valence != 5)
  ------------------
  |  Branch (5730:22): [True: 0, False: 0]
  |  Branch (5730:40): [True: 0, False: 0]
  |  Branch (5730:64): [True: 0, False: 0]
  ------------------
 5731|      0|                {
 5732|      0|                    continue;
 5733|      0|                }
 5734|       |                /* find the second O, -OH */
 5735|      0|                nNumO = nNumOthers = 0;
 5736|      0|                for (k = 0; k < at2[iN].valence; k++)
  ------------------
  |  Branch (5736:29): [True: 0, False: 0]
  ------------------
 5737|      0|                {
 5738|      0|                    neigh = at2[iN].neighbor[k];
 5739|      0|                    if (neigh == iat)
  ------------------
  |  Branch (5739:25): [True: 0, False: 0]
  ------------------
 5740|      0|                    {
 5741|      0|                        continue;
 5742|      0|                    }
 5743|      0|                    if (pVA[neigh].cNumValenceElectrons == 6 &&
  ------------------
  |  Branch (5743:25): [True: 0, False: 0]
  ------------------
 5744|      0|                         pStruct->endpoint[neigh] &&
  ------------------
  |  Branch (5744:26): [True: 0, False: 0]
  ------------------
 5745|      0|                         at2[neigh].valence == 1 && at2[neigh].num_H == 1 &&
  ------------------
  |  Branch (5745:26): [True: 0, False: 0]
  |  Branch (5745:53): [True: 0, False: 0]
  ------------------
 5746|      0|                         at2[neigh].radical == 0 && ( at2[neigh].charge == 0 ))
  ------------------
  |  Branch (5746:26): [True: 0, False: 0]
  |  Branch (5746:53): [True: 0, False: 0]
  ------------------
 5747|      0|                    {
 5748|      0|                        nNumO++;
 5749|      0|                    }
 5750|      0|                    else
 5751|      0|                        if (at2[iN].bond_type[k] == BOND_TYPE_DOUBLE &&
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (5751:29): [True: 0, False: 0]
  ------------------
 5752|      0|                             at2[neigh].valence >= 2 &&
  ------------------
  |  Branch (5752:30): [True: 0, False: 0]
  ------------------
 5753|      0|                             at2[neigh].valence < at2[neigh].chem_bonds_valence)
  ------------------
  |  Branch (5753:30): [True: 0, False: 0]
  ------------------
 5754|      0|                        {
 5755|      0|                            nNumOthers++;
 5756|      0|                        }
 5757|      0|                }
 5758|      0|                if (nNumO != 1 || nNumOthers != 1)
  ------------------
  |  Branch (5758:21): [True: 0, False: 0]
  |  Branch (5758:35): [True: 0, False: 0]
  ------------------
 5759|      0|                {
 5760|      0|                    continue;
 5761|      0|                }
 5762|       |                /* save edges to be changed */
 5763|      0|                if (( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NOOH], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  | 5630|      0|#define CHG_SET_NOOH         0
  ------------------
                              if (( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NOOH], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (5763:21): [True: 0, False: 0]
  ------------------
 5764|      0|                    ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_O_FIXED], e, INC_ADD_EDGE ) ))
  ------------------
  |  | 5634|      0|#define CHG_SET_O_FIXED      3
  ------------------
                                  ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_O_FIXED], e, INC_ADD_EDGE ) ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (5764:21): [True: 0, False: 0]
  ------------------
 5765|      0|                {
 5766|      0|                    goto exit_case_23;
 5767|      0|                }
 5768|      0|                if (NO_VERTEX != ( j = GetChargeFlowerUpperEdge( pBNS, pVA, e ) ) &&
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (5768:21): [True: 0, False: 0]
  ------------------
 5769|      0|                    ( ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NOOH], j, INC_ADD_EDGE ) ) ||
  ------------------
  |  | 5630|      0|#define CHG_SET_NOOH         0
  ------------------
                                  ( ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NOOH], j, INC_ADD_EDGE ) ) ||
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (5769:23): [True: 0, False: 0]
  ------------------
 5770|      0|                     ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_O_FIXED], e, INC_ADD_EDGE ) ) ))
  ------------------
  |  | 5634|      0|#define CHG_SET_O_FIXED      3
  ------------------
                                   ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_O_FIXED], e, INC_ADD_EDGE ) ) ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (5770:22): [True: 0, False: 0]
  ------------------
 5771|      0|                {
 5772|      0|                    goto exit_case_23;
 5773|      0|                }
 5774|      0|            }
 5775|       |            /* 2. search for (-) atoms that are tautomeric but should not be  */
 5776|       |            /*           or that got H from Normalization but they shouldn't  */
 5777|      0|            for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (5777:25): [True: 0, False: 0]
  ------------------
 5778|      0|            { /* i = canonical number - 1 */
 5779|      0|                iat = nCanon2AtnoRevrs[i];
 5780|      0|                if (at2[iat].charge == -1 &&
  ------------------
  |  Branch (5780:21): [True: 0, False: 0]
  ------------------
 5781|      0|                     !pStruct->endpoint[i] &&
  ------------------
  |  Branch (5781:22): [True: 0, False: 0]
  ------------------
 5782|      0|                     ( at_Mobile_H_Revrs &&
  ------------------
  |  Branch (5782:24): [True: 0, False: 0]
  ------------------
 5783|      0|                     ( at_Mobile_H_Revrs[i].endpoint || at2[iat].num_H < at_Mobile_H_Revrs[i].num_H ) ))
  ------------------
  |  Branch (5783:24): [True: 0, False: 0]
  |  Branch (5783:57): [True: 0, False: 0]
  ------------------
 5784|      0|                {
 5785|       |
 5786|      0|                    if (0 <= ( e = pVA[iat].nCMinusGroupEdge - 1 ) &&
  ------------------
  |  Branch (5786:25): [True: 0, False: 0]
  ------------------
 5787|      0|                         0 > FindInEdgeList( &ChangeableEdges[CHG_SET_O_FIXED], e ) &&
  ------------------
  |  | 5634|      0|#define CHG_SET_O_FIXED      3
  ------------------
  |  Branch (5787:26): [True: 0, False: 0]
  ------------------
 5788|      0|                         !pBNS->edge[e].forbidden && pBNS->edge[e].flow &&
  ------------------
  |  Branch (5788:26): [True: 0, False: 0]
  |  Branch (5788:54): [True: 0, False: 0]
  ------------------
 5789|      0|                         (
 5790|      0|                         ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_WRONG_TAUT], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  | 5631|      0|#define CHG_SET_WRONG_TAUT   1
  ------------------
                                       ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_WRONG_TAUT], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (5790:26): [True: 0, False: 0]
  ------------------
 5791|      0|                             ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_O_FIXED], e, INC_ADD_EDGE ) )
  ------------------
  |  | 5634|      0|#define CHG_SET_O_FIXED      3
  ------------------
                                           ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_O_FIXED], e, INC_ADD_EDGE ) )
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (5791:30): [True: 0, False: 0]
  ------------------
 5792|      0|                             ))
 5793|      0|                    {
 5794|      0|                        goto exit_case_23;
 5795|      0|                    }
 5796|      0|                }
 5797|      0|                else
 5798|      0|                {
 5799|       |                    /* negatively charged atom in Reconstructed structure got H(+) from Normalization */
 5800|       |                    /* and is not tautomeric; in the original structure it is tautomeric */
 5801|      0|                    if (at2[iat].charge == -1 &&
  ------------------
  |  Branch (5801:25): [True: 0, False: 0]
  ------------------
 5802|      0|                         pStruct->endpoint[i] &&
  ------------------
  |  Branch (5802:26): [True: 0, False: 0]
  ------------------
 5803|      0|                         !( at_Mobile_H_Revrs && at_Mobile_H_Revrs[i].endpoint ) &&
  ------------------
  |  Branch (5803:29): [True: 0, False: 0]
  |  Branch (5803:50): [True: 0, False: 0]
  ------------------
 5804|      0|                         ( num_Fixed_H_Revrs && num_Fixed_H_Revrs[i] == -1 ) &&
  ------------------
  |  Branch (5804:28): [True: 0, False: 0]
  |  Branch (5804:49): [True: 0, False: 0]
  ------------------
 5805|      0|                         ( pnMobHRevrs       && pnMobHRevrs[i] == 1 ) &&
  ------------------
  |  Branch (5805:28): [True: 0, False: 0]
  |  Branch (5805:49): [True: 0, False: 0]
  ------------------
 5806|      0|                         pStruct->fixed_H[i] == 0)
  ------------------
  |  Branch (5806:26): [True: 0, False: 0]
  ------------------
 5807|      0|                    {
 5808|       |
 5809|      0|                        if (0 <= ( e = pVA[iat].nCMinusGroupEdge - 1 ) &&
  ------------------
  |  Branch (5809:29): [True: 0, False: 0]
  ------------------
 5810|      0|                             0 > FindInEdgeList( &ChangeableEdges[CHG_SET_O_FIXED], e ) &&
  ------------------
  |  | 5634|      0|#define CHG_SET_O_FIXED      3
  ------------------
  |  Branch (5810:30): [True: 0, False: 0]
  ------------------
 5811|      0|                             !pBNS->edge[e].forbidden && pBNS->edge[e].flow &&
  ------------------
  |  Branch (5811:30): [True: 0, False: 0]
  |  Branch (5811:58): [True: 0, False: 0]
  ------------------
 5812|      0|                             (
 5813|      0|                             ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_WRONG_TAUT], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  | 5631|      0|#define CHG_SET_WRONG_TAUT   1
  ------------------
                                           ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_WRONG_TAUT], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (5813:30): [True: 0, False: 0]
  ------------------
 5814|      0|                                 ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_O_FIXED], e, INC_ADD_EDGE ) )
  ------------------
  |  | 5634|      0|#define CHG_SET_O_FIXED      3
  ------------------
                                               ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_O_FIXED], e, INC_ADD_EDGE ) )
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (5814:34): [True: 0, False: 0]
  ------------------
 5815|      0|                                 ))
 5816|      0|                        {
 5817|      0|                            goto exit_case_23;
 5818|      0|                        }
 5819|      0|                    }
 5820|      0|                }
 5821|      0|            }
 5822|       |            /* 3. Search for (-) atoms that are tautomeric */
 5823|      0|            for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (5823:25): [True: 0, False: 0]
  ------------------
 5824|      0|            {
 5825|       |                /* i = canonical number - 1 */
 5826|      0|                iat = nCanon2AtnoRevrs[i];
 5827|      0|                if (pStruct->endpoint[i] &&
  ------------------
  |  Branch (5827:21): [True: 0, False: 0]
  ------------------
 5828|      0|                    ( at_Mobile_H_Revrs && at_Mobile_H_Revrs[i].endpoint ) &&
  ------------------
  |  Branch (5828:23): [True: 0, False: 0]
  |  Branch (5828:44): [True: 0, False: 0]
  ------------------
 5829|      0|                     at2[iat].charge == -1
  ------------------
  |  Branch (5829:22): [True: 0, False: 0]
  ------------------
 5830|      0|                     /*&& pVA[i].cNumValenceElectrons == 6*/)
 5831|      0|                {
 5832|      0|                    if (0 <= ( e = pVA[iat].nCMinusGroupEdge - 1 ) &&
  ------------------
  |  Branch (5832:25): [True: 0, False: 0]
  ------------------
 5833|      0|                         !pBNS->edge[e].forbidden && pBNS->edge[e].flow &&
  ------------------
  |  Branch (5833:26): [True: 0, False: 0]
  |  Branch (5833:54): [True: 0, False: 0]
  ------------------
 5834|      0|                         0 > FindInEdgeList( &ChangeableEdges[CHG_SET_O_FIXED], e ) &&
  ------------------
  |  | 5634|      0|#define CHG_SET_O_FIXED      3
  ------------------
  |  Branch (5834:26): [True: 0, False: 0]
  ------------------
 5835|      0|                         ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_TAUT], e, INC_ADD_EDGE ) ))
  ------------------
  |  | 5632|      0|#define CHG_SET_TAUT         2
  ------------------
                                       ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_TAUT], e, INC_ADD_EDGE ) ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (5835:26): [True: 0, False: 0]
  ------------------
 5836|      0|                    {
 5837|      0|                        goto exit_case_23;
 5838|      0|                    }
 5839|      0|                }
 5840|      0|            }
 5841|       |
 5842|       |            /* ------- finally, try to move charges from O=N --------------*/
 5843|      0|            for (i = 0; i < num_DB_O; i++)
  ------------------
  |  Branch (5843:25): [True: 0, False: 0]
  ------------------
 5844|      0|            {
 5845|      0|                int nDeltaChargeExpected;
 5846|      0|                one_success = 0;
 5847|      0|                delta = 1;
 5848|      0|                iat = iat_DB_O[i];
 5849|      0|                peDB_O_Minus = pBNS->edge + ( pVA[iat].nCMinusGroupEdge - 1 );
 5850|      0|                pe = pBNS->edge + pBNS->vert[iat].iedge[0];
 5851|       |
 5852|      0|                if (!pe->flow)
  ------------------
  |  Branch (5852:21): [True: 0, False: 0]
  ------------------
 5853|      0|                    continue;
 5854|      0|                pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 5855|      0|                pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 5856|       |
 5857|      0|                pe->forbidden |= forbidden_edge_mask;
 5858|       |
 5859|      0|                pe->flow -= delta;
 5860|      0|                pv1->st_edge.flow -= delta;
 5861|      0|                pv2->st_edge.flow -= delta;
 5862|      0|                pBNS->tot_st_flow -= 2 * delta;
 5863|       |
 5864|      0|                for (k = 0; !one_success && k <= CHG_LAST_SET; k++)
  ------------------
  |  | 5633|      0|#define CHG_LAST_SET         2 /* the last index in trying */
  ------------------
  |  Branch (5864:29): [True: 0, False: 0]
  |  Branch (5864:45): [True: 0, False: 0]
  ------------------
 5865|      0|                {
 5866|      0|                    if (!ChangeableEdges[k].num_edges)
  ------------------
  |  Branch (5866:25): [True: 0, False: 0]
  ------------------
 5867|      0|                    {
 5868|      0|                        continue;
 5869|      0|                    }
 5870|      0|                    nDeltaChargeExpected = ( k == CHG_SET_NOOH ) ? 2 : 0;
  ------------------
  |  | 5630|      0|#define CHG_SET_NOOH         0
  ------------------
  |  Branch (5870:44): [True: 0, False: 0]
  ------------------
 5871|       |
 5872|      0|                    SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 5873|      0|                    RemoveForbiddenEdgeMask( pBNS, &ChangeableEdges[k], forbidden_edge_mask );
 5874|       |                    /* allow (-) charge to move to N=O */
 5875|      0|                    peDB_O_Minus->forbidden &= forbidden_edge_mask_inv;
 5876|       |
 5877|      0|                    ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 5878|      0|                                          &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 5879|       |
 5880|      0|                    if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (5880:25): [True: 0, False: 0]
  |  Branch (5880:39): [True: 0, False: 0]
  |  Branch (5880:57): [True: 0, False: 0]
  ------------------
 5881|      0|                                      vPathEnd == v2 && vPathStart == v1 ) &&
  ------------------
  |  Branch (5881:39): [True: 0, False: 0]
  |  Branch (5881:57): [True: 0, False: 0]
  ------------------
 5882|      0|                         nDeltaCharge == nDeltaChargeExpected)
  ------------------
  |  Branch (5882:26): [True: 0, False: 0]
  ------------------
 5883|      0|                    {
 5884|       |                        /* Move (-) charge to =O and remove it an endpoint => nDeltaCharge == 0 */
 5885|      0|                        ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 5886|      0|                        if (ret > 0)
  ------------------
  |  Branch (5886:29): [True: 0, False: 0]
  ------------------
 5887|      0|                        {
 5888|      0|                            nNumRunBNS++;
 5889|      0|                            one_success++; /* 23 */
 5890|      0|                        }
 5891|      0|                    }
 5892|      0|                    INCHI_HEAPCHK
 5893|      0|                }
 5894|      0|                cur_success += one_success;
 5895|       |
 5896|      0|                RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 5897|      0|                pe->forbidden &= forbidden_edge_mask_inv;
 5898|       |
 5899|      0|                if (!one_success)
  ------------------
  |  Branch (5899:21): [True: 0, False: 0]
  ------------------
 5900|      0|                {
 5901|      0|                    pe->flow += delta;
 5902|      0|                    pv1->st_edge.flow += delta;
 5903|      0|                    pv2->st_edge.flow += delta;
 5904|      0|                    pBNS->tot_st_flow += 2 * delta;
 5905|      0|                }
 5906|      0|            }
 5907|      0|        }
 5908|      0|    exit_case_23:
 5909|      0|        for (i = 0; i < CHG_SET_NUM; i++)
  ------------------
  |  | 5635|      0|#define CHG_SET_NUM          4
  ------------------
  |  Branch (5909:21): [True: 0, False: 0]
  ------------------
 5910|      0|        {
 5911|      0|            AllocEdgeList( &ChangeableEdges[i], EDGE_LIST_FREE );
  ------------------
  |  |  271|      0|#define EDGE_LIST_FREE   (-2)
  ------------------
 5912|      0|        }
 5913|       |
 5914|      0|        CurrEdges.num_edges = 0; /* clear current edge list */
 5915|      0|        if (cur_success)
  ------------------
  |  Branch (5915:13): [True: 0, False: 0]
  ------------------
 5916|      0|        {
 5917|      0|            tot_succes += cur_success;
 5918|       |            /* recalculate InChI from the structure */
 5919|      0|            if (0 >( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (5919:17): [True: 0, False: 0]
  ------------------
 5920|      0|                                                           ppt_group_info, ppat_norm, ppat_prep ) ))
 5921|      0|            {
 5922|      0|                goto exit_function;
 5923|      0|            }
 5924|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (5924:17): [True: 0, False: 0]
  ------------------
 5925|      0|            {
 5926|      0|                goto exit_function;
 5927|      0|            }
 5928|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (5928:17): [True: 0, False: 0]
  |  Branch (5928:45): [True: 0, False: 0]
  ------------------
 5929|      0|            {
 5930|      0|                goto exit_function;  /* no fixed-H found */
 5931|      0|            }
 5932|      0|            if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (5932:17): [True: 0, False: 0]
  ------------------
 5933|      0|            {
 5934|      0|                goto exit_function;
 5935|      0|            }
 5936|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (5936:17): [True: 0, False: 0]
  ------------------
 5937|      0|            {
 5938|      0|                goto exit_function; /* nothing to do */
 5939|      0|            }
 5940|      0|        }
 5941|      0|#undef CHG_SET_NOOH
 5942|      0|#undef CHG_SET_WRONG_TAUT
 5943|      0|#undef CHG_SET_TAUT
 5944|      0|#undef CHG_LAST_SET
 5945|      0|#undef CHG_SET_O_FIXED
 5946|      0|#undef CHG_SET_NUM
 5947|      0|    }
 5948|       |
 5949|      1|    if (pc2i->len_c2at && pc2i->nNumTgInChI == 1)
  ------------------
  |  Branch (5949:9): [True: 1, False: 0]
  |  Branch (5949:27): [True: 0, False: 1]
  ------------------
 5950|      0|    {
 5951|       |        /*------------------------------------------------------------------*/
 5952|       |        /* case 24: InChI norm. -N(-)-N(+)(IV) => -N=N(V) prevents tauto-   */
 5953|       |        /*          merism on -N(-)- in case of ADP                         */
 5954|       |        /*                                                                  */
 5955|       |        /* Solution: convert       N(V)=N-   ...=X    -> N(IV)(+)-N=...-X(-)*/
 5956|       |        /*                     N(IV)(+)-N(-)-...=X                          */
 5957|       |        /*                                                                  */
 5958|       |        /*      Orig InChI            taut      taut, 1 t-group only(ADP?)  */
 5959|       |        /*   Reconstructed struct   non-taut    possibly not taut           */
 5960|       |        /*                                                                  */
 5961|       |        /*   Details: 1a. store next to N(V) (+)edge its flower edge        */
 5962|       |        /*            1b. store next to N(-) edge NO_VERTEX                 */
 5963|       |        /*            2.  Release (-) edges of other missing endpoints or   */
 5964|       |        /*                all endpoints if no other is missing              */
 5965|       |        /*            3.  Decrement flow on (+) edge                        */
 5966|       |        /*                if flower edge is stored then expect DeltaCharge=2*/
 5967|       |        /*                otherwise DeltaCharge = 0                         */
 5968|       |        /*------------------------------------------------------------------*/
 5969|      0|        int iat;
 5970|      0|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 5971|      0|        inp_ATOM *at_Mobile_H_Revrs = ( pStruct->pOne_norm_data[1] &&
  ------------------
  |  Branch (5971:41): [True: 0, False: 0]
  ------------------
 5972|      0|                                        pStruct->pOne_norm_data[1]->at ) ? pStruct->pOne_norm_data[1]->at : NULL;
  ------------------
  |  Branch (5972:41): [True: 0, False: 0]
  ------------------
 5973|      0|        inp_ATOM *atf = ( pStruct->pOne_norm_data[1] && pStruct->pOne_norm_data[1]->at_fixed_bonds ) ?
  ------------------
  |  Branch (5973:27): [True: 0, False: 0]
  |  Branch (5973:57): [True: 0, False: 0]
  ------------------
 5974|      0|            pStruct->pOne_norm_data[1]->at_fixed_bonds : NULL;
 5975|      0|        int iN, one_success;
 5976|      0|        EdgeIndex  ef, e1;
 5977|      0|        BNS_EDGE *pef;
 5978|      0|#define CHG_SET_MISSED_TAUT   0
 5979|      0|#define CHG_SET_OTHER_TAUT_O  1
 5980|      0|#define CHG_SET_OTHER_TAUT_N  2
 5981|      0|#define CHG_LAST_SET          2 /* the last index in trying */
 5982|      0|#define CHG_SET_NN            3
 5983|      0|#define CHG_SET_AVOID         4
 5984|      0|#define CHG_SET_NUM           5
 5985|      0|        EDGE_LIST ChangeableEdges[CHG_SET_NUM];
 5986|      0|        memset( ChangeableEdges, 0, sizeof( ChangeableEdges ) );
 5987|       |        /* equivalent to AllocEdgeList( &EdgeList, EDGE_LIST_CLEAR ); */
 5988|       |        /*
 5989|       |        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H? pInChI[1]->nNum_H :
 5990|       |        pInChI[0] && pInChI[0]->nNum_H? pInChI[0]->nNum_H : 0;
 5991|       |        */
 5992|      0|        CurrEdges.num_edges = 0; /* clear current edge list */
 5993|      0|        cur_success = 0;
 5994|      0|        for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (5994:21): [True: 0, False: 0]
  ------------------
 5995|      0|        {
 5996|      0|            iat = pc2i->c2at[i].atomNumber;
 5997|      0|            if ( /* orig. InChI info: -N=N(V)    */
 5998|      0|                 pc2i->c2at[i].nValElectr == 5 /* N or P */ &&
  ------------------
  |  Branch (5998:18): [True: 0, False: 0]
  ------------------
 5999|      0|                 ( pc2i->c2at[i].endptInChI /* only N */ ) &&
  ------------------
  |  Branch (5999:18): [True: 0, False: 0]
  ------------------
 6000|      0|                 ( e1 = pVA[iat].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e1].forbidden &&
  ------------------
  |  Branch (6000:18): [True: 0, False: 0]
  |  Branch (6000:65): [True: 0, False: 0]
  ------------------
 6001|      0|                 pc2i->c2at[i].nFixHInChI == 0 && pc2i->c2at[i].nMobHInChI == 0 &&
  ------------------
  |  Branch (6001:18): [True: 0, False: 0]
  |  Branch (6001:51): [True: 0, False: 0]
  ------------------
 6002|       |                 /* reversed structure info: */
 6003|      0|                 !pc2i->c2at[i].endptRevrs &&
  ------------------
  |  Branch (6003:18): [True: 0, False: 0]
  ------------------
 6004|      0|                 pc2i->c2at[i].nFixHRevrs == 0 &&
  ------------------
  |  Branch (6004:18): [True: 0, False: 0]
  ------------------
 6005|      0|                 pc2i->c2at[i].nAtChargeRevrs == 0 && !at2[iat].num_H &&
  ------------------
  |  Branch (6005:18): [True: 0, False: 0]
  |  Branch (6005:55): [True: 0, False: 0]
  ------------------
 6006|      0|                 at2[iat].valence == 2 && at2[iat].chem_bonds_valence == 3 &&
  ------------------
  |  Branch (6006:18): [True: 0, False: 0]
  |  Branch (6006:43): [True: 0, False: 0]
  ------------------
 6007|       |                 /* find whether -N= has =N(V) neighbor; Note: operator comma: (A,B) returns B */
 6008|      0|                 ( iN = at2[iat].neighbor[at2[iat].bond_type[0] != BOND_TYPE_DOUBLE],
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (6008:18): [True: 0, False: 0]
  ------------------
 6009|      0|                   pVA[iN].cNumValenceElectrons == 5 ) &&
 6010|      0|                 at2[iN].chem_bonds_valence == 5 &&
  ------------------
  |  Branch (6010:18): [True: 0, False: 0]
  ------------------
 6011|      0|                 at2[iN].charge == 0 && !at2[iN].num_H && !at2[iN].radical &&
  ------------------
  |  Branch (6011:18): [True: 0, False: 0]
  |  Branch (6011:41): [True: 0, False: 0]
  |  Branch (6011:59): [True: 0, False: 0]
  ------------------
 6012|      0|                 0 <= ( e = pVA[iN].nCPlusGroupEdge - 1 ) && !pBNS->edge[e].forbidden && pBNS->edge[e].flow &&
  ------------------
  |  Branch (6012:18): [True: 0, False: 0]
  |  Branch (6012:62): [True: 0, False: 0]
  |  Branch (6012:90): [True: 0, False: 0]
  ------------------
 6013|      0|                 0 > FindInEdgeList( &ChangeableEdges[CHG_SET_AVOID], e ))
  ------------------
  |  | 5983|      0|#define CHG_SET_AVOID         4
  ------------------
  |  Branch (6013:18): [True: 0, False: 0]
  ------------------
 6014|      0|            {
 6015|       |
 6016|      0|                ef = GetChargeFlowerUpperEdge( pBNS, pVA, e ); /* == NO_VERTEX if N(V) has 4 bonds */
 6017|      0|                if (( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NN], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  | 5982|      0|#define CHG_SET_NN            3
  ------------------
                              if (( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NN], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6017:21): [True: 0, False: 0]
  ------------------
 6018|      0|                    ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NN], ef, INC_ADD_EDGE ) ) ||
  ------------------
  |  | 5982|      0|#define CHG_SET_NN            3
  ------------------
                                  ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NN], ef, INC_ADD_EDGE ) ) ||
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6018:21): [True: 0, False: 0]
  ------------------
 6019|      0|                     ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NN], 1, INC_ADD_EDGE ) ) || /* expected nDeltaCharge */
  ------------------
  |  | 5982|      0|#define CHG_SET_NN            3
  ------------------
                                   ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NN], 1, INC_ADD_EDGE ) ) || /* expected nDeltaCharge */
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6019:22): [True: 0, False: 0]
  ------------------
 6020|      0|                     ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e1, INC_ADD_EDGE ) ) ||
  ------------------
  |  | 5983|      0|#define CHG_SET_AVOID         4
  ------------------
                                   ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e1, INC_ADD_EDGE ) ) ||
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6020:22): [True: 0, False: 0]
  ------------------
 6021|      0|                     ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  | 5983|      0|#define CHG_SET_AVOID         4
  ------------------
                                   ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6021:22): [True: 0, False: 0]
  ------------------
 6022|      0|                     ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], ef, INC_ADD_EDGE ) ))
  ------------------
  |  | 5983|      0|#define CHG_SET_AVOID         4
  ------------------
                                   ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], ef, INC_ADD_EDGE ) ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6022:22): [True: 0, False: 0]
  ------------------
 6023|      0|                {
 6024|      0|                    goto exit_case_24;
 6025|      0|                }
 6026|       |                /* mark -N= so that (-) will not be moved to it */
 6027|      0|                if (0 <= ( e = pVA[iat].nCMinusGroupEdge ) && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (6027:21): [True: 0, False: 0]
  |  Branch (6027:63): [True: 0, False: 0]
  ------------------
 6028|      0|                     0 > FindInEdgeList( &ChangeableEdges[CHG_SET_AVOID], e ) &&
  ------------------
  |  | 5983|      0|#define CHG_SET_AVOID         4
  ------------------
  |  Branch (6028:22): [True: 0, False: 0]
  ------------------
 6029|      0|                     ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e, INC_ADD_EDGE ) ))
  ------------------
  |  | 5983|      0|#define CHG_SET_AVOID         4
  ------------------
                                   ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e, INC_ADD_EDGE ) ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6029:22): [True: 0, False: 0]
  ------------------
 6030|      0|                {
 6031|      0|                    goto exit_case_24;
 6032|      0|                }
 6033|      0|            }
 6034|      0|            else
 6035|      0|            {
 6036|      0|                if ( /* orig. InChI info: -N(-)N(IV)(+)    */
 6037|      0|                     atf &&
  ------------------
  |  Branch (6037:22): [True: 0, False: 0]
  ------------------
 6038|      0|                     pc2i->c2at[i].nValElectr == 5 /* N or P */ &&
  ------------------
  |  Branch (6038:22): [True: 0, False: 0]
  ------------------
 6039|      0|                     pc2i->c2at[i].endptInChI /* only N */ &&
  ------------------
  |  Branch (6039:22): [True: 0, False: 0]
  ------------------
 6040|      0|                     ( e = pVA[iat].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (6040:22): [True: 0, False: 0]
  |  Branch (6040:68): [True: 0, False: 0]
  ------------------
 6041|      0|                     pc2i->c2at[i].nFixHInChI == 0 && pc2i->c2at[i].nMobHInChI == 0 &&
  ------------------
  |  Branch (6041:22): [True: 0, False: 0]
  |  Branch (6041:55): [True: 0, False: 0]
  ------------------
 6042|       |                     /* reversed structure info: */
 6043|      0|                     !pc2i->c2at[i].endptRevrs &&
  ------------------
  |  Branch (6043:22): [True: 0, False: 0]
  ------------------
 6044|      0|                     pc2i->c2at[i].nFixHRevrs == 0 &&
  ------------------
  |  Branch (6044:22): [True: 0, False: 0]
  ------------------
 6045|      0|                     pc2i->c2at[i].nAtChargeRevrs == -1 && !at2[iat].num_H &&
  ------------------
  |  Branch (6045:22): [True: 0, False: 0]
  |  Branch (6045:60): [True: 0, False: 0]
  ------------------
 6046|      0|                     at2[iat].valence == 2 && at2[iat].chem_bonds_valence == 2 &&
  ------------------
  |  Branch (6046:22): [True: 0, False: 0]
  |  Branch (6046:47): [True: 0, False: 0]
  ------------------
 6047|      0|                     atf[iat].valence == 2 && atf[iat].chem_bonds_valence == 3 &&
  ------------------
  |  Branch (6047:22): [True: 0, False: 0]
  |  Branch (6047:47): [True: 0, False: 0]
  ------------------
 6048|       |                     /* find whether -N= has =N(V) neighbor; Note: operator comma: (A,B) returns B */
 6049|      0|                     ( iN = atf[iat].neighbor[atf[iat].bond_type[0] != BOND_TYPE_DOUBLE],
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (6049:22): [True: 0, False: 0]
  ------------------
 6050|      0|                       pVA[iN].cNumValenceElectrons == 5 ) &&
 6051|      0|                     at2[iN].charge == 1 && /* double bond neighbor */
  ------------------
  |  Branch (6051:22): [True: 0, False: 0]
  ------------------
 6052|      0|                     at2[iN].chem_bonds_valence == 4 &&
  ------------------
  |  Branch (6052:22): [True: 0, False: 0]
  ------------------
 6053|      0|                     atf[iN].charge == 0 &&
  ------------------
  |  Branch (6053:22): [True: 0, False: 0]
  ------------------
 6054|      0|                     atf[iN].chem_bonds_valence == 5 &&  /* InChI normalization created N(V)=N- out of N(IV)(+)-N(-)- */
  ------------------
  |  Branch (6054:22): [True: 0, False: 0]
  ------------------
 6055|      0|                     !at2[iN].num_H && !at2[iN].radical &&
  ------------------
  |  Branch (6055:22): [True: 0, False: 0]
  |  Branch (6055:40): [True: 0, False: 0]
  ------------------
 6056|      0|                     0 <= ( e = pVA[iat].nCMinusGroupEdge - 1 ) && !pBNS->edge[e].forbidden && pBNS->edge[e].flow &&
  ------------------
  |  Branch (6056:22): [True: 0, False: 0]
  |  Branch (6056:68): [True: 0, False: 0]
  |  Branch (6056:96): [True: 0, False: 0]
  ------------------
 6057|      0|                     0 > FindInEdgeList( &ChangeableEdges[CHG_SET_AVOID], e ))
  ------------------
  |  | 5983|      0|#define CHG_SET_AVOID         4
  ------------------
  |  Branch (6057:22): [True: 0, False: 0]
  ------------------
 6058|      0|                {
 6059|       |                    /* save (-) edge */
 6060|      0|                    if (( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NN], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  | 5982|      0|#define CHG_SET_NN            3
  ------------------
                                  if (( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NN], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6060:25): [True: 0, False: 0]
  ------------------
 6061|      0|                        ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NN], NO_VERTEX, INC_ADD_EDGE ) ) ||
  ------------------
  |  | 5982|      0|#define CHG_SET_NN            3
  ------------------
                                      ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NN], NO_VERTEX, INC_ADD_EDGE ) ) ||
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
                                      ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NN], NO_VERTEX, INC_ADD_EDGE ) ) ||
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6061:25): [True: 0, False: 0]
  ------------------
 6062|      0|                         ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NN], 1, INC_ADD_EDGE ) ) || /* expected nDeltaCharge */
  ------------------
  |  | 5982|      0|#define CHG_SET_NN            3
  ------------------
                                       ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NN], 1, INC_ADD_EDGE ) ) || /* expected nDeltaCharge */
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6062:26): [True: 0, False: 0]
  ------------------
 6063|      0|                         ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e, INC_ADD_EDGE ) ))
  ------------------
  |  | 5983|      0|#define CHG_SET_AVOID         4
  ------------------
                                       ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e, INC_ADD_EDGE ) ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6063:26): [True: 0, False: 0]
  ------------------
 6064|      0|                    {
 6065|      0|                        goto exit_case_24;
 6066|      0|                    }
 6067|      0|                }
 6068|      0|            }
 6069|      0|        }
 6070|      0|        if (!ChangeableEdges[CHG_SET_NN].num_edges)
  ------------------
  |  | 5982|      0|#define CHG_SET_NN            3
  ------------------
  |  Branch (6070:13): [True: 0, False: 0]
  ------------------
 6071|      0|        {
 6072|      0|            goto  exit_case_24;
 6073|      0|        }
 6074|       |        /* Collect all relevant tautomeric atoms */
 6075|      0|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (6075:21): [True: 0, False: 0]
  ------------------
 6076|      0|        {
 6077|       |            /* i = canonical number - 1 */
 6078|      0|            if (!pStruct->endpoint[i])
  ------------------
  |  Branch (6078:17): [True: 0, False: 0]
  ------------------
 6079|      0|            {
 6080|      0|                continue;
 6081|      0|            }
 6082|      0|            iat = nCanon2AtnoRevrs[i];
 6083|      0|            if (at2[iat].charge || at2[iat].radical || at2[iat].valence == at2[iat].chem_bonds_valence)
  ------------------
  |  Branch (6083:17): [True: 0, False: 0]
  |  Branch (6083:36): [True: 0, False: 0]
  |  Branch (6083:56): [True: 0, False: 0]
  ------------------
 6084|      0|            {
 6085|      0|                continue; /* cannot be an acceptor of (-) */
 6086|      0|            }
 6087|      0|            if (0 > ( e = pVA[iat].nCMinusGroupEdge - 1 ) || pBNS->edge[e].forbidden || pBNS->edge[e].flow)
  ------------------
  |  Branch (6087:17): [True: 0, False: 0]
  |  Branch (6087:62): [True: 0, False: 0]
  |  Branch (6087:89): [True: 0, False: 0]
  ------------------
 6088|      0|            {
 6089|      0|                continue;
 6090|      0|            }
 6091|      0|            if (0 <= FindInEdgeList( &ChangeableEdges[CHG_SET_AVOID], e ))
  ------------------
  |  | 5983|      0|#define CHG_SET_AVOID         4
  ------------------
  |  Branch (6091:17): [True: 0, False: 0]
  ------------------
 6092|      0|            {
 6093|      0|                continue; /* has already been used */
 6094|      0|            }
 6095|       |            /* missing endpoint */
 6096|      0|            if (!( at_Mobile_H_Revrs && at_Mobile_H_Revrs[iat].endpoint ))
  ------------------
  |  Branch (6096:20): [True: 0, False: 0]
  |  Branch (6096:41): [True: 0, False: 0]
  ------------------
 6097|      0|            {
 6098|      0|                if (0 > FindInEdgeList( &ChangeableEdges[CHG_SET_AVOID], e ) && (
  ------------------
  |  | 5983|      0|#define CHG_SET_AVOID         4
  ------------------
  |  Branch (6098:21): [True: 0, False: 0]
  ------------------
 6099|      0|                    ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_MISSED_TAUT], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  | 5978|      0|#define CHG_SET_MISSED_TAUT   0
  ------------------
                                  ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_MISSED_TAUT], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6099:21): [True: 0, False: 0]
  ------------------
 6100|      0|                    ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e, INC_ADD_EDGE ) ) ))
  ------------------
  |  | 5983|      0|#define CHG_SET_AVOID         4
  ------------------
                                  ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e, INC_ADD_EDGE ) ) ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6100:21): [True: 0, False: 0]
  ------------------
 6101|      0|                {
 6102|      0|                    goto exit_case_24;
 6103|      0|                }
 6104|      0|            }
 6105|      0|            else
 6106|      0|            {
 6107|       |                /* endpoint O */
 6108|      0|                if (pVA[iat].cNumValenceElectrons == 6)
  ------------------
  |  Branch (6108:21): [True: 0, False: 0]
  ------------------
 6109|      0|                {
 6110|      0|                    if (0 > FindInEdgeList( &ChangeableEdges[CHG_SET_AVOID], e ) && (
  ------------------
  |  | 5983|      0|#define CHG_SET_AVOID         4
  ------------------
  |  Branch (6110:25): [True: 0, False: 0]
  ------------------
 6111|      0|                        ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_OTHER_TAUT_O], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  | 5979|      0|#define CHG_SET_OTHER_TAUT_O  1
  ------------------
                                      ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_OTHER_TAUT_O], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6111:25): [True: 0, False: 0]
  ------------------
 6112|      0|                        ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e, INC_ADD_EDGE ) ) ))
  ------------------
  |  | 5983|      0|#define CHG_SET_AVOID         4
  ------------------
                                      ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e, INC_ADD_EDGE ) ) ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6112:25): [True: 0, False: 0]
  ------------------
 6113|      0|                    {
 6114|      0|                        goto exit_case_24;
 6115|      0|                    }
 6116|      0|                }
 6117|      0|                else
 6118|      0|                {
 6119|       |                    /* endpoint N */
 6120|      0|                    if (pVA[iat].cNumValenceElectrons == 5)
  ------------------
  |  Branch (6120:25): [True: 0, False: 0]
  ------------------
 6121|      0|                    {
 6122|      0|                        if (0 > FindInEdgeList( &ChangeableEdges[CHG_SET_AVOID], e ) && (
  ------------------
  |  | 5983|      0|#define CHG_SET_AVOID         4
  ------------------
  |  Branch (6122:29): [True: 0, False: 0]
  ------------------
 6123|      0|                            ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_OTHER_TAUT_N], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  | 5980|      0|#define CHG_SET_OTHER_TAUT_N  2
  ------------------
                                          ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_OTHER_TAUT_N], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6123:29): [True: 0, False: 0]
  ------------------
 6124|      0|                            ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e, INC_ADD_EDGE ) ) ))
  ------------------
  |  | 5983|      0|#define CHG_SET_AVOID         4
  ------------------
                                          ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e, INC_ADD_EDGE ) ) ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6124:29): [True: 0, False: 0]
  ------------------
 6125|      0|                        {
 6126|      0|                            goto exit_case_24;
 6127|      0|                        }
 6128|      0|                    }
 6129|      0|                }
 6130|      0|            }
 6131|      0|        }
 6132|       |        /* ------- finally, try to move charges from -N(-)-N(+) or to N(V) --------------*/
 6133|      0|        for (i = 0; i < ChangeableEdges[CHG_SET_NN].num_edges; i += 3)
  ------------------
  |  | 5982|      0|#define CHG_SET_NN            3
  ------------------
  |  Branch (6133:21): [True: 0, False: 0]
  ------------------
 6134|      0|        {
 6135|      0|            int nDeltaChargeExpected;
 6136|      0|            one_success = 0;
 6137|      0|            delta = 1;
 6138|      0|            pe = pBNS->edge + ChangeableEdges[CHG_SET_NN].pnEdges[i];
  ------------------
  |  | 5982|      0|#define CHG_SET_NN            3
  ------------------
 6139|      0|            pef = ( NO_VERTEX != ChangeableEdges[CHG_SET_NN].pnEdges[i + 1] ) ?
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
                          pef = ( NO_VERTEX != ChangeableEdges[CHG_SET_NN].pnEdges[i + 1] ) ?
  ------------------
  |  | 5982|      0|#define CHG_SET_NN            3
  ------------------
  |  Branch (6139:19): [True: 0, False: 0]
  ------------------
 6140|      0|                pBNS->edge + ChangeableEdges[CHG_SET_NN].pnEdges[i + 1] : NULL;
  ------------------
  |  | 5982|      0|#define CHG_SET_NN            3
  ------------------
 6141|      0|            nDeltaChargeExpected = ChangeableEdges[CHG_SET_NN].pnEdges[i + 2];
  ------------------
  |  | 5982|      0|#define CHG_SET_NN            3
  ------------------
 6142|       |
 6143|      0|            if (!pe->flow)
  ------------------
  |  Branch (6143:17): [True: 0, False: 0]
  ------------------
 6144|      0|                continue;
 6145|      0|            pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 6146|      0|            pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 6147|       |
 6148|      0|            pe->flow -= delta;
 6149|      0|            pv1->st_edge.flow -= delta;
 6150|      0|            pv2->st_edge.flow -= delta;
 6151|      0|            pBNS->tot_st_flow -= 2 * delta;
 6152|       |
 6153|      0|            for (k = 0; !one_success && k <= CHG_LAST_SET; k++)
  ------------------
  |  | 5981|      0|#define CHG_LAST_SET          2 /* the last index in trying */
  ------------------
  |  Branch (6153:25): [True: 0, False: 0]
  |  Branch (6153:41): [True: 0, False: 0]
  ------------------
 6154|      0|            {
 6155|      0|                if (!ChangeableEdges[k].num_edges)
  ------------------
  |  Branch (6155:21): [True: 0, False: 0]
  ------------------
 6156|      0|                {
 6157|      0|                    continue;
 6158|      0|                }
 6159|      0|                SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 6160|      0|                RemoveForbiddenEdgeMask( pBNS, &ChangeableEdges[k], forbidden_edge_mask );
 6161|       |                /* allow change of N(V) flower edge */
 6162|      0|                if (pef)
  ------------------
  |  Branch (6162:21): [True: 0, False: 0]
  ------------------
 6163|      0|                {
 6164|      0|                    pef->forbidden &= forbidden_edge_mask_inv;
 6165|      0|                }
 6166|       |
 6167|      0|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 6168|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 6169|       |
 6170|      0|                if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (6170:21): [True: 0, False: 0]
  |  Branch (6170:35): [True: 0, False: 0]
  |  Branch (6170:53): [True: 0, False: 0]
  ------------------
 6171|      0|                                  vPathEnd == v2 && vPathStart == v1 ) &&
  ------------------
  |  Branch (6171:35): [True: 0, False: 0]
  |  Branch (6171:53): [True: 0, False: 0]
  ------------------
 6172|      0|                     nDeltaCharge == nDeltaChargeExpected)
  ------------------
  |  Branch (6172:22): [True: 0, False: 0]
  ------------------
 6173|      0|                {
 6174|       |                    /* Move (-) charge to =O and remove it an endpoint => nDeltaCharge == 0 */
 6175|      0|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 6176|      0|                    if (ret > 0)
  ------------------
  |  Branch (6176:25): [True: 0, False: 0]
  ------------------
 6177|      0|                    {
 6178|      0|                        nNumRunBNS++;
 6179|      0|                        one_success++; /* 24 */
 6180|      0|                    }
 6181|      0|                }
 6182|      0|                INCHI_HEAPCHK
 6183|      0|            }
 6184|      0|            cur_success += one_success;
 6185|       |
 6186|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 6187|       |
 6188|      0|            if (!one_success)
  ------------------
  |  Branch (6188:17): [True: 0, False: 0]
  ------------------
 6189|      0|            {
 6190|      0|                pe->flow += delta;
 6191|      0|                pv1->st_edge.flow += delta;
 6192|      0|                pv2->st_edge.flow += delta;
 6193|      0|                pBNS->tot_st_flow += 2 * delta;
 6194|      0|            }
 6195|      0|        }
 6196|      0|    exit_case_24:
 6197|      0|        for (i = 0; i < CHG_SET_NUM; i++)
  ------------------
  |  | 5984|      0|#define CHG_SET_NUM           5
  ------------------
  |  Branch (6197:21): [True: 0, False: 0]
  ------------------
 6198|      0|        {
 6199|      0|            AllocEdgeList( &ChangeableEdges[i], EDGE_LIST_FREE );
  ------------------
  |  |  271|      0|#define EDGE_LIST_FREE   (-2)
  ------------------
 6200|      0|        }
 6201|       |
 6202|      0|        CurrEdges.num_edges = 0; /* clear current edge list */
 6203|      0|        if (cur_success)
  ------------------
  |  Branch (6203:13): [True: 0, False: 0]
  ------------------
 6204|      0|        {
 6205|      0|            tot_succes += cur_success;
 6206|       |            /* recalculate InChI from the structure */
 6207|      0|            if (0 >( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (6207:17): [True: 0, False: 0]
  ------------------
 6208|      0|                                                           ppt_group_info, ppat_norm, ppat_prep ) ))
 6209|      0|            {
 6210|      0|                goto exit_function;
 6211|      0|            }
 6212|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (6212:17): [True: 0, False: 0]
  ------------------
 6213|      0|            {
 6214|      0|                goto exit_function;
 6215|      0|            }
 6216|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (6216:17): [True: 0, False: 0]
  |  Branch (6216:45): [True: 0, False: 0]
  ------------------
 6217|      0|            {
 6218|      0|                goto exit_function;  /* no fixed-H found */
 6219|      0|            }
 6220|      0|            if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (6220:17): [True: 0, False: 0]
  ------------------
 6221|      0|            {
 6222|      0|                goto exit_function;
 6223|      0|            }
 6224|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (6224:17): [True: 0, False: 0]
  ------------------
 6225|      0|            {
 6226|      0|                goto exit_function; /* nothing to do */
 6227|      0|            }
 6228|      0|        }
 6229|      0|#undef CHG_SET_NN
 6230|      0|#undef CHG_SET_MISSED_TAUT
 6231|      0|#undef CHG_SET_OTHER_TAUT_O
 6232|      0|#undef CHG_SET_OTHER_TAUT_N
 6233|      0|#undef CHG_LAST_SET
 6234|      0|#undef CHG_SET_AVOID
 6235|      0|#undef CHG_SET_NUM
 6236|      0|    }
 6237|       |
 6238|       |    /* pStruct->nNumRemovedProtonsMobHInChI == pc2i->nNumRemHInChI */
 6239|       |
 6240|      1|    if (pc2i->len_c2at && pc2i->nNumTgInChI == 1 &&
  ------------------
  |  Branch (6240:9): [True: 1, False: 0]
  |  Branch (6240:27): [True: 0, False: 1]
  ------------------
 6241|      1|         pc2i->nNumRemHRevrs > pc2i->nNumRemHInChI && 0 > pc2i->nNumRemHInChI &&
  ------------------
  |  Branch (6241:10): [True: 0, False: 0]
  |  Branch (6241:55): [True: 0, False: 0]
  ------------------
 6242|      1|         ( pc2i->nNumEndpRevrs < pc2i->nNumEndpInChI ||
  ------------------
  |  Branch (6242:12): [True: 0, False: 0]
  ------------------
 6243|      0|           pc2i->nNumTgRevrs > pc2i->nNumTgInChI ))
  ------------------
  |  Branch (6243:12): [True: 0, False: 0]
  ------------------
 6244|      0|    {
 6245|       |        /*------------------------------------------------------------------*/
 6246|       |        /* case 25: Restored InChI does not have 2 or more added protons    */
 6247|       |        /*                         possibly taut. endpoints are missing     */
 6248|       |        /*                         has -N(-O(-))-O(-) group(s)              */
 6249|       |        /*          Original InChI has only one t-group                     */
 6250|       |        /*                                                                  */
 6251|       |        /* Solution: convert       -N(-O(-))-O(-) -> -N(+)(=O)-O(-)         */
 6252|       |        /*                         and direct 2(-) to the missing taut atoms*/
 6253|       |        /*           at first attempt try to move (-) to N only             */
 6254|       |        /*                                                                  */
 6255|       |        /*------------------------------------------------------------------*/
 6256|      0|        int iat;
 6257|      0|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 6258|      0|        AT_NUMB  *nAtno2CanonRevrs = pStruct->nAtno2Canon[0];
 6259|      0|        inp_ATOM *at_Mobile_H_Revrs = ( pStruct->pOne_norm_data[1] &&
  ------------------
  |  Branch (6259:41): [True: 0, False: 0]
  ------------------
 6260|      0|                                        pStruct->pOne_norm_data[1]->at ) ? pStruct->pOne_norm_data[1]->at : NULL;
  ------------------
  |  Branch (6260:41): [True: 0, False: 0]
  ------------------
 6261|       |        /*
 6262|       |        inp_ATOM *atf  = (pStruct->pOne_norm_data[1] && pStruct->pOne_norm_data[1]->at_fixed_bonds)?
 6263|       |        pStruct->pOne_norm_data[1]->at_fixed_bonds : NULL;
 6264|       |        */
 6265|      0|        int iN, neigh, one_success;
 6266|      0|        EdgeIndex  e1, bFirst;
 6267|      0|        BNS_EDGE *pef;
 6268|      0|#define CHG_SET_MISSED_TAUT_1   0
 6269|      0|#define CHG_SET_MISSED_TAUT_ALL 1
 6270|      0|#define CHG_SET_OTHER_TAUT_1    2
 6271|      0|#define CHG_SET_OTHER_TAUT_ALL  3
 6272|      0|#define CHG_LAST_SET            3 /* the last index in trying */
 6273|      0|#define CHG_SET_NO_IN_NO2M2     4
 6274|      0|#define CHG_SET_AVOID           5
 6275|      0|#define CHG_SET_NUM             6
 6276|      0|        EDGE_LIST ChangeableEdges[CHG_SET_NUM];
 6277|      0|        memset( ChangeableEdges, 0, sizeof( ChangeableEdges ) );
 6278|       |        /* equivalent to AllocEdgeList( &EdgeList, EDGE_LIST_CLEAR ); */
 6279|       |        /*
 6280|       |        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H? pInChI[1]->nNum_H :
 6281|       |        pInChI[0] && pInChI[0]->nNum_H? pInChI[0]->nNum_H : 0;
 6282|       |        */
 6283|      0|        CurrEdges.num_edges = 0; /* clear current edge list */
 6284|      0|        cur_success = 0;
 6285|       |        /* find all -N(-O(-))-O(-) */
 6286|      0|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (6286:21): [True: 0, False: 0]
  ------------------
 6287|      0|        {
 6288|      0|            iat = nCanon2AtnoRevrs[i];
 6289|      0|            if (pStruct->endpoint[i])
  ------------------
  |  Branch (6289:17): [True: 0, False: 0]
  ------------------
 6290|      0|            {
 6291|      0|                if (0 >( e = pVA[iat].nCMinusGroupEdge - 1 ) || pBNS->edge[e].forbidden ||
  ------------------
  |  Branch (6291:21): [True: 0, False: 0]
  |  Branch (6291:65): [True: 0, False: 0]
  ------------------
 6292|      0|                     0 <= FindInEdgeList( &ChangeableEdges[CHG_SET_AVOID], e ))
  ------------------
  |  | 6274|      0|#define CHG_SET_AVOID           5
  ------------------
  |  Branch (6292:22): [True: 0, False: 0]
  ------------------
 6293|      0|                {
 6294|      0|                    continue;
 6295|      0|                }
 6296|      0|                bFirst = ( pVA[iat].cNumValenceElectrons == 5 && pc2i->nNumTgInChI == 1 ||
  ------------------
  |  Branch (6296:28): [True: 0, False: 0]
  |  Branch (6296:66): [True: 0, False: 0]
  ------------------
 6297|      0|                           pVA[iat].cNumValenceElectrons == 6 && pc2i->nNumTgInChI != 1 );
  ------------------
  |  Branch (6297:28): [True: 0, False: 0]
  |  Branch (6297:66): [True: 0, False: 0]
  ------------------
 6298|       |                /* many or no t-groups -> try O only first */
 6299|       |                /* single t-group -> try only N first */
 6300|      0|                if (!( at_Mobile_H_Revrs && at_Mobile_H_Revrs[i].endpoint ))
  ------------------
  |  Branch (6300:24): [True: 0, False: 0]
  |  Branch (6300:45): [True: 0, False: 0]
  ------------------
 6301|      0|                {
 6302|       |                    /* missed tautomeric endpoint */
 6303|      0|                    if (bFirst &&
  ------------------
  |  Branch (6303:25): [True: 0, False: 0]
  ------------------
 6304|      0|                        ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_MISSED_TAUT_1], e, INC_ADD_EDGE ) ))
  ------------------
  |  | 6268|      0|#define CHG_SET_MISSED_TAUT_1   0
  ------------------
                                      ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_MISSED_TAUT_1], e, INC_ADD_EDGE ) ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6304:25): [True: 0, False: 0]
  ------------------
 6305|      0|                    {
 6306|      0|                        goto exit_case_25;
 6307|      0|                    }
 6308|      0|                    if (ret = AddToEdgeList( &ChangeableEdges[CHG_SET_MISSED_TAUT_ALL], e, INC_ADD_EDGE ))
  ------------------
  |  | 6269|      0|#define CHG_SET_MISSED_TAUT_ALL 1
  ------------------
                                  if (ret = AddToEdgeList( &ChangeableEdges[CHG_SET_MISSED_TAUT_ALL], e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6308:25): [True: 0, False: 0]
  ------------------
 6309|      0|                    {
 6310|      0|                        goto exit_case_25;
 6311|      0|                    }
 6312|      0|                }
 6313|      0|                if (bFirst &&
  ------------------
  |  Branch (6313:21): [True: 0, False: 0]
  ------------------
 6314|      0|                    ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_OTHER_TAUT_1], e, INC_ADD_EDGE ) ))
  ------------------
  |  | 6270|      0|#define CHG_SET_OTHER_TAUT_1    2
  ------------------
                                  ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_OTHER_TAUT_1], e, INC_ADD_EDGE ) ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6314:21): [True: 0, False: 0]
  ------------------
 6315|      0|                {
 6316|      0|                    goto exit_case_25;
 6317|      0|                }
 6318|      0|                if (ret = AddToEdgeList( &ChangeableEdges[CHG_SET_OTHER_TAUT_ALL], e, INC_ADD_EDGE ))
  ------------------
  |  | 6271|      0|#define CHG_SET_OTHER_TAUT_ALL  3
  ------------------
                              if (ret = AddToEdgeList( &ChangeableEdges[CHG_SET_OTHER_TAUT_ALL], e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6318:21): [True: 0, False: 0]
  ------------------
 6319|      0|                {
 6320|      0|                    goto exit_case_25;
 6321|      0|                }
 6322|      0|                if (ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e, INC_ADD_EDGE ))
  ------------------
  |  | 6274|      0|#define CHG_SET_AVOID           5
  ------------------
                              if (ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e, INC_ADD_EDGE ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6322:21): [True: 0, False: 0]
  ------------------
 6323|      0|                {
 6324|      0|                    goto exit_case_25;
 6325|      0|                }
 6326|      0|            }
 6327|      0|            else
 6328|      0|            {
 6329|      0|                if (at2[iat].valence == 1 && at2[iat].charge == -1 &&
  ------------------
  |  Branch (6329:21): [True: 0, False: 0]
  |  Branch (6329:46): [True: 0, False: 0]
  ------------------
 6330|      0|                     pVA[iat].cNumValenceElectrons == 6 &&
  ------------------
  |  Branch (6330:22): [True: 0, False: 0]
  ------------------
 6331|      0|                     pVA[iN = at2[iat].neighbor[0]].cNumValenceElectrons == 5 && /* -O(-) */
  ------------------
  |  Branch (6331:22): [True: 0, False: 0]
  ------------------
 6332|      0|                     !pStruct->endpoint[nAtno2CanonRevrs[iN]] &&
  ------------------
  |  Branch (6332:22): [True: 0, False: 0]
  ------------------
 6333|      0|                     at2[iN].valence == 3 && at2[iN].chem_bonds_valence == 3 &&
  ------------------
  |  Branch (6333:22): [True: 0, False: 0]
  |  Branch (6333:46): [True: 0, False: 0]
  ------------------
 6334|      0|                     !at2[iN].charge && !at2[iN].radical &&
  ------------------
  |  Branch (6334:22): [True: 0, False: 0]
  |  Branch (6334:41): [True: 0, False: 0]
  ------------------
 6335|      0|                     0 <= ( e = pVA[iN].nCPlusGroupEdge - 1 ) && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (6335:22): [True: 0, False: 0]
  |  Branch (6335:66): [True: 0, False: 0]
  ------------------
 6336|      0|                     pBNS->edge[e].flow && /* NPlus edge */
  ------------------
  |  Branch (6336:22): [True: 0, False: 0]
  ------------------
 6337|      0|                     0 <= ( e1 = pVA[iat].nCMinusGroupEdge - 1 ) && !pBNS->edge[e1].forbidden &&
  ------------------
  |  Branch (6337:22): [True: 0, False: 0]
  |  Branch (6337:69): [True: 0, False: 0]
  ------------------
 6338|      0|                     pBNS->edge[e1].flow &&  /* OMinus edge */
  ------------------
  |  Branch (6338:22): [True: 0, False: 0]
  ------------------
 6339|      0|                     0 > FindInEdgeList( &ChangeableEdges[CHG_SET_AVOID], e ) &&
  ------------------
  |  | 6274|      0|#define CHG_SET_AVOID           5
  ------------------
  |  Branch (6339:22): [True: 0, False: 0]
  ------------------
 6340|      0|                     0 > FindInEdgeList( &ChangeableEdges[CHG_SET_AVOID], e1 ))
  ------------------
  |  | 6274|      0|#define CHG_SET_AVOID           5
  ------------------
  |  Branch (6340:22): [True: 0, False: 0]
  ------------------
 6341|      0|                {
 6342|       |                    /* found >N-O(-) */
 6343|      0|                    int nNumO = 0, nNumOthers = 0;
 6344|      0|                    for (k = 0; k < at2[iN].valence; k++)
  ------------------
  |  Branch (6344:33): [True: 0, False: 0]
  ------------------
 6345|      0|                    {
 6346|      0|                        neigh = at2[iN].neighbor[k];
 6347|      0|                        if (neigh == iat)
  ------------------
  |  Branch (6347:29): [True: 0, False: 0]
  ------------------
 6348|      0|                        {
 6349|      0|                            continue;
 6350|      0|                        }
 6351|      0|                        if (pVA[neigh].cNumValenceElectrons == 6 &&
  ------------------
  |  Branch (6351:29): [True: 0, False: 0]
  ------------------
 6352|      0|                             !pStruct->endpoint[neigh] &&
  ------------------
  |  Branch (6352:30): [True: 0, False: 0]
  ------------------
 6353|      0|                             at2[neigh].valence == 1 && at2[neigh].num_H == 0 &&
  ------------------
  |  Branch (6353:30): [True: 0, False: 0]
  |  Branch (6353:57): [True: 0, False: 0]
  ------------------
 6354|      0|                             at2[neigh].radical == 0 && at2[neigh].charge == -1 &&
  ------------------
  |  Branch (6354:30): [True: 0, False: 0]
  |  Branch (6354:57): [True: 0, False: 0]
  ------------------
 6355|      0|                             at2[neigh].chem_bonds_valence == 1)
  ------------------
  |  Branch (6355:30): [True: 0, False: 0]
  ------------------
 6356|      0|                        {
 6357|      0|                            nNumO++;
 6358|      0|                        }
 6359|      0|                        else
 6360|      0|                        {
 6361|      0|                            if (at2[iN].bond_type[k] == BOND_TYPE_SINGLE &&
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (6361:33): [True: 0, False: 0]
  ------------------
 6362|      0|                                 at2[neigh].valence > 1 &&
  ------------------
  |  Branch (6362:34): [True: 0, False: 0]
  ------------------
 6363|      0|                                 at2[neigh].valence < at2[neigh].chem_bonds_valence)
  ------------------
  |  Branch (6363:34): [True: 0, False: 0]
  ------------------
 6364|      0|                            {
 6365|      0|                                nNumOthers++;
 6366|      0|                            }
 6367|      0|                        }
 6368|      0|                    }
 6369|      0|                    if (nNumO != 1 && nNumOthers != 1)
  ------------------
  |  Branch (6369:25): [True: 0, False: 0]
  |  Branch (6369:39): [True: 0, False: 0]
  ------------------
 6370|      0|                    {
 6371|      0|                        continue;
 6372|      0|                    }
 6373|       |                    /* save charge edges: NPlus first, OMinus second */
 6374|      0|                    if (( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NO_IN_NO2M2], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  | 6273|      0|#define CHG_SET_NO_IN_NO2M2     4
  ------------------
                                  if (( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NO_IN_NO2M2], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6374:25): [True: 0, False: 0]
  ------------------
 6375|      0|                        ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NO_IN_NO2M2], e1, INC_ADD_EDGE ) ) ||
  ------------------
  |  | 6273|      0|#define CHG_SET_NO_IN_NO2M2     4
  ------------------
                                      ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_NO_IN_NO2M2], e1, INC_ADD_EDGE ) ) ||
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6375:25): [True: 0, False: 0]
  ------------------
 6376|      0|                         ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  | 6274|      0|#define CHG_SET_AVOID           5
  ------------------
                                       ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e, INC_ADD_EDGE ) ) ||
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6376:26): [True: 0, False: 0]
  ------------------
 6377|      0|                         ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e1, INC_ADD_EDGE ) ))
  ------------------
  |  | 6274|      0|#define CHG_SET_AVOID           5
  ------------------
                                       ( ret = AddToEdgeList( &ChangeableEdges[CHG_SET_AVOID], e1, INC_ADD_EDGE ) ))
  ------------------
  |  |   46|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (6377:26): [True: 0, False: 0]
  ------------------
 6378|      0|                    {
 6379|      0|                        goto exit_case_25;
 6380|      0|                    }
 6381|      0|                }
 6382|      0|            }
 6383|      0|        }
 6384|      0|        if (!ChangeableEdges[CHG_SET_NO_IN_NO2M2].num_edges ||
  ------------------
  |  | 6273|      0|#define CHG_SET_NO_IN_NO2M2     4
  ------------------
  |  Branch (6384:13): [True: 0, False: 0]
  ------------------
 6385|      0|             !ChangeableEdges[CHG_SET_OTHER_TAUT_ALL].num_edges)
  ------------------
  |  | 6271|      0|#define CHG_SET_OTHER_TAUT_ALL  3
  ------------------
  |  Branch (6385:14): [True: 0, False: 0]
  ------------------
 6386|      0|        {
 6387|      0|            goto exit_case_25;
 6388|      0|        }
 6389|       |        /* ------- finally, try to move charges from -NO2(2-) or to tautomeric endpoints ----*/
 6390|      0|        for (i = 0; i < ChangeableEdges[CHG_SET_NO_IN_NO2M2].num_edges; i += 2)
  ------------------
  |  | 6273|      0|#define CHG_SET_NO_IN_NO2M2     4
  ------------------
  |  Branch (6390:21): [True: 0, False: 0]
  ------------------
 6391|      0|        {
 6392|      0|            int nDeltaChargeExpected = 3;
 6393|       |            /* change flow on O(-) to make it neutral; 3 new charges will be created:
 6394|       |            N(+), and two (-) on InChI endpoints
 6395|       |            alternatively, if we change flow on N to make N(+) then O(-) will
 6396|       |            be nutralized (-1 charge) and two (-) charges on taut. endpoints will be
 6397|       |            created (+2); the total change in this case would be (-1)+(+2) = +1
 6398|       |            */
 6399|      0|            one_success = 0;
 6400|      0|            delta = 1;
 6401|      0|            pe = pBNS->edge + ChangeableEdges[CHG_SET_NO_IN_NO2M2].pnEdges[i + 1]; /* O(-) edge */
  ------------------
  |  | 6273|      0|#define CHG_SET_NO_IN_NO2M2     4
  ------------------
 6402|      0|            pef = pBNS->edge + ChangeableEdges[CHG_SET_NO_IN_NO2M2].pnEdges[i]; /* >N- (+) edge */
  ------------------
  |  | 6273|      0|#define CHG_SET_NO_IN_NO2M2     4
  ------------------
 6403|       |
 6404|      0|            if (!pe->flow)
  ------------------
  |  Branch (6404:17): [True: 0, False: 0]
  ------------------
 6405|      0|                continue;
 6406|      0|            pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 6407|      0|            pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 6408|       |
 6409|      0|            pe->flow -= delta;
 6410|      0|            pv1->st_edge.flow -= delta;
 6411|      0|            pv2->st_edge.flow -= delta;
 6412|      0|            pBNS->tot_st_flow -= 2 * delta;
 6413|       |
 6414|      0|            for (k = 0; !one_success && k <= CHG_LAST_SET; k++)
  ------------------
  |  | 6272|      0|#define CHG_LAST_SET            3 /* the last index in trying */
  ------------------
  |  Branch (6414:25): [True: 0, False: 0]
  |  Branch (6414:41): [True: 0, False: 0]
  ------------------
 6415|      0|            {
 6416|      0|                if (!ChangeableEdges[k].num_edges)
  ------------------
  |  Branch (6416:21): [True: 0, False: 0]
  ------------------
 6417|      0|                {
 6418|      0|                    continue;
 6419|      0|                }
 6420|      0|                SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 6421|      0|                RemoveForbiddenEdgeMask( pBNS, &ChangeableEdges[k], forbidden_edge_mask );
 6422|       |                /* allow change of N(V) flower edge */
 6423|      0|                pef->forbidden &= forbidden_edge_mask_inv;
 6424|       |
 6425|      0|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 6426|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 6427|       |
 6428|      0|                if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (6428:21): [True: 0, False: 0]
  |  Branch (6428:35): [True: 0, False: 0]
  |  Branch (6428:53): [True: 0, False: 0]
  ------------------
 6429|      0|                                  vPathEnd == v2 && vPathStart == v1 ) &&
  ------------------
  |  Branch (6429:35): [True: 0, False: 0]
  |  Branch (6429:53): [True: 0, False: 0]
  ------------------
 6430|      0|                     nDeltaCharge == nDeltaChargeExpected)
  ------------------
  |  Branch (6430:22): [True: 0, False: 0]
  ------------------
 6431|      0|                {
 6432|       |                    /* Move (-) charge to =O and remove it an endpoint => nDeltaCharge == 0 */
 6433|      0|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 6434|      0|                    if (ret > 0)
  ------------------
  |  Branch (6434:25): [True: 0, False: 0]
  ------------------
 6435|      0|                    {
 6436|      0|                        nNumRunBNS++;
 6437|      0|                        one_success++; /* 24 */
 6438|      0|                    }
 6439|      0|                }
 6440|      0|                INCHI_HEAPCHK
 6441|      0|            }
 6442|      0|            cur_success += one_success;
 6443|       |
 6444|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 6445|       |
 6446|      0|            if (!one_success)
  ------------------
  |  Branch (6446:17): [True: 0, False: 0]
  ------------------
 6447|      0|            {
 6448|      0|                pe->flow += delta;
 6449|      0|                pv1->st_edge.flow += delta;
 6450|      0|                pv2->st_edge.flow += delta;
 6451|      0|                pBNS->tot_st_flow += 2 * delta;
 6452|      0|            }
 6453|      0|        }
 6454|      0|    exit_case_25:
 6455|      0|        for (i = 0; i < CHG_SET_NUM; i++)
  ------------------
  |  | 6275|      0|#define CHG_SET_NUM             6
  ------------------
  |  Branch (6455:21): [True: 0, False: 0]
  ------------------
 6456|      0|        {
 6457|      0|            AllocEdgeList( &ChangeableEdges[i], EDGE_LIST_FREE );
  ------------------
  |  |  271|      0|#define EDGE_LIST_FREE   (-2)
  ------------------
 6458|      0|        }
 6459|       |
 6460|      0|        CurrEdges.num_edges = 0; /* clear current edge list */
 6461|      0|        if (cur_success)
  ------------------
  |  Branch (6461:13): [True: 0, False: 0]
  ------------------
 6462|      0|        {
 6463|      0|            tot_succes += cur_success;
 6464|       |            /* recalculate InChI from the structure */
 6465|      0|            if (0 >( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (6465:17): [True: 0, False: 0]
  ------------------
 6466|      0|                                                           ppt_group_info, ppat_norm, ppat_prep ) ))
 6467|      0|            {
 6468|      0|                goto exit_function;
 6469|      0|            }
 6470|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (6470:17): [True: 0, False: 0]
  ------------------
 6471|      0|            {
 6472|      0|                goto exit_function;
 6473|      0|            }
 6474|      0|            if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (6474:17): [True: 0, False: 0]
  |  Branch (6474:45): [True: 0, False: 0]
  ------------------
 6475|      0|            {
 6476|      0|                goto exit_function;  /* no fixed-H found */
 6477|      0|            }
 6478|      0|            if (ret = FillOutCMP2FHINCHI( pStruct, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (6478:17): [True: 0, False: 0]
  ------------------
 6479|      0|            {
 6480|      0|                goto exit_function;
 6481|      0|            }
 6482|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (6482:17): [True: 0, False: 0]
  ------------------
 6483|      0|            {
 6484|      0|                goto exit_function; /* nothing to do */
 6485|      0|            }
 6486|      0|        }
 6487|      0|#undef CHG_SET_NN
 6488|      0|#undef CHG_SET_MISSED_TAUT
 6489|      0|#undef CHG_SET_OTHER_TAUT_O
 6490|      0|#undef CHG_SET_OTHER_TAUT_N
 6491|      0|#undef CHG_LAST_SET
 6492|      0|#undef CHG_SET_AVOID
 6493|      0|#undef CHG_SET_NUM
 6494|      0|    }
 6495|       |
 6496|       |
 6497|      2|exit_function:
 6498|       |
 6499|      2|    AllocEdgeList( &AllChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|      2|#define EDGE_LIST_FREE   (-2)
  ------------------
 6500|      2|    AllocEdgeList( &CurrEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|      2|#define EDGE_LIST_FREE   (-2)
  ------------------
 6501|      2|    AllocEdgeList( &NFlowerEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|      2|#define EDGE_LIST_FREE   (-2)
  ------------------
 6502|      2|    AllocEdgeList( &SFlowerEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|      2|#define EDGE_LIST_FREE   (-2)
  ------------------
 6503|      2|    AllocEdgeList( &OtherNFlowerEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|      2|#define EDGE_LIST_FREE   (-2)
  ------------------
 6504|      2|    AllocEdgeList( &FixedLargeRingStereoEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|      2|#define EDGE_LIST_FREE   (-2)
  ------------------
 6505|      2|    AllocEdgeList( &AllBondEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|      2|#define EDGE_LIST_FREE   (-2)
  ------------------
 6506|       |
 6507|      2|    return ret < 0 ? ret : ( pc2i->bHasDifference && tot_succes );
  ------------------
  |  Branch (6507:12): [True: 0, False: 2]
  |  Branch (6507:30): [True: 1, False: 1]
  |  Branch (6507:54): [True: 0, False: 1]
  ------------------
 6508|      1|}

ForbidCarbonChargeEdges:
   54|    801|{
   55|    801|#define MAX_NUM_CARBON_CHARGE_EDGES 2
   56|    801|    int nType, i, k, ret;
   57|    801|    BNS_EDGE   *pEdge;
   58|    801|    if (ret = AllocEdgeList( pCarbonChargeEdges, MAX_NUM_CARBON_CHARGE_EDGES ))
  ------------------
  |  |   55|    801|#define MAX_NUM_CARBON_CHARGE_EDGES 2
  ------------------
  |  Branch (58:9): [True: 0, False: 801]
  ------------------
   59|      0|    {
   60|      0|        goto exit_function;
   61|      0|    }
   62|    801|    pCarbonChargeEdges->num_edges = 0;
   63|  2.40k|    for (i = 0; i < MAX_NUM_CARBON_CHARGE_EDGES; i++)
  ------------------
  |  |   55|  2.40k|#define MAX_NUM_CARBON_CHARGE_EDGES 2
  ------------------
  |  Branch (63:17): [True: 1.60k, False: 801]
  ------------------
   64|  1.60k|    {
   65|  1.60k|        switch (i)
   66|  1.60k|        {
   67|    801|            case 0:
  ------------------
  |  Branch (67:13): [True: 801, False: 801]
  ------------------
   68|    801|                nType = TCG_Plus_C0;
   69|    801|                break;
   70|    801|            case 1:
  ------------------
  |  Branch (70:13): [True: 801, False: 801]
  ------------------
   71|    801|                nType = TCG_Minus_C0;
   72|    801|                break;
   73|      0|            default:
  ------------------
  |  Branch (73:13): [True: 0, False: 1.60k]
  ------------------
   74|      0|                ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
   75|      0|                goto exit_function;
   76|  1.60k|        }
   77|  1.60k|        if (( k = pTCGroups->nGroup[nType] ) >= 0)
  ------------------
  |  Branch (77:13): [True: 6, False: 1.59k]
  ------------------
   78|      6|        {
   79|      6|            k = pTCGroups->pTCG[k].nForwardEdge;
   80|      6|            if (k > 0)
  ------------------
  |  Branch (80:17): [True: 6, False: 0]
  ------------------
   81|      6|            {
   82|      6|                pEdge = pBNS->edge + k;
   83|      6|                if (!( pEdge->forbidden & forbidden_edge_mask ))
  ------------------
  |  Branch (83:21): [True: 6, False: 0]
  ------------------
   84|      6|                {
   85|      6|                    pEdge->forbidden |= forbidden_edge_mask;
   86|      6|                    if (ret = AddToEdgeList( pCarbonChargeEdges, k, 0 ))
  ------------------
  |  Branch (86:25): [True: 0, False: 6]
  ------------------
   87|      0|                    {
   88|      0|                        goto exit_function;
   89|      0|                    }
   90|      6|                }
   91|      6|            }
   92|      0|            else
   93|      0|            {
   94|      0|                ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
   95|      0|                goto exit_function;
   96|      0|            }
   97|      6|        }
   98|  1.60k|    }
   99|    801|    ret = pCarbonChargeEdges->num_edges;
  100|       |
  101|    801|exit_function:
  102|       |
  103|    801|    return ret;
  104|    801|#undef MAX_NUM_CARBON_CHARGE_EDGES
  105|    801|}
ForbidNintrogenPlus2BondsInSmallRings:
  117|  1.60k|{
  118|  1.60k|    int i, j, ret;
  119|  1.60k|    BNS_EDGE   *e;
  120|       |
  121|  1.60k|    ret = 0;
  122|       |        /* --- forbid edges that allow to make =N(+)= or #N(+)- in small ring */
  123|  8.92k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (123:17): [True: 7.31k, False: 1.60k]
  ------------------
  124|  7.31k|    {
  125|  7.31k|        if (at[i].valence == 2 &&
  ------------------
  |  Branch (125:13): [True: 18, False: 7.30k]
  ------------------
  126|  7.31k|             !at[i].num_H && !at[i].endpoint &&
  ------------------
  |  Branch (126:14): [True: 18, False: 0]
  |  Branch (126:30): [True: 18, False: 0]
  ------------------
  127|  7.31k|             pVA[i].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (127:14): [True: 2, False: 16]
  ------------------
  128|  7.31k|             pVA[i].cPeriodicRowNumber == 1 &&
  ------------------
  |  Branch (128:14): [True: 2, False: 0]
  ------------------
  129|  7.31k|             !pVA[i].cMaxFlowToMetal && pVA[i].nCPlusGroupEdge > 0 &&
  ------------------
  |  Branch (129:14): [True: 2, False: 0]
  |  Branch (129:41): [True: 2, False: 0]
  ------------------
  130|  7.31k|             pVA[i].cnListIndex > 0 && cnList[pVA[i].cnListIndex - 1].bits == cn_bits_MNP &&
  ------------------
  |  |  455|      2|#define cn_bits_MNP  MAKE_CN_BITS(cn_bits_M, cn_bits_N, cn_bits_P, 0)
  |  |  ------------------
  |  |  |  |  449|  7.32k|#define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  |  |  ------------------
  |  |  |  |  |  |  447|      2|#define cn_bits_shift 3
  |  |  |  |  ------------------
  |  |  |  |               #define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  |  |  ------------------
  |  |  |  |  |  |  447|      2|#define cn_bits_shift 3
  |  |  |  |  ------------------
  |  |  |  |               #define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  |  |  ------------------
  |  |  |  |  |  |  447|      2|#define cn_bits_shift 3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (130:14): [True: 2, False: 0]
  |  Branch (130:40): [True: 2, False: 0]
  ------------------
  131|  7.31k|             pVA[i].cMinRingSize && pVA[i].cMinRingSize <= min_ring_size)
  ------------------
  |  Branch (131:14): [True: 0, False: 2]
  |  Branch (131:37): [True: 0, False: 0]
  ------------------
  132|      0|        {
  133|       |
  134|      0|            e = pBNS->edge + ( j = pVA[i].nCPlusGroupEdge - 1 );
  135|      0|            if (!( e->forbidden & forbidden_edge_mask ))
  ------------------
  |  Branch (135:17): [True: 0, False: 0]
  ------------------
  136|      0|            {
  137|      0|                e->forbidden |= forbidden_edge_mask;
  138|      0|                if (ret = AddToEdgeList( pNplus2BondsEdges, j, 128 ))
  ------------------
  |  Branch (138:21): [True: 0, False: 0]
  ------------------
  139|      0|                {
  140|      0|                    goto exit_function;
  141|      0|                }
  142|      0|            }
  143|      0|        }
  144|  7.31k|    }
  145|  1.60k|    ret = 0;
  146|       |
  147|  1.60k|exit_function:
  148|       |
  149|  1.60k|    return ret;
  150|  1.60k|}
FixMoreHydrogenInFormula:
  403|      2|{
  404|      2|    int iNH = NO_VERTEX, neigh, neigh2;
  ------------------
  |  |  146|      2|#define NO_VERTEX    -2
  ------------------
  405|      2|    EDGE_LIST NewlyFixedEdges;
  406|      2|    int ret, i, j, k, k2 = 0, delta;
  407|      2|    int num_at = pStruct->num_atoms;
  408|      2|    int inv_forbidden_edge_mask = ~forbidden_edge_mask;
  409|      2|    Vertex v1, v2;
  410|       |    /* for RunBnsTestOnce */
  411|      2|    Vertex     vPathStart, vPathEnd;
  412|      2|    int        nPathLen, nDeltaH, nDeltaCharge, nNumVisitedAtoms;
  413|      2|    BNS_EDGE *pe, *pe2;
  414|       |
  415|      2|    AllocEdgeList( &NewlyFixedEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      2|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  416|      2|    if (ret = AllocEdgeList( &NewlyFixedEdges, 2 * num_at ))
  ------------------
  |  Branch (416:9): [True: 0, False: 2]
  ------------------
  417|      0|    {
  418|      0|        goto exit_function;
  419|      0|    }
  420|       |    /* fix all charges */
  421|     12|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (421:17): [True: 10, False: 2]
  ------------------
  422|     10|    {
  423|     10|        if (( j = pVA[i].nCMinusGroupEdge - 1 ) >= 0)
  ------------------
  |  Branch (423:13): [True: 7, False: 3]
  ------------------
  424|      7|        {
  425|      7|            if (ret = AddToEdgeList( &NewlyFixedEdges, j, 0 ))
  ------------------
  |  Branch (425:17): [True: 0, False: 7]
  ------------------
  426|      0|            {
  427|      0|                goto exit_function;
  428|      0|            }
  429|      7|            pBNS->edge[j].forbidden |= forbidden_edge_mask;
  430|      7|        }
  431|     10|        if (( j = pVA[i].nCPlusGroupEdge - 1 ) >= 0)
  ------------------
  |  Branch (431:13): [True: 10, False: 0]
  ------------------
  432|     10|        {
  433|     10|            if (ret = AddToEdgeList( &NewlyFixedEdges, j, 0 ))
  ------------------
  |  Branch (433:17): [True: 0, False: 10]
  ------------------
  434|      0|            {
  435|      0|                goto exit_function;
  436|      0|            }
  437|     10|            pBNS->edge[j].forbidden |= forbidden_edge_mask;
  438|     10|        }
  439|     10|    }
  440|       |
  441|       |    /* H(+) has been added to -O(-); check non-tautomeric atoms */
  442|     12|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (442:17): [True: 10, False: 2]
  ------------------
  443|     10|    {
  444|     10|        if (!( pStruct->bMobileH ? at2[i].endpoint : pStruct->endpoint[i] ) && !pVA[i].cMetal &&
  ------------------
  |  Branch (444:13): [True: 10, False: 0]
  |  Branch (444:16): [True: 5, False: 5]
  |  Branch (444:80): [True: 10, False: 0]
  ------------------
  445|     10|             at2[i].num_H + 1 == atf[i].num_H &&      /* normalization added H ??? What would happen in Fixed-H case?*/
  ------------------
  |  Branch (445:14): [True: 2, False: 8]
  ------------------
  446|     10|             ( k = pVA[i].nCMinusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (446:14): [True: 2, False: 0]
  ------------------
  447|     10|             pBNS->edge[k].flow == 1 &&               /* atom had (-) charge before preprocessing */
  ------------------
  |  Branch (447:14): [True: 2, False: 0]
  ------------------
  448|     10|             at2[i].charge == -1 && atf[i].charge == 0 && /* and has no charge after preprocessing */
  ------------------
  |  Branch (448:14): [True: 2, False: 0]
  |  Branch (448:37): [True: 2, False: 0]
  ------------------
  449|     10|             at2[i].valence == 1 && at2[i].chem_bonds_valence == 1 && /* connected by a single bond */
  ------------------
  |  Branch (449:14): [True: 2, False: 0]
  |  Branch (449:37): [True: 2, False: 0]
  ------------------
  450|     10|             pVA[i].cNumValenceElectrons == 6 &&     /* atom is O, S, Se, Te */
  ------------------
  |  Branch (450:14): [True: 2, False: 0]
  ------------------
  451|     10|             at2[neigh = at2[i].neighbor[0]].chem_bonds_valence > at2[neigh].valence
  ------------------
  |  Branch (451:14): [True: 0, False: 2]
  ------------------
  452|       |             /* atom's single neighbor has multiple bond(s)*/
  453|     10|            )
  454|      0|        {
  455|       |            /* H(+) was added to O in Y=X-O(-), where X is the only neighbor of O, X=neigh, Y=neigh2 */
  456|      0|            iNH = i;
  457|      0|            for (j = 0; j < at2[neigh].valence; j++)
  ------------------
  |  Branch (457:25): [True: 0, False: 0]
  ------------------
  458|      0|            {
  459|      0|                neigh2 = at2[neigh].neighbor[j];
  460|      0|                if (neigh2 != iNH && !at2[neigh2].endpoint &&
  ------------------
  |  Branch (460:21): [True: 0, False: 0]
  |  Branch (460:38): [True: 0, False: 0]
  ------------------
  461|      0|                     !pBNS->edge[(int) pBNS->vert[neigh].iedge[j]].forbidden &&
  ------------------
  |  Branch (461:22): [True: 0, False: 0]
  ------------------
  462|      0|                     4 <= pVA[neigh2].cNumValenceElectrons &&
  ------------------
  |  Branch (462:22): [True: 0, False: 0]
  ------------------
  463|      0|                          pVA[neigh2].cNumValenceElectrons <= 5 && /* neig2 is C or N */
  ------------------
  |  Branch (463:27): [True: 0, False: 0]
  ------------------
  464|      0|                          ( k2 = pVA[neigh2].nCMinusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (464:27): [True: 0, False: 0]
  ------------------
  465|      0|                     !pBNS->edge[k2].flow /* negative charge may be moved to neigh2 */)
  ------------------
  |  Branch (465:22): [True: 0, False: 0]
  ------------------
  466|      0|                {
  467|      0|                    break;
  468|      0|                }
  469|      0|            }
  470|      0|            if (j < at2[neigh].valence)
  ------------------
  |  Branch (470:17): [True: 0, False: 0]
  ------------------
  471|      0|            {
  472|      0|                delta = 1;
  473|      0|                pe = pBNS->edge + k;  /* -O(-) negative charge edge; flow = 1 */
  474|      0|                pe2 = pBNS->edge + k2; /* X charge edge; flow = 0 */
  475|      0|                v1 = pe->neighbor1;
  476|      0|                v2 = pe->neighbor12 ^ v1;
  477|      0|                pe->flow -= delta;
  478|      0|                pBNS->vert[v1].st_edge.flow -= delta;
  479|      0|                pBNS->vert[v2].st_edge.flow -= delta;
  480|      0|                pBNS->tot_st_flow -= 2 * delta;
  481|      0|                pe2->forbidden &= inv_forbidden_edge_mask; /* allow the charge to move */
  482|       |
  483|      0|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
  484|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
  485|      0|                if (ret < 0)
  ------------------
  |  Branch (485:21): [True: 0, False: 0]
  ------------------
  486|      0|                {
  487|      0|                    goto exit_function;
  488|      0|                }
  489|      0|                if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (489:21): [True: 0, False: 0]
  |  Branch (489:35): [True: 0, False: 0]
  |  Branch (489:53): [True: 0, False: 0]
  ------------------
  490|      0|                    vPathEnd == v2 && vPathStart == v1 ) &&
  ------------------
  |  Branch (490:21): [True: 0, False: 0]
  |  Branch (490:39): [True: 0, False: 0]
  ------------------
  491|      0|                                  nDeltaCharge <= 1)
  ------------------
  |  Branch (491:35): [True: 0, False: 0]
  ------------------
  492|      0|                {
  493|      0|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
  494|      0|                    ( *pnNumRunBNS )++;
  495|      0|                    if (ret < 0)
  ------------------
  |  Branch (495:25): [True: 0, False: 0]
  ------------------
  496|      0|                    {
  497|      0|                        goto exit_function;
  498|      0|                    }
  499|      0|                    else
  500|      0|                        if (ret)
  ------------------
  |  Branch (500:29): [True: 0, False: 0]
  ------------------
  501|      0|                        {
  502|      0|                            *pnTotalDelta += ret;
  503|      0|                        }
  504|      0|                        else
  505|      0|                        {
  506|      0|                            ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  507|      0|                        }
  508|      0|                    break;
  509|      0|                }
  510|      0|                else
  511|      0|                {
  512|       |                             /* the attempt has failed; restore the flow */
  513|      0|                    ret = 0;
  514|      0|                    pe->flow += delta;
  515|      0|                    pBNS->vert[v1].st_edge.flow += delta;
  516|      0|                    pBNS->vert[v2].st_edge.flow += delta;
  517|      0|                    pBNS->tot_st_flow += 2 * delta;
  518|      0|                }
  519|      0|            }
  520|      0|        }
  521|     10|    }
  522|       |
  523|      2|exit_function:
  524|       |    /* remove bond fixation */
  525|      2|    RemoveForbiddenEdgeMask( pBNS, &NewlyFixedEdges, forbidden_edge_mask );
  526|      2|    AllocEdgeList( &NewlyFixedEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|      2|#define EDGE_LIST_FREE   (-2)
  ------------------
  527|       |
  528|      2|    return ret;
  529|      2|}
FixRemoveExtraTautEndpoints:
  594|      2|{
  595|      2|    EDGE_LIST NewlyFixedEdges;
  596|      2|    int ret, i, j, k, delta, centerpoint, endpoint1, endpoint2;
  597|      2|    int num_at = pStruct->num_atoms;
  598|      2|    int inv_forbidden_edge_mask = ~forbidden_edge_mask;
  599|      2|    Vertex v1, v2;
  600|       |    /* for RunBnsTestOnce */
  601|      2|    Vertex     vPathStart, vPathEnd;
  602|      2|    int        nPathLen, nDeltaH, nDeltaCharge, nNumVisitedAtoms;
  603|      2|    BNS_EDGE *pe, *pe2;
  604|       |
  605|      2|    ret = 0;
  606|       |
  607|      2|    AllocEdgeList( &NewlyFixedEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      2|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  608|      2|    if (ret = AllocEdgeList( &NewlyFixedEdges, 2 * num_at ))
  ------------------
  |  Branch (608:9): [True: 0, False: 2]
  ------------------
  609|      0|    {
  610|      0|        goto exit_function;
  611|      0|    }
  612|       |    /* fix all charges */
  613|     12|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (613:17): [True: 10, False: 2]
  ------------------
  614|     10|    {
  615|     10|        if (( j = pVA[i].nCMinusGroupEdge - 1 ) >= 0)
  ------------------
  |  Branch (615:13): [True: 7, False: 3]
  ------------------
  616|      7|        {
  617|      7|            if (ret = AddToEdgeList( &NewlyFixedEdges, j, 0 ))
  ------------------
  |  Branch (617:17): [True: 0, False: 7]
  ------------------
  618|      0|            {
  619|      0|                goto exit_function;
  620|      0|            }
  621|      7|            pBNS->edge[j].forbidden |= forbidden_edge_mask;
  622|      7|        }
  623|     10|        if (( j = pVA[i].nCPlusGroupEdge - 1 ) >= 0)
  ------------------
  |  Branch (623:13): [True: 10, False: 0]
  ------------------
  624|     10|        {
  625|     10|            if (ret = AddToEdgeList( &NewlyFixedEdges, j, 0 ))
  ------------------
  |  Branch (625:17): [True: 0, False: 10]
  ------------------
  626|      0|            {
  627|      0|                goto exit_function;
  628|      0|            }
  629|     10|            pBNS->edge[j].forbidden |= forbidden_edge_mask;
  630|     10|        }
  631|     10|    }
  632|       |
  633|      6|    for (i = 0; i < picr->num_endp_in1_only; i++)
  ------------------
  |  Branch (633:17): [True: 4, False: 2]
  ------------------
  634|      4|    {
  635|      4|        endpoint1 = picr->endp_in1_only[i] - 1;
  636|      4|        if (at2[endpoint1].valence == at2[endpoint1].chem_bonds_valence ||
  ------------------
  |  Branch (636:13): [True: 4, False: 0]
  ------------------
  637|      4|             pVA[endpoint1].nCMinusGroupEdge <= 0)
  ------------------
  |  Branch (637:14): [True: 0, False: 0]
  ------------------
  638|      4|        {
  639|      4|            continue;
  640|      4|        }
  641|       |        /* find centerpoint */
  642|      0|        for (j = 0; j < at2[endpoint1].valence; j++)
  ------------------
  |  Branch (642:21): [True: 0, False: 0]
  ------------------
  643|      0|        {
  644|      0|            if (BOND_TYPE_DOUBLE == ( BOND_TYPE_MASK & at2[endpoint1].bond_type[j] ))
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
                          if (BOND_TYPE_DOUBLE == ( BOND_TYPE_MASK & at2[endpoint1].bond_type[j] ))
  ------------------
  |  |  217|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
  |  Branch (644:17): [True: 0, False: 0]
  ------------------
  645|      0|            {
  646|      0|                centerpoint = at2[endpoint1].neighbor[j];
  647|      0|                if (at2[centerpoint].charge || pVA[centerpoint].nCPlusGroupEdge <= 0 ||
  ------------------
  |  Branch (647:21): [True: 0, False: 0]
  |  Branch (647:48): [True: 0, False: 0]
  ------------------
  648|      0|                     !is_centerpoint_elem( at2[centerpoint].el_number ))
  ------------------
  |  Branch (648:22): [True: 0, False: 0]
  ------------------
  649|      0|                {
  650|      0|                    continue;
  651|      0|                }
  652|       |                /* -- the centerpoint as depicted has no ChargeStruct flower ---
  653|       |                m = GetChargeFlowerUpperEdge( pBNS, pVA, pVA[centerpoint].nCPlusGroupEdge-1 );
  654|       |                if ( m < 0 || pBNS->edge[m].flow ) {
  655|       |                    continue;
  656|       |                }
  657|       |                */
  658|       |                /* find 2nd endpoint */
  659|      0|                for (k = 0; k < at2[centerpoint].valence; k++)
  ------------------
  |  Branch (659:29): [True: 0, False: 0]
  ------------------
  660|      0|                {
  661|      0|                    if (BOND_TYPE_SINGLE != ( BOND_TYPE_MASK & at2[centerpoint].bond_type[k] ))
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
                                  if (BOND_TYPE_SINGLE != ( BOND_TYPE_MASK & at2[centerpoint].bond_type[k] ))
  ------------------
  |  |  217|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
  |  Branch (661:25): [True: 0, False: 0]
  ------------------
  662|      0|                    {
  663|      0|                        continue;
  664|      0|                    }
  665|      0|                    endpoint2 = at2[centerpoint].neighbor[k];
  666|      0|                    if (!at2[endpoint2].endpoint && atn[endpoint2].endpoint)
  ------------------
  |  Branch (666:25): [True: 0, False: 0]
  |  Branch (666:53): [True: 0, False: 0]
  ------------------
  667|      0|                    {
  668|      0|                        break;
  669|      0|                    }
  670|      0|                }
  671|      0|                if (k == at2[centerpoint].valence)
  ------------------
  |  Branch (671:21): [True: 0, False: 0]
  ------------------
  672|      0|                {
  673|      0|                    continue;
  674|      0|                }
  675|       |                /* the centerpoint and two extra endpoints have been found */
  676|      0|                pe = pBNS->edge + pVA[centerpoint].nCPlusGroupEdge - 1;
  677|      0|                if (!pe->flow)
  ------------------
  |  Branch (677:21): [True: 0, False: 0]
  ------------------
  678|      0|                {
  679|      0|                    continue;
  680|      0|                }
  681|      0|                pe2 = pBNS->edge + pVA[endpoint1].nCMinusGroupEdge - 1;
  682|      0|                if (pe2->flow)
  ------------------
  |  Branch (682:21): [True: 0, False: 0]
  ------------------
  683|      0|                {
  684|      0|                    continue;
  685|      0|                }
  686|      0|                delta = 1;
  687|      0|                v1 = pe->neighbor1;
  688|      0|                v2 = pe->neighbor12 ^ v1;
  689|      0|                pe->flow -= delta;
  690|      0|                pBNS->vert[v1].st_edge.flow -= delta;
  691|      0|                pBNS->vert[v2].st_edge.flow -= delta;
  692|      0|                pBNS->tot_st_flow -= 2 * delta;
  693|      0|                pe2->forbidden &= inv_forbidden_edge_mask; /* allow the charge to move */
  694|       |
  695|      0|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
  696|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
  697|      0|                if (ret < 0)
  ------------------
  |  Branch (697:21): [True: 0, False: 0]
  ------------------
  698|      0|                {
  699|      0|                    goto exit_function;
  700|      0|                }
  701|      0|                if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (701:21): [True: 0, False: 0]
  |  Branch (701:35): [True: 0, False: 0]
  |  Branch (701:53): [True: 0, False: 0]
  ------------------
  702|      0|                    vPathEnd == v2 && vPathStart == v1 ) &&
  ------------------
  |  Branch (702:21): [True: 0, False: 0]
  |  Branch (702:39): [True: 0, False: 0]
  ------------------
  703|      0|                                  nDeltaCharge <= 1)
  ------------------
  |  Branch (703:35): [True: 0, False: 0]
  ------------------
  704|      0|                {
  705|      0|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
  706|      0|                    ( *pnNumRunBNS )++;
  707|      0|                    if (ret < 0)
  ------------------
  |  Branch (707:25): [True: 0, False: 0]
  ------------------
  708|      0|                    {
  709|      0|                        goto exit_function;
  710|      0|                    }
  711|      0|                    else
  712|      0|                    {
  713|      0|                        if (ret)
  ------------------
  |  Branch (713:29): [True: 0, False: 0]
  ------------------
  714|      0|                        {
  715|      0|                            *pnTotalDelta += ret;
  716|      0|                        }
  717|      0|                        else
  718|      0|                        {
  719|      0|                            ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  720|      0|                        }
  721|      0|                    }
  722|      0|                    goto exit_function;
  723|      0|                }
  724|      0|                else
  725|      0|                {
  726|      0|                    ret = 0;
  727|      0|                    pe->flow += delta;
  728|      0|                    pBNS->vert[v1].st_edge.flow += delta;
  729|      0|                    pBNS->vert[v2].st_edge.flow += delta;
  730|      0|                    pBNS->tot_st_flow += 2 * delta;
  731|      0|                    pe2->forbidden |= forbidden_edge_mask;
  732|      0|                }
  733|      0|            }
  734|      0|        }
  735|      0|    }
  736|       |
  737|      2|exit_function:
  738|       |    /* remove bond fixation */
  739|      2|    RemoveForbiddenEdgeMask( pBNS, &NewlyFixedEdges, forbidden_edge_mask );
  740|      2|    AllocEdgeList( &NewlyFixedEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|      2|#define EDGE_LIST_FREE   (-2)
  ------------------
  741|       |
  742|      2|    return ret;
  743|      2|}
FillOutExtraFixedHDataRestr:
  748|      8|{
  749|      8|    int i, j, k, len, ret = 0;
  750|      8|    AT_NUMB *pNum;
  751|     24|    for (i = 0; i < TAUT_NUM; i++)
  ------------------
  |  |  578|     24|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (751:17): [True: 16, False: 8]
  ------------------
  752|     16|    {
  753|     16|        if (pStruct->pOneINChI_Aux[i])
  ------------------
  |  Branch (753:13): [True: 10, False: 6]
  ------------------
  754|     10|        {
  755|     10|            pNum = ( pStruct->pOneINChI_Aux[i]->nIsotopicOrigAtNosInCanonOrd &&
  ------------------
  |  Branch (755:22): [True: 10, False: 0]
  ------------------
  756|     10|                    pStruct->pOneINChI_Aux[i]->nIsotopicOrigAtNosInCanonOrd[0] ) ?
  ------------------
  |  Branch (756:21): [True: 9, False: 1]
  ------------------
  757|      9|                pStruct->pOneINChI_Aux[i]->nIsotopicOrigAtNosInCanonOrd :
  758|     10|                ( pStruct->pOneINChI_Aux[i]->nOrigAtNosInCanonOrd &&
  ------------------
  |  Branch (758:19): [True: 1, False: 0]
  ------------------
  759|      1|                 pStruct->pOneINChI_Aux[i]->nOrigAtNosInCanonOrd[0] ) ?
  ------------------
  |  Branch (759:18): [True: 1, False: 0]
  ------------------
  760|      1|                pStruct->pOneINChI_Aux[i]->nOrigAtNosInCanonOrd : NULL;
  761|     10|        }
  762|      6|        else
  763|      6|        {
  764|      6|            pNum = NULL;
  765|      6|        }
  766|     16|        if (pNum)
  ------------------
  |  Branch (766:13): [True: 10, False: 6]
  ------------------
  767|     10|        {
  768|     10|            len = pStruct->num_atoms * sizeof( pStruct->nCanon2Atno[0][0] );
  769|     10|            if (!pStruct->nCanon2Atno[i] &&
  ------------------
  |  Branch (769:17): [True: 7, False: 3]
  ------------------
  770|     10|                 !( pStruct->nCanon2Atno[i] = (AT_NUMB *) inchi_malloc( len ) ) ||
  ------------------
  |  | 1130|      7|#define inchi_malloc   malloc
  ------------------
  |  Branch (770:18): [True: 0, False: 7]
  ------------------
  771|     10|                 !pStruct->nAtno2Canon[i] &&
  ------------------
  |  Branch (771:18): [True: 7, False: 3]
  ------------------
  772|     10|                 !( pStruct->nAtno2Canon[i] = (AT_NUMB *) inchi_malloc( len ) ))
  ------------------
  |  | 1130|      7|#define inchi_malloc   malloc
  ------------------
  |  Branch (772:18): [True: 0, False: 7]
  ------------------
  773|      0|            {
  774|      0|                ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
  775|      0|                goto exit_function;
  776|      0|            }
  777|       |
  778|       |            INCHI_HEAPCHK
  779|       |
  780|     10|            memcpy( pStruct->nCanon2Atno[i], pNum, len ); /* ??? the next for(...) fills it out */
  781|       |
  782|       |            INCHI_HEAPCHK
  783|       |
  784|    261|            for (j = 0; j < pStruct->num_atoms; j++)
  ------------------
  |  Branch (784:25): [True: 251, False: 10]
  ------------------
  785|    251|            {
  786|    251|                k = pNum[j] - 1; /* atom number */
  787|    251|                pStruct->nCanon2Atno[i][j] = (AT_NUMB) k;
  788|    251|                pStruct->nAtno2Canon[i][k] = (AT_NUMB) j;
  789|    251|                INCHI_HEAPCHK
  790|    251|            }
  791|     10|        }
  792|      6|        else
  793|      6|        {
  794|      6|            if (!i)
  ------------------
  |  Branch (794:17): [True: 0, False: 6]
  ------------------
  795|      0|            {
  796|      0|                ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  797|      0|                goto exit_function;
  798|      0|            }
  799|      6|            else
  800|      6|            {
  801|      6|                if (pStruct->nCanon2Atno[i])
  ------------------
  |  Branch (801:21): [True: 0, False: 6]
  ------------------
  802|      0|                {
  803|      0|                    inchi_free( pStruct->nCanon2Atno[i] );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  804|      0|                    pStruct->nCanon2Atno[i] = NULL;
  805|      0|                }
  806|      6|                INCHI_HEAPCHK
  807|      6|                if (pStruct->nAtno2Canon[i])
  ------------------
  |  Branch (807:21): [True: 0, False: 6]
  ------------------
  808|      0|                {
  809|      0|                    inchi_free( pStruct->nAtno2Canon[i] );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  810|      0|                    pStruct->nAtno2Canon[i] = NULL;
  811|      0|                }
  812|      6|                INCHI_HEAPCHK
  813|      6|            }
  814|      6|        }
  815|     16|    }
  816|       |
  817|      8|exit_function:
  818|       |
  819|      8|    return ret;
  820|      8|}
FillOutExtraFixedHDataInChI:
  825|      5|{
  826|      5|    int ret = 0;
  827|       |    /*--- allocate memory for Mobile/Fixed-H data from the input InChI ---*/
  828|      5|    if (NULL == pStruct->endpoint)
  ------------------
  |  Branch (828:9): [True: 0, False: 5]
  ------------------
  829|      0|    {
  830|      0|        pStruct->endpoint = (AT_NUMB *) inchi_calloc( pStruct->num_atoms, sizeof( pStruct->endpoint[0] ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  831|      0|    }
  832|      5|    else
  833|      5|    {
  834|      5|        memset( pStruct->endpoint, 0, pStruct->num_atoms * sizeof( pStruct->endpoint[0] ) );
  835|      5|    }
  836|      5|    if (NULL == pStruct->fixed_H)
  ------------------
  |  Branch (836:9): [True: 5, False: 0]
  ------------------
  837|      5|    {
  838|      5|        pStruct->fixed_H = (S_CHAR *) inchi_malloc( pStruct->num_atoms * sizeof( pStruct->fixed_H[0] ) );
  ------------------
  |  | 1130|      5|#define inchi_malloc   malloc
  ------------------
  839|      5|    }
  840|      5|    if (!pStruct->endpoint || !pStruct->fixed_H)
  ------------------
  |  Branch (840:9): [True: 0, False: 5]
  |  Branch (840:31): [True: 0, False: 5]
  ------------------
  841|      0|    {
  842|      0|        ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
  843|      0|        goto exit_function;
  844|      0|    }
  845|       |    /*--- fill out Mobile/Fixed-H data from the input InChI ---*/
  846|      5|    GetTgroupInfoFromInChI( &pStruct->ti, NULL, pStruct->endpoint, pInChI[1] );
  847|      5|    if (pInChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (847:9): [True: 0, False: 5]
  ------------------
  848|      0|    {
  849|      0|        memcpy( pStruct->fixed_H, pInChI[0]->nNum_H_fixed, pStruct->num_atoms * sizeof( pStruct->fixed_H[0] ) );
  850|      0|    }
  851|      5|    else
  852|      5|    {
  853|      5|        memset( pStruct->fixed_H, 0, pStruct->num_atoms * sizeof( pStruct->fixed_H[0] ) );
  854|      5|    }
  855|       |
  856|      5|exit_function:
  857|       |
  858|      5|    return ret;
  859|      5|}
FillOutCMP2FHINCHI:
  868|      2|{
  869|      2|    int       ret = 0, i, j;
  870|      2|    int       bFixHRevrsExists = pInChI[1] && pInChI[1]->nNumberOfAtoms > 0 && !pInChI[1]->bDeleted;
  ------------------
  |  Branch (870:34): [True: 2, False: 0]
  |  Branch (870:47): [True: 2, False: 0]
  |  Branch (870:80): [True: 2, False: 0]
  ------------------
  871|      2|    inp_ATOM *at_Mobile_H_Revrs = ( pStruct->pOne_norm_data[1] &&
  ------------------
  |  Branch (871:37): [True: 1, False: 1]
  ------------------
  872|      2|                                 pStruct->pOne_norm_data[1]->at ) ? pStruct->pOne_norm_data[1]->at : NULL;
  ------------------
  |  Branch (872:34): [True: 1, False: 0]
  ------------------
  873|      2|    S_CHAR   *num_Fixed_H_Revrs = pStruct->pOneINChI[0]->nNum_H_fixed ? pStruct->pOneINChI[0]->nNum_H_fixed : NULL;
  ------------------
  |  Branch (873:35): [True: 2, False: 0]
  ------------------
  874|       |    /* atom number in structure that produced original InChI is atom number in all inp_ATOM *atoms */
  875|       |    /* atom number in structure that produced restored InChI is in nAtomRevrs[]: */
  876|      2|    AT_NUMB  *nAtno2CanonRevrs = pStruct->nAtno2Canon[0];
  877|      2|    S_CHAR   *pnMobHInChI = ( pInChI[1] && pInChI[1]->nNum_H ) ? pInChI[1]->nNum_H :
  ------------------
  |  Branch (877:31): [True: 2, False: 0]
  |  Branch (877:44): [True: 2, False: 0]
  ------------------
  878|      2|        ( pInChI[0] && pInChI[0]->nNum_H ) ? pInChI[0]->nNum_H : NULL;
  ------------------
  |  Branch (878:11): [True: 0, False: 0]
  |  Branch (878:24): [True: 0, False: 0]
  ------------------
  879|      2|    S_CHAR   *pnMobHRevrs = ( pStruct->pOneINChI[1] && pStruct->pOneINChI[1]->nNum_H ) ?
  ------------------
  |  Branch (879:31): [True: 1, False: 1]
  |  Branch (879:56): [True: 1, False: 0]
  ------------------
  880|      1|        pStruct->pOneINChI[1]->nNum_H :
  881|      2|        ( pStruct->pOneINChI[0] && pStruct->pOneINChI[0]->nNum_H ) ?
  ------------------
  |  Branch (881:11): [True: 1, False: 0]
  |  Branch (881:36): [True: 1, False: 0]
  ------------------
  882|      1|        pStruct->pOneINChI[0]->nNum_H : NULL;
  883|      2|    int     nNumTgHInChI, nNumTgMInChI, nNumTgHRevrs, nNumTgMRevrs;
  884|      2|    memset( pc2i, 0, sizeof( *pc2i ) );
  885|      2|    pc2i->nNumTgInChI = pStruct->ti.num_t_groups;
  886|      2|    pc2i->nNumTgRevrs = pStruct->One_ti.num_t_groups;
  887|      2|    pc2i->bHasDifference |= pc2i->nNumTgInChI != pc2i->nNumTgRevrs;
  888|       |
  889|      2|    pc2i->nNumRemHInChI = pStruct->nNumRemovedProtonsMobHInChI;
  890|      2|    pc2i->nNumRemHRevrs = pStruct->One_ti.tni.nNumRemovedProtons;
  891|      2|    pc2i->bHasDifference |= pc2i->nNumRemHInChI != pc2i->nNumRemHRevrs;
  892|       |
  893|      2|    pc2i->bFixedHLayerExistsRevrs = bFixHRevrsExists;
  894|      2|    pc2i->bHasDifference |= !bFixHRevrsExists;
  895|       |
  896|      2|    for (i = 0; i < pStruct->ti.num_t_groups && i < pStruct->One_ti.num_t_groups; i++)
  ------------------
  |  Branch (896:17): [True: 0, False: 2]
  |  Branch (896:49): [True: 0, False: 0]
  ------------------
  897|      0|    {
  898|      0|        nNumTgHInChI = pStruct->ti.t_group[i].num[0] - pStruct->ti.t_group[i].num[1];
  899|      0|        nNumTgMInChI = pStruct->ti.t_group[i].num[1];
  900|      0|        nNumTgHRevrs = pStruct->One_ti.t_group[i].num[0] - pStruct->One_ti.t_group[i].num[1];
  901|      0|        nNumTgMRevrs = pStruct->One_ti.t_group[i].num[1];
  902|       |
  903|      0|        pc2i->bHasDifference |= nNumTgHInChI != nNumTgHRevrs;
  904|      0|        pc2i->bHasDifference |= nNumTgMInChI != nNumTgMRevrs;
  905|       |
  906|      0|        if (pStruct->ti.t_group[i].nNumEndpoints ==
  ------------------
  |  Branch (906:13): [True: 0, False: 0]
  ------------------
  907|      0|             pStruct->One_ti.t_group[i].nNumEndpoints)
  908|      0|        {
  909|       |
  910|      0|            if (nNumTgHInChI != nNumTgHRevrs)
  ------------------
  |  Branch (910:17): [True: 0, False: 0]
  ------------------
  911|      0|            {
  912|      0|                pc2i->nNumTgDiffH++;
  913|      0|            }
  914|      0|            if (nNumTgMInChI != nNumTgMRevrs)
  ------------------
  |  Branch (914:17): [True: 0, False: 0]
  ------------------
  915|      0|            {
  916|      0|                pc2i->nNumTgDiffMinus++;
  917|      0|            }
  918|      0|        }
  919|      0|        pc2i->bHasDifference |= pStruct->ti.t_group[i].nNumEndpoints !=
  920|      0|            pStruct->One_ti.t_group[i].nNumEndpoints;
  921|       |
  922|      0|        pc2i->nNumTgHInChI += nNumTgHInChI;
  923|      0|        pc2i->nNumTgMInChI += nNumTgMInChI;
  924|      0|        pc2i->nNumTgHRevrs += nNumTgHRevrs;
  925|      0|        pc2i->nNumTgMRevrs += nNumTgMRevrs;
  926|      0|    }
  927|      2|    for (; i < pStruct->ti.num_t_groups; i++)
  ------------------
  |  Branch (927:12): [True: 0, False: 2]
  ------------------
  928|      0|    {
  929|      0|        nNumTgHInChI = pStruct->ti.t_group[i].num[0] - pStruct->ti.t_group[i].num[1];
  930|      0|        nNumTgMInChI = pStruct->ti.t_group[i].num[1];
  931|      0|        pc2i->nNumTgHInChI += nNumTgHInChI;
  932|      0|        pc2i->nNumTgMInChI += nNumTgMInChI;
  933|      0|        pc2i->bHasDifference |= 1;
  934|      0|    }
  935|      3|    for (; i < pStruct->One_ti.num_t_groups; i++)
  ------------------
  |  Branch (935:12): [True: 1, False: 2]
  ------------------
  936|      1|    {
  937|      1|        nNumTgHRevrs = pStruct->One_ti.t_group[i].num[0] - pStruct->One_ti.t_group[i].num[1];
  938|      1|        nNumTgMRevrs = pStruct->One_ti.t_group[i].num[1];
  939|      1|        pc2i->nNumTgHRevrs += nNumTgHRevrs;
  940|      1|        pc2i->nNumTgMRevrs += nNumTgMRevrs;
  941|      1|        pc2i->bHasDifference |= 1;
  942|      1|    }
  943|     12|    for (i = j = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (943:21): [True: 10, False: 2]
  ------------------
  944|     10|    {
  945|       |        /* i = original InChI canonical number - 1 */
  946|       |        /* k = atom number from InChI created out of restored Fixed-H structure */
  947|     10|        int iCanonRevrs = nAtno2CanonRevrs[i];
  948|     10|        int endptInChI = pStruct->endpoint[i]; /* endpoint in InChI */
  949|     10|        int endptRevrs = at_Mobile_H_Revrs ? at_Mobile_H_Revrs[i].endpoint : 0;
  ------------------
  |  Branch (949:26): [True: 5, False: 5]
  ------------------
  950|     10|        int nFixHInChI = pStruct->fixed_H[i];
  951|     10|        int nFixHRevrs = num_Fixed_H_Revrs ? num_Fixed_H_Revrs[iCanonRevrs] : 0;
  ------------------
  |  Branch (951:26): [True: 10, False: 0]
  ------------------
  952|     10|        int nMobHInChI = pnMobHInChI ? pnMobHInChI[i] : 0;
  ------------------
  |  Branch (952:26): [True: 10, False: 0]
  ------------------
  953|     10|        int nMobHRevrs = pnMobHRevrs ? pnMobHRevrs[iCanonRevrs] : 0;
  ------------------
  |  Branch (953:26): [True: 10, False: 0]
  ------------------
  954|     10|        if ( /*(!endptInChI || !endptRevrs) &&*/ ( nFixHInChI != nFixHRevrs ) ||
  ------------------
  |  Branch (954:50): [True: 0, False: 10]
  ------------------
  955|     10|            ( !endptInChI != !endptRevrs ) || nMobHInChI != nMobHRevrs)
  ------------------
  |  Branch (955:13): [True: 2, False: 8]
  |  Branch (955:47): [True: 0, False: 8]
  ------------------
  956|      2|        {
  957|       |            /* in InChI or reversed InChI atom[i] is not tautomeric */
  958|       |            /* and number of fixed-H on the atom[i] differs */
  959|      2|            if (j >= MAX_DIFF_FIXH)
  ------------------
  |  |  484|      2|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (959:17): [True: 0, False: 2]
  ------------------
  960|      0|            {
  961|      0|                ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  962|      0|                goto exit_function;
  963|      0|            }
  964|      2|            pc2i->c2at[j].endptInChI = endptInChI;
  965|      2|            pc2i->c2at[j].endptRevrs = endptRevrs;
  966|      2|            pc2i->bHasDifference |= !endptInChI != !endptRevrs;
  967|      2|            pc2i->c2at[j].atomNumber = i;
  968|      2|            pc2i->c2at[j].nValElectr = pVA[i].cNumValenceElectrons;
  969|      2|            pc2i->c2at[j].nPeriodNum = pVA[i].cPeriodicRowNumber;
  970|      2|            pc2i->c2at[j].nFixHInChI = nFixHInChI;
  971|      2|            pc2i->c2at[j].nFixHRevrs = nFixHRevrs;
  972|      2|            pc2i->bHasDifference |= nFixHInChI != nFixHRevrs;
  973|      2|            pc2i->c2at[j].nMobHInChI = pInChI[1] && pInChI[1]->nNum_H ? pInChI[1]->nNum_H[i] :
  ------------------
  |  Branch (973:40): [True: 2, False: 0]
  |  Branch (973:53): [True: 2, False: 0]
  ------------------
  974|      2|                pInChI[0] && pInChI[0]->nNum_H ? pInChI[0]->nNum_H[i] : 0;
  ------------------
  |  Branch (974:17): [True: 0, False: 0]
  |  Branch (974:30): [True: 0, False: 0]
  ------------------
  975|      2|            pc2i->c2at[j].nMobHRevrs = ( pStruct->pOneINChI[1] && pStruct->pOneINChI[1]->nNum_H ) ?
  ------------------
  |  Branch (975:42): [True: 2, False: 0]
  |  Branch (975:67): [True: 2, False: 0]
  ------------------
  976|      2|                pStruct->pOneINChI[1]->nNum_H[iCanonRevrs] :
  977|      2|                ( pStruct->pOneINChI[0] && pStruct->pOneINChI[0]->nNum_H ) ?
  ------------------
  |  Branch (977:19): [True: 0, False: 0]
  |  Branch (977:44): [True: 0, False: 0]
  ------------------
  978|      0|                pStruct->pOneINChI[0]->nNum_H[iCanonRevrs] : 0;
  979|      2|            pc2i->nNumDiffMobH += ( nMobHInChI != nMobHRevrs && !endptRevrs && !endptInChI );
  ------------------
  |  Branch (979:37): [True: 0, False: 2]
  |  Branch (979:65): [True: 0, False: 0]
  |  Branch (979:80): [True: 0, False: 0]
  ------------------
  980|      2|            pc2i->bHasDifference |= nMobHInChI != nMobHRevrs;
  981|      2|            pc2i->c2at[j].nNumHRevrs = at2[i].num_H;
  982|      2|            pc2i->c2at[j].nAtChargeRevrs = at2[i].charge;
  983|      2|            j++;
  984|      2|        }
  985|     10|        pc2i->nNumEndpInChI += ( endptInChI != 0 );
  986|     10|        pc2i->nNumEndpRevrs += ( endptRevrs != 0 );
  987|       |
  988|     10|        if (!pVA[i].cMetal)
  ------------------
  |  Branch (988:13): [True: 10, False: 0]
  ------------------
  989|     10|        {
  990|     10|            pc2i->nChargeFixHRevrsNonMetal += at2[i].charge;
  991|     10|            pc2i->nChargeMobHRevrsNonMetal += at_Mobile_H_Revrs ? at_Mobile_H_Revrs[i].charge : 0;
  ------------------
  |  Branch (991:47): [True: 5, False: 5]
  ------------------
  992|     10|        }
  993|       |
  994|       |        /*pStruct->bExtract |= EXTRACT_STRUCT_NUMBER;*/
  995|     10|    }
  996|      2|    pc2i->nChargeFixHInChI = pInChI[0] ? pInChI[0]->nTotalCharge : 0;
  ------------------
  |  Branch (996:30): [True: 2, False: 0]
  ------------------
  997|      2|    pc2i->nChargeMobHInChI = pInChI[1] ? pInChI[1]->nTotalCharge : 0;
  ------------------
  |  Branch (997:30): [True: 2, False: 0]
  ------------------
  998|       |
  999|      2|    pc2i->nChargeMobHRevrs = pStruct->pOneINChI[1] ? pStruct->pOneINChI[1]->nTotalCharge :
  ------------------
  |  Branch (999:30): [True: 1, False: 1]
  ------------------
 1000|      2|        pStruct->pOneINChI[0] ? pStruct->pOneINChI[0]->nTotalCharge : 0;
  ------------------
  |  Branch (1000:9): [True: 1, False: 0]
  ------------------
 1001|      2|    pc2i->nChargeFixHRevrs = pStruct->pOneINChI[0] ? pStruct->pOneINChI[0]->nTotalCharge : 0;
  ------------------
  |  Branch (1001:30): [True: 2, False: 0]
  ------------------
 1002|       |
 1003|      2|    pc2i->bHasDifference |= pc2i->nChargeFixHInChI != pc2i->nChargeFixHRevrs;
 1004|      2|    pc2i->bHasDifference |= pc2i->nChargeMobHInChI != pc2i->nChargeMobHRevrs;
 1005|       |
 1006|      2|exit_function:
 1007|      2|    pc2i->len_c2at = j;
 1008|       |
 1009|      2|    return ret;
 1010|      2|}
FillOutCMP2MHINCHI:
 1020|      1|{
 1021|      1|    int       ret = 0, i, j, iat;
 1022|      1|    int       bFixHRevrsExists = pInChI[1] && pInChI[1]->nNumberOfAtoms > 0 && !pInChI[1]->bDeleted;
  ------------------
  |  Branch (1022:34): [True: 0, False: 1]
  |  Branch (1022:47): [True: 0, False: 0]
  |  Branch (1022:80): [True: 0, False: 0]
  ------------------
 1023|      1|    inp_ATOM *at_Mobile_H_Revrs = ( pStruct->pOne_norm_data[0] &&
  ------------------
  |  Branch (1023:37): [True: 1, False: 0]
  ------------------
 1024|      1|                                 pStruct->pOne_norm_data[0]->at ) ? pStruct->pOne_norm_data[0]->at : NULL;
  ------------------
  |  Branch (1024:34): [True: 1, False: 0]
  ------------------
 1025|       |    /* atom number in structure that produced original InChI is atom number in all inp_ATOM *atoms */
 1026|       |    /* atom number in structure that produced restored InChI is in nAtomRevrs[]: */
 1027|      1|    AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 1028|      1|    AT_NUMB  *nAtno2CanonRevrs = pStruct->nAtno2Canon[0];
 1029|      1|    S_CHAR   *pnMobHInChI = ( pInChI[0] && pInChI[0]->nNum_H ) ? pInChI[0]->nNum_H : NULL;
  ------------------
  |  Branch (1029:31): [True: 1, False: 0]
  |  Branch (1029:44): [True: 1, False: 0]
  ------------------
 1030|      1|    S_CHAR   *pnMobHRevrs = ( pStruct->pOneINChI[0] && pStruct->pOneINChI[0]->nNum_H ) ?
  ------------------
  |  Branch (1030:31): [True: 1, False: 0]
  |  Branch (1030:56): [True: 1, False: 0]
  ------------------
 1031|      1|        pStruct->pOneINChI[0]->nNum_H : NULL;
 1032|      1|    int     nNumTgHInChI, nNumTgMInChI, nNumTgHRevrs, nNumTgMRevrs;
 1033|      1|    memset( pc2i, 0, sizeof( *pc2i ) );
 1034|      1|    pc2i->nNumTgInChI = pStruct->ti.num_t_groups;
 1035|      1|    pc2i->nNumTgRevrs = pStruct->One_ti.num_t_groups;
 1036|      1|    pc2i->bHasDifference |= pc2i->nNumTgInChI != pc2i->nNumTgRevrs;
 1037|       |
 1038|      1|    pc2i->nNumRemHInChI = pStruct->nNumRemovedProtonsMobHInChI;
 1039|      1|    pc2i->nNumRemHRevrs = pStruct->One_ti.tni.nNumRemovedProtons;
 1040|       |    /*pc2i->bHasDifference |= pc2i->nNumRemHInChI != pc2i->nNumRemHRevrs;*/
 1041|       |
 1042|      1|    pc2i->bFixedHLayerExistsRevrs = bFixHRevrsExists;
 1043|       |    /*pc2i->bHasDifference |= !bFixHRevrsExists;*/
 1044|       |
 1045|      1|    for (i = 0; i < pStruct->ti.num_t_groups; i++)
  ------------------
  |  Branch (1045:17): [True: 0, False: 1]
  ------------------
 1046|      0|    {
 1047|      0|        int jFst = pStruct->ti.t_group[i].nFirstEndpointAtNoPos;
 1048|      0|        int jNum = pStruct->ti.t_group[i].nNumEndpoints;
 1049|      0|        int is_N, is_O;
 1050|      0|        for (j = 0; j < jNum; j++)
  ------------------
  |  Branch (1050:21): [True: 0, False: 0]
  ------------------
 1051|      0|        {
 1052|      0|            iat = pStruct->ti.nEndpointAtomNumber[jFst + j];
 1053|      0|            is_N = pVA[iat].cNumValenceElectrons == 5 && pVA[iat].cPeriodicRowNumber == 1;
  ------------------
  |  Branch (1053:20): [True: 0, False: 0]
  |  Branch (1053:58): [True: 0, False: 0]
  ------------------
 1054|      0|            is_O = pVA[iat].cNumValenceElectrons == 6;
 1055|      0|            if (is_N + is_O != 1)
  ------------------
  |  Branch (1055:17): [True: 0, False: 0]
  ------------------
 1056|      0|            {
 1057|      0|                return RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 1058|      0|            }
 1059|      0|            pc2i->nNumTgNInChI += is_N;
 1060|      0|            pc2i->nNumTgOInChI += is_O;
 1061|      0|            if (at2[iat].chem_bonds_valence == at2[iat].valence)
  ------------------
  |  Branch (1061:17): [True: 0, False: 0]
  ------------------
 1062|      0|            {
 1063|       |                /* donor */
 1064|      0|                if (is_N)
  ------------------
  |  Branch (1064:21): [True: 0, False: 0]
  ------------------
 1065|      0|                {
 1066|       |                    /* N */
 1067|      0|                    pc2i->nNumTgNHInChI += at2[iat].charge == 0 && at2[iat].num_H == 1;
  ------------------
  |  Branch (1067:44): [True: 0, False: 0]
  |  Branch (1067:68): [True: 0, False: 0]
  ------------------
 1068|      0|                    pc2i->nNumTgNH2InChI += at2[iat].charge == 0 && at2[iat].num_H == 2;
  ------------------
  |  Branch (1068:45): [True: 0, False: 0]
  |  Branch (1068:69): [True: 0, False: 0]
  ------------------
 1069|      0|                    pc2i->nNumTgNMinusInChI += at2[iat].charge == -1 && at2[iat].num_H == 0;
  ------------------
  |  Branch (1069:48): [True: 0, False: 0]
  |  Branch (1069:73): [True: 0, False: 0]
  ------------------
 1070|      0|                    pc2i->nNumTgNHMinusInChI += at2[iat].charge == -1 && at2[iat].num_H == 1;
  ------------------
  |  Branch (1070:49): [True: 0, False: 0]
  |  Branch (1070:74): [True: 0, False: 0]
  ------------------
 1071|      0|                }
 1072|      0|                else
 1073|      0|                {
 1074|       |                             /* O, S, Se, Te */
 1075|      0|                    pc2i->nNumTgOHInChI += at2[iat].charge == 0 && at2[iat].num_H == 1;
  ------------------
  |  Branch (1075:44): [True: 0, False: 0]
  |  Branch (1075:68): [True: 0, False: 0]
  ------------------
 1076|      0|                    pc2i->nNumTgOMinusInChI += at2[iat].charge == -1 && at2[iat].num_H == 0;
  ------------------
  |  Branch (1076:48): [True: 0, False: 0]
  |  Branch (1076:73): [True: 0, False: 0]
  ------------------
 1077|      0|                }
 1078|      0|            }
 1079|      0|            else
 1080|      0|            {
 1081|      0|                if (at2[iat].chem_bonds_valence == at2[iat].valence + 1)
  ------------------
  |  Branch (1081:21): [True: 0, False: 0]
  ------------------
 1082|      0|                {
 1083|       |                    /* donor */
 1084|      0|                    if (is_N)
  ------------------
  |  Branch (1084:25): [True: 0, False: 0]
  ------------------
 1085|      0|                    {
 1086|       |                        /* N */
 1087|      0|                        pc2i->nNumTgDBNHInChI += at2[iat].charge == 0 && at2[iat].num_H == 1;
  ------------------
  |  Branch (1087:50): [True: 0, False: 0]
  |  Branch (1087:74): [True: 0, False: 0]
  ------------------
 1088|      0|                        pc2i->nNumTgDBNMinusInChI += at2[iat].charge == -1 && at2[iat].num_H == 0;
  ------------------
  |  Branch (1088:54): [True: 0, False: 0]
  |  Branch (1088:79): [True: 0, False: 0]
  ------------------
 1089|      0|                        pc2i->nNumTgDBNInChI += at2[iat].charge == 0 && at2[iat].num_H == 0;
  ------------------
  |  Branch (1089:49): [True: 0, False: 0]
  |  Branch (1089:73): [True: 0, False: 0]
  ------------------
 1090|      0|                    }
 1091|      0|                    else
 1092|      0|                    {
 1093|       |                        /* O, S, Se, Te */
 1094|      0|                        pc2i->nNumTgDBOInChI += at2[iat].charge == 0 && at2[iat].num_H == 0;
  ------------------
  |  Branch (1094:49): [True: 0, False: 0]
  |  Branch (1094:73): [True: 0, False: 0]
  ------------------
 1095|      0|                    }
 1096|      0|                }
 1097|      0|            }
 1098|      0|        }
 1099|      0|    }
 1100|      2|    for (i = 0; i < pStruct->One_ti.num_t_groups; i++)
  ------------------
  |  Branch (1100:17): [True: 1, False: 1]
  ------------------
 1101|      1|    {
 1102|      1|        int jFst = pStruct->One_ti.t_group[i].nFirstEndpointAtNoPos;
 1103|      1|        int jNum = pStruct->One_ti.t_group[i].nNumEndpoints;
 1104|      1|        int is_N, is_O;
 1105|      3|        for (j = 0; j < jNum; j++)
  ------------------
  |  Branch (1105:21): [True: 2, False: 1]
  ------------------
 1106|      2|        {
 1107|      2|            iat = nCanon2AtnoRevrs[(int) pStruct->One_ti.nEndpointAtomNumber[jFst + j]];
 1108|      2|            is_N = pVA[iat].cNumValenceElectrons == 5 && pVA[iat].cPeriodicRowNumber == 1;
  ------------------
  |  Branch (1108:20): [True: 0, False: 2]
  |  Branch (1108:58): [True: 0, False: 0]
  ------------------
 1109|      2|            is_O = pVA[iat].cNumValenceElectrons == 6;
 1110|      2|            if (is_N + is_O != 1)
  ------------------
  |  Branch (1110:17): [True: 0, False: 2]
  ------------------
 1111|      0|            {
 1112|      0|                return RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1113|      0|            }
 1114|      2|            pc2i->nNumTgNRevrs += is_N;
 1115|      2|            pc2i->nNumTgORevrs += is_O;
 1116|      2|            if (at2[iat].chem_bonds_valence == at2[iat].valence)
  ------------------
  |  Branch (1116:17): [True: 2, False: 0]
  ------------------
 1117|      2|            {
 1118|       |                /* donor */
 1119|      2|                if (is_N)
  ------------------
  |  Branch (1119:21): [True: 0, False: 2]
  ------------------
 1120|      0|                {
 1121|       |                    /* N */
 1122|      0|                    pc2i->nNumTgNHRevrs += at2[iat].charge == 0 && at2[iat].num_H == 1;
  ------------------
  |  Branch (1122:44): [True: 0, False: 0]
  |  Branch (1122:68): [True: 0, False: 0]
  ------------------
 1123|      0|                    pc2i->nNumTgNH2Revrs += at2[iat].charge == 0 && at2[iat].num_H == 2;
  ------------------
  |  Branch (1123:45): [True: 0, False: 0]
  |  Branch (1123:69): [True: 0, False: 0]
  ------------------
 1124|      0|                    pc2i->nNumTgNMinusRevrs += at2[iat].charge == -1 && at2[iat].num_H == 0;
  ------------------
  |  Branch (1124:48): [True: 0, False: 0]
  |  Branch (1124:73): [True: 0, False: 0]
  ------------------
 1125|      0|                    pc2i->nNumTgNHMinusRevrs += at2[iat].charge == -1 && at2[iat].num_H == 1;
  ------------------
  |  Branch (1125:49): [True: 0, False: 0]
  |  Branch (1125:74): [True: 0, False: 0]
  ------------------
 1126|      0|                }
 1127|      2|                else
 1128|      2|                {
 1129|       |                    /* O, S, Se, Te */
 1130|      2|                    pc2i->nNumTgOHRevrs += at2[iat].charge == 0 && at2[iat].num_H == 1;
  ------------------
  |  Branch (1130:44): [True: 0, False: 2]
  |  Branch (1130:68): [True: 0, False: 0]
  ------------------
 1131|      2|                    pc2i->nNumTgOMinusRevrs += at2[iat].charge == -1 && at2[iat].num_H == 0;
  ------------------
  |  Branch (1131:48): [True: 2, False: 0]
  |  Branch (1131:73): [True: 2, False: 0]
  ------------------
 1132|      2|                }
 1133|      2|            }
 1134|      0|            else
 1135|      0|            {
 1136|      0|                if (at2[iat].chem_bonds_valence == at2[iat].valence + 1)
  ------------------
  |  Branch (1136:21): [True: 0, False: 0]
  ------------------
 1137|      0|                {
 1138|       |                    /* donor */
 1139|      0|                    if (is_N)
  ------------------
  |  Branch (1139:25): [True: 0, False: 0]
  ------------------
 1140|      0|                    {
 1141|       |                        /* N */
 1142|      0|                        pc2i->nNumTgDBNHRevrs += at2[iat].charge == 0 && at2[iat].num_H == 1;
  ------------------
  |  Branch (1142:50): [True: 0, False: 0]
  |  Branch (1142:74): [True: 0, False: 0]
  ------------------
 1143|      0|                        pc2i->nNumTgDBNMinusRevrs += at2[iat].charge == -1 && at2[iat].num_H == 0;
  ------------------
  |  Branch (1143:54): [True: 0, False: 0]
  |  Branch (1143:79): [True: 0, False: 0]
  ------------------
 1144|      0|                        pc2i->nNumTgDBNRevrs += at2[iat].charge == 0 && at2[iat].num_H == 0;
  ------------------
  |  Branch (1144:49): [True: 0, False: 0]
  |  Branch (1144:73): [True: 0, False: 0]
  ------------------
 1145|      0|                    }
 1146|      0|                    else
 1147|      0|                    {
 1148|       |                        /* O, S, Se, Te */
 1149|      0|                        pc2i->nNumTgDBORevrs += at2[iat].charge == 0 && at2[iat].num_H == 0;
  ------------------
  |  Branch (1149:49): [True: 0, False: 0]
  |  Branch (1149:73): [True: 0, False: 0]
  ------------------
 1150|      0|                    }
 1151|      0|                }
 1152|      0|            }
 1153|      2|        }
 1154|      1|    }
 1155|       |
 1156|      1|    for (i = 0; i < pStruct->ti.num_t_groups && i < pStruct->One_ti.num_t_groups; i++)
  ------------------
  |  Branch (1156:17): [True: 0, False: 1]
  |  Branch (1156:49): [True: 0, False: 0]
  ------------------
 1157|      0|    {
 1158|      0|        nNumTgHInChI = pStruct->ti.t_group[i].num[0] - pStruct->ti.t_group[i].num[1];
 1159|      0|        nNumTgMInChI = pStruct->ti.t_group[i].num[1];
 1160|      0|        nNumTgHRevrs = pStruct->One_ti.t_group[i].num[0] - pStruct->One_ti.t_group[i].num[1];
 1161|      0|        nNumTgMRevrs = pStruct->One_ti.t_group[i].num[1];
 1162|       |
 1163|      0|        pc2i->bHasDifference |= nNumTgHInChI != nNumTgHRevrs;
 1164|      0|        pc2i->bHasDifference |= nNumTgMInChI != nNumTgMRevrs;
 1165|       |
 1166|      0|        if (pStruct->ti.t_group[i].nNumEndpoints ==
  ------------------
  |  Branch (1166:13): [True: 0, False: 0]
  ------------------
 1167|      0|             pStruct->One_ti.t_group[i].nNumEndpoints)
 1168|      0|        {
 1169|       |
 1170|      0|            if (nNumTgHInChI != nNumTgHRevrs)
  ------------------
  |  Branch (1170:17): [True: 0, False: 0]
  ------------------
 1171|      0|            {
 1172|      0|                pc2i->nNumTgDiffH++;
 1173|      0|            }
 1174|      0|            if (nNumTgMInChI != nNumTgMRevrs)
  ------------------
  |  Branch (1174:17): [True: 0, False: 0]
  ------------------
 1175|      0|            {
 1176|      0|                pc2i->nNumTgDiffMinus++;
 1177|      0|            }
 1178|      0|        }
 1179|      0|        pc2i->bHasDifference |= pStruct->ti.t_group[i].nNumEndpoints !=
 1180|      0|            pStruct->One_ti.t_group[i].nNumEndpoints;
 1181|       |
 1182|      0|        pc2i->nNumTgHInChI += nNumTgHInChI;
 1183|      0|        pc2i->nNumTgMInChI += nNumTgMInChI;
 1184|      0|        pc2i->nNumTgHRevrs += nNumTgHRevrs;
 1185|      0|        pc2i->nNumTgMRevrs += nNumTgMRevrs;
 1186|      0|    }
 1187|      1|    for (; i < pStruct->ti.num_t_groups; i++)
  ------------------
  |  Branch (1187:12): [True: 0, False: 1]
  ------------------
 1188|      0|    {
 1189|      0|        nNumTgHInChI = pStruct->ti.t_group[i].num[0] - pStruct->ti.t_group[i].num[1];
 1190|      0|        nNumTgMInChI = pStruct->ti.t_group[i].num[1];
 1191|      0|        pc2i->nNumTgHInChI += nNumTgHInChI;
 1192|      0|        pc2i->nNumTgMInChI += nNumTgMInChI;
 1193|      0|        pc2i->bHasDifference |= 1;
 1194|      0|    }
 1195|      2|    for (; i < pStruct->One_ti.num_t_groups; i++)
  ------------------
  |  Branch (1195:12): [True: 1, False: 1]
  ------------------
 1196|      1|    {
 1197|      1|        nNumTgHRevrs = pStruct->One_ti.t_group[i].num[0] - pStruct->One_ti.t_group[i].num[1];
 1198|      1|        nNumTgMRevrs = pStruct->One_ti.t_group[i].num[1];
 1199|      1|        pc2i->nNumTgHRevrs += nNumTgHRevrs;
 1200|      1|        pc2i->nNumTgMRevrs += nNumTgMRevrs;
 1201|      1|        pc2i->bHasDifference |= 1;
 1202|      1|    }
 1203|      6|    for (i = j = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (1203:21): [True: 5, False: 1]
  ------------------
 1204|      5|    {
 1205|       |        /* i = original InChI canonical number - 1 */
 1206|       |        /* k = atom number from InChI created out of restored Fixed-H structure */
 1207|      5|        int iCanonRevrs = nAtno2CanonRevrs[i];
 1208|      5|        int endptInChI = at2[i].endpoint; /* endpoint in InChI */
 1209|      5|        int endptRevrs = at_Mobile_H_Revrs ? at_Mobile_H_Revrs[i].endpoint : 0;
  ------------------
  |  Branch (1209:26): [True: 5, False: 0]
  ------------------
 1210|      5|        int nMobHInChI = pnMobHInChI ? pnMobHInChI[i] : 0;
  ------------------
  |  Branch (1210:26): [True: 5, False: 0]
  ------------------
 1211|      5|        int nMobHRevrs = pnMobHRevrs ? pnMobHRevrs[iCanonRevrs] : 0;
  ------------------
  |  Branch (1211:26): [True: 5, False: 0]
  ------------------
 1212|      5|        if (( !endptInChI != !endptRevrs ) || nMobHInChI != nMobHRevrs)
  ------------------
  |  Branch (1212:13): [True: 2, False: 3]
  |  Branch (1212:47): [True: 0, False: 3]
  ------------------
 1213|      2|        {
 1214|       |            /* in InChI or reversed InChI atom[i] is not tautomeric */
 1215|       |            /* and number of fixed-H on the atom[i] differs */
 1216|      2|            if (j >= MAX_DIFF_FIXH)
  ------------------
  |  |  484|      2|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (1216:17): [True: 0, False: 2]
  ------------------
 1217|      0|            {
 1218|      0|                ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1219|      0|                goto exit_function;
 1220|      0|            }
 1221|      2|            pc2i->c2at[j].endptInChI = endptInChI;
 1222|      2|            pc2i->c2at[j].endptRevrs = endptRevrs;
 1223|      2|            pc2i->bHasDifference |= !endptInChI != !endptRevrs;
 1224|      2|            pc2i->c2at[j].atomNumber = i;
 1225|      2|            pc2i->c2at[j].nValElectr = pVA[i].cNumValenceElectrons;
 1226|      2|            pc2i->c2at[j].nPeriodNum = pVA[i].cPeriodicRowNumber;
 1227|      2|            pc2i->c2at[j].nMobHInChI = pInChI[1] && pInChI[1]->nNum_H ? pInChI[1]->nNum_H[i] :
  ------------------
  |  Branch (1227:40): [True: 0, False: 2]
  |  Branch (1227:53): [True: 0, False: 0]
  ------------------
 1228|      2|                pInChI[0] && pInChI[0]->nNum_H ? pInChI[0]->nNum_H[i] : 0;
  ------------------
  |  Branch (1228:17): [True: 2, False: 0]
  |  Branch (1228:30): [True: 2, False: 0]
  ------------------
 1229|      2|            pc2i->c2at[j].nMobHRevrs = ( pStruct->pOneINChI[1] && pStruct->pOneINChI[1]->nNum_H ) ?
  ------------------
  |  Branch (1229:42): [True: 0, False: 2]
  |  Branch (1229:67): [True: 0, False: 0]
  ------------------
 1230|      0|                pStruct->pOneINChI[1]->nNum_H[iCanonRevrs] :
 1231|      2|                ( pStruct->pOneINChI[0] && pStruct->pOneINChI[0]->nNum_H ) ?
  ------------------
  |  Branch (1231:19): [True: 2, False: 0]
  |  Branch (1231:44): [True: 2, False: 0]
  ------------------
 1232|      2|                pStruct->pOneINChI[0]->nNum_H[iCanonRevrs] : 0;
 1233|       |
 1234|      2|            pc2i->nNumDiffMobH += ( nMobHInChI != nMobHRevrs && !endptRevrs && !endptInChI );
  ------------------
  |  Branch (1234:37): [True: 0, False: 2]
  |  Branch (1234:65): [True: 0, False: 0]
  |  Branch (1234:80): [True: 0, False: 0]
  ------------------
 1235|      2|            pc2i->bHasDifference |= ( nMobHInChI != nMobHRevrs );
 1236|      2|            pc2i->c2at[j].nNumHRevrs = at2[i].num_H;
 1237|      2|            pc2i->c2at[j].nAtChargeRevrs = at2[i].charge;
 1238|      2|            j++;
 1239|      2|        }
 1240|      5|        pc2i->nNumEndpInChI += ( endptInChI != 0 );
 1241|      5|        pc2i->nNumEndpRevrs += ( endptRevrs != 0 );
 1242|       |
 1243|      5|        if (!pVA[i].cMetal)
  ------------------
  |  Branch (1243:13): [True: 5, False: 0]
  ------------------
 1244|      5|        {
 1245|      5|            pc2i->nChargeMobHRevrsNonMetal += ( at_Mobile_H_Revrs && !at_Mobile_H_Revrs[i].endpoint ) ? at_Mobile_H_Revrs[i].charge : 0;
  ------------------
  |  Branch (1245:49): [True: 5, False: 0]
  |  Branch (1245:70): [True: 3, False: 2]
  ------------------
 1246|      5|        }
 1247|       |
 1248|       |
 1249|       |        /*pStruct->bExtract |= EXTRACT_STRUCT_NUMBER;*/
 1250|      5|    }
 1251|      1|    pc2i->nChargeMobHRevrsNonMetal += pTCGroups->tgroup_charge;
 1252|       |
 1253|      1|    pc2i->nChargeMobHInChI = pInChI[0] ? pInChI[0]->nTotalCharge : 0;
  ------------------
  |  Branch (1253:30): [True: 1, False: 0]
  ------------------
 1254|       |
 1255|      1|    pc2i->nChargeMobHRevrs = pStruct->pOneINChI[0] ? pStruct->pOneINChI[0]->nTotalCharge : 0;
  ------------------
  |  Branch (1255:30): [True: 1, False: 0]
  ------------------
 1256|       |
 1257|      1|    pc2i->bHasDifference |= pc2i->nChargeMobHInChI != pc2i->nChargeMobHRevrs;
 1258|       |
 1259|      1|exit_function:
 1260|      1|    pc2i->len_c2at = j;
 1261|       |
 1262|      1|    return ret;
 1263|      1|}
NormalizeAndCompare:
 1286|    801|{
 1287|    801|    int i;
 1288|    801|    int err;
 1289|    801|    ICR icr, icr2;
 1290|    801|    int num_norm_endpoints, num_endpoints, num_norm_t_groups, num_mobile, num_norm_mobile, ret = 0;
 1291|       |#if ( bRELEASE_VERSION == 0 )
 1292|       |#ifndef TARGET_API_LIB
 1293|       |    const char *szCurHdr = ( ip->pSdfValue && ip->pSdfValue[0] ) ? ip->pSdfValue : "???";
 1294|       |    int         iComponent = pTCGroups->iComponent;
 1295|       |#endif
 1296|       |#endif
 1297|    801|    T_GROUP_INFO *t_group_info = NULL;
 1298|    801|    inp_ATOM     *at_norm = NULL; /* normalized */
 1299|    801|    inp_ATOM     *at_prep = NULL; /* preprocessed */
 1300|    801|    INCHI_MODE  cmpInChI, cmpInChI2;
 1301|    801|    int         nDeltaPrev, nDeltaCur;
 1302|    801|    int         iOrigInChI, iRevrInChI;
 1303|       |
 1304|       |
 1305|       |    /***********************************************************/
 1306|       |    /* normalize and create one component InChI                */
 1307|       |    /***********************************************************/
 1308|    801|    ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
 1309|    801|                                          &t_group_info, &at_norm, &at_prep );
 1310|    801|    if (ret < 0)
  ------------------
  |  Branch (1310:9): [True: 0, False: 801]
  ------------------
 1311|      0|    {
 1312|       |#if ( bRELEASE_VERSION == 0 )
 1313|       |#ifndef TARGET_API_LIB
 1314|       |        fprintf( stdout, "\nERROR in MakeOneInchi-1: %ld %s Comp:%d %c%c Err:%d\n", num_inp,
 1315|       |                 szCurHdr ? szCurHdr : "???", iComponent, pStruct->iInchiRec ? 'R' : 'D', pStruct->iMobileH ? 'M' : 'F', ret );
 1316|       |#endif
 1317|       |#endif
 1318|      0|        goto exit_function;
 1319|      0|    }
 1320|    801|    if (pStruct->bMobileH == TAUT_NON)
  ------------------
  |  |  579|    801|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1320:9): [True: 5, False: 796]
  ------------------
 1321|      5|    {
 1322|       |/* these indexes are used to compare Mobile-H InChI */
 1323|      5|        iOrigInChI = ( pInChI[1] && pInChI[1]->nNumberOfAtoms && !pInChI[1]->bDeleted ) ? 1 : 0;
  ------------------
  |  Branch (1323:24): [True: 5, False: 0]
  |  Branch (1323:37): [True: 5, False: 0]
  |  Branch (1323:66): [True: 5, False: 0]
  ------------------
 1324|      5|        iRevrInChI = ( pStruct->pOneINChI[1] && pStruct->pOneINChI[1]->nNumberOfAtoms && !pStruct->pOneINChI[1]->bDeleted ) ? 1 : 0;
  ------------------
  |  Branch (1324:24): [True: 1, False: 4]
  |  Branch (1324:49): [True: 1, False: 0]
  |  Branch (1324:90): [True: 1, False: 0]
  ------------------
 1325|      5|    }
 1326|    796|    else
 1327|    796|    {
 1328|    796|        iOrigInChI = 0;
 1329|    796|        iRevrInChI = 0;
 1330|    796|    }
 1331|       |    
 1332|       |    /* Intercept and correct non-polymer Zz to Zy if applicable */
 1333|    801|    if (pStruct->n_zy && pStruct->n_pzz)
  ------------------
  |  Branch (1333:9): [True: 0, False: 801]
  |  Branch (1333:26): [True: 0, False: 0]
  ------------------
 1334|      0|    {
 1335|      0|        if (pStruct->pOneINChI[iRevrInChI]->szHillFormula)
  ------------------
  |  Branch (1335:13): [True: 0, False: 0]
  ------------------
 1336|      0|        {
 1337|      0|            INCHI_IOS_STRING temp_string_container;
 1338|      0|            INCHI_IOS_STRING *strbuf = &temp_string_container;
 1339|      0|            int len0 = strlen(pStruct->pOneINChI[iRevrInChI]->szHillFormula);
 1340|      0|            if (inchi_strbuf_init(strbuf, len0+1, len0+1) > 0)
  ------------------
  |  Branch (1340:17): [True: 0, False: 0]
  ------------------
 1341|      0|            {
 1342|      0|                inchi_strbuf_printf(strbuf, "%-s", pStruct->pOneINChI[iRevrInChI]->szHillFormula);
 1343|      0|            }
 1344|      0|            MergeZzInHillFormula(strbuf);
 1345|      0|            if (strbuf->nUsedLength>len0+1)
  ------------------
  |  Branch (1345:17): [True: 0, False: 0]
  ------------------
 1346|      0|            {
 1347|      0|                pStruct->pOneINChI[iRevrInChI]->szHillFormula = (char *) realloc(pStruct->pOneINChI[iRevrInChI]->szHillFormula, strbuf->nUsedLength+1);
 1348|      0|            }
 1349|      0|            strcpy(pStruct->pOneINChI[iRevrInChI]->szHillFormula, strbuf->pStr);
 1350|      0|            inchi_strbuf_close(strbuf);
 1351|      0|        }
 1352|      0|    }
 1353|       |
 1354|       |
 1355|       |    /************************************************************/
 1356|       |    /* compare                                                  */
 1357|       |    /************************************************************/
 1358|    801|    if (pStruct->iMobileH == TAUT_NON && ( ret = FillOutExtraFixedHDataRestr( pStruct ) ))
  ------------------
  |  |  579|  1.60k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1358:9): [True: 5, False: 796]
  |  Branch (1358:42): [True: 0, False: 5]
  ------------------
 1359|      0|    {
 1360|      0|        goto exit_function;
 1361|      0|    }
 1362|    801|    cmpInChI = CompareReversedINChI2( pStruct->pOneINChI[iRevrInChI], pInChI[iOrigInChI], pStruct->pOneINChI_Aux[iRevrInChI], NULL /*INChI_Aux *a2*/, &icr, &err );
 1363|    801|    if (cmpInChI & IDIF_PROBLEM)
  ------------------
  |  Branch (1363:9): [True: 798, False: 3]
  ------------------
 1364|    798|    {
 1365|    798|        ret = RI_ERR_PROGR; /* severe restore problem */
  ------------------
  |  |   45|    798|#define RI_ERR_PROGR   (-3)
  ------------------
 1366|    798|        goto exit_function;
 1367|    798|    }
 1368|      3|    if (err)
  ------------------
  |  Branch (1368:9): [True: 0, False: 3]
  ------------------
 1369|      0|    {
 1370|      0|        ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 1371|      0|        goto exit_function;
 1372|      0|    }
 1373|       |    /********** InChI from restored structure has LESS hydrogen atoms ******************************/
 1374|      3|    if (( cmpInChI & IDIF_LESS_H ) && at_prep && 0 < ( nDeltaCur = icr.tot_num_H2 - icr.tot_num_H1 ))
  ------------------
  |  Branch (1374:9): [True: 0, False: 3]
  |  Branch (1374:39): [True: 0, False: 0]
  |  Branch (1374:50): [True: 0, False: 0]
  ------------------
 1375|      0|    {
 1376|      0|        do
 1377|      0|        {
 1378|      0|            ret = FixLessHydrogenInFormula( pBNS, pBD, pStruct, at, at2, at_prep, pVA, pTCGroups,
 1379|      0|                                             pnNumRunBNS, pnTotalDelta, forbidden_edge_mask );
 1380|      0|            if (ret < 0)
  ------------------
  |  Branch (1380:17): [True: 0, False: 0]
  ------------------
 1381|      0|            {
 1382|      0|                goto exit_function;
 1383|      0|            }
 1384|      0|            if (ret)
  ------------------
  |  Branch (1384:17): [True: 0, False: 0]
  ------------------
 1385|      0|            {
 1386|       |                /* Probably success. The changes are in pBNS. Create new InChI out of the new restored structure */
 1387|      0|                ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
 1388|      0|                                                      &t_group_info, &at_norm, &at_prep );
 1389|      0|                if (ret < 0)
  ------------------
  |  Branch (1389:21): [True: 0, False: 0]
  ------------------
 1390|      0|                {
 1391|       |#if ( bRELEASE_VERSION == 0 )
 1392|       |#ifndef TARGET_API_LIB
 1393|       |                    fprintf( stdout, "\nERROR in MakeOneInchi-2: %ld %s Comp:%d %c%c Err:%d\n", num_inp,
 1394|       |                             szCurHdr ? szCurHdr : "???", iComponent, pStruct->iInchiRec ? 'R' : 'D', pStruct->iMobileH ? 'M' : 'F', ret );
 1395|       |#endif
 1396|       |#endif
 1397|      0|                    goto exit_function;
 1398|      0|                }
 1399|       |                /* compare new InChI to the original InChI */
 1400|      0|                if (pStruct->bMobileH == TAUT_NON)
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1400:21): [True: 0, False: 0]
  ------------------
 1401|      0|                {
 1402|      0|                    iRevrInChI = ( pStruct->pOneINChI[1] && pStruct->pOneINChI[1]->nNumberOfAtoms && !pStruct->pOneINChI[1]->bDeleted ) ? 1 : 0;
  ------------------
  |  Branch (1402:36): [True: 0, False: 0]
  |  Branch (1402:61): [True: 0, False: 0]
  |  Branch (1402:102): [True: 0, False: 0]
  ------------------
 1403|      0|                }
 1404|      0|                else
 1405|      0|                {
 1406|      0|                    iRevrInChI = 0;
 1407|      0|                }
 1408|      0|                if (pStruct->iMobileH == TAUT_NON && ( ret = FillOutExtraFixedHDataRestr( pStruct ) ))
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1408:21): [True: 0, False: 0]
  |  Branch (1408:54): [True: 0, False: 0]
  ------------------
 1409|      0|                {
 1410|      0|                    goto exit_function;
 1411|      0|                }
 1412|      0|                cmpInChI = CompareReversedINChI2( pStruct->pOneINChI[iRevrInChI], pInChI[iOrigInChI], pStruct->pOneINChI_Aux[iRevrInChI], NULL, &icr, &err );
 1413|      0|                nDeltaPrev = nDeltaCur;
 1414|      0|                nDeltaCur = icr.tot_num_H2 - icr.tot_num_H1;
 1415|      0|            }
 1416|      0|            else
 1417|      0|            {
 1418|      0|                break;
 1419|      0|            }
 1420|      0|        }
 1421|      0|        while (( cmpInChI & IDIF_LESS_H ) && at_prep && nDeltaCur && nDeltaCur < nDeltaPrev);
  ------------------
  |  Branch (1421:16): [True: 0, False: 0]
  |  Branch (1421:46): [True: 0, False: 0]
  |  Branch (1421:57): [True: 0, False: 0]
  |  Branch (1421:70): [True: 0, False: 0]
  ------------------
 1422|      0|    }
 1423|       |    /********** InChI from restored structure has MORE hydrogen atoms ******************************/
 1424|      3|    if (( cmpInChI & IDIF_MORE_H ) && at_prep && 0 < ( nDeltaCur = icr.tot_num_H1 - icr.tot_num_H2 ))
  ------------------
  |  Branch (1424:9): [True: 2, False: 1]
  |  Branch (1424:39): [True: 2, False: 0]
  |  Branch (1424:50): [True: 2, False: 0]
  ------------------
 1425|      2|    {
 1426|      2|        do
 1427|      2|        {
 1428|      2|            ret = FixMoreHydrogenInFormula( pBNS, pBD, pStruct, at, at2, at_prep, pVA, pTCGroups,
 1429|      2|                                             pnNumRunBNS, pnTotalDelta, forbidden_edge_mask );
 1430|      2|            if (ret < 0)
  ------------------
  |  Branch (1430:17): [True: 0, False: 2]
  ------------------
 1431|      0|            {
 1432|      0|                goto exit_function;
 1433|      0|            }
 1434|      2|            if (ret)
  ------------------
  |  Branch (1434:17): [True: 0, False: 2]
  ------------------
 1435|      0|            {
 1436|       |                /* Probably success. The changes are in pBNS. Create new InChI out of the new restored structure */
 1437|      0|                ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
 1438|      0|                                                      &t_group_info, &at_norm, &at_prep );
 1439|      0|                if (ret < 0)
  ------------------
  |  Branch (1439:21): [True: 0, False: 0]
  ------------------
 1440|      0|                {
 1441|       |#if ( bRELEASE_VERSION == 0 )
 1442|       |#ifndef TARGET_API_LIB
 1443|       |                    fprintf( stdout, "\nERROR in MakeOneInchi-3: %ld %s Comp:%d %c%c Err:%d\n", num_inp,
 1444|       |                             szCurHdr ? szCurHdr : "???", iComponent, pStruct->iInchiRec ? 'R' : 'D', pStruct->iMobileH ? 'M' : 'F', ret );
 1445|       |#endif
 1446|       |#endif
 1447|      0|                    goto exit_function;
 1448|      0|                }
 1449|       |                /* compare new InChI to the original InChI */
 1450|      0|                if (pStruct->bMobileH == TAUT_NON)
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1450:21): [True: 0, False: 0]
  ------------------
 1451|      0|                {
 1452|      0|                    iRevrInChI = ( pStruct->pOneINChI[1] && pStruct->pOneINChI[1]->nNumberOfAtoms && !pStruct->pOneINChI[1]->bDeleted ) ? 1 : 0;
  ------------------
  |  Branch (1452:36): [True: 0, False: 0]
  |  Branch (1452:61): [True: 0, False: 0]
  |  Branch (1452:102): [True: 0, False: 0]
  ------------------
 1453|      0|                }
 1454|      0|                else
 1455|      0|                {
 1456|      0|                    iRevrInChI = 0;
 1457|      0|                }
 1458|      0|                if (pStruct->iMobileH == TAUT_NON && ( ret = FillOutExtraFixedHDataRestr( pStruct ) ))
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1458:21): [True: 0, False: 0]
  |  Branch (1458:54): [True: 0, False: 0]
  ------------------
 1459|      0|                {
 1460|      0|                    goto exit_function;
 1461|      0|                }
 1462|      0|                cmpInChI = CompareReversedINChI2( pStruct->pOneINChI[iRevrInChI], pInChI[iOrigInChI], pStruct->pOneINChI_Aux[iRevrInChI], NULL, &icr, &err );
 1463|      0|                nDeltaPrev = nDeltaCur;
 1464|      0|                nDeltaCur = icr.tot_num_H1 - icr.tot_num_H2;
 1465|      0|            }
 1466|      2|            else
 1467|      2|            {
 1468|      2|                break;
 1469|      2|            }
 1470|      2|        }
 1471|      2|        while (( cmpInChI & IDIF_MORE_H ) && at_prep && nDeltaCur && nDeltaCur < nDeltaPrev);
  ------------------
  |  Branch (1471:16): [True: 0, False: 0]
  |  Branch (1471:46): [True: 0, False: 0]
  |  Branch (1471:57): [True: 0, False: 0]
  |  Branch (1471:70): [True: 0, False: 0]
  ------------------
 1472|      2|    }
 1473|       |    /***************** Fix non-taut atoms normalized to tautomeric endpoints ***********************/
 1474|      3|    if (( cmpInChI & IDIF_EXTRA_TG_ENDP ) && at_norm && 0 < ( nDeltaCur = icr.num_endp_in1_only ))
  ------------------
  |  Branch (1474:9): [True: 2, False: 1]
  |  Branch (1474:46): [True: 2, False: 0]
  |  Branch (1474:57): [True: 2, False: 0]
  ------------------
 1475|      2|    {
 1476|      2|        do
 1477|      2|        {
 1478|      2|            ret = FixRemoveExtraTautEndpoints( pBNS, pBD, pStruct, at, at2, at_prep, at_norm, pVA, pTCGroups, &icr,
 1479|      2|                                               pnNumRunBNS, pnTotalDelta, forbidden_edge_mask );
 1480|      2|            if (ret < 0)
  ------------------
  |  Branch (1480:17): [True: 0, False: 2]
  ------------------
 1481|      0|            {
 1482|      0|                goto exit_function;
 1483|      0|            }
 1484|      2|            if (ret)
  ------------------
  |  Branch (1484:17): [True: 0, False: 2]
  ------------------
 1485|      0|            {
 1486|       |                /* Probably success. The changes are in pBNS. Create new InChI out of the new restored structure */
 1487|      0|                ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
 1488|      0|                                                      &t_group_info, &at_norm, &at_prep );
 1489|      0|                if (ret < 0)
  ------------------
  |  Branch (1489:21): [True: 0, False: 0]
  ------------------
 1490|      0|                {
 1491|       |#if ( bRELEASE_VERSION == 0 )
 1492|       |#ifndef TARGET_API_LIB
 1493|       |                    fprintf( stdout, "\nERROR in MakeOneInchi-4: %ld %s Comp:%d %c%c Err:%d\n", num_inp,
 1494|       |                             szCurHdr ? szCurHdr : "???", iComponent, pStruct->iInchiRec ? 'R' : 'D', pStruct->iMobileH ? 'M' : 'F', ret );
 1495|       |#endif
 1496|       |#endif
 1497|      0|                    goto exit_function;
 1498|      0|                }
 1499|       |                /* compare new InChI to the original InChI */
 1500|      0|                if (pStruct->bMobileH == TAUT_NON)
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1500:21): [True: 0, False: 0]
  ------------------
 1501|      0|                {
 1502|      0|                    iRevrInChI = ( pStruct->pOneINChI[1] && pStruct->pOneINChI[1]->nNumberOfAtoms && !pStruct->pOneINChI[1]->bDeleted ) ? 1 : 0;
  ------------------
  |  Branch (1502:36): [True: 0, False: 0]
  |  Branch (1502:61): [True: 0, False: 0]
  |  Branch (1502:102): [True: 0, False: 0]
  ------------------
 1503|      0|                }
 1504|      0|                else
 1505|      0|                {
 1506|      0|                    iRevrInChI = 0;
 1507|      0|                }
 1508|      0|                if (pStruct->iMobileH == TAUT_NON && ( ret = FillOutExtraFixedHDataRestr( pStruct ) ))
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1508:21): [True: 0, False: 0]
  |  Branch (1508:54): [True: 0, False: 0]
  ------------------
 1509|      0|                {
 1510|      0|                    goto exit_function;
 1511|      0|                }
 1512|      0|                cmpInChI = CompareReversedINChI2( pStruct->pOneINChI[iRevrInChI], pInChI[iOrigInChI], pStruct->pOneINChI_Aux[iRevrInChI], NULL, &icr, &err );
 1513|      0|                nDeltaPrev = nDeltaCur;
 1514|      0|                nDeltaCur = icr.num_endp_in1_only;
 1515|      0|            }
 1516|      2|            else
 1517|      2|            {
 1518|      2|                break;
 1519|      2|            }
 1520|      2|        }
 1521|      2|        while (( cmpInChI & IDIF_EXTRA_TG_ENDP ) && at_norm && nDeltaCur && nDeltaCur < nDeltaPrev);
  ------------------
  |  Branch (1521:16): [True: 0, False: 0]
  |  Branch (1521:53): [True: 0, False: 0]
  |  Branch (1521:64): [True: 0, False: 0]
  |  Branch (1521:77): [True: 0, False: 0]
  ------------------
 1522|      2|    }
 1523|       |    /************************ case of Fixed-H ******************************************************/
 1524|       |
 1525|      3|    if (pStruct->bMobileH == TAUT_NON)
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1525:9): [True: 2, False: 1]
  ------------------
 1526|      2|    {
 1527|      2|        int num_tries = 0;
 1528|      2|        do
 1529|      2|        {
 1530|      2|            if (0 > ( ret = FixFixedHRestoredStructure( pCG, ic, ip, sd, pBNS, pBD, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (1530:17): [True: 0, False: 2]
  ------------------
 1531|      2|                &t_group_info, &at_norm, &at_prep, pInChI,
 1532|      2|                num_inp, bHasSomeFixedH, pnNumRunBNS, pnTotalDelta, forbidden_edge_mask,
 1533|      2|                forbidden_stereo_edge_mask ) ))
 1534|      0|            {
 1535|      0|                goto exit_function;
 1536|      0|            }
 1537|      2|        }
 1538|      2|        while (num_tries++ < 2 && ret > 0);
  ------------------
  |  Branch (1538:16): [True: 2, False: 0]
  |  Branch (1538:35): [True: 0, False: 2]
  ------------------
 1539|      2|    }
 1540|       |    /************************ case of Fixed-H ******************************************************/
 1541|      3|    if (pStruct->bMobileH == TAUT_YES)
  ------------------
  |  |  580|      3|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1541:9): [True: 1, False: 2]
  ------------------
 1542|      1|    {
 1543|      1|        if (0 > ( ret = FixMobileHRestoredStructure( pCG, ic, ip, sd, pBNS, pBD, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (1543:13): [True: 0, False: 1]
  ------------------
 1544|      1|            &t_group_info, &at_norm, &at_prep, pInChI,
 1545|      1|            num_inp, bHasSomeFixedH, pnNumRunBNS, pnTotalDelta, forbidden_edge_mask,
 1546|      1|            forbidden_stereo_edge_mask ) ))
 1547|      0|        {
 1548|      0|            goto exit_function;
 1549|      0|        }
 1550|      1|    }
 1551|       |    /**********************************************************************************************/
 1552|       |    /* stereo */
 1553|      3|    cmpInChI = CompareReversedINChI2( pStruct->pOneINChI[0], pInChI[0], pStruct->pOneINChI_Aux[0], NULL /*INChI_Aux *a2*/, &icr, &err );
 1554|      3|    if (cmpInChI & IDIF_PROBLEM)
  ------------------
  |  Branch (1554:9): [True: 0, False: 3]
  ------------------
 1555|      0|    {
 1556|      0|        ret = RI_ERR_PROGR; /* severe restore problem */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1557|      0|        goto exit_function;
 1558|      0|    }
 1559|      3|    if (err)
  ------------------
  |  Branch (1559:9): [True: 0, False: 3]
  ------------------
 1560|      0|    {
 1561|      0|        ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 1562|      0|        goto exit_function;
 1563|      0|    }
 1564|      3|    cmpInChI2 = 0;
 1565|      3|    memset( &icr2, 0, sizeof( icr2 ) );
 1566|      3|    if (iRevrInChI || iOrigInChI)
  ------------------
  |  Branch (1566:9): [True: 1, False: 2]
  |  Branch (1566:23): [True: 1, False: 1]
  ------------------
 1567|      2|    {
 1568|       |        /* additional mobile-H compare in case of Fixed-H */
 1569|      2|        cmpInChI2 = CompareReversedINChI2( pStruct->pOneINChI[iRevrInChI], pInChI[iOrigInChI], pStruct->pOneINChI_Aux[iRevrInChI], NULL /*INChI_Aux *a2*/, &icr2, &err );
 1570|      2|        if (cmpInChI & IDIF_PROBLEM)
  ------------------
  |  Branch (1570:13): [True: 0, False: 2]
  ------------------
 1571|      0|        {
 1572|      0|            ret = RI_ERR_PROGR; /* severe restore problem */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1573|      0|            goto exit_function;
 1574|      0|        }
 1575|      2|        if (err)
  ------------------
  |  Branch (1575:13): [True: 0, False: 2]
  ------------------
 1576|      0|        {
 1577|      0|            ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 1578|      0|            goto exit_function;
 1579|      0|        }
 1580|      2|    }
 1581|      3|    ret = FixRestoredStructureStereo( pCG, ic,
 1582|      3|                                      cmpInChI, &icr, cmpInChI2, &icr2,
 1583|      3|                                      ip, sd, pBNS, pBD, pStruct, at, at2, at3, pVA, pTCGroups,
 1584|      3|                                      &t_group_info, &at_norm, &at_prep, pInChI,
 1585|      3|                                      num_inp, pnNumRunBNS, pnTotalDelta, forbidden_edge_mask,
 1586|      3|                                      forbidden_stereo_edge_mask );
 1587|       |
 1588|      3|    if (ret < 0)
  ------------------
  |  Branch (1588:9): [True: 0, False: 3]
  ------------------
 1589|      0|    {
 1590|      0|        goto exit_function;
 1591|      0|    }
 1592|       |#if ( FIX_ADD_PROTON_FOR_ADP == 1 )
 1593|       |    /************************ check and fix ADP by adding a proton (dummy) *************************/
 1594|       |    if (cmpInChI && pTCGroups->num_tgroups && pBNS->tot_st_cap > pBNS->tot_st_flow)
 1595|       |    {
 1596|       |        ret = FixAddProtonForADP( pBNS, pBD, pStruct, at, at2, at_prep, pVA, pTCGroups, &icr,
 1597|       |                                  pnNumRunBNS, pnTotalDelta, forbidden_edge_mask );
 1598|       |        if (ret < 0)
 1599|       |        {
 1600|       |            goto exit_function;
 1601|       |        }
 1602|       |    }
 1603|       |#endif
 1604|       |     /* moved to MakeOneInChIOutOfStrFromINChI():
 1605|       |       pStruct->nNumRemovedProtons = (pStruct->iMobileH == TAUT_YES)? pStruct->One_ti.tni.nNumRemovedProtons : 0;
 1606|       |     */
 1607|       |
 1608|       |    /* count endpoints */
 1609|      3|    num_endpoints = 0;
 1610|      3|    num_norm_endpoints = 0;
 1611|      3|    num_norm_t_groups = 0;
 1612|      3|    num_mobile = 0;
 1613|      3|    num_norm_mobile = 0;
 1614|      3|    at_norm = pStruct->pOne_norm_data[0]->at;
 1615|      3|    for (i = 0; i < pTCGroups->num_tgroups; i++)
  ------------------
  |  Branch (1615:17): [True: 0, False: 3]
  ------------------
 1616|      0|    {
 1617|      0|        num_endpoints += pTCGroups->pTCG[i].num_edges;
 1618|      0|        num_mobile += pTCGroups->pTCG[i].tg_num_H + pTCGroups->pTCG[i].tg_num_Minus;
 1619|      0|    }
 1620|       |
 1621|      3|    if (t_group_info)
  ------------------
  |  Branch (1621:9): [True: 1, False: 2]
  ------------------
 1622|      1|    {
 1623|       |        /* after canonicalization, t_group_info->t_group[i].num[0] = number of H   */
 1624|       |        /*                         t_group_info->t_group[i].num[1] = number of (-) */
 1625|      2|        for (i = 0; i < t_group_info->num_t_groups; i++)
  ------------------
  |  Branch (1625:21): [True: 1, False: 1]
  ------------------
 1626|      1|        {
 1627|      1|            if (t_group_info->t_group[i].num[0])
  ------------------
  |  Branch (1627:17): [True: 1, False: 0]
  ------------------
 1628|      1|            {
 1629|      1|                num_norm_t_groups++;
 1630|      1|                num_norm_endpoints += t_group_info->t_group[i].nNumEndpoints;
 1631|      1|                num_norm_mobile += t_group_info->t_group[i].num[0] + t_group_info->t_group[i].num[1];
 1632|      1|            }
 1633|      1|        }
 1634|      1|    }
 1635|       |#if ( bRELEASE_VERSION == 0 )
 1636|       |#ifndef TARGET_API_LIB
 1637|       |    if (num_norm_t_groups != pTCGroups->num_tgroups || num_norm_endpoints != num_endpoints)
 1638|       |    {
 1639|       |/* need aggressive (de)protonation */
 1640|       |/* pStruct->bExtract |= EXTRACT_STRUCT_NUMBER; */
 1641|       |        fprintf( stdout, "NORMCOMP: %s comp=%d %c%c: InChI/NormRvrs NumTg=%d/%d NumEndp=%d/%d\n",
 1642|       |            ( *ip ).pSdfValue, ( *pTCGroups ).iComponent,
 1643|       |                 pStruct->iInchiRec ? 'R' : 'D', pStruct->iMobileH ? 'M' : 'F',
 1644|       |                 pTCGroups->num_tgroups, num_norm_t_groups,
 1645|       |                 num_endpoints, num_norm_endpoints );
 1646|       |    }
 1647|       |#endif
 1648|       |#endif
 1649|       |
 1650|    801|exit_function:
 1651|       |
 1652|  2.40k|    for (i = 0; i < TAUT_NUM; i++)
  ------------------
  |  |  578|  2.40k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1652:17): [True: 1.60k, False: 801]
  ------------------
 1653|  1.60k|    {
 1654|  1.60k|        Free_INChI( &pStruct->pOneINChI[i] );
 1655|  1.60k|        Free_INChI_Aux( &pStruct->pOneINChI_Aux[i] );
 1656|  1.60k|        FreeInpAtomData( pStruct->pOne_norm_data[i] );
 1657|  1.60k|        if (pStruct->pOne_norm_data[i])
  ------------------
  |  Branch (1657:13): [True: 802, False: 800]
  ------------------
 1658|    802|        {
 1659|    802|            inchi_free( pStruct->pOne_norm_data[i] );
  ------------------
  |  | 1136|    802|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 802, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1660|    802|            pStruct->pOne_norm_data[i] = NULL;
 1661|    802|        }
 1662|  1.60k|    }
 1663|       |
 1664|    801|    free_t_group_info( &pStruct->One_ti );
 1665|       |
 1666|    801|    return ret;
 1667|      3|}
CheckAndRefixStereobonds:
 1676|    801|{
 1677|    801|    int forbidden_edge_stereo = BNS_EDGE_FORBIDDEN_MASK;
  ------------------
  |  |   67|    801|#define BNS_EDGE_FORBIDDEN_MASK  1
  ------------------
 1678|    801|    int inv_forbidden_edge_stereo = ~forbidden_edge_stereo;
 1679|       |
 1680|    801|    int i, k, ne, j1, j2, num_wrong, num_fixed;
 1681|    801|    int ret2, retBNS, ret;
 1682|    801|    int num_at = pStruct->num_atoms;
 1683|    801|    int num_deleted_H = pStruct->num_deleted_H;
 1684|    801|    int len_at = num_at + num_deleted_H;
 1685|    801|    EDGE_LIST FixedEdges, WrongEdges, CarbonChargeEdges;
 1686|       |
 1687|    801|    BNS_EDGE   *pEdge;
 1688|    801|    Vertex      v1, v2;
 1689|    801|    BNS_VERTEX *pv1, *pv2;
 1690|       |
 1691|    801|    ret = 0;
 1692|       |
 1693|       |    /* to simplify, prepare new at[] from pBNS */
 1694|    801|    memcpy( at2, at, len_at * sizeof( at2[0] ) );
 1695|    801|    pStruct->at = at2;
 1696|    801|    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 1697|    801|    pStruct->at = at;
 1698|    801|    if (ret2 < 0)
  ------------------
  |  Branch (1698:9): [True: 0, False: 801]
  ------------------
 1699|      0|    {
 1700|      0|        return ret;
 1701|      0|    }
 1702|       |
 1703|    801|    num_wrong = 0;
 1704|       |    /* find wrong double bonds */
 1705|  4.46k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (1705:17): [True: 3.65k, False: 801]
  ------------------
 1706|  3.65k|    {
 1707|  3.65k|        if (at2[i].valence == 3 &&
  ------------------
  |  Branch (1707:13): [True: 0, False: 3.65k]
  ------------------
 1708|  3.65k|             at2[i].chem_bonds_valence - at2[i].valence == 1 &&
  ------------------
  |  Branch (1708:14): [True: 0, False: 0]
  ------------------
 1709|  3.65k|             at2[i].sb_parity[0] && at2[i].sb_parity[1] && !at2[i].sb_parity[2] &&
  ------------------
  |  Branch (1709:14): [True: 0, False: 0]
  |  Branch (1709:37): [True: 0, False: 0]
  |  Branch (1709:60): [True: 0, False: 0]
  ------------------
 1710|  3.65k|             ( at2[i].bond_type[j1 = (int) at2[i].sb_ord[0]] & BOND_TYPE_MASK ) == BOND_TYPE_SINGLE &&
  ------------------
  |  |  217|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
                           ( at2[i].bond_type[j1 = (int) at2[i].sb_ord[0]] & BOND_TYPE_MASK ) == BOND_TYPE_SINGLE &&
  ------------------
  |  |   60|  3.65k|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (1710:14): [True: 0, False: 0]
  ------------------
 1711|  3.65k|             ( at2[i].bond_type[j2 = (int) at2[i].sb_ord[1]] & BOND_TYPE_MASK ) == BOND_TYPE_SINGLE  &&
  ------------------
  |  |  217|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
                           ( at2[i].bond_type[j2 = (int) at2[i].sb_ord[1]] & BOND_TYPE_MASK ) == BOND_TYPE_SINGLE  &&
  ------------------
  |  |   60|  3.65k|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (1711:14): [True: 0, False: 0]
  ------------------
 1712|  3.65k|             j1 != j2)
  ------------------
  |  Branch (1712:14): [True: 0, False: 0]
  ------------------
 1713|      0|        {
 1714|       |
 1715|      0|            num_wrong++;
 1716|      0|        }
 1717|  3.65k|    }
 1718|    801|    if (!num_wrong)
  ------------------
  |  Branch (1718:9): [True: 801, False: 0]
  ------------------
 1719|    801|    {
 1720|    801|        return 0;
 1721|    801|    }
 1722|      0|    num_fixed = 0;
 1723|      0|    for (i = 0; i < pBNS->num_bonds; i++)
  ------------------
  |  Branch (1723:17): [True: 0, False: 0]
  ------------------
 1724|      0|    {
 1725|      0|        pEdge = pBNS->edge + i;
 1726|      0|        if (pEdge->forbidden & forbidden_edge_stereo)
  ------------------
  |  Branch (1726:13): [True: 0, False: 0]
  ------------------
 1727|      0|        {
 1728|      0|            num_fixed++;
 1729|      0|        }
 1730|      0|    }
 1731|       |
 1732|       |    /* there may be no fixed stereo bonds at all, see #87607 */
 1733|      0|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      0|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 1734|      0|    AllocEdgeList( &FixedEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      0|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 1735|      0|    AllocEdgeList( &WrongEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      0|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 1736|       |
 1737|       |    /* do not goto exit_function before reaching this point: EdgeLists have not been initiated */
 1738|       |
 1739|      0|    if (0 > ( ret = ForbidCarbonChargeEdges( pBNS, pTCGroups, &CarbonChargeEdges, forbidden_edge_mask ) ))
  ------------------
  |  Branch (1739:9): [True: 0, False: 0]
  ------------------
 1740|      0|    {
 1741|      0|        goto exit_function;
 1742|      0|    }
 1743|      0|    if (( ret = AllocEdgeList( &FixedEdges, num_fixed ) ) ||
  ------------------
  |  Branch (1743:9): [True: 0, False: 0]
  ------------------
 1744|      0|        ( ret = AllocEdgeList( &WrongEdges, num_wrong ) ))
  ------------------
  |  Branch (1744:9): [True: 0, False: 0]
  ------------------
 1745|      0|    {
 1746|      0|        goto exit_function;
 1747|      0|    }
 1748|       |    /* collect wrong double bonds and set flow=0 */
 1749|      0|    for (i = 0; i < num_at && WrongEdges.num_edges < num_wrong; i++)
  ------------------
  |  Branch (1749:17): [True: 0, False: 0]
  |  Branch (1749:31): [True: 0, False: 0]
  ------------------
 1750|      0|    {
 1751|      0|        if (at2[i].valence == 3 &&
  ------------------
  |  Branch (1751:13): [True: 0, False: 0]
  ------------------
 1752|      0|             at2[i].chem_bonds_valence - at2[i].valence == 1 &&
  ------------------
  |  Branch (1752:14): [True: 0, False: 0]
  ------------------
 1753|      0|             at2[i].sb_parity[0] && at2[i].sb_parity[1] && !at2[i].sb_parity[2] &&
  ------------------
  |  Branch (1753:14): [True: 0, False: 0]
  |  Branch (1753:37): [True: 0, False: 0]
  |  Branch (1753:60): [True: 0, False: 0]
  ------------------
 1754|      0|             ( at2[i].bond_type[j1 = (int) at2[i].sb_ord[0]] & BOND_TYPE_MASK ) == BOND_TYPE_SINGLE &&
  ------------------
  |  |  217|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
                           ( at2[i].bond_type[j1 = (int) at2[i].sb_ord[0]] & BOND_TYPE_MASK ) == BOND_TYPE_SINGLE &&
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (1754:14): [True: 0, False: 0]
  ------------------
 1755|      0|             ( at2[i].bond_type[j2 = (int) at2[i].sb_ord[1]] & BOND_TYPE_MASK ) == BOND_TYPE_SINGLE &&
  ------------------
  |  |  217|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
                           ( at2[i].bond_type[j2 = (int) at2[i].sb_ord[1]] & BOND_TYPE_MASK ) == BOND_TYPE_SINGLE &&
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (1755:14): [True: 0, False: 0]
  ------------------
 1756|      0|             j1 != j2)
  ------------------
  |  Branch (1756:14): [True: 0, False: 0]
  ------------------
 1757|      0|        {
 1758|      0|            switch (j1 + j2)
 1759|      0|            {
 1760|      0|                case 1: /* 0, 1 */
  ------------------
  |  Branch (1760:17): [True: 0, False: 0]
  ------------------
 1761|      0|                    k = 2;
 1762|      0|                    break;
 1763|      0|                case 2: /* 0, 2 */
  ------------------
  |  Branch (1763:17): [True: 0, False: 0]
  ------------------
 1764|      0|                    k = 1;
 1765|      0|                    break;
 1766|      0|                case 3: /* 1, 2 */
  ------------------
  |  Branch (1766:17): [True: 0, False: 0]
  ------------------
 1767|      0|                    k = 0;
 1768|      0|                    break;
 1769|      0|                default:
  ------------------
  |  Branch (1769:17): [True: 0, False: 0]
  ------------------
 1770|      0|                    ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1771|      0|                    goto exit_function;
 1772|      0|            }
 1773|      0|            ne = pBNS->vert[i].iedge[k];
 1774|      0|            pEdge = pBNS->edge + ne;
 1775|      0|            v1 = pEdge->neighbor1;
 1776|      0|            v2 = pEdge->neighbor12 ^ v1;
 1777|      0|            pv1 = pBNS->vert + v1;
 1778|      0|            pv2 = pBNS->vert + v2;
 1779|       |
 1780|      0|            if (!pEdge->flow)
  ------------------
  |  Branch (1780:17): [True: 0, False: 0]
  ------------------
 1781|      0|            {
 1782|      0|                ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1783|      0|                goto exit_function;
 1784|      0|            }
 1785|      0|            pEdge->flow--;
 1786|      0|            pEdge->forbidden |= forbidden_edge_mask;
 1787|      0|            pv1->st_edge.flow--;
 1788|      0|            pv2->st_edge.flow--;
 1789|      0|            pBNS->tot_st_flow -= 2;
 1790|      0|            if (ret = AddToEdgeList( &WrongEdges, ne, 0 ))
  ------------------
  |  Branch (1790:17): [True: 0, False: 0]
  ------------------
 1791|      0|            {
 1792|      0|                goto exit_function;
 1793|      0|            }
 1794|      0|        }
 1795|      0|    }
 1796|       |    /* remove forbidden mark from stereo bonds (unfix stereo bonds) */
 1797|      0|    for (i = 0; i < pBNS->num_bonds && FixedEdges.num_edges < num_fixed; i++)
  ------------------
  |  Branch (1797:17): [True: 0, False: 0]
  |  Branch (1797:40): [True: 0, False: 0]
  ------------------
 1798|      0|    {
 1799|      0|        pEdge = pBNS->edge + i;
 1800|      0|        if (pEdge->forbidden & forbidden_edge_stereo)
  ------------------
  |  Branch (1800:13): [True: 0, False: 0]
  ------------------
 1801|      0|        {
 1802|      0|            pEdge->forbidden &= inv_forbidden_edge_stereo;
 1803|      0|            FixedEdges.pnEdges[FixedEdges.num_edges++] = i;
 1804|      0|        }
 1805|      0|    }
 1806|       |    /* Run BNS to move charges and rearrange bond orders */
 1807|      0|    retBNS = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 1808|      0|    ( *pnNumRunBNS )++;
 1809|      0|    if (retBNS < 0)
  ------------------
  |  Branch (1809:9): [True: 0, False: 0]
  ------------------
 1810|      0|    {
 1811|      0|        goto exit_function;
 1812|      0|    }
 1813|      0|    else
 1814|      0|    {
 1815|      0|        if (retBNS > 0)
  ------------------
  |  Branch (1815:13): [True: 0, False: 0]
  ------------------
 1816|      0|        {
 1817|      0|            *pnTotalDelta += retBNS;
 1818|      0|        }
 1819|      0|    }
 1820|       |    /* remove forbidden_edge_mask and set forbidden_edge_stereo */
 1821|      0|    RemoveForbiddenEdgeMask( pBNS, &WrongEdges, forbidden_edge_mask );
 1822|       |    /* allow carbon charges to change */
 1823|      0|    RemoveForbiddenEdgeMask( pBNS, &CarbonChargeEdges, forbidden_edge_mask );
 1824|       |    /* fix previously unfixed stereo bonds */
 1825|      0|    SetForbiddenEdgeMask( pBNS, &FixedEdges, forbidden_edge_stereo );
 1826|       |    /* Run BNS again in case not all edge flows are maximal */
 1827|      0|    ret2 = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 1828|      0|    ( *pnNumRunBNS )++;
 1829|      0|    if (ret2 < 0)
  ------------------
  |  Branch (1829:9): [True: 0, False: 0]
  ------------------
 1830|      0|    {
 1831|      0|        goto exit_function;
 1832|      0|    }
 1833|      0|    else
 1834|      0|    {
 1835|      0|        if (ret2 > 0)
  ------------------
  |  Branch (1835:13): [True: 0, False: 0]
  ------------------
 1836|      0|        {
 1837|      0|            *pnTotalDelta += retBNS;
 1838|      0|        }
 1839|      0|    }
 1840|      0|    ret = retBNS;
 1841|       |
 1842|      0|exit_function:
 1843|       |
 1844|      0|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|      0|#define EDGE_LIST_FREE   (-2)
  ------------------
 1845|      0|    AllocEdgeList( &FixedEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|      0|#define EDGE_LIST_FREE   (-2)
  ------------------
 1846|      0|    AllocEdgeList( &WrongEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|      0|#define EDGE_LIST_FREE   (-2)
  ------------------
 1847|       |
 1848|      0|    return ret;
 1849|      0|}
MoveChargeToRemoveCenerpoints:
 1865|    801|{
 1866|    801|    int i, j, neigh, num_endpoints, num_success;
 1867|    801|    int num_donors, num_acceptors, bond_type, num_donors_O, num_acceptors_O, is_centerpoint_N, num_known_endpoints, num_wrong_neigh;
 1868|    801|    int ret2, ret_forbid_edges, ret, delta;
 1869|    801|    int num_at = pStruct->num_atoms;
 1870|    801|    int num_deleted_H = pStruct->num_deleted_H;
 1871|    801|    int len_at = num_at + num_deleted_H;
 1872|    801|    int forbidden_edge_test = BNS_EDGE_FORBIDDEN_TEST;
  ------------------
  |  |   69|    801|#define BNS_EDGE_FORBIDDEN_TEST  4
  ------------------
 1873|    801|    int bPossiblyIgnore = pStruct->charge >= 0 && ( !pTCGroups->num_tgroups || pStruct->iMobileH == TAUT_NON && pStruct->ti.num_t_groups );
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1873:27): [True: 798, False: 3]
  |  Branch (1873:53): [True: 798, False: 0]
  |  Branch (1873:80): [True: 0, False: 0]
  |  Branch (1873:113): [True: 0, False: 0]
  ------------------
 1874|    801|    S_CHAR MobileChargeNeigh[MAXVAL], DoubleBondAcceptors[MAXVAL], DoubleBondNotONeigh[MAXVAL];
 1875|    801|    int    numMobileChargeNeigh, numDoubleBondAcceptors, numDoubleBondNotONeigh, numOtherDoubleBondOAcceptors = 0;
 1876|    801|    EDGE_LIST ChargeListAllExcept_DB_O;
 1877|       |
 1878|       |
 1879|    801|    BNS_EDGE   *pEdgeMinus, *pe;
 1880|    801|    Vertex      v1m, v2m;
 1881|    801|    BNS_VERTEX *pv1m, *pv2m;
 1882|    801|    ret = 0;
 1883|    801|    num_success = 0;
 1884|       |
 1885|       |    /* count O(+)H, N(+)H */
 1886|       |
 1887|       |    /*
 1888|       |    if ( pStruct->charge >= 0 && (!pTCGroups->num_tgroups || pStruct->iMobileH == TAUT_NON && pStruct->ti.num_t_groups) ) {
 1889|       |        goto exit_function;
 1890|       |    }
 1891|       |    */
 1892|    801|    if (ret = AllocEdgeList( &ChargeListAllExcept_DB_O, EDGE_LIST_CLEAR ))
  ------------------
  |  |  270|    801|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  |  Branch (1892:9): [True: 0, False: 801]
  ------------------
 1893|      0|    {
 1894|      0|        goto exit_function;
 1895|      0|    }
 1896|       |
 1897|       |
 1898|       |    /* to simplify, prepare new at[] from pBNS */
 1899|    801|    memcpy( at2, at, len_at * sizeof( at2[0] ) );
 1900|    801|    pStruct->at = at2;
 1901|    801|    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 1902|    801|    pStruct->at = at;
 1903|    801|    if (ret2 < 0)
  ------------------
  |  Branch (1903:9): [True: 0, False: 801]
  ------------------
 1904|      0|    {
 1905|      0|        ret = ret2;
 1906|      0|        goto exit_function;
 1907|      0|    }
 1908|    801|#if ( FIND_RING_SYSTEMS == 1 )
 1909|    801|    ret2 = MarkRingSystemsInp( at2, num_at, 0 );
 1910|    801|    if (ret2 < 0)
  ------------------
  |  Branch (1910:9): [True: 0, False: 801]
  ------------------
 1911|      0|    {
 1912|      0|        ret = ret2;
 1913|      0|        goto exit_function;
 1914|      0|    }
 1915|    801|#endif
 1916|       |    /* mark bonds that cannot be tautomeric; do not forget to remove the marks later */
 1917|    801|    ret_forbid_edges = SetForbiddenEdges( pBNS, at2, num_at, forbidden_edge_test, 0, NULL );
 1918|    801|    if (ret_forbid_edges < 0)
  ------------------
  |  Branch (1918:9): [True: 0, False: 801]
  ------------------
 1919|      0|    {
 1920|      0|        ret = ret_forbid_edges;
 1921|      0|        goto exit_function;
 1922|      0|    }
 1923|       |
 1924|  4.46k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (1924:17): [True: 3.65k, False: 801]
  ------------------
 1925|  3.65k|    {
 1926|  3.65k|        if (pVA[i].cNumValenceElectrons != 4 && /* not C, Si, Ge */
  ------------------
  |  Branch (1926:13): [True: 3.60k, False: 51]
  ------------------
 1927|  3.65k|             !( pVA[i].nTautGroupEdge || pStruct->iMobileH == TAUT_NON && pStruct->endpoint && pStruct->endpoint[i] ) &&
  ------------------
  |  |  579|  7.21k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1927:17): [True: 0, False: 3.60k]
  |  Branch (1927:42): [True: 224, False: 3.38k]
  |  Branch (1927:75): [True: 224, False: 0]
  |  Branch (1927:96): [True: 0, False: 224]
  ------------------
 1928|  3.65k|             !at2[i].num_H && !at2[i].charge && at2[i].valence >= 2 &&
  ------------------
  |  Branch (1928:14): [True: 3.60k, False: 0]
  |  Branch (1928:31): [True: 3.59k, False: 9]
  |  Branch (1928:49): [True: 2, False: 3.59k]
  ------------------
 1929|  3.65k|             at2[i].valence < at2[i].chem_bonds_valence &&
  ------------------
  |  Branch (1929:14): [True: 0, False: 2]
  ------------------
 1930|  3.65k|             is_centerpoint_elem( at2[i].el_number ))
  ------------------
  |  Branch (1930:14): [True: 0, False: 0]
  ------------------
 1931|      0|        {
 1932|       |
 1933|      0|            is_centerpoint_N = ( pVA[i].cNumValenceElectrons == 5 && ( pVA[i].cPeriodicRowNumber == 1 || pVA[i].cMetal ) );
  ------------------
  |  Branch (1933:34): [True: 0, False: 0]
  |  Branch (1933:72): [True: 0, False: 0]
  |  Branch (1933:106): [True: 0, False: 0]
  ------------------
 1934|       |            /* look at the neighbors */
 1935|      0|            numMobileChargeNeigh = numDoubleBondAcceptors = numDoubleBondNotONeigh = num_donors = num_acceptors = 0;
 1936|      0|            num_donors_O = num_acceptors_O = 0;
 1937|      0|            num_known_endpoints = num_wrong_neigh = 0;
 1938|      0|            for (j = 0, num_endpoints = 0; j < at2[i].valence; j++)
  ------------------
  |  Branch (1938:44): [True: 0, False: 0]
  ------------------
 1939|      0|            {
 1940|      0|                neigh = at2[i].neighbor[j];
 1941|      0|                if (( at2[neigh].endpoint || pStruct->iMobileH == TAUT_NON && pStruct->endpoint && pStruct->endpoint[neigh] ) || at2[neigh].charge > 0)
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1941:23): [True: 0, False: 0]
  |  Branch (1941:46): [True: 0, False: 0]
  |  Branch (1941:79): [True: 0, False: 0]
  |  Branch (1941:100): [True: 0, False: 0]
  |  Branch (1941:130): [True: 0, False: 0]
  ------------------
 1942|      0|                {
 1943|      0|                    num_known_endpoints++;
 1944|      0|                    continue;
 1945|      0|                }
 1946|      0|                if (pBNS->edge[pBNS->vert[i].iedge[j]].forbidden & forbidden_edge_test)
  ------------------
  |  Branch (1946:21): [True: 0, False: 0]
  ------------------
 1947|      0|                {
 1948|      0|                    continue;
 1949|      0|                }
 1950|      0|                bond_type = at2[i].bond_type[j] & BOND_TYPE_MASK;
  ------------------
  |  |  217|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
 1951|      0|                if (bond_type > BOND_TYPE_DOUBLE)
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (1951:21): [True: 0, False: 0]
  ------------------
 1952|      0|                {
 1953|      0|                    num_wrong_neigh++;
 1954|      0|                    continue;
 1955|      0|                }
 1956|      0|                if (at2[neigh].num_H && bond_type == BOND_TYPE_SINGLE)
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (1956:21): [True: 0, False: 0]
  |  Branch (1956:41): [True: 0, False: 0]
  ------------------
 1957|      0|                {
 1958|      0|                    break;  /* not this case */
 1959|      0|                }
 1960|      0|                if (at2[neigh].chem_bonds_valence - at2[neigh].charge
  ------------------
  |  Branch (1960:21): [True: 0, False: 0]
  ------------------
 1961|      0|                     != get_endpoint_valence( at2[neigh].el_number ))
 1962|      0|                {
 1963|      0|                    if (bond_type == BOND_TYPE_DOUBLE && pVA[neigh].cNumValenceElectrons != 6)
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (1963:25): [True: 0, False: 0]
  |  Branch (1963:58): [True: 0, False: 0]
  ------------------
 1964|      0|                    {
 1965|      0|                        DoubleBondNotONeigh[numDoubleBondNotONeigh++] = j;
 1966|      0|                    }
 1967|      0|                    continue;
 1968|      0|                }
 1969|      0|                if (at2[neigh].charge == -1 && bond_type == BOND_TYPE_SINGLE &&
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (1969:21): [True: 0, False: 0]
  |  Branch (1969:48): [True: 0, False: 0]
  ------------------
 1970|      0|                    ( pVA[neigh].nCMinusGroupEdge < 1 || pBNS->edge[pVA[neigh].nCMinusGroupEdge - 1].flow != 1 ))
  ------------------
  |  Branch (1970:23): [True: 0, False: 0]
  |  Branch (1970:58): [True: 0, False: 0]
  ------------------
 1971|      0|                {
 1972|      0|                    break;
 1973|      0|                }
 1974|      0|                switch (bond_type)
  ------------------
  |  Branch (1974:25): [True: 0, False: 0]
  ------------------
 1975|      0|                {
 1976|      0|                    case BOND_TYPE_SINGLE:
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (1976:21): [True: 0, False: 0]
  ------------------
 1977|      0|                        if (at2[neigh].charge != -1 || pVA[neigh].nCMinusGroupEdge <= 0)
  ------------------
  |  Branch (1977:29): [True: 0, False: 0]
  |  Branch (1977:56): [True: 0, False: 0]
  ------------------
 1978|      0|                        {
 1979|      0|                            num_wrong_neigh++;
 1980|      0|                            continue;
 1981|      0|                        }
 1982|      0|                        num_donors++;
 1983|      0|                        num_donors_O += ( pVA[neigh].cNumValenceElectrons == 6 && pVA[neigh].cPeriodicRowNumber <= 4 );
  ------------------
  |  Branch (1983:43): [True: 0, False: 0]
  |  Branch (1983:83): [True: 0, False: 0]
  ------------------
 1984|      0|                        MobileChargeNeigh[numMobileChargeNeigh++] = j;
 1985|      0|                        break;
 1986|      0|                    case BOND_TYPE_DOUBLE:
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (1986:21): [True: 0, False: 0]
  ------------------
 1987|      0|                        if (at2[neigh].charge)
  ------------------
  |  Branch (1987:29): [True: 0, False: 0]
  ------------------
 1988|      0|                        {
 1989|      0|                            num_wrong_neigh++;
 1990|      0|                            continue;
 1991|      0|                        }
 1992|      0|                        DoubleBondAcceptors[numDoubleBondAcceptors++] = j;
 1993|      0|                        num_acceptors++;
 1994|      0|                        num_acceptors_O += ( pVA[neigh].cNumValenceElectrons == 6 && pVA[neigh].cPeriodicRowNumber <= 4 );
  ------------------
  |  Branch (1994:46): [True: 0, False: 0]
  |  Branch (1994:86): [True: 0, False: 0]
  ------------------
 1995|      0|                }
 1996|      0|            }
 1997|      0|            if (j != at2[i].valence || !num_donors || !num_acceptors)
  ------------------
  |  Branch (1997:17): [True: 0, False: 0]
  |  Branch (1997:40): [True: 0, False: 0]
  |  Branch (1997:55): [True: 0, False: 0]
  ------------------
 1998|      0|            {
 1999|      0|                continue;
 2000|      0|            }
 2001|       |            /* special case NOn(-) */
 2002|      0|            if (is_centerpoint_N && ( num_donors == num_donors_O ) && ( num_acceptors == num_acceptors_O ))
  ------------------
  |  Branch (2002:17): [True: 0, False: 0]
  |  Branch (2002:37): [True: 0, False: 0]
  |  Branch (2002:71): [True: 0, False: 0]
  ------------------
 2003|      0|            {
 2004|      0|                continue;
 2005|      0|            }
 2006|      0|            if (pStruct->iMobileH == TAUT_NON && num_donors == numDoubleBondNotONeigh)
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (2006:17): [True: 0, False: 0]
  |  Branch (2006:50): [True: 0, False: 0]
  ------------------
 2007|      0|            {
 2008|       |                /* fix all charges except on =O */
 2009|      0|                Vertex     vPathStart, vPathEnd;
 2010|      0|                int        nPathLen, nDeltaH, nDeltaCharge, nNumVisitedAtoms;
 2011|      0|                int k, e, num_MovedCharges = 0;
 2012|       |
 2013|      0|                if (!ChargeListAllExcept_DB_O.num_edges)
  ------------------
  |  Branch (2013:21): [True: 0, False: 0]
  ------------------
 2014|      0|                {
 2015|      0|                    numOtherDoubleBondOAcceptors = 0;
 2016|      0|                    for (k = 0; k < num_at; k++)
  ------------------
  |  Branch (2016:33): [True: 0, False: 0]
  ------------------
 2017|      0|                    {
 2018|      0|                        if (1 == at2[k].valence && pBNS->edge[pBNS->vert[k].iedge[0]].flow &&
  ------------------
  |  Branch (2018:29): [True: 0, False: 0]
  |  Branch (2018:52): [True: 0, False: 0]
  ------------------
 2019|      0|                             !pBNS->edge[pBNS->vert[k].iedge[0]].forbidden &&
  ------------------
  |  Branch (2019:30): [True: 0, False: 0]
  ------------------
 2020|      0|                             !( ( e = pVA[k].nCMinusGroupEdge - 1 ) >= 0 && pBNS->edge[e].flow ) &&
  ------------------
  |  Branch (2020:33): [True: 0, False: 0]
  |  Branch (2020:77): [True: 0, False: 0]
  ------------------
 2021|      0|                             !( ( e = pVA[k].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].flow ) &&
  ------------------
  |  Branch (2021:33): [True: 0, False: 0]
  |  Branch (2021:76): [True: 0, False: 0]
  ------------------
 2022|       |                             /* 0 == at2[k].charge && */
 2023|      0|                             pVA[k].cNumValenceElectrons == 6 && !pVA[k].cMetal &&
  ------------------
  |  Branch (2023:30): [True: 0, False: 0]
  |  Branch (2023:66): [True: 0, False: 0]
  ------------------
 2024|      0|                             pStruct->endpoint && pStruct->endpoint[k] ||
  ------------------
  |  Branch (2024:30): [True: 0, False: 0]
  |  Branch (2024:51): [True: 0, False: 0]
  ------------------
 2025|      0|                             pStruct->fixed_H && pStruct->fixed_H[k])
  ------------------
  |  Branch (2025:30): [True: 0, False: 0]
  |  Branch (2025:50): [True: 0, False: 0]
  ------------------
 2026|      0|                        {
 2027|      0|                            numOtherDoubleBondOAcceptors++;  /* do not fix this minus edge */
 2028|      0|                        }
 2029|      0|                        else
 2030|      0|                            if (( e = pVA[k].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].flow &&
  ------------------
  |  Branch (2030:33): [True: 0, False: 0]
  |  Branch (2030:77): [True: 0, False: 0]
  ------------------
 2031|      0|                                 !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (2031:34): [True: 0, False: 0]
  ------------------
 2032|      0|                                 ( ret = AddToEdgeList( &ChargeListAllExcept_DB_O, e, 64 ) ))
  ------------------
  |  Branch (2032:34): [True: 0, False: 0]
  ------------------
 2033|      0|                            {
 2034|      0|                                goto exit_function;
 2035|      0|                            }
 2036|      0|                        if (( e = pVA[k].nCPlusGroupEdge - 1 ) >= 0 &&
  ------------------
  |  Branch (2036:29): [True: 0, False: 0]
  ------------------
 2037|      0|                             !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (2037:30): [True: 0, False: 0]
  ------------------
 2038|      0|                             ( ret = AddToEdgeList( &ChargeListAllExcept_DB_O, e, 64 ) ))
  ------------------
  |  Branch (2038:30): [True: 0, False: 0]
  ------------------
 2039|      0|                        {
 2040|      0|                            goto exit_function;
 2041|      0|                        }
 2042|      0|                    }
 2043|      0|                }
 2044|       |                /* fix double bonds to non-O neighbors connected by double bonds;
 2045|       |                   we will try to make these bons single */
 2046|      0|                for (k = 0; k < numDoubleBondNotONeigh; k++)
  ------------------
  |  Branch (2046:29): [True: 0, False: 0]
  ------------------
 2047|      0|                {
 2048|      0|                    e = pBNS->vert[i].iedge[(int) DoubleBondNotONeigh[k]];
 2049|      0|                    if (!pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (2049:25): [True: 0, False: 0]
  ------------------
 2050|      0|                        ( ret = AddToEdgeList( &ChargeListAllExcept_DB_O, e, 64 ) ))
  ------------------
  |  Branch (2050:25): [True: 0, False: 0]
  ------------------
 2051|      0|                    {
 2052|      0|                        goto exit_function;
 2053|      0|                    }
 2054|      0|                }
 2055|       |                /* attempt to make DoubleBondNotONeigh[] single */
 2056|      0|                SetForbiddenEdgeMask( pBNS, &ChargeListAllExcept_DB_O, forbidden_edge_mask );
 2057|      0|                for (k = 0; k < numDoubleBondNotONeigh && num_MovedCharges < numMobileChargeNeigh; k++)
  ------------------
  |  Branch (2057:29): [True: 0, False: 0]
  |  Branch (2057:59): [True: 0, False: 0]
  ------------------
 2058|      0|                {
 2059|      0|                    pe = pBNS->edge + pBNS->vert[i].iedge[(int) DoubleBondNotONeigh[k]];
 2060|      0|                    delta = 1;
 2061|      0|                    if (pe->flow != delta)
  ------------------
  |  Branch (2061:25): [True: 0, False: 0]
  ------------------
 2062|      0|                        continue;
 2063|      0|                    pv1m = pBNS->vert + ( v1m = pe->neighbor1 );
 2064|      0|                    pv2m = pBNS->vert + ( v2m = pe->neighbor12 ^ v1m );
 2065|      0|                    pv1m->st_edge.flow -= delta;
 2066|      0|                    pv2m->st_edge.flow -= delta;
 2067|      0|                    pe->flow -= delta;
 2068|      0|                    pBNS->tot_st_flow -= 2 * delta;
 2069|      0|                    ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 2070|      0|                                          &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 2071|      0|                    if (ret < 0)
  ------------------
  |  Branch (2071:25): [True: 0, False: 0]
  ------------------
 2072|      0|                    {
 2073|      0|                        goto exit_function;
 2074|      0|                    }
 2075|      0|                    if (ret == 1 && ( vPathEnd == v1m && vPathStart == v2m ||
  ------------------
  |  Branch (2075:25): [True: 0, False: 0]
  |  Branch (2075:39): [True: 0, False: 0]
  |  Branch (2075:58): [True: 0, False: 0]
  ------------------
 2076|      0|                        vPathEnd == v2m && vPathStart == v1m ) &&
  ------------------
  |  Branch (2076:25): [True: 0, False: 0]
  |  Branch (2076:44): [True: 0, False: 0]
  ------------------
 2077|      0|                                      nDeltaCharge == 0  /* (-) moving from one to another atom*/)
  ------------------
  |  Branch (2077:39): [True: 0, False: 0]
  ------------------
 2078|      0|                    {
 2079|      0|                        ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 2080|      0|                        ( *pnNumRunBNS )++;
 2081|      0|                        if (ret < 0)
  ------------------
  |  Branch (2081:29): [True: 0, False: 0]
  ------------------
 2082|      0|                        {
 2083|      0|                            goto exit_function;
 2084|      0|                        }
 2085|      0|                        else
 2086|      0|                        {
 2087|      0|                            if (ret == 1)
  ------------------
  |  Branch (2087:33): [True: 0, False: 0]
  ------------------
 2088|      0|                            {
 2089|      0|                                *pnTotalDelta += ret;
 2090|      0|                                num_MovedCharges++;
 2091|      0|                            }
 2092|      0|                            else
 2093|      0|                            {
 2094|      0|                                ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 2095|      0|                                goto exit_function;
 2096|      0|                            }
 2097|      0|                        }
 2098|      0|                    }
 2099|      0|                    else
 2100|      0|                    {
 2101|      0|                        ret = 0;
 2102|      0|                        pv1m->st_edge.flow += delta;
 2103|      0|                        pv2m->st_edge.flow += delta;
 2104|      0|                        pe->flow += delta;
 2105|      0|                        pBNS->tot_st_flow += 2 * delta;
 2106|      0|                    }
 2107|      0|                }
 2108|      0|                RemoveForbiddenEdgeMask( pBNS, &ChargeListAllExcept_DB_O, forbidden_edge_mask );
 2109|      0|            }
 2110|      0|            else
 2111|      0|            {
 2112|      0|                if (!bPossiblyIgnore || !num_known_endpoints && !num_wrong_neigh && ( num_acceptors_O + num_donors_O ) >= 3)
  ------------------
  |  Branch (2112:21): [True: 0, False: 0]
  |  Branch (2112:41): [True: 0, False: 0]
  |  Branch (2112:65): [True: 0, False: 0]
  |  Branch (2112:85): [True: 0, False: 0]
  ------------------
 2113|      0|                {
 2114|       |                    /* remove negative charges from the neighbors */
 2115|      0|                    pBNS->vert[i].st_edge.cap += num_donors; /* enough to make all bonds to donors double */
 2116|      0|                    pBNS->tot_st_cap += num_donors;
 2117|      0|                    pVA[i].cInitCharge -= num_donors; /* work no matter what are known charge/valence */
 2118|      0|                    for (j = 0; j < numMobileChargeNeigh; j++)
  ------------------
  |  Branch (2118:33): [True: 0, False: 0]
  ------------------
 2119|      0|                    {
 2120|      0|                        neigh = at2[i].neighbor[(int) MobileChargeNeigh[j]];
 2121|      0|                        pEdgeMinus = pBNS->edge + ( pVA[neigh].nCMinusGroupEdge - 1 );
 2122|      0|                        v1m = pEdgeMinus->neighbor1;
 2123|      0|                        v2m = pEdgeMinus->neighbor12 ^ v1m;
 2124|      0|                        pv1m = pBNS->vert + v1m;
 2125|      0|                        pv2m = pBNS->vert + v2m;
 2126|      0|                        delta = pEdgeMinus->flow;
 2127|      0|                        pv1m->st_edge.flow -= delta;
 2128|      0|                        pv2m->st_edge.flow -= delta;
 2129|      0|                        if (IS_BNS_VT_C_GR( pv1m->type ))
  ------------------
  |  |  106|      0|#define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   99|      0|#define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|      0|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  |  |  ------------------
  |  |  |  |               #define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|      0|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   77|      0|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  |  |  |  Branch (106:37): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2130|      0|                        {
 2131|       |                            /* irreversible change to ChargeStruct */
 2132|      0|                            pv1m->st_edge.cap -= delta;
 2133|      0|                        }
 2134|      0|                        else
 2135|      0|                        {
 2136|      0|                            if (IS_BNS_VT_C_GR( pv2m->type ))
  ------------------
  |  |  106|      0|#define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   99|      0|#define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|      0|#define BNS_VERT_TYPE_SUPER_TGROUP  0x0020
  |  |  |  |  ------------------
  |  |  |  |               #define BNS_VT_C_POS_ALL  (BNS_VERT_TYPE_SUPER_TGROUP | BNS_VERT_TYPE_C_GROUP)    /* supergroup (+) */
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|      0|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define IS_BNS_VT_C_GR(X)           (((X) & BNS_VT_C_POS_ALL) == BNS_VERT_TYPE_C_GROUP)
  |  |  ------------------
  |  |  |  |   77|      0|#define BNS_VERT_TYPE_C_GROUP       0x0010
  |  |  ------------------
  |  |  |  Branch (106:37): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2137|      0|                            {
 2138|       |                                /* irreversible change to ChargeStruct */
 2139|      0|                                pv2m->st_edge.cap -= delta;
 2140|      0|                            }
 2141|      0|                            else
 2142|      0|                            {
 2143|      0|                                ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 2144|      0|                                goto exit_function;
 2145|      0|                            }
 2146|      0|                        }
 2147|      0|                        pBNS->tot_st_cap -= delta;
 2148|      0|                        pBNS->tot_st_flow -= 2 * delta;
 2149|      0|                        pEdgeMinus->flow -= delta;
 2150|      0|                    }
 2151|      0|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 2152|      0|                    ( *pnNumRunBNS )++;
 2153|      0|                    if (ret < 0)
  ------------------
  |  Branch (2153:25): [True: 0, False: 0]
  ------------------
 2154|      0|                    {
 2155|      0|                        goto exit_function;
 2156|      0|                    }
 2157|      0|                    else
 2158|      0|                        if (ret == num_donors)
  ------------------
  |  Branch (2158:29): [True: 0, False: 0]
  ------------------
 2159|      0|                        {
 2160|      0|                            *pnTotalDelta += ret;
 2161|      0|                            num_success++;
 2162|       |                            /*pStruct->bExtract |= EXTRACT_STRUCT_NUMBER;*/
 2163|      0|                        }
 2164|      0|                        else
 2165|      0|                        {
 2166|      0|                            ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 2167|      0|                            goto exit_function;
 2168|      0|                        }
 2169|      0|                }
 2170|      0|            }
 2171|      0|        }
 2172|  3.65k|    }
 2173|    801|    if (ret_forbid_edges)
  ------------------
  |  Branch (2173:9): [True: 0, False: 801]
  ------------------
 2174|      0|    {
 2175|       |        /* remove the marks */
 2176|      0|        RemoveForbiddenBondFlowBits( pBNS, forbidden_edge_test );
 2177|      0|    }
 2178|    801|    ret = num_success;
 2179|       |
 2180|    801|exit_function:
 2181|       |
 2182|    801|    AllocEdgeList( &ChargeListAllExcept_DB_O, EDGE_LIST_FREE );
  ------------------
  |  |  271|    801|#define EDGE_LIST_FREE   (-2)
  ------------------
 2183|       |
 2184|    801|    return ret;
 2185|    801|}
MakeSingleBondsMetal2ChargedHeteroat:
 2202|    801|{
 2203|    801|    int i;
 2204|       |
 2205|    801|    int ret2, ret, pass;
 2206|    801|    int num_at = pStruct->num_atoms;
 2207|    801|    int num_deleted_H = pStruct->num_deleted_H;
 2208|    801|    int len_at = num_at + num_deleted_H;
 2209|    801|    int inv_forbidden_edge_mask = ~forbidden_edge_mask;
 2210|       |
 2211|    801|    int         j, k;
 2212|    801|    int        cur_num_edges;
 2213|    801|    BNS_EDGE  *e;
 2214|    801|    Vertex     v1, v2;
 2215|       |
 2216|    801|    EdgeIndex *pFixedEdges;
 2217|    801|    int        nNumEdgesToFix;
 2218|       |
 2219|    801|    ret = 0;
 2220|       |
 2221|       |    /* to simplify, prepare new at[] from pBNS */
 2222|    801|    memcpy( at2, at, len_at * sizeof( at2[0] ) );
 2223|    801|    pStruct->at = at2;
 2224|    801|    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 2225|    801|    pStruct->at = at;
 2226|    801|    if (ret2 < 0)
  ------------------
  |  Branch (2226:9): [True: 0, False: 801]
  ------------------
 2227|      0|    {
 2228|      0|        ret = ret2;
 2229|      0|        goto exit_function;
 2230|      0|    }
 2231|       |
 2232|    801|    pFixedEdges = NULL;
 2233|       |
 2234|    801|    nNumEdgesToFix = 0; /* cpunt nNumEdgesToFix only when pass==0 */
 2235|    801|    cur_num_edges = 0; /* count cur_num_edges  only when pass==1; at the end they must be equal */
 2236|  1.60k|    for (pass = 0; pass < 2; pass++)
  ------------------
  |  Branch (2236:20): [True: 1.60k, False: 0]
  ------------------
 2237|  1.60k|    {
 2238|  1.60k|        if (pass)
  ------------------
  |  Branch (2238:13): [True: 801, False: 801]
  ------------------
 2239|    801|        {
 2240|       |            /* 2nd pass: allocate edge storage */
 2241|    801|            if (!nNumEdgesToFix)
  ------------------
  |  Branch (2241:17): [True: 801, False: 0]
  ------------------
 2242|    801|            {
 2243|    801|                break; /* nothing to do */
 2244|    801|            }
 2245|      0|            pFixedEdges = (EdgeIndex *) inchi_malloc( nNumEdgesToFix * sizeof( pFixedEdges[0] ) );
  ------------------
  |  | 1130|      0|#define inchi_malloc   malloc
  ------------------
 2246|      0|            if (!pFixedEdges)
  ------------------
  |  Branch (2246:17): [True: 0, False: 0]
  ------------------
 2247|      0|            {
 2248|      0|                ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 2249|      0|                goto exit_function;
 2250|      0|            }
 2251|      0|        }
 2252|  4.46k|        for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (2252:21): [True: 3.65k, False: 801]
  ------------------
 2253|  3.65k|        {
 2254|  3.65k|            int neigh;
 2255|  3.65k|            if (pVA[i].cMetal)
  ------------------
  |  Branch (2255:17): [True: 1.94k, False: 1.71k]
  ------------------
 2256|  1.94k|            {
 2257|  1.94k|                for (j = 0; j < at2[i].valence; j++)
  ------------------
  |  Branch (2257:29): [True: 0, False: 1.94k]
  ------------------
 2258|      0|                {
 2259|      0|                    neigh = at2[i].neighbor[j];
 2260|      0|                    if (pVA[neigh].cNumValenceElectrons == 4 &&
  ------------------
  |  Branch (2260:25): [True: 0, False: 0]
  ------------------
 2261|      0|                         pVA[neigh].cPeriodicRowNumber == 1)
  ------------------
  |  Branch (2261:26): [True: 0, False: 0]
  ------------------
 2262|      0|                    {
 2263|      0|                        continue; /* ignore carbon */
 2264|      0|                    }
 2265|      0|                    if (at2[i].bond_type[j] > BOND_TYPE_SINGLE && at2[neigh].charge &&
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2265:25): [True: 0, False: 0]
  |  Branch (2265:67): [True: 0, False: 0]
  ------------------
 2266|      0|                         !pVA[neigh].cMetal && pVA[neigh].cnListIndex > 0)
  ------------------
  |  Branch (2266:26): [True: 0, False: 0]
  |  Branch (2266:48): [True: 0, False: 0]
  ------------------
 2267|      0|                    {
 2268|      0|                        int cnBits = at2[neigh].charge > 0 ? MAKE_CN_BITS( cn_bits_N, cn_bits_P, 0, 0 ) :
  ------------------
  |  |  449|      0|#define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  ------------------
  |  |  |  |  447|      0|#define cn_bits_shift 3
  |  |  ------------------
  |  |               #define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  ------------------
  |  |  |  |  447|      0|#define cn_bits_shift 3
  |  |  ------------------
  |  |               #define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  ------------------
  |  |  |  |  447|      0|#define cn_bits_shift 3
  |  |  ------------------
  ------------------
  |  Branch (2268:38): [True: 0, False: 0]
  ------------------
 2269|      0|                            MAKE_CN_BITS( cn_bits_N, cn_bits_M, 0, 0 );
  ------------------
  |  |  449|      0|#define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  ------------------
  |  |  |  |  447|      0|#define cn_bits_shift 3
  |  |  ------------------
  |  |               #define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  ------------------
  |  |  |  |  447|      0|#define cn_bits_shift 3
  |  |  ------------------
  |  |               #define MAKE_CN_BITS(A, B, C, D ) (( (( ((D) << cn_bits_shift | (C)) << cn_bits_shift ) | (B)) << cn_bits_shift ) | (A))
  |  |  ------------------
  |  |  |  |  447|      0|#define cn_bits_shift 3
  |  |  ------------------
  ------------------
 2270|      0|                        int atBits = cnList[pVA[neigh].cnListIndex - 1].bits;
 2271|      0|                        for (k = 0; k < MAX_NUM_CN_BITS - 1; k++, atBits >>= cn_bits_shift)
  ------------------
  |  |  448|      0|#define MAX_NUM_CN_BITS 4
  ------------------
                                      for (k = 0; k < MAX_NUM_CN_BITS - 1; k++, atBits >>= cn_bits_shift)
  ------------------
  |  |  447|      0|#define cn_bits_shift 3
  ------------------
  |  Branch (2271:37): [True: 0, False: 0]
  ------------------
 2272|      0|                        {
 2273|       |                            /* ??? */
 2274|      0|                            if (( atBits & cnBits ) == cnBits)
  ------------------
  |  Branch (2274:33): [True: 0, False: 0]
  ------------------
 2275|      0|                            {
 2276|      0|                                break;
 2277|      0|                            }
 2278|      0|                        }
 2279|      0|                        if (k == MAX_NUM_CN_BITS - 1)
  ------------------
  |  |  448|      0|#define MAX_NUM_CN_BITS 4
  ------------------
  |  Branch (2279:29): [True: 0, False: 0]
  ------------------
 2280|      0|                        {
 2281|      0|                            continue;
 2282|      0|                        }
 2283|      0|                        if (pass == 0)
  ------------------
  |  Branch (2283:29): [True: 0, False: 0]
  ------------------
 2284|      0|                        {
 2285|      0|                            nNumEdgesToFix++;
 2286|      0|                        }
 2287|      0|                        else
 2288|      0|                        {
 2289|      0|                            pFixedEdges[cur_num_edges++] = pBNS->vert[i].iedge[j];
 2290|      0|                        }
 2291|      0|                    }
 2292|      0|                }
 2293|  1.94k|            }
 2294|  3.65k|        }
 2295|    801|    }
 2296|       |
 2297|       |    /* restore the initial structures */
 2298|    801|    memcpy( at2, at, ( num_at + num_deleted_H ) * sizeof( at2[0] ) );
 2299|       |
 2300|    801|    if (nNumEdgesToFix && pFixedEdges)
  ------------------
  |  Branch (2300:9): [True: 0, False: 801]
  |  Branch (2300:27): [True: 0, False: 0]
  ------------------
 2301|      0|    {
 2302|      0|        if (nNumEdgesToFix != cur_num_edges)
  ------------------
  |  Branch (2302:13): [True: 0, False: 0]
  ------------------
 2303|      0|        {
 2304|      0|            ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 2305|      0|            goto exit_function;
 2306|      0|        }
 2307|       |        /* change edge flow, fix the edges, and run BNS */
 2308|      0|        for (i = 0; i < nNumEdgesToFix; i++)
  ------------------
  |  Branch (2308:21): [True: 0, False: 0]
  ------------------
 2309|      0|        {
 2310|      0|            e = pBNS->edge + pFixedEdges[i];
 2311|      0|            v1 = e->neighbor1;
 2312|      0|            v2 = e->neighbor12 ^ v1;
 2313|      0|            e->flow--;
 2314|      0|            e->forbidden |= forbidden_edge_mask;
 2315|      0|            pBNS->vert[v1].st_edge.flow--;
 2316|      0|            pBNS->vert[v2].st_edge.flow--;
 2317|      0|            pBNS->tot_st_flow -= 2;
 2318|      0|            ( *pnTotalDelta ) -= 2;
 2319|      0|        }
 2320|       |        /* Run BNS allowing to change any charges */
 2321|      0|        ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 2322|      0|        ( *pnNumRunBNS )++;
 2323|      0|        if (ret < 0)
  ------------------
  |  Branch (2323:13): [True: 0, False: 0]
  ------------------
 2324|      0|        {
 2325|      0|            goto exit_function;
 2326|      0|        }
 2327|      0|        else
 2328|      0|        {
 2329|      0|            ( *pnTotalDelta ) += ret;
 2330|      0|        }
 2331|       |        /* unfix the edges */
 2332|      0|        for (i = 0; i < nNumEdgesToFix; i++)
  ------------------
  |  Branch (2332:21): [True: 0, False: 0]
  ------------------
 2333|      0|        {
 2334|      0|            e = pBNS->edge + pFixedEdges[i];
 2335|      0|            e->forbidden &= inv_forbidden_edge_mask;
 2336|      0|        }
 2337|      0|        if (ret < 2 * nNumEdgesToFix)
  ------------------
  |  Branch (2337:13): [True: 0, False: 0]
  ------------------
 2338|      0|        {
 2339|       |            /* not all fixes succeeded */
 2340|      0|            ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 2341|      0|            ( *pnNumRunBNS )++;
 2342|      0|            if (ret < 0)
  ------------------
  |  Branch (2342:17): [True: 0, False: 0]
  ------------------
 2343|      0|            {
 2344|      0|                goto exit_function;
 2345|      0|            }
 2346|      0|            else
 2347|      0|            {
 2348|      0|                ( *pnTotalDelta ) += ret;
 2349|      0|            }
 2350|      0|        }
 2351|      0|    }
 2352|    801|    if (pFixedEdges)
  ------------------
  |  Branch (2352:9): [True: 0, False: 801]
  ------------------
 2353|      0|    {
 2354|      0|        inchi_free( pFixedEdges );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2355|      0|        pFixedEdges = NULL;
 2356|      0|    }
 2357|       |
 2358|    801|exit_function:
 2359|       |
 2360|    801|    return ret;
 2361|    801|}
SaltBondsToCoordBonds:
 2380|    801|{
 2381|    801|    int i;
 2382|       |
 2383|    801|    int ret2, ret, cur_success;
 2384|    801|    int num_at = pStruct->num_atoms;
 2385|    801|    int num_edges = pBNS->num_bonds + 2 * pBNS->num_atoms;
 2386|    801|    int num_deleted_H = pStruct->num_deleted_H;
 2387|    801|    int len_at = num_at + num_deleted_H;
 2388|    801|    int inv_forbidden_edge_mask = ~forbidden_edge_mask;
 2389|    801|    EDGE_LIST AllChargeEdges;
 2390|       |
 2391|    801|    int         j, k, n;
 2392|    801|    BNS_EDGE  *pe, *pePlusMetal, *peMinusO;
 2393|    801|    BNS_VERTEX *pv1, *pv2, *pvO, *pvM;
 2394|    801|    Vertex     v1, v2, vPlusMinus;
 2395|       |
 2396|    801|    EdgeIndex  ie, iePlusMetal, ieMinusO;
 2397|       |
 2398|    801|    Vertex     vPathStart, vPathEnd;
 2399|    801|    int        delta, nPathLen, nDeltaH, nDeltaCharge, nNumVisitedAtoms;
 2400|       |
 2401|    801|    ret = 0;
 2402|    801|    cur_success = 0;
 2403|    801|    AllocEdgeList( &AllChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|    801|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 2404|       |
 2405|    801|    if (pStruct->iInchiRec == INCHI_BAS || !pStruct->pSrm->bMetalAddFlower || pStruct->pSrm->nMetalMinBondOrder)
  ------------------
  |  |  575|  1.60k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (2405:9): [True: 801, False: 0]
  |  Branch (2405:44): [True: 0, False: 0]
  |  Branch (2405:79): [True: 0, False: 0]
  ------------------
 2406|    801|    {
 2407|    801|        goto exit_function;
 2408|    801|    }
 2409|       |
 2410|       |    /* to simplify, prepare new at[] from pBNS */
 2411|      0|    memcpy( at2, at, len_at * sizeof( at2[0] ) );
 2412|      0|    pStruct->at = at2;
 2413|      0|    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 2414|      0|    pStruct->at = at;
 2415|      0|    if (ret2 < 0)
  ------------------
  |  Branch (2415:9): [True: 0, False: 0]
  ------------------
 2416|      0|    {
 2417|      0|        ret = ret2;
 2418|      0|        goto exit_function;
 2419|      0|    }
 2420|      0|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (2420:17): [True: 0, False: 0]
  ------------------
 2421|      0|    {
 2422|      0|        if (bIsMetalSalt( at2, i ))
  ------------------
  |  Branch (2422:13): [True: 0, False: 0]
  ------------------
 2423|      0|        {
 2424|      0|            if (!AllChargeEdges.num_edges)
  ------------------
  |  Branch (2424:17): [True: 0, False: 0]
  ------------------
 2425|      0|            {
 2426|       |                /*--------- one-time action: fix all bonds, charges, taut. group edges ------------*/
 2427|      0|                for (j = 0; j < num_at; j++)
  ------------------
  |  Branch (2427:29): [True: 0, False: 0]
  ------------------
 2428|      0|                {
 2429|       |                    /* all bonds */
 2430|      0|                    for (k = 0; k < at2[j].valence; k++)
  ------------------
  |  Branch (2430:33): [True: 0, False: 0]
  ------------------
 2431|      0|                    {
 2432|      0|                        n = at2[j].neighbor[k];
 2433|      0|                        if (n < j && !pBNS->edge[ie = pBNS->vert[j].iedge[k]].forbidden &&
  ------------------
  |  Branch (2433:29): [True: 0, False: 0]
  |  Branch (2433:38): [True: 0, False: 0]
  ------------------
 2434|      0|                            ( ret = AddToEdgeList( &AllChargeEdges, ie, num_edges ) ))
  ------------------
  |  Branch (2434:29): [True: 0, False: 0]
  ------------------
 2435|      0|                        {
 2436|      0|                            goto exit_function;
 2437|      0|                        }
 2438|      0|                    }
 2439|       |                    /* charge edges */
 2440|      0|                    if (( ie = pVA[j].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[ie].forbidden &&
  ------------------
  |  Branch (2440:25): [True: 0, False: 0]
  |  Branch (2440:70): [True: 0, False: 0]
  ------------------
 2441|      0|                        ( ret = AddToEdgeList( &AllChargeEdges, ie, num_edges ) ))
  ------------------
  |  Branch (2441:25): [True: 0, False: 0]
  ------------------
 2442|      0|                    {
 2443|      0|                        goto exit_function;
 2444|      0|                    }
 2445|      0|                    if (( ie = pVA[j].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[ie].forbidden &&
  ------------------
  |  Branch (2445:25): [True: 0, False: 0]
  |  Branch (2445:69): [True: 0, False: 0]
  ------------------
 2446|      0|                        ( ret = AddToEdgeList( &AllChargeEdges, ie, num_edges ) ))
  ------------------
  |  Branch (2446:25): [True: 0, False: 0]
  ------------------
 2447|      0|                    {
 2448|      0|                        goto exit_function;
 2449|      0|                    }
 2450|      0|                }
 2451|       |                /* taut group edges */
 2452|      0|                for (j = 0; j < pTCGroups->num_tgroups; j++)
  ------------------
  |  Branch (2452:29): [True: 0, False: 0]
  ------------------
 2453|      0|                {
 2454|      0|                    pv1 = pBNS->vert + ( v1 = pTCGroups->pTCG[j].nVertexNumber ); /* t-group vertex */
 2455|      0|                    for (k = 0; k < pv1->num_adj_edges; k++)
  ------------------
  |  Branch (2455:33): [True: 0, False: 0]
  ------------------
 2456|      0|                    {
 2457|       |                        /* ie, pe - tautomeric atom edge; pv2 - endpoint vertex */
 2458|       |                        /* Note: pe, pv2, v1 are not used here; they are to show how to traverse t-group */
 2459|      0|                        pv2 = pBNS->vert + ( pe = pBNS->edge + ( ie = pv1->iedge[k] ) )->neighbor1;
 2460|      0|                        if (ret = AddToEdgeList( &AllChargeEdges, ie, num_edges ))
  ------------------
  |  Branch (2460:29): [True: 0, False: 0]
  ------------------
 2461|      0|                        {
 2462|      0|                            goto exit_function;
 2463|      0|                        }
 2464|      0|                    }
 2465|      0|                }
 2466|       |                /*---------------------------------------------------------------*/
 2467|      0|            }
 2468|       |            /* replace all single bonds to neutral neighbors with zero-order bonds
 2469|       |               allow neighbor charge change to (-1) and metal atom charge increment +1 */
 2470|      0|            for (k = 0; k < at2[i].valence; k++)
  ------------------
  |  Branch (2470:25): [True: 0, False: 0]
  ------------------
 2471|      0|            {
 2472|      0|                n = at2[i].neighbor[k];
 2473|      0|                pe = pBNS->edge + pBNS->vert[i].iedge[k];
 2474|      0|                if (at2[n].charge || at2[i].bond_type[k] != BOND_TYPE_SINGLE)
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (2474:21): [True: 0, False: 0]
  |  Branch (2474:38): [True: 0, False: 0]
  ------------------
 2475|      0|                {
 2476|      0|                    continue;
 2477|      0|                }
 2478|      0|                iePlusMetal = pVA[i].nCPlusGroupEdge - 1;
 2479|      0|                ieMinusO = pVA[n].nCMinusGroupEdge - 1;
 2480|       |
 2481|      0|                if (pe->flow != 1 || pe->forbidden || iePlusMetal < 0)
  ------------------
  |  Branch (2481:21): [True: 0, False: 0]
  |  Branch (2481:38): [True: 0, False: 0]
  |  Branch (2481:55): [True: 0, False: 0]
  ------------------
 2482|      0|                {
 2483|      0|                    continue;
 2484|      0|                }
 2485|      0|                pePlusMetal = pBNS->edge + iePlusMetal;
 2486|      0|                if (pePlusMetal->flow <= 0)
  ------------------
  |  Branch (2486:21): [True: 0, False: 0]
  ------------------
 2487|      0|                {
 2488|      0|                    continue; /* to add (+) to metal this flow must be decremented */
 2489|      0|                }
 2490|      0|                if (ieMinusO >= 0)
  ------------------
  |  Branch (2490:21): [True: 0, False: 0]
  ------------------
 2491|      0|                {
 2492|       |                    /* usually does not happen */
 2493|      0|                    peMinusO = pBNS->edge + ieMinusO;
 2494|       |
 2495|      0|                    if (peMinusO->flow || pePlusMetal->forbidden || peMinusO->forbidden)
  ------------------
  |  Branch (2495:25): [True: 0, False: 0]
  |  Branch (2495:43): [True: 0, False: 0]
  |  Branch (2495:69): [True: 0, False: 0]
  ------------------
 2496|      0|                    {
 2497|      0|                        continue;
 2498|      0|                    }
 2499|       |
 2500|       |                    /* decrement bond order to 0 */
 2501|      0|                    delta = 1;
 2502|      0|                    pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 2503|      0|                    pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 2504|       |
 2505|      0|                    pe->flow -= delta;
 2506|      0|                    pv1->st_edge.flow -= delta;
 2507|      0|                    pv2->st_edge.flow -= delta;
 2508|      0|                    pBNS->tot_st_flow -= 2 * delta;
 2509|       |
 2510|      0|                    SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 2511|      0|                    pePlusMetal->forbidden &= inv_forbidden_edge_mask;
 2512|      0|                    peMinusO->forbidden &= inv_forbidden_edge_mask;
 2513|       |
 2514|      0|                    ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 2515|      0|                                          &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 2516|       |
 2517|      0|                    if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (2517:25): [True: 0, False: 0]
  |  Branch (2517:39): [True: 0, False: 0]
  |  Branch (2517:57): [True: 0, False: 0]
  ------------------
 2518|      0|                        vPathEnd == v2 && vPathStart == v1 ) /*&& nDeltaCharge > 0*/)
  ------------------
  |  Branch (2518:25): [True: 0, False: 0]
  |  Branch (2518:43): [True: 0, False: 0]
  ------------------
 2519|      0|                    {
 2520|       |                        /* (+)charge was just moved, no change in number of charges */
 2521|      0|                        ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 2522|      0|                        if (ret > 0)
  ------------------
  |  Branch (2522:29): [True: 0, False: 0]
  ------------------
 2523|      0|                        {
 2524|      0|                            ( *pnNumRunBNS )++;
 2525|      0|                            cur_success++; /* 01 */
 2526|      0|                        }
 2527|      0|                    }
 2528|      0|                    else
 2529|      0|                    {
 2530|      0|                        pe->flow += delta; /* roll back */
 2531|      0|                        pv1->st_edge.flow += delta;
 2532|      0|                        pv2->st_edge.flow += delta;
 2533|      0|                        pBNS->tot_st_flow += 2 * delta;
 2534|      0|                    }
 2535|      0|                    RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 2536|      0|                }
 2537|      0|                else
 2538|      0|                {
 2539|      0|                    if (NO_VERTEX != ( vPlusMinus = GetPlusMinusVertex( pBNS, pTCGroups, 1, 1 ) ))
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (2539:25): [True: 0, False: 0]
  ------------------
 2540|      0|                    {
 2541|       |                        /* manually add (-) charge to O and (+) charge to metal */
 2542|       |                        /* decrement bond order to 0 */
 2543|       |                        /*---------------------------------------------------------------------------*/
 2544|       |                        /*                                                                           */
 2545|       |                        /*      (+/-)*               (+/-)           Result:                         */
 2546|       |                        /*        |                    ||                                            */
 2547|       |                        /*        |                    ||            - Added (+) to M                */
 2548|       |                        /*       (+)super             (+)super       - Incremented bond M-O          */
 2549|       |                        /*        ||                   |                                             */
 2550|       |                        /*        ||          =>       |             To make this attachment H,      */
 2551|       |                        /*       (Y)                  (Y)            increment                       */
 2552|       |                        /*        |                    ||            pTCGroups->pTCG[itg].tg_num_H   */
 2553|       |                        /*        |                    ||                                            */
 2554|       |                        /*       (+)metal             (+)hetero      Technical details:              */
 2555|       |                        /*         \\                   \            increase capacities of          */
 2556|       |                        /*           M                    M(+)       edges to (+/-) otherwise        */
 2557|       |                        /*           |                    ||         flow may not be able to         */
 2558|       |                        /*          -O*                -O-O          increase                        */
 2559|       |                        /*                                                                           */
 2560|       |                        /*   After that change M=O bond order from 2 to 0                            */
 2561|       |                        /*---------------------------------------------------------------------------*/
 2562|      0|                        int i1, j1, k1;
 2563|      0|                        delta = 1;
 2564|      0|                        pvO = pBNS->vert + n;
 2565|      0|                        pvM = pBNS->vert + i;
 2566|       |                        /* Increment st_edge.cap on (+/-) vertex */
 2567|      0|                        pBNS->vert[vPlusMinus].st_edge.cap += delta;
 2568|       |                        /* Increment st_edge.cap on O */
 2569|      0|                        pvO->st_edge.cap += delta;
 2570|       |                        /* increment cap on M-O edge */
 2571|      0|                        pe->cap += delta;
 2572|       |                        /* total cap count */
 2573|      0|                        pBNS->tot_st_cap += 2 * delta;
 2574|       |
 2575|      0|                        v1 = vPlusMinus;
 2576|      0|                        v2 = n; /* atom O */
 2577|       |
 2578|       |                        /* increase capacities of edges to Y  */
 2579|      0|                        for (i1 = 0; i1 < pBNS->vert[vPlusMinus].num_adj_edges; i1++)
  ------------------
  |  Branch (2579:38): [True: 0, False: 0]
  ------------------
 2580|      0|                        {
 2581|      0|                            j1 = pBNS->edge[pBNS->vert[vPlusMinus].iedge[i1]].neighbor12 ^ vPlusMinus;
 2582|      0|                            for (k1 = 0; k1 < pBNS->vert[j1].num_adj_edges; k1++)
  ------------------
  |  Branch (2582:42): [True: 0, False: 0]
  ------------------
 2583|      0|                            {
 2584|      0|                                pBNS->edge[pBNS->vert[j1].iedge[k1]].cap += delta;
 2585|      0|                            }
 2586|      0|                        }
 2587|      0|                        SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 2588|      0|                        pePlusMetal->forbidden &= inv_forbidden_edge_mask;
 2589|      0|                        pe->forbidden &= inv_forbidden_edge_mask;
 2590|       |
 2591|      0|                        ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 2592|      0|                                              &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 2593|      0|                        cur_success = 0;
 2594|      0|                        if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (2594:29): [True: 0, False: 0]
  |  Branch (2594:43): [True: 0, False: 0]
  |  Branch (2594:61): [True: 0, False: 0]
  ------------------
 2595|      0|                                          vPathEnd == v2 && vPathStart == v1 ) /*&& nDeltaCharge == 1*/)
  ------------------
  |  Branch (2595:43): [True: 0, False: 0]
  |  Branch (2595:61): [True: 0, False: 0]
  ------------------
 2596|      0|                        {
 2597|       |                            /* Added (+)charge to -N< => nDeltaCharge == 1 */
 2598|       |                            /* Flow change on pe (-)charge edge (atom B-O(-)) is not known to RunBnsTestOnce()) */
 2599|      0|                            ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 2600|      0|                            if (ret > 0)
  ------------------
  |  Branch (2600:33): [True: 0, False: 0]
  ------------------
 2601|      0|                            {
 2602|      0|                                ( *pnNumRunBNS )++;
 2603|      0|                                cur_success++; /* 01 */
 2604|      0|                            }
 2605|      0|                        }
 2606|      0|                        if (cur_success)
  ------------------
  |  Branch (2606:29): [True: 0, False: 0]
  ------------------
 2607|      0|                        {
 2608|       |                            /* set bond M=O order = 0 */
 2609|      0|                            if (pe->flow != 2 * delta)
  ------------------
  |  Branch (2609:33): [True: 0, False: 0]
  ------------------
 2610|      0|                            {
 2611|      0|                                ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 2612|      0|                                goto exit_function;
 2613|      0|                            }
 2614|       |                            /* reduce pe bond order by 2*delta */
 2615|      0|                            pe->flow -= 2 * delta;
 2616|      0|                            pvO->st_edge.cap -= 2 * delta;
 2617|      0|                            pvO->st_edge.flow -= 2 * delta;
 2618|      0|                            pvM->st_edge.flow -= 2 * delta;
 2619|      0|                            pvM->st_edge.cap -= 2 * delta;
 2620|      0|                            pBNS->tot_st_cap -= 3 * delta;
 2621|      0|                            pBNS->tot_st_flow -= 4 * delta;
 2622|       |                            /* fix M-O bond order to zero */
 2623|      0|                            pe->cap -= 2 * delta;
 2624|       |                            /* add fixed (-) charge to O */
 2625|      0|                            pVA[n].cInitCharge -= delta;
 2626|      0|                        }
 2627|      0|                        else
 2628|      0|                        {
 2629|       |                            /* failed */
 2630|      0|                            pBNS->vert[vPlusMinus].st_edge.cap -= delta;
 2631|      0|                            pvO->st_edge.cap -= delta;
 2632|       |                            /*pTCGroups->pTCG[itg].edges_cap     -= delta;*/ /* ???bug??? - commented out 2006-03-22 */
 2633|      0|                            pBNS->tot_st_cap -= 2 * delta;
 2634|       |                            /* decrease capacities of edges to Y  */
 2635|      0|                            for (i1 = 0; i1 < pBNS->vert[vPlusMinus].num_adj_edges; i1++)
  ------------------
  |  Branch (2635:42): [True: 0, False: 0]
  ------------------
 2636|      0|                            {
 2637|      0|                                j1 = pBNS->edge[pBNS->vert[vPlusMinus].iedge[i1]].neighbor12 ^ vPlusMinus;
 2638|      0|                                for (k1 = 0; k1 < pBNS->vert[j1].num_adj_edges; k1++)
  ------------------
  |  Branch (2638:46): [True: 0, False: 0]
  ------------------
 2639|      0|                                {
 2640|      0|                                    pBNS->edge[pBNS->vert[j1].iedge[k1]].cap -= delta;
 2641|      0|                                }
 2642|      0|                            }
 2643|      0|                        }
 2644|      0|                        RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 2645|      0|                    }
 2646|      0|                }
 2647|      0|            }
 2648|      0|        }
 2649|      0|    }
 2650|       |
 2651|    801|exit_function:
 2652|       |
 2653|    801|    AllocEdgeList( &AllChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|    801|#define EDGE_LIST_FREE   (-2)
  ------------------
 2654|       |
 2655|    801|    return ret;
 2656|      0|}
RunBnsRestore1:
 2749|    801|{
 2750|    801|    int        nNumRunBNS = 0;
 2751|       |
 2752|    801|    EDGE_LIST CarbonChargeEdges, MetalCarbonEdges, Nplus2BondsEdges;
 2753|       |
 2754|    801|    int nTotalDelta = 0, ret = 0, tot_num_fixes;
 2755|    801|    inp_ATOM *at = pStruct->at;
 2756|    801|    inp_ATOM *at2 = NULL; /* restored structure */
 2757|    801|    inp_ATOM *at3 = NULL; /* structure for calculating one InChI */
 2758|    801|    int     num_at = pStruct->num_atoms;
 2759|    801|    int     num_deleted_H = pStruct->num_deleted_H;
 2760|       |#ifdef _DEBUG
 2761|       |    int ret2;
 2762|       |#endif
 2763|       |
 2764|       |#if ( KEEP_METAL_EDGE_FLOW == 1 )
 2765|       |    BNS_VERTEX *pVert, *pNeigh;
 2766|       |    int         j, neigh;
 2767|       |#endif
 2768|       |
 2769|       |    /* Edge lists initialization */
 2770|    801|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|    801|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 2771|    801|    AllocEdgeList( &MetalCarbonEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|    801|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 2772|    801|    AllocEdgeList( &Nplus2BondsEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|    801|#define EDGE_LIST_CLEAR  (-1)
  ------------------
 2773|       |
 2774|    801|    if (pStruct->iMobileH == TAUT_NON &&
  ------------------
  |  |  579|  1.60k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (2774:9): [True: 5, False: 796]
  ------------------
 2775|    801|        ( ret = FillOutExtraFixedHDataInChI( pStruct, pInChI ) ))
  ------------------
  |  Branch (2775:9): [True: 0, False: 5]
  ------------------
 2776|      0|    {
 2777|      0|        goto exit_function;
 2778|      0|    }
 2779|       |
 2780|    801|    if (!at2 && !( at2 = (inp_ATOM *) inchi_malloc( ( num_at + num_deleted_H ) * sizeof( at2[0] ) ) ) ||
  ------------------
  |  | 1130|    801|#define inchi_malloc   malloc
  ------------------
  |  Branch (2780:9): [True: 801, False: 0]
  |  Branch (2780:17): [True: 0, False: 801]
  ------------------
 2781|    801|         !at3 && !( at3 = (inp_ATOM *) inchi_malloc( ( num_at + num_deleted_H ) * sizeof( at3[0] ) ) ))
  ------------------
  |  | 1130|    801|#define inchi_malloc   malloc
  ------------------
  |  Branch (2781:10): [True: 801, False: 0]
  |  Branch (2781:18): [True: 0, False: 801]
  ------------------
 2782|      0|    {
 2783|      0|        return RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 2784|      0|    }
 2785|       |
 2786|    801|    if (0 > ( ret = ForbidCarbonChargeEdges( pBNS, pTCGroups, &CarbonChargeEdges, BNS_EDGE_FORBIDDEN_TEMP ) ))
  ------------------
  |  |   68|    801|#define BNS_EDGE_FORBIDDEN_TEMP  2
  ------------------
  |  Branch (2786:9): [True: 0, False: 801]
  ------------------
 2787|      0|    {
 2788|      0|        goto exit_function;
 2789|      0|    }
 2790|       |
 2791|       |#if ( KEEP_METAL_EDGE_FLOW == 1 )
 2792|       |    /* count edges of -C(IV)< carbons connected to metals */
 2793|       |    if (0 > ( ret = ForbidMetalCarbonEdges( pBNS, at, num_at, pVA, pTCGroups, &MetalCarbonEdges, BNS_EDGE_FORBIDDEN_TEMP ) ))
 2794|       |    {
 2795|       |        goto exit_function;
 2796|       |    }
 2797|       |#endif
 2798|    801|    if (0 > ( ret = ForbidNintrogenPlus2BondsInSmallRings( pBNS, at, num_at, pVA, 6,
  ------------------
  |  Branch (2798:9): [True: 0, False: 801]
  ------------------
 2799|    801|        pTCGroups, &Nplus2BondsEdges, BNS_EDGE_FORBIDDEN_TEMP ) ))
  ------------------
  |  |   68|    801|#define BNS_EDGE_FORBIDDEN_TEMP  2
  ------------------
 2800|      0|    {
 2801|      0|        goto exit_function;
 2802|      0|    }
 2803|       |
 2804|       |    /*********** Run BNS #1: no charge on carbons and =N= ***************/
 2805|    801|    if (Nplus2BondsEdges.num_edges)
  ------------------
  |  Branch (2805:9): [True: 0, False: 801]
  ------------------
 2806|      0|    {
 2807|       |        /* Run BNS leaving carbon charges unchanged */
 2808|      0|        ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 2809|      0|        nNumRunBNS++;
 2810|      0|        if (ret < 0)
  ------------------
  |  Branch (2810:13): [True: 0, False: 0]
  ------------------
 2811|      0|        {
 2812|      0|            goto exit_function;
 2813|      0|        }
 2814|      0|        else
 2815|      0|        {
 2816|      0|            nTotalDelta += ret;
 2817|      0|        }
 2818|      0|        RemoveForbiddenEdgeMask( pBNS, &Nplus2BondsEdges, BNS_EDGE_FORBIDDEN_TEMP );
  ------------------
  |  |   68|      0|#define BNS_EDGE_FORBIDDEN_TEMP  2
  ------------------
 2819|      0|        AllocEdgeList( &Nplus2BondsEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|      0|#define EDGE_LIST_FREE   (-2)
  ------------------
 2820|      0|    }
 2821|       |#ifdef _DEBUG
 2822|       |    /* debug only */
 2823|       |    memcpy( at2, at, ( pStruct->num_atoms + pStruct->num_deleted_H ) * sizeof( at2[0] ) );
 2824|       |    pStruct->at = at2;
 2825|       |    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 2826|       |    pStruct->at = at;
 2827|       |#endif
 2828|       |    /*************************** extend min ring size to 8 ****************************/
 2829|    801|    if (0 > ( ret = ForbidNintrogenPlus2BondsInSmallRings( pBNS, at, num_at, pVA, 8,
  ------------------
  |  Branch (2829:9): [True: 0, False: 801]
  ------------------
 2830|    801|        pTCGroups, &Nplus2BondsEdges, BNS_EDGE_FORBIDDEN_TEMP ) ))
  ------------------
  |  |   68|    801|#define BNS_EDGE_FORBIDDEN_TEMP  2
  ------------------
 2831|      0|    {
 2832|      0|        goto exit_function;
 2833|      0|    }
 2834|    801|    if (Nplus2BondsEdges.num_edges)
  ------------------
  |  Branch (2834:9): [True: 0, False: 801]
  ------------------
 2835|      0|    {
 2836|       |        /* Run BNS leaving carbon charges unchanged */
 2837|      0|        ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 2838|      0|        nNumRunBNS++;
 2839|      0|        if (ret < 0)
  ------------------
  |  Branch (2839:13): [True: 0, False: 0]
  ------------------
 2840|      0|        {
 2841|      0|            goto exit_function;
 2842|      0|        }
 2843|      0|        else
 2844|      0|        {
 2845|      0|            nTotalDelta += ret;
 2846|      0|        }
 2847|      0|        RemoveForbiddenEdgeMask( pBNS, &Nplus2BondsEdges, BNS_EDGE_FORBIDDEN_TEMP );
  ------------------
  |  |   68|      0|#define BNS_EDGE_FORBIDDEN_TEMP  2
  ------------------
 2848|      0|        AllocEdgeList( &Nplus2BondsEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|      0|#define EDGE_LIST_FREE   (-2)
  ------------------
 2849|      0|    }
 2850|       |#ifdef _DEBUG
 2851|       |    /* debug only */
 2852|       |    memcpy( at2, at, ( pStruct->num_atoms + pStruct->num_deleted_H ) * sizeof( at2[0] ) );
 2853|       |    pStruct->at = at2;
 2854|       |    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 2855|       |    pStruct->at = at;
 2856|       |#endif
 2857|       |    /*******************************************************************/
 2858|    801|    if (CarbonChargeEdges.num_edges > 0)
  ------------------
  |  Branch (2858:9): [True: 3, False: 798]
  ------------------
 2859|      3|    {
 2860|       |        /* Run BNS leaving carbon charges unchanged */
 2861|      3|        ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 2862|      3|        nNumRunBNS++;
 2863|      3|        if (ret < 0)
  ------------------
  |  Branch (2863:13): [True: 0, False: 3]
  ------------------
 2864|      0|        {
 2865|      0|            goto exit_function;
 2866|      0|        }
 2867|      3|        else
 2868|      3|        {
 2869|      3|            nTotalDelta += ret;
 2870|      3|        }
 2871|      3|        RemoveForbiddenEdgeMask( pBNS, &CarbonChargeEdges, BNS_EDGE_FORBIDDEN_TEMP );
  ------------------
  |  |   68|      3|#define BNS_EDGE_FORBIDDEN_TEMP  2
  ------------------
 2872|      3|        AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|      3|#define EDGE_LIST_FREE   (-2)
  ------------------
 2873|      3|    }
 2874|       |#ifdef _DEBUG
 2875|       |    /* debug only */
 2876|       |    memcpy( at2, at, ( pStruct->num_atoms + pStruct->num_deleted_H ) * sizeof( at2[0] ) );
 2877|       |    pStruct->at = at2;
 2878|       |    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 2879|       |    pStruct->at = at;
 2880|       |#endif
 2881|       |    /*******************************************************************/
 2882|    801|    if (MetalCarbonEdges.num_edges > 0)
  ------------------
  |  Branch (2882:9): [True: 0, False: 801]
  ------------------
 2883|      0|    {
 2884|       |        /* Run BNS leaving carbon charges unchanged */
 2885|      0|        ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 2886|      0|        nNumRunBNS++;
 2887|      0|        if (ret < 0)
  ------------------
  |  Branch (2887:13): [True: 0, False: 0]
  ------------------
 2888|      0|        {
 2889|      0|            goto exit_function;
 2890|      0|        }
 2891|      0|        else
 2892|      0|        {
 2893|      0|            nTotalDelta += ret;
 2894|      0|        }
 2895|      0|        RemoveForbiddenEdgeMask( pBNS, &MetalCarbonEdges, BNS_EDGE_FORBIDDEN_TEMP );
  ------------------
  |  |   68|      0|#define BNS_EDGE_FORBIDDEN_TEMP  2
  ------------------
 2896|      0|        AllocEdgeList( &MetalCarbonEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|      0|#define EDGE_LIST_FREE   (-2)
  ------------------
 2897|      0|    }
 2898|       |    /*******************************************************************/
 2899|       |    /* Run BNS allowing to change any charges */
 2900|    801|    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 2901|    801|    nNumRunBNS++;
 2902|    801|    if (ret < 0)
  ------------------
  |  Branch (2902:9): [True: 0, False: 801]
  ------------------
 2903|      0|    {
 2904|      0|        goto exit_function;
 2905|      0|    }
 2906|    801|    else
 2907|    801|    {
 2908|    801|        nTotalDelta += ret;
 2909|    801|    }
 2910|       |#ifdef _DEBUG
 2911|       |    /* debug only */
 2912|       |    memcpy( at2, at, ( pStruct->num_atoms + pStruct->num_deleted_H ) * sizeof( at2[0] ) );
 2913|       |    pStruct->at = at2;
 2914|       |    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 2915|       |    pStruct->at = at;
 2916|       |#endif
 2917|       |
 2918|    801|#if ( BNS_RAD_SEARCH == 1 )
 2919|       |    /****************************************************************************/
 2920|       |    /* move unfulfilled 'radicals' from ChargeStruct to atoms         */
 2921|       |    /* and set change charges of affected atoms to fit total charge   */
 2922|    801|    ret = MoveRadToAtomsAddCharges( pBNS, pBD, pStruct, at, at2, pVA, pTCGroups, BNS_EDGE_FORBIDDEN_TEMP );
  ------------------
  |  |   68|    801|#define BNS_EDGE_FORBIDDEN_TEMP  2
  ------------------
 2923|    801|    if (ret < 0)
  ------------------
  |  Branch (2923:9): [True: 0, False: 801]
  ------------------
 2924|      0|    {
 2925|      0|        goto exit_function;
 2926|      0|    }
 2927|    801|#endif
 2928|       |    /**************************************************************/
 2929|       |    /**************************************************************/
 2930|       |    /*****           fix restore inconsistencies              *****/
 2931|       |    /**************************************************************/
 2932|       |    /**************************************************************/
 2933|       |#ifdef _DEBUG
 2934|       |    /* debug only */
 2935|       |    memcpy( at2, at, ( pStruct->num_atoms + pStruct->num_deleted_H ) * sizeof( at2[0] ) );
 2936|       |    pStruct->at = at2;
 2937|       |    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 2938|       |    pStruct->at = at;
 2939|       |#endif
 2940|       |
 2941|       |    /* rearrange (+) and (-) edges flow so that there is no (+)flow=0 and (-)flow=1 */
 2942|    801|    ret = RearrangePlusMinusEdgesFlow( pBNS, pBD, pVA, pTCGroups, BNS_EDGE_FORBIDDEN_TEMP );
  ------------------
  |  |   68|    801|#define BNS_EDGE_FORBIDDEN_TEMP  2
  ------------------
 2943|    801|    if (ret < 0)
  ------------------
  |  Branch (2943:9): [True: 0, False: 801]
  ------------------
 2944|      0|    {
 2945|      0|        goto exit_function;
 2946|      0|    }
 2947|       |
 2948|       |    /*****************************************************************/
 2949|       |    /*       Increment zero order metal bonds to heteroatoms         */
 2950|       |    /*****************************************************************/
 2951|    801|    ret = IncrementZeroOrderBondsToHeteroat( pBNS, pBD, pStruct, at, at2, pVA, pTCGroups,
 2952|    801|                                             &nNumRunBNS, &nTotalDelta, BNS_EDGE_FORBIDDEN_TEMP );
  ------------------
  |  |   68|    801|#define BNS_EDGE_FORBIDDEN_TEMP  2
  ------------------
 2953|    801|    if (ret < 0)
  ------------------
  |  Branch (2953:9): [True: 0, False: 801]
  ------------------
 2954|      0|    {
 2955|      0|        goto exit_function;
 2956|      0|    }
 2957|       |
 2958|       |#ifdef _DEBUG
 2959|       |    /* debug only */
 2960|       |    memcpy( at2, at, ( pStruct->num_atoms + pStruct->num_deleted_H ) * sizeof( at2[0] ) );
 2961|       |    pStruct->at = at2;
 2962|       |    ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 2963|       |    pStruct->at = at;
 2964|       |#endif
 2965|       |
 2966|       |#if (MOVE_CHARGES_FROM_HETEREO_TO_METAL == 1 )
 2967|       |    /*****************************************************************/
 2968|       |    /* move charges from heteroatoms to metal atoms                  */
 2969|       |    /*****************************************************************/
 2970|       |    ret = MoveChargeFromHeteroatomsToMetals( pBNS, pBD, pStruct, at, at2, pVA, pTCGroups,
 2971|       |                                             &nNumRunBNS, &nTotalDelta, BNS_EDGE_FORBIDDEN_TEMP );
 2972|       |    if (ret < 0)
 2973|       |    {
 2974|       |        goto exit_function;
 2975|       |    }
 2976|       |#endif
 2977|       |    /***********************************************************************
 2978|       |            NH2                NH2
 2979|       |               \                  \
 2980|       |                C==S(+)-   =>      C(+)-S-   where NH2 are not tautomeric
 2981|       |               /                  /
 2982|       |            NH2                NH2
 2983|       |    ************************************************************************/
 2984|    801|    ret = MovePlusFromS2DiaminoCarbon( pBNS, pBD, pStruct, at, at2, pVA, pTCGroups,
 2985|    801|                                       &nNumRunBNS, &nTotalDelta, BNS_EDGE_FORBIDDEN_TEMP );
  ------------------
  |  |   68|    801|#define BNS_EDGE_FORBIDDEN_TEMP  2
  ------------------
 2986|    801|    if (ret < 0)
  ------------------
  |  Branch (2986:9): [True: 0, False: 801]
  ------------------
 2987|      0|    {
 2988|      0|        goto exit_function;
 2989|      0|    }
 2990|       |    /*****************************************************************/
 2991|       |    /*       Avoid charge separation on heteroatoms                  */
 2992|       |    /*****************************************************************/
 2993|    801|    ret = EliminateChargeSeparationOnHeteroatoms( pBNS, pBD, pStruct, at, at2, pVA, pTCGroups,
 2994|    801|                                                  &nNumRunBNS, &nTotalDelta, BNS_EDGE_FORBIDDEN_TEMP, 0 );
  ------------------
  |  |   68|    801|#define BNS_EDGE_FORBIDDEN_TEMP  2
  ------------------
 2995|    801|    if (ret < 0)
  ------------------
  |  Branch (2995:9): [True: 0, False: 801]
  ------------------
 2996|      0|    {
 2997|      0|        goto exit_function;
 2998|      0|    }
 2999|    801|    if (ret)
  ------------------
  |  Branch (2999:9): [True: 0, False: 801]
  ------------------
 3000|      0|    {
 3001|       |        /*charge separation remains; allow changes of stereobonds in a ring and try again */
 3002|      0|        ret = EliminateChargeSeparationOnHeteroatoms( pBNS, pBD, pStruct, at, at2, pVA, pTCGroups,
 3003|      0|                                                      &nNumRunBNS, &nTotalDelta, BNS_EDGE_FORBIDDEN_TEMP,
  ------------------
  |  |   68|      0|#define BNS_EDGE_FORBIDDEN_TEMP  2
  ------------------
 3004|      0|                                                      BNS_EDGE_FORBIDDEN_MASK );
  ------------------
  |  |   67|      0|#define BNS_EDGE_FORBIDDEN_MASK  1
  ------------------
 3005|      0|        if (ret < 0)
  ------------------
  |  Branch (3005:13): [True: 0, False: 0]
  ------------------
 3006|      0|        {
 3007|      0|            goto exit_function;
 3008|      0|        }
 3009|      0|    }
 3010|       |    /*****************************************************************/
 3011|       |    /*         convert N#N(+)-N= into N(-)=N(+)=N-                   */
 3012|       |    /*****************************************************************/
 3013|    801|    ret = RestoreNNNgroup( pBNS, pBD, pStruct, at, at2, pVA, pTCGroups,
 3014|    801|                           &nNumRunBNS, &nTotalDelta, BNS_EDGE_FORBIDDEN_TEMP );
  ------------------
  |  |   68|    801|#define BNS_EDGE_FORBIDDEN_TEMP  2
  ------------------
 3015|    801|    if (ret < 0)
  ------------------
  |  Branch (3015:9): [True: 0, False: 801]
  ------------------
 3016|      0|    {
 3017|      0|        goto exit_function;
 3018|      0|    }
 3019|       |    /*****************************************************************/
 3020|       |    /*     convert Metal(q)-N(-)-O(-) Metal(q-2)-N=O (local change)  */
 3021|       |    /*****************************************************************/
 3022|    801|    ret = FixMetal_Nminus_Ominus( pBNS, pBD, pStruct, at, at2, pVA, pTCGroups,
 3023|    801|                           &nNumRunBNS, &nTotalDelta, BNS_EDGE_FORBIDDEN_TEMP );
  ------------------
  |  |   68|    801|#define BNS_EDGE_FORBIDDEN_TEMP  2
  ------------------
 3024|    801|    if (ret < 0)
  ------------------
  |  Branch (3024:9): [True: 0, False: 801]
  ------------------
 3025|      0|    {
 3026|      0|        goto exit_function;
 3027|      0|    }
 3028|       |    /*****************************************************************/
 3029|       |    /*         convert N(-)=C= into N#C-         -                   */
 3030|       |    /*****************************************************************/
 3031|    801|    ret = RestoreCyanoGroup( pBNS, pBD, pStruct, at, at2, pVA, pTCGroups,
 3032|    801|                           &nNumRunBNS, &nTotalDelta, BNS_EDGE_FORBIDDEN_TEMP );
  ------------------
  |  |   68|    801|#define BNS_EDGE_FORBIDDEN_TEMP  2
  ------------------
 3033|    801|    if (ret < 0)
  ------------------
  |  Branch (3033:9): [True: 0, False: 801]
  ------------------
 3034|      0|    {
 3035|      0|        goto exit_function;
 3036|      0|    }
 3037|       |    /*****************************************************************/
 3038|       |    /*         convert C(+)#N(+)- into C(-)#N(+)-                    */
 3039|       |    /*****************************************************************/
 3040|    801|    ret = RestoreIsoCyanoGroup( pBNS, pBD, pStruct, at, at2, pVA, pTCGroups,
 3041|    801|                           &nNumRunBNS, &nTotalDelta, BNS_EDGE_FORBIDDEN_TEMP );
  ------------------
  |  |   68|    801|#define BNS_EDGE_FORBIDDEN_TEMP  2
  ------------------
 3042|    801|    if (ret < 0)
  ------------------
  |  Branch (3042:9): [True: 0, False: 801]
  ------------------
 3043|      0|    {
 3044|      0|        goto exit_function;
 3045|      0|    }
 3046|       |    /*****************************************************************/
 3047|       |    /*         eliminate =N(V)= if possible                          */
 3048|       |    /*                    |                                          */
 3049|       |    /*****************************************************************/
 3050|    801|    ret = EliminateNitrogen5Val3Bonds( pBNS, pBD, pStruct, at, at2, pVA, pTCGroups,
 3051|    801|                                      &nNumRunBNS, &nTotalDelta, BNS_EDGE_FORBIDDEN_TEMP );
  ------------------
  |  |   68|    801|#define BNS_EDGE_FORBIDDEN_TEMP  2
  ------------------
 3052|    801|    if (ret < 0)
  ------------------
  |  Branch (3052:9): [True: 0, False: 801]
  ------------------
 3053|      0|    {
 3054|      0|        goto exit_function;
 3055|      0|    }
 3056|       |
 3057|       |    /*****************************************************************/
 3058|       |    /*                    |      |                                   */
 3059|       |    /*         convert   -S- to =S= if possible                      */
 3060|       |    /*                    |      |                                   */
 3061|       |    /*****************************************************************/
 3062|    801|    ret = Convert_SIV_to_SVI( pBNS, pBD, pStruct, at, at2, pVA, pTCGroups,
 3063|    801|                             &nNumRunBNS, &nTotalDelta, BNS_EDGE_FORBIDDEN_TEMP );
  ------------------
  |  |   68|    801|#define BNS_EDGE_FORBIDDEN_TEMP  2
  ------------------
 3064|    801|    if (ret < 0)
  ------------------
  |  Branch (3064:9): [True: 0, False: 801]
  ------------------
 3065|      0|    {
 3066|      0|        goto exit_function;
 3067|      0|    }
 3068|       |
 3069|       |    /*****************************************************************/
 3070|       |    /*                  =N(+)=O     =N-O(-)                          */
 3071|       |    /*         convert           => if possible                      */
 3072|       |    /*                  Metal(q)    Metal(q+2)                       */
 3073|       |    /*****************************************************************/
 3074|    801|    ret = PlusFromDB_N_DB_O_to_Metal( pBNS, pBD, pStruct, at, at2, pVA, pTCGroups,
 3075|    801|                             &nNumRunBNS, &nTotalDelta, BNS_EDGE_FORBIDDEN_TEMP );
  ------------------
  |  |   68|    801|#define BNS_EDGE_FORBIDDEN_TEMP  2
  ------------------
 3076|    801|    if (ret < 0)
  ------------------
  |  Branch (3076:9): [True: 0, False: 801]
  ------------------
 3077|      0|    {
 3078|      0|        goto exit_function;
 3079|      0|    }
 3080|       |
 3081|       |    /*****************************************************************/
 3082|       |    /*  forbidden edges prevents required in InChI tautomerism       */
 3083|       |    /*  incorrectly restored mobile H mix separate tautomeric groups */
 3084|       |    /*  because an edge may not become forbidden                     */
 3085|       |    /* note: removes this 'forbidden_edge' bit from ALL edges        */
 3086|       |    /*****************************************************************/
 3087|    801|    ret = MoveMobileHToAvoidFixedBonds( pBNS, pBD, pStruct, at, at2, pVA, pTCGroups,
 3088|    801|                                      &nNumRunBNS, &nTotalDelta, BNS_EDGE_FORBIDDEN_TEMP );
  ------------------
  |  |   68|    801|#define BNS_EDGE_FORBIDDEN_TEMP  2
  ------------------
 3089|       |
 3090|    801|    if (ret < 0)
  ------------------
  |  Branch (3090:9): [True: 0, False: 801]
  ------------------
 3091|      0|    {
 3092|      0|        goto exit_function;
 3093|      0|    }
 3094|       |    /**************************************************************************/
 3095|       |    /* 2. Mobile H endpoint has radical on it (typical for wrong P(VI)(=O)3OH */
 3096|    801|    tot_num_fixes = 0;
 3097|    801|    if (pStruct->iMobileH == TAUT_NON)
  ------------------
  |  |  579|    801|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (3097:9): [True: 5, False: 796]
  ------------------
 3098|      5|    {
 3099|      5|        ret = RemoveRadFromMobileHEndpointFixH( pBNS, pBD, pStruct, at, at2, pVA, pTCGroups,
 3100|      5|                                          &nNumRunBNS, &nTotalDelta, BNS_EDGE_FORBIDDEN_TEMP );
  ------------------
  |  |   68|      5|#define BNS_EDGE_FORBIDDEN_TEMP  2
  ------------------
 3101|      5|    }
 3102|    796|    else
 3103|    796|    {
 3104|    796|        ret = RemoveRadFromMobileHEndpoint( pBNS, pBD, pStruct, at, at2, pVA, pTCGroups,
 3105|    796|                                      &nNumRunBNS, &nTotalDelta, BNS_EDGE_FORBIDDEN_TEMP );
  ------------------
  |  |   68|    796|#define BNS_EDGE_FORBIDDEN_TEMP  2
  ------------------
 3106|    796|    }
 3107|    801|    if (ret < 0)
  ------------------
  |  Branch (3107:9): [True: 0, False: 801]
  ------------------
 3108|      0|    {
 3109|      0|        goto exit_function;
 3110|      0|    }
 3111|    801|    tot_num_fixes += ret;
 3112|       |    /**************************************************************/
 3113|       |    /* make bonds between a charged heteroatom and a metal single */
 3114|    801|    ret = MakeSingleBondsMetal2ChargedHeteroat( pBNS, pBD, pStruct, at, at2, pVA, pTCGroups,
 3115|    801|                                      &nNumRunBNS, &nTotalDelta, BNS_EDGE_FORBIDDEN_TEMP );
  ------------------
  |  |   68|    801|#define BNS_EDGE_FORBIDDEN_TEMP  2
  ------------------
 3116|    801|    if (ret < 0)
  ------------------
  |  Branch (3116:9): [True: 0, False: 801]
  ------------------
 3117|      0|    {
 3118|      0|        goto exit_function;
 3119|      0|    }
 3120|       |    /**************************************************************/
 3121|       |    /* move (+) charges to >N- and other centerpoints             */
 3122|    801|    ret = MoveChargeToMakeCenerpoints( pBNS, pBD, pStruct, at, at2, pVA, pTCGroups,
 3123|    801|                                      &nNumRunBNS, &nTotalDelta, BNS_EDGE_FORBIDDEN_TEMP );
  ------------------
  |  |   68|    801|#define BNS_EDGE_FORBIDDEN_TEMP  2
  ------------------
 3124|    801|    if (ret < 0)
  ------------------
  |  Branch (3124:9): [True: 0, False: 801]
  ------------------
 3125|      0|    {
 3126|      0|        goto exit_function;
 3127|      0|    }
 3128|       |
 3129|       |    /**************************************************************************/
 3130|       |    /* Find and eliminate false Mobile-H groups: Cl(=O)3(-O(-)) => Cl(-)(=O)4 */
 3131|    801|    ret = MoveChargeToRemoveCenerpoints( pBNS, pBD, pStruct, at, at2, pVA, pTCGroups,
 3132|    801|                                      &nNumRunBNS, &nTotalDelta, BNS_EDGE_FORBIDDEN_TEMP );
  ------------------
  |  |   68|    801|#define BNS_EDGE_FORBIDDEN_TEMP  2
  ------------------
 3133|    801|    if (ret < 0)
  ------------------
  |  Branch (3133:9): [True: 0, False: 801]
  ------------------
 3134|      0|    {
 3135|      0|        goto exit_function;
 3136|      0|    }
 3137|       |    /**************************************************************************/
 3138|       |    /* Find A=X< where all bonds to X except A=X are marked as stereogenic    */
 3139|       |    /* make bonds A=X single                                                  */
 3140|    801|    ret = CheckAndRefixStereobonds( pBNS, pBD, pStruct, at, at2, pVA, pTCGroups,
 3141|    801|                                 &nNumRunBNS, &nTotalDelta, BNS_EDGE_FORBIDDEN_TEMP );
  ------------------
  |  |   68|    801|#define BNS_EDGE_FORBIDDEN_TEMP  2
  ------------------
 3142|    801|    if (ret < 0)
  ------------------
  |  Branch (3142:9): [True: 0, False: 801]
  ------------------
 3143|      0|    {
 3144|      0|        goto exit_function;
 3145|      0|    }
 3146|       |    /**************************************************************************/
 3147|       |    /* In Reconnected structure change 'salt bonds' to 'coordination bonds    */
 3148|       |    /* for example, M-O-C=  ->  M(+)-O(-)-C=                                  */
 3149|       |    /* Defect: instead of NH2-C=O(+)-M it will restore NH2(+)=C-O(-)-M(+)     */
 3150|       |    /* However, in this release metal-organic compounds do not get much care  */
 3151|    801|    ret = SaltBondsToCoordBonds( pBNS, pBD, pStruct, at, at2, pVA, pTCGroups,
 3152|    801|                               &nNumRunBNS, &nTotalDelta, BNS_EDGE_FORBIDDEN_TEMP );
  ------------------
  |  |   68|    801|#define BNS_EDGE_FORBIDDEN_TEMP  2
  ------------------
 3153|    801|    if (ret < 0)
  ------------------
  |  Branch (3153:9): [True: 0, False: 801]
  ------------------
 3154|      0|    {
 3155|      0|        goto exit_function;
 3156|      0|    }
 3157|       |    /**************************************************************************/
 3158|       |    /* Normalize the structure and compare t-groups and stereobonds           */
 3159|    801|    ret = NormalizeAndCompare( pCG, ic, ip, sd, pBNS, pBD, pStruct, at, at2, at3, pVA, pTCGroups, pInChI, num_inp, bHasSomeFixedH,
 3160|    801|                               &nNumRunBNS, &nTotalDelta, BNS_EDGE_FORBIDDEN_TEMP, BNS_EDGE_FORBIDDEN_MASK );
  ------------------
  |  |   68|    801|#define BNS_EDGE_FORBIDDEN_TEMP  2
  ------------------
                                             &nNumRunBNS, &nTotalDelta, BNS_EDGE_FORBIDDEN_TEMP, BNS_EDGE_FORBIDDEN_MASK );
  ------------------
  |  |   67|    801|#define BNS_EDGE_FORBIDDEN_MASK  1
  ------------------
 3161|    801|    if (ret < 0)
  ------------------
  |  Branch (3161:9): [True: 798, False: 3]
  ------------------
 3162|    798|    {
 3163|    798|        goto exit_function;
 3164|    798|    }
 3165|       |    /**************************************************************************/
 3166|       |    /* Create InChI out of the restored structure                             */
 3167|       |
 3168|       |
 3169|       |    /*ret = nTotalDelta;*/
 3170|       |
 3171|    801|exit_function:
 3172|       |
 3173|    801|    pStruct->at = at;
 3174|    801|    pStruct->at2 = at2;
 3175|    801|    at2 = NULL;
 3176|    801|    AllocEdgeList( &CarbonChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|    801|#define EDGE_LIST_FREE   (-2)
  ------------------
 3177|    801|    AllocEdgeList( &MetalCarbonEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|    801|#define EDGE_LIST_FREE   (-2)
  ------------------
 3178|    801|    AllocEdgeList( &Nplus2BondsEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|    801|#define EDGE_LIST_FREE   (-2)
  ------------------
 3179|    801|    if (at2)
  ------------------
  |  Branch (3179:9): [True: 0, False: 801]
  ------------------
 3180|      0|    {
 3181|      0|        inchi_free( at2 );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3182|      0|    }
 3183|    801|    if (at3)
  ------------------
  |  Branch (3183:9): [True: 801, False: 0]
  ------------------
 3184|    801|    {
 3185|    801|        inchi_free( at3 );
  ------------------
  |  | 1136|    801|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 801, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3186|    801|    }
 3187|       |
 3188|    801|    return ret;
 3189|    801|}
RestoreAtomMakeBNS:
 3203|  55.4k|{
 3204|  55.4k|    int i, j, ret = 0, ret2;
 3205|       |    /*int nDelta, nTotalDelta;*/
 3206|  55.4k|    VAL_AT   *pVA = NULL;
 3207|  55.4k|    VAL_AT    va1;
 3208|  55.4k|    int    num_at = pStruct->num_atoms;
 3209|  55.4k|    inp_ATOM *at = pStruct->at;
 3210|  55.4k|    ALL_TC_GROUPS   TCGroups;
 3211|  55.4k|    ALL_TC_GROUPS *pTCGroups = &TCGroups;
 3212|  55.4k|    int            nAddEdges2eachAtom = 2, nAddVertices = 0;
 3213|       |
 3214|  55.4k|    BFS_Q bfsq;
 3215|       |
 3216|       |    /* BNS creation */
 3217|  55.4k|    BN_STRUCT     *pBNS = NULL;
 3218|  55.4k|    BN_DATA       *pBD = NULL;
 3219|  55.4k|    int            nNum_changed_bonds = 0;
 3220|  55.4k|    int            bTreatMoreAtomsAsMetals = 0, bSecondPassNewMetals = 0;
 3221|  55.4k|    int            nMaxAddAtoms = 2, nMaxAddEdges = 2, max_altp = BN_MAX_ALTP;
  ------------------
  |  |   45|  55.4k|#define BN_MAX_ALTP  16
  ------------------
 3222|       |
 3223|  55.4k|    memset( pTCGroups, 0, sizeof( pTCGroups[0] ) );
 3224|  1.05M|    for (i = 0; i < NUM_TCGROUP_TYPES; i++)
  ------------------
  |  Branch (3224:17): [True: 998k, False: 55.4k]
  ------------------
 3225|   998k|    {
 3226|   998k|        pTCGroups->nGroup[i] = TCG_None; /* unassigned */
 3227|   998k|    }
 3228|  55.4k|    pTCGroups->iComponent = iComponent;
 3229|  55.4k|    pTCGroups->iAtNoOffset = iAtNoOffset;
 3230|       |
 3231|  55.4k|    if (num_at == 1)
  ------------------
  |  Branch (3231:9): [True: 54.6k, False: 840]
  ------------------
 3232|  54.6k|    {
 3233|       |        /* single atom -- no bonds to restore */
 3234|  54.6k|        inp_ATOM *at2 = (inp_ATOM *) inchi_malloc( sizeof( at2[0] )*( pStruct->num_atoms + pStruct->num_deleted_H ) );
  ------------------
  |  | 1130|  54.6k|#define inchi_malloc   malloc
  ------------------
 3235|  54.6k|        inp_ATOM *at3 = (inp_ATOM *) inchi_malloc( sizeof( at3[0] )*( pStruct->num_atoms + pStruct->num_deleted_H ) );
  ------------------
  |  | 1130|  54.6k|#define inchi_malloc   malloc
  ------------------
 3236|  54.6k|        pStruct->at2 = at2;
 3237|  54.6k|        at[0].charge = pInChI[0]->nTotalCharge;
 3238|  54.6k|        if (at2)
  ------------------
  |  Branch (3238:13): [True: 54.6k, False: 0]
  ------------------
 3239|  54.6k|        {
 3240|  54.6k|            memcpy( at2, at, sizeof( at2[0] )*( pStruct->num_atoms + pStruct->num_deleted_H ) );
 3241|  54.6k|        }
 3242|  54.6k|        if (!at2 || !at3)
  ------------------
  |  Branch (3242:13): [True: 0, False: 54.6k]
  |  Branch (3242:21): [True: 0, False: 54.6k]
  ------------------
 3243|      0|        {
 3244|      0|            if (at3) inchi_free( at3 );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (3244:17): [True: 0, False: 0]
  ------------------
 3245|      0|            return RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 3246|      0|        }
 3247|  54.6k|        ret = MakeOneInChIOutOfStrFromINChI( pCG, ic, ip, sd, pStruct, pStruct->at2, at3, pTCGroups );
 3248|       |        /* clean up */
 3249|   163k|        for (i = 0; i < TAUT_NUM; i++)
  ------------------
  |  |  578|   163k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (3249:21): [True: 109k, False: 54.6k]
  ------------------
 3250|   109k|        {
 3251|   109k|            Free_INChI( &pStruct->pOneINChI[i] );
 3252|   109k|            Free_INChI_Aux( &pStruct->pOneINChI_Aux[i] );
 3253|   109k|            FreeInpAtomData( pStruct->pOne_norm_data[i] );
 3254|   109k|            if (pStruct->pOne_norm_data[i])
  ------------------
  |  Branch (3254:17): [True: 54.6k, False: 54.6k]
  ------------------
 3255|  54.6k|            {
 3256|  54.6k|                inchi_free( pStruct->pOne_norm_data[i] );
  ------------------
  |  | 1136|  54.6k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 54.6k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3257|  54.6k|                pStruct->pOne_norm_data[i] = NULL;
 3258|  54.6k|            }
 3259|   109k|        }
 3260|  54.6k|        free_t_group_info( &pStruct->One_ti );
 3261|  54.6k|        inchi_free( at3 );
  ------------------
  |  | 1136|  54.6k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 54.6k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3262|       |
 3263|  54.6k|        return ret;
 3264|  54.6k|    }
 3265|       |
 3266|    840|    AllocBfsQueue( &bfsq, BFS_Q_CLEAR, 0 );
  ------------------
  |  |   88|    840|#define BFS_Q_CLEAR  (-1)
  ------------------
 3267|    840|    if (!( pVA = (VAL_AT *) inchi_calloc( num_at, sizeof( pVA[0] ) ) ))
  ------------------
  |  | 1133|    840|#define inchi_calloc   calloc
  ------------------
  |  Branch (3267:9): [True: 0, False: 840]
  ------------------
 3268|      0|    {
 3269|      0|        ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 3270|      0|        goto exit_function;
 3271|      0|    }
 3272|    840|    pStruct->pVA = pVA;
 3273|    840|    memset( &va1, 0, sizeof( va1 ) );
 3274|    840|    pTCGroups->total_charge = pInChI[0]->nTotalCharge;
 3275|    840|    if (0 > ( ret = AllocBfsQueue( &bfsq, num_at, 0 /* min ring size undefined */ ) ))
  ------------------
  |  Branch (3275:9): [True: 0, False: 840]
  ------------------
 3276|      0|    {
 3277|      0|        goto exit_function;
 3278|      0|    }
 3279|    840|    pStruct->pbfsq = &bfsq;
 3280|       |
 3281|    840|    if (pStruct->iMobileH == TAUT_NON && pInChI[1] && pInChI[1]->nNumberOfAtoms > 1 &&
  ------------------
  |  |  579|  1.68k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (3281:9): [True: 5, False: 835]
  |  Branch (3281:42): [True: 5, False: 0]
  |  Branch (3281:55): [True: 5, False: 0]
  ------------------
 3282|    840|        ( ret = FillOutpStructEndpointFromInChI( pInChI[1], &pStruct->endpoint ) ))
  ------------------
  |  Branch (3282:9): [True: 0, False: 5]
  ------------------
 3283|      0|    {
 3284|      0|        goto exit_function;
 3285|      0|    }
 3286|       |
 3287|       |    /* mark metal atoms; find min ring sizes for atoms that have 2 bonds */
 3288|   654k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (3288:17): [True: 653k, False: 840]
  ------------------
 3289|   653k|    {
 3290|   653k|        pVA[i].cNumValenceElectrons = get_sp_element_type( at[i].el_number, &j );
 3291|   653k|        pVA[i].cPeriodicRowNumber = j;
 3292|   653k|        pVA[i].cPeriodicNumber = at[i].el_number;
 3293|   653k|        pVA[i].cNumValenceElectrons--; /* = -1 d- and f- metals, 0 for H, 1 for Na, 2 for Mg,.. = (ATYPE_Xx-1)  */
 3294|       |
 3295|   653k|        if (is_el_a_metal( at[i].el_number ))
  ------------------
  |  Branch (3295:13): [True: 66.7k, False: 586k]
  ------------------
 3296|  66.7k|        {
 3297|  66.7k|            if (pStruct->pSrm->bStereoRemovesMetalFlag)
  ------------------
  |  Branch (3297:17): [True: 0, False: 66.7k]
  ------------------
 3298|      0|            {
 3299|       |                /* treat metal as non-metal if it is stereogenic or has a stereobond */
 3300|      0|                pVA[i].cMetal = !( at[i].p_parity || at[i].sb_parity[0] );
  ------------------
  |  Branch (3300:36): [True: 0, False: 0]
  |  Branch (3300:54): [True: 0, False: 0]
  ------------------
 3301|      0|            }
 3302|  66.7k|            else
 3303|  66.7k|            {
 3304|  66.7k|                pVA[i].cMetal = 1;
 3305|  66.7k|            }
 3306|  66.7k|        }
 3307|   653k|        if (at[i].valence == 2 && !at[i].num_H)
  ------------------
  |  Branch (3307:13): [True: 9, False: 653k]
  |  Branch (3307:35): [True: 9, False: 0]
  ------------------
 3308|      9|        {
 3309|      9|            pVA[i].cMinRingSize = is_bond_in_Nmax_memb_ring( at, i, 0, bfsq.q, bfsq.nAtomLevel,
 3310|      9|                                                             bfsq.cSource, 99 /* max ring size */ );
 3311|      9|        }
 3312|   653k|        else
 3313|   653k|        {
 3314|   653k|            pVA[i].cMinRingSize = 0;
 3315|   653k|        }
 3316|   653k|    }
 3317|       |    /* AllocBfsQueue( &bfsq, BFS_Q_FREE, 0 ); */
 3318|       |
 3319|    840|repeat_for_new_metals:
 3320|       |    /* set valences for the first time; find ChargeValence structures for each atom */
 3321|   654k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (3321:17): [True: 653k, False: 840]
  ------------------
 3322|   653k|    {
 3323|       |        /* get additional fictitious atoms information */
 3324|   653k|        pVA[i].cInitFreeValences = 0;
 3325|       |
 3326|   653k|        ret = GetAtomRestoreInfo( pCG, at, i, pVA, pStruct->pSrm, pStruct->bMobileH, pStruct->endpoint );
 3327|       |
 3328|   653k|        if (ret < 0)
  ------------------
  |  Branch (3328:13): [True: 0, False: 653k]
  ------------------
 3329|      0|        {
 3330|      0|            goto exit_function;
 3331|      0|        }
 3332|   653k|        if (ret == TREAT_ATOM_AS_METAL && !bSecondPassNewMetals && !pVA[i].cMetal)
  ------------------
  |  |  286|  1.30M|#define TREAT_ATOM_AS_METAL 99
  ------------------
  |  Branch (3332:13): [True: 0, False: 653k]
  |  Branch (3332:43): [True: 0, False: 0]
  |  Branch (3332:68): [True: 0, False: 0]
  ------------------
 3333|      0|        {
 3334|      0|            if (pStruct->pSrm->bStereoRemovesMetalFlag)
  ------------------
  |  Branch (3334:17): [True: 0, False: 0]
  ------------------
 3335|      0|            {
 3336|       |                /* treat metal as non-metal if it is stereogenic or has a stereobond */
 3337|      0|                pVA[i].cMetal = !( at[i].p_parity || at[i].sb_parity[0] );
  ------------------
  |  Branch (3337:36): [True: 0, False: 0]
  |  Branch (3337:54): [True: 0, False: 0]
  ------------------
 3338|      0|            }
 3339|      0|            else
 3340|      0|            {
 3341|      0|                pVA[i].cMetal = 1;
 3342|      0|            }
 3343|      0|            if (pVA[i].cMetal)
  ------------------
  |  Branch (3343:17): [True: 0, False: 0]
  ------------------
 3344|      0|            {
 3345|      0|                bTreatMoreAtomsAsMetals++;
 3346|      0|            }
 3347|      0|        }
 3348|   653k|        pTCGroups->charge_on_atoms += pVA[i].cInitCharge;
 3349|   653k|    }
 3350|    840|    if (bTreatMoreAtomsAsMetals && !bSecondPassNewMetals)
  ------------------
  |  Branch (3350:9): [True: 0, False: 840]
  |  Branch (3350:36): [True: 0, False: 0]
  ------------------
 3351|      0|    {
 3352|      0|        for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (3352:21): [True: 0, False: 0]
  ------------------
 3353|      0|        {
 3354|       |            /* clear all members of pVA[i] except two */
 3355|      0|            pTCGroups->charge_on_atoms -= pVA[i].cInitCharge;
 3356|      0|            va1.cMetal = pVA[i].cMetal;
 3357|      0|            va1.cMinRingSize = pVA[i].cMinRingSize;
 3358|      0|            va1.cNumValenceElectrons = pVA[i].cNumValenceElectrons;
 3359|      0|            va1.cPeriodicRowNumber = pVA[i].cPeriodicRowNumber;
 3360|      0|            va1.cPeriodicNumber = pVA[i].cPeriodicNumber;
 3361|      0|            pVA[i] = va1;
 3362|      0|        }
 3363|      0|        bSecondPassNewMetals = 1;
 3364|      0|        goto repeat_for_new_metals;
 3365|      0|    }
 3366|       |
 3367|       |    /* count atoms, bonds, additional edges and vertices in ChargeValence structures and t-groups */
 3368|    840|    ret = nCountBnsSizes( at, num_at, nAddEdges2eachAtom, nAddVertices, &pStruct->ti,
 3369|    840|                          pVA, pStruct->pSrm, pTCGroups );
 3370|    840|    if (ret < 0)
  ------------------
  |  Branch (3370:9): [True: 39, False: 801]
  ------------------
 3371|     39|    {
 3372|     39|        goto exit_function;
 3373|     39|    }
 3374|       |
 3375|       |    /* find and count groups; add counts of all other vertices to be created */
 3376|    801|    ret = nAddSuperCGroups( pTCGroups );
 3377|    801|    if (ret < 0)
  ------------------
  |  Branch (3377:9): [True: 0, False: 801]
  ------------------
 3378|      0|    {
 3379|      0|        goto exit_function;
 3380|      0|    }
 3381|       |
 3382|       |    /* create the BNS and fill it with all real atoms */
 3383|    801|    pBNS = AllocateAndInitTCGBnStruct( pStruct, pVA, pTCGroups,
 3384|    801|                                       nMaxAddAtoms, nMaxAddEdges, max_altp, &nNum_changed_bonds );
 3385|    801|    if (!pBNS)
  ------------------
  |  Branch (3385:9): [True: 0, False: 801]
  ------------------
 3386|      0|    {
 3387|      0|        ret = BNS_OUT_OF_RAM;
  ------------------
  |  |   77|      0|#define BNS_OUT_OF_RAM     (BNS_ERR +  1) /*(-9998)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3388|      0|        goto exit_function;
 3389|      0|    }
 3390|       |    /* add t-groups to the BNS */
 3391|    801|    ret = AddTGroups2TCGBnStruct( pBNS, pStruct, pVA, pTCGroups, nMaxAddEdges );
 3392|    801|    if (ret < 0)
  ------------------
  |  Branch (3392:9): [True: 0, False: 801]
  ------------------
 3393|      0|    {
 3394|      0|        goto exit_function;
 3395|      0|    }
 3396|       |
 3397|       |    /* add c-groups to the BNS; adjust charges */
 3398|    801|    ret = AddCGroups2TCGBnStruct( pBNS, pStruct, pVA, pTCGroups, nMaxAddEdges );
 3399|    801|    if (ret < 0)
  ------------------
  |  Branch (3399:9): [True: 0, False: 801]
  ------------------
 3400|      0|    {
 3401|      0|        goto exit_function;
 3402|      0|    }
 3403|       |
 3404|    801|    pBNS->ulTimeOutTime = NULL;             /* v. 1.05 */
 3405|    801|    pBNS->ic = ic;                          /* v. 1.05 */
 3406|       |
 3407|       |    /* allocate BNData */
 3408|    801|    pBD = AllocateAndInitBnData( pBNS->max_vertices + pBNS->max_vertices / 2 );
 3409|    801|    if (!pBD)
  ------------------
  |  Branch (3409:9): [True: 0, False: 801]
  ------------------
 3410|      0|    {
 3411|      0|        ret = BNS_OUT_OF_RAM;
  ------------------
  |  |   77|      0|#define BNS_OUT_OF_RAM     (BNS_ERR +  1) /*(-9998)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3412|      0|        goto exit_function;
 3413|      0|    }
 3414|    801|    CheckBnsConsistency( pStruct, pBNS, pVA, pTCGroups, 0 );
 3415|       |
 3416|       |    /* restore bonds & charges */
 3417|    801|    ret = RunBnsRestore1( pCG, ic, ip, sd, pBNS, pBD, pStruct, pVA, pTCGroups, pInChI, num_inp, bHasSomeFixedH );
 3418|    801|    if (ret < 0)
  ------------------
  |  Branch (3418:9): [True: 798, False: 3]
  ------------------
 3419|    798|    {
 3420|    798|        goto exit_function;
 3421|    798|    }
 3422|       |
 3423|      3|    ret = CheckBnsConsistency( pStruct, pBNS, pVA, pTCGroups, 1 );
 3424|       |#if ( bRELEASE_VERSION == 0 )
 3425|       |#ifndef TARGET_API_LIB
 3426|       |    if (ret)
 3427|       |    {
 3428|       |        fprintf( stdout, "Msg for: %ld %s comp=%d %c%c\n", num_inp, ( szCurHdr && szCurHdr[0] ) ? szCurHdr : "", iComponent, pStruct->iInchiRec ? 'R' : 'D', pStruct->iMobileH ? 'M' : 'F' );
 3429|       |    }
 3430|       |    if (pStruct->iMobileH == TAUT_YES && pStruct->nNumRemovedProtons)
 3431|       |    {
 3432|       |        fprintf( stdout, "REMOVED_PROTONS%+d %ld %s\n", pStruct->nNumRemovedProtons, num_inp, ( szCurHdr && szCurHdr[0] ) ? szCurHdr : "" );
 3433|       |        /*pStruct->bExtract |= EXTRACT_STRUCT_NUMBER;*/
 3434|       |    }
 3435|       |    if (pStruct->bExtract & EXTRACT_STRUCT_NUMBER)
 3436|       |    {
 3437|       |        fprintf( stdout, "EXTRACT: %ld: %s\n", num_inp, ( szCurHdr && szCurHdr[0] ) ? szCurHdr : "" );
 3438|       |    }
 3439|       |#endif
 3440|       |#endif
 3441|      3|    {  /* create the final structure in pStruct->at2 */
 3442|      3|        inp_ATOM *at_tmp = pStruct->at;
 3443|      3|        pStruct->at = pStruct->at2;
 3444|      3|        memcpy( pStruct->at, at_tmp, sizeof( pStruct->at[0] )*( pStruct->num_atoms + pStruct->num_deleted_H ) );
 3445|      3|        ret2 = CopyBnsToAtom( pStruct, pBNS, pVA, pTCGroups, 1 );
 3446|      3|        pStruct->at2 = pStruct->at;
 3447|      3|        pStruct->at = at_tmp;
 3448|      3|        if (ret2 < 0)
  ------------------
  |  Branch (3448:13): [True: 0, False: 3]
  ------------------
 3449|      0|        {
 3450|      0|            ret = ret2;
 3451|      0|        }
 3452|      3|    }
 3453|       |
 3454|    840|exit_function:
 3455|       |
 3456|    840|    pStruct->pbfsq = NULL;
 3457|    840|    AllocBfsQueue( &bfsq, BFS_Q_FREE, 0 );
  ------------------
  |  |   89|    840|#define BFS_Q_FREE   (-2)
  ------------------
 3458|       |
 3459|    840|    pBD = DeAllocateBnData( pBD );
 3460|    840|    pBNS = DeAllocateBnStruct( pBNS );
 3461|       |    /*
 3462|       |    if ( pVA ) inchi_free( pVA );
 3463|       |    */
 3464|    840|    if (pTCGroups->pTCG) inchi_free( pTCGroups->pTCG );
  ------------------
  |  | 1136|     42|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 42, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (3464:9): [True: 42, False: 798]
  ------------------
 3465|       |
 3466|    840|    return ret;
 3467|      3|}
OneInChI2Atom:
 3482|  55.4k|{
 3483|  55.4k|    int ret;
 3484|  55.4k|    INPUT_PARMS *ip, ip_loc;
 3485|       |
 3486|  55.4k|    ip_loc = *ip_inp;
 3487|  55.4k|    ip = &ip_loc;
 3488|       |
 3489|  55.4k|    sd->pStrErrStruct[0] = '\0';
 3490|  55.4k|    ret = RestoreAtomConnectionsSetStereo( pStruct, iComponent, iAtNoOffset, pInChI[0], pInChI[1] );
 3491|  55.4k|    if (ret < 0)
  ------------------
  |  Branch (3491:9): [True: 0, False: 55.4k]
  ------------------
 3492|      0|    {
 3493|      0|        goto exit_function;
 3494|      0|    }
 3495|  55.4k|    ret = SetStereoBondTypesFrom0DStereo( pStruct, pInChI[0] );
 3496|  55.4k|    if (ret < 0)
  ------------------
  |  Branch (3496:9): [True: 0, False: 55.4k]
  ------------------
 3497|      0|    {
 3498|      0|        goto exit_function;
 3499|      0|    }
 3500|  55.4k|    ret = ReconcileAllCmlBondParities( pStruct->at, pStruct->num_atoms, 0 );
 3501|  55.4k|    if (ret < 0)
  ------------------
  |  Branch (3501:9): [True: 0, False: 55.4k]
  ------------------
 3502|      0|    {
 3503|      0|        goto exit_function;
 3504|      0|    }
 3505|       |
 3506|       |    /* main InChI restore function */
 3507|  55.4k|    ret = RestoreAtomMakeBNS( ic, pCG, ip, sd, pStruct, iComponent, iAtNoOffset, pInChI, szCurHdr, num_inp, bHasSomeFixedH );
 3508|       |
 3509|       |#ifndef COMPILE_ANSI_ONLY
 3510|       |    if (( pStruct->num_inp_actual > 0 ? pStruct->num_inp_actual : num_inp ) >= ip->first_struct_number &&
 3511|       |        ( (/*ret > 0 &&*/ ip->bDisplayIfRestoreWarnings ) && pStruct->pXYZ ))
 3512|       |    {
 3513|       |        inchiTime     ulTStart;
 3514|       |        InchiTimeGet( &ulTStart );
 3515|       |        DisplayRestoredComponent( pCG, pStruct, iComponent, iAtNoOffset, pInChI[0], szCurHdr );
 3516|       |        sd->ulStructTime -= InchiTimeElapsed( ic, &ulTStart ); /* subtract display time */
 3517|       |    }
 3518|       |#endif
 3519|       |
 3520|  55.4k|    if (ret < 0)
  ------------------
  |  Branch (3520:9): [True: 837, False: 54.6k]
  ------------------
 3521|    837|    {
 3522|    837|        goto exit_function;
 3523|    837|    }
 3524|  54.6k|    if (( pStruct->num_inp_actual ? pStruct->num_inp_actual : num_inp ) >= ip->first_struct_number && ret >= 0)
  ------------------
  |  Branch (3524:9): [True: 54.6k, False: 0]
  |  Branch (3524:11): [True: 0, False: 54.6k]
  |  Branch (3524:103): [True: 54.6k, False: 0]
  ------------------
 3525|  54.6k|    {
 3526|       |        /* remove t-group markings and increment zero-order bonds,
 3527|       |           otherwise MakeInChIOutOfStrFromINChI2() woild fail */
 3528|       |        /* --- moved to MakeInChIOutOfStrFromINChI2 ---
 3529|       |        IncrZeroBondsAndClearEndpts(pStruct->at2, pStruct->num_atoms, iComponent+1);
 3530|       |        CopySt2At( pStruct->at2, pStruct->st, pStruct->num_atoms );
 3531|       |        */
 3532|       |        /* include all restored structure features in pStruct->at2 */
 3533|       |        /* make full InChI out of pStruct->at2, pStruct->num_atoms */
 3534|       |        /***************************************************************************************/
 3535|       |        /* !!! pStruct->One_InChI etc. were removed at the exit from NormalizeAndCompare() !!! */
 3536|       |        /***************************************************************************************/
 3537|  54.6k|        if (bHasSomeFixedH && pStruct->iInchiRec == INCHI_REC && pStruct->iMobileH == TAUT_YES &&
  ------------------
  |  |  576|   108k|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                      if (bHasSomeFixedH && pStruct->iInchiRec == INCHI_REC && pStruct->iMobileH == TAUT_YES &&
  ------------------
  |  |  580|  54.6k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3537:13): [True: 53.8k, False: 776]
  |  Branch (3537:31): [True: 0, False: 53.8k]
  |  Branch (3537:66): [True: 0, False: 0]
  ------------------
 3538|  54.6k|             !pStruct->bFixedHExists && !( ip->nMode & REQ_MODE_BASIC ))
  ------------------
  |  |   43|      0|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
  |  Branch (3538:14): [True: 0, False: 0]
  |  Branch (3538:41): [True: 0, False: 0]
  ------------------
 3539|      0|        {
 3540|       |            /* reconnected components without Fixed-H layer may produce 'tautomeric' fragments like Cl(-) */
 3541|      0|            ip->nMode |= REQ_MODE_BASIC;
  ------------------
  |  |   43|      0|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
 3542|      0|        }
 3543|       |
 3544|  54.6k|        ret = MakeInChIOutOfStrFromINChI2( ic, pCG, ip, sd, pStruct, iComponent, iAtNoOffset, num_inp );
 3545|       |
 3546|  54.6k|        if (ret >= 0)
  ------------------
  |  Branch (3546:13): [True: 54.6k, False: 1]
  ------------------
 3547|  54.6k|        {
 3548|  54.6k|            ;
 3549|  54.6k|        }
 3550|       |#if ( bRELEASE_VERSION == 0 )
 3551|       |#ifndef TARGET_API_LIB
 3552|       |        else
 3553|       |        {
 3554|       |            fprintf( stdout, "\nERROR in MakeInChI-1: %ld %s Comp:%d %c%c Err:%d\n", num_inp,
 3555|       |                     szCurHdr ? szCurHdr : "???", iComponent, pStruct->iInchiRec ? 'R' : 'D', pStruct->iMobileH ? 'M' : 'F', ret );
 3556|       |        }
 3557|       |#endif
 3558|       |#endif
 3559|  54.6k|    }
 3560|       |
 3561|  55.4k|exit_function:
 3562|       |
 3563|  55.4k|    return ret;
 3564|  54.6k|}
MakeProtonComponent:
 3569|      1|{
 3570|      1|    inp_ATOM *at = NULL;
 3571|      1|    int        i;
 3572|       |
 3573|      1|    if (num_prot <= 0)
  ------------------
  |  Branch (3573:9): [True: 0, False: 1]
  ------------------
 3574|      0|    {
 3575|      0|        return 0;
 3576|      0|    }
 3577|       |    /* allocate */
 3578|      1|    pStruct->at = (inp_ATOM *) inchi_calloc( num_prot, sizeof( pStruct->at[0] ) );
  ------------------
  |  | 1133|      1|#define inchi_calloc   calloc
  ------------------
 3579|      1|    pStruct->at2 = (inp_ATOM *) inchi_calloc( num_prot, sizeof( pStruct->at2[0] ) );
  ------------------
  |  | 1133|      1|#define inchi_calloc   calloc
  ------------------
 3580|      1|    if (!pStruct->at || !pStruct->at2)
  ------------------
  |  Branch (3580:9): [True: 0, False: 1]
  |  Branch (3580:25): [True: 0, False: 1]
  ------------------
 3581|      0|    {
 3582|      0|        return 0;
 3583|      0|    }
 3584|       |    /* create protons */
 3585|      1|    at = pStruct->at;
 3586|       |    /* fill out proton atom info */
 3587|      2|    for (i = 0; i < num_prot; i++)
  ------------------
  |  Branch (3587:17): [True: 1, False: 1]
  ------------------
 3588|      1|    {
 3589|      1|        strcpy( at[i].elname, "H" );
 3590|      1|        at[i].el_number = EL_NUMBER_H;
  ------------------
  |  |   41|      1|#define EL_NUMBER_H ((U_CHAR) 1)
  ------------------
 3591|      1|        at[i].orig_at_number = i + 1;
 3592|       |        /*
 3593|       |        at[i].orig_compt_at_numb = i + 1;
 3594|       |        at[i].component = i + 1;
 3595|       |        */
 3596|      1|        at[i].charge = 1;
 3597|      1|    }
 3598|      1|    memcpy( pStruct->at2, at, num_prot * sizeof( pStruct->at2[0] ) );
 3599|      1|    pStruct->bDeleted = 0;
 3600|      1|    pStruct->num_atoms = num_prot;
 3601|      1|    pStruct->bMobileH = TAUT_YES;
  ------------------
  |  |  580|      1|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3602|      1|    pStruct->iMobileH = TAUT_YES;
  ------------------
  |  |  580|      1|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3603|       |
 3604|      1|    return num_prot;
 3605|      1|}
AddRemProtonsInRestrStruct:
 3620|     28|{
 3621|       |    /* on entry and exit, all at[i].num_H do not include isotopic H  and explicit terminal H are connected */
 3622|     28|    int  iComp, q, ret = 0;
 3623|     28|    int      num_atoms, tot_num_at, num_deleted_H, num_tg, num_changed, num_deleted_components;
 3624|     28|    inp_ATOM *at;
 3625|     28|    INPUT_PARMS *ip, ip_loc;
 3626|     28|    int      num_prot = *nProtonsToBeRemovedByNormFromRevrs;
 3627|     28|    int      delta_recmet_prot, num_prot_prev, bAccumulateChanges = 0, nNumProtAddedByRevrs;
 3628|     28|    INChI_Aux *pINChI_Aux;
 3629|     28|    INCHI_MODE bNormalizationFlags;
 3630|     28|    int        nChargeRevrs, nChargeInChI;
 3631|       |
 3632|     28|    if (!num_prot)
  ------------------
  |  Branch (3632:9): [True: 27, False: 1]
  ------------------
 3633|     27|    {
 3634|     27|        return 0;
 3635|     27|    }
 3636|      1|    delta_recmet_prot = 0;
 3637|      1|    num_changed = 0;
 3638|      1|    num_deleted_components = 0;
 3639|      1|    ip_loc = *ip_inp;
 3640|      1|    ip = &ip_loc;
 3641|       |    /*----------------------------------------------------------------------------------
 3642|       |    nLink < 0 && num_componentsR > 0 => This is a Disconnected structure component; it is
 3643|       |                                        same as already processed reconnected one
 3644|       |                                        Do no preicess it
 3645|       |
 3646|       |    nLink > 0 && num_componentsR > 0 => This is a Disconnected structure component;
 3647|       |    (should not happen)                 It it is a result of (nLink-1)th Reconeected
 3648|       |                                        component disconnection (NOT IMPLEMENTED YET)
 3649|       |
 3650|       |    nLink = 0                        => Process this component. It is either a reconnected
 3651|       |                                        component, or a result of a disconnection (for now)
 3652|       |
 3653|       |    nLink > 0 && num_componentsR = 0 => This is a Reconnected component that is same as
 3654|       |                                        a disconnected one that will not be processed.
 3655|       |                                        Process and save charge delta.
 3656|       |    -----------------------------------------------------------------------------------*/
 3657|       |
 3658|      3|    for (iComp = 0; iComp < num_components && num_prot; iComp++)
  ------------------
  |  Branch (3658:21): [True: 2, False: 1]
  |  Branch (3658:47): [True: 2, False: 0]
  ------------------
 3659|      2|    {
 3660|      2|        bAccumulateChanges = 0;
 3661|      2|        if (pStruct[iComp].nLink < 0 && num_componentsR > 0)
  ------------------
  |  Branch (3661:13): [True: 0, False: 2]
  |  Branch (3661:41): [True: 0, False: 0]
  ------------------
 3662|      0|        {
 3663|       |            /* check */
 3664|      0|            q = -( pStruct[iComp].nLink + 1 );
 3665|      0|            if (!pStructR || !num_componentsR || q >= num_componentsR || pStructR[q].nLink != ( iComp + 1 ))
  ------------------
  |  Branch (3665:17): [True: 0, False: 0]
  |  Branch (3665:30): [True: 0, False: 0]
  |  Branch (3665:50): [True: 0, False: 0]
  |  Branch (3665:74): [True: 0, False: 0]
  ------------------
 3666|      0|            {
 3667|      0|                ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 3668|      0|                goto exit_function;
 3669|      0|            }
 3670|      0|            continue; /* Disconnected structure component has already been processed as a Reconnected one */
 3671|      0|        }
 3672|       |
 3673|      2|        at = pStruct[iComp].at2;
 3674|      2|        num_atoms = pStruct[iComp].num_atoms;
 3675|      2|        tot_num_at = pStruct[iComp].num_atoms + ( num_deleted_H = pStruct[iComp].num_deleted_H );
 3676|      2|        bAccumulateChanges = ( pStruct[iComp].nLink > 0 && !num_componentsR );
  ------------------
  |  Branch (3676:32): [True: 0, False: 2]
  |  Branch (3676:60): [True: 0, False: 0]
  ------------------
 3677|      2|        nChargeRevrs = pStruct[iComp].nChargeRevrs;
 3678|      2|        nChargeInChI = pStruct[iComp].nChargeInChI;
 3679|      2|        num_deleted_components += ( 0 != pStruct[iComp].bDeleted );
 3680|      2|        if (!at || !num_atoms)
  ------------------
  |  Branch (3680:13): [True: 1, False: 1]
  |  Branch (3680:20): [True: 0, False: 1]
  ------------------
 3681|      1|        {
 3682|      1|            continue;
 3683|      1|        }
 3684|       |        /* find whether it is a reconnected structure */
 3685|      1|        q = bRevInchiComponentExists( pStruct + iComp, INCHI_REC, TAUT_YES, 0 ) ? INCHI_REC : INCHI_BAS;
  ------------------
  |  |  576|      1|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                      q = bRevInchiComponentExists( pStruct + iComp, INCHI_REC, TAUT_YES, 0 ) ? INCHI_REC : INCHI_BAS;
  ------------------
  |  |  580|      1|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                      q = bRevInchiComponentExists( pStruct + iComp, INCHI_REC, TAUT_YES, 0 ) ? INCHI_REC : INCHI_BAS;
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                      q = bRevInchiComponentExists( pStruct + iComp, INCHI_REC, TAUT_YES, 0 ) ? INCHI_REC : INCHI_BAS;
  ------------------
  |  |  575|      2|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (3685:13): [True: 0, False: 1]
  ------------------
 3686|       |        /*
 3687|       |        q = pStruct[iComp].RevInChI.pINChI_Aux[INCHI_REC] &&
 3688|       |            pStruct[iComp].RevInChI.pINChI_Aux[INCHI_REC][0][TAUT_YES] &&
 3689|       |            pStruct[iComp].RevInChI.pINChI_Aux[INCHI_REC][0][TAUT_YES]->nNumberOfAtoms? INCHI_REC : INCHI_BAS;
 3690|       |        */
 3691|      1|        pINChI_Aux = pStruct[iComp].RevInChI.pINChI_Aux[q][0][TAUT_YES]; /* 0 = 1st component in RevInChI */
  ------------------
  |  |  580|      1|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3692|       |        /*nNumProtAddedByRevrs = pINChI_Aux->nNumRemovedProtons;*/
 3693|      1|        nNumProtAddedByRevrs = -pStruct[iComp].nNumRemovedProtonsByRevrs;
 3694|      1|        bNormalizationFlags = pINChI_Aux->bNormalizationFlags;
 3695|      1|        num_tg = pINChI_Aux->nNumberOfTGroups;
 3696|       |
 3697|       |
 3698|       |        /* disconnect all explicit H and add the number of implicit iso H and all explicit terminal H to the number of implicit H */
 3699|      1|        if (0 > ( ret = DisconnectedConnectedH( at, num_atoms, num_deleted_H ) ))
  ------------------
  |  Branch (3699:13): [True: 0, False: 1]
  ------------------
 3700|      0|        {
 3701|      0|            goto exit_function;
 3702|      0|        }
 3703|      1|        num_prot_prev = num_prot;
 3704|      1|        ret = AddRemoveProtonsRestr( at, num_atoms, &num_prot, nNumProtAddedByRevrs,
 3705|      1|                                     bNormalizationFlags, num_tg, nChargeRevrs, nChargeInChI );
 3706|       |
 3707|      1|        pStruct[iComp].bPostProcessed = ret;
 3708|      1|        num_changed += ( ret > 0 );
 3709|      1|        if (ret < 0)
  ------------------
  |  Branch (3709:13): [True: 0, False: 1]
  ------------------
 3710|      0|        {
 3711|      0|            goto exit_function;
 3712|      0|        }
 3713|      1|        if (ret > 0)
  ------------------
  |  Branch (3713:13): [True: 0, False: 1]
  ------------------
 3714|      0|        {
 3715|       |            /* recalculate InChI; it will reconnect at */
 3716|      0|            StrFromINChI *pStruct1 = pStruct + iComp;
 3717|      0|            INCHI_MODE    nMode = ip->nMode;
 3718|      0|            FreeAllINChIArrays( pStruct1->RevInChI.pINChI,
 3719|      0|                                pStruct1->RevInChI.pINChI_Aux,
 3720|      0|                                pStruct1->RevInChI.num_components );
 3721|       |
 3722|      0|            if (bHasSomeFixedH && pStruct1->iInchiRec == INCHI_REC && pStruct1->iMobileH == TAUT_YES &&
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                          if (bHasSomeFixedH && pStruct1->iInchiRec == INCHI_REC && pStruct1->iMobileH == TAUT_YES &&
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3722:17): [True: 0, False: 0]
  |  Branch (3722:35): [True: 0, False: 0]
  |  Branch (3722:71): [True: 0, False: 0]
  ------------------
 3723|      0|                 !pStruct1->bFixedHExists && !( ip->nMode & REQ_MODE_BASIC ))
  ------------------
  |  |   43|      0|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
  |  Branch (3723:18): [True: 0, False: 0]
  |  Branch (3723:46): [True: 0, False: 0]
  ------------------
 3724|      0|            {
 3725|       |                /* reconnected components without Fixed-H layer may produce 'tautomeric' fragments like Cl(-) */
 3726|      0|                ip->nMode |= REQ_MODE_BASIC;
  ------------------
  |  |   43|      0|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
 3727|      0|            }
 3728|       |            /* calls ConnectDisconnectedH(...): subtracts number of implicit iso H from implicit H */
 3729|       |
 3730|      0|            ret = MakeInChIOutOfStrFromINChI2( ic, pCG, ip, sd, pStruct1, 0, 0, num_inp );
 3731|       |
 3732|      0|            ip->nMode = nMode;
 3733|      0|            if (ret < 0)
  ------------------
  |  Branch (3733:17): [True: 0, False: 0]
  ------------------
 3734|      0|            {
 3735|      0|                goto exit_function;
 3736|      0|            }
 3737|      0|        }
 3738|      1|        else
 3739|      1|        {
 3740|       |             /* reconnect disconnected terminal H and subtracts number of implicit iso H from implicit H */
 3741|      1|            if (0 > ( ret = ConnectDisconnectedH( at, num_atoms, num_deleted_H ) ))
  ------------------
  |  Branch (3741:17): [True: 0, False: 1]
  ------------------
 3742|      0|            {
 3743|      0|                goto exit_function;
 3744|      0|            }
 3745|      1|        }
 3746|      1|        if (bAccumulateChanges && recmet_change_balance)
  ------------------
  |  Branch (3746:13): [True: 0, False: 1]
  |  Branch (3746:35): [True: 0, False: 0]
  ------------------
 3747|      0|        {
 3748|       |            /* processed Reconnected layer component that is also present in Disconnected layer */
 3749|      0|            delta_recmet_prot += num_prot - num_prot_prev;
 3750|      0|        }
 3751|      1|    }
 3752|       |
 3753|      1|    iComp = num_components - 1;
 3754|      1|    if (!bHasSomeFixedH && num_prot > 0 && 1 == num_deleted_components && iComp >= 0 && pStruct[iComp].bDeleted)
  ------------------
  |  Branch (3754:9): [True: 1, False: 0]
  |  Branch (3754:28): [True: 1, False: 0]
  |  Branch (3754:44): [True: 1, False: 0]
  |  Branch (3754:75): [True: 1, False: 0]
  |  Branch (3754:89): [True: 1, False: 0]
  ------------------
 3755|      1|    {
 3756|       |        /* add bare protons to the deleted Mobile-H component; undelete the component */
 3757|      1|        num_prot_prev = num_prot;
 3758|      1|        if (!MakeProtonComponent( pStruct + iComp, iComp, num_prot ))
  ------------------
  |  Branch (3758:13): [True: 0, False: 1]
  ------------------
 3759|      0|        {
 3760|      0|            goto exit_function;
 3761|      0|        }
 3762|      1|        else
 3763|      1|        {
 3764|       |             /* recalculate InChI; it will reconnect at */
 3765|      1|            StrFromINChI *pStruct1 = pStruct + iComp;
 3766|      1|            INCHI_MODE    nMode = ip->nMode;
 3767|      1|            num_changed++;
 3768|      1|            num_prot = 0;
 3769|      1|            FreeAllINChIArrays( pStruct1->RevInChI.pINChI,
 3770|      1|                                pStruct1->RevInChI.pINChI_Aux,
 3771|      1|                                pStruct1->RevInChI.num_components );
 3772|       |
 3773|      1|            if (bHasSomeFixedH && pStruct1->iInchiRec == INCHI_REC && pStruct1->iMobileH == TAUT_YES &&
  ------------------
  |  |  576|      1|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                          if (bHasSomeFixedH && pStruct1->iInchiRec == INCHI_REC && pStruct1->iMobileH == TAUT_YES &&
  ------------------
  |  |  580|      1|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3773:17): [True: 0, False: 1]
  |  Branch (3773:35): [True: 0, False: 0]
  |  Branch (3773:71): [True: 0, False: 0]
  ------------------
 3774|      1|                 !pStruct1->bFixedHExists && !( ip->nMode & REQ_MODE_BASIC ))
  ------------------
  |  |   43|      0|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
  |  Branch (3774:18): [True: 0, False: 0]
  |  Branch (3774:46): [True: 0, False: 0]
  ------------------
 3775|      0|            {
 3776|       |                /* reconnected components without Fixed-H layer may produce 'tautomeric' fragments like Cl(-) */
 3777|      0|                ip->nMode |= REQ_MODE_BASIC;
  ------------------
  |  |   43|      0|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
 3778|      0|            }
 3779|       |            /* Although MakeInChIOutOfStrFromINChI2() calls ConnectDisconnectedH(...) */
 3780|       |            /* to subtracts number of implicit iso H from implicit H */
 3781|       |            /* this CANNOT have any effect on the deleted H component */
 3782|       |
 3783|      1|            ret = MakeInChIOutOfStrFromINChI2( ic, pCG, ip, sd, pStruct1, 0, 0, num_inp );
 3784|       |
 3785|      1|            ip->nMode = nMode;
 3786|      1|            if (ret < 0)
  ------------------
  |  Branch (3786:17): [True: 0, False: 1]
  ------------------
 3787|      0|            {
 3788|      0|                goto exit_function;
 3789|      0|            }
 3790|      1|            if (bAccumulateChanges && recmet_change_balance)
  ------------------
  |  Branch (3790:17): [True: 0, False: 1]
  |  Branch (3790:39): [True: 0, False: 0]
  ------------------
 3791|      0|            {
 3792|       |                /* processed Reconnected layer component that is also present in Disconnected layer */
 3793|      0|                delta_recmet_prot += num_prot - num_prot_prev;
 3794|      0|            }
 3795|      1|        }
 3796|      1|    }
 3797|      1|    *nProtonsToBeRemovedByNormFromRevrs = num_prot;
 3798|      1|    if (recmet_change_balance)
  ------------------
  |  Branch (3798:9): [True: 0, False: 1]
  ------------------
 3799|      0|    {
 3800|      0|        *recmet_change_balance = delta_recmet_prot;
 3801|      0|    }
 3802|       |
 3803|      1|exit_function:
 3804|       |
 3805|      1|    return ret < 0 ? ret : num_changed;
  ------------------
  |  Branch (3805:12): [True: 0, False: 1]
  ------------------
 3806|      1|}
AddRemIsoProtonsInRestrStruct:
 3822|     28|{
 3823|       |    /* on entry and exit, all at[i].num_H do not include isotopic H and explicit terminal H are connected */
 3824|     28|    int  iComp, q, k, ret = 0, bNotEmpty;
 3825|     28|    int      num_atoms, tot_num_at, num_deleted_H, num_tg, num_changed;
 3826|     28|    inp_ATOM *at;
 3827|     28|    NUM_H    num_prot[NUM_H_ISOTOPES], delta_recmet_prot[NUM_H_ISOTOPES], num_prot_prev[NUM_H_ISOTOPES];
 3828|     28|    int      bAccumulateChanges;
 3829|     28|    INChI_Aux *pINChI_Aux;
 3830|     28|    INChI     *pINChI;
 3831|     28|    INCHI_MODE bNormalizationFlags;
 3832|     28|    INPUT_PARMS *ip, ip_loc;
 3833|       |
 3834|     28|    ip_loc = *ip_inp;
 3835|     28|    ip = &ip_loc;
 3836|       |
 3837|     28|    memcpy( num_prot, pProtonBalance, sizeof( num_prot ) );
 3838|    112|    for (bNotEmpty = 0, k = 0; k < NUM_H_ISOTOPES; k++)
  ------------------
  |  |   53|    112|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (3838:32): [True: 84, False: 28]
  ------------------
 3839|     84|    {
 3840|     84|        bNotEmpty |= num_prot[k];
 3841|     84|    }
 3842|     28|    if (!bNotEmpty)
  ------------------
  |  Branch (3842:9): [True: 28, False: 0]
  ------------------
 3843|     28|    {
 3844|     28|        return 0;
 3845|     28|    }
 3846|      0|    memset( delta_recmet_prot, 0, sizeof( delta_recmet_prot ) );
 3847|      0|    num_changed = 0;
 3848|       |    /*----------------------------------------------------------------------------------
 3849|       |    nLink < 0 && num_componentsR > 0 => This is a Disconnected structure component; it is
 3850|       |                                        same as already processed reconnected one
 3851|       |                                        Do no preicess it
 3852|       |
 3853|       |    nLink > 0 && num_componentsR > 0 => This is a Disconnected structure component;
 3854|       |    (should not happen)                 It it is a result of (nLink-1)th Reconeected
 3855|       |                                        component disconnection (NOT IMPLEMENTED YET)
 3856|       |
 3857|       |    nLink = 0                        => Process this component. It is either a reconnected
 3858|       |                                        component, or a result of a disconnection (for now)
 3859|       |
 3860|       |    nLink > 0 && num_componentsR = 0 => This is a Reconnected component that is same as
 3861|       |                                        a disconnected one that will not be processed.
 3862|       |                                        Process and save charge delta.
 3863|       |    -----------------------------------------------------------------------------------*/
 3864|       |
 3865|      0|    for (iComp = 0; iComp < num_components && num_prot; iComp++)
  ------------------
  |  Branch (3865:21): [True: 0, False: 0]
  |  Branch (3865:47): [True: 0, False: 0]
  ------------------
 3866|      0|    {
 3867|      0|        bAccumulateChanges = 0;
 3868|      0|        if (pStruct[iComp].nLink < 0 && num_componentsR > 0)
  ------------------
  |  Branch (3868:13): [True: 0, False: 0]
  |  Branch (3868:41): [True: 0, False: 0]
  ------------------
 3869|      0|        {
 3870|       |            /* check */
 3871|      0|            q = -( pStruct[iComp].nLink + 1 );
 3872|      0|            if (!pStructR || !num_componentsR || q >= num_componentsR || pStructR[q].nLink != ( iComp + 1 ))
  ------------------
  |  Branch (3872:17): [True: 0, False: 0]
  |  Branch (3872:30): [True: 0, False: 0]
  |  Branch (3872:50): [True: 0, False: 0]
  |  Branch (3872:74): [True: 0, False: 0]
  ------------------
 3873|      0|            {
 3874|      0|                ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 3875|      0|                goto exit_function;
 3876|      0|            }
 3877|      0|            continue; /* Disconnected structure component has already been processed as a Reconnected one */
 3878|      0|        }
 3879|       |
 3880|      0|        at = pStruct[iComp].at2;
 3881|      0|        num_atoms = pStruct[iComp].num_atoms;
 3882|      0|        tot_num_at = pStruct[iComp].num_atoms + ( num_deleted_H = pStruct[iComp].num_deleted_H );
 3883|      0|        bAccumulateChanges = ( pStruct[iComp].nLink > 0 && !num_componentsR );
  ------------------
  |  Branch (3883:32): [True: 0, False: 0]
  |  Branch (3883:60): [True: 0, False: 0]
  ------------------
 3884|       |
 3885|      0|        if (!at || !num_atoms)
  ------------------
  |  Branch (3885:13): [True: 0, False: 0]
  |  Branch (3885:20): [True: 0, False: 0]
  ------------------
 3886|      0|        {
 3887|      0|            continue;
 3888|      0|        }
 3889|       |        /* find whether it is a reconnected structure */
 3890|      0|        q = pStruct[iComp].RevInChI.pINChI_Aux[INCHI_REC] &&
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (3890:13): [True: 0, False: 0]
  ------------------
 3891|      0|            pStruct[iComp].RevInChI.pINChI_Aux[INCHI_REC][0][TAUT_YES] &&
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                          pStruct[iComp].RevInChI.pINChI_Aux[INCHI_REC][0][TAUT_YES] &&
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3891:13): [True: 0, False: 0]
  ------------------
 3892|      0|            pStruct[iComp].RevInChI.pINChI_Aux[INCHI_REC][0][TAUT_YES]->nNumberOfAtoms ? INCHI_REC : INCHI_BAS;
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                          pStruct[iComp].RevInChI.pINChI_Aux[INCHI_REC][0][TAUT_YES]->nNumberOfAtoms ? INCHI_REC : INCHI_BAS;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                          pStruct[iComp].RevInChI.pINChI_Aux[INCHI_REC][0][TAUT_YES]->nNumberOfAtoms ? INCHI_REC : INCHI_BAS;
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                          pStruct[iComp].RevInChI.pINChI_Aux[INCHI_REC][0][TAUT_YES]->nNumberOfAtoms ? INCHI_REC : INCHI_BAS;
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (3892:13): [True: 0, False: 0]
  ------------------
 3893|       |
 3894|      0|        pINChI_Aux = pStruct[iComp].RevInChI.pINChI_Aux[q][0][TAUT_YES]; /* 0 = 1st component in RevInChI */
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3895|      0|        pINChI = pStruct[iComp].RevInChI.pINChI[q][0][TAUT_YES]; /* 0 = 1st component in RevInChI */
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 3896|      0|        bNormalizationFlags = pINChI_Aux->bNormalizationFlags;
 3897|      0|        num_tg = pINChI_Aux->nNumberOfTGroups;
 3898|      0|        memcpy( num_prot_prev, num_prot, sizeof( num_prot_prev ) );
 3899|       |
 3900|       |        /* pass CONNECTED explicit H to AddRemoveIsoProtonsRestr() for isotopic H addition */
 3901|      0|        ret = AddRemoveIsoProtonsRestr( at, num_atoms, num_prot, num_tg );
 3902|       |
 3903|      0|        pStruct[iComp].bPostProcessed |= ret;
 3904|      0|        num_changed += ( ret > 0 );
 3905|      0|        if (ret < 0)
  ------------------
  |  Branch (3905:13): [True: 0, False: 0]
  ------------------
 3906|      0|        {
 3907|      0|            goto exit_function;
 3908|      0|        }
 3909|      0|        if (ret > 0)
  ------------------
  |  Branch (3909:13): [True: 0, False: 0]
  ------------------
 3910|      0|        {
 3911|      0|            StrFromINChI *pStruct1 = pStruct + iComp;
 3912|      0|            INCHI_MODE    nMode = ip->nMode;
 3913|       |            /* recalculate InChI; MakeInChIOutOfStrFromINChI2() will reconnect explicit H */
 3914|       |            /* disconnect all explicit H and add the number of implicit iso H and all explicit terminal H to the number of implicit H */
 3915|      0|            if (0 > ( ret = DisconnectedConnectedH( at, num_atoms, num_deleted_H ) ))
  ------------------
  |  Branch (3915:17): [True: 0, False: 0]
  ------------------
 3916|      0|            {
 3917|      0|                goto exit_function;
 3918|      0|            }
 3919|      0|            FreeAllINChIArrays( pStruct1->RevInChI.pINChI,
 3920|      0|                                pStruct1->RevInChI.pINChI_Aux,
 3921|      0|                                pStruct1->RevInChI.num_components );
 3922|      0|            if (bHasSomeFixedH && pStruct1->iInchiRec == INCHI_REC && pStruct1->iMobileH == TAUT_YES &&
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                          if (bHasSomeFixedH && pStruct1->iInchiRec == INCHI_REC && pStruct1->iMobileH == TAUT_YES &&
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3922:17): [True: 0, False: 0]
  |  Branch (3922:35): [True: 0, False: 0]
  |  Branch (3922:71): [True: 0, False: 0]
  ------------------
 3923|      0|                 !pStruct1->bFixedHExists && !( ip->nMode & REQ_MODE_BASIC ))
  ------------------
  |  |   43|      0|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
  |  Branch (3923:18): [True: 0, False: 0]
  |  Branch (3923:46): [True: 0, False: 0]
  ------------------
 3924|      0|            {
 3925|       |                /* reconnected components without Fixed-H layer may produce 'tautomeric' fragments like Cl(-) */
 3926|      0|                ip->nMode |= REQ_MODE_BASIC;
  ------------------
  |  |   43|      0|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
 3927|      0|            }
 3928|       |            /* input: disconnected explicit H, output: connected explicit H */
 3929|      0|            ret = MakeInChIOutOfStrFromINChI2( ic, pCG, ip, sd, pStruct1, 0, 0, num_inp );
 3930|      0|            ip->nMode = nMode;
 3931|      0|            if (ret < 0)
  ------------------
  |  Branch (3931:17): [True: 0, False: 0]
  ------------------
 3932|      0|            {
 3933|      0|                goto exit_function;
 3934|      0|            }
 3935|      0|        }
 3936|       |        /* the following was commented out 2007-08-28 by DT. Reason: it's a bug since H must be already connected */
 3937|       |        /* else {
 3938|       |            if ( 0 > ( ret = ConnectDisconnectedH( at, num_atoms, num_deleted_H ) ) ) {
 3939|       |                goto exit_function;
 3940|       |            }
 3941|       |        } */
 3942|      0|        if (bAccumulateChanges)
  ------------------
  |  Branch (3942:13): [True: 0, False: 0]
  ------------------
 3943|      0|        {
 3944|       |            /* processed Reconnected layer component that is also present in Disconnected layer */
 3945|      0|            for (k = 0; k < NUM_H_ISOTOPES; k++)
  ------------------
  |  |   53|      0|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (3945:25): [True: 0, False: 0]
  ------------------
 3946|      0|            {
 3947|      0|                delta_recmet_prot[k] += num_prot[k] - num_prot_prev[k];
 3948|      0|            }
 3949|      0|        }
 3950|      0|    }
 3951|       |
 3952|      0|    memcpy( pProtonBalance, num_prot, sizeof( num_prot ) );
 3953|      0|    if (recmet_change_balance)
  ------------------
  |  Branch (3953:9): [True: 0, False: 0]
  ------------------
 3954|      0|    {
 3955|      0|        memcpy( recmet_change_balance, delta_recmet_prot, sizeof( delta_recmet_prot ) );
 3956|      0|    }
 3957|       |
 3958|      0|exit_function:
 3959|       |
 3960|      0|    return ret < 0 ? ret : num_changed;
  ------------------
  |  Branch (3960:12): [True: 0, False: 0]
  ------------------
 3961|      0|}

FixMobileHRestoredStructure:
  155|      1|{
  156|       |    /*--------- process extra or missing Fixed-H on non-tautomeric atoms ------*/
  157|       |    /* at2 should be the most recently restored atom, Fixed-H */
  158|      1|    int i, j, k, iat, delta, tot_succes, cur_success, ret = 0;
  159|      1|    CMP2MHINCHI c2i;
  160|      1|    CMP2MHINCHI *pc2i = &c2i;
  161|       |
  162|      1|    EDGE_LIST AllChargeEdges, CurrEdges, CurrEdges2, CurrEdges3, TautEdges, NFlowerEdges, OtherNFlowerEdges, FixedLargeRingStereoEdges;
  163|      1|    EDGE_LIST  *pEdgeList = NULL;
  164|       |
  165|      1|    EdgeIndex e;
  166|      1|    BNS_EDGE  *pe;
  167|      1|    Vertex v1, v2, vPlusMinus;
  168|      1|    BNS_VERTEX *pv1, *pv2;
  169|       |
  170|      1|    Vertex     vPathStart, vPathEnd;
  171|      1|    int        nPathLen, nDeltaH, nDeltaCharge, nNumVisitedAtoms;
  172|       |
  173|      1|    int        nNumRunBNS = 0, forbidden_edge_mask_inv = ~forbidden_edge_mask;
  174|       |
  175|       |    INCHI_HEAPCHK
  176|       |
  177|      1|        AllocEdgeList( &AllChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      1|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  178|      1|    AllocEdgeList( &CurrEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      1|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  179|      1|    AllocEdgeList( &NFlowerEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      1|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  180|      1|    AllocEdgeList( &CurrEdges2, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      1|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  181|      1|    AllocEdgeList( &CurrEdges3, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      1|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  182|      1|    AllocEdgeList( &OtherNFlowerEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      1|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  183|      1|    AllocEdgeList( &FixedLargeRingStereoEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      1|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  184|      1|    AllocEdgeList( &TautEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      1|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  185|       |
  186|      1|    tot_succes = 0;
  187|       |
  188|      1|    if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (188:9): [True: 1, False: 0]
  |  Branch (188:37): [True: 0, False: 1]
  ------------------
  189|      0|    {
  190|      0|        goto exit_function;  /* no fixed-H found */
  191|      0|    }
  192|       |    /* taut group edges */
  193|      1|    for (i = 0; i < pTCGroups->num_tgroups; i++)
  ------------------
  |  Branch (193:17): [True: 0, False: 1]
  ------------------
  194|      0|    {
  195|      0|        pv1 = pBNS->vert + ( v1 = pTCGroups->pTCG[i].nVertexNumber ); /* t-group vertex */
  196|      0|        for (j = 0; j < pv1->num_adj_edges; j++)
  ------------------
  |  Branch (196:21): [True: 0, False: 0]
  ------------------
  197|      0|        {
  198|       |            /* e, pe - tautomeric atom edge; pv2 - endpoint vertex */
  199|       |            /* Note: pe, pv2, v1 are not used here; they are to show how to traverse t-group */
  200|      0|            pv2 = pBNS->vert + ( pe = pBNS->edge + ( e = pv1->iedge[j] ) )->neighbor1;
  201|      0|            if (ret = AddToEdgeList( &TautEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   47|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (201:17): [True: 0, False: 0]
  ------------------
  202|      0|            {
  203|      0|                goto exit_function;
  204|      0|            }
  205|      0|        }
  206|      0|    }
  207|       |    /* charge and flower edges */
  208|      6|    for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (208:17): [True: 5, False: 1]
  ------------------
  209|      5|    {
  210|      5|        if (( e = pVA[i].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (210:13): [True: 4, False: 1]
  |  Branch (210:57): [True: 4, False: 0]
  ------------------
  211|      5|            ( ret = AddToEdgeList( &AllChargeEdges, e, INC_ADD_EDGE ) ))
  ------------------
  |  |   47|      4|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (211:13): [True: 0, False: 4]
  ------------------
  212|      0|        {
  213|      0|            goto exit_function;
  214|      0|        }
  215|      5|        if (( e = pVA[i].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (215:13): [True: 5, False: 0]
  |  Branch (215:56): [True: 5, False: 0]
  ------------------
  216|      5|        {
  217|      5|            if (ret = AddToEdgeList( &AllChargeEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   47|      5|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (217:17): [True: 0, False: 5]
  ------------------
  218|      0|            {
  219|      0|                goto exit_function;
  220|      0|            }
  221|       |
  222|       |            /* in addition, disallow N(V) creation by forbidding charge flower edge that has flow=1 */
  223|      5|            if (pVA[i].cNumValenceElectrons == 5 && !pVA[i].cMetal && /* N, P, As */
  ------------------
  |  Branch (223:17): [True: 0, False: 5]
  |  Branch (223:53): [True: 0, False: 0]
  ------------------
  224|      5|                 NO_VERTEX != ( j = GetChargeFlowerUpperEdge( pBNS, pVA, e ) ))
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (224:18): [True: 0, False: 0]
  ------------------
  225|      0|            {
  226|       |
  227|      0|                if (!pBNS->edge[j].forbidden && pBNS->edge[j].flow)
  ------------------
  |  Branch (227:21): [True: 0, False: 0]
  |  Branch (227:49): [True: 0, False: 0]
  ------------------
  228|      0|                {
  229|      0|                    if (ret = AddToEdgeList( &AllChargeEdges, j, INC_ADD_EDGE ))
  ------------------
  |  |   47|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (229:25): [True: 0, False: 0]
  ------------------
  230|      0|                    {
  231|      0|                        goto exit_function;
  232|      0|                    }
  233|      0|                    if (ret = AddToEdgeList( &NFlowerEdges, j, INC_ADD_EDGE ))
  ------------------
  |  |   47|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (233:25): [True: 0, False: 0]
  ------------------
  234|      0|                    {
  235|      0|                        goto exit_function;
  236|      0|                    }
  237|      0|                }
  238|      0|                else
  239|      0|                {
  240|      0|                    if (ret = AddToEdgeList( &OtherNFlowerEdges, j, INC_ADD_EDGE ))
  ------------------
  |  |   47|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (240:25): [True: 0, False: 0]
  ------------------
  241|      0|                    {
  242|      0|                        goto exit_function;
  243|      0|                    }
  244|      0|                }
  245|      0|            }
  246|      5|        }
  247|      5|    }
  248|      1|    if (forbidden_stereo_edge_mask)
  ------------------
  |  Branch (248:9): [True: 1, False: 0]
  ------------------
  249|      1|    {
  250|      6|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (250:21): [True: 5, False: 1]
  ------------------
  251|      5|        {
  252|     13|            for (j = 0; j < at2[i].valence; j++)
  ------------------
  |  Branch (252:25): [True: 8, False: 5]
  ------------------
  253|      8|            {
  254|      8|                if (pBNS->edge[k = pBNS->vert[i].iedge[j]].forbidden == forbidden_stereo_edge_mask)
  ------------------
  |  Branch (254:21): [True: 0, False: 8]
  ------------------
  255|      0|                {
  256|      0|                    int nMinRingSize = is_bond_in_Nmax_memb_ring( at2, i, j, pStruct->pbfsq->q,
  257|      0|                                                             pStruct->pbfsq->nAtomLevel,
  258|      0|                                                             pStruct->pbfsq->cSource, 99 /* max ring size */ );
  259|      0|                    if (0 < nMinRingSize && ( ret = AddToEdgeList( &FixedLargeRingStereoEdges, k, INC_ADD_EDGE ) ))
  ------------------
  |  |   47|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (259:25): [True: 0, False: 0]
  |  Branch (259:45): [True: 0, False: 0]
  ------------------
  260|      0|                    {
  261|      0|                        goto exit_function;
  262|      0|                    }
  263|      0|                }
  264|      8|            }
  265|      5|        }
  266|      1|    }
  267|       |
  268|       |    INCHI_HEAPCHK
  269|       |
  270|      1|    if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (270:9): [True: 0, False: 1]
  ------------------
  271|      0|    {
  272|      0|        goto exit_function;
  273|      0|    }
  274|       |
  275|      1|    INCHI_HEAPCHK
  276|      1|    if (ret = FillOutCMP2MHINCHI( pStruct, pTCGroups, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (276:9): [True: 0, False: 1]
  ------------------
  277|      0|    {
  278|      0|        goto exit_function;
  279|      0|    }
  280|       |
  281|       |    INCHI_HEAPCHK
  282|       |
  283|       |
  284|       |
  285|       |
  286|      1|    if (pc2i->nNumTgInChI == 1 && ( pc2i->nNumEndpRevrs < pc2i->nNumEndpInChI || pc2i->nNumTgRevrs > 1 ) &&
  ------------------
  |  Branch (286:9): [True: 0, False: 1]
  |  Branch (286:37): [True: 0, False: 0]
  |  Branch (286:82): [True: 0, False: 0]
  ------------------
  287|      1|            pc2i->nNumTgDBNMinusRevrs + pc2i->nNumTgNHMinusRevrs == 0 && pc2i->nNumTgOMinusInChI &&
  ------------------
  |  Branch (287:13): [True: 0, False: 0]
  |  Branch (287:74): [True: 0, False: 0]
  ------------------
  288|      1|            !( pTCGroups->pTCG[0].tg_RestoreFlags & TGRF_MINUS_FIRST ))
  ------------------
  |  Branch (288:13): [True: 0, False: 0]
  ------------------
  289|      0|    {            /*----------------------------------------------------*/
  290|       |        /* case 01: restored has -O(-) and does not have N(-) */
  291|       |        /*          endpoints defined by the original InChI   */
  292|       |        /*          restored has single taut. group or more   */
  293|       |        /*          tautomeric endpoints.                     */
  294|       |        /* Solution: move (-) from endp. -O(-) to endpoints N */
  295|       |        /*-------
  296|       |---------------------------------------------*/
  297|      0|        pTCGroups->pTCG[0].tg_RestoreFlags |= TGRF_MINUS_FIRST;
  298|       |        /* recalculate InChI from the structure */
  299|      0|        if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (299:13): [True: 0, False: 0]
  ------------------
  300|      0|            ppt_group_info, ppat_norm, ppat_prep ) ))
  301|      0|        {
  302|      0|            goto exit_function;
  303|      0|        }
  304|      0|        if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (304:13): [True: 0, False: 0]
  ------------------
  305|      0|        {
  306|      0|            goto exit_function;
  307|      0|        }
  308|      0|        if (!pInChI[0]->nNum_H_fixed && !pStruct->pOneINChI[0]->nNum_H_fixed)
  ------------------
  |  Branch (308:13): [True: 0, False: 0]
  |  Branch (308:41): [True: 0, False: 0]
  ------------------
  309|      0|        {
  310|      0|            goto exit_function;  /* no fixed-H found */
  311|      0|        }
  312|      0|        if (ret = FillOutCMP2MHINCHI( pStruct, pTCGroups, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (312:13): [True: 0, False: 0]
  ------------------
  313|      0|        {
  314|      0|            goto exit_function;
  315|      0|        }
  316|      0|        if (!pc2i->bHasDifference)
  ------------------
  |  Branch (316:13): [True: 0, False: 0]
  ------------------
  317|      0|        {
  318|      0|            goto exit_function; /* nothing to do */
  319|      0|        }
  320|      0|    }
  321|      1|    if (pc2i->nNumTgInChI == 1 && ( pc2i->nNumEndpRevrs < pc2i->nNumEndpInChI || pc2i->nNumTgRevrs > 1 ) &&
  ------------------
  |  Branch (321:9): [True: 0, False: 1]
  |  Branch (321:37): [True: 0, False: 0]
  |  Branch (321:82): [True: 0, False: 0]
  ------------------
  322|      1|         pc2i->nNumTgDBNMinusRevrs + pc2i->nNumTgNHMinusRevrs == 0 && pc2i->nNumTgOMinusInChI == 0)
  ------------------
  |  Branch (322:10): [True: 0, False: 0]
  |  Branch (322:71): [True: 0, False: 0]
  ------------------
  323|      0|    {
  324|       |        /*-------------------------------------------------------*/
  325|       |        /* case 02: restored has no -O(-) and does not have N(-) */
  326|       |        /*          restored has single taut. group or more      */
  327|       |        /*          tautomeric endpoints.                        */
  328|       |        /* Solution: >N-AB=N-  => >N(+)=AB-NH- (add H(+))        */
  329|       |        /* Solution: >N-AB=NH  => >N(+)=AB-NH2 (add H(+))        */
  330|       |        /*      SB_N_III  DB_N_III                               */
  331|       |        /*-------------------------------------------------------*/
  332|      0|        int iat_SB_N_III[MAX_DIFF_MOBH], iat_DB_N_III[MAX_DIFF_MOBH];
  333|      0|        int num_SB_N_III = 0, num_DB_N_III = 0, k1, k2;
  334|      0|        CurrEdges.num_edges = 0;
  335|      0|        cur_success = 0;
  336|      0|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (336:21): [True: 0, False: 0]
  ------------------
  337|      0|        {
  338|      0|            iat = i;
  339|      0|            if (pVA[iat].cNumValenceElectrons == 5 && pVA[i].cPeriodicRowNumber == 1 &&
  ------------------
  |  Branch (339:17): [True: 0, False: 0]
  |  Branch (339:55): [True: 0, False: 0]
  ------------------
  340|      0|                 !at2[iat].endpoint && !at2[iat].charge && !at2[iat].radical)
  ------------------
  |  Branch (340:18): [True: 0, False: 0]
  |  Branch (340:40): [True: 0, False: 0]
  |  Branch (340:60): [True: 0, False: 0]
  ------------------
  341|      0|            {
  342|      0|                if (num_DB_N_III < MAX_DIFF_MOBH && !at2[iat].num_H &&
  ------------------
  |  |  485|      0|#define MAX_DIFF_MOBH 256
  ------------------
  |  Branch (342:21): [True: 0, False: 0]
  |  Branch (342:53): [True: 0, False: 0]
  ------------------
  343|      0|                     at2[iat].valence == 2 &&
  ------------------
  |  Branch (343:22): [True: 0, False: 0]
  ------------------
  344|      0|                     at2[iat].chem_bonds_valence == 3 &&
  ------------------
  |  Branch (344:22): [True: 0, False: 0]
  ------------------
  345|      0|                     !at2[iat].sb_parity[0] &&  /* do not eliminate stereobonds */
  ------------------
  |  Branch (345:22): [True: 0, False: 0]
  ------------------
  346|      0|                     ( e = pVA[iat].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (346:22): [True: 0, False: 0]
  |  Branch (346:68): [True: 0, False: 0]
  ------------------
  347|      0|                     pBNS->edge[e].cap && !pBNS->edge[e].flow)
  ------------------
  |  Branch (347:22): [True: 0, False: 0]
  |  Branch (347:43): [True: 0, False: 0]
  ------------------
  348|      0|                {
  349|       |                    /* -N= */
  350|      0|                    iat_DB_N_III[num_DB_N_III++] = iat;
  351|      0|                }
  352|      0|                else
  353|      0|                {
  354|      0|                    if (num_DB_N_III < MAX_DIFF_MOBH && 1 == at2[iat].num_H &&
  ------------------
  |  |  485|      0|#define MAX_DIFF_MOBH 256
  ------------------
  |  Branch (354:25): [True: 0, False: 0]
  |  Branch (354:57): [True: 0, False: 0]
  ------------------
  355|      0|                         at2[iat].valence == 1 &&
  ------------------
  |  Branch (355:26): [True: 0, False: 0]
  ------------------
  356|      0|                         at2[iat].chem_bonds_valence == 2 &&
  ------------------
  |  Branch (356:26): [True: 0, False: 0]
  ------------------
  357|      0|                         !at2[iat].sb_parity[0] &&  /* do not eliminate stereobonds */
  ------------------
  |  Branch (357:26): [True: 0, False: 0]
  ------------------
  358|      0|                         ( e = pVA[iat].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (358:26): [True: 0, False: 0]
  |  Branch (358:72): [True: 0, False: 0]
  ------------------
  359|      0|                         pBNS->edge[e].cap && !pBNS->edge[e].flow)
  ------------------
  |  Branch (359:26): [True: 0, False: 0]
  |  Branch (359:47): [True: 0, False: 0]
  ------------------
  360|      0|                    {
  361|       |                        /* -N= */
  362|      0|                        iat_DB_N_III[num_DB_N_III++] = iat;
  363|      0|                    }
  364|      0|                    else
  365|      0|                    {
  366|      0|                        if (num_SB_N_III < MAX_DIFF_MOBH && !at2[iat].num_H &&
  ------------------
  |  |  485|      0|#define MAX_DIFF_MOBH 256
  ------------------
  |  Branch (366:29): [True: 0, False: 0]
  |  Branch (366:61): [True: 0, False: 0]
  ------------------
  367|      0|                                at2[iat].valence == 3 &&
  ------------------
  |  Branch (367:33): [True: 0, False: 0]
  ------------------
  368|      0|                                at2[iat].chem_bonds_valence == 3 &&
  ------------------
  |  Branch (368:33): [True: 0, False: 0]
  ------------------
  369|      0|                                ( e = pVA[iat].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (369:33): [True: 0, False: 0]
  |  Branch (369:78): [True: 0, False: 0]
  ------------------
  370|      0|                                pBNS->edge[e].cap && pBNS->edge[e].flow)
  ------------------
  |  Branch (370:33): [True: 0, False: 0]
  |  Branch (370:54): [True: 0, False: 0]
  ------------------
  371|      0|                        {
  372|       |                            /* -N< */
  373|      0|                            iat_SB_N_III[num_SB_N_III++] = iat;
  374|      0|                            if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   47|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (374:33): [True: 0, False: 0]
  ------------------
  375|      0|                            {
  376|      0|                                goto exit_function;
  377|      0|                            }
  378|      0|                        }
  379|      0|                    }
  380|      0|                }
  381|      0|            }
  382|      0|        }
  383|      0|        if (num_DB_N_III && num_SB_N_III)
  ------------------
  |  Branch (383:13): [True: 0, False: 0]
  |  Branch (383:29): [True: 0, False: 0]
  ------------------
  384|      0|        {
  385|      0|            EdgeIndex ieMinus;
  386|      0|            BNS_EDGE  *peMinus;
  387|      0|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
  388|      0|            RemoveForbiddenEdgeMask( pBNS, &CurrEdges, forbidden_edge_mask );
  389|      0|            for (i = 0; i < num_DB_N_III && !cur_success; i++)
  ------------------
  |  Branch (389:25): [True: 0, False: 0]
  |  Branch (389:45): [True: 0, False: 0]
  ------------------
  390|      0|            {
  391|      0|                iat = iat_DB_N_III[i];
  392|      0|                e = pBNS->edge[k1 = pBNS->vert[iat].iedge[0]].flow ? k1 :
  ------------------
  |  Branch (392:21): [True: 0, False: 0]
  ------------------
  393|      0|                    pBNS->edge[k2 = pBNS->vert[iat].iedge[1]].flow ? k2 : NO_VERTEX;
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (393:21): [True: 0, False: 0]
  ------------------
  394|      0|                if (e == NO_VERTEX)
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (394:21): [True: 0, False: 0]
  ------------------
  395|      0|                {
  396|      0|                    continue; /* should not happen */
  397|      0|                }
  398|      0|                ieMinus = pVA[iat].nCMinusGroupEdge - 1;
  399|      0|                peMinus = pBNS->edge + ieMinus;
  400|      0|                pe = pBNS->edge + e;
  401|      0|                if (!pe->flow)
  ------------------
  |  Branch (401:21): [True: 0, False: 0]
  ------------------
  402|      0|                    continue;
  403|      0|                pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
  404|      0|                pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
  405|       |
  406|      0|                pe->forbidden |= forbidden_edge_mask;     /* fix double bond */
  407|      0|                peMinus->forbidden &= forbidden_edge_mask_inv; /* allow negative charge */
  408|      0|                delta = 1;
  409|      0|                pe->flow -= delta; /* remove (-) from AB-O(-) */
  410|      0|                pv1->st_edge.flow -= delta;
  411|      0|                pv2->st_edge.flow -= delta;
  412|      0|                pBNS->tot_st_flow -= 2 * delta;
  413|       |
  414|      0|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
  415|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
  416|       |
  417|      0|                if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (417:21): [True: 0, False: 0]
  |  Branch (417:35): [True: 0, False: 0]
  |  Branch (417:53): [True: 0, False: 0]
  ------------------
  418|      0|                    vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == 2)
  ------------------
  |  Branch (418:21): [True: 0, False: 0]
  |  Branch (418:39): [True: 0, False: 0]
  |  Branch (418:61): [True: 0, False: 0]
  ------------------
  419|      0|                {
  420|       |                    /* Added (-)charge -N= and (+) to -N< => nDeltaCharge == 2 */
  421|      0|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
  422|      0|                    if (ret > 0)
  ------------------
  |  Branch (422:25): [True: 0, False: 0]
  ------------------
  423|      0|                    {
  424|      0|                        nNumRunBNS++;
  425|      0|                        cur_success++; /* 01 */
  426|       |
  427|       |                        /* eliminate (-) charge and add H */
  428|      0|                        pv1 = pBNS->vert + ( v1 = peMinus->neighbor1 );      /* atom */
  429|      0|                        pv2 = pBNS->vert + ( v2 = peMinus->neighbor12 ^ v1 );/* (=) vertex */
  430|       |                        /* effectively eliminate (-) edge by setting its cap=flow= 0 */
  431|      0|                        peMinus->cap--;
  432|      0|                        peMinus->flow--;
  433|      0|                        pv1->st_edge.cap--;
  434|      0|                        pv1->st_edge.flow--;
  435|      0|                        pv2->st_edge.cap--;
  436|      0|                        pv2->st_edge.flow--;
  437|      0|                        pBNS->tot_st_flow -= 2;
  438|      0|                        pBNS->tot_st_cap -= 2;
  439|       |                        /* add H */
  440|      0|                        pStruct->at[iat].num_H++;
  441|       |                        /* register total charge increase */
  442|      0|                        pTCGroups->total_charge++;
  443|      0|                        pStruct->nNumRemovedProtonsByRevrs -= 1;
  444|      0|                    }
  445|      0|                }
  446|      0|                else
  447|      0|                {
  448|      0|                    pe->forbidden &= forbidden_edge_mask_inv;
  449|      0|                    peMinus->forbidden |= forbidden_edge_mask;
  450|      0|                    pe->flow += delta;
  451|      0|                    pv1->st_edge.flow += delta;
  452|      0|                    pv2->st_edge.flow += delta;
  453|      0|                    pBNS->tot_st_flow += 2 * delta;
  454|      0|                }
  455|      0|            }
  456|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
  457|      0|            CurrEdges.num_edges = 0; /* clear current edge list */
  458|       |
  459|      0|            if (cur_success)
  ------------------
  |  Branch (459:17): [True: 0, False: 0]
  ------------------
  460|      0|            {
  461|      0|                tot_succes += cur_success;
  462|       |                /* recalculate InChI from the structure */
  463|       |                /* recalculate InChI from the structure */
  464|      0|                if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (464:21): [True: 0, False: 0]
  ------------------
  465|      0|                    ppt_group_info, ppat_norm, ppat_prep ) ))
  466|      0|                {
  467|      0|                    goto exit_function;
  468|      0|                }
  469|      0|                if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (469:21): [True: 0, False: 0]
  ------------------
  470|      0|                {
  471|      0|                    goto exit_function;
  472|      0|                }
  473|      0|                if (ret = FillOutCMP2MHINCHI( pStruct, pTCGroups, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (473:21): [True: 0, False: 0]
  ------------------
  474|      0|                {
  475|      0|                    goto exit_function;
  476|      0|                }
  477|      0|                if (!pc2i->bHasDifference)
  ------------------
  |  Branch (477:21): [True: 0, False: 0]
  ------------------
  478|      0|                {
  479|      0|                    goto exit_function; /* nothing to do */
  480|      0|                }
  481|      0|            }
  482|      0|        }
  483|      0|    }
  484|      1|    if (pc2i->nNumTgInChI == 1 && ( pc2i->nNumEndpRevrs < pc2i->nNumEndpInChI || pc2i->nNumTgRevrs > 1 ) && /* ADP */
  ------------------
  |  Branch (484:9): [True: 0, False: 1]
  |  Branch (484:37): [True: 0, False: 0]
  |  Branch (484:82): [True: 0, False: 0]
  ------------------
  485|      1|        pc2i->nNumTgMInChI == 0 && pc2i->nNumTgNInChI && pc2i->nNumTgOInChI)
  ------------------
  |  Branch (485:9): [True: 0, False: 0]
  |  Branch (485:36): [True: 0, False: 0]
  |  Branch (485:58): [True: 0, False: 0]
  ------------------
  486|      0|    {
  487|       |        /*-------------------------------------------------------*/
  488|       |        /* case 03: restored has N and O endpoints, no (-) endp  */
  489|       |        /* case 04: original has single taut. group or more      */
  490|       |        /*          tautomeric endpoints.                        */
  491|       |        /* Solution: 1. Move taut attachment from O to N         */
  492|       |        /* Solution: 2. Replace the attachment with (-)          */
  493|       |        /*      SB_N_III  DB_N_III                               */
  494|       |        /*-------------------------------------------------------*/
  495|       |        /*
  496|       |          int iat_SB_N_III[MAX_DIFF_MOBH], iat_DB_N_III[MAX_DIFF_MOBH];
  497|       |          int num_SB_N_III = 0, num_DB_N_III = 0, k1, k2,
  498|       |        */
  499|      0|        int itg, j1, j2, bAction = 0;
  500|      0|        BNS_VERTEX *pTg, *pvEndp, *pvEndp2, *pvCent;
  501|      0|        Vertex     vEndp, vEndp2, vCent;
  502|      0|        BNS_EDGE   *peTg, *peTg2, *peCent1, *peCent2;
  503|      0|        EdgeIndex  eTg, eTg2;
  504|       |
  505|      0|        CurrEdges.num_edges = 0;
  506|      0|        CurrEdges2.num_edges = 0;
  507|      0|        cur_success = 0;
  508|       |
  509|       |        /* 1st attempt: -NH-=O => -N(-)-=O  or -N=-OH => -N(-)-=O */
  510|      0|        for (itg = 0; itg < pTCGroups->num_tgroups && !cur_success; itg++)
  ------------------
  |  Branch (510:23): [True: 0, False: 0]
  |  Branch (510:55): [True: 0, False: 0]
  ------------------
  511|      0|        {
  512|      0|            pTg = pBNS->vert + pTCGroups->pTCG[itg].nVertexNumber;
  513|      0|            for (i = 0; i < pTg->num_adj_edges && !cur_success; i++)
  ------------------
  |  Branch (513:25): [True: 0, False: 0]
  |  Branch (513:51): [True: 0, False: 0]
  ------------------
  514|      0|            {
  515|      0|                pvEndp = pBNS->vert + ( vEndp = ( peTg = pBNS->edge + ( eTg = pTg->iedge[i] ) )->neighbor1 );
  516|      0|                eTg2 = -1;
  517|      0|                if (pVA[vEndp].cNumValenceElectrons == 6 && peTg->cap)
  ------------------
  |  Branch (517:21): [True: 0, False: 0]
  |  Branch (517:61): [True: 0, False: 0]
  ------------------
  518|      0|                {
  519|       |                    /* endpoint -OH or =O found; search for a possible centerpoint */
  520|      0|                    for (j1 = 0; j1 < at2[vEndp].valence && eTg2 < 0; j1++)
  ------------------
  |  Branch (520:34): [True: 0, False: 0]
  |  Branch (520:61): [True: 0, False: 0]
  ------------------
  521|      0|                    {
  522|      0|                        peCent1 = pBNS->edge + pvEndp->iedge[j1]; /* edge from O to a centerpoint */
  523|      0|                        pvCent = pBNS->vert + ( vCent = peCent1->neighbor12 ^ vEndp ); /* centerpoint */
  524|      0|                        if (at2[vCent].endpoint || !peCent1->cap ||
  ------------------
  |  Branch (524:29): [True: 0, False: 0]
  |  Branch (524:52): [True: 0, False: 0]
  ------------------
  525|      0|                             peCent1->flow + ( peTg->cap == peTg->flow ) != 1)
  ------------------
  |  Branch (525:30): [True: 0, False: 0]
  ------------------
  526|      0|                        {
  527|      0|                            continue;
  528|      0|                        }
  529|       |                        /* search for another endpoint, N, around vCent */
  530|      0|                        for (j2 = 0; j2 < at2[vCent].valence; j2++)
  ------------------
  |  Branch (530:38): [True: 0, False: 0]
  ------------------
  531|      0|                        {
  532|      0|                            peCent2 = pBNS->edge + pvCent->iedge[j2];
  533|      0|                            pvEndp2 = pBNS->vert + ( vEndp2 = peCent2->neighbor12 ^ vCent );
  534|      0|                            if (!peCent2->cap || peCent2->flow + peCent1->flow != 1 ||
  ------------------
  |  Branch (534:33): [True: 0, False: 0]
  |  Branch (534:50): [True: 0, False: 0]
  ------------------
  535|      0|                                 at2[vEndp2].endpoint != itg + 1 ||
  ------------------
  |  Branch (535:34): [True: 0, False: 0]
  ------------------
  536|      0|                                 pVA[vEndp2].cNumValenceElectrons != 5 ||
  ------------------
  |  Branch (536:34): [True: 0, False: 0]
  ------------------
  537|      0|                                 0 > ( j = pVA[vEndp2].nTautGroupEdge - 1 ) ||
  ------------------
  |  Branch (537:34): [True: 0, False: 0]
  ------------------
  538|      0|                                 ( peTg2 = pBNS->edge + j )->forbidden ||
  ------------------
  |  Branch (538:34): [True: 0, False: 0]
  ------------------
  539|      0|                                 peCent2->flow + ( peTg2->cap == peTg2->flow ) != 1)
  ------------------
  |  Branch (539:34): [True: 0, False: 0]
  ------------------
  540|      0|                            {
  541|      0|                                continue;
  542|      0|                            }
  543|      0|                            eTg2 = j;
  544|      0|                            break; /* found OH-C=N- or O=C-NH- */
  545|      0|                        }
  546|      0|                    }
  547|      0|                }
  548|      0|                if (eTg2 >= 0)
  ------------------
  |  Branch (548:21): [True: 0, False: 0]
  ------------------
  549|      0|                {
  550|       |                    /*--------------------------------------------
  551|       |                                    tg                        tg
  552|       |                            eTg //\ eTg2              eTg / \\eTg2
  553|       |                                //  \                     /   \\
  554|       |                        vEndp HO--C==N vEndp2 -->  vEndp O==C--NH vEndp2
  555|       |                                ^ ^ ^                     ^ ^ ^
  556|       |                            eCent1 | eCent2           eCent1 | eCent2
  557|       |                                    vCent                     vCent
  558|       |
  559|       |                    additional action: -OH-C=N- => O=C-NH-
  560|       |                    -------------------------------------------*/
  561|      0|                    if (0 == peTg->cap - peTg->flow && 1 == peTg2->cap - peTg2->flow &&
  ------------------
  |  Branch (561:25): [True: 0, False: 0]
  |  Branch (561:56): [True: 0, False: 0]
  ------------------
  562|      0|                         0 == peCent1->flow && 1 == peCent2->flow)
  ------------------
  |  Branch (562:26): [True: 0, False: 0]
  |  Branch (562:48): [True: 0, False: 0]
  ------------------
  563|      0|                    {
  564|      0|                        peTg->flow--;          /* 03 prepare */
  565|      0|                        peTg2->flow++;
  566|      0|                        peCent2->flow--;
  567|      0|                        peCent1->flow++;
  568|      0|                        bAction |= 1; /* switched H position */
  569|      0|                    }
  570|      0|                    if (1 == peTg->cap - peTg->flow && 0 == peTg2->cap - peTg2->flow &&
  ------------------
  |  Branch (570:25): [True: 0, False: 0]
  |  Branch (570:56): [True: 0, False: 0]
  ------------------
  571|      0|                         1 == peCent1->flow && 0 == peCent2->flow)
  ------------------
  |  Branch (571:26): [True: 0, False: 0]
  |  Branch (571:48): [True: 0, False: 0]
  ------------------
  572|      0|                    {
  573|       |                        /* replace -NH- with -N(-)- */
  574|      0|                        pTCGroups->pTCG[itg].tg_num_H--;
  575|      0|                        pTCGroups->pTCG[itg].tg_num_Minus++;
  576|      0|                        pTCGroups->pTCG[itg].tg_RestoreFlags |= TGRF_MINUS_FIRST;
  577|      0|                        pTCGroups->pTCG[itg].tg_set_Minus = vEndp2 + 1;
  578|      0|                        pStruct->ti.t_group[itg].num[1] ++; /* increment number of (-), keep number of taut attachments */
  579|      0|                        pTCGroups->total_charge--;
  580|      0|                        pTCGroups->tgroup_charge--;
  581|      0|                        pStruct->nNumRemovedProtonsByRevrs += 1;
  582|      0|                        bAction |= 2; /* single NH (at2[vEndp2]) replaced with N(-) */
  583|      0|                        cur_success++; /* 03/04 */
  584|      0|                    }
  585|      0|                }
  586|      0|            }
  587|      0|        }
  588|       |
  589|      0|        if (0 == pc2i->nNumTgNHInChI + pc2i->nNumTgNH2InChI && pc2i->nNumTgOHInChI && !cur_success)
  ------------------
  |  Branch (589:13): [True: 0, False: 0]
  |  Branch (589:64): [True: 0, False: 0]
  |  Branch (589:87): [True: 0, False: 0]
  ------------------
  590|      0|        {
  591|       |            /* transfer an attachement to N */
  592|      0|            for (itg = 0; itg < pTCGroups->num_tgroups; itg++)
  ------------------
  |  Branch (592:27): [True: 0, False: 0]
  ------------------
  593|      0|            {
  594|      0|                pTg = pBNS->vert + pTCGroups->pTCG[itg].nVertexNumber;
  595|      0|                for (i = 0; i < pTg->num_adj_edges; i++)
  ------------------
  |  Branch (595:29): [True: 0, False: 0]
  ------------------
  596|      0|                {
  597|      0|                    pvEndp = pBNS->vert + ( vEndp = ( peTg = pBNS->edge + ( eTg = pTg->iedge[i] ) )->neighbor1 );
  598|      0|                    if (pVA[vEndp].cNumValenceElectrons == 6 &&
  ------------------
  |  Branch (598:25): [True: 0, False: 0]
  ------------------
  599|      0|                         at2[vEndp].valence == at2[vEndp].chem_bonds_valence &&
  ------------------
  |  Branch (599:26): [True: 0, False: 0]
  ------------------
  600|      0|                         peTg->flow && peTg->flow == peTg->cap)
  ------------------
  |  Branch (600:26): [True: 0, False: 0]
  |  Branch (600:40): [True: 0, False: 0]
  ------------------
  601|      0|                    {
  602|       |                        /* endpoint -OH found; save the tautomeric group edge */
  603|      0|                        if (ret = AddToEdgeList( &CurrEdges, eTg, INC_ADD_EDGE ))
  ------------------
  |  |   47|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (603:29): [True: 0, False: 0]
  ------------------
  604|      0|                        {
  605|      0|                            goto exit_function;
  606|      0|                        }
  607|      0|                    }
  608|      0|                    else
  609|      0|                    {
  610|      0|                        if (pVA[vEndp].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (610:29): [True: 0, False: 0]
  ------------------
  611|      0|                             pVA[vEndp].cPeriodicRowNumber == 1 &&
  ------------------
  |  Branch (611:30): [True: 0, False: 0]
  ------------------
  612|      0|                             at2[vEndp].valence + 1 == at2[vEndp].chem_bonds_valence &&
  ------------------
  |  Branch (612:30): [True: 0, False: 0]
  ------------------
  613|      0|                             peTg->cap && peTg->flow + 1 == peTg->cap)
  ------------------
  |  Branch (613:30): [True: 0, False: 0]
  |  Branch (613:43): [True: 0, False: 0]
  ------------------
  614|      0|                        {
  615|       |                            /* endpoint -N= or =NH found, check for -N=-OH */
  616|      0|                            e = -1;
  617|      0|                            for (j1 = 0; j1 < at2[vEndp].valence && e < 0; j1++)
  ------------------
  |  Branch (617:42): [True: 0, False: 0]
  |  Branch (617:69): [True: 0, False: 0]
  ------------------
  618|      0|                            {
  619|      0|                                peCent1 = pBNS->edge + pvEndp->iedge[j1];
  620|      0|                                if (peCent1->flow == 1)
  ------------------
  |  Branch (620:37): [True: 0, False: 0]
  ------------------
  621|      0|                                {
  622|       |                                    /* double bond */
  623|      0|                                    pvCent = pBNS->vert + ( vCent = peCent1->neighbor12 ^ vEndp );
  624|      0|                                    if (at2[vCent].endpoint)
  ------------------
  |  Branch (624:41): [True: 0, False: 0]
  ------------------
  625|      0|                                        continue;
  626|      0|                                    for (j2 = 0; j2 < at2[vCent].valence; j2++)
  ------------------
  |  Branch (626:50): [True: 0, False: 0]
  ------------------
  627|      0|                                    {
  628|      0|                                        peCent2 = pBNS->edge + pvCent->iedge[j2];
  629|      0|                                        pvEndp2 = pBNS->vert + ( vEndp2 = peCent2->neighbor12 ^ vCent );
  630|      0|                                        if (peCent2->flow || at2[vEndp2].endpoint != itg + 1 ||
  ------------------
  |  Branch (630:45): [True: 0, False: 0]
  |  Branch (630:62): [True: 0, False: 0]
  ------------------
  631|      0|                                             pVA[vEndp2].cNumValenceElectrons != 6 ||
  ------------------
  |  Branch (631:46): [True: 0, False: 0]
  ------------------
  632|      0|                                             0 >= ( e = pVA[vEndp2].nTautGroupEdge - 1 ) ||
  ------------------
  |  Branch (632:46): [True: 0, False: 0]
  ------------------
  633|      0|                                             pBNS->edge[e].forbidden || !pBNS->edge[e].flow)
  ------------------
  |  Branch (633:46): [True: 0, False: 0]
  |  Branch (633:73): [True: 0, False: 0]
  ------------------
  634|      0|                                        {
  635|      0|                                            e = -1;
  636|      0|                                            continue;
  637|      0|                                        }
  638|       |                                        /*********************/
  639|       |                                        /* found -N=X-OH     */
  640|       |                                        /*    vEndp ^ vEndp2 */
  641|       |                                        /*          vCent    */
  642|       |                                        /*********************/
  643|       |                                        /* save this -OH taut edge */
  644|      0|                                        if (ret = AddToEdgeList( &CurrEdges2, e, INC_ADD_EDGE ))
  ------------------
  |  |   47|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (644:45): [True: 0, False: 0]
  ------------------
  645|      0|                                        {
  646|      0|                                            goto exit_function;
  647|      0|                                        }
  648|      0|                                        break;
  649|      0|                                    }
  650|      0|                                }
  651|      0|                            }
  652|      0|                            if (e < 0 && ( ret = AddToEdgeList( &CurrEdges, eTg, INC_ADD_EDGE ) ))
  ------------------
  |  |   47|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (652:33): [True: 0, False: 0]
  |  Branch (652:42): [True: 0, False: 0]
  ------------------
  653|      0|                            {
  654|      0|                                goto exit_function;
  655|      0|                            }
  656|      0|                        }
  657|      0|                    }
  658|      0|                }
  659|      0|            }
  660|       |            /* rearrange the flows */
  661|      0|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
  662|      0|            SetForbiddenEdgeMask( pBNS, &CurrEdges, forbidden_edge_mask );
  663|      0|            SetForbiddenEdgeMask( pBNS, &CurrEdges2, forbidden_edge_mask );
  664|      0|            pEdgeList = CurrEdges2.num_edges ? &CurrEdges2 : CurrEdges.num_edges ? &CurrEdges : NULL;
  ------------------
  |  Branch (664:25): [True: 0, False: 0]
  |  Branch (664:62): [True: 0, False: 0]
  ------------------
  665|       |
  666|      0|            for (i = 0; pEdgeList && i < pEdgeList->num_edges && !cur_success; i++)
  ------------------
  |  Branch (666:25): [True: 0, False: 0]
  |  Branch (666:38): [True: 0, False: 0]
  |  Branch (666:66): [True: 0, False: 0]
  ------------------
  667|      0|            {
  668|      0|                pe = pBNS->edge + pEdgeList->pnEdges[i]; /* pe->flow = 1 <=> -OH */
  669|      0|                if (!pe->flow)
  ------------------
  |  Branch (669:21): [True: 0, False: 0]
  ------------------
  670|      0|                    continue;
  671|      0|                pv1 = pBNS->vert + ( v1 = pe->neighbor1 );       /* -OH atom */
  672|      0|                pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 ); /* t-group vertex */
  673|       |                /* locate the t-group */
  674|      0|                for (itg = 0; itg < pTCGroups->num_tgroups; itg++)
  ------------------
  |  Branch (674:31): [True: 0, False: 0]
  ------------------
  675|      0|                {
  676|      0|                    if (v2 == pTCGroups->pTCG[itg].nVertexNumber)
  ------------------
  |  Branch (676:25): [True: 0, False: 0]
  ------------------
  677|      0|                    {
  678|      0|                        break;
  679|      0|                    }
  680|      0|                }
  681|      0|                if (itg == pTCGroups->num_tgroups)
  ------------------
  |  Branch (681:21): [True: 0, False: 0]
  ------------------
  682|      0|                {
  683|       |                    /* tgroup not found -- should not happen */
  684|      0|                    continue;
  685|      0|                }
  686|       |
  687|      0|                delta = 1;
  688|      0|                pe->flow -= delta; /* add one attachment to  */
  689|      0|                pv1->st_edge.flow -= delta;
  690|      0|                pv2->st_edge.flow -= delta;
  691|      0|                pBNS->tot_st_flow -= 2 * delta;
  692|       |
  693|      0|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
  694|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
  695|       |
  696|      0|                if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (696:21): [True: 0, False: 0]
  |  Branch (696:35): [True: 0, False: 0]
  |  Branch (696:53): [True: 0, False: 0]
  ------------------
  697|      0|                    vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == 2)
  ------------------
  |  Branch (697:21): [True: 0, False: 0]
  |  Branch (697:39): [True: 0, False: 0]
  |  Branch (697:61): [True: 0, False: 0]
  ------------------
  698|      0|                {
  699|       |                    /* Added (-)charge -N= and (+) to -N< => nDeltaCharge == 2 */
  700|      0|                    ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
  701|      0|                    if (ret > 0)
  ------------------
  |  Branch (701:25): [True: 0, False: 0]
  ------------------
  702|      0|                    {
  703|      0|                        nNumRunBNS++;
  704|      0|                        cur_success++; /* 03 */
  705|       |                        /* replace -NH- with -N(-)- */
  706|      0|                        pTCGroups->pTCG[itg].tg_num_H--;
  707|      0|                        pTCGroups->pTCG[itg].tg_num_Minus++;
  708|      0|                        pTCGroups->pTCG[itg].tg_RestoreFlags |= TGRF_MINUS_FIRST;
  709|      0|                        pStruct->ti.t_group[itg].num[1] ++;
  710|      0|                        pTCGroups->total_charge--;
  711|      0|                        pTCGroups->tgroup_charge--;
  712|      0|                        pStruct->nNumRemovedProtonsByRevrs += 1;
  713|      0|                        bAction |= 4; /* H in the 1st available NH was replaced with (-) */
  714|      0|                    }
  715|      0|                }
  716|      0|                else
  717|      0|                {
  718|      0|                    pe->flow += delta;
  719|      0|                    pv1->st_edge.flow += delta;
  720|      0|                    pv2->st_edge.flow += delta;
  721|      0|                    pBNS->tot_st_flow += 2 * delta;
  722|      0|                }
  723|      0|            }
  724|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
  725|      0|            RemoveForbiddenEdgeMask( pBNS, &CurrEdges, forbidden_edge_mask );
  726|      0|            RemoveForbiddenEdgeMask( pBNS, &CurrEdges, forbidden_edge_mask );
  727|      0|        }
  728|      0|        else
  729|      0|        {
  730|      0|            if (pc2i->nNumTgNHInChI + pc2i->nNumTgNH2InChI && pc2i->nNumTgOInChI && !cur_success)
  ------------------
  |  Branch (730:17): [True: 0, False: 0]
  |  Branch (730:63): [True: 0, False: 0]
  |  Branch (730:85): [True: 0, False: 0]
  ------------------
  731|      0|            {
  732|       |                /* change an attachement to N from H to (-) */
  733|      0|                for (itg = 0; itg < pTCGroups->num_tgroups && !cur_success; itg++)
  ------------------
  |  Branch (733:31): [True: 0, False: 0]
  |  Branch (733:63): [True: 0, False: 0]
  ------------------
  734|      0|                {
  735|      0|                    pTg = pBNS->vert + pTCGroups->pTCG[itg].nVertexNumber;
  736|      0|                    for (i = 0; i < pTg->num_adj_edges && !cur_success; i++)
  ------------------
  |  Branch (736:33): [True: 0, False: 0]
  |  Branch (736:59): [True: 0, False: 0]
  ------------------
  737|      0|                    {
  738|      0|                        pvEndp2 = pBNS->vert + ( vEndp2 = ( peTg = pBNS->edge + pTg->iedge[i] )->neighbor1 );
  739|      0|                        if (pVA[vEndp2].cNumValenceElectrons == 5 && pVA[vEndp2].cPeriodicRowNumber == 1 &&
  ------------------
  |  Branch (739:29): [True: 0, False: 0]
  |  Branch (739:70): [True: 0, False: 0]
  ------------------
  740|      0|                             at2[vEndp2].valence == at2[vEndp2].chem_bonds_valence &&
  ------------------
  |  Branch (740:30): [True: 0, False: 0]
  ------------------
  741|      0|                             peTg->flow && peTg->flow == peTg->cap)
  ------------------
  |  Branch (741:30): [True: 0, False: 0]
  |  Branch (741:44): [True: 0, False: 0]
  ------------------
  742|      0|                        {
  743|       |                            /* endpoint -NHn found; change its charge */
  744|      0|                            cur_success++; /* 04 */
  745|       |                            /* replace -NH- with -N(-)- */
  746|      0|                            pTCGroups->pTCG[itg].tg_num_H--;
  747|      0|                            pTCGroups->pTCG[itg].tg_num_Minus++;
  748|      0|                            pTCGroups->pTCG[itg].tg_RestoreFlags |= TGRF_MINUS_FIRST;
  749|      0|                            pTCGroups->pTCG[itg].tg_set_Minus = vEndp2 + 1;
  750|      0|                            pStruct->ti.t_group[itg].num[1] ++;
  751|      0|                            pTCGroups->total_charge--;
  752|      0|                            pTCGroups->tgroup_charge--;
  753|      0|                            pStruct->nNumRemovedProtonsByRevrs += 1;
  754|      0|                            bAction |= 8; /* manually set (-) charge to NH atom, vEndp2 */
  755|      0|                        }
  756|      0|                    }
  757|      0|                }
  758|      0|            }
  759|      0|        }
  760|      0|        if (cur_success)
  ------------------
  |  Branch (760:13): [True: 0, False: 0]
  ------------------
  761|      0|        {
  762|      0|            tot_succes += cur_success;
  763|       |            /* recalculate InChI from the structure */
  764|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (764:17): [True: 0, False: 0]
  ------------------
  765|      0|                ppt_group_info, ppat_norm, ppat_prep ) ))
  766|      0|            {
  767|      0|                goto exit_function;
  768|      0|            }
  769|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (769:17): [True: 0, False: 0]
  ------------------
  770|      0|            {
  771|      0|                goto exit_function;
  772|      0|            }
  773|      0|            if (ret = FillOutCMP2MHINCHI( pStruct, pTCGroups, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (773:17): [True: 0, False: 0]
  ------------------
  774|      0|            {
  775|      0|                goto exit_function;
  776|      0|            }
  777|      0|            if (pStruct->One_ti.num_t_groups == 1 && pStruct->One_ti.t_group[0].num[1])
  ------------------
  |  Branch (777:17): [True: 0, False: 0]
  |  Branch (777:54): [True: 0, False: 0]
  ------------------
  778|      0|            {
  779|       |                /* this method did not work: no alt path from N(-) to =O */
  780|      0|                itg = 0;
  781|      0|                if (bAction & ( 8 | 2 ))
  ------------------
  |  Branch (781:21): [True: 0, False: 0]
  ------------------
  782|      0|                {
  783|       |                    /* roll back NH -> N(-) replacement; H move from OH to N is not undone */
  784|      0|                    pTCGroups->pTCG[itg].tg_num_H++;
  785|      0|                    pTCGroups->pTCG[itg].tg_num_Minus--;
  786|      0|                    pTCGroups->pTCG[itg].tg_RestoreFlags &= ~TGRF_MINUS_FIRST;
  787|      0|                    pTCGroups->pTCG[itg].tg_set_Minus = 0;
  788|      0|                    pStruct->ti.t_group[itg].num[1] --;
  789|      0|                    pTCGroups->total_charge++;
  790|      0|                    pTCGroups->tgroup_charge++;
  791|      0|                    pStruct->nNumRemovedProtonsByRevrs -= 1;
  792|      0|                    cur_success--;
  793|      0|                }
  794|      0|                else
  795|      0|                {
  796|      0|                    if (bAction & 4)
  ------------------
  |  Branch (796:25): [True: 0, False: 0]
  ------------------
  797|      0|                    {
  798|      0|                        pTCGroups->pTCG[itg].tg_num_H++;
  799|      0|                        pTCGroups->pTCG[itg].tg_num_Minus--;
  800|      0|                        pTCGroups->pTCG[itg].tg_RestoreFlags &= ~TGRF_MINUS_FIRST;
  801|      0|                        pStruct->ti.t_group[itg].num[1] --;
  802|      0|                        pTCGroups->total_charge++;
  803|      0|                        pTCGroups->tgroup_charge++;
  804|      0|                        pStruct->nNumRemovedProtonsByRevrs -= 1;
  805|      0|                        cur_success--;
  806|      0|                    }
  807|      0|                    else
  808|      0|                    {
  809|      0|                        ret = RI_ERR_PROGR;
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  810|      0|                        goto exit_function;
  811|      0|                    }
  812|      0|                }
  813|       |                /* recalculate InChI from the structure */
  814|      0|                if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (814:21): [True: 0, False: 0]
  ------------------
  815|      0|                    ppt_group_info, ppat_norm, ppat_prep ) ))
  816|      0|                {
  817|      0|                    goto exit_function;
  818|      0|                }
  819|      0|                if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (819:21): [True: 0, False: 0]
  ------------------
  820|      0|                {
  821|      0|                    goto exit_function;
  822|      0|                }
  823|      0|                if (ret = FillOutCMP2MHINCHI( pStruct, pTCGroups, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (823:21): [True: 0, False: 0]
  ------------------
  824|      0|                {
  825|      0|                    goto exit_function;
  826|      0|                }
  827|      0|            }
  828|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (828:17): [True: 0, False: 0]
  ------------------
  829|      0|            {
  830|      0|                goto exit_function; /* nothing to do */
  831|      0|            }
  832|      0|        }
  833|      0|    }
  834|       |
  835|      1|    if (pc2i->nNumTgInChI == 1 && ( pc2i->nNumEndpRevrs < pc2i->nNumEndpInChI || pc2i->nNumTgRevrs > 1 ) && /* ADP */
  ------------------
  |  Branch (835:9): [True: 0, False: 1]
  |  Branch (835:37): [True: 0, False: 0]
  |  Branch (835:82): [True: 0, False: 0]
  ------------------
  836|      1|        pc2i->nNumTgMInChI == 0 && ( pc2i->nNumTgNInChI || pc2i->nNumTgOInChI ) &&
  ------------------
  |  Branch (836:9): [True: 0, False: 0]
  |  Branch (836:38): [True: 0, False: 0]
  |  Branch (836:60): [True: 0, False: 0]
  ------------------
  837|      1|        NO_VERTEX != ( vPlusMinus = GetPlusMinusVertex( pBNS, pTCGroups, 1, 1 ) ))
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (837:9): [True: 0, False: 0]
  ------------------
  838|      0|    {
  839|       |        /*---------------------------------------------------------------------------*/
  840|       |        /* case 05: restored has N endpoints, no (-) endpoints                       */
  841|       |        /*          original has single taut. group or more                          */
  842|       |        /*          tautomeric endpoints.                                            */
  843|       |        /* Solution: Find -N< and allow (+) charge change                            */
  844|       |        /*           Fix all charges and taut attachments exept                      */
  845|       |        /*           =N- and =O (taut. endpoints)                                    */
  846|       |        /*           Increment st_edge.cap on (+/-) vertex => add (+) charge to -N<  */
  847|       |        /*           Increment tot. charge in other places                           */
  848|       |        /*           Increment t-group st_edge.cap                                   */
  849|       |        /*           Run BNS                                                         */
  850|       |        /*                                                                           */
  851|       |        /*      (+/-)*               (+/-)           Result:                         */
  852|       |        /*        |                    ||                                            */
  853|       |        /*        |                    ||            - Added (+) to -N<              */
  854|       |        /*       (+)super             (+)super       - Added attachment point to O   */
  855|       |        /*        ||                   |                                             */
  856|       |        /*        ||          =>       |             To make this attachment H,      */
  857|       |        /*       (Y)                  (Y)            increment                       */
  858|       |        /*        |                    ||            pTCGroups->pTCG[itg].tg_num_H   */
  859|       |        /*        |                    ||                                            */
  860|       |        /*       (+)hetero            (+)hetero      Technical details:              */
  861|       |        /*         \\                   \            increase capacities of          */
  862|       |        /*           N                    N(+)       edges to (+/-) otherwise        */
  863|       |        /*           |                    ||         flow may not be able to         */
  864|       |        /*   *(t)--O=R.            (t)==O-R.         increase                        */
  865|       |        /*                                                                           */
  866|       |        /*                                                                           */
  867|       |        /*---------------------------------------------------------------------------*/
  868|      0|        int itg;
  869|      0|        BNS_VERTEX *pTg, *pvEndp;
  870|      0|        Vertex     vEndp, vTg;
  871|      0|        BNS_EDGE   *peTg;
  872|      0|        EdgeIndex  eTg;
  873|      0|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
  874|       |
  875|      0|        CurrEdges.num_edges = 0;
  876|      0|        CurrEdges2.num_edges = 0;
  877|      0|        cur_success = 0;
  878|       |        /* find -N< and non-taut =N- or =O */
  879|      0|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (879:21): [True: 0, False: 0]
  ------------------
  880|      0|        {
  881|      0|            iat = nCanon2AtnoRevrs[i];
  882|       |            /* -N< */
  883|      0|            if (!at2[iat].endpoint && !at2[iat].charge && !at2[iat].radical && !at2[iat].num_H &&
  ------------------
  |  Branch (883:17): [True: 0, False: 0]
  |  Branch (883:39): [True: 0, False: 0]
  |  Branch (883:59): [True: 0, False: 0]
  |  Branch (883:80): [True: 0, False: 0]
  ------------------
  884|      0|                 pVA[i].cNumValenceElectrons == 5 && pVA[i].cPeriodicRowNumber == 1 &&
  ------------------
  |  Branch (884:18): [True: 0, False: 0]
  |  Branch (884:54): [True: 0, False: 0]
  ------------------
  885|      0|                 0 <= ( e = pVA[iat].nCPlusGroupEdge - 1 ) && pBNS->edge[e].flow && !pBNS->edge[e].forbidden)
  ------------------
  |  Branch (885:18): [True: 0, False: 0]
  |  Branch (885:63): [True: 0, False: 0]
  |  Branch (885:85): [True: 0, False: 0]
  ------------------
  886|      0|            {
  887|       |
  888|      0|                if (ret = AddToEdgeList( &CurrEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   47|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (888:21): [True: 0, False: 0]
  ------------------
  889|      0|                {
  890|      0|                    goto exit_function;
  891|      0|                }
  892|      0|            }
  893|      0|        }
  894|      0|        if (!CurrEdges.num_edges)
  ------------------
  |  Branch (894:13): [True: 0, False: 0]
  ------------------
  895|      0|        {
  896|      0|            goto exit_case_05;
  897|      0|        }
  898|       |        /* find taut -N= and =O */
  899|      0|        for (itg = 0; itg < pTCGroups->num_tgroups && !cur_success; itg++)
  ------------------
  |  Branch (899:23): [True: 0, False: 0]
  |  Branch (899:55): [True: 0, False: 0]
  ------------------
  900|      0|        {
  901|      0|            CurrEdges2.num_edges = 0;
  902|      0|            pTg = pBNS->vert + ( vTg = pTCGroups->pTCG[itg].nVertexNumber );
  903|      0|            for (i = 0; i < pTg->num_adj_edges; i++)
  ------------------
  |  Branch (903:25): [True: 0, False: 0]
  ------------------
  904|      0|            {
  905|      0|                pvEndp = pBNS->vert + ( vEndp = ( peTg = pBNS->edge + ( eTg = pTg->iedge[i] ) )->neighbor1 );
  906|      0|                if (at2[vEndp].charge || at2[vEndp].radical || peTg->cap - peTg->flow != 1)
  ------------------
  |  Branch (906:21): [True: 0, False: 0]
  |  Branch (906:42): [True: 0, False: 0]
  |  Branch (906:64): [True: 0, False: 0]
  ------------------
  907|      0|                {
  908|      0|                    continue;
  909|      0|                }
  910|       |                /* t-group edges to -N= and =O */
  911|      0|                if (ret = AddToEdgeList( &CurrEdges2, eTg, INC_ADD_EDGE ))
  ------------------
  |  |   47|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (911:21): [True: 0, False: 0]
  ------------------
  912|      0|                {
  913|      0|                    goto exit_function;
  914|      0|                }
  915|      0|            }
  916|      0|            if (!CurrEdges2.num_edges)
  ------------------
  |  Branch (916:17): [True: 0, False: 0]
  ------------------
  917|      0|            {
  918|      0|                goto exit_case_05;
  919|      0|            }
  920|       |            /* fix all charge edges except -N< and all taut. edges except =O and =N- */
  921|      0|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
  922|      0|            SetForbiddenEdgeMask( pBNS, &TautEdges, forbidden_edge_mask );
  923|      0|            RemoveForbiddenEdgeMask( pBNS, &CurrEdges, forbidden_edge_mask );
  924|      0|            RemoveForbiddenEdgeMask( pBNS, &CurrEdges2, forbidden_edge_mask );
  925|      0|            delta = 1;
  926|       |            /* Increment st_edge.cap on (+/-) vertex */
  927|      0|            pBNS->vert[vPlusMinus].st_edge.cap += delta;
  928|       |            /* Increment st_edge.cap on t-group */
  929|      0|            pTg->st_edge.cap += delta;
  930|       |            /* total cap count */
  931|      0|            pBNS->tot_st_cap += 2 * delta;
  932|       |
  933|      0|            v1 = vPlusMinus;
  934|      0|            v2 = vTg;
  935|       |
  936|       |            /* increase capacities of edges to Y  */
  937|      0|            for (i = 0; i < pBNS->vert[vPlusMinus].num_adj_edges; i++)
  ------------------
  |  Branch (937:25): [True: 0, False: 0]
  ------------------
  938|      0|            {
  939|      0|                j = pBNS->edge[pBNS->vert[vPlusMinus].iedge[i]].neighbor12 ^ vPlusMinus;
  940|      0|                for (k = 0; k < pBNS->vert[j].num_adj_edges; k++)
  ------------------
  |  Branch (940:29): [True: 0, False: 0]
  ------------------
  941|      0|                {
  942|      0|                    pBNS->edge[pBNS->vert[j].iedge[k]].cap += delta;
  943|      0|                }
  944|      0|            }
  945|       |
  946|      0|            ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
  947|      0|                                  &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
  948|       |
  949|      0|            if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (949:17): [True: 0, False: 0]
  |  Branch (949:31): [True: 0, False: 0]
  |  Branch (949:49): [True: 0, False: 0]
  ------------------
  950|      0|                vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == 1)
  ------------------
  |  Branch (950:17): [True: 0, False: 0]
  |  Branch (950:35): [True: 0, False: 0]
  |  Branch (950:57): [True: 0, False: 0]
  ------------------
  951|      0|            {
  952|       |                /* Added (+)charge to -N< => nDeltaCharge == 1 */
  953|       |                /* Flow change on pe (-)charge edge (atom B-O(-)) is not known to RunBnsTestOnce()) */
  954|      0|                ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
  955|      0|                if (ret > 0)
  ------------------
  |  Branch (955:21): [True: 0, False: 0]
  ------------------
  956|      0|                {
  957|      0|                    nNumRunBNS++;
  958|      0|                    cur_success++; /* 01 */
  959|       |                    /* update bookkeeping */
  960|      0|                    pTCGroups->total_charge += delta;
  961|      0|                    pTCGroups->pTCG[itg].edges_cap += delta;
  962|      0|                    pTCGroups->pTCG[itg].tg_num_H += delta;
  963|      0|                    pStruct->nNumRemovedProtonsByRevrs -= delta;
  964|      0|                }
  965|      0|            }
  966|      0|            else
  967|      0|            {
  968|      0|                pBNS->vert[vPlusMinus].st_edge.cap -= delta;
  969|      0|                pTg->st_edge.cap -= delta;
  970|       |                /*pTCGroups->pTCG[itg].edges_cap     -= delta;*/ /* ???bug??? - commented out 2006-03-22 */
  971|      0|                pBNS->tot_st_cap -= 2 * delta;
  972|       |                /* decrease capacities of edges to Y  */
  973|      0|                for (i = 0; i < pBNS->vert[vPlusMinus].num_adj_edges; i++)
  ------------------
  |  Branch (973:29): [True: 0, False: 0]
  ------------------
  974|      0|                {
  975|      0|                    j = pBNS->edge[pBNS->vert[vPlusMinus].iedge[i]].neighbor12 ^ vPlusMinus;
  976|      0|                    for (k = 0; k < pBNS->vert[j].num_adj_edges; k++)
  ------------------
  |  Branch (976:33): [True: 0, False: 0]
  ------------------
  977|      0|                    {
  978|      0|                        pBNS->edge[pBNS->vert[j].iedge[k]].cap -= delta;
  979|      0|                    }
  980|      0|                }
  981|      0|            }
  982|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
  983|      0|            RemoveForbiddenEdgeMask( pBNS, &TautEdges, forbidden_edge_mask );
  984|      0|        }
  985|      0|        if (cur_success)
  ------------------
  |  Branch (985:13): [True: 0, False: 0]
  ------------------
  986|      0|        {
  987|      0|            tot_succes += cur_success;
  988|       |            /* recalculate InChI from the structure */
  989|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (989:17): [True: 0, False: 0]
  ------------------
  990|      0|                ppt_group_info, ppat_norm, ppat_prep ) ))
  991|      0|            {
  992|      0|                goto exit_function;
  993|      0|            }
  994|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (994:17): [True: 0, False: 0]
  ------------------
  995|      0|            {
  996|      0|                goto exit_function;
  997|      0|            }
  998|      0|            if (ret = FillOutCMP2MHINCHI( pStruct, pTCGroups, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (998:17): [True: 0, False: 0]
  ------------------
  999|      0|            {
 1000|      0|                goto exit_function;
 1001|      0|            }
 1002|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (1002:17): [True: 0, False: 0]
  ------------------
 1003|      0|            {
 1004|      0|                goto exit_function; /* nothing to do */
 1005|      0|            }
 1006|      0|        }
 1007|       |
 1008|      0|    exit_case_05:;
 1009|      0|    }
 1010|       |
 1011|      1|    while (pc2i->nNumDiffMobH && pc2i->nChargeMobHRevrs > pc2i->nChargeMobHInChI)
  ------------------
  |  Branch (1011:12): [True: 0, False: 1]
  |  Branch (1011:34): [True: 0, False: 0]
  ------------------
 1012|      0|    {
 1013|       |        /*----------------------------------------------------*/
 1014|       |        /* case 06: restored has extra H attached to -O(-)    */
 1015|       |        /*          while the chrge should be on C, most pro- */
 1016|       |        /*          bably in a small ring.ut. group or more   */
 1017|       |        /*          tautomeric endpoints.                     */
 1018|       |        /* Solution: move (-) from O to C                     */
 1019|       |        /*----------------------------------------------------*/
 1020|      0|        int iO, mode;
 1021|      0|        EdgeIndex e2;
 1022|      0|        BNS_EDGE  *pe2;
 1023|      0|        cur_success = 0;
 1024|      0|        for (i = 0; !cur_success && i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (1024:21): [True: 0, False: 0]
  |  Branch (1024:37): [True: 0, False: 0]
  ------------------
 1025|      0|        {
 1026|       |
 1027|      0|            if (pc2i->c2at[i].nMobHRevrs == pc2i->c2at[i].nMobHInChI + 1 &&
  ------------------
  |  Branch (1027:17): [True: 0, False: 0]
  ------------------
 1028|      0|                 pc2i->c2at[i].nNumHRevrs == pc2i->c2at[i].nMobHInChI &&
  ------------------
  |  Branch (1028:18): [True: 0, False: 0]
  ------------------
 1029|      0|                 !pc2i->c2at[i].endptInChI && !pc2i->c2at[i].endptRevrs &&
  ------------------
  |  Branch (1029:18): [True: 0, False: 0]
  |  Branch (1029:47): [True: 0, False: 0]
  ------------------
 1030|      0|                 at2[iO = pc2i->c2at[i].atomNumber].charge == -1 &&
  ------------------
  |  Branch (1030:18): [True: 0, False: 0]
  ------------------
 1031|      0|                 0 <= ( e = pVA[iO].nCMinusGroupEdge - 1 ) && ( pe = pBNS->edge + e )->flow)
  ------------------
  |  Branch (1031:18): [True: 0, False: 0]
  |  Branch (1031:63): [True: 0, False: 0]
  ------------------
 1032|      0|            {
 1033|       |                /* try suitable atoms C */
 1034|       |                /* first look for =C= in a small ring */
 1035|      0|                for (mode = 4; !cur_success && mode <= 8; mode++)
  ------------------
  |  Branch (1035:32): [True: 0, False: 0]
  |  Branch (1035:48): [True: 0, False: 0]
  ------------------
 1036|      0|                {
 1037|       |
 1038|      0|                    if (mode == 8)
  ------------------
  |  Branch (1038:25): [True: 0, False: 0]
  ------------------
 1039|      0|                        mode = 99;
 1040|       |
 1041|      0|                    for (iat = 0; !cur_success && iat < pStruct->num_atoms; iat++)
  ------------------
  |  Branch (1041:35): [True: 0, False: 0]
  |  Branch (1041:51): [True: 0, False: 0]
  ------------------
 1042|      0|                    {
 1043|       |
 1044|      0|                        if (!at2[iat].charge && !at2[iat].radical &&
  ------------------
  |  Branch (1044:29): [True: 0, False: 0]
  |  Branch (1044:49): [True: 0, False: 0]
  ------------------
 1045|      0|                             pVA[iat].cNumValenceElectrons == 4 &&
  ------------------
  |  Branch (1045:30): [True: 0, False: 0]
  ------------------
 1046|      0|                             0 <= ( e2 = pVA[iat].nCMinusGroupEdge - 1 ) && !( pe2 = pBNS->edge + e2 )->flow &&
  ------------------
  |  Branch (1046:30): [True: 0, False: 0]
  |  Branch (1046:77): [True: 0, False: 0]
  ------------------
 1047|      0|                             0 < bIsUnsatCarbonInASmallRing( at2, pVA, iat, pStruct->pbfsq, mode ))
  ------------------
  |  Branch (1047:30): [True: 0, False: 0]
  ------------------
 1048|      0|                        {
 1049|       |
 1050|      0|                            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 1051|       |                            /* allow negative charge on the chosen carbon */
 1052|      0|                            pe2->forbidden &= forbidden_edge_mask_inv;
 1053|       |
 1054|      0|                            delta = 1;
 1055|      0|                            if (!pe->flow)
  ------------------
  |  Branch (1055:33): [True: 0, False: 0]
  ------------------
 1056|      0|                                continue;
 1057|      0|                            pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 1058|      0|                            pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 1059|      0|                            pe->flow -= delta;
 1060|      0|                            pv1->st_edge.flow -= delta;
 1061|      0|                            pv2->st_edge.flow -= delta;
 1062|      0|                            pBNS->tot_st_flow -= 2 * delta;
 1063|       |
 1064|      0|                            ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 1065|      0|                                                  &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 1066|       |
 1067|      0|                            if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (1067:33): [True: 0, False: 0]
  |  Branch (1067:47): [True: 0, False: 0]
  |  Branch (1067:65): [True: 0, False: 0]
  ------------------
 1068|      0|                                vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == 1)
  ------------------
  |  Branch (1068:33): [True: 0, False: 0]
  |  Branch (1068:51): [True: 0, False: 0]
  |  Branch (1068:73): [True: 0, False: 0]
  ------------------
 1069|      0|                            {
 1070|       |                                /* Added (-)charge to unsaturated C => nDeltaCharge == 2 */
 1071|      0|                                ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 1072|      0|                                if (ret > 0)
  ------------------
  |  Branch (1072:37): [True: 0, False: 0]
  ------------------
 1073|      0|                                {
 1074|      0|                                    nNumRunBNS++;
 1075|      0|                                    cur_success++; /* 01 */
 1076|      0|                                    tot_succes += cur_success;
 1077|      0|                                }
 1078|      0|                            }
 1079|      0|                            else
 1080|      0|                            {
 1081|      0|                                pe->forbidden |= forbidden_edge_mask;
 1082|      0|                                pe->flow += delta;
 1083|      0|                                pv1->st_edge.flow += delta;
 1084|      0|                                pv2->st_edge.flow += delta;
 1085|      0|                                pBNS->tot_st_flow += 2 * delta;
 1086|      0|                            }
 1087|      0|                            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 1088|      0|                        }
 1089|      0|                    }
 1090|      0|                }
 1091|      0|            }
 1092|      0|        }
 1093|      0|        if (cur_success)
  ------------------
  |  Branch (1093:13): [True: 0, False: 0]
  ------------------
 1094|      0|        {
 1095|       |            /* recalculate InChI from the structure */
 1096|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (1096:17): [True: 0, False: 0]
  ------------------
 1097|      0|                ppt_group_info, ppat_norm, ppat_prep ) ))
 1098|      0|            {
 1099|      0|                goto exit_function;
 1100|      0|            }
 1101|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (1101:17): [True: 0, False: 0]
  ------------------
 1102|      0|            {
 1103|      0|                goto exit_function;
 1104|      0|            }
 1105|      0|            if (ret = FillOutCMP2MHINCHI( pStruct, pTCGroups, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (1105:17): [True: 0, False: 0]
  ------------------
 1106|      0|            {
 1107|      0|                goto exit_function;
 1108|      0|            }
 1109|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (1109:17): [True: 0, False: 0]
  ------------------
 1110|      0|            {
 1111|      0|                goto exit_function; /* nothing to do */
 1112|      0|            }
 1113|      0|        }
 1114|      0|        else
 1115|      0|        {
 1116|      0|            break;
 1117|      0|        }
 1118|      0|    }
 1119|      1|    if (pc2i->len_c2at && pc2i->nChargeMobHRevrs > pc2i->nChargeMobHInChI)
  ------------------
  |  Branch (1119:9): [True: 1, False: 0]
  |  Branch (1119:27): [True: 1, False: 0]
  ------------------
 1120|      1|    {
 1121|       |        /*------------------------------------------------------------------*/
 1122|       |        /* case 07: -NO2 are to be tautomeric but they are not AND          */
 1123|       |        /*          InChI has a SINGLE tautomeric group                     */
 1124|       |        /*                                                                  */
 1125|       |        /*                   (-)O                   (-)O                    */
 1126|       |        /* Solution: convert     \                      \                   */
 1127|       |        /*                        N-X=...-Z(-)   =>      N(+)=X- ...=Z      */
 1128|       |        /*                      //                      /                   */
 1129|       |        /*                     O                    (-)O                    */
 1130|       |        /*                                                                  */
 1131|       |        /*                     O                       O                    */
 1132|       |        /*        or            \\                      \\                  */
 1133|       |        /*                        N-X=...-Z(-)    =>      N=X-  ...=Z       */
 1134|       |        /*                      //                       /                  */
 1135|       |        /*                     O                     (-)O                   */
 1136|       |        /*                                                                  */
 1137|       |        /*                                                                  */
 1138|       |        /*  (a) move (-) from other tautomeric atom to O in O=N-X           */
 1139|       |        /*          or   from other atom that has to be tautomeric          */
 1140|       |        /*               but is not                                         */
 1141|       |        /*  (b) create (+) [ion pair creation] on N as in                   */
 1142|       |        /*                                                                  */
 1143|       |        /*       OH             OH                                          */
 1144|       |        /*      /              /                                            */
 1145|       |        /*  -C=N     =>  =C-N(+)                                            */
 1146|       |        /*     \\             \\                                            */
 1147|       |        /*       O              O                                           */
 1148|       |        /*                                                                  */
 1149|       |        /*------------------------------------------------------------------*/
 1150|      1|        int num_DB_O = 0;
 1151|      1|        short iat_DB_O[MAX_DIFF_FIXH], iat_NO2[MAX_DIFF_FIXH];
 1152|      1|        AT_NUMB  *nCanon2AtnoRevrs = pStruct->nCanon2Atno[0];
 1153|       |        /*
 1154|       |        AT_NUMB  *nAtno2CanonRevrs = pStruct->nAtno2Canon[0];
 1155|       |        */
 1156|      1|        inp_ATOM *at_Mobile_H_Revrs = ( pStruct->pOne_norm_data[0] &&
  ------------------
  |  Branch (1156:41): [True: 1, False: 0]
  ------------------
 1157|      1|                                     pStruct->pOne_norm_data[0]->at ) ? pStruct->pOne_norm_data[0]->at : NULL;
  ------------------
  |  Branch (1157:38): [True: 1, False: 0]
  ------------------
 1158|       |
 1159|      1|        int iN, one_success;
 1160|      1|        BNS_EDGE *peDB_O_Minus;
 1161|      1|        int neigh, nNumO, nNumOthers;
 1162|      1|#define CHG_SET_WRONG_TAUT_N   0
 1163|      1|#define CHG_SET_WRONG_TAUT_O   1
 1164|      1|#define CHG_SET_WRONG_TAUT_ALL 2
 1165|      1|#define CHG_LAST_SET           2 /* the last index in trying */
 1166|      1|#define CHG_SET_O_FIXED        3
 1167|      1|#define CHG_SET_NUM            4
 1168|      1|        EDGE_LIST ChangeableEdges[CHG_SET_NUM];
 1169|      1|        memset( ChangeableEdges, 0, sizeof( ChangeableEdges ) );
 1170|       |        /* equivalent to AllocEdgeList( &EdgeList, EDGE_LIST_CLEAR ); */
 1171|       |        /*
 1172|       |        S_CHAR   *nMobHInChI = pInChI[1] && pInChI[1]->nNum_H? pInChI[1]->nNum_H :
 1173|       |                               pInChI[0] && pInChI[0]->nNum_H? pInChI[0]->nNum_H : 0;
 1174|       |        */
 1175|      1|        CurrEdges.num_edges = 0; /* clear current edge list */
 1176|      1|        cur_success = 0;
 1177|      6|        for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (1177:21): [True: 5, False: 1]
  ------------------
 1178|      5|        {
 1179|      5|            iat = nCanon2AtnoRevrs[i];
 1180|      5|            if ( /* orig. InChI info: taut in orig. InChI =O located in -NO2 that is not taut in Reconstructed InChI */
 1181|      5|                 num_DB_O < MAX_DIFF_FIXH &&
  ------------------
  |  |  484|     10|#define MAX_DIFF_FIXH 256
  ------------------
  |  Branch (1181:18): [True: 5, False: 0]
  ------------------
 1182|      5|                 pVA[iat].cNumValenceElectrons == 6 /* O, S, Se, Te */ &&
  ------------------
  |  Branch (1182:18): [True: 3, False: 2]
  ------------------
 1183|      5|                 ( !at2[iat].endpoint /*|| pc2i->c2at[i].nMobHInChI*/ ) &&
  ------------------
  |  Branch (1183:18): [True: 3, False: 0]
  ------------------
 1184|      5|                 ( e = pVA[iat].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[e].forbidden &&
  ------------------
  |  Branch (1184:18): [True: 2, False: 1]
  |  Branch (1184:64): [True: 2, False: 0]
  ------------------
 1185|      5|                 at2[iat].num_H == 0 && /*pc2i->c2at[i].nMobHInChI ==  1 &&*/
  ------------------
  |  Branch (1185:18): [True: 2, False: 0]
  ------------------
 1186|       |                 /* reversed structure info: */
 1187|      5|                 !( at_Mobile_H_Revrs && at_Mobile_H_Revrs[iat].endpoint ) /*|| pc2i->c2at[i].nMobHRevrs*/ &&
  ------------------
  |  Branch (1187:21): [True: 2, False: 0]
  |  Branch (1187:42): [True: 2, False: 0]
  ------------------
 1188|      5|                 !at2[iat].charge &&
  ------------------
  |  Branch (1188:18): [True: 0, False: 0]
  ------------------
 1189|      5|                 at2[iat].valence == 1 && at2[iat].chem_bonds_valence == 2 &&
  ------------------
  |  Branch (1189:18): [True: 0, False: 0]
  |  Branch (1189:43): [True: 0, False: 0]
  ------------------
 1190|       |                 /* find whether it belongs to NO2 */
 1191|      5|                 pVA[iN = at2[iat].neighbor[0]].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (1191:18): [True: 0, False: 0]
  ------------------
 1192|      5|                 at2[iN].valence == 3 && ( at2[iN].charge == 0 || at2[iN].charge == 1 ) &&
  ------------------
  |  Branch (1192:18): [True: 0, False: 0]
  |  Branch (1192:44): [True: 0, False: 0]
  |  Branch (1192:67): [True: 0, False: 0]
  ------------------
 1193|      5|                 at2[iN].chem_bonds_valence == 5 - at2[iN].charge)
  ------------------
  |  Branch (1193:18): [True: 0, False: 0]
  ------------------
 1194|      0|            {
 1195|       |                /* find the second O */
 1196|      0|                nNumO = nNumOthers = 0;
 1197|      0|                for (k = 0; k < at2[iN].valence; k++)
  ------------------
  |  Branch (1197:29): [True: 0, False: 0]
  ------------------
 1198|      0|                {
 1199|      0|                    neigh = at2[iN].neighbor[k];
 1200|      0|                    if (neigh == iat)
  ------------------
  |  Branch (1200:25): [True: 0, False: 0]
  ------------------
 1201|      0|                    {
 1202|      0|                        continue;
 1203|      0|                    }
 1204|      0|                    if (pVA[neigh].cNumValenceElectrons == 6 &&
  ------------------
  |  Branch (1204:25): [True: 0, False: 0]
  ------------------
 1205|      0|                         !at2[neigh].endpoint &&
  ------------------
  |  Branch (1205:26): [True: 0, False: 0]
  ------------------
 1206|      0|                         !( at_Mobile_H_Revrs && at_Mobile_H_Revrs[neigh].endpoint ) &&
  ------------------
  |  Branch (1206:29): [True: 0, False: 0]
  |  Branch (1206:50): [True: 0, False: 0]
  ------------------
 1207|      0|                         at2[neigh].valence == 1 && at2[neigh].num_H == 0 &&
  ------------------
  |  Branch (1207:26): [True: 0, False: 0]
  |  Branch (1207:53): [True: 0, False: 0]
  ------------------
 1208|      0|                         at2[neigh].radical == 0 && ( at2[neigh].charge == 0 || at2[neigh].charge == -1 ) &&
  ------------------
  |  Branch (1208:26): [True: 0, False: 0]
  |  Branch (1208:55): [True: 0, False: 0]
  |  Branch (1208:81): [True: 0, False: 0]
  ------------------
 1209|      0|                         at2[neigh].chem_bonds_valence - at2[neigh].charge == 2)
  ------------------
  |  Branch (1209:26): [True: 0, False: 0]
  ------------------
 1210|      0|                    {
 1211|      0|                        nNumO++;
 1212|      0|                    }
 1213|      0|                    else
 1214|      0|                    {
 1215|      0|                        if (at2[iN].bond_type[k] == BOND_TYPE_SINGLE &&
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (1215:29): [True: 0, False: 0]
  ------------------
 1216|      0|                              at2[neigh].valence > 1 &&
  ------------------
  |  Branch (1216:31): [True: 0, False: 0]
  ------------------
 1217|      0|                              at2[neigh].valence < at2[neigh].chem_bonds_valence)
  ------------------
  |  Branch (1217:31): [True: 0, False: 0]
  ------------------
 1218|      0|                        {
 1219|      0|                            nNumOthers++;
 1220|      0|                        }
 1221|      0|                    }
 1222|      0|                }
 1223|      0|                if (nNumO != 1 || nNumOthers != 1)
  ------------------
  |  Branch (1223:21): [True: 0, False: 0]
  |  Branch (1223:35): [True: 0, False: 0]
  ------------------
 1224|      0|                {
 1225|      0|                    continue;
 1226|      0|                }
 1227|      0|                for (k = 0; k < num_DB_O; k++)
  ------------------
  |  Branch (1227:29): [True: 0, False: 0]
  ------------------
 1228|      0|                {
 1229|      0|                    if (iat_NO2[k] == iN)
  ------------------
  |  Branch (1229:25): [True: 0, False: 0]
  ------------------
 1230|      0|                    {
 1231|      0|                        break;
 1232|      0|                    }
 1233|      0|                }
 1234|      0|                if (k == num_DB_O)
  ------------------
  |  Branch (1234:21): [True: 0, False: 0]
  ------------------
 1235|      0|                {
 1236|      0|                    iat_NO2[num_DB_O] = iN;
 1237|      0|                    iat_DB_O[num_DB_O++] = iat;
 1238|      0|                }
 1239|       |                /* save the =O (-)-edge to avoid interference */
 1240|      0|                if (ret = AddToEdgeList( &ChangeableEdges[CHG_SET_O_FIXED], e, INC_ADD_EDGE ))
  ------------------
  |  | 1166|      0|#define CHG_SET_O_FIXED        3
  ------------------
                              if (ret = AddToEdgeList( &ChangeableEdges[CHG_SET_O_FIXED], e, INC_ADD_EDGE ))
  ------------------
  |  |   47|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1240:21): [True: 0, False: 0]
  ------------------
 1241|      0|                {
 1242|      0|                    goto exit_case_07;
 1243|      0|                }
 1244|      0|            }
 1245|      5|        }
 1246|      1|        if (num_DB_O)
  ------------------
  |  Branch (1246:13): [True: 0, False: 1]
  ------------------
 1247|      0|        {
 1248|       |            /* search for falsely tautomeric negatively charged atoms N and O */
 1249|      0|            for (i = 0; i < pc2i->len_c2at; i++)
  ------------------
  |  Branch (1249:25): [True: 0, False: 0]
  ------------------
 1250|      0|            {
 1251|      0|                iat = pc2i->c2at[i].atomNumber;
 1252|      0|                if (pc2i->c2at[i].endptRevrs && !pc2i->c2at[i].endptInChI &&
  ------------------
  |  Branch (1252:21): [True: 0, False: 0]
  |  Branch (1252:49): [True: 0, False: 0]
  ------------------
 1253|      0|                     pc2i->c2at[i].nAtChargeRevrs == -1 &&
  ------------------
  |  Branch (1253:22): [True: 0, False: 0]
  ------------------
 1254|      0|                     0 <= ( e = pVA[iat].nCMinusGroupEdge - 1 ) && !pBNS->edge[e].forbidden && pBNS->edge[e].flow &&
  ------------------
  |  Branch (1254:22): [True: 0, False: 0]
  |  Branch (1254:68): [True: 0, False: 0]
  |  Branch (1254:96): [True: 0, False: 0]
  ------------------
 1255|      0|                     0 > FindInEdgeList( &ChangeableEdges[CHG_SET_O_FIXED], e ))
  ------------------
  |  | 1166|      0|#define CHG_SET_O_FIXED        3
  ------------------
  |  Branch (1255:22): [True: 0, False: 0]
  ------------------
 1256|      0|                {
 1257|      0|                    if (pc2i->c2at[i].nValElectr == 6)
  ------------------
  |  Branch (1257:25): [True: 0, False: 0]
  ------------------
 1258|      0|                    {
 1259|      0|                        if (ret = AddToEdgeList( &ChangeableEdges[CHG_SET_WRONG_TAUT_O], e, INC_ADD_EDGE ))
  ------------------
  |  | 1163|      0|#define CHG_SET_WRONG_TAUT_O   1
  ------------------
                                      if (ret = AddToEdgeList( &ChangeableEdges[CHG_SET_WRONG_TAUT_O], e, INC_ADD_EDGE ))
  ------------------
  |  |   47|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1259:29): [True: 0, False: 0]
  ------------------
 1260|      0|                        {
 1261|      0|                            goto exit_case_07;
 1262|      0|                        }
 1263|      0|                    }
 1264|      0|                    else
 1265|      0|                        if (pc2i->c2at[i].nValElectr == 5)
  ------------------
  |  Branch (1265:29): [True: 0, False: 0]
  ------------------
 1266|      0|                        {
 1267|      0|                            if (ret = AddToEdgeList( &ChangeableEdges[CHG_SET_WRONG_TAUT_N], e, INC_ADD_EDGE ))
  ------------------
  |  | 1162|      0|#define CHG_SET_WRONG_TAUT_N   0
  ------------------
                                          if (ret = AddToEdgeList( &ChangeableEdges[CHG_SET_WRONG_TAUT_N], e, INC_ADD_EDGE ))
  ------------------
  |  |   47|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1267:33): [True: 0, False: 0]
  ------------------
 1268|      0|                            {
 1269|      0|                                goto exit_case_07;
 1270|      0|                            }
 1271|      0|                        }
 1272|      0|                    if (ret = AddToEdgeList( &ChangeableEdges[CHG_SET_WRONG_TAUT_ALL], e, INC_ADD_EDGE ))
  ------------------
  |  | 1164|      0|#define CHG_SET_WRONG_TAUT_ALL 2
  ------------------
                                  if (ret = AddToEdgeList( &ChangeableEdges[CHG_SET_WRONG_TAUT_ALL], e, INC_ADD_EDGE ))
  ------------------
  |  |   47|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1272:25): [True: 0, False: 0]
  ------------------
 1273|      0|                    {
 1274|      0|                        goto exit_case_07;
 1275|      0|                    }
 1276|      0|                }
 1277|      0|            }
 1278|       |            /* ------- finally, try to move charges from O=N --------------*/
 1279|      0|            for (i = 0; i < num_DB_O; i++)
  ------------------
  |  Branch (1279:25): [True: 0, False: 0]
  ------------------
 1280|      0|            {
 1281|      0|                int nDeltaChargeExpected;
 1282|      0|                one_success = 0;
 1283|      0|                delta = 1;
 1284|      0|                iat = iat_DB_O[i];
 1285|      0|                peDB_O_Minus = pBNS->edge + ( pVA[iat].nCMinusGroupEdge - 1 );
 1286|      0|                pe = pBNS->edge + pBNS->vert[iat].iedge[0];
 1287|       |
 1288|      0|                if (!pe->flow)
  ------------------
  |  Branch (1288:21): [True: 0, False: 0]
  ------------------
 1289|      0|                    continue;
 1290|      0|                pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 1291|      0|                pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 1292|       |
 1293|      0|                pe->forbidden |= forbidden_edge_mask;
 1294|       |
 1295|      0|                pe->flow -= delta;
 1296|      0|                pv1->st_edge.flow -= delta;
 1297|      0|                pv2->st_edge.flow -= delta;
 1298|      0|                pBNS->tot_st_flow -= 2 * delta;
 1299|       |
 1300|      0|                for (k = 0; !one_success && k <= CHG_LAST_SET; k++)
  ------------------
  |  | 1165|      0|#define CHG_LAST_SET           2 /* the last index in trying */
  ------------------
  |  Branch (1300:29): [True: 0, False: 0]
  |  Branch (1300:45): [True: 0, False: 0]
  ------------------
 1301|      0|                {
 1302|      0|                    if (!ChangeableEdges[k].num_edges)
  ------------------
  |  Branch (1302:25): [True: 0, False: 0]
  ------------------
 1303|      0|                    {
 1304|      0|                        continue;
 1305|      0|                    }
 1306|      0|                    nDeltaChargeExpected = 0;
 1307|       |
 1308|      0|                    SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 1309|      0|                    RemoveForbiddenEdgeMask( pBNS, &ChangeableEdges[k], forbidden_edge_mask );
 1310|       |                    /* allow (-) charge to move to N=O */
 1311|      0|                    peDB_O_Minus->forbidden &= forbidden_edge_mask_inv;
 1312|       |
 1313|      0|                    ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 1314|      0|                                          &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 1315|       |
 1316|      0|                    if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (1316:25): [True: 0, False: 0]
  |  Branch (1316:39): [True: 0, False: 0]
  |  Branch (1316:57): [True: 0, False: 0]
  ------------------
 1317|      0|                        vPathEnd == v2 && vPathStart == v1 ) &&
  ------------------
  |  Branch (1317:25): [True: 0, False: 0]
  |  Branch (1317:43): [True: 0, False: 0]
  ------------------
 1318|      0|                                      nDeltaCharge == nDeltaChargeExpected)
  ------------------
  |  Branch (1318:39): [True: 0, False: 0]
  ------------------
 1319|      0|                    {
 1320|       |                        /* Move (-) charge to =O and remove it an endpoint => nDeltaCharge == 0 */
 1321|      0|                        ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 1322|      0|                        if (ret > 0)
  ------------------
  |  Branch (1322:29): [True: 0, False: 0]
  ------------------
 1323|      0|                        {
 1324|      0|                            nNumRunBNS++;
 1325|      0|                            one_success++; /* 07 */
 1326|      0|                        }
 1327|      0|                    }
 1328|      0|                    INCHI_HEAPCHK
 1329|      0|                }
 1330|      0|                cur_success += one_success;
 1331|       |
 1332|      0|                RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
 1333|      0|                pe->forbidden &= forbidden_edge_mask_inv;
 1334|       |
 1335|      0|                if (!one_success)
  ------------------
  |  Branch (1335:21): [True: 0, False: 0]
  ------------------
 1336|      0|                {
 1337|      0|                    pe->flow += delta;
 1338|      0|                    pv1->st_edge.flow += delta;
 1339|      0|                    pv2->st_edge.flow += delta;
 1340|      0|                    pBNS->tot_st_flow += 2 * delta;
 1341|      0|                }
 1342|      0|            }
 1343|      0|        }
 1344|      1|    exit_case_07:
 1345|      5|        for (i = 0; i < CHG_SET_NUM; i++)
  ------------------
  |  | 1167|      5|#define CHG_SET_NUM            4
  ------------------
  |  Branch (1345:21): [True: 4, False: 1]
  ------------------
 1346|      4|        {
 1347|      4|            AllocEdgeList( &ChangeableEdges[i], EDGE_LIST_FREE );
  ------------------
  |  |  271|      4|#define EDGE_LIST_FREE   (-2)
  ------------------
 1348|      4|        }
 1349|       |
 1350|      1|        CurrEdges.num_edges = 0; /* clear current edge list */
 1351|      1|        if (cur_success)
  ------------------
  |  Branch (1351:13): [True: 0, False: 1]
  ------------------
 1352|      0|        {
 1353|      0|            tot_succes += cur_success;
 1354|       |            /* recalculate InChI from the structure */
 1355|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (1355:17): [True: 0, False: 0]
  ------------------
 1356|      0|                ppt_group_info, ppat_norm, ppat_prep ) ))
 1357|      0|            {
 1358|      0|                goto exit_function;
 1359|      0|            }
 1360|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (1360:17): [True: 0, False: 0]
  ------------------
 1361|      0|            {
 1362|      0|                goto exit_function;
 1363|      0|            }
 1364|      0|            if (ret = FillOutCMP2MHINCHI( pStruct, pTCGroups, at2, pVA, pInChI, pc2i ))
  ------------------
  |  Branch (1364:17): [True: 0, False: 0]
  ------------------
 1365|      0|            {
 1366|      0|                goto exit_function;
 1367|      0|            }
 1368|      0|            if (!pc2i->bHasDifference)
  ------------------
  |  Branch (1368:17): [True: 0, False: 0]
  ------------------
 1369|      0|            {
 1370|      0|                goto exit_function; /* nothing to do */
 1371|      0|            }
 1372|      0|        }
 1373|      1|#undef CHG_SET_NOOH
 1374|      1|#undef CHG_SET_WRONG_TAUT
 1375|      1|#undef CHG_SET_TAUT
 1376|      1|#undef CHG_LAST_SET
 1377|      1|#undef CHG_SET_O_FIXED
 1378|      1|#undef CHG_SET_NUM
 1379|      1|    }
 1380|       |
 1381|      1|exit_function:
 1382|      1|    AllocEdgeList( &AllChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|      1|#define EDGE_LIST_FREE   (-2)
  ------------------
 1383|      1|    AllocEdgeList( &CurrEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|      1|#define EDGE_LIST_FREE   (-2)
  ------------------
 1384|      1|    AllocEdgeList( &CurrEdges2, EDGE_LIST_FREE );
  ------------------
  |  |  271|      1|#define EDGE_LIST_FREE   (-2)
  ------------------
 1385|      1|    AllocEdgeList( &CurrEdges3, EDGE_LIST_FREE );
  ------------------
  |  |  271|      1|#define EDGE_LIST_FREE   (-2)
  ------------------
 1386|      1|    AllocEdgeList( &NFlowerEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|      1|#define EDGE_LIST_FREE   (-2)
  ------------------
 1387|      1|    AllocEdgeList( &OtherNFlowerEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|      1|#define EDGE_LIST_FREE   (-2)
  ------------------
 1388|      1|    AllocEdgeList( &FixedLargeRingStereoEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|      1|#define EDGE_LIST_FREE   (-2)
  ------------------
 1389|      1|    AllocEdgeList( &TautEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|      1|#define EDGE_LIST_FREE   (-2)
  ------------------
 1390|       |
 1391|      1|    return ret;
 1392|      1|}

FixRestoredStructureStereo:
   77|      3|{
   78|       |    /*--------- process extra or missing Fixed-H on non-tautomeric atoms ------*/
   79|       |    /* at2 should be the most recently restored atom, Fixed-H */
   80|      3|    int i, j, k, delta, tot_succes, max_success, cur_success, ret = 0;
   81|      3|    int err, iOrigInChI, iRevrInChI;
   82|      3|    int j12, v1, v2, e, vRad;
   83|      3|    BNS_VERTEX *pv1, *pv2, *pvRad;
   84|      3|    BNS_EDGE   *pe, *peRad;
   85|      3|    EDGE_LIST AllChargeEdges, CurrEdges, NFlowerEdges, OtherNFlowerEdges, FixedStereoEdges, AllRadList;
   86|      3|    EDGE_LIST TautMinusEdges[2]; /* 0 -> O & O(+), 1=> N & N(+) */
   87|       |
   88|      3|    Vertex     vPathStart, vPathEnd;
   89|      3|    int        nPathLen, nDeltaH, nDeltaCharge, nNumVisitedAtoms;
   90|      3|    INChI_Stereo *pStereoInChI, *pStereo2InChI, *pStereoRevrs, *pStereo2Revrs;
   91|       |
   92|       |    /* Stereo */
   93|       |
   94|       |    /* currently being processed layer */
   95|      3|    pStereoInChI = ( pInChI[0]->StereoIsotopic &&
  ------------------
  |  Branch (95:22): [True: 0, False: 3]
  ------------------
   96|      3|                     pInChI[0]->StereoIsotopic->nNumberOfStereoBonds +
  ------------------
  |  Branch (96:22): [True: 0, False: 0]
  ------------------
   97|      0|                     pInChI[0]->StereoIsotopic->nNumberOfStereoCenters )
   98|      3|        ? pInChI[0]->StereoIsotopic
   99|      3|        : pInChI[0]->Stereo;
  100|       |
  101|       |    /* mobile-H layer in case of Fixed-H */
  102|      3|    pStereo2InChI = ( pStruct->bMobileH == TAUT_YES || !pInChI[1] ||
  ------------------
  |  |  580|      6|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (102:23): [True: 1, False: 2]
  |  Branch (102:56): [True: 0, False: 2]
  ------------------
  103|      3|                      !pInChI[1]->nNumberOfAtoms || pInChI[1]->bDeleted )
  ------------------
  |  Branch (103:23): [True: 0, False: 2]
  |  Branch (103:53): [True: 0, False: 2]
  ------------------
  104|      3|        ? NULL
  105|      3|        : ( pInChI[1]->StereoIsotopic &&
  ------------------
  |  Branch (105:13): [True: 0, False: 2]
  ------------------
  106|      2|            pInChI[1]->StereoIsotopic->nNumberOfStereoBonds +
  ------------------
  |  Branch (106:13): [True: 0, False: 0]
  ------------------
  107|      0|            pInChI[1]->StereoIsotopic->nNumberOfStereoCenters ) ?
  108|      0|            pInChI[1]->StereoIsotopic :
  109|      2|            pInChI[1]->Stereo;
  110|       |
  111|       |    /* currently being processed layer */
  112|      3|    pStereoRevrs = ( pStruct->pOneINChI[0]->StereoIsotopic &&
  ------------------
  |  Branch (112:22): [True: 3, False: 0]
  ------------------
  113|      3|                     pStruct->pOneINChI[0]->StereoIsotopic->nNumberOfStereoBonds +
  ------------------
  |  Branch (113:22): [True: 0, False: 3]
  ------------------
  114|      3|                     pStruct->pOneINChI[0]->StereoIsotopic->nNumberOfStereoCenters )
  115|      3|        ? pStruct->pOneINChI[0]->StereoIsotopic
  116|      3|        : pStruct->pOneINChI[0]->Stereo;
  117|       |
  118|       |    /* mobile-H layer in case of Fixed-H */
  119|      3|    pStereo2Revrs = ( pStruct->bMobileH == TAUT_YES || !pStruct->pOneINChI[1] ||
  ------------------
  |  |  580|      6|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (119:23): [True: 1, False: 2]
  |  Branch (119:56): [True: 1, False: 1]
  ------------------
  120|      3|                      !pStruct->pOneINChI[1]->nNumberOfAtoms || pStruct->pOneINChI[1]->bDeleted )
  ------------------
  |  Branch (120:23): [True: 0, False: 1]
  |  Branch (120:65): [True: 0, False: 1]
  ------------------
  121|      3|        ? NULL
  122|      3|        : ( pStruct->pOneINChI[1]->StereoIsotopic &&
  ------------------
  |  Branch (122:13): [True: 1, False: 0]
  ------------------
  123|      1|            pStruct->pOneINChI[1]->StereoIsotopic->nNumberOfStereoBonds +
  ------------------
  |  Branch (123:13): [True: 0, False: 1]
  ------------------
  124|      1|            pStruct->pOneINChI[1]->StereoIsotopic->nNumberOfStereoCenters ) ?
  125|      0|            pStruct->pOneINChI[1]->StereoIsotopic :
  126|      1|            pStruct->pOneINChI[1]->Stereo;
  127|       |
  128|       |    INCHI_HEAPCHK
  129|       |
  130|      3|    AllocEdgeList( &AllChargeEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      3|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  131|      3|    AllocEdgeList( &CurrEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      3|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  132|      3|    AllocEdgeList( &NFlowerEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      3|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  133|      3|    AllocEdgeList( &OtherNFlowerEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      3|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  134|      3|    AllocEdgeList( &FixedStereoEdges, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      3|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  135|      3|    AllocEdgeList( &AllRadList, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      3|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  136|       |
  137|      3|    AllocEdgeList( TautMinusEdges + 0, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      3|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  138|      3|    AllocEdgeList( TautMinusEdges + 1, EDGE_LIST_CLEAR );
  ------------------
  |  |  270|      3|#define EDGE_LIST_CLEAR  (-1)
  ------------------
  139|       |
  140|      3|    cmpInChI = CompareReversedINChI2( pStruct->pOneINChI[0], pInChI[0], pStruct->pOneINChI_Aux[0], NULL /*INChI_Aux *v2*/, icr, &err );
  141|      3|    if (cmpInChI & IDIF_PROBLEM)
  ------------------
  |  Branch (141:9): [True: 0, False: 3]
  ------------------
  142|      0|    {
  143|      0|        ret = RI_ERR_PROGR; /* severe restore problem */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  144|      0|        goto exit_function;
  145|      0|    }
  146|      3|    if (err)
  ------------------
  |  Branch (146:9): [True: 0, False: 3]
  ------------------
  147|      0|    {
  148|      0|        ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
  149|      0|        goto exit_function;
  150|      0|    }
  151|       |
  152|      3|    cmpInChI2 = 0;
  153|       |
  154|      3|    if (pStruct->bMobileH == TAUT_NON)
  ------------------
  |  |  579|      3|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (154:9): [True: 2, False: 1]
  ------------------
  155|      2|    {
  156|       |        /* these indexes are used to compare Mobile-H InChI */
  157|      2|        iOrigInChI = ( pInChI[1] && pInChI[1]->nNumberOfAtoms && !pInChI[1]->bDeleted ) ? 1 : 0;
  ------------------
  |  Branch (157:24): [True: 2, False: 0]
  |  Branch (157:37): [True: 2, False: 0]
  |  Branch (157:66): [True: 2, False: 0]
  ------------------
  158|      2|        iRevrInChI = ( pStruct->pOneINChI[1] && pStruct->pOneINChI[1]->nNumberOfAtoms && !pStruct->pOneINChI[1]->bDeleted ) ? 1 : 0;
  ------------------
  |  Branch (158:24): [True: 1, False: 1]
  |  Branch (158:49): [True: 1, False: 0]
  |  Branch (158:90): [True: 1, False: 0]
  ------------------
  159|      2|    }
  160|      1|    else
  161|      1|    {
  162|      1|        iOrigInChI = 0;
  163|      1|        iRevrInChI = 0;
  164|      1|    }
  165|       |
  166|      3|    memset( icr2, 0, sizeof( *icr2 ) );
  167|      3|    if (iRevrInChI || iOrigInChI)
  ------------------
  |  Branch (167:9): [True: 1, False: 2]
  |  Branch (167:23): [True: 1, False: 1]
  ------------------
  168|      2|    {
  169|       |        /* additional mobile-H compare in case of Fixed-H */
  170|      2|        cmpInChI2 = CompareReversedINChI2( pStruct->pOneINChI[iRevrInChI], pInChI[iOrigInChI], pStruct->pOneINChI_Aux[iRevrInChI], NULL /*INChI_Aux *v2*/, icr2, &err );
  171|      2|        if (cmpInChI & IDIF_PROBLEM)
  ------------------
  |  Branch (171:13): [True: 0, False: 2]
  ------------------
  172|      0|        {
  173|      0|            ret = RI_ERR_PROGR; /* severe restore problem */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  174|      0|            goto exit_function;
  175|      0|        }
  176|      2|        if (err)
  ------------------
  |  Branch (176:13): [True: 0, False: 2]
  ------------------
  177|      0|        {
  178|      0|            ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
  179|      0|            goto exit_function;
  180|      0|        }
  181|      2|    }
  182|       |
  183|      3|    if (!( cmpInChI & IDIFF_SB ) && !( cmpInChI2 & IDIFF_SB ))
  ------------------
  |  |  157|      3|#define IDIFF_SB (IDIF_SB_PARITY | IDIF_SB_EXTRA_UNDF | IDIF_SB_EXTRA | IDIF_SB_MISS_UNDF | IDIF_SB_MISS)
  ------------------
                  if (!( cmpInChI & IDIFF_SB ) && !( cmpInChI2 & IDIFF_SB ))
  ------------------
  |  |  157|      3|#define IDIFF_SB (IDIF_SB_PARITY | IDIF_SB_EXTRA_UNDF | IDIF_SB_EXTRA | IDIF_SB_MISS_UNDF | IDIF_SB_MISS)
  ------------------
  |  Branch (183:9): [True: 3, False: 0]
  |  Branch (183:37): [True: 3, False: 0]
  ------------------
  184|      3|    {
  185|      3|        goto exit_function;
  186|      3|    }
  187|       |    /* need to temporarily remove fixing of stereogenic bonds */
  188|      0|    for (i = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (188:17): [True: 0, False: 0]
  ------------------
  189|      0|    {
  190|      0|        pv1 = pBNS->vert + i;
  191|      0|        for (j = 0; j < at2[i].valence; j++)
  ------------------
  |  Branch (191:21): [True: 0, False: 0]
  ------------------
  192|      0|        {
  193|      0|            pe = pBNS->edge + ( e = pv1->iedge[j] );
  194|      0|            if (j == pe->neighbor1)
  ------------------
  |  Branch (194:17): [True: 0, False: 0]
  ------------------
  195|      0|            {
  196|       |                /* do not store same bond 2 times */
  197|      0|                if (( pe->forbidden & forbidden_stereo_edge_mask ) &&
  ------------------
  |  Branch (197:21): [True: 0, False: 0]
  ------------------
  198|      0|                    ( ret = AddToEdgeList( &FixedStereoEdges, e, INC_ADD_EDGE ) ))
  ------------------
  |  |   48|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (198:21): [True: 0, False: 0]
  ------------------
  199|      0|                {
  200|      0|                    goto exit_function;
  201|      0|                }
  202|      0|            }
  203|      0|        }
  204|      0|    }
  205|       |
  206|      0|    tot_succes = 0;
  207|      0|    cur_success = 0;
  208|      0|    if (( cmpInChI & IDIF_SB_MISS ) && ( !cmpInChI2 || ( cmpInChI2 & IDIF_SB_MISS ) ) &&
  ------------------
  |  Branch (208:9): [True: 0, False: 0]
  |  Branch (208:42): [True: 0, False: 0]
  |  Branch (208:56): [True: 0, False: 0]
  ------------------
  209|      0|         0 < ( max_success = pBNS->tot_st_cap - pBNS->tot_st_flow ))
  ------------------
  |  Branch (209:10): [True: 0, False: 0]
  ------------------
  210|      0|    {
  211|       |        /*----------------------------------------------------*/
  212|       |        /* case 01: extra stereogenic bond, radical present   */
  213|       |        /* X=N-O*  => X=N=O and eliminate radical             */
  214|       |        /*----------------------------------------------------*/
  215|      0|        int aN;
  216|      0|        BNS_VERTEX *pvO, *pvN;
  217|      0|        BNS_EDGE   *peNO;
  218|       |
  219|      0|        RemoveForbiddenEdgeMask( pBNS, &FixedStereoEdges, forbidden_stereo_edge_mask );
  220|       |
  221|      0|        for (i = 0; i < icr->num_sb_in2_only && cur_success < max_success; i++)
  ------------------
  |  Branch (221:21): [True: 0, False: 0]
  |  Branch (221:49): [True: 0, False: 0]
  ------------------
  222|      0|        {
  223|      0|            j12 = icr->sb_in2_only[i];
  224|      0|            pv1 = pBNS->vert + ( v1 = pStereoInChI->nBondAtom1[j12] - 1 );
  225|      0|            pv2 = pBNS->vert + ( v2 = pStereoInChI->nBondAtom2[j12] - 1 );
  226|      0|            for (k = 0; k < at2[v1].valence; k++)
  ------------------
  |  Branch (226:25): [True: 0, False: 0]
  ------------------
  227|      0|            {
  228|      0|                pe = pBNS->edge + ( e = pv1->iedge[k] );
  229|      0|                if (v2 == ( pe->neighbor12 ^ v1 ))
  ------------------
  |  Branch (229:21): [True: 0, False: 0]
  ------------------
  230|      0|                    break; /* the edge has been found */
  231|      0|            }
  232|      0|            if (k == at2[v1].valence)
  ------------------
  |  Branch (232:17): [True: 0, False: 0]
  ------------------
  233|      0|            {
  234|      0|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
  235|      0|                goto exit_function;
  236|      0|            }
  237|       |            /* check v1 */
  238|      0|            pv1->st_edge.cap--;
  239|      0|            pv1->st_edge.flow--;
  240|      0|            pv2->st_edge.flow--;
  241|      0|            pe->flow--; /* new radical on v2 */
  242|      0|            vRad = NO_VERTEX;
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  243|      0|            ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
  244|      0|                                  &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
  245|      0|            pv1->st_edge.cap++;
  246|      0|            pv1->st_edge.flow++;
  247|      0|            pv2->st_edge.flow++;
  248|      0|            pe->flow++; /* remove new radical on v2 */
  249|       |
  250|      0|            if (ret == 1 /*&& !nDeltaH*/ && !nDeltaCharge && ( v2 == vPathStart || v2 == vPathEnd ))
  ------------------
  |  Branch (250:17): [True: 0, False: 0]
  |  Branch (250:45): [True: 0, False: 0]
  |  Branch (250:64): [True: 0, False: 0]
  |  Branch (250:84): [True: 0, False: 0]
  ------------------
  251|      0|            {
  252|      0|                vRad = ( v2 == vPathStart ) ? vPathEnd : vPathStart;
  ------------------
  |  Branch (252:24): [True: 0, False: 0]
  ------------------
  253|      0|            }
  254|      0|            else
  255|      0|            {
  256|      0|                pv2->st_edge.cap--;
  257|      0|                pv2->st_edge.flow--;
  258|      0|                pv1->st_edge.flow--;
  259|      0|                pe->flow--; /* new radical on v1 */
  260|      0|                vRad = NO_VERTEX;
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  261|      0|                ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
  262|      0|                                      &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
  263|      0|                pv2->st_edge.cap++;
  264|      0|                pv2->st_edge.flow++;
  265|      0|                pv1->st_edge.flow++;
  266|      0|                pe->flow++; /* remove new radical on v1 */
  267|      0|                if (ret == 1 /*&& !nDeltaH*/ && !nDeltaCharge && ( v1 == vPathStart || v1 == vPathEnd ))
  ------------------
  |  Branch (267:21): [True: 0, False: 0]
  |  Branch (267:49): [True: 0, False: 0]
  |  Branch (267:68): [True: 0, False: 0]
  |  Branch (267:88): [True: 0, False: 0]
  ------------------
  268|      0|                {
  269|      0|                    vRad = ( v1 == vPathStart ) ? vPathEnd : vPathStart;
  ------------------
  |  Branch (269:28): [True: 0, False: 0]
  ------------------
  270|      0|                }
  271|      0|            }
  272|      0|            if (vRad == NO_VERTEX)
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (272:17): [True: 0, False: 0]
  ------------------
  273|      0|            {
  274|      0|                continue; /* radical did not affect this bond */
  275|      0|            }
  276|      0|            pvRad = pBNS->vert + vRad;
  277|       |            /* detect =N-O*  */
  278|      0|            if (pVA[vRad].cNumValenceElectrons == 6 && at2[vRad].valence == 1 &&
  ------------------
  |  Branch (278:17): [True: 0, False: 0]
  |  Branch (278:56): [True: 0, False: 0]
  ------------------
  279|      0|                ( peRad = pBNS->edge + pvRad->iedge[0] )->flow == 0 &&
  ------------------
  |  Branch (279:17): [True: 0, False: 0]
  ------------------
  280|      0|                 pVA[aN = peRad->neighbor12 ^ vRad].cNumValenceElectrons == 5 &&
  ------------------
  |  Branch (280:18): [True: 0, False: 0]
  ------------------
  281|      0|                 at2[aN].valence == 2)
  ------------------
  |  Branch (281:18): [True: 0, False: 0]
  ------------------
  282|      0|            {
  283|       |                /*------------------------------------------------------------
  284|       |                  Fix Metal disconnection/normalization inconsistency :
  285|       |                                         disconnected  restored
  286|       |                  R=N(+)-M     R=N--M     R=N  + M     R=N   + M
  287|       |                    |       ->   ||    ->   ||     ->    |
  288|       |                    O(-)         O          O            O* <- radical
  289|       |
  290|       |                  The correct     R=N    + M(+)
  291|       |                  disconnection     |
  292|       |                  would be this:    O(-)
  293|       |                --------------------------------------------------------------*/
  294|      0|                pvN = pBNS->vert + aN;
  295|      0|                pvO = pvRad;
  296|      0|                peNO = peRad;
  297|       |
  298|       |                /* N-O*  => N=O */
  299|      0|                peNO->flow++;
  300|      0|                pvO->st_edge.flow++;
  301|      0|                pvN->st_edge.cap++;
  302|      0|                pvN->st_edge.flow++;
  303|      0|                pBNS->tot_st_cap += 1;
  304|      0|                pBNS->tot_st_flow += 2;
  305|      0|                cur_success++;
  306|      0|            }
  307|      0|            else
  308|      0|            {
  309|       |                     /* all other radicals that affect stereo */
  310|      0|                delta = pvRad->st_edge.cap - pvRad->st_edge.flow;
  311|      0|                pvRad->st_edge.cap -= delta;
  312|      0|                pBNS->tot_st_cap -= delta;
  313|      0|            }
  314|      0|        }
  315|       |/*exit_case_01:*/
  316|      0|        SetForbiddenEdgeMask( pBNS, &FixedStereoEdges, forbidden_stereo_edge_mask );
  317|      0|        if (cur_success)
  ------------------
  |  Branch (317:13): [True: 0, False: 0]
  ------------------
  318|      0|        {
  319|      0|            tot_succes += cur_success;
  320|       |            /* recalculate InChI from the structure */
  321|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (321:17): [True: 0, False: 0]
  ------------------
  322|      0|                ppt_group_info, ppat_norm, ppat_prep ) ))
  323|      0|            {
  324|      0|                goto exit_function;
  325|      0|            }
  326|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (326:17): [True: 0, False: 0]
  ------------------
  327|      0|            {
  328|      0|                goto exit_function;
  329|      0|            }
  330|       |            /*
  331|       |            if ( ret = FillOutCMP2MHINCHI( pStruct, pTCGroups, at2, pVA, pInChI, pc2i ) ) {
  332|       |                goto exit_function;
  333|       |            }
  334|       |            */
  335|      0|            cmpInChI = CompareReversedINChI2( pStruct->pOneINChI[0], pInChI[0], pStruct->pOneINChI_Aux[0], NULL /*INChI_Aux *v2*/, icr, &err );
  336|      0|            if (cmpInChI & IDIF_PROBLEM)
  ------------------
  |  Branch (336:17): [True: 0, False: 0]
  ------------------
  337|      0|            {
  338|      0|                ret = RI_ERR_PROGR; /* severe restore problem */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  339|      0|                goto exit_function;
  340|      0|            }
  341|      0|            if (err)
  ------------------
  |  Branch (341:17): [True: 0, False: 0]
  ------------------
  342|      0|            {
  343|      0|                ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
  344|      0|                goto exit_function;
  345|      0|            }
  346|      0|            cmpInChI2 = 0;
  347|      0|            memset( icr2, 0, sizeof( *icr2 ) );
  348|      0|            if (iRevrInChI || iOrigInChI)
  ------------------
  |  Branch (348:17): [True: 0, False: 0]
  |  Branch (348:31): [True: 0, False: 0]
  ------------------
  349|      0|            {
  350|       |                /* additional mobile-H compare in case of Fixed-H */
  351|      0|                cmpInChI2 = CompareReversedINChI2( pStruct->pOneINChI[iRevrInChI], pInChI[iOrigInChI], pStruct->pOneINChI_Aux[iRevrInChI], NULL /*INChI_Aux *v2*/, icr2, &err );
  352|      0|                if (cmpInChI & IDIF_PROBLEM)
  ------------------
  |  Branch (352:21): [True: 0, False: 0]
  ------------------
  353|      0|                {
  354|      0|                    ret = RI_ERR_PROGR; /* severe restore problem */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  355|      0|                    goto exit_function;
  356|      0|                }
  357|      0|                if (err)
  ------------------
  |  Branch (357:21): [True: 0, False: 0]
  ------------------
  358|      0|                {
  359|      0|                    ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
  360|      0|                    goto exit_function;
  361|      0|                }
  362|      0|            }
  363|       |
  364|      0|            pStereoRevrs = ( pStruct->pOneINChI[0]->StereoIsotopic &&
  ------------------
  |  Branch (364:30): [True: 0, False: 0]
  ------------------
  365|      0|                       pStruct->pOneINChI[0]->StereoIsotopic->nNumberOfStereoBonds +
  ------------------
  |  Branch (365:24): [True: 0, False: 0]
  ------------------
  366|      0|                       pStruct->pOneINChI[0]->StereoIsotopic->nNumberOfStereoCenters )
  367|      0|                ? pStruct->pOneINChI[0]->StereoIsotopic
  368|      0|                : pStruct->pOneINChI[0]->Stereo;
  369|       |
  370|       |
  371|      0|            pStereo2Revrs = ( pStruct->bMobileH == TAUT_YES || !pStruct->pOneINChI[1] ||
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (371:31): [True: 0, False: 0]
  |  Branch (371:64): [True: 0, False: 0]
  ------------------
  372|      0|                       !pStruct->pOneINChI[1]->nNumberOfAtoms || pStruct->pOneINChI[1]->bDeleted )
  ------------------
  |  Branch (372:24): [True: 0, False: 0]
  |  Branch (372:66): [True: 0, False: 0]
  ------------------
  373|      0|                ? NULL
  374|      0|                : ( pStruct->pOneINChI[1]->StereoIsotopic &&
  ------------------
  |  Branch (374:21): [True: 0, False: 0]
  ------------------
  375|      0|                    pStruct->pOneINChI[1]->StereoIsotopic->nNumberOfStereoBonds +
  ------------------
  |  Branch (375:21): [True: 0, False: 0]
  ------------------
  376|      0|                    pStruct->pOneINChI[1]->StereoIsotopic->nNumberOfStereoCenters ) ?
  377|      0|                    pStruct->pOneINChI[1]->StereoIsotopic :
  378|      0|                    pStruct->pOneINChI[1]->Stereo;
  379|      0|        }
  380|      0|    }
  381|       |
  382|      0|    cur_success = 0;
  383|      0|    if (!( cmpInChI & IDIF_SB_MISS ) && ( cmpInChI2 & IDIF_SB_MISS ) &&
  ------------------
  |  Branch (383:9): [True: 0, False: 0]
  |  Branch (383:41): [True: 0, False: 0]
  ------------------
  384|      0|         icr2->num_sb_in2_only &&
  ------------------
  |  Branch (384:10): [True: 0, False: 0]
  ------------------
  385|      0|         0 < ( max_success = pBNS->tot_st_cap - pBNS->tot_st_flow ))
  ------------------
  |  Branch (385:10): [True: 0, False: 0]
  ------------------
  386|      0|    {
  387|       |        /*----------------------------------------------------*/
  388|       |        /* case 02: missing stereogenic bond in Mobile-H only */
  389|       |        /* X=N-O*  => X=N=O and eliminate radical             */
  390|       |        /*----------------------------------------------------*/
  391|      0|        int retC, ret2C, retS, ret2S;
  392|      0|        INCHI_MODE cmpInChI_Prev, cmpInChI2_Prev;
  393|      0|        ICR  icr_Prev, icr2_Prev;
  394|       |
  395|       |        /* blind attepmt */
  396|      0|        icr_Prev = *icr;
  397|      0|        icr2_Prev = *icr2;
  398|      0|        cmpInChI_Prev = cmpInChI;
  399|      0|        cmpInChI2_Prev = cmpInChI2;
  400|      0|        for (i = AllRadList.num_edges = 0; i < pStruct->num_atoms; i++)
  ------------------
  |  Branch (400:44): [True: 0, False: 0]
  ------------------
  401|      0|        {
  402|      0|            if (pBNS->vert[i].st_edge.cap - pBNS->vert[i].st_edge.flow == 1 &&
  ------------------
  |  Branch (402:17): [True: 0, False: 0]
  ------------------
  403|      0|                ( ret = AddToEdgeList( &AllRadList, i, INC_ADD_EDGE ) ))
  ------------------
  |  |   48|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (403:17): [True: 0, False: 0]
  ------------------
  404|      0|            {
  405|      0|                goto exit_function;
  406|      0|            }
  407|      0|        }
  408|      0|        for (i = 0; i < AllRadList.num_edges; i++)
  ------------------
  |  Branch (408:21): [True: 0, False: 0]
  ------------------
  409|      0|        {
  410|      0|            j = AllRadList.pnEdges[i];
  411|      0|            pBNS->vert[j].st_edge.cap -= 1;
  412|      0|            pBNS->tot_st_cap -= 1;
  413|      0|        }
  414|       |        /*-------------------------------------------------*/
  415|       |        /* re-create InChI and see whether it looks better */
  416|       |        /*-------------------------------------------------*/
  417|      0|        if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (417:13): [True: 0, False: 0]
  ------------------
  418|      0|            ppt_group_info, ppat_norm, ppat_prep ) ))
  419|      0|        {
  420|      0|            goto exit_function;
  421|      0|        }
  422|      0|        if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (422:13): [True: 0, False: 0]
  ------------------
  423|      0|        {
  424|      0|            goto exit_function;
  425|      0|        }
  426|       |        /*
  427|       |        if ( ret = FillOutCMP2MHINCHI( pStruct, pTCGroups, at2, pVA, pInChI, pc2i ) ) {
  428|       |            goto exit_function;
  429|       |        }
  430|       |        */
  431|      0|        cmpInChI = CompareReversedINChI2( pStruct->pOneINChI[0], pInChI[0], pStruct->pOneINChI_Aux[0], NULL /*INChI_Aux *v2*/, icr, &err );
  432|      0|        if (cmpInChI & IDIF_PROBLEM)
  ------------------
  |  Branch (432:13): [True: 0, False: 0]
  ------------------
  433|      0|        {
  434|      0|            ret = RI_ERR_PROGR; /* severe restore problem */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  435|      0|            goto exit_function;
  436|      0|        }
  437|      0|        if (err)
  ------------------
  |  Branch (437:13): [True: 0, False: 0]
  ------------------
  438|      0|        {
  439|      0|            ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
  440|      0|            goto exit_function;
  441|      0|        }
  442|      0|        cmpInChI2 = 0;
  443|      0|        memset( icr2, 0, sizeof( *icr2 ) );
  444|      0|        if (iRevrInChI || iOrigInChI)
  ------------------
  |  Branch (444:13): [True: 0, False: 0]
  |  Branch (444:27): [True: 0, False: 0]
  ------------------
  445|      0|        {
  446|       |            /* additional mobile-H compare in case of Fixed-H */
  447|      0|            cmpInChI2 = CompareReversedINChI2( pStruct->pOneINChI[iRevrInChI], pInChI[iOrigInChI], pStruct->pOneINChI_Aux[iRevrInChI], NULL /*INChI_Aux *v2*/, icr2, &err );
  448|      0|            if (cmpInChI & IDIF_PROBLEM)
  ------------------
  |  Branch (448:17): [True: 0, False: 0]
  ------------------
  449|      0|            {
  450|      0|                ret = RI_ERR_PROGR; /* severe restore problem */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  451|      0|                goto exit_function;
  452|      0|            }
  453|      0|            if (err)
  ------------------
  |  Branch (453:17): [True: 0, False: 0]
  ------------------
  454|      0|            {
  455|      0|                ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
  456|      0|                goto exit_function;
  457|      0|            }
  458|      0|        }
  459|      0|        retC = CompareIcr( icr, &icr_Prev, NULL, NULL, IDIFF_CONSTIT );
  ------------------
  |  |  160|      0|#define IDIFF_CONSTIT (IDIF_POSITION_H | IDIF_MORE_FH | IDIF_LESS_FH | IDIF_MORE_H | IDIF_LESS_H |\
  |  |  161|      0|                       IDIF_NO_TAUT | IDIF_WRONG_TAUT | IDIF_SINGLE_TG | IDIF_MULTIPLE_TG | \
  |  |  162|      0|                       IDIF_NUM_TG | IDIF_EXTRA_TG_ENDP | IDIF_MISS_TG_ENDP | IDIF_TG | \
  |  |  163|      0|                       IDIF_NUM_ISO_AT | IDIF_ISO_AT | IDIF_CHARGE | IDIF_REM_PROT | IDIF_REM_ISO_H |\
  |  |  164|      0|                       IDIF_DIFF_TG_ENDP)
  ------------------
  460|      0|        retS = CompareIcr( icr, &icr_Prev, NULL, NULL, IDIFF_STEREO );
  ------------------
  |  |  165|      0|#define IDIFF_STEREO  (IDIF_SC_INV | IDIF_SC_PARITY | IDIF_SC_EXTRA_UNDF | IDIF_SC_EXTRA | \
  |  |  166|      0|                       IDIF_SC_MISS_UNDF | IDIF_SC_MISS | IDIF_SB_PARITY | IDIF_SB_EXTRA_UNDF |\
  |  |  167|      0|                       IDIF_SB_EXTRA | IDIF_SB_MISS_UNDF | IDIF_SB_MISS)
  ------------------
  461|      0|        ret2C = CompareIcr( icr2, &icr2_Prev, NULL, NULL, IDIFF_CONSTIT );
  ------------------
  |  |  160|      0|#define IDIFF_CONSTIT (IDIF_POSITION_H | IDIF_MORE_FH | IDIF_LESS_FH | IDIF_MORE_H | IDIF_LESS_H |\
  |  |  161|      0|                       IDIF_NO_TAUT | IDIF_WRONG_TAUT | IDIF_SINGLE_TG | IDIF_MULTIPLE_TG | \
  |  |  162|      0|                       IDIF_NUM_TG | IDIF_EXTRA_TG_ENDP | IDIF_MISS_TG_ENDP | IDIF_TG | \
  |  |  163|      0|                       IDIF_NUM_ISO_AT | IDIF_ISO_AT | IDIF_CHARGE | IDIF_REM_PROT | IDIF_REM_ISO_H |\
  |  |  164|      0|                       IDIF_DIFF_TG_ENDP)
  ------------------
  462|      0|        ret2S = CompareIcr( icr2, &icr2_Prev, NULL, NULL, IDIFF_STEREO );
  ------------------
  |  |  165|      0|#define IDIFF_STEREO  (IDIF_SC_INV | IDIF_SC_PARITY | IDIF_SC_EXTRA_UNDF | IDIF_SC_EXTRA | \
  |  |  166|      0|                       IDIF_SC_MISS_UNDF | IDIF_SC_MISS | IDIF_SB_PARITY | IDIF_SB_EXTRA_UNDF |\
  |  |  167|      0|                       IDIF_SB_EXTRA | IDIF_SB_MISS_UNDF | IDIF_SB_MISS)
  ------------------
  463|       |
  464|      0|        if (0 >= retC &&
  ------------------
  |  Branch (464:13): [True: 0, False: 0]
  ------------------
  465|      0|             0 >= retS &&
  ------------------
  |  Branch (465:14): [True: 0, False: 0]
  ------------------
  466|      0|             0 >= ret2C &&
  ------------------
  |  Branch (466:14): [True: 0, False: 0]
  ------------------
  467|      0|             0 > ret2S)
  ------------------
  |  Branch (467:14): [True: 0, False: 0]
  ------------------
  468|      0|        {
  469|      0|            ; /* accept */
  470|      0|        }
  471|      0|        else
  472|      0|        {
  473|       |             /* reject */
  474|      0|            for (i = 0; i < AllRadList.num_edges; i++)
  ------------------
  |  Branch (474:25): [True: 0, False: 0]
  ------------------
  475|      0|            {
  476|      0|                j = AllRadList.pnEdges[i];
  477|      0|                pBNS->vert[j].st_edge.cap += 1;
  478|      0|                pBNS->tot_st_cap += 1;
  479|      0|            }
  480|       |
  481|       |            /*-------------------------------------------------*/
  482|       |            /* re-create InChI-- return to previous state      */
  483|       |            /*-------------------------------------------------*/
  484|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (484:17): [True: 0, False: 0]
  ------------------
  485|      0|                ppt_group_info, ppat_norm, ppat_prep ) ))
  486|      0|            {
  487|      0|                goto exit_function;
  488|      0|            }
  489|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (489:17): [True: 0, False: 0]
  ------------------
  490|      0|            {
  491|      0|                goto exit_function;
  492|      0|            }
  493|       |            /*
  494|       |            if ( ret = FillOutCMP2MHINCHI( pStruct, pTCGroups, at2, pVA, pInChI, pc2i ) ) {
  495|       |                goto exit_function;
  496|       |            }
  497|       |            */
  498|      0|            cmpInChI = CompareReversedINChI2( pStruct->pOneINChI[0], pInChI[0], pStruct->pOneINChI_Aux[0], NULL /*INChI_Aux *v2*/, icr, &err );
  499|      0|            if (cmpInChI & IDIF_PROBLEM)
  ------------------
  |  Branch (499:17): [True: 0, False: 0]
  ------------------
  500|      0|            {
  501|      0|                ret = RI_ERR_PROGR; /* severe restore problem */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  502|      0|                goto exit_function;
  503|      0|            }
  504|      0|            if (err)
  ------------------
  |  Branch (504:17): [True: 0, False: 0]
  ------------------
  505|      0|            {
  506|      0|                ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
  507|      0|                goto exit_function;
  508|      0|            }
  509|      0|            cmpInChI2 = 0;
  510|      0|            memset( icr2, 0, sizeof( *icr2 ) );
  511|      0|            if (iRevrInChI || iOrigInChI)
  ------------------
  |  Branch (511:17): [True: 0, False: 0]
  |  Branch (511:31): [True: 0, False: 0]
  ------------------
  512|      0|            {
  513|       |                /* additional mobile-H compare in case of Fixed-H */
  514|      0|                cmpInChI2 = CompareReversedINChI2( pStruct->pOneINChI[iRevrInChI], pInChI[iOrigInChI], pStruct->pOneINChI_Aux[iRevrInChI], NULL /*INChI_Aux *v2*/, icr2, &err );
  515|      0|                if (cmpInChI & IDIF_PROBLEM)
  ------------------
  |  Branch (515:21): [True: 0, False: 0]
  ------------------
  516|      0|                {
  517|      0|                    ret = RI_ERR_PROGR; /* severe restore problem */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  518|      0|                    goto exit_function;
  519|      0|                }
  520|      0|                if (err)
  ------------------
  |  Branch (520:21): [True: 0, False: 0]
  ------------------
  521|      0|                {
  522|      0|                    ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
  523|      0|                    goto exit_function;
  524|      0|                }
  525|      0|            }
  526|      0|            pStereoRevrs = ( pStruct->pOneINChI[0]->StereoIsotopic &&
  ------------------
  |  Branch (526:30): [True: 0, False: 0]
  ------------------
  527|      0|                       pStruct->pOneINChI[0]->StereoIsotopic->nNumberOfStereoBonds +
  ------------------
  |  Branch (527:24): [True: 0, False: 0]
  ------------------
  528|      0|                       pStruct->pOneINChI[0]->StereoIsotopic->nNumberOfStereoCenters ) ?
  529|      0|                pStruct->pOneINChI[0]->StereoIsotopic : pStruct->pOneINChI[0]->Stereo;
  530|       |
  531|       |
  532|      0|            pStereo2Revrs = ( pStruct->bMobileH == TAUT_YES || !pStruct->pOneINChI[1] ||
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (532:31): [True: 0, False: 0]
  |  Branch (532:64): [True: 0, False: 0]
  ------------------
  533|      0|                       !pStruct->pOneINChI[1]->nNumberOfAtoms || pStruct->pOneINChI[1]->bDeleted ) ?
  ------------------
  |  Branch (533:24): [True: 0, False: 0]
  |  Branch (533:66): [True: 0, False: 0]
  ------------------
  534|      0|                NULL :
  535|      0|                ( pStruct->pOneINChI[1]->StereoIsotopic &&
  ------------------
  |  Branch (535:19): [True: 0, False: 0]
  ------------------
  536|      0|                pStruct->pOneINChI[1]->StereoIsotopic->nNumberOfStereoBonds +
  ------------------
  |  Branch (536:17): [True: 0, False: 0]
  ------------------
  537|      0|                pStruct->pOneINChI[1]->StereoIsotopic->nNumberOfStereoCenters ) ?
  538|      0|                pStruct->pOneINChI[1]->StereoIsotopic :
  539|      0|                pStruct->pOneINChI[1]->Stereo;
  540|      0|        }
  541|       |/*exit_case_02:;*/
  542|      0|    }
  543|       |
  544|      0|    cur_success = 0;
  545|      0|    if (pStruct->bMobileH == TAUT_NON && ( cmpInChI & IDIF_SB_EXTRA_UNDF ) &&
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (545:9): [True: 0, False: 0]
  |  Branch (545:42): [True: 0, False: 0]
  ------------------
  546|      0|         pStruct->endpoint)
  ------------------
  |  Branch (546:10): [True: 0, False: 0]
  ------------------
  547|      0|    {
  548|       |        /*------------------------------------------------------*/
  549|       |        /* case 03: extra stereogenic bond in Fixed-H  only     */
  550|       |        /* in Mobile-H this bond is not stereogenic.            */
  551|       |        /* Since this bond parity is not known, it is UNDEFINED */
  552|       |        /*------------------------------------------------------*/
  553|      0|        int bDone, num_endpoints;
  554|       |
  555|      0|        TautMinusEdges[0].num_edges = 0;
  556|      0|        TautMinusEdges[1].num_edges = 0;
  557|      0|        AllChargeEdges.num_edges = 0;
  558|       |        /* in1 => in restored structure; in2 => in original InChI */
  559|      0|        for (i = 0; i < icr->num_sb_undef_in1_only; i++)
  ------------------
  |  Branch (559:21): [True: 0, False: 0]
  ------------------
  560|      0|        {
  561|      0|            j12 = icr->sb_undef_in1_only[i];
  562|      0|            pv1 = pBNS->vert + ( v1 = pStereoRevrs->nBondAtom1[j12] - 1 );
  563|      0|            pv2 = pBNS->vert + ( v2 = pStereoRevrs->nBondAtom2[j12] - 1 );
  564|       |
  565|      0|            if (pStereo2Revrs)
  ------------------
  |  Branch (565:17): [True: 0, False: 0]
  ------------------
  566|      0|            {
  567|       |                /* reject if it is extra in Mobile-H also */
  568|      0|                if (icr2->num_sb_undef_in1_only)
  ------------------
  |  Branch (568:21): [True: 0, False: 0]
  ------------------
  569|      0|                {
  570|      0|                    for (j = 0; j < icr2->num_sb_undef_in1_only; j++)
  ------------------
  |  Branch (570:33): [True: 0, False: 0]
  ------------------
  571|      0|                    {
  572|      0|                        k = icr2->sb_undef_in1_only[j];
  573|      0|                        if (v1 == pStereo2Revrs->nBondAtom1[k] &&
  ------------------
  |  Branch (573:29): [True: 0, False: 0]
  ------------------
  574|      0|                             v2 == pStereo2Revrs->nBondAtom2[k])
  ------------------
  |  Branch (574:30): [True: 0, False: 0]
  ------------------
  575|      0|                        {
  576|      0|                            break;
  577|      0|                        }
  578|      0|                    }
  579|      0|                    if (j < icr->num_sb_in1_only)
  ------------------
  |  Branch (579:25): [True: 0, False: 0]
  ------------------
  580|      0|                    {
  581|      0|                        continue; /* extra stereobond in Mobile H also */
  582|      0|                    }
  583|      0|                }
  584|      0|            }
  585|       |            /* reject if it is a stereobond in Mobile-H also */
  586|      0|            if (pStereo2InChI && pStereo2InChI->nNumberOfStereoBonds)
  ------------------
  |  Branch (586:17): [True: 0, False: 0]
  |  Branch (586:34): [True: 0, False: 0]
  ------------------
  587|      0|            {
  588|      0|                for (j = 0; j < pStereo2InChI->nNumberOfStereoBonds; j++)
  ------------------
  |  Branch (588:29): [True: 0, False: 0]
  ------------------
  589|      0|                {
  590|      0|                    if (v1 == pStereo2InChI->nBondAtom1[j] &&
  ------------------
  |  Branch (590:25): [True: 0, False: 0]
  ------------------
  591|      0|                         v2 == pStereo2InChI->nBondAtom1[j])
  ------------------
  |  Branch (591:26): [True: 0, False: 0]
  ------------------
  592|      0|                    {
  593|      0|                        break;
  594|      0|                    }
  595|      0|                }
  596|      0|                if (j < pStereo2InChI->nNumberOfStereoBonds)
  ------------------
  |  Branch (596:21): [True: 0, False: 0]
  ------------------
  597|      0|                {
  598|      0|                    continue; /* ignore this extra stereo bond: it is in Mobile-H */
  599|      0|                }
  600|      0|            }
  601|       |            /* find the edge between v1 and v2 */
  602|      0|            for (k = 0; k < at2[v1].valence; k++)
  ------------------
  |  Branch (602:25): [True: 0, False: 0]
  ------------------
  603|      0|            {
  604|      0|                pe = pBNS->edge + ( e = pv1->iedge[k] );
  605|      0|                if (v2 == ( pe->neighbor12 ^ v1 ))
  ------------------
  |  Branch (605:21): [True: 0, False: 0]
  ------------------
  606|      0|                    break; /* the edge has been found */
  607|      0|            }
  608|      0|            if (k == at2[v1].valence)
  ------------------
  |  Branch (608:17): [True: 0, False: 0]
  ------------------
  609|      0|            {
  610|      0|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
  611|      0|                goto exit_function;
  612|      0|            }
  613|       |            /* Fix all charges except negative charges on tautomeric endpoints */
  614|      0|            if (!AllChargeEdges.num_edges && !TautMinusEdges[0].num_edges && !TautMinusEdges[1].num_edges)
  ------------------
  |  Branch (614:17): [True: 0, False: 0]
  |  Branch (614:46): [True: 0, False: 0]
  |  Branch (614:78): [True: 0, False: 0]
  ------------------
  615|      0|            {
  616|      0|                for (j = 0; j < pStruct->num_atoms; j++)
  ------------------
  |  Branch (616:29): [True: 0, False: 0]
  ------------------
  617|      0|                {
  618|      0|                    if (( k = pVA[j].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[k].forbidden)
  ------------------
  |  Branch (618:25): [True: 0, False: 0]
  |  Branch (618:69): [True: 0, False: 0]
  ------------------
  619|      0|                    {
  620|      0|                        if (!pStruct->endpoint[j])
  ------------------
  |  Branch (620:29): [True: 0, False: 0]
  ------------------
  621|      0|                        {
  622|      0|                            if (ret = AddToEdgeList( &AllChargeEdges, k, INC_ADD_EDGE ))
  ------------------
  |  |   48|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (622:33): [True: 0, False: 0]
  ------------------
  623|      0|                            {
  624|      0|                                goto exit_function;
  625|      0|                            }
  626|      0|                        }
  627|      0|                        else
  628|      0|                            if (pVA[j].cNumValenceElectrons == 6)
  ------------------
  |  Branch (628:33): [True: 0, False: 0]
  ------------------
  629|      0|                            {
  630|       |                                /* O */
  631|      0|                                if (ret = AddToEdgeList( TautMinusEdges + 0, k, INC_ADD_EDGE ))
  ------------------
  |  |   48|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (631:37): [True: 0, False: 0]
  ------------------
  632|      0|                                {
  633|      0|                                    goto exit_function;
  634|      0|                                }
  635|      0|                            }
  636|      0|                            else
  637|      0|                            {
  638|       |                                                 /* N */
  639|      0|                                if (ret = AddToEdgeList( TautMinusEdges + 1, k, INC_ADD_EDGE ))
  ------------------
  |  |   48|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (639:37): [True: 0, False: 0]
  ------------------
  640|      0|                                {
  641|      0|                                    goto exit_function;
  642|      0|                                }
  643|      0|                            }
  644|      0|                    }
  645|      0|                    if (( k = pVA[j].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[k].forbidden)
  ------------------
  |  Branch (645:25): [True: 0, False: 0]
  |  Branch (645:68): [True: 0, False: 0]
  ------------------
  646|      0|                    {
  647|      0|                        if (ret = AddToEdgeList( &AllChargeEdges, k, INC_ADD_EDGE ))
  ------------------
  |  |   48|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (647:29): [True: 0, False: 0]
  ------------------
  648|      0|                        {
  649|      0|                            goto exit_function;
  650|      0|                        }
  651|       |                        /* in addition, disallow N(V) creation by forbidding charge flower edge that has flow=1 */
  652|      0|                        if (pVA[j].cNumValenceElectrons == 5 && !pVA[j].cMetal && /* N, P, As */
  ------------------
  |  Branch (652:29): [True: 0, False: 0]
  |  Branch (652:65): [True: 0, False: 0]
  ------------------
  653|      0|                             NO_VERTEX != ( k = GetChargeFlowerUpperEdge( pBNS, pVA, k ) ))
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (653:30): [True: 0, False: 0]
  ------------------
  654|      0|                        {
  655|       |
  656|      0|                            if (!pBNS->edge[j].forbidden && pBNS->edge[k].flow)
  ------------------
  |  Branch (656:33): [True: 0, False: 0]
  |  Branch (656:61): [True: 0, False: 0]
  ------------------
  657|      0|                            {
  658|      0|                                if (ret = AddToEdgeList( &AllChargeEdges, k, INC_ADD_EDGE ))
  ------------------
  |  |   48|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (658:37): [True: 0, False: 0]
  ------------------
  659|      0|                                {
  660|      0|                                    goto exit_function;
  661|      0|                                }
  662|      0|                            }
  663|      0|                        }
  664|      0|                    }
  665|      0|                }
  666|      0|            }
  667|      0|            if (!pe->flow)
  ------------------
  |  Branch (667:17): [True: 0, False: 0]
  ------------------
  668|      0|                continue;
  669|       |            /* fix all charges except tautomeric; first allow only O, then only N, finally both N and O */
  670|      0|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
  671|      0|            for (k = 1, bDone = 0; k < 4 && !bDone; k++)
  ------------------
  |  Branch (671:36): [True: 0, False: 0]
  |  Branch (671:45): [True: 0, False: 0]
  ------------------
  672|      0|            {
  673|       |                /* fix tautomeric charges */
  674|      0|                num_endpoints = ( TautMinusEdges + 0 )->num_edges + ( TautMinusEdges + 1 )->num_edges;
  675|      0|                if (k == 2)
  ------------------
  |  Branch (675:21): [True: 0, False: 0]
  ------------------
  676|      0|                {
  677|       |                    /* fix charges on O */
  678|      0|                    SetForbiddenEdgeMask( pBNS, TautMinusEdges + 0, forbidden_edge_mask );
  679|      0|                    num_endpoints -= ( TautMinusEdges + 0 )->num_edges;
  680|      0|                }
  681|      0|                if (k == 1)
  ------------------
  |  Branch (681:21): [True: 0, False: 0]
  ------------------
  682|      0|                {
  683|      0|                    SetForbiddenEdgeMask( pBNS, TautMinusEdges + 1, forbidden_edge_mask );
  684|      0|                    num_endpoints -= ( TautMinusEdges + 1 )->num_edges;
  685|      0|                }
  686|      0|                if (num_endpoints >= 2)
  ------------------
  |  Branch (686:21): [True: 0, False: 0]
  ------------------
  687|      0|                {
  688|      0|                    delta = 1;
  689|      0|                    pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
  690|      0|                    pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
  691|       |
  692|      0|                    pe->forbidden |= forbidden_edge_mask; /* fix stereobond */
  693|      0|                    pe->flow -= delta;                    /* decrement stereobond order */
  694|      0|                    pv1->st_edge.flow -= delta;
  695|      0|                    pv2->st_edge.flow -= delta;
  696|      0|                    pBNS->tot_st_flow -= 2 * delta;
  697|       |
  698|      0|                    ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
  699|      0|                                          &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
  700|       |
  701|      0|                    if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (701:25): [True: 0, False: 0]
  |  Branch (701:39): [True: 0, False: 0]
  |  Branch (701:57): [True: 0, False: 0]
  ------------------
  702|      0|                        vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == 0)
  ------------------
  |  Branch (702:25): [True: 0, False: 0]
  |  Branch (702:43): [True: 0, False: 0]
  |  Branch (702:65): [True: 0, False: 0]
  ------------------
  703|      0|                    {
  704|       |                        /* Negative charge has been moved, no change in number of charges */
  705|      0|                        ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
  706|      0|                        if (ret > 0)
  ------------------
  |  Branch (706:29): [True: 0, False: 0]
  ------------------
  707|      0|                        {
  708|      0|                            ( *pnNumRunBNS )++;
  709|      0|                            cur_success++; /* 01 */
  710|      0|                            bDone = 1;
  711|      0|                        }
  712|      0|                    }
  713|      0|                    else
  714|      0|                    {
  715|      0|                        pe->forbidden &= ~forbidden_edge_mask;
  716|      0|                        pe->flow += delta;
  717|      0|                        pv1->st_edge.flow += delta;
  718|      0|                        pv2->st_edge.flow += delta;
  719|      0|                        pBNS->tot_st_flow += 2 * delta;
  720|      0|                    }
  721|      0|                }
  722|       |                /* unfix tautomeric charges */
  723|      0|                if (k == 2)
  ------------------
  |  Branch (723:21): [True: 0, False: 0]
  ------------------
  724|      0|                    RemoveForbiddenEdgeMask( pBNS, TautMinusEdges + 0, forbidden_edge_mask );
  725|      0|                if (k == 1)
  ------------------
  |  Branch (725:21): [True: 0, False: 0]
  ------------------
  726|      0|                    RemoveForbiddenEdgeMask( pBNS, TautMinusEdges + 1, forbidden_edge_mask );
  727|      0|            }
  728|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
  729|      0|        }
  730|       |/*exit_case_03:*/
  731|      0|        if (cur_success)
  ------------------
  |  Branch (731:13): [True: 0, False: 0]
  ------------------
  732|      0|        {
  733|      0|            tot_succes += cur_success;
  734|       |            /* recalculate InChI from the structure */
  735|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (735:17): [True: 0, False: 0]
  ------------------
  736|      0|                ppt_group_info, ppat_norm, ppat_prep ) ))
  737|      0|            {
  738|      0|                goto exit_function;
  739|      0|            }
  740|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (740:17): [True: 0, False: 0]
  ------------------
  741|      0|            {
  742|      0|                goto exit_function;
  743|      0|            }
  744|       |            /*
  745|       |            if ( ret = FillOutCMP2MHINCHI( pStruct, pTCGroups, at2, pVA, pInChI, pc2i ) ) {
  746|       |                goto exit_function;
  747|       |            }
  748|       |            */
  749|      0|            cmpInChI = CompareReversedINChI2( pStruct->pOneINChI[0], pInChI[0], pStruct->pOneINChI_Aux[0], NULL /*INChI_Aux *v2*/, icr, &err );
  750|      0|            if (cmpInChI & IDIF_PROBLEM)
  ------------------
  |  Branch (750:17): [True: 0, False: 0]
  ------------------
  751|      0|            {
  752|      0|                ret = RI_ERR_PROGR; /* severe restore problem */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  753|      0|                goto exit_function;
  754|      0|            }
  755|      0|            if (err)
  ------------------
  |  Branch (755:17): [True: 0, False: 0]
  ------------------
  756|      0|            {
  757|      0|                ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
  758|      0|                goto exit_function;
  759|      0|            }
  760|      0|            cmpInChI2 = 0;
  761|      0|            memset( icr2, 0, sizeof( *icr2 ) );
  762|      0|            if (iRevrInChI || iOrigInChI)
  ------------------
  |  Branch (762:17): [True: 0, False: 0]
  |  Branch (762:31): [True: 0, False: 0]
  ------------------
  763|      0|            {
  764|       |                /* additional mobile-H compare in case of Fixed-H */
  765|      0|                cmpInChI2 = CompareReversedINChI2( pStruct->pOneINChI[iRevrInChI], pInChI[iOrigInChI], pStruct->pOneINChI_Aux[iRevrInChI], NULL /*INChI_Aux *v2*/, icr2, &err );
  766|      0|                if (cmpInChI & IDIF_PROBLEM)
  ------------------
  |  Branch (766:21): [True: 0, False: 0]
  ------------------
  767|      0|                {
  768|      0|                    ret = RI_ERR_PROGR; /* severe restore problem */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  769|      0|                    goto exit_function;
  770|      0|                }
  771|      0|                if (err)
  ------------------
  |  Branch (771:21): [True: 0, False: 0]
  ------------------
  772|      0|                {
  773|      0|                    ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
  774|      0|                    goto exit_function;
  775|      0|                }
  776|      0|            }
  777|      0|            pStereoRevrs = ( pStruct->pOneINChI[0]->StereoIsotopic &&
  ------------------
  |  Branch (777:30): [True: 0, False: 0]
  ------------------
  778|      0|                       pStruct->pOneINChI[0]->StereoIsotopic->nNumberOfStereoBonds +
  ------------------
  |  Branch (778:24): [True: 0, False: 0]
  ------------------
  779|      0|                       pStruct->pOneINChI[0]->StereoIsotopic->nNumberOfStereoCenters )
  780|      0|                ? pStruct->pOneINChI[0]->StereoIsotopic
  781|      0|                : pStruct->pOneINChI[0]->Stereo;
  782|       |
  783|       |
  784|      0|            pStereo2Revrs = ( pStruct->bMobileH == TAUT_YES || !pStruct->pOneINChI[1] ||
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (784:31): [True: 0, False: 0]
  |  Branch (784:64): [True: 0, False: 0]
  ------------------
  785|      0|                       !pStruct->pOneINChI[1]->nNumberOfAtoms || pStruct->pOneINChI[1]->bDeleted )
  ------------------
  |  Branch (785:24): [True: 0, False: 0]
  |  Branch (785:66): [True: 0, False: 0]
  ------------------
  786|      0|                ? NULL
  787|      0|                : ( pStruct->pOneINChI[1]->StereoIsotopic &&
  ------------------
  |  Branch (787:21): [True: 0, False: 0]
  ------------------
  788|      0|                    pStruct->pOneINChI[1]->StereoIsotopic->nNumberOfStereoBonds +
  ------------------
  |  Branch (788:21): [True: 0, False: 0]
  ------------------
  789|      0|                    pStruct->pOneINChI[1]->StereoIsotopic->nNumberOfStereoCenters ) ?
  790|      0|                    pStruct->pOneINChI[1]->StereoIsotopic :
  791|      0|                    pStruct->pOneINChI[1]->Stereo;
  792|      0|        }
  793|      0|    }
  794|       |
  795|      0|    cur_success = 0;
  796|      0|    if (( cmpInChI & IDIF_SB_EXTRA_UNDF ))
  ------------------
  |  Branch (796:9): [True: 0, False: 0]
  ------------------
  797|      0|    {
  798|       |        /*------------------------------------------------------*/
  799|       |        /* case 04: extra stereogenic bond                      */
  800|       |        /* Since this bond parity is not known, it is UNDEFINED */
  801|       |        /*------------------------------------------------------*/
  802|      0|        int bDone, num_endpoints;
  803|       |
  804|      0|        TautMinusEdges[0].num_edges = 0;
  805|      0|        TautMinusEdges[1].num_edges = 0;
  806|      0|        AllChargeEdges.num_edges = 0;
  807|       |        /* in1 => in restored structure; in2 => in original InChI */
  808|      0|        for (i = 0; i < icr->num_sb_undef_in1_only; i++)
  ------------------
  |  Branch (808:21): [True: 0, False: 0]
  ------------------
  809|      0|        {
  810|      0|            j12 = icr->sb_undef_in1_only[i];
  811|      0|            pv1 = pBNS->vert + ( v1 = pStereoRevrs->nBondAtom1[j12] - 1 );
  812|      0|            pv2 = pBNS->vert + ( v2 = pStereoRevrs->nBondAtom2[j12] - 1 );
  813|       |
  814|       |            /* find the edge between v1 and v2 */
  815|      0|            for (k = 0; k < at2[v1].valence; k++)
  ------------------
  |  Branch (815:25): [True: 0, False: 0]
  ------------------
  816|      0|            {
  817|      0|                pe = pBNS->edge + ( e = pv1->iedge[k] );
  818|      0|                if (v2 == ( pe->neighbor12 ^ v1 ))
  ------------------
  |  Branch (818:21): [True: 0, False: 0]
  ------------------
  819|      0|                    break; /* the edge has been found */
  820|      0|            }
  821|      0|            if (k == at2[v1].valence)
  ------------------
  |  Branch (821:17): [True: 0, False: 0]
  ------------------
  822|      0|            {
  823|      0|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
  824|      0|                goto exit_function;
  825|      0|            }
  826|      0|            if (pStereo2Revrs)
  ------------------
  |  Branch (826:17): [True: 0, False: 0]
  ------------------
  827|      0|            {
  828|       |                /* reject if it is not extra in Mobile-H also */
  829|      0|                if (icr2->num_sb_undef_in1_only)
  ------------------
  |  Branch (829:21): [True: 0, False: 0]
  ------------------
  830|      0|                {
  831|      0|                    for (j = 0; j < icr2->num_sb_undef_in1_only; j++)
  ------------------
  |  Branch (831:33): [True: 0, False: 0]
  ------------------
  832|      0|                    {
  833|      0|                        k = icr2->sb_undef_in1_only[j];
  834|      0|                        if (v1 == pStereo2Revrs->nBondAtom1[k] &&
  ------------------
  |  Branch (834:29): [True: 0, False: 0]
  ------------------
  835|      0|                             v2 == pStereo2Revrs->nBondAtom2[k])
  ------------------
  |  Branch (835:30): [True: 0, False: 0]
  ------------------
  836|      0|                        {
  837|      0|                            break;
  838|      0|                        }
  839|      0|                    }
  840|      0|                    if (j == icr->num_sb_in1_only)
  ------------------
  |  Branch (840:25): [True: 0, False: 0]
  ------------------
  841|      0|                    {
  842|      0|                        continue; /* extra stereobond only in Fixed-H, not in Mobile H also */
  843|      0|                    }
  844|      0|                }
  845|      0|            }
  846|       |
  847|       |            /* Fix all charges except negative charges on tautomeric endpoints */
  848|      0|            if (!AllChargeEdges.num_edges && !TautMinusEdges[0].num_edges && !TautMinusEdges[1].num_edges)
  ------------------
  |  Branch (848:17): [True: 0, False: 0]
  |  Branch (848:46): [True: 0, False: 0]
  |  Branch (848:78): [True: 0, False: 0]
  ------------------
  849|      0|            {
  850|      0|                for (j = 0; j < pStruct->num_atoms; j++)
  ------------------
  |  Branch (850:29): [True: 0, False: 0]
  ------------------
  851|      0|                {
  852|      0|                    if (( k = pVA[j].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[k].forbidden)
  ------------------
  |  Branch (852:25): [True: 0, False: 0]
  |  Branch (852:69): [True: 0, False: 0]
  ------------------
  853|      0|                    {
  854|      0|                        if (ret = AddToEdgeList( &AllChargeEdges, k, INC_ADD_EDGE ))
  ------------------
  |  |   48|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (854:29): [True: 0, False: 0]
  ------------------
  855|      0|                        {
  856|      0|                            goto exit_function;
  857|      0|                        }
  858|      0|                    }
  859|      0|                    if (( k = pVA[j].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[k].forbidden)
  ------------------
  |  Branch (859:25): [True: 0, False: 0]
  |  Branch (859:68): [True: 0, False: 0]
  ------------------
  860|      0|                    {
  861|      0|                        int bMayBeUnfixed = !at2[j].num_H && !( pStruct->endpoint && pStruct->endpoint[j] );
  ------------------
  |  Branch (861:45): [True: 0, False: 0]
  |  Branch (861:65): [True: 0, False: 0]
  |  Branch (861:86): [True: 0, False: 0]
  ------------------
  862|      0|                        if (bMayBeUnfixed && pVA[j].cNumValenceElectrons == 6 ||
  ------------------
  |  Branch (862:29): [True: 0, False: 0]
  |  Branch (862:46): [True: 0, False: 0]
  ------------------
  863|      0|                             pVA[j].cNumValenceElectrons == 5 && pVA[j].cPeriodicRowNumber > 1)
  ------------------
  |  Branch (863:30): [True: 0, False: 0]
  |  Branch (863:66): [True: 0, False: 0]
  ------------------
  864|      0|                        {
  865|       |                            /* O & P */
  866|      0|                            if (ret = AddToEdgeList( TautMinusEdges + 0, k, INC_ADD_EDGE ))
  ------------------
  |  |   48|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (866:33): [True: 0, False: 0]
  ------------------
  867|      0|                            {
  868|      0|                                goto exit_function;
  869|      0|                            }
  870|      0|                        }
  871|      0|                        else
  872|      0|                        {
  873|      0|                            if (bMayBeUnfixed &&
  ------------------
  |  Branch (873:33): [True: 0, False: 0]
  ------------------
  874|      0|                                    pVA[j].cNumValenceElectrons == 5 && pVA[j].cPeriodicRowNumber == 1)
  ------------------
  |  Branch (874:37): [True: 0, False: 0]
  |  Branch (874:73): [True: 0, False: 0]
  ------------------
  875|      0|                            {
  876|       |                                /* N */
  877|      0|                                if (ret = AddToEdgeList( TautMinusEdges + 1, k, INC_ADD_EDGE ))
  ------------------
  |  |   48|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (877:37): [True: 0, False: 0]
  ------------------
  878|      0|                                {
  879|      0|                                    goto exit_function;
  880|      0|                                }
  881|      0|                            }
  882|      0|                            else
  883|      0|                            {
  884|      0|                                if (ret = AddToEdgeList( &AllChargeEdges, k, INC_ADD_EDGE ))
  ------------------
  |  |   48|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (884:37): [True: 0, False: 0]
  ------------------
  885|      0|                                {
  886|      0|                                    goto exit_function;
  887|      0|                                }
  888|      0|                            }
  889|      0|                        }
  890|       |                        /* in addition, disallow N(V) creation by forbidding charge flower edge that has flow=1 */
  891|      0|                        if (pVA[j].cNumValenceElectrons == 5 && !pVA[j].cMetal && /* N, P, As */
  ------------------
  |  Branch (891:29): [True: 0, False: 0]
  |  Branch (891:65): [True: 0, False: 0]
  ------------------
  892|      0|                             NO_VERTEX != ( k = GetChargeFlowerUpperEdge( pBNS, pVA, k ) ))
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (892:30): [True: 0, False: 0]
  ------------------
  893|      0|                        {
  894|      0|                            if (!pBNS->edge[j].forbidden && pBNS->edge[k].flow)
  ------------------
  |  Branch (894:33): [True: 0, False: 0]
  |  Branch (894:61): [True: 0, False: 0]
  ------------------
  895|      0|                            {
  896|      0|                                if (ret = AddToEdgeList( &AllChargeEdges, k, INC_ADD_EDGE ))
  ------------------
  |  |   48|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (896:37): [True: 0, False: 0]
  ------------------
  897|      0|                                {
  898|      0|                                    goto exit_function;
  899|      0|                                }
  900|      0|                            }
  901|      0|                        }
  902|      0|                    }
  903|      0|                }
  904|      0|            }
  905|      0|            if (!pe->flow)
  ------------------
  |  Branch (905:17): [True: 0, False: 0]
  ------------------
  906|      0|                continue;
  907|       |            /* fix all charges except tautomeric; first allow only O, then only N, finally both N and O */
  908|      0|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
  909|      0|            for (k = 1, bDone = 0; k < 4 && !bDone; k++)
  ------------------
  |  Branch (909:36): [True: 0, False: 0]
  |  Branch (909:45): [True: 0, False: 0]
  ------------------
  910|      0|            {
  911|       |                /* fix positive charges on heteroatoms */
  912|      0|                num_endpoints = ( TautMinusEdges + 0 )->num_edges + ( TautMinusEdges + 1 )->num_edges;
  913|      0|                if (k == 2)
  ------------------
  |  Branch (913:21): [True: 0, False: 0]
  ------------------
  914|      0|                {
  915|       |                    /* fix charges on O */
  916|      0|                    SetForbiddenEdgeMask( pBNS, TautMinusEdges + 0, forbidden_edge_mask );
  917|      0|                    num_endpoints -= ( TautMinusEdges + 0 )->num_edges;
  918|      0|                }
  919|      0|                if (k == 1)
  ------------------
  |  Branch (919:21): [True: 0, False: 0]
  ------------------
  920|      0|                {
  921|       |                    /* fix charges on N */
  922|      0|                    SetForbiddenEdgeMask( pBNS, TautMinusEdges + 1, forbidden_edge_mask );
  923|      0|                    num_endpoints -= ( TautMinusEdges + 1 )->num_edges;
  924|      0|                }
  925|      0|                if (num_endpoints >= 2)
  ------------------
  |  Branch (925:21): [True: 0, False: 0]
  ------------------
  926|      0|                {
  927|      0|                    delta = 1;
  928|      0|                    pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
  929|      0|                    pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
  930|       |
  931|      0|                    pe->forbidden |= forbidden_edge_mask; /* fix stereobond */
  932|      0|                    pe->flow -= delta;                    /* decrement stereobond order */
  933|      0|                    pv1->st_edge.flow -= delta;
  934|      0|                    pv2->st_edge.flow -= delta;
  935|      0|                    pBNS->tot_st_flow -= 2 * delta;
  936|       |
  937|      0|                    ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
  938|      0|                                          &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
  939|       |
  940|      0|                    if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (940:25): [True: 0, False: 0]
  |  Branch (940:39): [True: 0, False: 0]
  |  Branch (940:57): [True: 0, False: 0]
  ------------------
  941|      0|                        vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == 0)
  ------------------
  |  Branch (941:25): [True: 0, False: 0]
  |  Branch (941:43): [True: 0, False: 0]
  |  Branch (941:65): [True: 0, False: 0]
  ------------------
  942|      0|                    {
  943|       |                        /* Negative charge has been moved, no change in number of charges */
  944|      0|                        ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
  945|      0|                        if (ret > 0)
  ------------------
  |  Branch (945:29): [True: 0, False: 0]
  ------------------
  946|      0|                        {
  947|      0|                            ( *pnNumRunBNS )++;
  948|      0|                            cur_success++; /* 01 */
  949|      0|                            bDone = 1;
  950|      0|                        }
  951|      0|                    }
  952|      0|                    else
  953|      0|                    {
  954|      0|                        pe->forbidden &= ~forbidden_edge_mask;
  955|      0|                        pe->flow += delta;
  956|      0|                        pv1->st_edge.flow += delta;
  957|      0|                        pv2->st_edge.flow += delta;
  958|      0|                        pBNS->tot_st_flow += 2 * delta;
  959|      0|                    }
  960|      0|                }
  961|       |                /* unfix tautomeric charges */
  962|      0|                if (k == 2)
  ------------------
  |  Branch (962:21): [True: 0, False: 0]
  ------------------
  963|      0|                    RemoveForbiddenEdgeMask( pBNS, TautMinusEdges + 0, forbidden_edge_mask );
  964|      0|                if (k == 1)
  ------------------
  |  Branch (964:21): [True: 0, False: 0]
  ------------------
  965|      0|                    RemoveForbiddenEdgeMask( pBNS, TautMinusEdges + 1, forbidden_edge_mask );
  966|      0|            }
  967|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );
  968|      0|        }
  969|       |/*exit_case_04:*/
  970|      0|        if (cur_success)
  ------------------
  |  Branch (970:13): [True: 0, False: 0]
  ------------------
  971|      0|        {
  972|      0|            tot_succes += cur_success;
  973|       |            /* recalculate InChI from the structure */
  974|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (974:17): [True: 0, False: 0]
  ------------------
  975|      0|                ppt_group_info, ppat_norm, ppat_prep ) ))
  976|      0|            {
  977|      0|                goto exit_function;
  978|      0|            }
  979|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (979:17): [True: 0, False: 0]
  ------------------
  980|      0|            {
  981|      0|                goto exit_function;
  982|      0|            }
  983|       |            /*
  984|       |            if ( ret = FillOutCMP2MHINCHI( pStruct, pTCGroups, at2, pVA, pInChI, pc2i ) ) {
  985|       |                goto exit_function;
  986|       |            }
  987|       |            */
  988|      0|            cmpInChI = CompareReversedINChI2( pStruct->pOneINChI[0], pInChI[0], pStruct->pOneINChI_Aux[0], NULL /*INChI_Aux *v2*/, icr, &err );
  989|      0|            if (cmpInChI & IDIF_PROBLEM)
  ------------------
  |  Branch (989:17): [True: 0, False: 0]
  ------------------
  990|      0|            {
  991|      0|                ret = RI_ERR_PROGR; /* severe restore problem */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
  992|      0|                goto exit_function;
  993|      0|            }
  994|      0|            if (err)
  ------------------
  |  Branch (994:17): [True: 0, False: 0]
  ------------------
  995|      0|            {
  996|      0|                ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
  997|      0|                goto exit_function;
  998|      0|            }
  999|      0|            cmpInChI2 = 0;
 1000|      0|            memset( icr2, 0, sizeof( *icr2 ) );
 1001|      0|            if (iRevrInChI || iOrigInChI)
  ------------------
  |  Branch (1001:17): [True: 0, False: 0]
  |  Branch (1001:31): [True: 0, False: 0]
  ------------------
 1002|      0|            {
 1003|       |/* additional mobile-H compare in case of Fixed-H */
 1004|      0|                cmpInChI2 = CompareReversedINChI2( pStruct->pOneINChI[iRevrInChI], pInChI[iOrigInChI], pStruct->pOneINChI_Aux[iRevrInChI], NULL /*INChI_Aux *v2*/, icr2, &err );
 1005|      0|                if (cmpInChI & IDIF_PROBLEM)
  ------------------
  |  Branch (1005:21): [True: 0, False: 0]
  ------------------
 1006|      0|                {
 1007|      0|                    ret = RI_ERR_PROGR; /* severe restore problem */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1008|      0|                    goto exit_function;
 1009|      0|                }
 1010|      0|                if (err)
  ------------------
  |  Branch (1010:21): [True: 0, False: 0]
  ------------------
 1011|      0|                {
 1012|      0|                    ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 1013|      0|                    goto exit_function;
 1014|      0|                }
 1015|      0|            }
 1016|      0|            pStereoRevrs = ( pStruct->pOneINChI[0]->StereoIsotopic &&
  ------------------
  |  Branch (1016:30): [True: 0, False: 0]
  ------------------
 1017|      0|                       pStruct->pOneINChI[0]->StereoIsotopic->nNumberOfStereoBonds +
  ------------------
  |  Branch (1017:24): [True: 0, False: 0]
  ------------------
 1018|      0|                       pStruct->pOneINChI[0]->StereoIsotopic->nNumberOfStereoCenters )
 1019|      0|                ? pStruct->pOneINChI[0]->StereoIsotopic
 1020|      0|                : pStruct->pOneINChI[0]->Stereo;
 1021|       |
 1022|       |
 1023|      0|            pStereo2Revrs = ( pStruct->bMobileH == TAUT_YES || !pStruct->pOneINChI[1] ||
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1023:31): [True: 0, False: 0]
  |  Branch (1023:64): [True: 0, False: 0]
  ------------------
 1024|      0|                       !pStruct->pOneINChI[1]->nNumberOfAtoms || pStruct->pOneINChI[1]->bDeleted )
  ------------------
  |  Branch (1024:24): [True: 0, False: 0]
  |  Branch (1024:66): [True: 0, False: 0]
  ------------------
 1025|      0|                ? NULL
 1026|      0|                : ( pStruct->pOneINChI[1]->StereoIsotopic &&
  ------------------
  |  Branch (1026:21): [True: 0, False: 0]
  ------------------
 1027|      0|                    pStruct->pOneINChI[1]->StereoIsotopic->nNumberOfStereoBonds +
  ------------------
  |  Branch (1027:21): [True: 0, False: 0]
  ------------------
 1028|      0|                    pStruct->pOneINChI[1]->StereoIsotopic->nNumberOfStereoCenters ) ?
 1029|      0|                    pStruct->pOneINChI[1]->StereoIsotopic :
 1030|      0|                    pStruct->pOneINChI[1]->Stereo;
 1031|      0|        }
 1032|      0|    }
 1033|       |
 1034|      0|    cur_success = 0;
 1035|      0|    if (pStruct->bMobileH == TAUT_YES &&
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1035:9): [True: 0, False: 0]
  ------------------
 1036|      0|        ( cmpInChI & IDIF_SB_EXTRA_UNDF &&
  ------------------
  |  Branch (1036:11): [True: 0, False: 0]
  ------------------
 1037|      0|            !pStruct->ti.num_t_groups )
  ------------------
  |  Branch (1037:13): [True: 0, False: 0]
  ------------------
 1038|      0|         /*pStruct->bMobileH == TAUT_NON && (cmpInChI2 & IDIF_SB_EXTRA_UNDF)*/)
 1039|      0|    {
 1040|       |        /*----------------------------------------------------------*/
 1041|       |        /* case 05: extra stereogenic bond on =NH2(+), (B, Mobile-H)*/
 1042|       |        /*                   H             H                        */
 1043|       |        /* original: N(+)=-N<   ->  N--==N/                         */
 1044|       |        /* (A)               H                                      */
 1045|       |        /*                             double bond is marked as     */
 1046|       |        /*                             not stereogenic due to       */
 1047|       |        /*                             its change during proton     */
 1048|       |        /*                             removal => No Stereo bond    */
 1049|       |        /*                             (=NH may be tautomeric)      */
 1050|       |        /*                                                          */
 1051|       |        /*                   H             H                        */
 1052|       |        /* original: N=-N(+)<   ->  N--==N/                         */
 1053|       |        /* (B)               H                                      */
 1054|       |        /*                             double bond was not          */
 1055|       |        /*                             changed during proton        */
 1056|       |        /* In Fixed-H this bond        removal => Undef Stereo      */
 1057|       |        /* may not be stereogenic      (=NH is not tautomeric)      */
 1058|       |        /* (a) due to (+) movement                                  */
 1059|       |        /* (b) due to symmetry (2H), even if isotopic               */
 1060|       |        /*                                                          */
 1061|       |        /* Fixed-H: move (+) to or from NH2 for Undef or No stereo  */
 1062|       |        /*          respectively                                    */
 1063|       |        /* Mobile-H: Add H(+) to =NH and move the charge to =N-     */
 1064|       |        /*           to eliminate Undef stereo                      */
 1065|       |        /*          Move charge from N to -NH2 to create            */
 1066|       |        /*           Undef Stereo                                   */
 1067|       |        /* Since this bond parity is not known, it is UNDEFINED     */
 1068|       |        /*                                                          */
 1069|       |        /* Solution: Add H(+) to =NH and move charge to -N=         */
 1070|       |        /*                                                          */
 1071|       |        /*----------------------------------------------------------*/
 1072|      0|        int aN, aC, i1, i2, vPlusMinus;
 1073|      0|        AllChargeEdges.num_edges = 0;
 1074|       |        /* in1 => in restored structure; in2 => in original InChI */
 1075|      0|        for (i = 0; i < icr->num_sb_undef_in1_only; i++)
  ------------------
  |  Branch (1075:21): [True: 0, False: 0]
  ------------------
 1076|      0|        {
 1077|      0|            j12 = icr->sb_undef_in1_only[i];
 1078|      0|            pv1 = pBNS->vert + ( v1 = pStereoRevrs->nBondAtom1[j12] - 1 );
 1079|      0|            pv2 = pBNS->vert + ( v2 = pStereoRevrs->nBondAtom2[j12] - 1 );
 1080|       |            /* indicators of -NH: */
 1081|      0|            i1 = at2[v1].valence == 1 && at2[v1].num_H == 1 && !at2[v1].endpoint &&
  ------------------
  |  Branch (1081:18): [True: 0, False: 0]
  |  Branch (1081:42): [True: 0, False: 0]
  |  Branch (1081:64): [True: 0, False: 0]
  ------------------
 1082|      0|                pVA[v1].cNumValenceElectrons == 5 && pVA[v1].cPeriodicRowNumber == 1;
  ------------------
  |  Branch (1082:17): [True: 0, False: 0]
  |  Branch (1082:54): [True: 0, False: 0]
  ------------------
 1083|      0|            i2 = at2[v2].valence == 1 && at2[v2].num_H == 1 && !at2[v2].endpoint &&
  ------------------
  |  Branch (1083:18): [True: 0, False: 0]
  |  Branch (1083:42): [True: 0, False: 0]
  |  Branch (1083:64): [True: 0, False: 0]
  ------------------
 1084|      0|                pVA[v2].cNumValenceElectrons == 5 && pVA[v2].cPeriodicRowNumber == 1;
  ------------------
  |  Branch (1084:17): [True: 0, False: 0]
  |  Branch (1084:54): [True: 0, False: 0]
  ------------------
 1085|      0|            if (!i1 && !i2 || i1 && i2)
  ------------------
  |  Branch (1085:17): [True: 0, False: 0]
  |  Branch (1085:24): [True: 0, False: 0]
  |  Branch (1085:31): [True: 0, False: 0]
  |  Branch (1085:37): [True: 0, False: 0]
  ------------------
 1086|      0|            {
 1087|      0|                continue;
 1088|      0|            }
 1089|       |            /* find the edge between v1 and v2 */
 1090|      0|            for (k = 0; k < at2[v1].valence; k++)
  ------------------
  |  Branch (1090:25): [True: 0, False: 0]
  ------------------
 1091|      0|            {
 1092|      0|                pe = pBNS->edge + ( e = pv1->iedge[k] );
 1093|      0|                if (v2 == ( pe->neighbor12 ^ v1 ))
  ------------------
  |  Branch (1093:21): [True: 0, False: 0]
  ------------------
 1094|      0|                {
 1095|      0|                    break; /* the edge has been found */
 1096|      0|                }
 1097|      0|            }
 1098|      0|            if (k == at2[v1].valence)
  ------------------
  |  Branch (1098:17): [True: 0, False: 0]
  ------------------
 1099|      0|            {
 1100|      0|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 1101|      0|                goto exit_function;
 1102|      0|            }
 1103|      0|            if (pe->flow != 1)
  ------------------
  |  Branch (1103:17): [True: 0, False: 0]
  ------------------
 1104|      0|            {
 1105|      0|                continue; /* already charged */
 1106|      0|            }
 1107|      0|            aN = i1 ? v1 : v2; /* -NH atom */
  ------------------
  |  Branch (1107:18): [True: 0, False: 0]
  ------------------
 1108|      0|            aC = i1 ? v2 : v1; /* neighbor */
  ------------------
  |  Branch (1108:18): [True: 0, False: 0]
  ------------------
 1109|       |            /* Replace =NH with -NH2
 1110|       |               Create such a charge on some -N< that may be moved to NH2 to remove H(+):
 1111|       |               transformation:
 1112|       |               from:  HN=C-=-N=(+vert)-Y=(+super)-(+/-)
 1113|       |               to:   2HN-C*-=-N=(+vert)-Y=(+super)-(+/-)*
 1114|       |               Run BNS to obtain:
 1115|       |                     2HN-C=-=N(+)-(+vert)=Y-(+super)=(+/-)
 1116|       |            */
 1117|      0|            vPlusMinus = GetPlusMinusVertex( pBNS, pTCGroups, 1, 0 );
 1118|      0|            if (NO_VERTEX == vPlusMinus)
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (1118:17): [True: 0, False: 0]
  ------------------
 1119|      0|            {
 1120|      0|                break; /* cannot do anything */
 1121|      0|            }
 1122|       |            /* increase edges to -Y-(+/-)-Y- capacities */
 1123|      0|            delta = 1;
 1124|      0|            for (i1 = 0; i1 < pBNS->vert[vPlusMinus].num_adj_edges; i1++)
  ------------------
  |  Branch (1124:26): [True: 0, False: 0]
  ------------------
 1125|      0|            {
 1126|      0|                i2 = pBNS->edge[pBNS->vert[vPlusMinus].iedge[i1]].neighbor12 ^ vPlusMinus;
 1127|      0|                for (k = 0; k < pBNS->vert[i2].num_adj_edges; k++)
  ------------------
  |  Branch (1127:29): [True: 0, False: 0]
  ------------------
 1128|      0|                {
 1129|      0|                    pBNS->edge[pBNS->vert[i2].iedge[k]].cap += delta;
 1130|      0|                }
 1131|      0|            }
 1132|       |            /* Fix all charges except (+) on -N< */
 1133|      0|            if (!AllChargeEdges.num_edges)
  ------------------
  |  Branch (1133:17): [True: 0, False: 0]
  ------------------
 1134|      0|            {
 1135|      0|                for (j = 0; j < pStruct->num_atoms; j++)
  ------------------
  |  Branch (1135:29): [True: 0, False: 0]
  ------------------
 1136|      0|                {
 1137|      0|                    if (( k = pVA[j].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[k].forbidden)
  ------------------
  |  Branch (1137:25): [True: 0, False: 0]
  |  Branch (1137:69): [True: 0, False: 0]
  ------------------
 1138|      0|                    {
 1139|      0|                        if (ret = AddToEdgeList( &AllChargeEdges, k, INC_ADD_EDGE ))
  ------------------
  |  |   48|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1139:29): [True: 0, False: 0]
  ------------------
 1140|      0|                        {
 1141|      0|                            goto exit_function;
 1142|      0|                        }
 1143|      0|                    }
 1144|      0|                    if (( k = pVA[j].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[k].forbidden)
  ------------------
  |  Branch (1144:25): [True: 0, False: 0]
  |  Branch (1144:68): [True: 0, False: 0]
  ------------------
 1145|      0|                    {
 1146|      0|                        if (pVA[j].cNumValenceElectrons == 5 && pVA[j].cPeriodicRowNumber == 1 &&
  ------------------
  |  Branch (1146:29): [True: 0, False: 0]
  |  Branch (1146:65): [True: 0, False: 0]
  ------------------
 1147|      0|                             !at2[j].num_H && at2[j].valence == 3 &&
  ------------------
  |  Branch (1147:30): [True: 0, False: 0]
  |  Branch (1147:47): [True: 0, False: 0]
  ------------------
 1148|      0|                             !( at2[j].endpoint || pStruct->endpoint && pStruct->endpoint[j] ))
  ------------------
  |  Branch (1148:33): [True: 0, False: 0]
  |  Branch (1148:52): [True: 0, False: 0]
  |  Branch (1148:73): [True: 0, False: 0]
  ------------------
 1149|      0|                        {
 1150|      0|                            ; /* do not fix -N< or =N(+)< */
 1151|      0|                        }
 1152|      0|                        else
 1153|      0|                        {
 1154|       |                                             /* all others */
 1155|      0|                            if (ret = AddToEdgeList( TautMinusEdges + 0, k, INC_ADD_EDGE ))
  ------------------
  |  |   48|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1155:33): [True: 0, False: 0]
  ------------------
 1156|      0|                            {
 1157|      0|                                goto exit_function;
 1158|      0|                            }
 1159|      0|                        }
 1160|       |                        /* in addition, disallow N(V) creation by forbidding charge flower edge that has flow=1 */
 1161|      0|                        if (pVA[j].cNumValenceElectrons == 5 && !pVA[j].cMetal && /* N, P, As */
  ------------------
  |  Branch (1161:29): [True: 0, False: 0]
  |  Branch (1161:65): [True: 0, False: 0]
  ------------------
 1162|      0|                             NO_VERTEX != ( k = GetChargeFlowerUpperEdge( pBNS, pVA, k ) ))
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (1162:30): [True: 0, False: 0]
  ------------------
 1163|      0|                        {
 1164|      0|                            if (!pBNS->edge[j].forbidden && pBNS->edge[k].flow)
  ------------------
  |  Branch (1164:33): [True: 0, False: 0]
  |  Branch (1164:61): [True: 0, False: 0]
  ------------------
 1165|      0|                            {
 1166|      0|                                if (ret = AddToEdgeList( &AllChargeEdges, k, INC_ADD_EDGE ))
  ------------------
  |  |   48|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1166:37): [True: 0, False: 0]
  ------------------
 1167|      0|                                {
 1168|      0|                                    goto exit_function;
 1169|      0|                                }
 1170|      0|                            }
 1171|      0|                        }
 1172|      0|                    }
 1173|      0|                }
 1174|      0|            }
 1175|       |            /* Make bond to =NH single, add radical to aC */
 1176|      0|            pe->flow -= delta; /* make single bond */
 1177|      0|            pBNS->vert[aN].st_edge.flow -= delta;
 1178|      0|            pBNS->vert[aN].st_edge.cap -= delta; /* avoid radical on N */
 1179|      0|            pBNS->vert[aC].st_edge.flow -= delta; /* create radical on C */
 1180|      0|            pBNS->vert[vPlusMinus].st_edge.cap += delta; /* create radical on (+/-) */
 1181|      0|            pBNS->tot_st_flow -= 2 * delta;
 1182|       |            /* fix C-NH bond */
 1183|      0|            if (ret = AddToEdgeList( &AllChargeEdges, e, INC_ADD_EDGE ))
  ------------------
  |  |   48|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1183:17): [True: 0, False: 0]
  ------------------
 1184|      0|            {
 1185|      0|                goto exit_function;
 1186|      0|            }
 1187|       |            /* pBNS->tot_st_cap is unchanged */
 1188|       |            /* find all aC edges except pe to fix them */
 1189|       |            /* 2. Check whether it would work and do if it would */
 1190|      0|            SetForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );/* fix aC edges */
 1191|      0|            pe->cap++;
 1192|      0|            ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 1193|      0|                                  &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 1194|       |
 1195|      0|            if (ret == 1 && ( vPathEnd == vPlusMinus && vPathStart == aC ||
  ------------------
  |  Branch (1195:17): [True: 0, False: 0]
  |  Branch (1195:31): [True: 0, False: 0]
  |  Branch (1195:57): [True: 0, False: 0]
  ------------------
 1196|      0|                vPathEnd == aC && vPathStart == vPlusMinus ) && nDeltaCharge == 1)
  ------------------
  |  Branch (1196:17): [True: 0, False: 0]
  |  Branch (1196:35): [True: 0, False: 0]
  |  Branch (1196:65): [True: 0, False: 0]
  ------------------
 1197|      0|            {
 1198|       |                /* Negative charge has been moved, no change in number of charges */
 1199|      0|                ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 1200|      0|                if (ret > 0)
  ------------------
  |  Branch (1200:21): [True: 0, False: 0]
  ------------------
 1201|      0|                {
 1202|      0|                    ( *pnNumRunBNS )++;
 1203|       |                    /* 3. Add  H to -NH and register increaded charge */
 1204|      0|                    pStruct->at[aN].num_H++;
 1205|      0|                    pTCGroups->total_charge++;
 1206|      0|                    cur_success++; /* 01 */
 1207|      0|                }
 1208|      0|            }
 1209|      0|            else
 1210|      0|            {
 1211|      0|                pe->flow += delta; /* make single bond */
 1212|      0|                pBNS->vert[aN].st_edge.flow += delta;
 1213|      0|                pBNS->vert[aN].st_edge.cap += delta; /* avoid radical on N */
 1214|      0|                pBNS->vert[aC].st_edge.flow += delta; /* create radical on C */
 1215|      0|                pBNS->vert[vPlusMinus].st_edge.cap -= delta; /* create radical on (+/-) */
 1216|      0|                pBNS->tot_st_flow += 2 * delta;
 1217|      0|                RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );/* fix aC edges */
 1218|      0|                AllChargeEdges.num_edges--; /* remove pe from the list */
 1219|      0|                CurrEdges.num_edges = 0;
 1220|      0|                continue; /* should not happen */
 1221|      0|            }
 1222|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );/* fix aC edges */
 1223|      0|            AllChargeEdges.num_edges--; /* remove pe from the list */
 1224|      0|            CurrEdges.num_edges = 0;
 1225|      0|        }
 1226|       |/*exit_case_05:*/
 1227|      0|        if (cur_success)
  ------------------
  |  Branch (1227:13): [True: 0, False: 0]
  ------------------
 1228|      0|        {
 1229|      0|            tot_succes += cur_success;
 1230|       |            /* recalculate InChI from the structure */
 1231|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (1231:17): [True: 0, False: 0]
  ------------------
 1232|      0|                ppt_group_info, ppat_norm, ppat_prep ) ))
 1233|      0|            {
 1234|      0|                goto exit_function;
 1235|      0|            }
 1236|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (1236:17): [True: 0, False: 0]
  ------------------
 1237|      0|            {
 1238|      0|                goto exit_function;
 1239|      0|            }
 1240|       |            /*
 1241|       |            if ( ret = FillOutCMP2MHINCHI( pStruct, pTCGroups, at2, pVA, pInChI, pc2i ) ) {
 1242|       |                goto exit_function;
 1243|       |            }
 1244|       |            */
 1245|      0|            cmpInChI = CompareReversedINChI2( pStruct->pOneINChI[0], pInChI[0], pStruct->pOneINChI_Aux[0], NULL /*INChI_Aux *v2*/, icr, &err );
 1246|      0|            if (cmpInChI & IDIF_PROBLEM)
  ------------------
  |  Branch (1246:17): [True: 0, False: 0]
  ------------------
 1247|      0|            {
 1248|      0|                ret = RI_ERR_PROGR; /* severe restore problem */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1249|      0|                goto exit_function;
 1250|      0|            }
 1251|      0|            if (err)
  ------------------
  |  Branch (1251:17): [True: 0, False: 0]
  ------------------
 1252|      0|            {
 1253|      0|                ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 1254|      0|                goto exit_function;
 1255|      0|            }
 1256|      0|            cmpInChI2 = 0;
 1257|      0|            memset( icr2, 0, sizeof( *icr2 ) );
 1258|      0|            if (iRevrInChI || iOrigInChI)
  ------------------
  |  Branch (1258:17): [True: 0, False: 0]
  |  Branch (1258:31): [True: 0, False: 0]
  ------------------
 1259|      0|            {
 1260|       |                /* additional mobile-H compare in case of Fixed-H */
 1261|      0|                cmpInChI2 = CompareReversedINChI2( pStruct->pOneINChI[iRevrInChI], pInChI[iOrigInChI], pStruct->pOneINChI_Aux[iRevrInChI], NULL /*INChI_Aux *v2*/, icr2, &err );
 1262|      0|                if (cmpInChI & IDIF_PROBLEM)
  ------------------
  |  Branch (1262:21): [True: 0, False: 0]
  ------------------
 1263|      0|                {
 1264|      0|                    ret = RI_ERR_PROGR; /* severe restore problem */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1265|      0|                    goto exit_function;
 1266|      0|                }
 1267|      0|                if (err)
  ------------------
  |  Branch (1267:21): [True: 0, False: 0]
  ------------------
 1268|      0|                {
 1269|      0|                    ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 1270|      0|                    goto exit_function;
 1271|      0|                }
 1272|      0|            }
 1273|      0|            pStereoRevrs = ( pStruct->pOneINChI[0]->StereoIsotopic &&
  ------------------
  |  Branch (1273:30): [True: 0, False: 0]
  ------------------
 1274|      0|                       pStruct->pOneINChI[0]->StereoIsotopic->nNumberOfStereoBonds +
  ------------------
  |  Branch (1274:24): [True: 0, False: 0]
  ------------------
 1275|      0|                       pStruct->pOneINChI[0]->StereoIsotopic->nNumberOfStereoCenters )
 1276|      0|                ? pStruct->pOneINChI[0]->StereoIsotopic
 1277|      0|                : pStruct->pOneINChI[0]->Stereo;
 1278|       |
 1279|       |
 1280|      0|            pStereo2Revrs = ( pStruct->bMobileH == TAUT_YES || !pStruct->pOneINChI[1] ||
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1280:31): [True: 0, False: 0]
  |  Branch (1280:64): [True: 0, False: 0]
  ------------------
 1281|      0|                       !pStruct->pOneINChI[1]->nNumberOfAtoms || pStruct->pOneINChI[1]->bDeleted )
  ------------------
  |  Branch (1281:24): [True: 0, False: 0]
  |  Branch (1281:66): [True: 0, False: 0]
  ------------------
 1282|      0|                ? NULL
 1283|      0|                : ( pStruct->pOneINChI[1]->StereoIsotopic &&
  ------------------
  |  Branch (1283:21): [True: 0, False: 0]
  ------------------
 1284|      0|                    pStruct->pOneINChI[1]->StereoIsotopic->nNumberOfStereoBonds +
  ------------------
  |  Branch (1284:21): [True: 0, False: 0]
  ------------------
 1285|      0|                    pStruct->pOneINChI[1]->StereoIsotopic->nNumberOfStereoCenters ) ?
 1286|      0|                    pStruct->pOneINChI[1]->StereoIsotopic :
 1287|      0|                    pStruct->pOneINChI[1]->Stereo;
 1288|      0|        }
 1289|      0|    }
 1290|       |
 1291|      0|    cur_success = 0;
 1292|      0|    if (pStruct->bMobileH == TAUT_NON && pStereo2Revrs /* added check 2006-04-05 */ &&
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1292:9): [True: 0, False: 0]
  |  Branch (1292:42): [True: 0, False: 0]
  ------------------
 1293|      0|        ( cmpInChI2 & IDIF_SB_EXTRA_UNDF &&
  ------------------
  |  Branch (1293:11): [True: 0, False: 0]
  ------------------
 1294|      0|            !pStruct->ti.num_t_groups )
  ------------------
  |  Branch (1294:13): [True: 0, False: 0]
  ------------------
 1295|      0|         /*pStruct->bMobileH == TAUT_NON && (cmpInChI2 & IDIF_SB_EXTRA_UNDF)*/)
 1296|      0|    {
 1297|       |        /*----------------------------------------------------------*/
 1298|       |        /* case 06: extra stereogenic bond on =NH2(+), (B, Fixed-H) */
 1299|       |        /*                   H                H        ===========  */
 1300|       |        /* original: N(+)=-N<   ->  N--==N(+)<                      */
 1301|       |        /* (A)               H                H                     */
 1302|       |        /*                             double bond in Mobile-H      */
 1303|       |        /*                             layer has Undef stereo       */
 1304|       |        /*                                                          */
 1305|       |        /*                                                          */
 1306|       |        /* Fixed-H: move (+) to or from NH2 for Undef or No stereo  */
 1307|       |        /*          respectively                                    */
 1308|       |        /* Mobile-H: Add H(+) to =NH and move the charge to =N-     */
 1309|       |        /*           to eliminate Undef stereo                      */
 1310|       |        /*          Move charge from N to -NH2 to create            */
 1311|       |        /*           Undef Stereo                                   */
 1312|       |        /* Since this bond parity is not known, it is UNDEFINED     */
 1313|       |        /*                                                          */
 1314|       |        /* Solution: Move (+) from -NH2(+) to othe -N<              */
 1315|       |        /*                                                          */
 1316|       |        /*----------------------------------------------------------*/
 1317|      0|        int aN, aC, i1, i2, ePlus;
 1318|      0|        BNS_EDGE   *pePlus;
 1319|      0|        AllChargeEdges.num_edges = 0;
 1320|       |        /* in1 => in restored structure; in2 => in original InChI */
 1321|      0|        for (i = 0; i < icr2->num_sb_undef_in1_only; i++)
  ------------------
  |  Branch (1321:21): [True: 0, False: 0]
  ------------------
 1322|      0|        {
 1323|      0|            j12 = icr2->sb_undef_in1_only[i];
 1324|      0|            pv1 = pBNS->vert + ( v1 = pStereo2Revrs->nBondAtom1[j12] - 1 );
 1325|      0|            pv2 = pBNS->vert + ( v2 = pStereo2Revrs->nBondAtom2[j12] - 1 );
 1326|       |            /* indicators of -NH: */
 1327|      0|            i1 = at2[v1].valence == 1 && at2[v1].num_H == 2 && !at2[v1].endpoint &&
  ------------------
  |  Branch (1327:18): [True: 0, False: 0]
  |  Branch (1327:42): [True: 0, False: 0]
  |  Branch (1327:64): [True: 0, False: 0]
  ------------------
 1328|      0|                pVA[v1].cNumValenceElectrons == 5 && pVA[v1].cPeriodicRowNumber == 1;
  ------------------
  |  Branch (1328:17): [True: 0, False: 0]
  |  Branch (1328:54): [True: 0, False: 0]
  ------------------
 1329|      0|            i2 = at2[v2].valence == 1 && at2[v2].num_H == 2 && !at2[v2].endpoint &&
  ------------------
  |  Branch (1329:18): [True: 0, False: 0]
  |  Branch (1329:42): [True: 0, False: 0]
  |  Branch (1329:64): [True: 0, False: 0]
  ------------------
 1330|      0|                pVA[v2].cNumValenceElectrons == 5 && pVA[v2].cPeriodicRowNumber == 1;
  ------------------
  |  Branch (1330:17): [True: 0, False: 0]
  |  Branch (1330:54): [True: 0, False: 0]
  ------------------
 1331|      0|            if (!i1 && !i2 || i1 && i2)
  ------------------
  |  Branch (1331:17): [True: 0, False: 0]
  |  Branch (1331:24): [True: 0, False: 0]
  |  Branch (1331:31): [True: 0, False: 0]
  |  Branch (1331:37): [True: 0, False: 0]
  ------------------
 1332|      0|            {
 1333|      0|                continue;
 1334|      0|            }
 1335|       |            /* find the edge between v1 and v2 */
 1336|      0|            for (k = 0; k < at2[v1].valence; k++)
  ------------------
  |  Branch (1336:25): [True: 0, False: 0]
  ------------------
 1337|      0|            {
 1338|      0|                pe = pBNS->edge + ( e = pv1->iedge[k] );
 1339|      0|                if (v2 == ( pe->neighbor12 ^ v1 ))
  ------------------
  |  Branch (1339:21): [True: 0, False: 0]
  ------------------
 1340|      0|                    break; /* the edge has been found */
 1341|      0|            }
 1342|      0|            if (k == at2[v1].valence)
  ------------------
  |  Branch (1342:17): [True: 0, False: 0]
  ------------------
 1343|      0|            {
 1344|      0|                ret = RI_ERR_SYNTAX;
  ------------------
  |  |   44|      0|#define RI_ERR_SYNTAX  (-2)
  ------------------
 1345|      0|                goto exit_function;
 1346|      0|            }
 1347|      0|            if (pe->flow != 1)
  ------------------
  |  Branch (1347:17): [True: 0, False: 0]
  ------------------
 1348|      0|            {
 1349|      0|                continue; /* already charged */
 1350|      0|            }
 1351|      0|            aN = i1 ? v1 : v2; /* -NH atom */
  ------------------
  |  Branch (1351:18): [True: 0, False: 0]
  ------------------
 1352|      0|            aC = i1 ? v2 : v1; /* neighbor */
  ------------------
  |  Branch (1352:18): [True: 0, False: 0]
  ------------------
 1353|      0|            if (0 > ( ePlus = pVA[aN].nCPlusGroupEdge - 1 ) ||
  ------------------
  |  Branch (1353:17): [True: 0, False: 0]
  ------------------
 1354|      0|                ( pePlus = pBNS->edge + ePlus )->flow ||  /* must be (+) charged */
  ------------------
  |  Branch (1354:17): [True: 0, False: 0]
  ------------------
 1355|      0|                 pePlus->forbidden)
  ------------------
  |  Branch (1355:18): [True: 0, False: 0]
  ------------------
 1356|      0|            {
 1357|      0|                continue;
 1358|      0|            }
 1359|       |            /* Move (+) from =NH2(+) to some other -N<
 1360|       |            */
 1361|       |            /* Fix all charges except (+) on -N< */
 1362|      0|            if (!AllChargeEdges.num_edges)
  ------------------
  |  Branch (1362:17): [True: 0, False: 0]
  ------------------
 1363|      0|            {
 1364|      0|                for (j = 0; j < pStruct->num_atoms; j++)
  ------------------
  |  Branch (1364:29): [True: 0, False: 0]
  ------------------
 1365|      0|                {
 1366|      0|                    if (( k = pVA[j].nCMinusGroupEdge - 1 ) >= 0 && !pBNS->edge[k].forbidden)
  ------------------
  |  Branch (1366:25): [True: 0, False: 0]
  |  Branch (1366:69): [True: 0, False: 0]
  ------------------
 1367|      0|                    {
 1368|      0|                        if (ret = AddToEdgeList( &AllChargeEdges, k, INC_ADD_EDGE ))
  ------------------
  |  |   48|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1368:29): [True: 0, False: 0]
  ------------------
 1369|      0|                        {
 1370|      0|                            goto exit_function;
 1371|      0|                        }
 1372|      0|                    }
 1373|      0|                    if (( k = pVA[j].nCPlusGroupEdge - 1 ) >= 0 && !pBNS->edge[k].forbidden)
  ------------------
  |  Branch (1373:25): [True: 0, False: 0]
  |  Branch (1373:68): [True: 0, False: 0]
  ------------------
 1374|      0|                    {
 1375|      0|                        if (pVA[j].cNumValenceElectrons == 5 && pVA[j].cPeriodicRowNumber == 1 &&
  ------------------
  |  Branch (1375:29): [True: 0, False: 0]
  |  Branch (1375:65): [True: 0, False: 0]
  ------------------
 1376|      0|                             !at2[j].num_H && at2[j].valence == 3 &&
  ------------------
  |  Branch (1376:30): [True: 0, False: 0]
  |  Branch (1376:47): [True: 0, False: 0]
  ------------------
 1377|      0|                             !( at2[j].endpoint || pStruct->endpoint && pStruct->endpoint[j] ))
  ------------------
  |  Branch (1377:33): [True: 0, False: 0]
  |  Branch (1377:52): [True: 0, False: 0]
  |  Branch (1377:73): [True: 0, False: 0]
  ------------------
 1378|      0|                        {
 1379|      0|                            ; /* do not fix -N< or =N(+)< */
 1380|      0|                        }
 1381|      0|                        else
 1382|      0|                        {
 1383|       |                                             /* all others */
 1384|      0|                            if (ret = AddToEdgeList( TautMinusEdges + 0, k, INC_ADD_EDGE ))
  ------------------
  |  |   48|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1384:33): [True: 0, False: 0]
  ------------------
 1385|      0|                            {
 1386|      0|                                goto exit_function;
 1387|      0|                            }
 1388|      0|                        }
 1389|       |                        /* in addition, disallow N(V) creation by forbidding charge flower edge that has flow=1 */
 1390|      0|                        if (pVA[j].cNumValenceElectrons == 5 && !pVA[j].cMetal && /* N, P, As */
  ------------------
  |  Branch (1390:29): [True: 0, False: 0]
  |  Branch (1390:65): [True: 0, False: 0]
  ------------------
 1391|      0|                             NO_VERTEX != ( k = GetChargeFlowerUpperEdge( pBNS, pVA, k ) ))
  ------------------
  |  |  146|      0|#define NO_VERTEX    -2
  ------------------
  |  Branch (1391:30): [True: 0, False: 0]
  ------------------
 1392|      0|                        {
 1393|      0|                            if (!pBNS->edge[j].forbidden && pBNS->edge[k].flow)
  ------------------
  |  Branch (1393:33): [True: 0, False: 0]
  |  Branch (1393:61): [True: 0, False: 0]
  ------------------
 1394|      0|                            {
 1395|      0|                                if (ret = AddToEdgeList( &AllChargeEdges, k, INC_ADD_EDGE ))
  ------------------
  |  |   48|      0|#define INC_ADD_EDGE 64
  ------------------
  |  Branch (1395:37): [True: 0, False: 0]
  ------------------
 1396|      0|                                {
 1397|      0|                                    goto exit_function;
 1398|      0|                                }
 1399|      0|                            }
 1400|      0|                        }
 1401|      0|                    }
 1402|      0|                }
 1403|      0|            }
 1404|       |            /* pePlus edge is already fixed; unfix it */
 1405|       |            /* To decrement (+) on =NH2(+) decrement its double bond order */
 1406|      0|            delta = 1;
 1407|      0|            if (!pe->flow)
  ------------------
  |  Branch (1407:17): [True: 0, False: 0]
  ------------------
 1408|      0|                continue;
 1409|      0|            pv1 = pBNS->vert + ( v1 = pe->neighbor1 );
 1410|      0|            pv2 = pBNS->vert + ( v2 = pe->neighbor12 ^ v1 );
 1411|       |
 1412|      0|            delta = 1;
 1413|      0|            pe->flow -= delta;
 1414|      0|            pv1->st_edge.flow -= delta;
 1415|      0|            pv2->st_edge.flow -= delta;
 1416|      0|            pBNS->tot_st_flow -= 2 * delta;
 1417|       |
 1418|      0|            pe->forbidden |= forbidden_edge_mask;
 1419|      0|            pePlus->forbidden &= ~forbidden_edge_mask;
 1420|       |
 1421|      0|            ret = RunBnsTestOnce( pBNS, pBD, pVA, &vPathStart, &vPathEnd, &nPathLen,
 1422|      0|                                  &nDeltaH, &nDeltaCharge, &nNumVisitedAtoms );
 1423|       |
 1424|      0|            if (ret == 1 && ( vPathEnd == v1 && vPathStart == v2 ||
  ------------------
  |  Branch (1424:17): [True: 0, False: 0]
  |  Branch (1424:31): [True: 0, False: 0]
  |  Branch (1424:49): [True: 0, False: 0]
  ------------------
 1425|      0|                vPathEnd == v2 && vPathStart == v1 ) && nDeltaCharge == 0)
  ------------------
  |  Branch (1425:17): [True: 0, False: 0]
  |  Branch (1425:35): [True: 0, False: 0]
  |  Branch (1425:57): [True: 0, False: 0]
  ------------------
 1426|      0|            {
 1427|       |                /* (+)charge was just moved, no change in number of charges */
 1428|      0|                ret = RunBnsRestoreOnce( pBNS, pBD, pVA, pTCGroups );
 1429|      0|                if (ret > 0)
  ------------------
  |  Branch (1429:21): [True: 0, False: 0]
  ------------------
 1430|      0|                {
 1431|      0|                    ( *pnNumRunBNS )++;
 1432|      0|                    cur_success++; /* 01 */
 1433|      0|                }
 1434|      0|            }
 1435|      0|            else
 1436|      0|            {
 1437|      0|                pe->flow += delta; /* roll back */
 1438|      0|                pv1->st_edge.flow += delta;
 1439|      0|                pv2->st_edge.flow += delta;
 1440|      0|                pBNS->tot_st_flow += 2 * delta;
 1441|      0|            }
 1442|      0|            pe->forbidden &= ~forbidden_edge_mask;
 1443|      0|            RemoveForbiddenEdgeMask( pBNS, &AllChargeEdges, forbidden_edge_mask );/* fix aC edges */
 1444|      0|        }
 1445|       |/*exit_case_06:*/
 1446|      0|        if (cur_success)
  ------------------
  |  Branch (1446:13): [True: 0, False: 0]
  ------------------
 1447|      0|        {
 1448|      0|            tot_succes += cur_success;
 1449|       |            /* recalculate InChI from the structure */
 1450|      0|            if (0 > ( ret = MakeOneInChIOutOfStrFromINChI2( pCG, ic, ip, sd, pBNS, pStruct, at, at2, at3, pVA, pTCGroups,
  ------------------
  |  Branch (1450:17): [True: 0, False: 0]
  ------------------
 1451|      0|                ppt_group_info, ppat_norm, ppat_prep ) ))
 1452|      0|            {
 1453|      0|                goto exit_function;
 1454|      0|            }
 1455|      0|            if (ret = FillOutExtraFixedHDataRestr( pStruct ))
  ------------------
  |  Branch (1455:17): [True: 0, False: 0]
  ------------------
 1456|      0|            {
 1457|      0|                goto exit_function;
 1458|      0|            }
 1459|       |            /*
 1460|       |            if ( ret = FillOutCMP2MHINCHI( pStruct, pTCGroups, at2, pVA, pInChI, pc2i ) ) {
 1461|       |                goto exit_function;
 1462|       |            }
 1463|       |            */
 1464|      0|            cmpInChI = CompareReversedINChI2( pStruct->pOneINChI[0], pInChI[0], pStruct->pOneINChI_Aux[0], NULL /*INChI_Aux *v2*/, icr2, &err );
 1465|      0|            if (cmpInChI & IDIF_PROBLEM)
  ------------------
  |  Branch (1465:17): [True: 0, False: 0]
  ------------------
 1466|      0|            {
 1467|      0|                ret = RI_ERR_PROGR; /* severe restore problem */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1468|      0|                goto exit_function;
 1469|      0|            }
 1470|      0|            if (err)
  ------------------
  |  Branch (1470:17): [True: 0, False: 0]
  ------------------
 1471|      0|            {
 1472|      0|                ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 1473|      0|                goto exit_function;
 1474|      0|            }
 1475|      0|            cmpInChI2 = 0;
 1476|      0|            memset( icr2, 0, sizeof( *icr2 ) );
 1477|      0|            if (iRevrInChI || iOrigInChI)
  ------------------
  |  Branch (1477:17): [True: 0, False: 0]
  |  Branch (1477:31): [True: 0, False: 0]
  ------------------
 1478|      0|            {
 1479|       |                /* additional mobile-H compare in case of Fixed-H */
 1480|      0|                cmpInChI2 = CompareReversedINChI2( pStruct->pOneINChI[iRevrInChI], pInChI[iOrigInChI], pStruct->pOneINChI_Aux[iRevrInChI], NULL /*INChI_Aux *v2*/, icr2, &err );
 1481|      0|                if (cmpInChI & IDIF_PROBLEM)
  ------------------
  |  Branch (1481:21): [True: 0, False: 0]
  ------------------
 1482|      0|                {
 1483|      0|                    ret = RI_ERR_PROGR; /* severe restore problem */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1484|      0|                    goto exit_function;
 1485|      0|                }
 1486|      0|                if (err)
  ------------------
  |  Branch (1486:21): [True: 0, False: 0]
  ------------------
 1487|      0|                {
 1488|      0|                    ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 1489|      0|                    goto exit_function;
 1490|      0|                }
 1491|      0|            }
 1492|      0|            pStereoRevrs = ( pStruct->pOneINChI[0]->StereoIsotopic &&
  ------------------
  |  Branch (1492:30): [True: 0, False: 0]
  ------------------
 1493|      0|                       pStruct->pOneINChI[0]->StereoIsotopic->nNumberOfStereoBonds +
  ------------------
  |  Branch (1493:24): [True: 0, False: 0]
  ------------------
 1494|      0|                       pStruct->pOneINChI[0]->StereoIsotopic->nNumberOfStereoCenters )
 1495|      0|                ? pStruct->pOneINChI[0]->StereoIsotopic
 1496|      0|                : pStruct->pOneINChI[0]->Stereo;
 1497|       |
 1498|       |
 1499|      0|            pStereo2Revrs = ( pStruct->bMobileH == TAUT_YES || !pStruct->pOneINChI[1] ||
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1499:31): [True: 0, False: 0]
  |  Branch (1499:64): [True: 0, False: 0]
  ------------------
 1500|      0|                       !pStruct->pOneINChI[1]->nNumberOfAtoms || pStruct->pOneINChI[1]->bDeleted )
  ------------------
  |  Branch (1500:24): [True: 0, False: 0]
  |  Branch (1500:66): [True: 0, False: 0]
  ------------------
 1501|      0|                ? NULL
 1502|      0|                : ( pStruct->pOneINChI[1]->StereoIsotopic &&
  ------------------
  |  Branch (1502:21): [True: 0, False: 0]
  ------------------
 1503|      0|                    pStruct->pOneINChI[1]->StereoIsotopic->nNumberOfStereoBonds +
  ------------------
  |  Branch (1503:21): [True: 0, False: 0]
  ------------------
 1504|      0|                    pStruct->pOneINChI[1]->StereoIsotopic->nNumberOfStereoCenters ) ?
 1505|      0|                    pStruct->pOneINChI[1]->StereoIsotopic :
 1506|      0|                    pStruct->pOneINChI[1]->Stereo;
 1507|      0|        }
 1508|      0|    }
 1509|       |
 1510|       |
 1511|      3|exit_function:
 1512|      3|    SetForbiddenEdgeMask( pBNS, &FixedStereoEdges, forbidden_stereo_edge_mask );
 1513|      3|    AllocEdgeList( &AllChargeEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|      3|#define EDGE_LIST_FREE   (-2)
  ------------------
 1514|      3|    AllocEdgeList( &CurrEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|      3|#define EDGE_LIST_FREE   (-2)
  ------------------
 1515|      3|    AllocEdgeList( &NFlowerEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|      3|#define EDGE_LIST_FREE   (-2)
  ------------------
 1516|      3|    AllocEdgeList( &OtherNFlowerEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|      3|#define EDGE_LIST_FREE   (-2)
  ------------------
 1517|      3|    AllocEdgeList( &FixedStereoEdges, EDGE_LIST_FREE );
  ------------------
  |  |  271|      3|#define EDGE_LIST_FREE   (-2)
  ------------------
 1518|      3|    AllocEdgeList( &AllRadList, EDGE_LIST_FREE ); /* eliminate memory leak */
  ------------------
  |  |  271|      3|#define EDGE_LIST_FREE   (-2)
  ------------------
 1519|      3|    AllocEdgeList( TautMinusEdges + 0, EDGE_LIST_FREE );
  ------------------
  |  |  271|      3|#define EDGE_LIST_FREE   (-2)
  ------------------
 1520|      3|    AllocEdgeList( TautMinusEdges + 1, EDGE_LIST_FREE );
  ------------------
  |  |  271|      3|#define EDGE_LIST_FREE   (-2)
  ------------------
 1521|       |
 1522|      3|    return ret;
 1523|      0|}

InChI2Atom:
  104|  55.4k|{
  105|  55.4k|    int ret = 0;
  106|       |
  107|  55.4k|    int iINChI = ( bI2A_Flag & I2A_FLAG_RECMET ) ? INCHI_REC : INCHI_BAS;
  ------------------
  |  |  134|  55.4k|#define I2A_FLAG_RECMET  0x0002
  ------------------
                  int iINChI = ( bI2A_Flag & I2A_FLAG_RECMET ) ? INCHI_REC : INCHI_BAS;
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                  int iINChI = ( bI2A_Flag & I2A_FLAG_RECMET ) ? INCHI_REC : INCHI_BAS;
  ------------------
  |  |  575|  55.4k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (107:18): [True: 0, False: 55.4k]
  ------------------
  108|  55.4k|    int bMobileH = ( bI2A_Flag & I2A_FLAG_FIXEDH ) ? TAUT_NON : TAUT_YES;
  ------------------
  |  |  133|  55.4k|#define I2A_FLAG_FIXEDH  0x0001
  ------------------
                  int bMobileH = ( bI2A_Flag & I2A_FLAG_FIXEDH ) ? TAUT_NON : TAUT_YES;
  ------------------
  |  |  579|     20|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                  int bMobileH = ( bI2A_Flag & I2A_FLAG_FIXEDH ) ? TAUT_NON : TAUT_YES;
  ------------------
  |  |  580|  55.4k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (108:20): [True: 20, False: 55.4k]
  ------------------
  109|       |
  110|  55.4k|    INChI *pInChI[TAUT_NUM];
  111|       |
  112|       |
  113|       |
  114|  55.4k|    memset( pInChI, 0, sizeof( pInChI ) );
  115|       |
  116|       |
  117|       |    /* disconnected or reconnected */
  118|       |
  119|  55.4k|    if (iINChI == INCHI_REC)
  ------------------
  |  |  576|  55.4k|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (119:9): [True: 0, False: 55.4k]
  ------------------
  120|      0|    {
  121|      0|        if (!OneInput->nNumComponents[iINChI][TAUT_YES])
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (121:13): [True: 0, False: 0]
  ------------------
  122|      0|        {
  123|      0|            iINChI = INCHI_BAS;
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  124|      0|        }
  125|      0|    }
  126|  55.4k|    if (iComponent >= OneInput->nNumComponents[iINChI][TAUT_YES])
  ------------------
  |  |  580|  55.4k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (126:9): [True: 0, False: 55.4k]
  ------------------
  127|      0|    {
  128|      0|        return 0; /* component does not exist */
  129|      0|    }
  130|       |
  131|       |    /* mobile or fixed H */
  132|  55.4k|    pStruct->bFixedHExists = 0;
  133|  55.4k|    if (bMobileH == TAUT_NON)
  ------------------
  |  |  579|  55.4k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (133:9): [True: 20, False: 55.4k]
  ------------------
  134|     20|    {
  135|     20|        if (!OneInput->nNumComponents[iINChI][bMobileH])
  ------------------
  |  Branch (135:13): [True: 0, False: 20]
  ------------------
  136|      0|        {
  137|       |            /* only one InChI exists (no mobile H) */
  138|      0|            bMobileH = TAUT_YES;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  139|      0|        }
  140|     20|    }
  141|  55.4k|    if (iComponent >= OneInput->nNumComponents[iINChI][bMobileH])
  ------------------
  |  Branch (141:9): [True: 0, False: 55.4k]
  ------------------
  142|      0|    {
  143|      0|        return 0; /* component does not exist */
  144|      0|    }
  145|       |
  146|       |    /* pointer to the InChI that is going to be reversed */
  147|  55.4k|    pInChI[0] = &OneInput->pInpInChI[iINChI][bMobileH][iComponent];
  148|  55.4k|    pStruct->bMobileH = bMobileH;
  149|  55.4k|    pStruct->iINCHI = iINChI;
  150|       |
  151|       |    /* deleted component only in case Mobile-H and compound contains only protons */
  152|  55.4k|    if (pInChI[0]->bDeleted)
  ------------------
  |  Branch (152:9): [True: 0, False: 55.4k]
  ------------------
  153|      0|    {
  154|      0|        return 0; /* deleted component, presumably H(+) */
  155|      0|    }
  156|       |
  157|  55.4k|    if (bMobileH == TAUT_NON && OneInput->nNumProtons[iINChI][TAUT_YES].pNumProtons)
  ------------------
  |  |  579|   110k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                  if (bMobileH == TAUT_NON && OneInput->nNumProtons[iINChI][TAUT_YES].pNumProtons)
  ------------------
  |  |  580|     20|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (157:9): [True: 20, False: 55.4k]
  |  Branch (157:33): [True: 0, False: 20]
  ------------------
  158|      0|    {
  159|      0|        pStruct->nNumRemovedProtonsMobHInChI =
  160|      0|            OneInput->nNumProtons[iINChI][TAUT_YES].pNumProtons[iComponent].nNumRemovedProtons;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  161|      0|    }
  162|       |
  163|  55.4k|    if (bMobileH == TAUT_NON ||
  ------------------
  |  |  579|   110k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (163:9): [True: 20, False: 55.4k]
  ------------------
  164|  55.4k|         bMobileH == TAUT_YES &&
  ------------------
  |  |  580|   110k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (164:10): [True: 55.4k, False: 0]
  ------------------
  165|  55.4k|           OneInput->pInpInChI[iINChI][TAUT_NON] &&
  ------------------
  |  |  579|  55.4k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (165:12): [True: 53.8k, False: 1.61k]
  ------------------
  166|  55.4k|           OneInput->pInpInChI[iINChI][TAUT_NON][iComponent].nNumberOfAtoms > 0 &&
  ------------------
  |  |  579|  53.8k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (166:12): [True: 0, False: 53.8k]
  ------------------
  167|  55.4k|           !OneInput->pInpInChI[iINChI][TAUT_NON][iComponent].bDeleted
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (167:12): [True: 0, False: 0]
  ------------------
  168|  55.4k|        )
  169|     20|    {
  170|     20|        pStruct->bFixedHExists = 1;
  171|     20|    }
  172|       |
  173|  55.4k|    if (bMobileH == TAUT_NON &&
  ------------------
  |  |  579|   110k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (173:9): [True: 20, False: 55.4k]
  ------------------
  174|  55.4k|         iComponent < OneInput->nNumComponents[iINChI][TAUT_YES] &&
  ------------------
  |  |  580|     20|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (174:10): [True: 20, False: 0]
  ------------------
  175|  55.4k|         OneInput->pInpInChI[iINChI][TAUT_YES] &&
  ------------------
  |  |  580|     20|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (175:10): [True: 20, False: 0]
  ------------------
  176|  55.4k|         OneInput->pInpInChI[iINChI][TAUT_YES][iComponent].nNumberOfAtoms > 0 &&
  ------------------
  |  |  580|     20|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (176:10): [True: 20, False: 0]
  ------------------
  177|  55.4k|         !OneInput->pInpInChI[iINChI][TAUT_YES][iComponent].bDeleted
  ------------------
  |  |  580|     20|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (177:10): [True: 20, False: 0]
  ------------------
  178|  55.4k|        )
  179|     20|    {
  180|       |        /* pointer to the Mobile-H InChI if we are reversing Fixed-H InChI */
  181|     20|        pInChI[1] = &OneInput->pInpInChI[iINChI][TAUT_YES][iComponent];
  ------------------
  |  |  580|     20|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  182|     20|    }
  183|       |
  184|  55.4k|    pStruct->num_inp_actual = OneInput->num_inp;
  185|       |
  186|       |    /* Intercept and correct non-polymer Zz to Zy if applicable */
  187|  55.4k|    if ( OneInput->polymer )
  ------------------
  |  Branch (187:10): [True: 160, False: 55.2k]
  ------------------
  188|    160|    {
  189|    160|        int a, k, new_num;
  190|    160|        OAD_Polymer *p = OneInput->polymer;
  191|    160|        pStruct->n_pzz = 0;
  192|    160|        pStruct->n_zy = 0;
  193|    321|        for (a = 0; a < pInChI[0]->nNumberOfAtoms; a++)
  ------------------
  |  Branch (193:21): [True: 161, False: 160]
  ------------------
  194|    161|        {
  195|    161|            int aglob = iAtNoOffset + a + 1;
  196|    161|            if (pInChI[0]->nAtom[a] == EL_NUMBER_ZZ)
  ------------------
  |  |   58|    161|#define EL_NUMBER_ZZ ((U_CHAR) 120)
  ------------------
  |  Branch (196:17): [True: 132, False: 29]
  ------------------
  197|    132|            {
  198|    132|                new_num = EL_NUMBER_ZY; /* Zy */
  ------------------
  |  |   57|    132|#define EL_NUMBER_ZY ((U_CHAR) 119)
  ------------------
  199|  5.30k|                for (k = 0; k < p->n; k++)
  ------------------
  |  Branch (199:29): [True: 5.30k, False: 0]
  ------------------
  200|  5.30k|                {
  201|  5.30k|                    if ( (aglob == p->units[k]->cap1) || (aglob == p->units[k]->cap2) )
  ------------------
  |  Branch (201:26): [True: 66, False: 5.24k]
  |  Branch (201:58): [True: 66, False: 5.17k]
  ------------------
  202|    132|                    {
  203|    132|                        new_num = EL_NUMBER_ZZ;
  ------------------
  |  |   58|    132|#define EL_NUMBER_ZZ ((U_CHAR) 120)
  ------------------
  204|    132|                        break;
  205|    132|                    }
  206|  5.30k|                }
  207|    132|                pInChI[0]->nAtom[a] = new_num;
  208|    132|                if (new_num == EL_NUMBER_ZY)
  ------------------
  |  |   57|    132|#define EL_NUMBER_ZY ((U_CHAR) 119)
  ------------------
  |  Branch (208:21): [True: 0, False: 132]
  ------------------
  209|      0|                { 
  210|      0|                    pStruct->n_zy++; 
  211|      0|                }
  212|    132|                else if (new_num == EL_NUMBER_ZZ)
  ------------------
  |  |   58|    132|#define EL_NUMBER_ZZ ((U_CHAR) 120)
  ------------------
  |  Branch (212:26): [True: 132, False: 0]
  ------------------
  213|    132|                {
  214|    132|                    pStruct->n_pzz++;
  215|    132|                }
  216|    132|            }
  217|    161|        }
  218|    160|    }
  219|       |
  220|  55.4k|    ret = OneInChI2Atom( ic, pCG, ip, sd, szCurHdr, num_inp, pStruct,
  221|  55.4k|                         iComponent, 0 /* iAtNoOffset*/, bHasSomeFixedH, pInChI );
  222|       |
  223|  55.4k|    {
  224|  55.4k|        int a;
  225|   763k|        for (a = 0; a < pInChI[0]->nNumberOfAtoms; a++)
  ------------------
  |  Branch (225:21): [True: 707k, False: 55.4k]
  ------------------
  226|   707k|        {
  227|   707k|            if (pInChI[0]->nAtom[a] == EL_NUMBER_ZY)
  ------------------
  |  |   57|   707k|#define EL_NUMBER_ZY ((U_CHAR) 119)
  ------------------
  |  Branch (227:17): [True: 0, False: 707k]
  ------------------
  228|      0|            {
  229|      0|                pInChI[0]->nAtom[a] = EL_NUMBER_ZZ;
  ------------------
  |  |   58|      0|#define EL_NUMBER_ZZ ((U_CHAR) 120)
  ------------------
  230|      0|                pStruct->at[a].el_number = EL_NUMBER_ZZ;
  ------------------
  |  |   58|      0|#define EL_NUMBER_ZZ ((U_CHAR) 120)
  ------------------
  231|      0|                strcpy(pStruct->at[a].elname, "Zz");
  232|      0|                pStruct->at2[a].el_number = EL_NUMBER_ZZ;
  ------------------
  |  |   58|      0|#define EL_NUMBER_ZZ ((U_CHAR) 120)
  ------------------
  233|      0|                strcpy(pStruct->at2[a].elname, "Zz");
  234|      0|                pStruct->n_zy--;
  235|      0|                pStruct->n_pzz++;
  236|      0|            }
  237|   707k|        }
  238|  55.4k|    }
  239|       |
  240|  55.4k|    return ret; /* same interpretation as in ProcessOneStructure ??? */
  241|  55.4k|}
RemoveFixHInChIIdentical2MobH:
  246|     88|{
  247|     88|    int iInchiRec, cur_num_comp, k;
  248|       |
  249|       |    /* eliminate Fixed-H InChI that are exactly came as the corresponding Mobile-H structures */
  250|    264|    for (iInchiRec = 0; iInchiRec < INCHI_NUM; iInchiRec++)
  ------------------
  |  |  574|    264|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (250:25): [True: 176, False: 88]
  ------------------
  251|    176|    {
  252|    176|        cur_num_comp = inchi_min( pOneInput->nNumComponents[iInchiRec][TAUT_YES],
  ------------------
  |  |  167|    176|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 176]
  |  |  ------------------
  ------------------
  253|    176|                                 pOneInput->nNumComponents[iInchiRec][TAUT_NON] );
  254|  54.0k|        for (k = 0; k < cur_num_comp; k++)
  ------------------
  |  Branch (254:21): [True: 53.8k, False: 176]
  ------------------
  255|  53.8k|        {
  256|  53.8k|            if (!CompareReversedINChI( pOneInput->pInpInChI[iInchiRec][TAUT_YES] + k,
  ------------------
  |  |  580|  53.8k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (256:17): [True: 53.8k, False: 20]
  ------------------
  257|  53.8k|                pOneInput->pInpInChI[iInchiRec][TAUT_NON] + k, NULL, NULL ))
  ------------------
  |  |  579|  53.8k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  258|  53.8k|            {
  259|  53.8k|                Free_INChI_Members( pOneInput->pInpInChI[iInchiRec][TAUT_NON] + k );
  ------------------
  |  |  579|  53.8k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  260|  53.8k|                memset( pOneInput->pInpInChI[iInchiRec][TAUT_NON] + k, 0, sizeof( pOneInput->pInpInChI[0][0][0] ) );
  ------------------
  |  |  579|  53.8k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  261|  53.8k|            }
  262|  53.8k|        }
  263|    176|    }
  264|     88|}
MarkDisconectedIdenticalToReconnected:
  273|     88|{
  274|     88|    int k1, k2, num_marked = 0;
  275|     88|    int k1max = inchi_max( pOneInput->nNumComponents[INCHI_BAS][TAUT_YES],
  ------------------
  |  |  166|     88|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 68, False: 20]
  |  |  ------------------
  ------------------
  276|     88|                           pOneInput->nNumComponents[INCHI_BAS][TAUT_NON] );
  277|       |
  278|  55.6k|    for (k1 = 0; k1 < k1max; k1++)
  ------------------
  |  Branch (278:18): [True: 55.5k, False: 88]
  ------------------
  279|  55.5k|    {
  280|  55.5k|        int k2max = inchi_max( pOneInput->nNumComponents[INCHI_REC][TAUT_YES],
  ------------------
  |  |  166|  55.5k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 55.5k]
  |  |  ------------------
  ------------------
  281|  55.5k|                               pOneInput->nNumComponents[INCHI_REC][TAUT_NON] );
  282|       |
  283|  55.5k|        for (k2 = 0; k2 < k2max; k2++)
  ------------------
  |  Branch (283:22): [True: 0, False: 55.5k]
  ------------------
  284|      0|        {
  285|      0|            int eqM = k1 < pOneInput->nNumComponents[INCHI_BAS][TAUT_YES]
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          int eqM = k1 < pOneInput->nNumComponents[INCHI_BAS][TAUT_YES]
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (285:23): [True: 0, False: 0]
  ------------------
  286|      0|                &&
  287|      0|                k2 < pOneInput->nNumComponents[INCHI_REC][TAUT_YES]
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                              k2 < pOneInput->nNumComponents[INCHI_REC][TAUT_YES]
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (287:17): [True: 0, False: 0]
  ------------------
  288|      0|                &&
  289|      0|                !pOneInput->pInpInChI[INCHI_REC][TAUT_YES][k2].nLink /* already linked */
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                              !pOneInput->pInpInChI[INCHI_REC][TAUT_YES][k2].nLink /* already linked */
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (289:17): [True: 0, False: 0]
  ------------------
  290|      0|                &&
  291|      0|                !pOneInput->pInpInChI[INCHI_BAS][TAUT_YES][k1].bDeleted
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                              !pOneInput->pInpInChI[INCHI_BAS][TAUT_YES][k1].bDeleted
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (291:17): [True: 0, False: 0]
  ------------------
  292|      0|                &&
  293|      0|                pOneInput->pInpInChI[INCHI_BAS][TAUT_YES][k1].nNumberOfAtoms
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                              pOneInput->pInpInChI[INCHI_BAS][TAUT_YES][k1].nNumberOfAtoms
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (293:17): [True: 0, False: 0]
  ------------------
  294|      0|                &&
  295|      0|                pOneInput->pInpInChI[INCHI_BAS][TAUT_YES][k1].nNumberOfAtoms ==
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                              pOneInput->pInpInChI[INCHI_BAS][TAUT_YES][k1].nNumberOfAtoms ==
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (295:17): [True: 0, False: 0]
  ------------------
  296|      0|                pOneInput->pInpInChI[INCHI_REC][TAUT_YES][k2].nNumberOfAtoms
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                              pOneInput->pInpInChI[INCHI_REC][TAUT_YES][k2].nNumberOfAtoms
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  297|      0|                &&
  298|      0|                !pOneInput->pInpInChI[INCHI_REC][TAUT_YES][k2].bDeleted
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                              !pOneInput->pInpInChI[INCHI_REC][TAUT_YES][k2].bDeleted
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (298:17): [True: 0, False: 0]
  ------------------
  299|      0|                &&
  300|      0|                !CompareReversedINChI( pOneInput->pInpInChI[INCHI_REC][TAUT_YES] + k2,
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                              !CompareReversedINChI( pOneInput->pInpInChI[INCHI_REC][TAUT_YES] + k2,
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (300:17): [True: 0, False: 0]
  ------------------
  301|      0|                                       pOneInput->pInpInChI[INCHI_BAS][TAUT_YES] + k1,
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                                                     pOneInput->pInpInChI[INCHI_BAS][TAUT_YES] + k1,
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  302|      0|                                       NULL, NULL );
  303|       |
  304|      0|            int isF1 = k1 < pOneInput->nNumComponents[INCHI_BAS][TAUT_NON]
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          int isF1 = k1 < pOneInput->nNumComponents[INCHI_BAS][TAUT_NON]
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (304:24): [True: 0, False: 0]
  ------------------
  305|      0|                &&
  306|      0|                0 == pOneInput->pInpInChI[INCHI_BAS][TAUT_NON][k1].bDeleted
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                              0 == pOneInput->pInpInChI[INCHI_BAS][TAUT_NON][k1].bDeleted
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (306:17): [True: 0, False: 0]
  ------------------
  307|      0|                &&
  308|      0|                0 < pOneInput->pInpInChI[INCHI_BAS][TAUT_NON][k1].nNumberOfAtoms
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                              0 < pOneInput->pInpInChI[INCHI_BAS][TAUT_NON][k1].nNumberOfAtoms
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (308:17): [True: 0, False: 0]
  ------------------
  309|      0|                ;
  310|       |
  311|      0|            int isF2 = k2 < pOneInput->nNumComponents[INCHI_REC][TAUT_NON]
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                          int isF2 = k2 < pOneInput->nNumComponents[INCHI_REC][TAUT_NON]
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (311:24): [True: 0, False: 0]
  ------------------
  312|      0|                &&
  313|      0|                0 == pOneInput->pInpInChI[INCHI_REC][TAUT_NON][k2].bDeleted
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                              0 == pOneInput->pInpInChI[INCHI_REC][TAUT_NON][k2].bDeleted
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (313:17): [True: 0, False: 0]
  ------------------
  314|      0|                &&
  315|      0|                0 < pOneInput->pInpInChI[INCHI_REC][TAUT_NON][k2].nNumberOfAtoms
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                              0 < pOneInput->pInpInChI[INCHI_REC][TAUT_NON][k2].nNumberOfAtoms
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (315:17): [True: 0, False: 0]
  ------------------
  316|      0|                ;
  317|       |
  318|      0|            int eqF = isF1
  ------------------
  |  Branch (318:23): [True: 0, False: 0]
  ------------------
  319|      0|                &&
  320|      0|                isF2
  ------------------
  |  Branch (320:17): [True: 0, False: 0]
  ------------------
  321|      0|                &&
  322|      0|                !pOneInput->pInpInChI[INCHI_REC][TAUT_NON][k2].nLink
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                              !pOneInput->pInpInChI[INCHI_REC][TAUT_NON][k2].nLink
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (322:17): [True: 0, False: 0]
  ------------------
  323|      0|                &&
  324|      0|                pOneInput->pInpInChI[INCHI_BAS][TAUT_NON][k1].nNumberOfAtoms ==
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                              pOneInput->pInpInChI[INCHI_BAS][TAUT_NON][k1].nNumberOfAtoms ==
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (324:17): [True: 0, False: 0]
  ------------------
  325|      0|                pOneInput->pInpInChI[INCHI_REC][TAUT_NON][k2].nNumberOfAtoms
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                              pOneInput->pInpInChI[INCHI_REC][TAUT_NON][k2].nNumberOfAtoms
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  326|      0|                &&
  327|      0|                !CompareReversedINChI( pOneInput->pInpInChI[INCHI_REC][TAUT_NON] + k2,
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                              !CompareReversedINChI( pOneInput->pInpInChI[INCHI_REC][TAUT_NON] + k2,
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (327:17): [True: 0, False: 0]
  ------------------
  328|      0|                                       pOneInput->pInpInChI[INCHI_BAS][TAUT_NON] + k1,
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                                                     pOneInput->pInpInChI[INCHI_BAS][TAUT_NON] + k1,
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  329|      0|                                       NULL, NULL )
  330|      0|                ;
  331|       |
  332|      0|            if (eqM && ( !isF1 && !isF2 || eqF ))
  ------------------
  |  Branch (332:17): [True: 0, False: 0]
  |  Branch (332:26): [True: 0, False: 0]
  |  Branch (332:35): [True: 0, False: 0]
  |  Branch (332:44): [True: 0, False: 0]
  ------------------
  333|      0|            {
  334|      0|                pOneInput->pInpInChI[INCHI_BAS][TAUT_YES][k1].nLink = -( k2 + 1 );
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                              pOneInput->pInpInChI[INCHI_BAS][TAUT_YES][k1].nLink = -( k2 + 1 );
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  335|      0|                pOneInput->pInpInChI[INCHI_REC][TAUT_YES][k2].nLink = ( k1 + 1 );
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                              pOneInput->pInpInChI[INCHI_REC][TAUT_YES][k2].nLink = ( k1 + 1 );
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  336|      0|                if (eqF)
  ------------------
  |  Branch (336:21): [True: 0, False: 0]
  ------------------
  337|      0|                {
  338|      0|                    pOneInput->pInpInChI[INCHI_BAS][TAUT_NON][k1].nLink = -( k2 + 1 );
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                                  pOneInput->pInpInChI[INCHI_BAS][TAUT_NON][k1].nLink = -( k2 + 1 );
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  339|      0|                    pOneInput->pInpInChI[INCHI_REC][TAUT_NON][k2].nLink = ( k1 + 1 );
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                                  pOneInput->pInpInChI[INCHI_REC][TAUT_NON][k2].nLink = ( k1 + 1 );
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  340|      0|                }
  341|      0|                num_marked++;
  342|      0|                break;
  343|       |                /* equal InChI has been deleted from the disconnected layer, get next k1 */
  344|      0|            }
  345|      0|        }
  346|  55.5k|    }
  347|       |
  348|     88|    return num_marked;
  349|     88|}
SetUpSrm:
  354|     88|{
  355|       |    /* structure restore parms !!!!! */
  356|     88|    memset( pSrm, 0, sizeof( pSrm[0] ) );
  357|     88|    pSrm->bFixStereoBonds = FIX_STEREO_BOND_ORDER;
  ------------------
  |  |  119|     88|#define FIX_STEREO_BOND_ORDER  0   /* 1=> fix stereobonds; treat metal as non-metal if it is stereogenic or has a stereobond */
  ------------------
  358|     88|    pSrm->nMetal2EndpointMinBondOrder = 1;
  359|     88|    pSrm->nMetal2EndpointInitEdgeFlow = 0;
  360|       |
  361|     88|    if (METAL_FREE_CHARGE_VAL == 1)
  ------------------
  |  |  121|     88|#define METAL_FREE_CHARGE_VAL  1  /* 1=> allow free changing charges/valences of metals; initial bond order=0 or 1 */
  ------------------
  |  Branch (361:9): [Folded - Ignored]
  ------------------
  362|     88|    {
  363|     88|        pSrm->bMetalAddFlower = 1;
  364|       |        /* the next 3 parameters: */
  365|       |        /* 0, 0, 0 => all bonds 0, no init radical on metal */
  366|       |        /* 0, 0, 1 => all bonds 0,    init radical on metal */
  367|       |        /* 0, 1, 0 => wrong */
  368|       |        /* 0, 1, 1 => all bonds 1, no init radical on metal */
  369|       |        /* 1, 0, 1 => min bond order 1, all bonds to metal have order 1 */
  370|       |        /* 1, 1, 0 => wrong */
  371|       |        /* 1, 1, 1 => wrong */
  372|     88|        pSrm->nMetalMinBondOrder = 0;
  373|     88|        pSrm->nMetalInitEdgeFlow = 1;
  374|     88|        pSrm->nMetalInitBondOrder = 1;
  375|     88|        pSrm->bStereoRemovesMetalFlag = pSrm->bFixStereoBonds;
  376|     88|        pSrm->nMetalFlowerParam_D = 16;
  377|     88|        pSrm->nMetalMaxCharge_D = 16;
  378|     88|    }
  379|      0|    else
  380|      0|    {
  381|      0|        pSrm->bMetalAddFlower = 0;
  382|      0|        pSrm->nMetalMinBondOrder = 1;
  383|      0|        pSrm->nMetalInitEdgeFlow = 0;
  384|      0|        pSrm->nMetalInitBondOrder = 1;
  385|      0|        pSrm->bStereoRemovesMetalFlag = pSrm->bFixStereoBonds;
  386|      0|        pSrm->nMetalFlowerParam_D = 16;
  387|      0|        pSrm->nMetalMaxCharge_D = 0;
  388|      0|    }
  389|     88|    pSrm->nMetal2EndpointInitBondOrder = pSrm->nMetal2EndpointMinBondOrder
  390|     88|        + pSrm->nMetal2EndpointInitEdgeFlow;
  391|     88|}
MergeStructureComponents:
  403|     31|{
  404|     31|    int iInchiRec, iMobileH, iAlternH, num_components, tot_just_atoms, tot_removed_H, tot_atoms, cur_nA, cur_nH;
  405|     31|    int k, i, j, ret, iCurAtomOffs, iNxtAtomOffs, iCurDelHOffs, iNxtDelHOffs, len, len2, iShiftH, icomp;
  406|     31|    int *nAtomOffs = NULL, *nDelHOffs = NULL;
  407|     31|    StrFromINChI *pStruct1;
  408|     31|    inp_ATOM *at = NULL, *a;
  409|       |
  410|     31|    ret = 0;
  411|     31|    pOneInput->num_atoms = 0;
  412|       |    /* select highest detail level */
  413|     31|    if (num_components = pOneInput->nNumComponents[INCHI_REC][TAUT_NON])
  ------------------
  |  |  576|     31|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                  if (num_components = pOneInput->nNumComponents[INCHI_REC][TAUT_NON])
  ------------------
  |  |  579|     31|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (413:9): [True: 0, False: 31]
  ------------------
  414|      0|    {
  415|      0|        iInchiRec = INCHI_REC;
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  416|      0|        iMobileH = TAUT_NON;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  417|      0|    }
  418|     31|    else
  419|     31|    {
  420|     31|        if (num_components = pOneInput->nNumComponents[INCHI_REC][TAUT_YES])
  ------------------
  |  |  576|     31|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                      if (num_components = pOneInput->nNumComponents[INCHI_REC][TAUT_YES])
  ------------------
  |  |  580|     31|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (420:13): [True: 0, False: 31]
  ------------------
  421|      0|        {
  422|      0|            iInchiRec = INCHI_REC;
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  423|      0|            iMobileH = TAUT_YES;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  424|      0|        }
  425|     31|        else
  426|     31|        {
  427|     31|            if (num_components = pOneInput->nNumComponents[INCHI_BAS][TAUT_NON])
  ------------------
  |  |  575|     31|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          if (num_components = pOneInput->nNumComponents[INCHI_BAS][TAUT_NON])
  ------------------
  |  |  579|     31|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (427:17): [True: 17, False: 14]
  ------------------
  428|     17|            {
  429|     17|                iInchiRec = INCHI_BAS;
  ------------------
  |  |  575|     17|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  430|     17|                iMobileH = TAUT_NON;
  ------------------
  |  |  579|     17|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  431|     17|            }
  432|     14|            else
  433|     14|            {
  434|     14|                if (num_components = pOneInput->nNumComponents[INCHI_BAS][TAUT_YES])
  ------------------
  |  |  575|     14|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                              if (num_components = pOneInput->nNumComponents[INCHI_BAS][TAUT_YES])
  ------------------
  |  |  580|     14|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (434:21): [True: 14, False: 0]
  ------------------
  435|     14|                {
  436|     14|                    iInchiRec = INCHI_BAS;
  ------------------
  |  |  575|     14|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  437|     14|                    iMobileH = TAUT_YES;
  ------------------
  |  |  580|     14|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  438|     14|                }
  439|      0|                else
  440|      0|                {
  441|      0|                    return 0; /* no components available */
  442|      0|                }
  443|     14|            }
  444|     31|        }
  445|     31|    }
  446|       |
  447|     31|    nAtomOffs = (int*) inchi_malloc( ( num_components + 1 ) * sizeof( nAtomOffs[0] ) );
  ------------------
  |  | 1130|     31|#define inchi_malloc   malloc
  ------------------
  448|     31|    nDelHOffs = (int*) inchi_malloc( ( num_components + 1 ) * sizeof( nDelHOffs[0] ) );
  ------------------
  |  | 1130|     31|#define inchi_malloc   malloc
  ------------------
  449|     31|    if (!nAtomOffs || !nDelHOffs)
  ------------------
  |  Branch (449:9): [True: 0, False: 31]
  |  Branch (449:23): [True: 0, False: 31]
  ------------------
  450|      0|    {
  451|      0|        ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
  452|      0|        goto exit_function;
  453|      0|    }
  454|       |    /* count number of atoms and removed H */
  455|     31|    tot_just_atoms = tot_removed_H = tot_atoms = 0;
  456|     31|    iAlternH = ( iMobileH == TAUT_NON && pOneInput->nNumComponents[iInchiRec][TAUT_YES] ) ? TAUT_YES : -1;
  ------------------
  |  |  579|     62|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                  iAlternH = ( iMobileH == TAUT_NON && pOneInput->nNumComponents[iInchiRec][TAUT_YES] ) ? TAUT_YES : -1;
  ------------------
  |  |  580|     17|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  iAlternH = ( iMobileH == TAUT_NON && pOneInput->nNumComponents[iInchiRec][TAUT_YES] ) ? TAUT_YES : -1;
  ------------------
  |  |  580|     17|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (456:18): [True: 17, False: 14]
  |  Branch (456:42): [True: 17, False: 0]
  ------------------
  457|     31|    nAtomOffs[0] = nDelHOffs[0] = 0;
  458|  53.5k|    for (k = 0; k < num_components; k++)
  ------------------
  |  Branch (458:17): [True: 53.4k, False: 31]
  ------------------
  459|  53.4k|    {
  460|  53.4k|        pStruct1 = pStruct[iInchiRec][iMobileH][k].num_atoms ? pStruct[iInchiRec][iMobileH] + k :
  ------------------
  |  Branch (460:20): [True: 308, False: 53.1k]
  ------------------
  461|  53.4k|            iAlternH >= 0 &&
  ------------------
  |  Branch (461:13): [True: 53.1k, False: 13]
  ------------------
  462|  53.1k|            pStruct[iInchiRec][iAlternH][k].num_atoms ? pStruct[iInchiRec][iAlternH] + k : NULL;
  ------------------
  |  Branch (462:13): [True: 53.1k, False: 0]
  ------------------
  463|  53.4k|        if (!pStruct1 || !pStruct1->at2 || !pStruct1->num_atoms || pStruct1->bDeleted)
  ------------------
  |  Branch (463:13): [True: 13, False: 53.4k]
  |  Branch (463:26): [True: 0, False: 53.4k]
  |  Branch (463:44): [True: 0, False: 53.4k]
  |  Branch (463:68): [True: 0, False: 53.4k]
  ------------------
  464|     13|        {
  465|     13|            cur_nA = cur_nH = 0;
  466|     13|        }
  467|  53.4k|        else
  468|  53.4k|        {
  469|  53.4k|            cur_nA = pStruct1->num_atoms;
  470|  53.4k|            cur_nH = pStruct1->num_deleted_H;
  471|  53.4k|        }
  472|  53.4k|        nAtomOffs[k + 1] = nAtomOffs[k] + cur_nA;
  473|  53.4k|        nDelHOffs[k + 1] = nDelHOffs[k] + cur_nH;
  474|  53.4k|    }
  475|     31|    tot_just_atoms = nAtomOffs[num_components];
  476|       |    /* shift all H to the end */
  477|  53.5k|    for (k = 0; k <= num_components; k++)
  ------------------
  |  Branch (477:17): [True: 53.5k, False: 31]
  ------------------
  478|  53.5k|    {
  479|  53.5k|        nDelHOffs[k] += tot_just_atoms;
  480|  53.5k|    }
  481|     31|    tot_atoms = nDelHOffs[num_components];
  482|       |
  483|       |    /* merge atoms together: 1. Allocate */
  484|     31|    if (NULL == ( at = (inp_ATOM *) inchi_malloc( ( tot_atoms + 1 ) * sizeof( at[0] ) ) ))
  ------------------
  |  | 1130|     31|#define inchi_malloc   malloc
  ------------------
  |  Branch (484:9): [True: 0, False: 31]
  ------------------
  485|      0|    {
  486|      0|        ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
  487|      0|        goto exit_function;
  488|      0|    }
  489|     31|    if (!tot_atoms)
  ------------------
  |  Branch (489:9): [True: 0, False: 31]
  ------------------
  490|      0|    {
  491|      0|        ret = 0;
  492|      0|        goto exit_function; /* empty structure */
  493|      0|    }
  494|       |    /* merge atoms together: 2. Copy */
  495|  53.5k|    for (k = 0; k < num_components; k++)
  ------------------
  |  Branch (495:17): [True: 53.4k, False: 31]
  ------------------
  496|  53.4k|    {
  497|  53.4k|        pStruct1 = pStruct[iInchiRec][iMobileH][k].num_atoms ? pStruct[iInchiRec][iMobileH] + k :
  ------------------
  |  Branch (497:20): [True: 308, False: 53.1k]
  ------------------
  498|  53.4k|            iAlternH >= 0 &&
  ------------------
  |  Branch (498:13): [True: 53.1k, False: 13]
  ------------------
  499|  53.1k|            pStruct[iInchiRec][iAlternH][k].num_atoms ? pStruct[iInchiRec][iAlternH] + k : NULL;
  ------------------
  |  Branch (499:13): [True: 53.1k, False: 0]
  ------------------
  500|  53.4k|        if (len = nAtomOffs[k + 1] - nAtomOffs[k])
  ------------------
  |  Branch (500:13): [True: 53.4k, False: 13]
  ------------------
  501|  53.4k|        {
  502|  53.4k|            memcpy( at + nAtomOffs[k], pStruct1->at2, len * sizeof( at[0] ) );
  503|  53.4k|            if (len2 = nDelHOffs[k + 1] - nDelHOffs[k])
  ------------------
  |  Branch (503:17): [True: 0, False: 53.4k]
  ------------------
  504|      0|            {
  505|      0|                memcpy( at + nDelHOffs[k], pStruct1->at2 + len, len2 * sizeof( at[0] ) );
  506|      0|            }
  507|  53.4k|        }
  508|  53.4k|    }
  509|       |    /* merge atoms together: 3. Update atom numbers */
  510|     31|    icomp = 0;
  511|  53.5k|    for (k = 0; k < num_components; k++)
  ------------------
  |  Branch (511:17): [True: 53.4k, False: 31]
  ------------------
  512|  53.4k|    {
  513|  53.4k|        iCurAtomOffs = nAtomOffs[k];
  514|  53.4k|        iNxtAtomOffs = nAtomOffs[k + 1];
  515|  53.4k|        iCurDelHOffs = nDelHOffs[k];
  516|  53.4k|        iNxtDelHOffs = nDelHOffs[k + 1];
  517|  53.4k|        len = nAtomOffs[k + 1] - nAtomOffs[k]; /* number of atoms in a component excluding explicit H */
  518|  53.4k|        iShiftH = iCurDelHOffs - len;
  519|  53.4k|        if (!len)
  ------------------
  |  Branch (519:13): [True: 13, False: 53.4k]
  ------------------
  520|     13|        {
  521|     13|            continue;
  522|     13|        }
  523|  53.4k|        icomp++; /* current component number */
  524|       |        /* update atoms */
  525|   106k|        for (i = iCurAtomOffs; i < iNxtAtomOffs; i++)
  ------------------
  |  Branch (525:32): [True: 53.4k, False: 53.4k]
  ------------------
  526|  53.4k|        {
  527|       |
  528|  53.4k|            a = at + i;
  529|       |
  530|  53.4k|            a->endpoint = 0;
  531|  53.4k|            a->bAmbiguousStereo = 0;
  532|  53.4k|            a->at_type = 0;
  533|  53.4k|            a->bCutVertex = 0;
  534|  53.4k|            a->bUsed0DParity = 0;
  535|  53.4k|            a->cFlags = 0;
  536|  53.4k|            a->nBlockSystem = 0;
  537|  53.4k|            a->nNumAtInRingSystem = 0;
  538|  53.4k|            a->nRingSystem = 0;
  539|       |
  540|  53.5k|            for (j = 0; j < a->valence; j++)
  ------------------
  |  Branch (540:25): [True: 24, False: 53.4k]
  ------------------
  541|     24|            {
  542|     24|                if (a->neighbor[j] < len)
  ------------------
  |  Branch (542:21): [True: 24, False: 0]
  ------------------
  543|     24|                {
  544|     24|                    a->neighbor[j] += iCurAtomOffs; /* atom */
  545|     24|                }
  546|      0|                else
  547|      0|                {
  548|      0|                    a->neighbor[j] += iShiftH;      /* explicit H */
  549|      0|                }
  550|     24|            }
  551|  53.4k|            a->orig_at_number += iCurAtomOffs;
  552|  53.4k|            a->component = icomp;
  553|  53.4k|            if (a->p_parity)
  ------------------
  |  Branch (553:17): [True: 0, False: 53.4k]
  ------------------
  554|      0|            {
  555|      0|                for (j = 0; j < MAX_NUM_STEREO_ATOM_NEIGH; j++)
  ------------------
  |  |  880|      0|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (555:29): [True: 0, False: 0]
  ------------------
  556|      0|                {
  557|      0|                    if (a->p_orig_at_num[j] <= len)
  ------------------
  |  Branch (557:25): [True: 0, False: 0]
  ------------------
  558|      0|                    {
  559|       |                        /* originally, orig_at_num = atom_index+1, therefore <= instead of < */
  560|      0|                        a->p_orig_at_num[j] += iCurAtomOffs;
  561|      0|                    }
  562|      0|                    else
  563|      0|                    {
  564|      0|                        a->p_orig_at_num[j] += iShiftH;
  565|      0|                    }
  566|      0|                }
  567|      0|            }
  568|  53.4k|            for (j = 0; j < MAX_NUM_STEREO_BONDS && a->sb_parity[j]; j++)
  ------------------
  |  |  876|   106k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (568:25): [True: 53.4k, False: 0]
  |  Branch (568:53): [True: 0, False: 53.4k]
  ------------------
  569|      0|            {
  570|      0|                if (a->sn_orig_at_num[j] <= len)
  ------------------
  |  Branch (570:21): [True: 0, False: 0]
  ------------------
  571|      0|                {
  572|       |                    /* originally, orig_at_num = atom_index+1, therefore <= instead of < */
  573|      0|                    a->sn_orig_at_num[j] += iCurAtomOffs;
  574|      0|                }
  575|      0|                else
  576|      0|                {
  577|      0|                    a->sn_orig_at_num[j] += iShiftH;
  578|      0|                }
  579|      0|            }
  580|  53.4k|        }
  581|       |        /* update fixed-H */
  582|  53.4k|        for (i = iCurDelHOffs; i < iNxtDelHOffs; i++)
  ------------------
  |  Branch (582:32): [True: 0, False: 53.4k]
  ------------------
  583|      0|        {
  584|      0|            a = at + i;
  585|      0|            a->neighbor[0] += iCurAtomOffs;
  586|      0|            a->orig_at_number += iShiftH;
  587|      0|        }
  588|  53.4k|    }
  589|       |    /* save the results */
  590|     31|    pOneInput->atom = at;
  591|     31|    pOneInput->num_atoms = tot_atoms;
  592|     31|    at = NULL;
  593|       |
  594|     31|exit_function:
  595|     31|    if (at)        inchi_free( at );  /* in case of failure */
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (595:9): [True: 0, False: 31]
  ------------------
  596|     31|    if (nAtomOffs) inchi_free( nAtomOffs );
  ------------------
  |  | 1136|     31|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 31, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (596:9): [True: 31, False: 0]
  ------------------
  597|     31|    if (nDelHOffs) inchi_free( nDelHOffs );
  ------------------
  |  | 1136|     31|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 31, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (597:9): [True: 31, False: 0]
  ------------------
  598|     31|    return ret;
  599|     31|}
AllInchiToStructure:
 1044|     88|{
 1045|     88|    int iInchiRec, iMobileH, cur_num_comp, bCurI2A_Flag, k, ret, num_err;
 1046|     88|    int iAtNoOffset;
 1047|     88|    INPUT_PARMS *ip, ip_loc;
 1048|     88|    STRUCT_DATA *sd, sd_loc;
 1049|     88|    long          ulProcessingTime = 0;
 1050|     88|    inchiTime     ulTStart;
 1051|       |
 1052|     88|    InchiTimeGet( &ulTStart );
 1053|     88|    ip = &ip_loc;
 1054|     88|    *ip = *ip_inp;
 1055|     88|    sd = &sd_loc;
 1056|     88|    memset( sd, 0, sizeof( *sd ) );
 1057|     88|    sd->ulStructTime = sd_inp->ulStructTime;
 1058|     88|    ret = 0;
 1059|     88|    num_err = 0;
 1060|    264|    for (iInchiRec = 0; iInchiRec < INCHI_NUM; iInchiRec++)
  ------------------
  |  |  574|    264|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1060:25): [True: 176, False: 88]
  ------------------
 1061|    176|    {
 1062|       |        /* Disconnected/Connected */
 1063|    528|        for (iMobileH = 0; iMobileH < TAUT_NUM; iMobileH++)
  ------------------
  |  |  578|    528|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1063:28): [True: 352, False: 176]
  ------------------
 1064|    352|        {
 1065|       |            /* Mobile/Fixed H */
 1066|    352|            cur_num_comp = pOneInput->nNumComponents[iInchiRec][iMobileH];
 1067|    352|            if (!cur_num_comp)
  ------------------
  |  Branch (1067:17): [True: 244, False: 108]
  ------------------
 1068|    244|            {
 1069|    244|                continue;
 1070|    244|            }
 1071|       |            /* allocate memory for all existing components */
 1072|    108|            pStruct[iInchiRec][iMobileH] = (StrFromINChI *) inchi_calloc( cur_num_comp, sizeof( pStruct[0][0][0] ) );
  ------------------
  |  | 1133|    108|#define inchi_calloc   calloc
  ------------------
 1073|    108|            if (!pStruct[iInchiRec][iMobileH])
  ------------------
  |  Branch (1073:17): [True: 0, False: 108]
  ------------------
 1074|      0|            {
 1075|      0|                ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 1076|      0|                goto exit_error;
 1077|      0|            }
 1078|       |            /* set conversion mode */
 1079|    108|            bCurI2A_Flag = ( iMobileH ? 0 : I2A_FLAG_FIXEDH ) | ( iInchiRec ? I2A_FLAG_RECMET : 0 );
  ------------------
  |  |  133|     20|#define I2A_FLAG_FIXEDH  0x0001
  ------------------
                          bCurI2A_Flag = ( iMobileH ? 0 : I2A_FLAG_FIXEDH ) | ( iInchiRec ? I2A_FLAG_RECMET : 0 );
  ------------------
  |  |  134|      0|#define I2A_FLAG_RECMET  0x0002
  ------------------
  |  Branch (1079:30): [True: 88, False: 20]
  |  Branch (1079:67): [True: 0, False: 108]
  ------------------
 1080|    108|            if (iMobileH)
  ------------------
  |  Branch (1080:17): [True: 88, False: 20]
  ------------------
 1081|     88|            {
 1082|     88|                ip->nMode &= ~REQ_MODE_BASIC;
  ------------------
  |  |   43|     88|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
 1083|     88|            }
 1084|     20|            else
 1085|     20|            {
 1086|     20|                ip->nMode |= REQ_MODE_BASIC;
  ------------------
  |  |   43|     20|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
 1087|     20|            }
 1088|       |            /* InChI --> structure conversion for all components except duplicated */
 1089|    108|            iAtNoOffset = 0;
 1090|   109k|            for (k = 0; k < cur_num_comp; k++)
  ------------------
  |  Branch (1090:25): [True: 109k, False: 108]
  ------------------
 1091|   109k|            {
 1092|       |                /* components */
 1093|   109k|                if (!iMobileH && !pOneInput->pInpInChI[iInchiRec][iMobileH][k].nNumberOfAtoms ||
  ------------------
  |  Branch (1093:21): [True: 53.8k, False: 55.5k]
  |  Branch (1093:34): [True: 53.8k, False: 20]
  ------------------
 1094|   109k|                     pOneInput->pInpInChI[iInchiRec][iMobileH][k].bDeleted ||
  ------------------
  |  Branch (1094:22): [True: 68, False: 55.4k]
  ------------------
 1095|   109k|                     pOneInput->pInpInChI[iInchiRec][iMobileH][k].nLink < 0)
  ------------------
  |  Branch (1095:22): [True: 0, False: 55.4k]
  ------------------
 1096|  53.8k|                {
 1097|  53.8k|                    pStruct[iInchiRec][iMobileH][k].nLink = pOneInput->pInpInChI[iInchiRec][iMobileH][k].nLink;
 1098|  53.8k|                    pStruct[iInchiRec][iMobileH][k].bDeleted = pOneInput->pInpInChI[iInchiRec][iMobileH][k].bDeleted;
 1099|  53.8k|                    continue; /* do not create a structure out of an unavailable
 1100|       |                                 Fixed-H InChI or out of the one present in Reconnected layer */
 1101|       |
 1102|       |#ifdef NEVER  /* a wrong attempt to process deleted components here */
 1103|       |                    if (pStruct[iInchiRec][iMobileH][k].nLink = pOneInput->pInpInChI[iInchiRec][iMobileH][k].nLink)
 1104|       |                    {
 1105|       |                        continue; /* do not create a structure out of an unavailable
 1106|       |                                     Fixed-H InChI or out of the one present in Reconnected layer */
 1107|       |                    }
 1108|       |                    else
 1109|       |                        if (iMobileH && pOneInput->pInpInChI[iInchiRec][iMobileH][k].nNumberOfAtoms &&
 1110|       |                             pOneInput->pInpInChI[iInchiRec][iMobileH][k].bDeleted &&
 1111|       |                             pOneInput->pInpInChI[iInchiRec][iMobileH][0].bDeleted)
 1112|       |                        {
 1113|       |/* all components are protons */
 1114|       |                            ;
 1115|       |                        }
 1116|       |                        else
 1117|       |                        {
 1118|       |                            continue;
 1119|       |                        }
 1120|       |#endif
 1121|       |
 1122|  53.8k|                }
 1123|  55.4k|                if (bHasSomeFixedH && iMobileH && k < pOneInput->nNumComponents[iInchiRec][TAUT_NON] &&
  ------------------
  |  |  579|  53.8k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1123:21): [True: 53.8k, False: 1.61k]
  |  Branch (1123:39): [True: 53.8k, False: 20]
  |  Branch (1123:51): [True: 53.8k, False: 0]
  ------------------
 1124|  55.4k|                     pOneInput->pInpInChI[iInchiRec][TAUT_NON][k].nNumberOfAtoms)
  ------------------
  |  |  579|  53.8k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1124:22): [True: 20, False: 53.8k]
  ------------------
 1125|     20|                {
 1126|     20|                    continue; /* do not process Mobile-H if Fixed-H is requested and exists */
 1127|     20|                }
 1128|  55.4k|                pStruct[iInchiRec][iMobileH][k].pSrm = pSrm;
 1129|  55.4k|                pStruct[iInchiRec][iMobileH][k].iInchiRec = iInchiRec;
 1130|  55.4k|                pStruct[iInchiRec][iMobileH][k].iMobileH = iMobileH;
 1131|       |
 1132|       |                /****************************************************/
 1133|       |                /*                                                  */
 1134|       |                /* Convert InChI of one component into a Structure  */
 1135|       |                /*                                                  */
 1136|       |                /****************************************************/
 1137|       |
 1138|  55.4k|                ret = InChI2Atom( ic, pCG, ip, sd, szCurHdr, num_inp, pStruct[iInchiRec][iMobileH] + k, k,
 1139|  55.4k|                                  iAtNoOffset /* 0*/, bCurI2A_Flag, bHasSomeFixedH, pOneInput );
 1140|  55.4k|                pStruct[iInchiRec][iMobileH][k].nLink = pOneInput->pInpInChI[iInchiRec][iMobileH][k].nLink;
 1141|  55.4k|                if (ret < 0)
  ------------------
  |  Branch (1141:21): [True: 838, False: 54.6k]
  ------------------
 1142|    838|                {
 1143|       |#if ( bRELEASE_VERSION != 1 )
 1144|       |#ifndef TARGET_API_LIB
 1145|       |                    /* !!! Conversion Error -- Ignore for now !!! */
 1146|       |                    fprintf( stdout, "%ld %s Conversion failed: %d, %c%c comp %d\n",
 1147|       |                        num_inp, szCurHdr ? szCurHdr : "Struct", ret, iInchiRec ? 'R' : 'D', iMobileH ? 'M' : 'F', k + 1 );
 1148|       |#endif
 1149|       |#endif
 1150|    838|                    if (ret == CT_USER_QUIT_ERR)
  ------------------
  |  |   60|    838|#define CT_USER_QUIT_ERR     (CT_ERR_FIRST-13)  /*(-30013) */
  |  |  ------------------
  |  |  |  |   46|    838|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (1150:25): [True: 0, False: 838]
  ------------------
 1151|      0|                    {
 1152|      0|                        goto exit_error;
 1153|      0|                    }
 1154|    838|                    pStruct[iInchiRec][iMobileH][k].nError = ret;
 1155|    838|                    ret = 0; /* force to ignore the errors for now !!!! */
 1156|    838|                    num_err++;
 1157|    838|                }
 1158|  55.4k|                iAtNoOffset += pOneInput->pInpInChI[iInchiRec][iMobileH][k].nNumberOfAtoms ;
 1159|  55.4k|            } /* k-th component */
 1160|    108|        }
 1161|    176|    }
 1162|       |
 1163|     88|exit_error:
 1164|     88|    ulProcessingTime += InchiTimeElapsed( ic, &ulTStart );
 1165|     88|    sd->ulStructTime += ulProcessingTime;
 1166|       |
 1167|     88|    return ret < 0 ? ret : num_err;
  ------------------
  |  Branch (1167:12): [True: 0, False: 88]
  ------------------
 1168|     88|}
AddProtonAndIsoHBalanceToMobHStruct:
 1181|     31|{
 1182|     31|    COMPONENT_REM_PROTONS nToBeRemovedByNormFromRevrs[INCHI_NUM];
 1183|     31|    int                   nRemovedByNormFromRevrs[INCHI_NUM];
 1184|     31|    int                   nRemovedByRevrs[INCHI_NUM];
 1185|       |
 1186|     31|    int   nDeltaFromDisconnected = 0, nRemovedProtonsByNormFromRevrs, nRemovedProtonsByRevrs, num_changes = 0;
 1187|     31|    NUM_H nIsoDeltaFromDisconnected[NUM_H_ISOTOPES];
 1188|     31|    int iInchiRec, i, k, k1, ret = 0;
 1189|     31|    int  nChargeInChI, nChargeRevrs;
 1190|       |
 1191|     31|    if (bHasSomeFixedH)
  ------------------
  |  Branch (1191:9): [True: 17, False: 14]
  ------------------
 1192|     17|    {
 1193|     17|        return 0; /* 2005-03-01 */
 1194|     17|    }
 1195|       |
 1196|       |    /* num protons removed by InChI Normalization from the original structure */
 1197|     42|    for (i = 0; i < INCHI_NUM; i++)
  ------------------
  |  |  574|     42|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1197:17): [True: 28, False: 14]
  ------------------
 1198|     28|    {
 1199|     28|        nToBeRemovedByNormFromRevrs[i].nNumRemovedProtons = pOneInput->nNumProtons[i][TAUT_YES].nNumRemovedProtons;
  ------------------
  |  |  580|     28|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1200|    112|        for (k = 0; k < NUM_H_ISOTOPES; k++)
  ------------------
  |  |   53|    112|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (1200:21): [True: 84, False: 28]
  ------------------
 1201|     84|        {
 1202|     84|            nToBeRemovedByNormFromRevrs[i].nNumRemovedIsotopicH[k] = pOneInput->nNumProtons[i][TAUT_YES].nNumRemovedIsotopicH[k];
  ------------------
  |  |  580|     84|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1203|     84|        }
 1204|     28|    }
 1205|       |    /* accumulate here num. protons removed by the normalization from the reversed structure */
 1206|     14|    nRemovedByNormFromRevrs[INCHI_BAS] =
  ------------------
  |  |  575|     14|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1207|     14|        nRemovedByNormFromRevrs[INCHI_REC] = 0;
  ------------------
  |  |  576|     14|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1208|     14|    nRemovedByRevrs[INCHI_REC] =
  ------------------
  |  |  576|     14|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1209|     14|        nRemovedByRevrs[INCHI_BAS] = 0;
  ------------------
  |  |  575|     14|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1210|       |        /* protons added/removed by InChI Normalization to/from Restored Structure might have been added by StructureRestore */
 1211|       |
 1212|     42|    for (iInchiRec = 0; iInchiRec < INCHI_NUM; iInchiRec++)
  ------------------
  |  |  574|     42|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1212:25): [True: 28, False: 14]
  ------------------
 1213|     28|    {
 1214|    332|        for (k = 0; k < pOneInput->nNumComponents[iInchiRec][TAUT_YES]; k++)
  ------------------
  |  |  580|    332|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1214:21): [True: 304, False: 28]
  ------------------
 1215|    304|        {
 1216|    304|            if (!bInpInchiComponentExists( pOneInput, iInchiRec, TAUT_YES, k ))
  ------------------
  |  |  580|    304|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1216:17): [True: 14, False: 290]
  ------------------
 1217|     14|            {
 1218|     14|                continue;
 1219|     14|            }
 1220|    290|            nRemovedProtonsByNormFromRevrs = 0; /* Num protons removed from the Restored Structure by InChI Normalization */
 1221|    290|            nRemovedProtonsByRevrs = 0; /* Num protons removed by the Reconstruction from the Restored Structure */
 1222|    290|            if (iInchiRec == INCHI_REC || iInchiRec == INCHI_BAS && ( k1 = pStruct[iInchiRec][TAUT_YES][k].nLink ) >= 0)
  ------------------
  |  |  576|    580|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                          if (iInchiRec == INCHI_REC || iInchiRec == INCHI_BAS && ( k1 = pStruct[iInchiRec][TAUT_YES][k].nLink ) >= 0)
  ------------------
  |  |  575|    580|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          if (iInchiRec == INCHI_REC || iInchiRec == INCHI_BAS && ( k1 = pStruct[iInchiRec][TAUT_YES][k].nLink ) >= 0)
  ------------------
  |  |  580|    290|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1222:17): [True: 0, False: 290]
  |  Branch (1222:43): [True: 290, False: 0]
  |  Branch (1222:69): [True: 290, False: 0]
  ------------------
 1223|    290|            {
 1224|       |
 1225|    290|                REV_INCHI  *pRevInChI = &pStruct[iInchiRec][TAUT_YES][k].RevInChI;
  ------------------
  |  |  580|    290|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1226|    290|                INChI_Aux  **pINChI_Aux2 = pRevInChI->pINChI_Aux[iInchiRec][0]; /* component 0*/
 1227|    290|                INChI      **pINChI_Revr = pRevInChI->pINChI[iInchiRec][0];
 1228|    290|                INChI       *pINChI_Orig = pOneInput->pInpInChI[iInchiRec][TAUT_YES] + k;
  ------------------
  |  |  580|    290|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1229|    290|                nChargeRevrs = pINChI_Revr ? pINChI_Revr[TAUT_YES]->nTotalCharge : NO_VALUE_INT;
  ------------------
  |  |  580|    290|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                              nChargeRevrs = pINChI_Revr ? pINChI_Revr[TAUT_YES]->nTotalCharge : NO_VALUE_INT;
  ------------------
  |  |   51|    290|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (1229:32): [True: 290, False: 0]
  ------------------
 1230|    290|                nChargeInChI = pINChI_Orig->nTotalCharge;
 1231|    290|                if (pINChI_Aux2)
  ------------------
  |  Branch (1231:21): [True: 290, False: 0]
  ------------------
 1232|    290|                {
 1233|    290|                    nRemovedProtonsByNormFromRevrs = pINChI_Aux2[TAUT_YES]->nNumRemovedProtons;
  ------------------
  |  |  580|    290|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1234|    290|                }
 1235|    290|                nRemovedProtonsByRevrs = pStruct[iInchiRec][TAUT_YES][k].nNumRemovedProtonsByRevrs;
  ------------------
  |  |  580|    290|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1236|    290|                pStruct[iInchiRec][TAUT_YES][k].nChargeRevrs = nChargeRevrs;
  ------------------
  |  |  580|    290|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1237|    290|                pStruct[iInchiRec][TAUT_YES][k].nChargeInChI = nChargeInChI;
  ------------------
  |  |  580|    290|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1238|    290|            }
 1239|      0|            else
 1240|      0|            {
 1241|      0|                if (0 <= ( k1 = -( 1 + pStruct[iInchiRec][TAUT_YES][k].nLink ) ))
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1241:21): [True: 0, False: 0]
  ------------------
 1242|      0|                {
 1243|      0|                    REV_INCHI  *pRevInChI = &pStruct[INCHI_REC][TAUT_YES][k1].RevInChI;
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                                  REV_INCHI  *pRevInChI = &pStruct[INCHI_REC][TAUT_YES][k1].RevInChI;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1244|      0|                    INChI_Aux  **pINChI_Aux2 = pRevInChI->pINChI_Aux[INCHI_BAS][0]; /* component 0 */
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1245|      0|                    INChI      **pINChI_Revr = pRevInChI->pINChI[INCHI_BAS][0];
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1246|      0|                    INChI       *pINChI_Orig = pOneInput->pInpInChI[INCHI_REC][TAUT_YES] + k1;
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                                  INChI       *pINChI_Orig = pOneInput->pInpInChI[INCHI_REC][TAUT_YES] + k1;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1247|      0|                    nChargeRevrs = pINChI_Revr ? pINChI_Revr[TAUT_YES]->nTotalCharge : NO_VALUE_INT;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                                  nChargeRevrs = pINChI_Revr ? pINChI_Revr[TAUT_YES]->nTotalCharge : NO_VALUE_INT;
  ------------------
  |  |   51|      0|#define NO_VALUE_INT    9999
  ------------------
  |  Branch (1247:36): [True: 0, False: 0]
  ------------------
 1248|      0|                    nChargeInChI = pINChI_Orig->nTotalCharge;
 1249|      0|                    if (pINChI_Aux2)
  ------------------
  |  Branch (1249:25): [True: 0, False: 0]
  ------------------
 1250|      0|                    {
 1251|      0|                        nRemovedProtonsByNormFromRevrs = pINChI_Aux2[TAUT_YES]->nNumRemovedProtons;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1252|      0|                    }
 1253|       |                    /* this component cannot be disconnected because it is same as in reconnected layer */
 1254|      0|                    nRemovedProtonsByRevrs = pStruct[INCHI_REC][TAUT_YES][k1].nNumRemovedProtonsByRevrs;
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                                  nRemovedProtonsByRevrs = pStruct[INCHI_REC][TAUT_YES][k1].nNumRemovedProtonsByRevrs;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1255|      0|                    pStruct[iInchiRec][TAUT_YES][k1].nChargeRevrs = nChargeRevrs;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1256|      0|                    pStruct[iInchiRec][TAUT_YES][k1].nChargeInChI = nChargeInChI;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1257|      0|                }
 1258|      0|            }
 1259|       |            /* how many protons (to be removed by InChI Normalization) to add =
 1260|       |            (proton balance in InChI} -
 1261|       |            {number of protons known to be removed by InChI Normalization from Reconstructed structure} */
 1262|    290|            nToBeRemovedByNormFromRevrs[iInchiRec].nNumRemovedProtons -= nRemovedProtonsByNormFromRevrs;
 1263|    290|            nRemovedByNormFromRevrs[iInchiRec] += nRemovedProtonsByNormFromRevrs;
 1264|    290|            nRemovedByRevrs[iInchiRec] += nRemovedProtonsByRevrs;
 1265|    290|            pStruct[iInchiRec][TAUT_YES][k].nRemovedProtonsByNormFromRevrs = nRemovedProtonsByNormFromRevrs;
  ------------------
  |  |  580|    290|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1266|    290|        }
 1267|     28|    }
 1268|       |
 1269|       |    /* Since fixed-H layer is missing we need to add proton balance to the components */
 1270|     14|    memset( nIsoDeltaFromDisconnected, 0, sizeof( nIsoDeltaFromDisconnected ) );
 1271|     42|    for (iInchiRec = INCHI_REC; INCHI_BAS <= iInchiRec; iInchiRec--)
  ------------------
  |  |  576|     14|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                  for (iInchiRec = INCHI_REC; INCHI_BAS <= iInchiRec; iInchiRec--)
  ------------------
  |  |  575|     42|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (1271:33): [True: 28, False: 14]
  ------------------
 1272|     28|    {
 1273|       |        /*
 1274|       |        if ( !pOneInput->nNumComponents[iInchiRec][TAUT_NON] &&
 1275|       |              pOneInput->nNumComponents[iInchiRec][TAUT_YES] ) {
 1276|       |        */
 1277|     28|        int bHasRecMobH = ( iInchiRec == INCHI_BAS && pOneInput->nNumComponents[INCHI_REC][TAUT_YES] );
  ------------------
  |  |  575|     56|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                      int bHasRecMobH = ( iInchiRec == INCHI_BAS && pOneInput->nNumComponents[INCHI_REC][TAUT_YES] );
  ------------------
  |  |  576|     14|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                      int bHasRecMobH = ( iInchiRec == INCHI_BAS && pOneInput->nNumComponents[INCHI_REC][TAUT_YES] );
  ------------------
  |  |  580|     14|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1277:29): [True: 14, False: 14]
  |  Branch (1277:55): [True: 0, False: 14]
  ------------------
 1278|       |        /* bHasRecMobH means all components that could not be disconnected are in reconnected part */
 1279|     28|        if (iInchiRec == INCHI_BAS)
  ------------------
  |  |  575|     28|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (1279:13): [True: 14, False: 14]
  ------------------
 1280|     14|        {
 1281|       |            /* second pass: common structures have been changed */
 1282|     14|            nToBeRemovedByNormFromRevrs[INCHI_BAS].nNumRemovedProtons += nDeltaFromDisconnected;
  ------------------
  |  |  575|     14|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1283|     14|        }
 1284|       |        /* after proton removal InChI is recalculated */
 1285|       |
 1286|     28|        ret = AddRemProtonsInRestrStruct( ic, pCG, ip, sd, num_inp, bHasSomeFixedH, pStruct[iInchiRec][TAUT_YES],
  ------------------
  |  |  580|     28|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1287|     28|                                pOneInput->nNumComponents[iInchiRec][TAUT_YES],
  ------------------
  |  |  580|     28|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1288|     28|                                bHasRecMobH ? pStruct[INCHI_REC][TAUT_YES] : NULL,
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                                              bHasRecMobH ? pStruct[INCHI_REC][TAUT_YES] : NULL,
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1288:33): [True: 0, False: 28]
  ------------------
 1289|     28|                                bHasRecMobH ? pOneInput->nNumComponents[INCHI_REC][TAUT_YES] : 0,
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                                              bHasRecMobH ? pOneInput->nNumComponents[INCHI_REC][TAUT_YES] : 0,
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1289:33): [True: 0, False: 28]
  ------------------
 1290|     28|                                &nToBeRemovedByNormFromRevrs[iInchiRec].nNumRemovedProtons,
 1291|     28|                                ( iInchiRec == INCHI_REC ) ? &nDeltaFromDisconnected : NULL );
  ------------------
  |  |  576|     28|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (1291:33): [True: 14, False: 14]
  ------------------
 1292|     28|        if (ret < 0)
  ------------------
  |  Branch (1292:13): [True: 0, False: 28]
  ------------------
 1293|      0|        {
 1294|      0|            goto exit_function;
 1295|      0|        }
 1296|     28|        num_changes += ret;
 1297|       |       /*
 1298|       |       }
 1299|       |       */
 1300|     28|    }
 1301|       |
 1302|       |    /* if fixed-H layer is missing then we need to add isotopic exchangeable proton balance to the components */
 1303|     42|    for (iInchiRec = INCHI_REC; INCHI_BAS <= iInchiRec; iInchiRec--)
  ------------------
  |  |  576|     14|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                  for (iInchiRec = INCHI_REC; INCHI_BAS <= iInchiRec; iInchiRec--)
  ------------------
  |  |  575|     42|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (1303:33): [True: 28, False: 14]
  ------------------
 1304|     28|    {
 1305|       |        /*
 1306|       |        if ( !pOneInput->nNumComponents[iInchiRec][TAUT_NON] &&
 1307|       |              pOneInput->nNumComponents[iInchiRec][TAUT_YES] ) {
 1308|       |        */
 1309|     28|        int bHasRecMobH = ( iInchiRec == INCHI_BAS && pOneInput->nNumComponents[INCHI_REC][TAUT_YES] );
  ------------------
  |  |  575|     56|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                      int bHasRecMobH = ( iInchiRec == INCHI_BAS && pOneInput->nNumComponents[INCHI_REC][TAUT_YES] );
  ------------------
  |  |  576|     14|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                      int bHasRecMobH = ( iInchiRec == INCHI_BAS && pOneInput->nNumComponents[INCHI_REC][TAUT_YES] );
  ------------------
  |  |  580|     14|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1309:29): [True: 14, False: 14]
  |  Branch (1309:55): [True: 0, False: 14]
  ------------------
 1310|       |        /* bHasRecMobH means all components that could not be disconnected are in reconnected part */
 1311|     28|        if (iInchiRec == INCHI_BAS)
  ------------------
  |  |  575|     28|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (1311:13): [True: 14, False: 14]
  ------------------
 1312|     14|        {
 1313|       |            /* second pass: common structures have been changed */
 1314|     56|            for (k = 0; k < NUM_H_ISOTOPES; k++)
  ------------------
  |  |   53|     56|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (1314:25): [True: 42, False: 14]
  ------------------
 1315|     42|            {
 1316|     42|                nToBeRemovedByNormFromRevrs[INCHI_BAS].nNumRemovedIsotopicH[k] += nIsoDeltaFromDisconnected[k];
  ------------------
  |  |  575|     42|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1317|     42|            }
 1318|     14|        }
 1319|       |
 1320|       |        /* after proton removal InChI is recalculated */
 1321|     28|        ret = AddRemIsoProtonsInRestrStruct( ic, pCG, ip, sd, num_inp, bHasSomeFixedH, pStruct[iInchiRec][TAUT_YES],
  ------------------
  |  |  580|     28|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1322|     28|                                pOneInput->nNumComponents[iInchiRec][TAUT_YES],
  ------------------
  |  |  580|     28|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1323|     28|                                bHasRecMobH ? pStruct[INCHI_REC][TAUT_YES] : NULL,
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                                              bHasRecMobH ? pStruct[INCHI_REC][TAUT_YES] : NULL,
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1323:33): [True: 0, False: 28]
  ------------------
 1324|     28|                                bHasRecMobH ? pOneInput->nNumComponents[INCHI_REC][TAUT_YES] : 0,
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                                              bHasRecMobH ? pOneInput->nNumComponents[INCHI_REC][TAUT_YES] : 0,
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1324:33): [True: 0, False: 28]
  ------------------
 1325|     28|                                nToBeRemovedByNormFromRevrs[iInchiRec].nNumRemovedIsotopicH,
 1326|     28|                                ( iInchiRec == INCHI_REC ) ? nIsoDeltaFromDisconnected : NULL );
  ------------------
  |  |  576|     28|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (1326:33): [True: 14, False: 14]
  ------------------
 1327|       |
 1328|     28|        if (ret < 0)
  ------------------
  |  Branch (1328:13): [True: 0, False: 28]
  ------------------
 1329|      0|        {
 1330|      0|            goto exit_function;
 1331|      0|        }
 1332|     28|        num_changes += ret;
 1333|       |        /*
 1334|       |        }
 1335|       |        */
 1336|     28|    }
 1337|       |
 1338|     14|exit_function:
 1339|       |
 1340|     14|    return ret;
 1341|     14|}
FreeStrFromINChI:
 1347|     88|{
 1348|     88|    int iInchiRec, iMobileH, cur_num_comp, k, j;
 1349|     88|    StrFromINChI *pStruct1;
 1350|    264|    for (iInchiRec = 0; iInchiRec < INCHI_NUM; iInchiRec++)
  ------------------
  |  |  574|    264|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1350:25): [True: 176, False: 88]
  ------------------
 1351|    176|    {
 1352|    528|        for (iMobileH = 0; iMobileH < TAUT_NUM; iMobileH++)
  ------------------
  |  |  578|    528|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1352:28): [True: 352, False: 176]
  ------------------
 1353|    352|        {
 1354|    352|            cur_num_comp = nNumComponents[iInchiRec][iMobileH];
 1355|    352|            if (!cur_num_comp || !( pStruct1 = pStruct[iInchiRec][iMobileH] ))
  ------------------
  |  Branch (1355:17): [True: 244, False: 108]
  |  Branch (1355:34): [True: 0, False: 108]
  ------------------
 1356|    244|            {
 1357|    244|                continue;
 1358|    244|            }
 1359|   109k|            for (k = 0; k < cur_num_comp; k++)
  ------------------
  |  Branch (1359:25): [True: 109k, False: 108]
  ------------------
 1360|   109k|            {
 1361|   109k|                if (pStruct1[k].at)
  ------------------
  |  Branch (1361:21): [True: 55.4k, False: 53.9k]
  ------------------
 1362|  55.4k|                {
 1363|  55.4k|                    inchi_free( pStruct1[k].at );
  ------------------
  |  | 1136|  55.4k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 55.4k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1364|  55.4k|                }
 1365|   109k|                if (pStruct1[k].at2)
  ------------------
  |  Branch (1365:21): [True: 55.4k, False: 53.9k]
  ------------------
 1366|  55.4k|                {
 1367|  55.4k|                    inchi_free( pStruct1[k].at2 );
  ------------------
  |  | 1136|  55.4k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 55.4k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1368|  55.4k|                }
 1369|   109k|                if (pStruct1[k].st)
  ------------------
  |  Branch (1369:21): [True: 0, False: 109k]
  ------------------
 1370|      0|                {
 1371|      0|                    inchi_free( pStruct1[k].st );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1372|      0|                }
 1373|   109k|                if (pStruct1[k].pVA)
  ------------------
  |  Branch (1373:21): [True: 840, False: 108k]
  ------------------
 1374|    840|                {
 1375|    840|                    inchi_free( pStruct1[k].pVA );
  ------------------
  |  | 1136|    840|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 840, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1376|    840|                }
 1377|       |                /*
 1378|       |                if ( pStruct1[k].ti.t_group ) {
 1379|       |                    inchi_free( pStruct1[k].ti.t_group );
 1380|       |                }
 1381|       |                */
 1382|   109k|                if (pStruct1[k].pXYZ)
  ------------------
  |  Branch (1382:21): [True: 0, False: 109k]
  ------------------
 1383|      0|                {
 1384|      0|                    inchi_free( pStruct1[k].pXYZ );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1385|      0|                }
 1386|       |                /*==== begin ====*/
 1387|   109k|                free_t_group_info( &pStruct1[k].ti );
 1388|   109k|                if (pStruct1[k].endpoint)
  ------------------
  |  Branch (1388:21): [True: 5, False: 109k]
  ------------------
 1389|      5|                {
 1390|      5|                    inchi_free( pStruct1[k].endpoint );
  ------------------
  |  | 1136|      5|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 5, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1391|      5|                }
 1392|   109k|                if (pStruct1[k].fixed_H)
  ------------------
  |  Branch (1392:21): [True: 5, False: 109k]
  ------------------
 1393|      5|                {
 1394|      5|                    inchi_free( pStruct1[k].fixed_H );
  ------------------
  |  | 1136|      5|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 5, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1395|      5|                }
 1396|   328k|                for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  578|   328k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1396:29): [True: 218k, False: 109k]
  ------------------
 1397|   218k|                {
 1398|   218k|                    if (pStruct1[k].nAtno2Canon[j])
  ------------------
  |  Branch (1398:25): [True: 7, False: 218k]
  ------------------
 1399|      7|                        inchi_free( pStruct1[k].nAtno2Canon[j] );
  ------------------
  |  | 1136|      7|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 7, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1400|   218k|                    if (pStruct1[k].nCanon2Atno[j])
  ------------------
  |  Branch (1400:25): [True: 7, False: 218k]
  ------------------
 1401|      7|                        inchi_free( pStruct1[k].nCanon2Atno[j] );
  ------------------
  |  | 1136|      7|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 7, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1402|   218k|                }
 1403|       |                /*===== end ======*/
 1404|       |                /*  free INChI memory */
 1405|   109k|                FreeAllINChIArrays( pStruct1[k].RevInChI.pINChI,
 1406|   109k|                                    pStruct1[k].RevInChI.pINChI_Aux,
 1407|   109k|                                    pStruct1[k].RevInChI.num_components );
 1408|       |#ifdef NEVER
 1409|       |                /* don't do that: these are just pointers to OneInput structure members */
 1410|       |                Free_INChI( &pStruct1[k].pINChI );
 1411|       |                Free_INChI_Aux( &pStruct1[k].pINChI_Aux );
 1412|       |                if (pStruct1[k].inp_norm_data)
 1413|       |                {
 1414|       |                    FreeInpAtomData( pStruct1[k].inp_norm_data );
 1415|       |                    inchi_free( pStruct1[k].inp_norm_data );
 1416|       |                }
 1417|       |#endif
 1418|   109k|            }
 1419|    108|            inchi_free( pStruct[iInchiRec][iMobileH] );
  ------------------
  |  | 1136|    108|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 108, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1420|    108|            pStruct[iInchiRec][iMobileH] = NULL;
 1421|    108|        }
 1422|    176|    }
 1423|     88|}
FreeInpInChI:
 1428|    828|{
 1429|    828|    int iINChI, k, j;
 1430|  2.48k|    for (iINChI = 0; iINChI < INCHI_NUM; iINChI++)
  ------------------
  |  |  574|  2.48k|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1430:22): [True: 1.65k, False: 828]
  ------------------
 1431|  1.65k|    {
 1432|  4.96k|        for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  578|  4.96k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1432:21): [True: 3.31k, False: 1.65k]
  ------------------
 1433|  3.31k|        {
 1434|  3.31k|            if (pOneInput->pInpInChI[iINChI][j])
  ------------------
  |  Branch (1434:17): [True: 415, False: 2.89k]
  ------------------
 1435|    415|            {
 1436|   343k|                for (k = 0; k < pOneInput->nNumComponents[iINChI][j]; k++)
  ------------------
  |  Branch (1436:29): [True: 342k, False: 415]
  ------------------
 1437|   342k|                {
 1438|   342k|                    Free_INChI_Members( &pOneInput->pInpInChI[iINChI][j][k] );
 1439|   342k|                }
 1440|    415|                inchi_free( pOneInput->pInpInChI[iINChI][j] );
  ------------------
  |  | 1136|    415|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 415, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1441|    415|                pOneInput->pInpInChI[iINChI][j] = NULL;
 1442|    415|            }
 1443|  3.31k|            if (pOneInput->nNumProtons[iINChI][j].pNumProtons)
  ------------------
  |  Branch (1443:17): [True: 10, False: 3.30k]
  ------------------
 1444|     10|            {
 1445|     10|                inchi_free( pOneInput->nNumProtons[iINChI][j].pNumProtons );
  ------------------
  |  | 1136|     10|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 10, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1446|     10|                pOneInput->nNumProtons[iINChI][j].pNumProtons = NULL;
 1447|     10|            }
 1448|  3.31k|        }
 1449|  1.65k|    }
 1450|    828|    if (pOneInput->atom)
  ------------------
  |  Branch (1450:9): [True: 0, False: 828]
  ------------------
 1451|      0|    {
 1452|      0|        inchi_free( pOneInput->atom );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1453|      0|    }
 1454|       |
 1455|    828|    FreeExtOrigAtData( pOneInput->polymer, pOneInput->v3000 );
 1456|       |
 1457|    828|    memset( pOneInput, 0, sizeof( *pOneInput ) );
 1458|    828|}
CompareAllOrigInchiToRevInChI:
 1467|     31|{
 1468|     31|    int i, iInchiRec, iMobileH, iMobileHpStruct, num_components, iComponent, ret = 0;
 1469|     31|    COMPONENT_REM_PROTONS nCurRemovedProtons, nNumRemovedProtons;
 1470|     31|    INChI     *pInChI[TAUT_NUM];
 1471|     31|    INCHI_MODE  CompareInchiFlags[TAUT_NUM];
 1472|     31|    memset( pOneInput->CompareInchiFlags[0], 0, sizeof( pOneInput->CompareInchiFlags[0] ) );
 1473|     31|    memset( &nNumRemovedProtons, 0, sizeof( nNumRemovedProtons ) );
 1474|       |
 1475|       |    /* do we have reconnected InChI ?*/
 1476|     31|    iInchiRec = INCHI_REC;
  ------------------
  |  |  576|     31|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1477|     31|    iMobileH = TAUT_NON;
  ------------------
  |  |  579|     31|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 1478|     31|    if (!pOneInput->nNumComponents[iInchiRec][TAUT_YES] && !pOneInput->nNumComponents[iInchiRec][TAUT_NON])
  ------------------
  |  |  580|     31|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  if (!pOneInput->nNumComponents[iInchiRec][TAUT_YES] && !pOneInput->nNumComponents[iInchiRec][TAUT_NON])
  ------------------
  |  |  579|     31|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1478:9): [True: 31, False: 0]
  |  Branch (1478:60): [True: 31, False: 0]
  ------------------
 1479|     31|    {
 1480|     31|        iInchiRec = INCHI_BAS;
  ------------------
  |  |  575|     31|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1481|     31|    }
 1482|       |    /* do we have Mobile or Fixed-H ? */
 1483|     31|    if (!pOneInput->nNumComponents[iInchiRec][TAUT_NON] || !bReqNonTaut)
  ------------------
  |  |  579|     31|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1483:9): [True: 14, False: 17]
  |  Branch (1483:60): [True: 0, False: 17]
  ------------------
 1484|     14|    {
 1485|     14|        iMobileH = TAUT_YES;  /* index for pOneInput */
  ------------------
  |  |  580|     14|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1486|     14|    }
 1487|       |    /* if a restored structure has Fixed-H InChI then its mobile-H restored InChI is in Fixed-H pStruct */
 1488|     31|    num_components = pOneInput->nNumComponents[iInchiRec][iMobileH];
 1489|  53.5k|    for (iComponent = 0; iComponent < num_components; iComponent++)
  ------------------
  |  Branch (1489:26): [True: 53.4k, False: 31]
  ------------------
 1490|  53.4k|    {
 1491|  53.4k|        int bMobileH = iMobileH;
 1492|  53.4k|        pInChI[0] = pInChI[1] = NULL;
 1493|  53.4k|        if (pOneInput->pInpInChI[iInchiRec][bMobileH][iComponent].nNumberOfAtoms &&
  ------------------
  |  Branch (1493:13): [True: 321, False: 53.1k]
  ------------------
 1494|  53.4k|             !pOneInput->pInpInChI[iInchiRec][bMobileH][iComponent].bDeleted)
  ------------------
  |  Branch (1494:14): [True: 307, False: 14]
  ------------------
 1495|    307|        {
 1496|       |            /* the requested InChI layer exists */
 1497|    307|            pInChI[0] = &pOneInput->pInpInChI[iInchiRec][bMobileH][iComponent];
 1498|    307|            if (bMobileH == TAUT_NON)
  ------------------
  |  |  579|    307|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1498:17): [True: 17, False: 290]
  ------------------
 1499|     17|            {
 1500|     17|                pInChI[1] = &pOneInput->pInpInChI[iInchiRec][TAUT_YES][iComponent];
  ------------------
  |  |  580|     17|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1501|     17|            }
 1502|    307|        }
 1503|  53.1k|        else
 1504|  53.1k|        {
 1505|  53.1k|            if (bMobileH == TAUT_NON &&
  ------------------
  |  |  579|   106k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1505:17): [True: 53.1k, False: 14]
  ------------------
 1506|  53.1k|                pOneInput->pInpInChI[iInchiRec][TAUT_YES][iComponent].nNumberOfAtoms &&
  ------------------
  |  |  580|  53.1k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1506:17): [True: 53.1k, False: 0]
  ------------------
 1507|  53.1k|                !pOneInput->pInpInChI[iInchiRec][TAUT_YES][iComponent].bDeleted)
  ------------------
  |  |  580|  53.1k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1507:17): [True: 53.1k, False: 0]
  ------------------
 1508|  53.1k|            {
 1509|       |                /* the requested Fixed-H InChI layer does not exist; however, the Mobile-H does exist */
 1510|  53.1k|                bMobileH = TAUT_YES; /* only Mobile-H is available */
  ------------------
  |  |  580|  53.1k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1511|  53.1k|                pInChI[0] = &pOneInput->pInpInChI[iInchiRec][bMobileH][iComponent];
 1512|  53.1k|            }
 1513|  53.1k|        }
 1514|  53.4k|        memset( CompareInchiFlags, 0, sizeof( CompareInchiFlags ) );
 1515|  53.4k|        memset( &nCurRemovedProtons, 0, sizeof( nCurRemovedProtons ) );
 1516|  53.4k|        iMobileHpStruct =
 1517|       |#if ( bRELEASE_VERSION == 0 )
 1518|       |#ifndef TARGET_API_LIB
 1519|       |        /* legacy: reproduce old output */
 1520|       |            OldPrintCompareOneOrigInchiToRevInChI( pStruct[iInchiRec][bMobileH] + iComponent, pInChI, bMobileH,
 1521|       |                                                  iComponent, num_inp, szCurHdr );
 1522|       |#endif
 1523|       |#endif
 1524|       |        /* one component comparison result bits */
 1525|  53.4k|        ret = CompareOneOrigInchiToRevInChI( pStruct[iInchiRec][bMobileH] + iComponent, pInChI, bMobileH, iComponent,
 1526|  53.4k|                                             num_inp, szCurHdr, &nCurRemovedProtons, CompareInchiFlags );
 1527|  53.4k|        if (ret >= 0)
  ------------------
  |  Branch (1527:13): [True: 53.4k, False: 0]
  ------------------
 1528|  53.4k|        {
 1529|       |            /* no errors encountered -> accumulate removed protons from individual Mobile-H layers of components */
 1530|  53.4k|            nNumRemovedProtons.nNumRemovedProtons += nCurRemovedProtons.nNumRemovedProtons;
 1531|   213k|            for (i = 0; i < NUM_H_ISOTOPES; i++)
  ------------------
  |  |   53|   213k|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (1531:25): [True: 160k, False: 53.4k]
  ------------------
 1532|   160k|            {
 1533|   160k|                nNumRemovedProtons.nNumRemovedIsotopicH[i] += nCurRemovedProtons.nNumRemovedIsotopicH[i];
 1534|   160k|            }
 1535|       |            /* accumulate compare bits */
 1536|   160k|            for (i = 0; i < TAUT_NUM; i++)
  ------------------
  |  |  578|   160k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1536:25): [True: 106k, False: 53.4k]
  ------------------
 1537|   106k|            {
 1538|   106k|                pOneInput->CompareInchiFlags[0][i] |= CompareInchiFlags[i];
 1539|   106k|            }
 1540|  53.4k|        }
 1541|      0|        else
 1542|      0|        {
 1543|      0|            goto exit_function;
 1544|      0|        }
 1545|  53.4k|    }
 1546|     31|    if (iMobileH == TAUT_YES)
  ------------------
  |  |  580|     31|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1546:9): [True: 14, False: 17]
  ------------------
 1547|     14|    {
 1548|     14|        if (pOneInput->nNumProtons[iInchiRec][iMobileH].pNumProtons)
  ------------------
  |  Branch (1548:13): [True: 0, False: 14]
  ------------------
 1549|      0|        {
 1550|      0|            ret = RI_ERR_PROGR; /* in Mobile-H case proton balances are split between compoments */
  ------------------
  |  |   45|      0|#define RI_ERR_PROGR   (-3)
  ------------------
 1551|      0|        }
 1552|     14|        else
 1553|     14|        {
 1554|       |             /*   num removed protons in orig. InChI      num removed protons in restored InChi */
 1555|     14|            if (nNumRemovedProtons.nNumRemovedProtons != pOneInput->nNumProtons[iInchiRec][iMobileH].nNumRemovedProtons)
  ------------------
  |  Branch (1555:17): [True: 0, False: 14]
  ------------------
 1556|      0|            {
 1557|       |                /* restored structure InChI has less or more removed protons */
 1558|      0|                pOneInput->CompareInchiFlags[0][TAUT_YES] |= INCHIDIFF_MOBH_PROTONS;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1559|       |#if ( bRELEASE_VERSION == 0 )
 1560|       |                /* debug output only */
 1561|       |                {
 1562|       |                    int num_H_AddedByRevrs = pOneInput->nNumProtons[iInchiRec][iMobileH].nNumRemovedProtons
 1563|       |                        - nNumRemovedProtons.nNumRemovedProtons;
 1564|       |                    fprintf( stdout, "COMPARE_INCHI: %ld: %s %cM: Proton balance (Diff: %d, RevrsRem=%d)\n",
 1565|       |                        num_inp, szCurHdr ? szCurHdr : "Struct", iInchiRec ? 'R' : 'D',
 1566|       |                        pOneInput->nNumProtons[iInchiRec][iMobileH].nNumRemovedProtons, num_H_AddedByRevrs );
 1567|       |                }
 1568|       |#endif
 1569|      0|            }
 1570|     56|            for (i = 0; i < NUM_H_ISOTOPES; i++)
  ------------------
  |  |   53|     56|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (1570:25): [True: 42, False: 14]
  ------------------
 1571|     42|            {
 1572|     42|                if (nNumRemovedProtons.nNumRemovedIsotopicH[i] != pOneInput->nNumProtons[iInchiRec][TAUT_YES].nNumRemovedIsotopicH[i])
  ------------------
  |  |  580|     42|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1572:21): [True: 0, False: 42]
  ------------------
 1573|      0|                {
 1574|      0|                    pOneInput->CompareInchiFlags[0][TAUT_YES] |= INCHIDIFF_MOB_ISO_H;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1575|       |#if ( bRELEASE_VERSION == 0 )
 1576|       |                    /* debug output only */
 1577|       |                    {
 1578|       |                        int num_H_AddedByRevrs = pOneInput->nNumProtons[iInchiRec][TAUT_YES].nNumRemovedIsotopicH[i]
 1579|       |                            - nNumRemovedProtons.nNumRemovedIsotopicH[i];
 1580|       |                        fprintf( stdout, "COMPARE_INCHI: %ld: %s %cM: Iso Xchg %dH balance (Diff: %d, RevrsRem=%d)\n",
 1581|       |                            num_inp, szCurHdr ? szCurHdr : "Struct", iInchiRec ? 'R' : 'D', i + 1,
 1582|       |                            pOneInput->nNumProtons[iInchiRec][TAUT_YES].nNumRemovedIsotopicH[i], num_H_AddedByRevrs );
 1583|       |                    }
 1584|       |#endif
 1585|      0|                }
 1586|     42|            }
 1587|     14|        }
 1588|     14|    }
 1589|       |
 1590|     31|exit_function:
 1591|       |
 1592|     31|    return ret;
 1593|     31|}
CompareAllDisconnectedOrigInchiToRevInChI:
 1602|     31|{
 1603|     31|    int i, k, m, n, iInChI, iMobileH, bMobileH, ifk;
 1604|     31|    int num_components_D, num_components_R;
 1605|     31|    int nNumCompHaveSeparateProtons_D, nNumCompHaveSeparateProtons_R;
 1606|     31|    int num_fragments_D, num_fragments_R, num_fragments_DR, num_fragments, iComponent, ret;
 1607|     31|    int ifInChI, ifMobileH, bfMobileH, nLink;
 1608|     31|    COMPONENT_REM_PROTONS nNumRemovedProtons_D;     /* removed from the disconnected layer of the Input InChI */
 1609|     31|    COMPONENT_REM_PROTONS nNumRemovedProtons_D_all; /* if only totals are avalable */
 1610|     31|    COMPONENT_REM_PROTONS nNumRemovedProtons_R; /* removed from disconnected layer of the reconstructed struct */
 1611|     31|    COMPONENT_REM_PROTONS nNumRemovedProtons_R_all;
 1612|     31|    INCHI_MODE  CompareInchiFlags[TAUT_NUM];
 1613|     31|    StrFromINChI *pStruct1;
 1614|     31|    INChI_Aux *pINChI_Aux;
 1615|     31|    INCHI_SORT *pINChISort1 = NULL; /* from reversed structure */
 1616|     31|    INCHI_SORT *pINChISort2 = NULL; /* original input InChI */
 1617|     31|    int        nNumNonTaut1 = 0, nNumNonTaut2 = 0;
 1618|       |
 1619|     31|    ret = 0;
 1620|     31|    memset( pOneInput->CompareInchiFlags[1], 0, sizeof( pOneInput->CompareInchiFlags[1] ) );
 1621|       |
 1622|       |    /* count components that are not subject to disconnection */
 1623|     31|    if (!pOneInput->nNumComponents[INCHI_REC][TAUT_YES] &&
  ------------------
  |  |  576|     31|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                  if (!pOneInput->nNumComponents[INCHI_REC][TAUT_YES] &&
  ------------------
  |  |  580|     31|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1623:9): [True: 31, False: 0]
  ------------------
 1624|     31|         !pOneInput->nNumComponents[INCHI_REC][TAUT_NON])
  ------------------
  |  |  576|     31|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                       !pOneInput->nNumComponents[INCHI_REC][TAUT_NON])
  ------------------
  |  |  579|     31|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1624:10): [True: 31, False: 0]
  ------------------
 1625|     31|    {
 1626|     31|        return 0; /* nothing to do */
 1627|     31|    }
 1628|       |
 1629|      0|    memset( &nNumRemovedProtons_D, 0, sizeof( nNumRemovedProtons_D ) );
 1630|      0|    memset( &nNumRemovedProtons_R, 0, sizeof( nNumRemovedProtons_R ) );
 1631|      0|    memset( &nNumRemovedProtons_D_all, 0, sizeof( nNumRemovedProtons_D_all ) );
 1632|      0|    memset( &nNumRemovedProtons_R_all, 0, sizeof( nNumRemovedProtons_R_all ) );
 1633|      0|    memset( CompareInchiFlags, 0, sizeof( CompareInchiFlags ) );
 1634|       |
 1635|      0|    num_components_D = inchi_max( pOneInput->nNumComponents[INCHI_BAS][TAUT_YES],
  ------------------
  |  |  166|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1636|      0|                                  pOneInput->nNumComponents[INCHI_BAS][TAUT_NON] );
 1637|      0|    num_components_R = inchi_max( pOneInput->nNumComponents[INCHI_REC][TAUT_YES],
  ------------------
  |  |  166|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1638|      0|                                  pOneInput->nNumComponents[INCHI_REC][TAUT_NON] );
 1639|       |
 1640|       |    /***********************************************************************************************/
 1641|       |    /* InpInChI: count fragments -- disconnected components that do not match reconnected          */
 1642|       |    /* Accumulate removed H and isotopic H from ALL Fixed-H disconnected components except deleted */
 1643|       |    /* This segment collects info from the original InChI                                          */
 1644|       |    /***********************************************************************************************/
 1645|       |    /*---- Original InChI ----*/
 1646|       |
 1647|      0|    num_fragments_D = 0;
 1648|      0|    iInChI = INCHI_BAS;
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1649|      0|    iMobileH = bHasSomeFixedH ? !pOneInput->nNumComponents[iInChI][TAUT_NON] : TAUT_YES;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                  iMobileH = bHasSomeFixedH ? !pOneInput->nNumComponents[iInChI][TAUT_NON] : TAUT_YES;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1649:16): [True: 0, False: 0]
  ------------------
 1650|      0|    nNumCompHaveSeparateProtons_D = 0;
 1651|       |
 1652|       |    /* in case of Mobile-H components here are the proton totals from the original InChI disconn. layer */
 1653|      0|    nNumRemovedProtons_D.nNumRemovedProtons = pOneInput->nNumProtons[iInChI][TAUT_YES].nNumRemovedProtons;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1654|      0|    memcpy( nNumRemovedProtons_D.nNumRemovedIsotopicH,
 1655|      0|            pOneInput->nNumProtons[iInChI][TAUT_YES].nNumRemovedIsotopicH,
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1656|      0|            sizeof( nNumRemovedProtons_D.nNumRemovedIsotopicH ) ); /* total for the disconnected layer */
 1657|       |
 1658|      0|    for (k = 0; k < num_components_D; k++)
  ------------------
  |  Branch (1658:17): [True: 0, False: 0]
  ------------------
 1659|      0|    {
 1660|      0|        bMobileH = iMobileH;
 1661|      0|        if (!bInpInchiComponentExists( pOneInput, iInChI, bMobileH, k ))
  ------------------
  |  Branch (1661:13): [True: 0, False: 0]
  ------------------
 1662|      0|        {
 1663|      0|            if (bInpInchiComponentExists( pOneInput, iInChI, TAUT_YES, k ))
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1663:17): [True: 0, False: 0]
  ------------------
 1664|      0|            {
 1665|      0|                bMobileH = TAUT_YES;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1666|      0|            }
 1667|      0|            else
 1668|      0|            {
 1669|      0|                continue; /* component is missing ??? */
 1670|      0|            }
 1671|      0|        }
 1672|      0|        if (0 > ( nLink = pOneInput->pInpInChI[iInChI][bMobileH][k].nLink ))
  ------------------
  |  Branch (1672:13): [True: 0, False: 0]
  ------------------
 1673|      0|        {
 1674|       |            /* component in Disconnected layer is linked to the identical one in the Reconnected layer */
 1675|      0|            if (pOneInput->nNumProtons[INCHI_REC][TAUT_YES].pNumProtons)
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                          if (pOneInput->nNumProtons[INCHI_REC][TAUT_YES].pNumProtons)
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1675:17): [True: 0, False: 0]
  ------------------
 1676|      0|            {
 1677|      0|                nNumCompHaveSeparateProtons_D++;
 1678|      0|                nLink = -( 1 + nLink );
 1679|      0|                nNumRemovedProtons_D.nNumRemovedProtons += pOneInput->nNumProtons[INCHI_REC][TAUT_YES].pNumProtons[nLink].nNumRemovedProtons;
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                              nNumRemovedProtons_D.nNumRemovedProtons += pOneInput->nNumProtons[INCHI_REC][TAUT_YES].pNumProtons[nLink].nNumRemovedProtons;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1680|      0|                for (m = 0; m < NUM_H_ISOTOPES; m++)
  ------------------
  |  |   53|      0|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (1680:29): [True: 0, False: 0]
  ------------------
 1681|      0|                {
 1682|      0|                    nNumRemovedProtons_D.nNumRemovedIsotopicH[m] += pOneInput->nNumProtons[INCHI_REC][TAUT_YES].pNumProtons[nLink].nNumRemovedIsotopicH[m];
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                                  nNumRemovedProtons_D.nNumRemovedIsotopicH[m] += pOneInput->nNumProtons[INCHI_REC][TAUT_YES].pNumProtons[nLink].nNumRemovedIsotopicH[m];
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1683|      0|                }
 1684|      0|            }
 1685|      0|            continue; /* same as reconnected */
 1686|      0|        }
 1687|       |        /* component in the reconnected layer that was disconnected */
 1688|      0|        nNumNonTaut2 += ( bMobileH == TAUT_NON );
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 1689|      0|        if (pOneInput->nNumProtons[iInChI][TAUT_YES].pNumProtons)
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1689:13): [True: 0, False: 0]
  ------------------
 1690|      0|        {
 1691|      0|            nNumCompHaveSeparateProtons_D++;
 1692|      0|            nNumRemovedProtons_D.nNumRemovedProtons += pOneInput->nNumProtons[iInChI][TAUT_YES].pNumProtons[k].nNumRemovedProtons;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1693|      0|            for (m = 0; m < NUM_H_ISOTOPES; m++)
  ------------------
  |  |   53|      0|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (1693:25): [True: 0, False: 0]
  ------------------
 1694|      0|            {
 1695|      0|                nNumRemovedProtons_D.nNumRemovedIsotopicH[m] += pOneInput->nNumProtons[iInChI][TAUT_YES].pNumProtons[k].nNumRemovedIsotopicH[m];
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1696|      0|            }
 1697|      0|        }
 1698|      0|        num_fragments_D++; /* number of disconnected fragments from original reconnected structure */
 1699|      0|    }
 1700|       |    /* in case of Mobile-H components here are the proton totals from the original InChI */
 1701|       |    /*
 1702|       |    nNumRemovedProtons_D_all.nNumRemovedProtons = pOneInput->nNumProtons[iInChI][TAUT_YES].nNumRemovedProtons;
 1703|       |    memcpy( nNumRemovedProtons_D_all.nNumRemovedIsotopicH,
 1704|       |            pOneInput->nNumProtons[iInChI][TAUT_YES].nNumRemovedIsotopicH,
 1705|       |            sizeof(nNumRemovedProtons_D_all.nNumRemovedIsotopicH) );
 1706|       |
 1707|       |    */
 1708|       |    /****************************************************************************************************/
 1709|       |    /* count fragments in reconstructed reconnected structure                                           */
 1710|       |    /* accumulate removed H and isotopic H from ALL reconstructed reconnected components except deleted */
 1711|       |    /* This segment collects info from the reconstructed structure InChI                                */
 1712|       |    /****************************************************************************************************/
 1713|       |    /*---- InChI from the reconstructed reconnected structure ----*/
 1714|      0|    num_fragments_R = 0;
 1715|      0|    iInChI = INCHI_REC;
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1716|      0|    iMobileH = bHasSomeFixedH ? !pOneInput->nNumComponents[iInChI][TAUT_NON] : TAUT_YES;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                  iMobileH = bHasSomeFixedH ? !pOneInput->nNumComponents[iInChI][TAUT_NON] : TAUT_YES;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1716:16): [True: 0, False: 0]
  ------------------
 1717|      0|    nNumCompHaveSeparateProtons_R = 0;
 1718|      0|    for (k = 0; k < num_components_R; k++)
  ------------------
  |  Branch (1718:17): [True: 0, False: 0]
  ------------------
 1719|      0|    {
 1720|      0|        bMobileH = iMobileH;
 1721|      0|        if (!bInpInchiComponentExists( pOneInput, iInChI, bMobileH, k ))
  ------------------
  |  Branch (1721:13): [True: 0, False: 0]
  ------------------
 1722|      0|        {
 1723|      0|            if (bInpInchiComponentExists( pOneInput, iInChI, TAUT_YES, k ))
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1723:17): [True: 0, False: 0]
  ------------------
 1724|      0|            {
 1725|      0|                bMobileH = TAUT_YES;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1726|      0|            }
 1727|      0|            else
 1728|      0|            {
 1729|      0|                continue; /* component is missing ??? (Deleted proton in Mobile-H layer) */
 1730|      0|            }
 1731|      0|        }
 1732|      0|        if (0 < pOneInput->pInpInChI[iInChI][bMobileH][k].nLink)
  ------------------
  |  Branch (1732:13): [True: 0, False: 0]
  ------------------
 1733|      0|        {
 1734|       |            /* this reconstructed reconnected component was NOT DISCONNECTED */
 1735|       |            /* same component is in the disconnected layer, it has no metal atoms or is an isolated metal atom */
 1736|      0|            pStruct1 = pStruct[iInChI][bMobileH] + k;
 1737|      0|            ifMobileH = TAUT_YES;  /* Mobile-H Aux_Info contains number removed protons */
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1738|      0|            ifInChI = INCHI_BAS; /* this component cannot be reconnected */
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1739|      0|            ifk = 0;         /* 0th component since it is InChI of a single component */
 1740|       |            /* The statement in the following line is *WRONG*, component number mixed with bMobileH:  */
 1741|       |            /* in RevInchi, when only Mobile-H is present then its only non-NULL InChI has index 0==TAUT_NON */
 1742|      0|            if (bRevInchiComponentExists( pStruct1, ifInChI, ifMobileH, ifk ))
  ------------------
  |  Branch (1742:17): [True: 0, False: 0]
  ------------------
 1743|      0|            {
 1744|       |                /* count protons */
 1745|      0|                pINChI_Aux = pStruct1->RevInChI.pINChI_Aux[ifInChI][ifk][ifMobileH];
 1746|      0|                if (pINChI_Aux)
  ------------------
  |  Branch (1746:21): [True: 0, False: 0]
  ------------------
 1747|      0|                {
 1748|      0|                    nNumRemovedProtons_R.nNumRemovedProtons += pINChI_Aux->nNumRemovedProtons;
 1749|      0|                    for (m = 0; m < NUM_H_ISOTOPES; m++)
  ------------------
  |  |   53|      0|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (1749:33): [True: 0, False: 0]
  ------------------
 1750|      0|                    {
 1751|      0|                        nNumRemovedProtons_R.nNumRemovedIsotopicH[m] += pINChI_Aux->nNumRemovedIsotopicH[m];
 1752|      0|                    }
 1753|      0|                }
 1754|      0|            }
 1755|      0|            nNumCompHaveSeparateProtons_R += bRevInchiComponentExists( pStruct1, ifInChI, ALT_TAUT( ifMobileH ), ifk );
  ------------------
  |  |  582|      0|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (582:29): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1756|      0|            continue; /* same as disconnected, has no metal atoms */
 1757|      0|        }
 1758|       |        /* this reconstructed reconnected component WAS DISCONNECTED; check its fragments */
 1759|       |        /* it does not have same component in the disconnected layer */
 1760|      0|        pStruct1 = pStruct[iInChI][bMobileH] + k;
 1761|      0|        num_fragments = pStruct1->RevInChI.num_components[INCHI_BAS];
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1762|      0|        ifInChI = INCHI_BAS; /* disconnected layer */
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1763|      0|        ifMobileH = bHasSomeFixedH ? TAUT_NON : TAUT_YES;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                      ifMobileH = bHasSomeFixedH ? TAUT_NON : TAUT_YES;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1763:21): [True: 0, False: 0]
  ------------------
 1764|      0|        for (ifk = 0; ifk < num_fragments; ifk++)
  ------------------
  |  Branch (1764:23): [True: 0, False: 0]
  ------------------
 1765|      0|        {
 1766|      0|            bfMobileH = ifMobileH;
 1767|      0|            if (!bRevInchiComponentExists( pStruct1, ifInChI, bfMobileH, ifk ))
  ------------------
  |  Branch (1767:17): [True: 0, False: 0]
  ------------------
 1768|      0|            {
 1769|      0|                if (bRevInchiComponentExists( pStruct1, ifInChI, TAUT_YES, ifk ))
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1769:21): [True: 0, False: 0]
  ------------------
 1770|      0|                {
 1771|      0|                    bfMobileH = TAUT_YES;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1772|      0|                }
 1773|      0|                else
 1774|      0|                {
 1775|      0|                    continue; /* fragment does not exist ??? */
 1776|      0|                }
 1777|      0|            }
 1778|      0|            nNumNonTaut1 += ( bfMobileH == TAUT_NON );
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 1779|      0|            nNumCompHaveSeparateProtons_R += ( bfMobileH == TAUT_NON );
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 1780|       |            /* count protons from fragments made by metal disconnection */
 1781|      0|            pINChI_Aux = pStruct1->RevInChI.pINChI_Aux[ifInChI][ifk][TAUT_YES];
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1782|      0|            if (pINChI_Aux)
  ------------------
  |  Branch (1782:17): [True: 0, False: 0]
  ------------------
 1783|      0|            {
 1784|      0|                nNumRemovedProtons_R.nNumRemovedProtons += pINChI_Aux->nNumRemovedProtons;
 1785|      0|                for (m = 0; m < NUM_H_ISOTOPES; m++)
  ------------------
  |  |   53|      0|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (1785:29): [True: 0, False: 0]
  ------------------
 1786|      0|                {
 1787|      0|                    nNumRemovedProtons_R.nNumRemovedIsotopicH[m] += pINChI_Aux->nNumRemovedIsotopicH[m];
 1788|      0|                }
 1789|      0|            }
 1790|      0|            num_fragments_R++; /* number of disconnected fragments from reconstructed reconnected structure */
 1791|      0|        }
 1792|      0|    }
 1793|       |
 1794|       |    /*---------------- special treatment of the last reconstructed component -----------------*/
 1795|       |    /*---------------- this may contain separate protons added by the reconstruction ---------*/
 1796|      0|    k = num_components_R - 1;
 1797|      0|    pStruct1 = pStruct[iInChI][iMobileH] + k;
 1798|      0|    if (iMobileH == TAUT_YES && !bHasSomeFixedH &&
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1798:9): [True: 0, False: 0]
  |  Branch (1798:33): [True: 0, False: 0]
  ------------------
 1799|      0|         bInpInchiComponentDeleted( pOneInput, iInChI, iMobileH, k ) &&
  ------------------
  |  Branch (1799:10): [True: 0, False: 0]
  ------------------
 1800|      0|         ( num_fragments = pStruct1->RevInChI.num_components[INCHI_BAS] ))
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (1800:10): [True: 0, False: 0]
  ------------------
 1801|      0|    {
 1802|       |
 1803|      0|        ifInChI = INCHI_BAS; /* disconnected layer */
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1804|      0|        ifMobileH = TAUT_YES;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1805|      0|        for (ifk = 0; ifk < num_fragments; ifk++)
  ------------------
  |  Branch (1805:23): [True: 0, False: 0]
  ------------------
 1806|      0|        {
 1807|      0|            bfMobileH = ifMobileH;
 1808|      0|            if (!bRevInchiComponentDeleted( pStruct1, ifInChI, bfMobileH, ifk ))
  ------------------
  |  Branch (1808:17): [True: 0, False: 0]
  ------------------
 1809|      0|            {
 1810|      0|                continue; /* fragment does exist ??? Should not happen */
 1811|      0|            }
 1812|       |            /*
 1813|       |            nNumNonTaut1           += (bfMobileH == TAUT_NON);
 1814|       |            nNumCompHaveSeparateProtons_R += (bfMobileH == TAUT_NON);
 1815|       |            */
 1816|       |            /* count protons from fragments made by metal disconnection */
 1817|      0|            pINChI_Aux = pStruct1->RevInChI.pINChI_Aux[ifInChI][ifk][TAUT_YES];
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1818|      0|            if (pINChI_Aux)
  ------------------
  |  Branch (1818:17): [True: 0, False: 0]
  ------------------
 1819|      0|            {
 1820|      0|                nNumRemovedProtons_R.nNumRemovedProtons += pINChI_Aux->nNumRemovedProtons;
 1821|      0|                for (m = 0; m < NUM_H_ISOTOPES; m++)
  ------------------
  |  |   53|      0|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (1821:29): [True: 0, False: 0]
  ------------------
 1822|      0|                {
 1823|      0|                    nNumRemovedProtons_R.nNumRemovedIsotopicH[m] += pINChI_Aux->nNumRemovedIsotopicH[m];
 1824|      0|                }
 1825|      0|            }
 1826|       |            /*num_fragments_R ++;*/ /* number of disconnected fragments from reconstructed reconnected structure */
 1827|      0|        }
 1828|      0|    }
 1829|       |
 1830|      0|    num_fragments_DR = inchi_max( num_fragments_D, num_fragments_R );
  ------------------
  |  |  166|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1831|       |    /* in case of correct reconstruction, num_fragments_D, num_fragments_R */
 1832|      0|    if (!num_fragments_DR)
  ------------------
  |  Branch (1832:9): [True: 0, False: 0]
  ------------------
 1833|      0|    {
 1834|      0|        return 0; /* no component was disconnected */
 1835|      0|    }
 1836|      0|    if (num_fragments_D != num_fragments_R)
  ------------------
  |  Branch (1836:9): [True: 0, False: 0]
  ------------------
 1837|      0|    {
 1838|      0|        for (i = 0; i < TAUT_NUM; i++)
  ------------------
  |  |  578|      0|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1838:21): [True: 0, False: 0]
  ------------------
 1839|      0|        {
 1840|      0|            if (pOneInput->nNumComponents[INCHI_BAS][i])
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (1840:17): [True: 0, False: 0]
  ------------------
 1841|      0|            {
 1842|      0|                pOneInput->CompareInchiFlags[1][i] |= INCHIDIFF_PROBLEM;
 1843|      0|            }
 1844|      0|        }
 1845|      0|        return 1; /* severe error */
 1846|      0|    }
 1847|       |
 1848|      0|    pINChISort1 = (INCHI_SORT *) inchi_calloc( num_fragments_DR, sizeof( pINChISort1[0] ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 1849|      0|    pINChISort2 = (INCHI_SORT *) inchi_calloc( num_fragments_DR, sizeof( pINChISort2[0] ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 1850|      0|    if (!pINChISort1 || !pINChISort2)
  ------------------
  |  Branch (1850:9): [True: 0, False: 0]
  |  Branch (1850:25): [True: 0, False: 0]
  ------------------
 1851|      0|    {
 1852|      0|        ret = RI_ERR_ALLOC;
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 1853|      0|        goto exit_function;
 1854|      0|    }
 1855|       |
 1856|       |    /* accumulate original InChI of fragments -- disconnected components that do not match reconnected */
 1857|      0|    iInChI = INCHI_BAS;
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1858|      0|    iMobileH = bHasSomeFixedH ? !pOneInput->nNumComponents[iInChI][TAUT_NON] : TAUT_YES;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                  iMobileH = bHasSomeFixedH ? !pOneInput->nNumComponents[iInChI][TAUT_NON] : TAUT_YES;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1858:16): [True: 0, False: 0]
  ------------------
 1859|      0|    for (k = n = 0; k < num_components_D; k++)
  ------------------
  |  Branch (1859:21): [True: 0, False: 0]
  ------------------
 1860|      0|    {
 1861|      0|        bMobileH = iMobileH;
 1862|      0|        if (!bInpInchiComponentExists( pOneInput, iInChI, bMobileH, k ))
  ------------------
  |  Branch (1862:13): [True: 0, False: 0]
  ------------------
 1863|      0|        {
 1864|      0|            if (bInpInchiComponentExists( pOneInput, iInChI, TAUT_YES, k ))
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1864:17): [True: 0, False: 0]
  ------------------
 1865|      0|            {
 1866|      0|                bMobileH = TAUT_YES;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1867|      0|            }
 1868|      0|            else
 1869|      0|            {
 1870|      0|                continue; /* component is missing ??? (Deleted proton in Mobile-H layer) */
 1871|      0|            }
 1872|      0|        }
 1873|      0|        if (0 > pOneInput->pInpInChI[iInChI][bMobileH][k].nLink)
  ------------------
  |  Branch (1873:13): [True: 0, False: 0]
  ------------------
 1874|      0|        {
 1875|      0|            continue; /* same as reconnected */
 1876|      0|        }
 1877|       |        /* the component exists in disconnected layer of the orig. InChI only: it is a fragment */
 1878|      0|        pINChISort2[n].pINChI[bMobileH] = pOneInput->pInpInChI[iInChI][bMobileH] + k;
 1879|      0|        if (bMobileH == TAUT_NON &&
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1879:13): [True: 0, False: 0]
  ------------------
 1880|      0|            ( bInpInchiComponentExists( pOneInput, iInChI, TAUT_YES, k ) ||
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1880:15): [True: 0, False: 0]
  ------------------
 1881|      0|                bInpInchiComponentDeleted( pOneInput, iInChI, TAUT_YES, k ) ))
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1881:17): [True: 0, False: 0]
  ------------------
 1882|      0|        {
 1883|      0|            pINChISort2[n].pINChI[TAUT_YES] = pOneInput->pInpInChI[iInChI][TAUT_YES] + k;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                          pINChISort2[n].pINChI[TAUT_YES] = pOneInput->pInpInChI[iInChI][TAUT_YES] + k;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1884|      0|        }
 1885|       |        /* the last sort key is a number of removed protons */
 1886|      0|        pINChISort2[n].ord_number = pOneInput->nNumProtons[iInChI][TAUT_YES].pNumProtons ?
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1886:37): [True: 0, False: 0]
  ------------------
 1887|      0|            pOneInput->nNumProtons[iInChI][TAUT_YES].pNumProtons[k].nNumRemovedProtons : 0;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1888|      0|        pINChISort2[n].n1 = k;  /* orig. InChI disconnected layer component number */
 1889|      0|        pINChISort2[n].n2 = -1; /* no fragment index */
 1890|      0|        n++;
 1891|      0|    }
 1892|       |
 1893|       |    /* accumulate fragments from the reconstructed structure */
 1894|      0|    iInChI = INCHI_REC;
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 1895|      0|    iMobileH = bHasSomeFixedH ? !pOneInput->nNumComponents[iInChI][TAUT_NON] : TAUT_YES;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                  iMobileH = bHasSomeFixedH ? !pOneInput->nNumComponents[iInChI][TAUT_NON] : TAUT_YES;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1895:16): [True: 0, False: 0]
  ------------------
 1896|      0|    for (k = n = 0; k < num_components_R; k++)
  ------------------
  |  Branch (1896:21): [True: 0, False: 0]
  ------------------
 1897|      0|    {
 1898|      0|        bMobileH = iMobileH;
 1899|      0|        if (!bInpInchiComponentExists( pOneInput, iInChI, bMobileH, k ))
  ------------------
  |  Branch (1899:13): [True: 0, False: 0]
  ------------------
 1900|      0|        {
 1901|      0|            if (bInpInchiComponentExists( pOneInput, iInChI, TAUT_YES, k ))
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1901:17): [True: 0, False: 0]
  ------------------
 1902|      0|            {
 1903|      0|                bMobileH = TAUT_YES;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1904|      0|            }
 1905|      0|            else
 1906|      0|            {
 1907|      0|                continue; /* component is missing ??? (Deleted proton in Mobile-H layer) */
 1908|      0|            }
 1909|      0|        }
 1910|       |        /* the reconstructed structure */
 1911|      0|        if (0 < pOneInput->pInpInChI[iInChI][bMobileH][k].nLink)
  ------------------
  |  Branch (1911:13): [True: 0, False: 0]
  ------------------
 1912|      0|        {
 1913|      0|            continue; /* same as disconnected, has no metal atoms */
 1914|      0|        }
 1915|       |        /* this reconstructed structure was disconnected */
 1916|      0|        pStruct1 = pStruct[iInChI][bMobileH] + k;
 1917|      0|        num_fragments = pStruct1->RevInChI.num_components[INCHI_BAS];
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1918|      0|        ifInChI = INCHI_BAS;
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1919|      0|        ifMobileH = bHasSomeFixedH ? TAUT_NON : TAUT_YES;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                      ifMobileH = bHasSomeFixedH ? TAUT_NON : TAUT_YES;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1919:21): [True: 0, False: 0]
  ------------------
 1920|      0|        for (i = 0; i < num_fragments; i++)
  ------------------
  |  Branch (1920:21): [True: 0, False: 0]
  ------------------
 1921|      0|        {
 1922|      0|            bfMobileH = ifMobileH;
 1923|      0|            if (!bRevInchiComponentExists( pStruct1, ifInChI, bfMobileH, i ))
  ------------------
  |  Branch (1923:17): [True: 0, False: 0]
  ------------------
 1924|      0|            {
 1925|      0|                if (bRevInchiComponentExists( pStruct1, ifInChI, TAUT_YES, i ))
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1925:21): [True: 0, False: 0]
  ------------------
 1926|      0|                {
 1927|      0|                    bfMobileH = TAUT_YES;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1928|      0|                }
 1929|      0|                else
 1930|      0|                {
 1931|      0|                    continue; /* component is missing ??? */
 1932|      0|                }
 1933|      0|            }
 1934|      0|            pINChISort1[n].pINChI[bfMobileH] = pStruct1->RevInChI.pINChI[ifInChI][i][bfMobileH];
 1935|      0|            if (bfMobileH == TAUT_NON /*&& bRevInchiComponentExists( pStruct1, ifInChI, TAUT_YES, i )*/)
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1935:17): [True: 0, False: 0]
  ------------------
 1936|      0|            {
 1937|      0|                pINChISort1[n].pINChI[TAUT_YES] = pStruct1->RevInChI.pINChI[ifInChI][i][TAUT_YES];
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                              pINChISort1[n].pINChI[TAUT_YES] = pStruct1->RevInChI.pINChI[ifInChI][i][TAUT_YES];
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1938|       |                /* remove Fixed-H InChI if is is identical to Mobile-H */
 1939|       |                /* do it exactly same way the identical components were removed from InpInChI */
 1940|      0|                if (!CompareReversedINChI( pINChISort1[n].pINChI[bfMobileH],
  ------------------
  |  Branch (1940:21): [True: 0, False: 0]
  ------------------
 1941|      0|                    pINChISort1[n].pINChI[TAUT_YES], NULL, NULL ))
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1942|      0|                {
 1943|      0|                    pINChISort1[n].pINChI[bfMobileH] = NULL; /* remove Fixed-H layer */
 1944|      0|                }
 1945|      0|                else
 1946|      0|                {
 1947|      0|                    pINChISort1[n].ord_number = pStruct1->RevInChI.pINChI_Aux[ifInChI][i][TAUT_YES]->nNumRemovedProtons;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1948|      0|                }
 1949|      0|            }
 1950|       |
 1951|      0|            pINChISort1[n].n1 = k;  /* reconstructed reconnected structure component index */
 1952|      0|            pINChISort1[n].n2 = i;  /* index of a fragment made out of this component */
 1953|      0|            n++;
 1954|      0|        }
 1955|      0|    }
 1956|       |
 1957|       |    /* sort fragment InChI before comparing them */
 1958|      0|    qsort( pINChISort1, num_fragments_D, sizeof( pINChISort1[0] ), CompINChITaut2 );
 1959|      0|    qsort( pINChISort2, num_fragments_R, sizeof( pINChISort2[0] ), CompINChITaut2 );
 1960|       |
 1961|       |    /* compare fragments -- components present in disconnected layer only */
 1962|      0|    for (iComponent = 0; iComponent < num_fragments_DR; iComponent++)
  ------------------
  |  Branch (1962:26): [True: 0, False: 0]
  ------------------
 1963|      0|    {
 1964|      0|        INChI *pInChI1[TAUT_NUM]; /* from reversed structure */
 1965|      0|        INChI *pInChI2[TAUT_NUM]; /* original input InChI */
 1966|      0|        for (i = 0; i < TAUT_NUM; i++)
  ------------------
  |  |  578|      0|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1966:21): [True: 0, False: 0]
  ------------------
 1967|      0|        {
 1968|      0|            pInChI1[i] = pINChISort1[iComponent].pINChI[i];
 1969|      0|            pInChI2[i] = pINChISort2[iComponent].pINChI[i];
 1970|      0|        }
 1971|      0|        CompareTwoPairsOfInChI( pInChI1, pInChI2, !bHasSomeFixedH, CompareInchiFlags );
 1972|      0|    }
 1973|       |
 1974|      0|    if ( /*nNumNonTaut1 && nNumNonTaut2 &&*/ bHasSomeFixedH)
  ------------------
  |  Branch (1974:46): [True: 0, False: 0]
  ------------------
 1975|      0|    {
 1976|      0|        if (nNumCompHaveSeparateProtons_D || nNumCompHaveSeparateProtons_R)
  ------------------
  |  Branch (1976:13): [True: 0, False: 0]
  |  Branch (1976:46): [True: 0, False: 0]
  ------------------
 1977|      0|        {
 1978|       |            /* for each component, compare number removed protons */
 1979|       |            /* comparison does not make sense if Disconnected Fixed-H layer is not present */
 1980|      0|            for (iComponent = 0; iComponent < num_fragments_DR; iComponent++)
  ------------------
  |  Branch (1980:34): [True: 0, False: 0]
  ------------------
 1981|      0|            {
 1982|      0|                NUM_H   nNumRemovedIsotopicH1[NUM_H_ISOTOPES];
 1983|      0|                NUM_H   nNumRemovedIsotopicH2[NUM_H_ISOTOPES];
 1984|       |
 1985|      0|                memset( nNumRemovedIsotopicH1, 0, sizeof( nNumRemovedIsotopicH1 ) );
 1986|      0|                memset( nNumRemovedIsotopicH2, 0, sizeof( nNumRemovedIsotopicH2 ) );
 1987|       |                /* compare removed protons */
 1988|      0|                if (pINChISort1[iComponent].ord_number != pINChISort2[iComponent].ord_number)
  ------------------
  |  Branch (1988:21): [True: 0, False: 0]
  ------------------
 1989|      0|                {
 1990|      0|                    CompareInchiFlags[TAUT_YES] |= INCHIDIFF_MOBH_PROTONS; /* diff number of removed protons */
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1991|      0|                }
 1992|       |                /* also compare removed isotopic atoms H */
 1993|      0|                k = pINChISort2[iComponent].n1; /* input InChI, OneInput */
 1994|      0|                if (pOneInput->nNumProtons[INCHI_BAS][TAUT_YES].pNumProtons)
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                              if (pOneInput->nNumProtons[INCHI_BAS][TAUT_YES].pNumProtons)
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1994:21): [True: 0, False: 0]
  ------------------
 1995|      0|                {
 1996|      0|                    memcpy( nNumRemovedIsotopicH2,
 1997|      0|                        pOneInput->nNumProtons[INCHI_BAS][TAUT_YES].pNumProtons[k].nNumRemovedIsotopicH,
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                                      pOneInput->nNumProtons[INCHI_BAS][TAUT_YES].pNumProtons[k].nNumRemovedIsotopicH,
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1998|      0|                        sizeof( nNumRemovedIsotopicH2 ) );
 1999|      0|                }
 2000|       |               /* get fragments of reconstructed structure removed protons info */
 2001|      0|                k = pINChISort1[iComponent].n1; /* restored component number */
 2002|      0|                i = pINChISort1[iComponent].n2; /* subcomponent number */
 2003|      0|                iInChI = INCHI_REC;
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
 2004|      0|                iMobileH = bHasSomeFixedH ? !pOneInput->nNumComponents[iInChI][TAUT_NON] : TAUT_YES;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                              iMobileH = bHasSomeFixedH ? !pOneInput->nNumComponents[iInChI][TAUT_NON] : TAUT_YES;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2004:28): [True: 0, False: 0]
  ------------------
 2005|      0|                bMobileH = iMobileH;
 2006|      0|                if (!bInpInchiComponentExists( pOneInput, iInChI, bMobileH, k ))
  ------------------
  |  Branch (2006:21): [True: 0, False: 0]
  ------------------
 2007|      0|                {
 2008|      0|                    if (bInpInchiComponentExists( pOneInput, iInChI, TAUT_YES, k ))
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2008:25): [True: 0, False: 0]
  ------------------
 2009|      0|                    {
 2010|      0|                        bMobileH = TAUT_YES;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2011|      0|                    }
 2012|      0|                    else
 2013|      0|                    {
 2014|      0|                        goto compare_iso_H;
 2015|      0|                    }
 2016|      0|                }
 2017|      0|                if (pOneInput->pInpInChI[iInChI][bMobileH][k].nLink)
  ------------------
  |  Branch (2017:21): [True: 0, False: 0]
  ------------------
 2018|      0|                {
 2019|      0|                    continue;
 2020|       |                    /*
 2021|       |                    ret = RI_ERR_PROGR;
 2022|       |                    goto exit_function;
 2023|       |                    */
 2024|      0|                }
 2025|      0|                pStruct1 = pStruct[iInChI][bMobileH] + k;
 2026|      0|                num_fragments = pStruct1->RevInChI.num_components[INCHI_BAS];
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 2027|      0|                ifInChI = INCHI_BAS;
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 2028|      0|                ifMobileH = bHasSomeFixedH ? TAUT_NON : TAUT_YES;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                              ifMobileH = bHasSomeFixedH ? TAUT_NON : TAUT_YES;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2028:29): [True: 0, False: 0]
  ------------------
 2029|      0|                if (i < num_fragments)
  ------------------
  |  Branch (2029:21): [True: 0, False: 0]
  ------------------
 2030|      0|                {
 2031|      0|                    bfMobileH = ifMobileH;
 2032|      0|                    if (!bRevInchiComponentExists( pStruct1, ifInChI, bfMobileH, i ))
  ------------------
  |  Branch (2032:25): [True: 0, False: 0]
  ------------------
 2033|      0|                    {
 2034|      0|                        if (bRevInchiComponentExists( pStruct1, ifInChI, TAUT_YES, i ))
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2034:29): [True: 0, False: 0]
  ------------------
 2035|      0|                        {
 2036|      0|                            bfMobileH = TAUT_YES;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2037|      0|                        }
 2038|      0|                        else
 2039|      0|                        {
 2040|      0|                            goto compare_iso_H;
 2041|      0|                        }
 2042|      0|                    }
 2043|      0|                    memcpy( nNumRemovedIsotopicH1,
 2044|      0|                        pStruct1->RevInChI.pINChI_Aux[ifInChI][i][TAUT_YES]->nNumRemovedIsotopicH,
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2045|      0|                        sizeof( nNumRemovedIsotopicH1 ) );
 2046|      0|                }
 2047|      0|            compare_iso_H:
 2048|      0|                if (memcmp( nNumRemovedIsotopicH1, nNumRemovedIsotopicH2, sizeof( nNumRemovedIsotopicH1 ) ))
  ------------------
  |  Branch (2048:21): [True: 0, False: 0]
  ------------------
 2049|      0|                {
 2050|      0|                    CompareInchiFlags[TAUT_YES] |= INCHIDIFF_REM_ISO_H;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2051|      0|                }
 2052|      0|            }
 2053|      0|        }
 2054|      0|    }
 2055|      0|    else /*if ( !nNumNonTaut1 && !nNumNonTaut2 || !bHasSomeFixedH )*/
 2056|      0|    {
 2057|       |        /* compare totals for removed protons and isotopic H */
 2058|      0|        if (pOneInput->nNumProtons[INCHI_BAS][TAUT_YES].nNumRemovedProtons !=
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                      if (pOneInput->nNumProtons[INCHI_BAS][TAUT_YES].nNumRemovedProtons !=
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2058:13): [True: 0, False: 0]
  ------------------
 2059|      0|             nNumRemovedProtons_R.nNumRemovedProtons)
 2060|      0|        {
 2061|      0|            CompareInchiFlags[TAUT_YES] |= INCHIDIFF_MOBH_PROTONS;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2062|      0|        }
 2063|      0|        if (memcmp( pOneInput->nNumProtons[INCHI_BAS][TAUT_YES].nNumRemovedIsotopicH,
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                      if (memcmp( pOneInput->nNumProtons[INCHI_BAS][TAUT_YES].nNumRemovedIsotopicH,
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2063:13): [True: 0, False: 0]
  ------------------
 2064|      0|            nNumRemovedProtons_R.nNumRemovedIsotopicH,
 2065|      0|            sizeof( nNumRemovedProtons_R.nNumRemovedIsotopicH ) ))
 2066|      0|        {
 2067|      0|            CompareInchiFlags[TAUT_YES] |= INCHIDIFF_REM_ISO_H;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2068|      0|        }
 2069|      0|    }
 2070|       |
 2071|      0|    if (!nNumNonTaut1 == !nNumNonTaut2)
  ------------------
  |  Branch (2071:9): [True: 0, False: 0]
  ------------------
 2072|      0|    {
 2073|      0|        ; /* difference if(nNumNonTaut1 != nNumNonTaut2) will be caught in InChI comparison */
 2074|      0|    }
 2075|      0|    else
 2076|      0|    {
 2077|      0|        if (nNumNonTaut1)
  ------------------
  |  Branch (2077:13): [True: 0, False: 0]
  ------------------
 2078|      0|        {
 2079|       |            /* reconstructed has Fixed-H while the original has not: extra Fixed-H layer */
 2080|      0|            CompareInchiFlags[TAUT_YES] |= INCHIDIFF_WRONG_TAUT;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2081|      0|        }
 2082|      0|        else
 2083|      0|        {
 2084|       |            /* the original InChI has Fixed-H while the reconstructed one has not: missing Fixed-H layer */
 2085|      0|            CompareInchiFlags[TAUT_YES] |= INCHIDIFF_NO_TAUT;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2086|      0|        }
 2087|      0|    }
 2088|      0|    for (i = 0; i < TAUT_NUM; i++)
  ------------------
  |  |  578|      0|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (2088:17): [True: 0, False: 0]
  ------------------
 2089|      0|    {
 2090|      0|        pOneInput->CompareInchiFlags[1][i] |= CompareInchiFlags[i];
 2091|      0|    }
 2092|       |
 2093|       |    /* compare totals */
 2094|      0|    if (nNumRemovedProtons_R.nNumRemovedProtons != nNumRemovedProtons_D.nNumRemovedProtons)
  ------------------
  |  Branch (2094:9): [True: 0, False: 0]
  ------------------
 2095|      0|    {
 2096|      0|        CompareInchiFlags[TAUT_YES] |= INCHIDIFF_MOBH_PROTONS; /* diff number of removed protons */
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2097|      0|    }
 2098|      0|    if (memcmp( nNumRemovedProtons_R.nNumRemovedIsotopicH,
  ------------------
  |  Branch (2098:9): [True: 0, False: 0]
  ------------------
 2099|      0|        nNumRemovedProtons_D.nNumRemovedIsotopicH,
 2100|      0|        sizeof( nNumRemovedProtons_D.nNumRemovedIsotopicH ) ))
 2101|      0|    {
 2102|      0|        CompareInchiFlags[TAUT_YES] |= INCHIDIFF_REM_ISO_H;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2103|      0|    }
 2104|       |
 2105|      0|exit_function:
 2106|       |
 2107|      0|    if (pINChISort1)
  ------------------
  |  Branch (2107:9): [True: 0, False: 0]
  ------------------
 2108|      0|    {
 2109|      0|        inchi_free( pINChISort1 );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2110|      0|    }
 2111|      0|    if (pINChISort2)
  ------------------
  |  Branch (2111:9): [True: 0, False: 0]
  ------------------
 2112|      0|    {
 2113|      0|        inchi_free( pINChISort2 );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2114|      0|    }
 2115|       |
 2116|      0|    return ret;
 2117|      0|}
CompareOneOrigInchiToRevInChI:
 2166|  53.4k|{
 2167|  53.4k|    int ret = pStruct->RevInChI.nRetVal, err = 0;
 2168|  53.4k|    INCHI_MODE cmp;
 2169|  53.4k|    if (ret == _IS_OKAY || ret == _IS_WARNING)
  ------------------
  |  |   38|   106k|#define _IS_OKAY    0
  ------------------
                  if (ret == _IS_OKAY || ret == _IS_WARNING)
  ------------------
  |  |   39|      4|#define _IS_WARNING 1
  ------------------
  |  Branch (2169:9): [True: 53.4k, False: 4]
  |  Branch (2169:28): [True: 4, False: 0]
  ------------------
 2170|  53.4k|    {
 2171|       |        /* ignore bMobileH for now */
 2172|  53.4k|        int i, i0, b /* created type */, b0 /* requested type*/, j, k;
 2173|       |        /* pINChI[iINCHI][iComponent][bTaut] */
 2174|       |        /* i0 = requested Rec/Disconnected: 1/0 */
 2175|       |        /* i  = what InChI creaded out of the restored structure */
 2176|       |        /* b0 = requested Mobile/Fixed-H: 1/0 */
 2177|       |        /* b  = what InChI creaded out of the restored structure */
 2178|  53.4k|        i = i0 = pStruct->iINCHI;
 2179|  53.4k|        b = b0 = pStruct->iMobileH;
 2180|  53.4k|        if (i == INCHI_REC && !pStruct->RevInChI.num_components[i])
  ------------------
  |  |  576|   106k|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (2180:13): [True: 0, False: 53.4k]
  |  Branch (2180:31): [True: 0, False: 0]
  ------------------
 2181|      0|        {
 2182|      0|            i = INCHI_BAS;
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 2183|      0|        }
 2184|  53.4k|        if (b == TAUT_NON && ( !pStruct->RevInChI.pINChI[i] ||
  ------------------
  |  |  579|   106k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (2184:13): [True: 30, False: 53.4k]
  |  Branch (2184:32): [True: 13, False: 17]
  ------------------
 2185|     30|            !pStruct->RevInChI.pINChI[i][0][b] ||
  ------------------
  |  Branch (2185:13): [True: 0, False: 17]
  ------------------
 2186|     30|            !pStruct->RevInChI.pINChI[i][0][b]->nNumberOfAtoms ))
  ------------------
  |  Branch (2186:13): [True: 16, False: 1]
  ------------------
 2187|     29|        {
 2188|     29|            b = TAUT_YES;
  ------------------
  |  |  580|     29|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2189|     29|        }
 2190|  53.4k|        if (pStruct->bDeleted && ( !pInChI[0] || pInChI[0]->bDeleted ))
  ------------------
  |  Branch (2190:13): [True: 13, False: 53.4k]
  |  Branch (2190:36): [True: 13, False: 0]
  |  Branch (2190:50): [True: 0, False: 0]
  ------------------
 2191|     13|        {
 2192|     13|            return 0;
 2193|     13|        }
 2194|       |
 2195|  53.4k|        if (pStruct->RevInChI.num_components[i] > 1 &&
  ------------------
  |  Branch (2195:13): [True: 0, False: 53.4k]
  ------------------
 2196|  53.4k|             !pStruct->RevInChI.pINChI[i][1][b]->bDeleted ||
  ------------------
  |  Branch (2196:14): [True: 0, False: 0]
  ------------------
 2197|  53.4k|             pStruct->RevInChI.num_components[i] < 1)
  ------------------
  |  Branch (2197:14): [True: 0, False: 53.4k]
  ------------------
 2198|      0|        {
 2199|      0|            CompareInchiFlags[bMobileH] |= INCHIDIFF_COMP_NUMBER;
 2200|      0|        }
 2201|  53.4k|        if (b != b0 || b != bMobileH || b0 != bMobileH || i > i0)
  ------------------
  |  Branch (2201:13): [True: 16, False: 53.4k]
  |  Branch (2201:24): [True: 0, False: 53.4k]
  |  Branch (2201:41): [True: 0, False: 53.4k]
  |  Branch (2201:59): [True: 0, False: 53.4k]
  ------------------
 2202|     16|        {
 2203|       |            /* do not print messages about TAUT_YES instead of TAUT_NON */
 2204|     16|            CompareInchiFlags[bMobileH] |= INCHIDIFF_COMP_HLAYER;
 2205|     16|        }
 2206|       |
 2207|  53.4k|        if (pStruct->RevInChI.num_components[i])
  ------------------
  |  Branch (2207:13): [True: 53.4k, False: 0]
  ------------------
 2208|  53.4k|        {
 2209|       |            /* compare InChI from restored structure; '0' in [i][0][b] is the first component */
 2210|  53.4k|            if (b == TAUT_YES && pStruct->RevInChI.pINChI[i][0][b]->bDeleted && ( !pInChI[0] || pInChI[0]->bDeleted ))
  ------------------
  |  |  580|   106k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2210:17): [True: 53.4k, False: 1]
  |  Branch (2210:34): [True: 1, False: 53.4k]
  |  Branch (2210:83): [True: 1, False: 0]
  |  Branch (2210:97): [True: 0, False: 0]
  ------------------
 2211|      1|            {
 2212|       |                /* the 1st component is made out of proton(s) and the input component is missing or also a proton */
 2213|      1|                cmp = 0;
 2214|      1|            }
 2215|  53.4k|            else
 2216|  53.4k|            {
 2217|  53.4k|                cmp = CompareReversedINChI3( pStruct->RevInChI.pINChI[i][0][b], pInChI[0], NULL, NULL, &err );
 2218|  53.4k|                if (cmp)
  ------------------
  |  Branch (2218:21): [True: 3, False: 53.4k]
  ------------------
 2219|      3|                {
 2220|      3|                    CompareInchiFlags[bMobileH] |= cmp;
 2221|      3|                }
 2222|  53.4k|            }
 2223|  53.4k|            if (b == b0 && b == TAUT_NON)
  ------------------
  |  |  579|  53.4k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (2223:17): [True: 53.4k, False: 16]
  |  Branch (2223:28): [True: 1, False: 53.4k]
  ------------------
 2224|      1|            {
 2225|      1|                if (pStruct->RevInChI.pINChI[i][0][TAUT_YES] &&
  ------------------
  |  |  580|      1|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2225:21): [True: 1, False: 0]
  ------------------
 2226|      1|                     !pStruct->RevInChI.pINChI[i][0][TAUT_YES]->bDeleted ||
  ------------------
  |  |  580|      1|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2226:22): [True: 1, False: 0]
  ------------------
 2227|      1|                     pInChI[1] && !pInChI[1]->bDeleted)
  ------------------
  |  Branch (2227:22): [True: 0, False: 0]
  |  Branch (2227:35): [True: 0, False: 0]
  ------------------
 2228|      1|                {
 2229|       |                    /* in addition to fixed-H also compare mobile-H InChI */
 2230|      1|                    cmp = CompareReversedINChI3( pStruct->RevInChI.pINChI[i][0][TAUT_YES], pInChI[1], NULL, NULL, &err );
  ------------------
  |  |  580|      1|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2231|      1|                    if (cmp)
  ------------------
  |  Branch (2231:25): [True: 1, False: 0]
  ------------------
 2232|      1|                    {
 2233|      1|                        CompareInchiFlags[TAUT_YES] |= cmp;
  ------------------
  |  |  580|      1|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2234|      1|                    }
 2235|      1|                }
 2236|       |                /* compare removed H */
 2237|      1|                if (pStruct->nNumRemovedProtonsMobHInChI != pStruct->RevInChI.pINChI_Aux[i][0][TAUT_YES]->nNumRemovedProtons)
  ------------------
  |  |  580|      1|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2237:21): [True: 1, False: 0]
  ------------------
 2238|      1|                {
 2239|      1|                    CompareInchiFlags[TAUT_YES] |= INCHIDIFF_MOBH_PROTONS;
  ------------------
  |  |  580|      1|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2240|      1|                }
 2241|      1|            }
 2242|  53.4k|            memset( nCurRemovedProtons, 0, sizeof( *nCurRemovedProtons ) );
 2243|   106k|            for (k = 0; k < pStruct->RevInChI.num_components[i]; k++)
  ------------------
  |  Branch (2243:25): [True: 53.4k, False: 53.4k]
  ------------------
 2244|  53.4k|            {
 2245|  53.4k|                if (!k || pStruct->RevInChI.pINChI[i][k][TAUT_YES]->bDeleted)
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (2245:21): [True: 53.4k, False: 0]
  |  Branch (2245:27): [True: 0, False: 0]
  ------------------
 2246|  53.4k|                {
 2247|       |                    /* get removed protons from the 1st component; add othere only if they are deleted protons */
 2248|  53.4k|                    nCurRemovedProtons->nNumRemovedProtons += pStruct->RevInChI.pINChI_Aux[i][k][TAUT_YES]->nNumRemovedProtons;
  ------------------
  |  |  580|  53.4k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2249|   213k|                    for (j = 0; j < NUM_H_ISOTOPES; j++)
  ------------------
  |  |   53|   213k|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (2249:33): [True: 160k, False: 53.4k]
  ------------------
 2250|   160k|                    {
 2251|   160k|                        nCurRemovedProtons->nNumRemovedIsotopicH[j] += pStruct->RevInChI.pINChI_Aux[i][k][TAUT_YES]->nNumRemovedIsotopicH[j];
  ------------------
  |  |  580|   160k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 2252|   160k|                    }
 2253|  53.4k|                }
 2254|  53.4k|            }
 2255|  53.4k|        }
 2256|  53.4k|    }
 2257|      0|    else
 2258|      0|    {
 2259|      0|        CompareInchiFlags[bMobileH] |= INCHIDIFF_STR2INCHI_ERR;
 2260|      0|    }
 2261|       |
 2262|  53.4k|    return err;
 2263|  53.4k|}
CompareReversedStereoINChI3:
 2272|  53.4k|{
 2273|  53.4k|    int ret = 0;
 2274|  53.4k|    int j1, j2, num_eq, num_dif, num_extra_undf, num_miss_undf, num_in1_only, num_in2_only;
 2275|  53.4k|    int bAddSb = !( picr->num_sb_undef_in1_only + picr->num_sb_in1_only + picr->num_sb_in2_only );
 2276|  53.4k|    int bAddSc = !( picr->num_sc_undef_in1_only + picr->num_sc_in1_only + picr->num_sc_in2_only );
 2277|       |
 2278|  53.4k|    int nNumSc1 = s1 ? s1->nNumberOfStereoCenters : 0;
  ------------------
  |  Branch (2278:19): [True: 53.4k, False: 0]
  ------------------
 2279|  53.4k|    int nNumSc2 = s2 ? s2->nNumberOfStereoCenters : 0;
  ------------------
  |  Branch (2279:19): [True: 257, False: 53.2k]
  ------------------
 2280|  53.4k|    int nNumSb1 = s1 ? s1->nNumberOfStereoBonds : 0;
  ------------------
  |  Branch (2280:19): [True: 53.4k, False: 0]
  ------------------
 2281|  53.4k|    int nNumSb2 = s2 ? s2->nNumberOfStereoBonds : 0;
  ------------------
  |  Branch (2281:19): [True: 257, False: 53.2k]
  ------------------
 2282|       |
 2283|  53.4k|    if (( nNumSc1 || nNumSc1 ) &&
  ------------------
  |  Branch (2283:11): [True: 0, False: 53.4k]
  |  Branch (2283:22): [True: 0, False: 53.4k]
  ------------------
 2284|  53.4k|        ( nNumSc1 != nNumSc2 ||
  ------------------
  |  Branch (2284:11): [True: 0, False: 0]
  ------------------
 2285|      0|            memcmp( s1->nNumber, s2->nNumber, nNumSc1 * sizeof( s1->nNumber[0] ) ) ||
  ------------------
  |  Branch (2285:13): [True: 0, False: 0]
  ------------------
 2286|      0|            memcmp( s1->t_parity, s2->t_parity, nNumSc1 * sizeof( s1->t_parity[0] ) ) ))
  ------------------
  |  Branch (2286:13): [True: 0, False: 0]
  ------------------
 2287|      0|    {
 2288|       |
 2289|      0|        num_eq = num_dif = num_extra_undf = num_miss_undf = num_in1_only = num_in2_only = 0;
 2290|      0|        for (j1 = j2 = 0; j1 < nNumSc1 && j2 < nNumSc2; )
  ------------------
  |  Branch (2290:27): [True: 0, False: 0]
  |  Branch (2290:43): [True: 0, False: 0]
  ------------------
 2291|      0|        {
 2292|      0|            if (s1->nNumber[j1] == s2->nNumber[j2])
  ------------------
  |  Branch (2292:17): [True: 0, False: 0]
  ------------------
 2293|      0|            {
 2294|      0|                if (s1->t_parity[j1] == s2->t_parity[j2])
  ------------------
  |  Branch (2294:21): [True: 0, False: 0]
  ------------------
 2295|      0|                {
 2296|      0|                    num_eq++;
 2297|      0|                }
 2298|      0|                else
 2299|      0|                {
 2300|      0|                    num_dif++;
 2301|      0|                }
 2302|      0|                j1++;
 2303|      0|                j2++;
 2304|      0|            }
 2305|      0|            else
 2306|      0|            {
 2307|      0|                if (s1->nNumber[j1] < s2->nNumber[j2])
  ------------------
  |  Branch (2307:21): [True: 0, False: 0]
  ------------------
 2308|      0|                {
 2309|      0|                    num_in1_only++;
 2310|      0|                    if (s1->t_parity[j1] == AB_PARITY_UNDF)
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2310:25): [True: 0, False: 0]
  ------------------
 2311|      0|                    {
 2312|      0|                        num_extra_undf++;
 2313|      0|                    }
 2314|      0|                    if (bAddSc)
  ------------------
  |  Branch (2314:25): [True: 0, False: 0]
  ------------------
 2315|      0|                    {
 2316|      0|                        if (picr->num_sc_in1_only < ICR_MAX_SC_IN1_ONLY)
  ------------------
  |  |  176|      0|#define ICR_MAX_SC_IN1_ONLY   32
  ------------------
  |  Branch (2316:29): [True: 0, False: 0]
  ------------------
 2317|      0|                            picr->sc_in1_only[picr->num_sc_in1_only++] = j1;
 2318|      0|                        if (s1->t_parity[j1] == AB_PARITY_UNDF)
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2318:29): [True: 0, False: 0]
  ------------------
 2319|      0|                        {
 2320|      0|                            if (picr->num_sc_undef_in1_only < ICR_MAX_SC_UNDF)
  ------------------
  |  |  179|      0|#define ICR_MAX_SC_UNDF       32
  ------------------
  |  Branch (2320:33): [True: 0, False: 0]
  ------------------
 2321|      0|                                picr->sc_undef_in1_only[picr->num_sc_undef_in1_only++] = j1;
 2322|      0|                        }
 2323|      0|                    }
 2324|      0|                    j1++;
 2325|      0|                }
 2326|      0|                else
 2327|      0|                {
 2328|      0|                    num_in2_only++;
 2329|      0|                    if (s2->t_parity[j2] == AB_PARITY_UNDF)
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2329:25): [True: 0, False: 0]
  ------------------
 2330|      0|                    {
 2331|      0|                        num_miss_undf++;
 2332|      0|                    }
 2333|      0|                    if (bAddSc)
  ------------------
  |  Branch (2333:25): [True: 0, False: 0]
  ------------------
 2334|      0|                    {
 2335|      0|                        if (picr->num_sc_in2_only < ICR_MAX_SC_IN2_ONLY)
  ------------------
  |  |  177|      0|#define ICR_MAX_SC_IN2_ONLY   32
  ------------------
  |  Branch (2335:29): [True: 0, False: 0]
  ------------------
 2336|      0|                            picr->sc_in2_only[picr->num_sc_in2_only++] = j2;
 2337|      0|                        if (s2->t_parity[j2] == AB_PARITY_UNDF)
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2337:29): [True: 0, False: 0]
  ------------------
 2338|      0|                        {
 2339|      0|                            if (picr->num_sc_undef_in2_only < ICR_MAX_SC_UNDF)
  ------------------
  |  |  179|      0|#define ICR_MAX_SC_UNDF       32
  ------------------
  |  Branch (2339:33): [True: 0, False: 0]
  ------------------
 2340|      0|                                picr->sc_undef_in2_only[picr->num_sc_undef_in2_only++] = j1;
 2341|      0|                        }
 2342|      0|                    }
 2343|      0|                    j2++;
 2344|      0|                }
 2345|      0|            }
 2346|      0|        }
 2347|       |
 2348|      0|        while (j1 < nNumSc1)
  ------------------
  |  Branch (2348:16): [True: 0, False: 0]
  ------------------
 2349|      0|        {
 2350|      0|            if (s1->t_parity[j1] == AB_PARITY_UNDF)
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2350:17): [True: 0, False: 0]
  ------------------
 2351|      0|            {
 2352|      0|                num_extra_undf++;
 2353|      0|            }
 2354|      0|            num_in1_only++;
 2355|      0|            if (bAddSc)
  ------------------
  |  Branch (2355:17): [True: 0, False: 0]
  ------------------
 2356|      0|            {
 2357|      0|                if (picr->num_sc_in1_only < ICR_MAX_SC_IN1_ONLY)
  ------------------
  |  |  176|      0|#define ICR_MAX_SC_IN1_ONLY   32
  ------------------
  |  Branch (2357:21): [True: 0, False: 0]
  ------------------
 2358|      0|                    picr->sc_in1_only[picr->num_sc_in1_only++] = j1;
 2359|      0|                if (s1->t_parity[j1] == AB_PARITY_UNDF)
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2359:21): [True: 0, False: 0]
  ------------------
 2360|      0|                {
 2361|      0|                    if (picr->num_sc_undef_in1_only < ICR_MAX_SC_UNDF)
  ------------------
  |  |  179|      0|#define ICR_MAX_SC_UNDF       32
  ------------------
  |  Branch (2361:25): [True: 0, False: 0]
  ------------------
 2362|      0|                        picr->sc_undef_in1_only[picr->num_sc_undef_in1_only++] = j1;
 2363|      0|                }
 2364|      0|            }
 2365|      0|            j1++;
 2366|      0|        }
 2367|       |
 2368|      0|        while (j2 < nNumSc2)
  ------------------
  |  Branch (2368:16): [True: 0, False: 0]
  ------------------
 2369|      0|        {
 2370|      0|            if (s2->t_parity[j2] == AB_PARITY_UNDF)
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2370:17): [True: 0, False: 0]
  ------------------
 2371|      0|            {
 2372|      0|                num_miss_undf++;
 2373|      0|            }
 2374|      0|            num_in2_only++;
 2375|      0|            if (bAddSc)
  ------------------
  |  Branch (2375:17): [True: 0, False: 0]
  ------------------
 2376|      0|            {
 2377|      0|                if (picr->num_sc_in2_only < ICR_MAX_SC_IN2_ONLY)
  ------------------
  |  |  177|      0|#define ICR_MAX_SC_IN2_ONLY   32
  ------------------
  |  Branch (2377:21): [True: 0, False: 0]
  ------------------
 2378|      0|                    picr->sc_in2_only[picr->num_sc_in2_only++] = j2;
 2379|      0|            }
 2380|      0|            j2++;
 2381|      0|        }
 2382|       |
 2383|      0|        if (num_dif)
  ------------------
  |  Branch (2383:13): [True: 0, False: 0]
  ------------------
 2384|      0|        {
 2385|      0|            ret |= INCHIDIFF_SC_PARITY;
 2386|      0|        }
 2387|      0|        if (num_in1_only)
  ------------------
  |  Branch (2387:13): [True: 0, False: 0]
  ------------------
 2388|      0|        {
 2389|      0|            if (num_extra_undf)
  ------------------
  |  Branch (2389:17): [True: 0, False: 0]
  ------------------
 2390|      0|            {
 2391|      0|                ret |= INCHIDIFF_SC_EXTRA_UNDF;
 2392|      0|            }
 2393|      0|            if (num_in1_only != num_extra_undf)
  ------------------
  |  Branch (2393:17): [True: 0, False: 0]
  ------------------
 2394|      0|            {
 2395|      0|                ret |= INCHIDIFF_SC_EXTRA;
 2396|      0|            }
 2397|      0|        }
 2398|      0|        if (num_in2_only)
  ------------------
  |  Branch (2398:13): [True: 0, False: 0]
  ------------------
 2399|      0|        {
 2400|      0|            if (num_miss_undf)
  ------------------
  |  Branch (2400:17): [True: 0, False: 0]
  ------------------
 2401|      0|            {
 2402|      0|                ret |= INCHIDIFF_SC_MISS_UNDF;
 2403|      0|            }
 2404|      0|            if (num_in2_only != num_miss_undf)
  ------------------
  |  Branch (2404:17): [True: 0, False: 0]
  ------------------
 2405|      0|            {
 2406|      0|                ret |= INCHIDIFF_SC_MISS;
 2407|      0|            }
 2408|      0|        }
 2409|      0|    }
 2410|       |
 2411|  53.4k|    if (s1 && s2 && ( s2->nCompInv2Abs != 2 ) && s1->nCompInv2Abs != s2->nCompInv2Abs && s1->nCompInv2Abs && s2->nCompInv2Abs)
  ------------------
  |  Branch (2411:9): [True: 53.4k, False: 0]
  |  Branch (2411:15): [True: 257, False: 53.2k]
  |  Branch (2411:21): [True: 257, False: 0]
  |  Branch (2411:50): [True: 0, False: 257]
  |  Branch (2411:90): [True: 0, False: 0]
  |  Branch (2411:110): [True: 0, False: 0]
  ------------------
 2412|      0|    {
 2413|      0|        ret |= INCHIDIFF_SC_INV; /* 2007-07-13 DT: added (s2->nCompInv2Abs != 2) to fix bug reoprted by Yerin on 2007/02/28 */
 2414|       |                                 /* Bug description: falsely reported "Stereo centers/allenes: Falsely inverted" for /S2 or /S3 */
 2415|      0|    }
 2416|       |
 2417|  53.4k|    if (( nNumSb1 || nNumSb2 ) &&
  ------------------
  |  Branch (2417:11): [True: 0, False: 53.4k]
  |  Branch (2417:22): [True: 0, False: 53.4k]
  ------------------
 2418|  53.4k|        ( nNumSb1 != nNumSb2 ||
  ------------------
  |  Branch (2418:11): [True: 0, False: 0]
  ------------------
 2419|      0|            memcmp( s1->nBondAtom1, s2->nBondAtom1, nNumSb1 * sizeof( s1->nBondAtom1[0] ) ) ||
  ------------------
  |  Branch (2419:13): [True: 0, False: 0]
  ------------------
 2420|      0|            memcmp( s1->nBondAtom2, s2->nBondAtom2, nNumSb1 * sizeof( s1->nBondAtom2[0] ) ) ||
  ------------------
  |  Branch (2420:13): [True: 0, False: 0]
  ------------------
 2421|      0|            memcmp( s1->b_parity, s2->b_parity, nNumSb1 * sizeof( s1->b_parity[0] ) ) ))
  ------------------
  |  Branch (2421:13): [True: 0, False: 0]
  ------------------
 2422|      0|    {
 2423|       |
 2424|      0|        num_eq = num_dif = num_extra_undf = num_miss_undf = num_in1_only = num_in2_only = 0;
 2425|      0|        for (j1 = j2 = 0; j1 < nNumSb1 && j2 < nNumSb2; )
  ------------------
  |  Branch (2425:27): [True: 0, False: 0]
  |  Branch (2425:43): [True: 0, False: 0]
  ------------------
 2426|      0|        {
 2427|      0|            if (s1->nBondAtom1[j1] == s2->nBondAtom1[j2] &&
  ------------------
  |  Branch (2427:17): [True: 0, False: 0]
  ------------------
 2428|      0|                 s1->nBondAtom2[j1] == s2->nBondAtom2[j2])
  ------------------
  |  Branch (2428:18): [True: 0, False: 0]
  ------------------
 2429|      0|            {
 2430|      0|                if (s1->b_parity[j1] == s2->b_parity[j2])
  ------------------
  |  Branch (2430:21): [True: 0, False: 0]
  ------------------
 2431|      0|                {
 2432|      0|                    num_eq++;
 2433|      0|                }
 2434|      0|                else
 2435|      0|                {
 2436|      0|                    num_dif++;
 2437|      0|                }
 2438|      0|                j1++;
 2439|      0|                j2++;
 2440|      0|            }
 2441|      0|            else
 2442|      0|            {
 2443|      0|                if (s1->nBondAtom1[j1] < s2->nBondAtom1[j2] ||
  ------------------
  |  Branch (2443:21): [True: 0, False: 0]
  ------------------
 2444|      0|                     s1->nBondAtom1[j1] == s2->nBondAtom1[j2] && s1->nBondAtom2[j1] < s2->nBondAtom2[j2])
  ------------------
  |  Branch (2444:22): [True: 0, False: 0]
  |  Branch (2444:66): [True: 0, False: 0]
  ------------------
 2445|      0|                {
 2446|      0|                    num_in1_only++;
 2447|      0|                    if (s1->b_parity[j1] == AB_PARITY_UNDF)
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2447:25): [True: 0, False: 0]
  ------------------
 2448|      0|                    {
 2449|      0|                        num_extra_undf++;
 2450|      0|                    }
 2451|      0|                    if (bAddSb)
  ------------------
  |  Branch (2451:25): [True: 0, False: 0]
  ------------------
 2452|      0|                    {
 2453|      0|                        if (picr->num_sb_in1_only < ICR_MAX_SB_IN1_ONLY)
  ------------------
  |  |  174|      0|#define ICR_MAX_SB_IN1_ONLY   32
  ------------------
  |  Branch (2453:29): [True: 0, False: 0]
  ------------------
 2454|      0|                            picr->sb_in1_only[picr->num_sb_in1_only++] = j1;
 2455|      0|                        if (s1->b_parity[j1] == AB_PARITY_UNDF)
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2455:29): [True: 0, False: 0]
  ------------------
 2456|      0|                        {
 2457|      0|                            if (picr->num_sb_undef_in1_only < ICR_MAX_SB_UNDF)
  ------------------
  |  |  178|      0|#define ICR_MAX_SB_UNDF       32
  ------------------
  |  Branch (2457:33): [True: 0, False: 0]
  ------------------
 2458|      0|                                picr->sb_undef_in1_only[picr->num_sb_undef_in1_only++] = j1;
 2459|      0|                        }
 2460|      0|                    }
 2461|      0|                    j1++;
 2462|      0|                }
 2463|      0|                else
 2464|      0|                {
 2465|      0|                    num_in2_only++;
 2466|      0|                    if (s2->b_parity[j2] == AB_PARITY_UNDF)
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2466:25): [True: 0, False: 0]
  ------------------
 2467|      0|                    {
 2468|      0|                        num_miss_undf++;
 2469|      0|                    }
 2470|      0|                    if (bAddSb)
  ------------------
  |  Branch (2470:25): [True: 0, False: 0]
  ------------------
 2471|      0|                    {
 2472|      0|                        if (picr->num_sb_in2_only < ICR_MAX_SB_IN2_ONLY)
  ------------------
  |  |  175|      0|#define ICR_MAX_SB_IN2_ONLY   32
  ------------------
  |  Branch (2472:29): [True: 0, False: 0]
  ------------------
 2473|      0|                            picr->sb_in2_only[picr->num_sb_in2_only++] = j2;
 2474|      0|                        if (s2->b_parity[j2] == AB_PARITY_UNDF)
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2474:29): [True: 0, False: 0]
  ------------------
 2475|      0|                        {
 2476|      0|                            if (picr->num_sb_undef_in2_only < ICR_MAX_SB_UNDF)
  ------------------
  |  |  178|      0|#define ICR_MAX_SB_UNDF       32
  ------------------
  |  Branch (2476:33): [True: 0, False: 0]
  ------------------
 2477|      0|                                picr->sb_undef_in2_only[picr->num_sb_undef_in2_only++] = j1;
 2478|      0|                        }
 2479|      0|                    }
 2480|      0|                    j2++;
 2481|      0|                }
 2482|      0|            }
 2483|      0|        }
 2484|      0|        while (j1 < nNumSb1)
  ------------------
  |  Branch (2484:16): [True: 0, False: 0]
  ------------------
 2485|      0|        {
 2486|      0|            num_in1_only++;
 2487|      0|            if (s1->b_parity[j1] == AB_PARITY_UNDF)
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2487:17): [True: 0, False: 0]
  ------------------
 2488|      0|            {
 2489|      0|                num_extra_undf++;
 2490|      0|            }
 2491|      0|            if (bAddSb)
  ------------------
  |  Branch (2491:17): [True: 0, False: 0]
  ------------------
 2492|      0|            {
 2493|      0|                if (picr->num_sb_in1_only < ICR_MAX_SB_IN1_ONLY)
  ------------------
  |  |  174|      0|#define ICR_MAX_SB_IN1_ONLY   32
  ------------------
  |  Branch (2493:21): [True: 0, False: 0]
  ------------------
 2494|      0|                    picr->sb_in1_only[picr->num_sb_in1_only++] = j1;
 2495|      0|                if (s1->b_parity[j1] == AB_PARITY_UNDF)
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2495:21): [True: 0, False: 0]
  ------------------
 2496|      0|                {
 2497|      0|                    if (picr->num_sb_undef_in1_only < ICR_MAX_SB_UNDF)
  ------------------
  |  |  178|      0|#define ICR_MAX_SB_UNDF       32
  ------------------
  |  Branch (2497:25): [True: 0, False: 0]
  ------------------
 2498|      0|                        picr->sb_undef_in1_only[picr->num_sb_undef_in1_only++] = j1;
 2499|      0|                }
 2500|      0|            }
 2501|      0|            j1++;
 2502|      0|        }
 2503|      0|        while (j2 < nNumSb2)
  ------------------
  |  Branch (2503:16): [True: 0, False: 0]
  ------------------
 2504|      0|        {
 2505|      0|            num_in2_only++;
 2506|      0|            if (s2->b_parity[j2] == AB_PARITY_UNDF)
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2506:17): [True: 0, False: 0]
  ------------------
 2507|      0|            {
 2508|      0|                num_miss_undf++;
 2509|      0|            }
 2510|      0|            if (bAddSb)
  ------------------
  |  Branch (2510:17): [True: 0, False: 0]
  ------------------
 2511|      0|            {
 2512|      0|                if (picr->num_sb_in2_only < ICR_MAX_SB_IN2_ONLY)
  ------------------
  |  |  175|      0|#define ICR_MAX_SB_IN2_ONLY   32
  ------------------
  |  Branch (2512:21): [True: 0, False: 0]
  ------------------
 2513|      0|                    picr->sb_in2_only[picr->num_sb_in2_only++] = j2;
 2514|      0|                if (s2->b_parity[j2] == AB_PARITY_UNDF)
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (2514:21): [True: 0, False: 0]
  ------------------
 2515|      0|                {
 2516|      0|                    if (picr->num_sb_undef_in2_only < ICR_MAX_SB_UNDF)
  ------------------
  |  |  178|      0|#define ICR_MAX_SB_UNDF       32
  ------------------
  |  Branch (2516:25): [True: 0, False: 0]
  ------------------
 2517|      0|                        picr->sb_undef_in2_only[picr->num_sb_undef_in2_only++] = j1;
 2518|      0|                }
 2519|      0|            }
 2520|      0|            j2++;
 2521|      0|        }
 2522|      0|        if (num_dif)
  ------------------
  |  Branch (2522:13): [True: 0, False: 0]
  ------------------
 2523|      0|        {
 2524|      0|            ret |= INCHIDIFF_SB_PARITY;
 2525|      0|        }
 2526|      0|        if (num_in1_only)
  ------------------
  |  Branch (2526:13): [True: 0, False: 0]
  ------------------
 2527|      0|        {
 2528|      0|            if (num_extra_undf)
  ------------------
  |  Branch (2528:17): [True: 0, False: 0]
  ------------------
 2529|      0|            {
 2530|      0|                ret |= INCHIDIFF_SB_EXTRA_UNDF;
 2531|      0|            }
 2532|      0|            if (num_in1_only != num_extra_undf)
  ------------------
  |  Branch (2532:17): [True: 0, False: 0]
  ------------------
 2533|      0|            {
 2534|      0|                ret |= INCHIDIFF_SB_EXTRA;
 2535|      0|            }
 2536|      0|        }
 2537|      0|        if (num_in2_only)
  ------------------
  |  Branch (2537:13): [True: 0, False: 0]
  ------------------
 2538|      0|        {
 2539|      0|            if (num_miss_undf)
  ------------------
  |  Branch (2539:17): [True: 0, False: 0]
  ------------------
 2540|      0|            {
 2541|      0|                ret |= INCHIDIFF_SB_MISS_UNDF;
 2542|      0|            }
 2543|      0|            if (num_in2_only != num_miss_undf)
  ------------------
  |  Branch (2543:17): [True: 0, False: 0]
  ------------------
 2544|      0|            {
 2545|      0|                ret |= INCHIDIFF_SB_MISS;
 2546|      0|            }
 2547|      0|        }
 2548|      0|    }
 2549|       |
 2550|  53.4k|    return ret;
 2551|  53.4k|}
CompareReversedINChI3:
 2560|  53.4k|{
 2561|  53.4k|    INCHI_MODE ret = 0;
 2562|  53.4k|    INChI_Stereo *Stereo1 = NULL, *Stereo2 = NULL;
 2563|  53.4k|    int  n1, n2, m, j, j1, j2, ret2, num_H1, num_H2;
 2564|  53.4k|    ICR icr;
 2565|  53.4k|    ICR *picr = &icr;
 2566|       |
 2567|  53.4k|    *err = 0;
 2568|       |
 2569|  53.4k|    memset( picr, 0, sizeof( *picr ) );
 2570|       |
 2571|  53.4k|    if (i1 == NULL && i2 == NULL)
  ------------------
  |  Branch (2571:9): [True: 0, False: 53.4k]
  |  Branch (2571:23): [True: 0, False: 0]
  ------------------
 2572|      0|    {
 2573|      0|        return 0;
 2574|      0|    }
 2575|  53.4k|    if (( i1 == NULL ) ^ ( i2 == NULL ))
  ------------------
  |  Branch (2575:9): [True: 0, False: 53.4k]
  ------------------
 2576|      0|    {
 2577|      0|        ret |= INCHIDIFF_PROBLEM; /* one InChI exists while another doesn't */
 2578|      0|        goto exit_function;
 2579|      0|    }
 2580|       |
 2581|  53.4k|    if (i1->nErrorCode == i2->nErrorCode)
  ------------------
  |  Branch (2581:9): [True: 53.4k, False: 0]
  ------------------
 2582|  53.4k|    {
 2583|  53.4k|        if (i1->nErrorCode)
  ------------------
  |  Branch (2583:13): [True: 0, False: 53.4k]
  ------------------
 2584|      0|        {
 2585|      0|            ret |= INCHIDIFF_PROBLEM; /* both InChI have same error codes */
 2586|      0|            goto exit_function;
 2587|      0|        }
 2588|  53.4k|    }
 2589|      0|    else
 2590|      0|    {
 2591|      0|        ret |= INCHIDIFF_PROBLEM; /* at least one InChI has an error code */
 2592|      0|        goto exit_function;
 2593|      0|    }
 2594|       |
 2595|  53.4k|    if (i1->nNumberOfAtoms != i2->nNumberOfAtoms)
  ------------------
  |  Branch (2595:9): [True: 0, False: 53.4k]
  ------------------
 2596|      0|    {
 2597|      0|        ret |= INCHIDIFF_NUM_AT;
 2598|      0|        goto exit_function;
 2599|      0|    }
 2600|  53.4k|    if (i1->nNumberOfAtoms > 0)
  ------------------
  |  Branch (2600:9): [True: 53.4k, False: 0]
  ------------------
 2601|  53.4k|    {
 2602|  53.4k|        if (memcmp( i1->nAtom, i2->nAtom, i1->nNumberOfAtoms * sizeof( i1->nAtom[0] ) ))
  ------------------
  |  Branch (2602:13): [True: 0, False: 53.4k]
  ------------------
 2603|      0|        {
 2604|      0|            ret |= INCHIDIFF_ATOMS;
 2605|      0|            goto exit_function;
 2606|      0|        }
 2607|       |        /* INCHIDIFF_NON_TAUT_H,  INCHIDIFF_MORE_FH, INCHIDIFF_LESS_FH */
 2608|  53.4k|        if (memcmp( i1->nNum_H, i2->nNum_H, i1->nNumberOfAtoms * sizeof( i1->nNum_H[0] ) ))
  ------------------
  |  Branch (2608:13): [True: 0, False: 53.4k]
  ------------------
 2609|      0|        {
 2610|      0|            ret |= INCHIDIFF_POSITION_H;
 2611|      0|            for (j1 = 0; j1 < i1->nNumberOfAtoms; j1++)
  ------------------
  |  Branch (2611:26): [True: 0, False: 0]
  ------------------
 2612|      0|            {
 2613|      0|                if (i1->nNum_H[j1] != i2->nNum_H[j1] && picr->num_diff_pos_H < ICR_MAX_DIFF_FIXED_H)
  ------------------
  |  |  173|      0|#define ICR_MAX_DIFF_FIXED_H  32
  ------------------
  |  Branch (2613:21): [True: 0, False: 0]
  |  Branch (2613:57): [True: 0, False: 0]
  ------------------
 2614|      0|                {
 2615|      0|                    picr->diff_pos_H_at[picr->num_diff_pos_H] = j1;
 2616|      0|                    picr->diff_pos_H_nH[picr->num_diff_pos_H] = i1->nNum_H[j1] - i2->nNum_H[j1];
 2617|      0|                    picr->num_diff_pos_H++;
 2618|      0|                }
 2619|      0|            }
 2620|      0|        }
 2621|       |        /* fixed H */
 2622|  53.4k|        if (i1->nNum_H_fixed || i2->nNum_H_fixed)
  ------------------
  |  Branch (2622:13): [True: 53.4k, False: 0]
  |  Branch (2622:33): [True: 0, False: 0]
  ------------------
 2623|  53.4k|        {
 2624|  53.4k|            int bHasFixedH1 = 0, bHasFixedH2 = 0, i;
 2625|  53.4k|            if (i1->nNum_H_fixed)
  ------------------
  |  Branch (2625:17): [True: 53.4k, False: 0]
  ------------------
 2626|  53.4k|            {
 2627|   106k|                for (i = 0; i < i1->nNumberOfAtoms; i++)
  ------------------
  |  Branch (2627:29): [True: 53.4k, False: 53.4k]
  ------------------
 2628|  53.4k|                {
 2629|  53.4k|                    if (i1->nNum_H_fixed[i])
  ------------------
  |  Branch (2629:25): [True: 0, False: 53.4k]
  ------------------
 2630|      0|                    {
 2631|      0|                        bHasFixedH1++;
 2632|      0|                    }
 2633|  53.4k|                }
 2634|  53.4k|            }
 2635|  53.4k|            if (i2->nNum_H_fixed)
  ------------------
  |  Branch (2635:17): [True: 0, False: 53.4k]
  ------------------
 2636|      0|            {
 2637|      0|                for (i = 0; i < i2->nNumberOfAtoms; i++)
  ------------------
  |  Branch (2637:29): [True: 0, False: 0]
  ------------------
 2638|      0|                {
 2639|      0|                    if (i2->nNum_H_fixed[i])
  ------------------
  |  Branch (2639:25): [True: 0, False: 0]
  ------------------
 2640|      0|                    {
 2641|      0|                        bHasFixedH2++;
 2642|      0|                    }
 2643|      0|                }
 2644|      0|            }
 2645|  53.4k|            if (bHasFixedH1 && !bHasFixedH2)
  ------------------
  |  Branch (2645:17): [True: 0, False: 53.4k]
  |  Branch (2645:32): [True: 0, False: 0]
  ------------------
 2646|      0|            {
 2647|      0|                for (i = j = 0; i < i1->nNumberOfAtoms; i++)
  ------------------
  |  Branch (2647:33): [True: 0, False: 0]
  ------------------
 2648|      0|                {
 2649|      0|                    if (i1->nNum_H_fixed[i])
  ------------------
  |  Branch (2649:25): [True: 0, False: 0]
  ------------------
 2650|      0|                    {
 2651|      0|                        if (j < ICR_MAX_DIFF_FIXED_H)
  ------------------
  |  |  173|      0|#define ICR_MAX_DIFF_FIXED_H  32
  ------------------
  |  Branch (2651:29): [True: 0, False: 0]
  ------------------
 2652|      0|                        {
 2653|      0|                            picr->fixed_H_at1_more[j] = i;
 2654|      0|                            picr->fixed_H_nH1_more[j] = i1->nNum_H_fixed[i];
 2655|      0|                            j++;
 2656|      0|                        }
 2657|      0|                    }
 2658|      0|                }
 2659|      0|                picr->num_fixed_H1_more = j;
 2660|      0|                ret |= INCHIDIFF_MORE_FH; /* Extra Fixed-H */
 2661|      0|            }
 2662|  53.4k|            else
 2663|  53.4k|            {
 2664|  53.4k|                if (!bHasFixedH1 && bHasFixedH2)
  ------------------
  |  Branch (2664:21): [True: 53.4k, False: 0]
  |  Branch (2664:37): [True: 0, False: 53.4k]
  ------------------
 2665|      0|                {
 2666|      0|                    for (i = j = 0; i < i2->nNumberOfAtoms; i++)
  ------------------
  |  Branch (2666:37): [True: 0, False: 0]
  ------------------
 2667|      0|                    {
 2668|      0|                        if (i2->nNum_H_fixed[i])
  ------------------
  |  Branch (2668:29): [True: 0, False: 0]
  ------------------
 2669|      0|                        {
 2670|      0|                            if (j < ICR_MAX_DIFF_FIXED_H)
  ------------------
  |  |  173|      0|#define ICR_MAX_DIFF_FIXED_H  32
  ------------------
  |  Branch (2670:33): [True: 0, False: 0]
  ------------------
 2671|      0|                            {
 2672|      0|                                picr->fixed_H_at2_more[j] = i;
 2673|      0|                                picr->fixed_H_nH2_more[j] = i2->nNum_H_fixed[i];
 2674|      0|                                j++;
 2675|      0|                            }
 2676|      0|                        }
 2677|      0|                    }
 2678|      0|                    picr->num_fixed_H2_more = j;
 2679|      0|                    ret |= INCHIDIFF_LESS_FH; /* Missed Fixed-H */
 2680|      0|                }
 2681|  53.4k|                else
 2682|  53.4k|                {
 2683|  53.4k|                    if (bHasFixedH1 && bHasFixedH2 &&
  ------------------
  |  Branch (2683:25): [True: 0, False: 53.4k]
  |  Branch (2683:40): [True: 0, False: 0]
  ------------------
 2684|  53.4k|                         memcmp( i1->nNum_H_fixed, i2->nNum_H_fixed, i1->nNumberOfAtoms * sizeof( i1->nNum_H_fixed[0] ) ))
  ------------------
  |  Branch (2684:26): [True: 0, False: 0]
  ------------------
 2685|      0|                    {
 2686|      0|                        for (i = j1 = j2 = 0; i < i1->nNumberOfAtoms; i++)
  ------------------
  |  Branch (2686:47): [True: 0, False: 0]
  ------------------
 2687|      0|                        {
 2688|      0|                            if (i1->nNum_H_fixed[i] > i2->nNum_H_fixed[i])
  ------------------
  |  Branch (2688:33): [True: 0, False: 0]
  ------------------
 2689|      0|                            {
 2690|      0|                                if (j1 < ICR_MAX_DIFF_FIXED_H)
  ------------------
  |  |  173|      0|#define ICR_MAX_DIFF_FIXED_H  32
  ------------------
  |  Branch (2690:37): [True: 0, False: 0]
  ------------------
 2691|      0|                                {
 2692|      0|                                    picr->fixed_H_at1_more[j1] = i;
 2693|      0|                                    picr->fixed_H_nH1_more[j1] = i1->nNum_H_fixed[i] - i2->nNum_H_fixed[i];
 2694|      0|                                    j1++;
 2695|      0|                                }
 2696|      0|                            }
 2697|      0|                            else
 2698|      0|                                if (i1->nNum_H_fixed[i] < i2->nNum_H_fixed[i])
  ------------------
  |  Branch (2698:37): [True: 0, False: 0]
  ------------------
 2699|      0|                                {
 2700|      0|                                    if (j2 < ICR_MAX_DIFF_FIXED_H)
  ------------------
  |  |  173|      0|#define ICR_MAX_DIFF_FIXED_H  32
  ------------------
  |  Branch (2700:41): [True: 0, False: 0]
  ------------------
 2701|      0|                                    {
 2702|      0|                                        picr->fixed_H_at2_more[j2] = i;
 2703|      0|                                        picr->fixed_H_nH2_more[j2] = i2->nNum_H_fixed[i] - i1->nNum_H_fixed[i];
 2704|      0|                                        j2++;
 2705|      0|                                    }
 2706|      0|                                }
 2707|      0|                        }
 2708|      0|                        ret |= ( j1 ? INCHIDIFF_MORE_FH : 0 ) | ( j2 ? INCHIDIFF_LESS_FH : 0 );
  ------------------
  |  Branch (2708:34): [True: 0, False: 0]
  |  Branch (2708:67): [True: 0, False: 0]
  ------------------
 2709|      0|                        picr->num_fixed_H1_more = j1;
 2710|      0|                        picr->num_fixed_H2_more = j2;
 2711|      0|                    }
 2712|  53.4k|                }
 2713|  53.4k|            }
 2714|  53.4k|        }
 2715|  53.4k|    }
 2716|       |
 2717|       |    /* compare formulas and H */
 2718|  53.4k|    num_H1 = 0;
 2719|  53.4k|    num_H2 = 0;
 2720|  53.4k|    ret2 = CompareHillFormulasNoH( i1->szHillFormula, i2->szHillFormula, &num_H1, &num_H2 );
 2721|  53.4k|    picr->tot_num_H1 = num_H1;
 2722|  53.4k|    picr->tot_num_H2 = num_H2;
 2723|  53.4k|    if (ret2)
  ------------------
  |  Branch (2723:9): [True: 0, False: 53.4k]
  ------------------
 2724|      0|    {
 2725|      0|        ret |= INCHIDIFF_NUM_EL;
 2726|      0|        goto exit_function;
 2727|      0|    }
 2728|  53.4k|    if (num_H1 > num_H2)
  ------------------
  |  Branch (2728:9): [True: 2, False: 53.4k]
  ------------------
 2729|      2|    {
 2730|      2|        ret |= INCHIDIFF_MORE_H;
 2731|      2|    }
 2732|  53.4k|    if (num_H1 < num_H2)
  ------------------
  |  Branch (2732:9): [True: 0, False: 53.4k]
  ------------------
 2733|      0|    {
 2734|      0|        ret |= INCHIDIFF_LESS_H;
 2735|      0|    }
 2736|       |
 2737|  53.4k|    if (i1->lenConnTable != i2->lenConnTable)
  ------------------
  |  Branch (2737:9): [True: 0, False: 53.4k]
  ------------------
 2738|      0|    {
 2739|      0|        ret |= INCHIDIFF_CON_LEN;
 2740|      0|        goto exit_function;
 2741|      0|    }
 2742|  53.4k|    else
 2743|  53.4k|    {
 2744|  53.4k|        if (i1->lenConnTable > 0 && memcmp( i1->nConnTable, i2->nConnTable, i1->lenConnTable * sizeof( i1->nConnTable[0] ) ))
  ------------------
  |  Branch (2744:13): [True: 53.4k, False: 0]
  |  Branch (2744:37): [True: 0, False: 53.4k]
  ------------------
 2745|      0|        {
 2746|      0|            ret |= INCHIDIFF_CON_TBL;
 2747|      0|            goto exit_function;
 2748|      0|        }
 2749|  53.4k|    }
 2750|       |    /* output special cases: different number of t-groups, different sizes of t-groups, different endpoints */
 2751|       |    /* in isotopic or deprotonated cases i1->lenTautomer == 1 && i1->nTautomer[0] = 0 */
 2752|       |        /*
 2753|       |    if ( i1->lenTautomer != i2->lenTautomer && (i1->lenTautomer > 1 || i2->lenTautomer > 1) )
 2754|       |    {
 2755|       |        ret |=  INCHIDIFF_TAUT_LEN;
 2756|       |    }
 2757|       |    */
 2758|       |
 2759|       |    /* compare number of t-groups */
 2760|  53.4k|    n1 = i1->lenTautomer ? i1->nTautomer[0] : 0;
  ------------------
  |  Branch (2760:10): [True: 2, False: 53.4k]
  ------------------
 2761|  53.4k|    n2 = i2->lenTautomer ? i2->nTautomer[0] : 0;
  ------------------
  |  Branch (2761:10): [True: 0, False: 53.4k]
  ------------------
 2762|  53.4k|    if (!n1 && n2)
  ------------------
  |  Branch (2762:9): [True: 53.4k, False: 2]
  |  Branch (2762:16): [True: 0, False: 53.4k]
  ------------------
 2763|      0|    {
 2764|      0|        ret |= INCHIDIFF_NO_TAUT;
 2765|      0|    }
 2766|  53.4k|    else
 2767|  53.4k|    {
 2768|  53.4k|        if (n1 && !n2)
  ------------------
  |  Branch (2768:13): [True: 2, False: 53.4k]
  |  Branch (2768:19): [True: 2, False: 0]
  ------------------
 2769|      2|        {
 2770|      2|            ret |= INCHIDIFF_WRONG_TAUT;
 2771|      2|        }
 2772|  53.4k|        else
 2773|  53.4k|        {
 2774|  53.4k|            if (n1 == 1 && n2 > 1)
  ------------------
  |  Branch (2774:17): [True: 0, False: 53.4k]
  |  Branch (2774:28): [True: 0, False: 0]
  ------------------
 2775|      0|            {
 2776|      0|                ret |= INCHIDIFF_SINGLE_TG;
 2777|      0|            }
 2778|  53.4k|            else
 2779|  53.4k|            {
 2780|  53.4k|                if (n1 > 1 && n2 == 1)
  ------------------
  |  Branch (2780:21): [True: 0, False: 53.4k]
  |  Branch (2780:31): [True: 0, False: 0]
  ------------------
 2781|      0|                {
 2782|      0|                    ret |= INCHIDIFF_MULTIPLE_TG;
 2783|      0|                }
 2784|  53.4k|                else
 2785|  53.4k|                {
 2786|  53.4k|                    if (n1 != n2)
  ------------------
  |  Branch (2786:25): [True: 0, False: 53.4k]
  ------------------
 2787|      0|                    {
 2788|      0|                        ret |= INCHIDIFF_NUM_TG;
 2789|      0|                    }
 2790|  53.4k|                }
 2791|  53.4k|            }
 2792|  53.4k|        }
 2793|  53.4k|    }
 2794|       |
 2795|  53.4k|    if (n1 || n2)
  ------------------
  |  Branch (2795:9): [True: 2, False: 53.4k]
  |  Branch (2795:15): [True: 0, False: 53.4k]
  ------------------
 2796|      2|    {
 2797|       |        /* number of endpoints */
 2798|      2|        int num1 = 0, num2 = 0, num_M1 = 0, num_M2 = 0;
 2799|      2|        int len, num_eq, num_in1_only, num_in2_only;
 2800|      2|        AT_NUMB *pe1 = (AT_NUMB *) inchi_malloc( ( i1->lenTautomer + 1 ) * sizeof( pe1[0] ) );
  ------------------
  |  | 1130|      2|#define inchi_malloc   malloc
  ------------------
 2801|      2|        AT_NUMB *pe2 = (AT_NUMB *) inchi_malloc( ( i2->lenTautomer + 1 ) * sizeof( pe2[0] ) );
  ------------------
  |  | 1130|      2|#define inchi_malloc   malloc
  ------------------
 2802|      2|        num_H1 = num_H2 = 0;
 2803|       |        /* collect endpoints, H, (-) */
 2804|      2|        if (!pe1 || !pe2)
  ------------------
  |  Branch (2804:13): [True: 0, False: 2]
  |  Branch (2804:21): [True: 0, False: 2]
  ------------------
 2805|      0|        {
 2806|      0|            if (pe1) inchi_free( pe1 );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (2806:17): [True: 0, False: 0]
  ------------------
 2807|      0|            if (pe2) inchi_free( pe2 );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (2807:17): [True: 0, False: 0]
  ------------------
 2808|      0|            *err = RI_ERR_ALLOC; /* allocation error */
  ------------------
  |  |   43|      0|#define RI_ERR_ALLOC   (-1)
  ------------------
 2809|      0|            goto exit_function;
 2810|      0|        }
 2811|      4|        for (m = 1; m < i1->lenTautomer; m += len)
  ------------------
  |  Branch (2811:21): [True: 2, False: 2]
  ------------------
 2812|      2|        {
 2813|      2|            len = i1->nTautomer[m++];
 2814|      2|            num_H1 += i1->nTautomer[m];
 2815|      2|            num_M1 += i1->nTautomer[m + 1];
 2816|      6|            for (j = 2; j < len; j++)
  ------------------
  |  Branch (2816:25): [True: 4, False: 2]
  ------------------
 2817|      4|            {
 2818|      4|                pe1[num1++] = i1->nTautomer[m + j];
 2819|      4|            }
 2820|      2|        }
 2821|      2|        for (m = 1; m < i2->lenTautomer; m += len)
  ------------------
  |  Branch (2821:21): [True: 0, False: 2]
  ------------------
 2822|      0|        {
 2823|      0|            len = i2->nTautomer[m++];
 2824|      0|            num_H2 += i2->nTautomer[m];
 2825|      0|            num_M2 += i2->nTautomer[m + 1];
 2826|      0|            for (j = 2; j < len; j++)
  ------------------
  |  Branch (2826:25): [True: 0, False: 0]
  ------------------
 2827|      0|            {
 2828|      0|                pe2[num2++] = i2->nTautomer[m + j];
 2829|      0|            }
 2830|      0|        }
 2831|      2|        picr->num_taut_H1 = num_H1;
 2832|      2|        picr->num_taut_H2 = num_H2;
 2833|      2|        picr->num_taut_M1 = num_M1;
 2834|      2|        picr->num_taut_M2 = num_M2;
 2835|       |        /* sort endpoints */
 2836|      2|        insertions_sort_AT_NUMB( pe1, num1 );
 2837|      2|        insertions_sort_AT_NUMB( pe2, num2 );
 2838|       |        /* compare */
 2839|       |        /*
 2840|       |        if ( num1 < num2 ) {
 2841|       |            ret |= INCHIDIFF_LESS_TG_ENDP;
 2842|       |        } else
 2843|       |        if ( num1 > num2 ) {
 2844|       |            ret |= INCHIDIFF_MORE_TG_ENDP;
 2845|       |        }
 2846|       |        */
 2847|       |        /* compare all */
 2848|      2|        num_eq = num_in1_only = num_in2_only = 0;
 2849|      2|        for (j1 = j2 = 0; j1 < num1 && j2 < num2; )
  ------------------
  |  Branch (2849:27): [True: 2, False: 0]
  |  Branch (2849:40): [True: 0, False: 2]
  ------------------
 2850|      0|        {
 2851|      0|            if (pe1[j1] == pe2[j2])
  ------------------
  |  Branch (2851:17): [True: 0, False: 0]
  ------------------
 2852|      0|            {
 2853|      0|                j1++;
 2854|      0|                j2++;
 2855|      0|                num_eq++;
 2856|      0|            }
 2857|      0|            else
 2858|      0|            {
 2859|      0|                if (pe1[j1] < pe2[j1])
  ------------------
  |  Branch (2859:21): [True: 0, False: 0]
  ------------------
 2860|      0|                {
 2861|      0|                    if (picr->num_endp_in1_only < ICR_MAX_ENDP_IN1_ONLY)
  ------------------
  |  |  171|      0|#define ICR_MAX_ENDP_IN1_ONLY 32
  ------------------
  |  Branch (2861:25): [True: 0, False: 0]
  ------------------
 2862|      0|                    {
 2863|      0|                        picr->endp_in1_only[picr->num_endp_in1_only++] = pe1[j1];
 2864|      0|                    }
 2865|      0|                    j1++;
 2866|      0|                    num_in1_only++;
 2867|      0|                }
 2868|      0|                else
 2869|      0|                {
 2870|      0|                    if (picr->num_endp_in2_only < ICR_MAX_ENDP_IN2_ONLY)
  ------------------
  |  |  172|      0|#define ICR_MAX_ENDP_IN2_ONLY 32
  ------------------
  |  Branch (2870:25): [True: 0, False: 0]
  ------------------
 2871|      0|                    {
 2872|      0|                        picr->endp_in2_only[picr->num_endp_in2_only++] = pe2[j2];
 2873|      0|                    }
 2874|      0|                    j2++;
 2875|      0|                    num_in2_only++;
 2876|      0|                }
 2877|      0|            }
 2878|      0|        }
 2879|      6|        while (j1 < num1)
  ------------------
  |  Branch (2879:16): [True: 4, False: 2]
  ------------------
 2880|      4|        {
 2881|      4|            if (picr->num_endp_in1_only < ICR_MAX_ENDP_IN1_ONLY)
  ------------------
  |  |  171|      4|#define ICR_MAX_ENDP_IN1_ONLY 32
  ------------------
  |  Branch (2881:17): [True: 4, False: 0]
  ------------------
 2882|      4|            {
 2883|      4|                picr->endp_in1_only[picr->num_endp_in1_only++] = pe1[j1];
 2884|      4|            }
 2885|      4|            j1++;
 2886|      4|            num_in1_only++;
 2887|      4|        }
 2888|      2|        while (j2 < num2)
  ------------------
  |  Branch (2888:16): [True: 0, False: 2]
  ------------------
 2889|      0|        {
 2890|      0|            if (picr->num_endp_in2_only < ICR_MAX_ENDP_IN2_ONLY)
  ------------------
  |  |  172|      0|#define ICR_MAX_ENDP_IN2_ONLY 32
  ------------------
  |  Branch (2890:17): [True: 0, False: 0]
  ------------------
 2891|      0|            {
 2892|      0|                picr->endp_in2_only[picr->num_endp_in2_only++] = pe2[j2];
 2893|      0|            }
 2894|      0|            j2++;
 2895|      0|            num_in2_only++;
 2896|      0|        }
 2897|      2|        if (num_in1_only)
  ------------------
  |  Branch (2897:13): [True: 2, False: 0]
  ------------------
 2898|      2|        {
 2899|      2|            ret |= INCHIDIFF_EXTRA_TG_ENDP;
 2900|      2|        }
 2901|      2|        if (num_in2_only)
  ------------------
  |  Branch (2901:13): [True: 0, False: 2]
  ------------------
 2902|      0|        {
 2903|      0|            ret |= INCHIDIFF_MISS_TG_ENDP;
 2904|      0|        }
 2905|      2|        if (!num_in1_only && !num_in2_only && num_eq)
  ------------------
  |  Branch (2905:13): [True: 0, False: 2]
  |  Branch (2905:30): [True: 0, False: 0]
  |  Branch (2905:47): [True: 0, False: 0]
  ------------------
 2906|      0|        {
 2907|      0|            ; /* same t-groups endpoints */
 2908|      0|        }
 2909|      2|        else
 2910|      2|        {
 2911|      2|            ret |= INCHIDIFF_DIFF_TG_ENDP;
 2912|      2|        }
 2913|      2|        inchi_free( pe1 );
  ------------------
  |  | 1136|      2|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 2, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2914|      2|        inchi_free( pe2 );
  ------------------
  |  | 1136|      2|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 2, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2915|      2|    }
 2916|       |
 2917|  53.4k|    if (( i1->lenTautomer > 1 && i2->lenTautomer > 1 ) &&
  ------------------
  |  Branch (2917:11): [True: 2, False: 53.4k]
  |  Branch (2917:34): [True: 0, False: 2]
  ------------------
 2918|  53.4k|        ( i1->lenTautomer != i2->lenTautomer ||
  ------------------
  |  Branch (2918:11): [True: 0, False: 0]
  ------------------
 2919|      0|            memcmp( i1->nTautomer, i2->nTautomer, i1->lenTautomer * sizeof( i1->nTautomer[0] ) ) ))
  ------------------
  |  Branch (2919:13): [True: 0, False: 0]
  ------------------
 2920|      0|        ret |= INCHIDIFF_TG;
 2921|       |
 2922|  53.4k|    if (i1->nNumberOfIsotopicAtoms != i2->nNumberOfIsotopicAtoms)
  ------------------
  |  Branch (2922:9): [True: 3, False: 53.4k]
  ------------------
 2923|      3|    {
 2924|      3|        ret |= INCHIDIFF_NUM_ISO_AT;
 2925|      3|    }
 2926|  53.4k|    else
 2927|  53.4k|    {
 2928|  53.4k|        if (i1->nNumberOfIsotopicAtoms > 0 && memcmp( i1->IsotopicAtom, i2->IsotopicAtom, i1->nNumberOfIsotopicAtoms * sizeof( i1->IsotopicAtom[0] ) ))
  ------------------
  |  Branch (2928:13): [True: 15, False: 53.4k]
  |  Branch (2928:47): [True: 0, False: 15]
  ------------------
 2929|      0|        {
 2930|      0|            ret |= INCHIDIFF_ISO_AT;
 2931|      0|        }
 2932|  53.4k|    }
 2933|  53.4k|    if (i1->nTotalCharge != i2->nTotalCharge)
  ------------------
  |  Branch (2933:9): [True: 2, False: 53.4k]
  ------------------
 2934|      2|        ret |= INCHIDIFF_CHARGE;
 2935|  53.4k|    if (a1 && a1->nNumRemovedProtons && ( !a2 || a2->nNumRemovedProtons != a1->nNumRemovedProtons ))
  ------------------
  |  Branch (2935:9): [True: 0, False: 53.4k]
  |  Branch (2935:15): [True: 0, False: 0]
  |  Branch (2935:43): [True: 0, False: 0]
  |  Branch (2935:50): [True: 0, False: 0]
  ------------------
 2936|      0|    {
 2937|      0|        ret |= INCHIDIFF_REM_PROT;
 2938|      0|    }
 2939|  53.4k|    if (a1 && ( !a2 ||
  ------------------
  |  Branch (2939:9): [True: 0, False: 53.4k]
  |  Branch (2939:17): [True: 0, False: 0]
  ------------------
 2940|      0|        a2->nNumRemovedIsotopicH[0] != a1->nNumRemovedIsotopicH[0] ||
  ------------------
  |  Branch (2940:9): [True: 0, False: 0]
  ------------------
 2941|      0|        a2->nNumRemovedIsotopicH[1] != a1->nNumRemovedIsotopicH[1] ||
  ------------------
  |  Branch (2941:9): [True: 0, False: 0]
  ------------------
 2942|      0|        a2->nNumRemovedIsotopicH[2] != a1->nNumRemovedIsotopicH[2] ))
  ------------------
  |  Branch (2942:9): [True: 0, False: 0]
  ------------------
 2943|      0|    {
 2944|      0|        ret |= INCHIDIFF_REM_ISO_H;
 2945|      0|    }
 2946|       |
 2947|       |    /*
 2948|       |    if ( i1->nPossibleLocationsOfIsotopicH && i2->nPossibleLocationsOfIsotopicH ) {
 2949|       |        if ( i1->nPossibleLocationsOfIsotopicH[0] != i2->nPossibleLocationsOfIsotopicH[0] ||
 2950|       |             memcmp(i1->nPossibleLocationsOfIsotopicH, i2->nPossibleLocationsOfIsotopicH,
 2951|       |                    sizeof(i1->nPossibleLocationsOfIsotopicH[0])*i1->nPossibleLocationsOfIsotopicH[0]) )
 2952|       |            return 18;
 2953|       |    } else
 2954|       |    if ( !i1->nPossibleLocationsOfIsotopicH != !i2->nPossibleLocationsOfIsotopicH ) {
 2955|       |        return 19;
 2956|       |    }
 2957|       |    */
 2958|  53.4k|    if (i1->StereoIsotopic &&
  ------------------
  |  Branch (2958:9): [True: 53.4k, False: 0]
  ------------------
 2959|  53.4k|         i1->StereoIsotopic->nNumberOfStereoBonds + i1->StereoIsotopic->nNumberOfStereoCenters)
  ------------------
  |  Branch (2959:10): [True: 0, False: 53.4k]
  ------------------
 2960|      0|    {
 2961|      0|        Stereo1 = i1->StereoIsotopic;
 2962|      0|    }
 2963|  53.4k|    else
 2964|  53.4k|    {
 2965|  53.4k|        Stereo1 = i1->Stereo;
 2966|  53.4k|    }
 2967|  53.4k|    if (i2->StereoIsotopic &&
  ------------------
  |  Branch (2967:9): [True: 15, False: 53.4k]
  ------------------
 2968|  53.4k|         i2->StereoIsotopic->nNumberOfStereoBonds + i2->StereoIsotopic->nNumberOfStereoCenters)
  ------------------
  |  Branch (2968:10): [True: 0, False: 15]
  ------------------
 2969|      0|    {
 2970|      0|        Stereo2 = i2->StereoIsotopic;
 2971|      0|    }
 2972|  53.4k|    else
 2973|  53.4k|    {
 2974|  53.4k|        Stereo2 = i2->Stereo;
 2975|  53.4k|    }
 2976|  53.4k|    ret |= CompareReversedStereoINChI3( Stereo1, Stereo2, picr );
 2977|       |
 2978|  53.4k|exit_function:
 2979|  53.4k|    picr->flags = ret;
 2980|       |
 2981|  53.4k|    return ret;
 2982|  53.4k|}
AddOneMsg:
 3054|    173|{
 3055|    173|    const char ellip[] = "...";
 3056|    173|    int len = (int) strlen( szAddMsg );
 3057|    173|    int len_delim = ( used_len && szDelim ) ? strlen( szDelim ) : 0;
  ------------------
  |  Branch (3057:23): [True: 98, False: 75]
  |  Branch (3057:35): [True: 2, False: 96]
  ------------------
 3058|    173|    int len_to_copy;
 3059|    173|    if (len + len_delim + used_len < tot_len)
  ------------------
  |  Branch (3059:9): [True: 173, False: 0]
  ------------------
 3060|    173|    {
 3061|    173|        if (len_delim)
  ------------------
  |  Branch (3061:13): [True: 2, False: 171]
  ------------------
 3062|      2|        {
 3063|      2|            strcpy( szMsg + used_len, szDelim );
 3064|      2|            used_len += len_delim;
 3065|      2|        }
 3066|    173|        strcpy( szMsg + used_len, szAddMsg );
 3067|    173|        used_len += len;
 3068|    173|    }
 3069|      0|    else
 3070|      0|    {
 3071|      0|        if (( len_to_copy = ( tot_len - used_len - len_delim - ( int )sizeof( ellip ) ) ) > 10)
  ------------------
  |  Branch (3071:13): [True: 0, False: 0]
  ------------------
 3072|      0|        {
 3073|      0|            if (len_delim)
  ------------------
  |  Branch (3073:17): [True: 0, False: 0]
  ------------------
 3074|      0|            {
 3075|      0|                strcpy( szMsg + used_len, szDelim );
 3076|      0|                used_len += len_delim;
 3077|      0|            }
 3078|      0|            strncpy( szMsg + used_len, szAddMsg, len_to_copy );
 3079|      0|            used_len += len_to_copy;
 3080|      0|            strcpy( szMsg + used_len, ellip );
 3081|      0|            used_len += sizeof( ellip ) - 1;
 3082|      0|        }
 3083|      0|    }
 3084|       |
 3085|    173|    return used_len;
 3086|    173|}
FillOutCompareMessage:
 3091|     31|{
 3092|     31|    int bMobileH, k, n, len = (int) strlen( szMsg );
 3093|     31|    int iPrevGrpIdx, iCurGrpIdx, bFound;
 3094|     31|    INCHI_MODE bit;
 3095|     31|    static const char *hdr = " Problems/mismatches:";
 3096|     31|    char szOneMsg[256];
 3097|       |
 3098|     31|    int mismatch = 0;
 3099|       |
 3100|     31|    if (bits[TAUT_YES] || bits[TAUT_NON])
  ------------------
  |  |  580|     31|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  if (bits[TAUT_YES] || bits[TAUT_NON])
  ------------------
  |  |  579|     29|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (3100:9): [True: 2, False: 29]
  |  Branch (3100:27): [True: 16, False: 13]
  ------------------
 3101|     18|    {
 3102|       |
 3103|     18|        mismatch = -1;
 3104|       |
 3105|     18|        if (!strstr( szMsg, hdr ))
  ------------------
  |  Branch (3105:13): [True: 18, False: 0]
  ------------------
 3106|     18|        {
 3107|     18|            len = AddOneMsg( szMsg, len, nLenMsg, hdr, NULL );
 3108|     18|        }
 3109|       |
 3110|     54|        for (bMobileH = TAUT_YES; 0 <= bMobileH; bMobileH--)
  ------------------
  |  |  580|     18|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3110:35): [True: 36, False: 18]
  ------------------
 3111|     36|        {
 3112|       |            /*      bMobileH = TAUT_YES, TAUT_NON */
 3113|       |
 3114|     36|            if (bits[bMobileH])
  ------------------
  |  Branch (3114:17): [True: 18, False: 18]
  ------------------
 3115|     18|            {
 3116|     18|                strcpy( szOneMsg, bMobileH == TAUT_YES ? " Mobile-H(" : " Fixed-H(" );
  ------------------
  |  |  580|     18|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (3116:35): [True: 2, False: 16]
  ------------------
 3117|     18|                len = AddOneMsg( szMsg, len, nLenMsg, szOneMsg, NULL );
 3118|     18|            }
 3119|       |
 3120|     36|            bit = 1;
 3121|     36|            iPrevGrpIdx = -1;
 3122|       |
 3123|     36|            do
 3124|  2.30k|            {
 3125|  2.30k|                if (bit & bits[bMobileH])
  ------------------
  |  Branch (3125:21): [True: 28, False: 2.27k]
  ------------------
 3126|     28|                {
 3127|       |                    /* search for the message */
 3128|     28|                    bFound = 0;
 3129|    730|                    for (k = 0; CompareInchiMsgs[k].nBit != INCHIDIFF_ZERO && !bFound; k++)
  ------------------
  |  Branch (3129:33): [True: 730, False: 0]
  |  Branch (3129:79): [True: 702, False: 28]
  ------------------
 3130|    702|                    {
 3131|    702|                        if (bit & (INCHI_MODE) CompareInchiMsgs[k].nBit)
  ------------------
  |  Branch (3131:29): [True: 28, False: 674]
  ------------------
 3132|     28|                        {
 3133|       |                            /* message found */
 3134|    204|                            for (n = 0; CompareInchiMsgsGroup[n].nGroupID != IDGRP_ZERO; n++)
  ------------------
  |  Branch (3134:41): [True: 204, False: 0]
  ------------------
 3135|    204|                            {
 3136|    204|                                if (CompareInchiMsgsGroup[n].nGroupID == CompareInchiMsgs[k].nGroupID)
  ------------------
  |  Branch (3136:37): [True: 28, False: 176]
  ------------------
 3137|     28|                                {
 3138|     28|                                    iCurGrpIdx = n;
 3139|     28|                                    if (iCurGrpIdx != iPrevGrpIdx)
  ------------------
  |  Branch (3139:41): [True: 26, False: 2]
  ------------------
 3140|     26|                                    {
 3141|     26|                                        if (iPrevGrpIdx >= 0)
  ------------------
  |  Branch (3141:45): [True: 8, False: 18]
  ------------------
 3142|      8|                                        {
 3143|      8|                                            len = AddOneMsg( szMsg, len, nLenMsg, ";", NULL );
 3144|      8|                                        }
 3145|     26|                                        len = AddOneMsg( szMsg, len, nLenMsg, CompareInchiMsgsGroup[iCurGrpIdx].szGroupName, NULL );
 3146|     26|                                    }
 3147|     28|                                    len = AddOneMsg( szMsg, len, nLenMsg, CompareInchiMsgs[k].szMsg, iCurGrpIdx == iPrevGrpIdx ? "," : NULL );
  ------------------
  |  Branch (3147:102): [True: 2, False: 26]
  ------------------
 3148|     28|                                    iPrevGrpIdx = iCurGrpIdx;
 3149|     28|                                    bFound = 1;
 3150|     28|                                    break;
 3151|     28|                                }
 3152|    204|                            }
 3153|     28|                        }
 3154|    702|                    }
 3155|     28|                }
 3156|  2.30k|                bit <<= 1;
 3157|  2.30k|            } while (bit);
  ------------------
  |  Branch (3157:22): [True: 2.26k, False: 36]
  ------------------
 3158|       |
 3159|     36|            if (bits[bMobileH])
  ------------------
  |  Branch (3159:17): [True: 18, False: 18]
  ------------------
 3160|     18|            {
 3161|     18|                len = AddOneMsg( szMsg, len, nLenMsg, ")", NULL );
 3162|     18|            }
 3163|       |
 3164|     36|        }
 3165|     18|    }
 3166|       |
 3167|     31|    return mismatch; /*len; */
 3168|     31|}

inchi_qsort:
   64|   440k|{
   65|   440k|    char *lo, *hi;              /* ends of sub-array currently sorting */
   66|   440k|    char *mid;                  /* points to middle of subarray */
   67|   440k|    char *loguy, *higuy;        /* traveling pointers for partition step */
   68|   440k|    size_t size;                /* size of the sub-array */
   69|   440k|    char *lostk[STKSIZ], *histk[STKSIZ];
   70|   440k|    int stkptr;                 /* stack for saving sub-array to be processed */
   71|       |
   72|   440k|    if (num < 2)
  ------------------
  |  Branch (72:9): [True: 436k, False: 3.28k]
  ------------------
   73|   436k|        return;                 /* nothing to do */
   74|       |
   75|  3.28k|    stkptr = 0;                 /* initialize stack */
   76|       |
   77|  3.28k|    lo = (char *) base;
   78|  3.28k|    hi = (char *) base + width * ( num - 1 );        /* initialize limits */
   79|       |
   80|       |    /* This entry point is for pseudo-recursion calling: setting
   81|       |    lo and hi and jumping to here is like recursion, but stkptr is
   82|       |    preserved, locals aren't, so we preserve stuff on the stack */
   83|  9.97k|recurse:
   84|       |
   85|  9.97k|    size = ( hi - lo ) / width + 1;        /* number of el's to sort */
   86|       |
   87|       |    /* First we pick a partitioning element.  The efficiency of the
   88|       |    algorithm demands that we find one that is approximately the median
   89|       |    of the values, but also that we select one fast.  We choose the
   90|       |    median of the first, middle, and last elements, to avoid bad
   91|       |    performance in the face of already sorted data, or data that is made
   92|       |    up of multiple sorted runs appended together.  Testing shows that a
   93|       |    median-of-three algorithm provides better performance than simply
   94|       |    picking the middle element for the latter case. */
   95|       |
   96|  9.97k|    mid = lo + ( size / 2 ) * width;      /* find middle element */
   97|       |
   98|       |    /* Sort the first, middle, last elements into order */
   99|  9.97k|    if (comp( lo, mid, pParam ) > 0)
  ------------------
  |  Branch (99:9): [True: 1.44k, False: 8.53k]
  ------------------
  100|  1.44k|    {
  101|  1.44k|        inchi_swap( lo, mid, width );
  102|  1.44k|    }
  103|  9.97k|    if (comp( lo, hi, pParam ) > 0)
  ------------------
  |  Branch (103:9): [True: 413, False: 9.56k]
  ------------------
  104|    413|    {
  105|    413|        inchi_swap( lo, hi, width );
  106|    413|    }
  107|  9.97k|    if (comp( mid, hi, pParam ) > 0)
  ------------------
  |  Branch (107:9): [True: 1.06k, False: 8.91k]
  ------------------
  108|  1.06k|    {
  109|  1.06k|        inchi_swap( mid, hi, width );
  110|  1.06k|    }
  111|       |
  112|       |    /* We now wish to partition the array into three pieces, one consisting
  113|       |    of elements <= partition element, one of elements equal to the
  114|       |    partition element, and one of elements > than it.  This is done
  115|       |    below; comments indicate conditions established at every step. */
  116|       |
  117|  9.97k|    loguy = lo;
  118|  9.97k|    higuy = hi;
  119|       |
  120|       |    /* Note that higuy decreases and loguy increases on every iteration,
  121|       |    so loop must terminate. */
  122|  9.97k|    for (;;)
  123|  12.0k|    {
  124|       |        /* lo <= loguy < hi, lo < higuy <= hi,
  125|       |        A[i] <= A[mid] for lo <= i <= loguy,
  126|       |        A[i] > A[mid] for higuy <= i < hi,
  127|       |        A[hi] >= A[mid] */
  128|       |
  129|       |        /* The doubled loop is to avoid calling comp(mid,mid), since some
  130|       |        existing comparison funcs don't work when passed the same
  131|       |        value for both pointers. */
  132|       |
  133|  12.0k|        if (mid > loguy)
  ------------------
  |  Branch (133:13): [True: 11.4k, False: 601]
  ------------------
  134|  11.4k|        {
  135|  11.4k|            do
  136|  32.5k|            {
  137|  32.5k|                loguy += width;
  138|  32.5k|            }
  139|  32.5k|            while (loguy < mid && comp( loguy, mid, pParam ) <= 0);
  ------------------
  |  Branch (139:20): [True: 22.9k, False: 9.58k]
  |  Branch (139:35): [True: 21.1k, False: 1.84k]
  ------------------
  140|  11.4k|        }
  141|  12.0k|        if (mid <= loguy)
  ------------------
  |  Branch (141:13): [True: 10.1k, False: 1.84k]
  ------------------
  142|  10.1k|        {
  143|  10.1k|            do
  144|  14.7k|            {
  145|  14.7k|                loguy += width;
  146|  14.7k|            }
  147|  14.7k|            while (loguy <= hi && comp( loguy, mid, pParam ) <= 0);
  ------------------
  |  Branch (147:20): [True: 10.5k, False: 4.18k]
  |  Branch (147:35): [True: 4.58k, False: 5.99k]
  ------------------
  148|  10.1k|        }
  149|       |
  150|       |        /* lo < loguy <= hi+1, A[i] <= A[mid] for lo <= i < loguy,
  151|       |        either loguy > hi or A[loguy] > A[mid] */
  152|       |
  153|  12.0k|        do
  154|  29.0k|        {
  155|  29.0k|            higuy -= width;
  156|  29.0k|        }
  157|  29.0k|        while (higuy > mid && comp( higuy, mid, pParam ) > 0);
  ------------------
  |  Branch (157:16): [True: 19.0k, False: 9.93k]
  |  Branch (157:31): [True: 16.9k, False: 2.10k]
  ------------------
  158|       |
  159|       |         /* lo <= higuy < hi, A[i] > A[mid] for higuy < i < hi,
  160|       |         either higuy == lo or A[higuy] <= A[mid] */
  161|       |
  162|  12.0k|        if (higuy < loguy)
  ------------------
  |  Branch (162:13): [True: 9.97k, False: 2.05k]
  ------------------
  163|  9.97k|        {
  164|  9.97k|            break;
  165|  9.97k|        }
  166|       |
  167|       |        /* if loguy > hi or higuy == lo, then we would have exited, so
  168|       |        A[loguy] > A[mid], A[higuy] <= A[mid],
  169|       |        loguy <= hi, higuy > lo */
  170|       |
  171|  2.05k|        inchi_swap( loguy, higuy, width );
  172|       |
  173|       |        /* If the partition element was moved, follow it.  Only need
  174|       |        to check for mid == higuy, since before the swap,
  175|       |        A[loguy] > A[mid] implies loguy != mid. */
  176|       |
  177|  2.05k|        if (mid == higuy)
  ------------------
  |  Branch (177:13): [True: 396, False: 1.65k]
  ------------------
  178|    396|        {
  179|    396|            mid = loguy;
  180|    396|        }
  181|       |
  182|       |        /* A[loguy] <= A[mid], A[higuy] > A[mid]; so condition at top
  183|       |        of loop is re-established */
  184|  2.05k|    }
  185|       |
  186|       |    /*     A[i] <= A[mid] for lo <= i < loguy,
  187|       |    A[i] > A[mid] for higuy < i < hi,
  188|       |    A[hi] >= A[mid]
  189|       |    higuy < loguy
  190|       |    implying:
  191|       |    higuy == loguy-1
  192|       |    or higuy == hi - 1, loguy == hi + 1, A[hi] == A[mid] */
  193|       |
  194|       |    /* Find adjacent elements equal to the partition element.  The
  195|       |    doubled loop is to avoid calling comp(mid,mid), since some
  196|       |    existing comparison funcs don't work when passed the same value
  197|       |    for both pointers. */
  198|       |
  199|  9.97k|    higuy += width;
  200|  9.97k|    if (mid < higuy)
  ------------------
  |  Branch (200:9): [True: 5.79k, False: 4.18k]
  ------------------
  201|  5.79k|    {
  202|  5.79k|        do
  203|  5.79k|        {
  204|  5.79k|            higuy -= width;
  205|  5.79k|        }
  206|  5.79k|        while (higuy > mid && comp( higuy, mid, pParam ) == 0);
  ------------------
  |  Branch (206:16): [True: 444, False: 5.35k]
  |  Branch (206:31): [True: 0, False: 444]
  ------------------
  207|  5.79k|    }
  208|  9.97k|    if (mid >= higuy)
  ------------------
  |  Branch (208:9): [True: 9.53k, False: 444]
  ------------------
  209|  9.53k|    {
  210|  9.53k|        do
  211|  9.53k|        {
  212|  9.53k|            higuy -= width;
  213|  9.53k|        }
  214|  9.53k|        while (higuy > lo && comp( higuy, mid, pParam ) == 0);
  ------------------
  |  Branch (214:16): [True: 3.49k, False: 6.04k]
  |  Branch (214:30): [True: 0, False: 3.49k]
  ------------------
  215|  9.53k|    }
  216|       |
  217|       |    /* OK, now we have the following:
  218|       |    higuy < loguy
  219|       |    lo <= higuy <= hi
  220|       |    A[i]  <= A[mid] for lo <= i <= higuy
  221|       |    A[i]  == A[mid] for higuy < i < loguy
  222|       |    A[i]  >  A[mid] for loguy <= i < hi
  223|       |    A[hi] >= A[mid] */
  224|       |
  225|       |    /* We've finished the partition, now we want to sort the subarrays
  226|       |    [lo, higuy] and [loguy, hi].
  227|       |    We do the smaller one first to minimize stack usage.
  228|       |    We only sort arrays of length 2 or more.*/
  229|       |
  230|  9.97k|    if (higuy - lo >= hi - loguy)
  ------------------
  |  Branch (230:9): [True: 9.58k, False: 394]
  ------------------
  231|  9.58k|    {
  232|  9.58k|        if (lo < higuy)
  ------------------
  |  Branch (232:13): [True: 3.69k, False: 5.89k]
  ------------------
  233|  3.69k|        {
  234|  3.69k|            lostk[stkptr] = lo;
  235|  3.69k|            histk[stkptr] = higuy;
  236|  3.69k|            ++stkptr;
  237|  3.69k|        }                           /* save big recursion for later */
  238|       |
  239|  9.58k|        if (loguy < hi)
  ------------------
  |  Branch (239:13): [True: 2.36k, False: 7.21k]
  ------------------
  240|  2.36k|        {
  241|  2.36k|            lo = loguy;
  242|  2.36k|            goto recurse;           /* do small recursion */
  243|  2.36k|        }
  244|  9.58k|    }
  245|    394|    else
  246|    394|    {
  247|    394|        if (loguy < hi)
  ------------------
  |  Branch (247:13): [True: 394, False: 0]
  ------------------
  248|    394|        {
  249|    394|            lostk[stkptr] = loguy;
  250|    394|            histk[stkptr] = hi;
  251|    394|            ++stkptr;               /* save big recursion for later */
  252|    394|        }
  253|       |
  254|    394|        if (lo < higuy)
  ------------------
  |  Branch (254:13): [True: 248, False: 146]
  ------------------
  255|    248|        {
  256|    248|            hi = higuy;
  257|    248|            goto recurse;           /* do small recursion */
  258|    248|        }
  259|    394|    }
  260|       |
  261|       |    /* We have sorted the array, except for any pending sorts on the stack.
  262|       |    Check if there are any, and do them. */
  263|       |
  264|  7.36k|    --stkptr;
  265|  7.36k|    if (stkptr >= 0)
  ------------------
  |  Branch (265:9): [True: 4.08k, False: 3.28k]
  ------------------
  266|  4.08k|    {
  267|  4.08k|        lo = lostk[stkptr];
  268|  4.08k|        hi = histk[stkptr];
  269|  4.08k|        goto recurse;           /* pop subarray from stack */
  270|  4.08k|    }
  271|  3.28k|    else
  272|  3.28k|    {
  273|  3.28k|        return;                 /* all subarrays done */
  274|  3.28k|    }
  275|  7.36k|}
inchi_swap:
  280|   335k|{
  281|   335k|    char tmp;
  282|   335k|    if (a != b)
  ------------------
  |  Branch (282:9): [True: 335k, False: 0]
  ------------------
  283|   335k|    {
  284|  2.10M|        while (width--)
  ------------------
  |  Branch (284:16): [True: 1.77M, False: 335k]
  ------------------
  285|  1.77M|        {
  286|  1.77M|            tmp = *a;
  287|  1.77M|            *a++ = *b;
  288|  1.77M|            *b++ = tmp;
  289|  1.77M|        }
  290|   335k|    }
  291|   335k|}
insertions_sort:
  301|   224k|{
  302|   224k|    char *i, *j, *pk = (char*) base;
  303|   224k|    int  num_trans = 0;
  304|   224k|    size_t k;
  305|   228k|    for (k = 1; k < num; k++, pk += width)
  ------------------
  |  Branch (305:17): [True: 4.26k, False: 224k]
  ------------------
  306|  4.26k|    {
  307|       |        /*for( i = pk, j = pk + width; j > (char*)base && (*compare)(i,j) > 0; j=i, i -= width )*/
  308|  4.26k|        for (i = j = pk + width;
  309|  4.32k|             j > ( char* )base && ( i -= width, ( *compare )( i, j, pCG ) ) > 0;
  ------------------
  |  Branch (309:14): [True: 4.32k, False: 9]
  |  Branch (309:35): [True: 69, False: 4.25k]
  ------------------
  310|  4.26k|             j = i)        /* changed to keep BoundsChecker happy 2007-09-24 DT */
  311|     69|        {
  312|     69|            inchi_swap( i, j, width );
  313|     69|            num_trans++;
  314|     69|        }
  315|  4.26k|    }
  316|       |
  317|   224k|    return num_trans;
  318|   224k|}
insertions_sort_AT_NUMBERS:
  328|   256k|{
  329|   256k|    AT_NUMB *i, *j, *pk, tmp;
  330|   256k|    int  k, num_trans = 0;
  331|  7.60M|    for (k = 1, pk = base; k < num; k++, pk++)
  ------------------
  |  Branch (331:28): [True: 7.35M, False: 256k]
  ------------------
  332|  7.35M|    {
  333|  7.35M|        for (j = ( i = pk ) + 1, tmp = *j; j > base && ( *compare )( i, &tmp, pCG ) > 0; j = i, i--)
  ------------------
  |  Branch (333:44): [True: 7.35M, False: 0]
  |  Branch (333:56): [True: 0, False: 7.35M]
  ------------------
  334|      0|        {
  335|      0|            *j = *i;
  336|      0|            num_trans++;
  337|      0|        }
  338|  7.35M|        *j = tmp;
  339|  7.35M|    }
  340|       |
  341|   256k|    return num_trans;
  342|   256k|}
insertions_sort_NeighList_AT_NUMBERS:
  349|     24|{
  350|     24|    AT_NUMB *i, *j, *pk, tmp;
  351|     24|    AT_RANK rj; /* optimization */
  352|     24|    int k, num = (int) *base++;
  353|     48|    for (k = 1, pk = base; k < num; k++, pk++)
  ------------------
  |  Branch (353:28): [True: 24, False: 24]
  ------------------
  354|     24|    {
  355|     24|        for (j = ( i = pk ) + 1, rj = nRank[(int) *j]; j > base && nRank[(int) *i] > rj; j = i, i--)
  ------------------
  |  Branch (355:56): [True: 24, False: 0]
  |  Branch (355:68): [True: 0, False: 24]
  ------------------
  356|      0|        {
  357|      0|            tmp = *i;
  358|      0|            *i = *j;
  359|      0|            *j = tmp;
  360|      0|        }
  361|     24|    }
  362|     24|}
insertions_sort_AT_RANK:
  369|     12|{
  370|     12|    AT_RANK *i, *j, *pk, tmp;
  371|     12|    int  k, num_trans = 0;
  372|     18|    for (k = 1, pk = base; k < num; k++, pk++)
  ------------------
  |  Branch (372:28): [True: 6, False: 12]
  ------------------
  373|      6|    {
  374|      6|        for (j = ( i = pk ) + 1, tmp = *j; j > base && *i > tmp; j = i, i--)
  ------------------
  |  Branch (374:44): [True: 6, False: 0]
  |  Branch (374:56): [True: 0, False: 6]
  ------------------
  375|      0|        {
  376|      0|            *j = *i;
  377|      0|            num_trans++;
  378|      0|        }
  379|      6|        *j = tmp;
  380|      6|    }
  381|       |
  382|     12|    return num_trans;
  383|     12|}
CompNeighborsAT_NUMBER:
  447|     42|{
  448|     42|    CANON_GLOBALS *pCG = (CANON_GLOBALS *) p;
  449|     42|#ifdef CT_NEIGH_INCREASE
  450|     42|    return (int) pCG->m_pn_RankForSort[pCG->m_pNeighborsForSort[( int )*(const AT_NUMB*) a1]] -
  451|     42|           (int) pCG->m_pn_RankForSort[pCG->m_pNeighborsForSort[( int )*(const AT_NUMB*) a2]];
  452|       |#else
  453|       |    return (int) ( (CANON_GLOBALS *) pCG )->m_pn_RankForSort[pNeighborsForSort[( int )*(const AT_NUMB*) a2]] -
  454|       |           (int) ( (CANON_GLOBALS *) pCG )->m_pn_RankForSort[pNeighborsForSort[( int )*(const AT_NUMB*) a1]];
  455|       |#endif
  456|     42|}
CompRank:
  469|     30|{
  470|     30|    CANON_GLOBALS *pCG = (CANON_GLOBALS *) p;
  471|     30|    int ret = (int) pCG->m_pn_RankForSort[( int )*(const AT_RANK*) a1] -
  472|     30|              (int) pCG->m_pn_RankForSort[( int )*(const AT_RANK*) a2];
  473|       |
  474|     30|    return ret;
  475|     30|}
CompRanksOrd:
  480|  56.6k|{
  481|  56.6k|    int ret;
  482|  56.6k|    CANON_GLOBALS *pCG = (CANON_GLOBALS *) p;
  483|  56.6k|    ret = (int) pCG->m_pn_RankForSort[( int )*(const AT_RANK*) a1] -
  484|  56.6k|          (int) pCG->m_pn_RankForSort[( int )*(const AT_RANK*) a2];
  485|  56.6k|    if (!ret)
  ------------------
  |  Branch (485:9): [True: 47.2k, False: 9.44k]
  ------------------
  486|  47.2k|    {
  487|  47.2k|        ret = ( int )*(const AT_RANK*) a1 - ( int )*(const AT_RANK*) a2;
  488|  47.2k|    }
  489|       |
  490|  56.6k|    return ret;
  491|  56.6k|}
CompAtomInvariants2Only:
  496|  34.0k|{
  497|  34.0k|    CANON_GLOBALS *pCG = (CANON_GLOBALS *) p;
  498|  34.0k|    const ATOM_INVARIANT2 *pAI1 = pCG->m_pAtomInvariant2ForSort + ( int )*(const AT_RANK*) a1;
  499|  34.0k|    const ATOM_INVARIANT2 *pAI2 = pCG->m_pAtomInvariant2ForSort + ( int )*(const AT_RANK*) a2;
  500|  34.0k|    int i;
  501|   248k|    for (i = 0; i < AT_INV_BREAK1; i++)
  ------------------
  |  Branch (501:17): [True: 217k, False: 30.5k]
  ------------------
  502|   217k|    {
  503|   217k|        if (pAI1->val[i] == pAI2->val[i])
  ------------------
  |  Branch (503:13): [True: 214k, False: 3.48k]
  ------------------
  504|   214k|            continue;
  505|  3.48k|        return  (int) pAI1->val[i] - (int) pAI2->val[i];
  506|   217k|    }
  507|  30.5k|    if (pAI1->iso_sort_key != pAI2->iso_sort_key)
  ------------------
  |  Branch (507:9): [True: 799, False: 29.7k]
  ------------------
  508|    799|    {
  509|    799|        return ( pAI1->iso_sort_key > pAI2->iso_sort_key ) ? 1 : -1;
  ------------------
  |  Branch (509:16): [True: 238, False: 561]
  ------------------
  510|    799|    }
  511|  29.7k|    for (; i < AT_INV_LENGTH; i++)
  ------------------
  |  Branch (511:12): [True: 29.7k, False: 0]
  ------------------
  512|  29.7k|    {
  513|  29.7k|        if (pAI1->val[i] != pAI2->val[i])
  ------------------
  |  Branch (513:13): [True: 0, False: 29.7k]
  ------------------
  514|      0|        {
  515|      0|            continue;
  516|      0|        }
  517|  29.7k|        return  (int) pAI1->val[i] - (int) pAI2->val[i];
  518|  29.7k|    }
  519|      0|    if (pAI1->iso_aux_key != pAI2->iso_aux_key)
  ------------------
  |  Branch (519:9): [True: 0, False: 0]
  ------------------
  520|      0|    {
  521|      0|        return ( pAI1->iso_aux_key > pAI2->iso_aux_key ) ? 1 : -1;
  ------------------
  |  Branch (521:16): [True: 0, False: 0]
  ------------------
  522|      0|    }
  523|       |
  524|      0|    return 0;
  525|      0|}
CompAtomInvariants2:
  530|  29.8k|{
  531|       |    /*  Warning: the following line may be compiler implementation dependent */
  532|  29.8k|    int ret = CompAtomInvariants2Only( a1, a2, p );
  533|  29.8k|    if (!ret)
  ------------------
  |  Branch (533:9): [True: 26.6k, False: 3.22k]
  ------------------
  534|  26.6k|    {
  535|  26.6k|        ret = ( int )*(const AT_RANK*) a1 - ( int )*(const AT_RANK*) a2;
  536|  26.6k|    }
  537|       |
  538|  29.8k|    return ret;
  539|  29.8k|}
CompChemElemLex:
  545|  1.04k|{
  546|  1.04k|    return memcmp( a1, a2, 2 );
  547|  1.04k|}
CompareNeighListLex:
  554|  7.68M|{
  555|  7.68M|    int len1 = (int) *pp1++;
  556|  7.68M|    int len2 = (int) *pp2++;
  557|  7.68M|    int len = inchi_min( len1, len2 );
  ------------------
  |  |  167|  7.68M|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 7.68M]
  |  |  ------------------
  ------------------
  558|  7.68M|    int diff = 0;
  559|  7.68M|    while (len-- > 0 && !( diff = (int) nRank[*pp1++] - (int) nRank[*pp2++] ))
  ------------------
  |  Branch (559:12): [True: 0, False: 7.68M]
  |  Branch (559:25): [True: 0, False: 0]
  ------------------
  560|      0|    {
  561|      0|        ;
  562|      0|    }
  563|       |
  564|  7.68M|    return diff ? diff : ( len1 - len2 );
  ------------------
  |  Branch (564:12): [True: 0, False: 7.68M]
  ------------------
  565|  7.68M|}
CompareNeighListLexUpToMaxRank:
  572|  7.01M|{
  573|  7.01M|    int len1 = (int) *pp1++;
  574|  7.01M|    int len2 = (int) *pp2++;
  575|  7.01M|    int diff = 0;
  576|  7.01M|    int len;
  577|  7.01M|    while (0 < len1 && nRank[pp1[len1 - 1]] > nMaxAtNeighRank)
  ------------------
  |  Branch (577:12): [True: 0, False: 7.01M]
  |  Branch (577:24): [True: 0, False: 0]
  ------------------
  578|      0|    {
  579|      0|        len1--;
  580|      0|    }
  581|  7.01M|    while (0 < len2 && nRank[pp2[len2 - 1]] > nMaxAtNeighRank)
  ------------------
  |  Branch (581:12): [True: 0, False: 7.01M]
  |  Branch (581:24): [True: 0, False: 0]
  ------------------
  582|      0|    {
  583|      0|        len2--;
  584|      0|    }
  585|  7.01M|    len = inchi_min( len1, len2 );
  ------------------
  |  |  167|  7.01M|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 7.01M]
  |  |  ------------------
  ------------------
  586|  7.01M|    while (len-- > 0 && !( diff = (int) nRank[*pp1++] - (int) nRank[*pp2++] ))
  ------------------
  |  Branch (586:12): [True: 0, False: 7.01M]
  |  Branch (586:25): [True: 0, False: 0]
  ------------------
  587|      0|    {
  588|      0|        ;
  589|      0|    }
  590|       |
  591|  7.01M|    return diff ? diff : ( len1 - len2 );
  ------------------
  |  Branch (591:12): [True: 0, False: 7.01M]
  ------------------
  592|  7.01M|}
compare_NeighLists:
  597|  3.84M|{
  598|  3.84M|    CANON_GLOBALS *pCG = (CANON_GLOBALS *) p;
  599|  3.84M|    return CompareNeighListLex( *op1, *op2, pCG->m_pn_RankForSort );
  600|  3.84M|}
CompNeighListRanks:
  605|  8.26k|{
  606|  8.26k|    CANON_GLOBALS *pCG = (CANON_GLOBALS *) p;
  607|  8.26k|    int ret;
  608|  8.26k|    ret = (int) pCG->m_pn_RankForSort[*( (const AT_RANK*) a1 )] -
  609|  8.26k|          (int) pCG->m_pn_RankForSort[*( (const AT_RANK*) a2 )];
  610|  8.26k|    if (!ret)
  ------------------
  |  Branch (610:9): [True: 6.22k, False: 2.03k]
  ------------------
  611|  6.22k|    {
  612|  6.22k|        ret = compare_NeighLists( pCG->m_pNeighList_RankForSort + *( (const AT_RANK*) a1 ),
  613|  6.22k|                                     pCG->m_pNeighList_RankForSort + *( (const AT_RANK*) a2 ), p );
  614|  6.22k|    }
  615|       |
  616|  8.26k|    return ret;
  617|  8.26k|}
CompNeighLists:
  622|  3.84M|{
  623|  3.84M|    CANON_GLOBALS *pCG = (CANON_GLOBALS *) p;
  624|  3.84M|    int ret;
  625|  3.84M|    ret = compare_NeighLists( pCG->m_pNeighList_RankForSort + *( (const AT_RANK*) a1 ),
  626|  3.84M|                              pCG->m_pNeighList_RankForSort + *( (const AT_RANK*) a2 ), p );
  627|       |
  628|  3.84M|    return ret;
  629|  3.84M|}
CompNeighListsUpToMaxRank:
  634|  3.50M|{
  635|  3.50M|    CANON_GLOBALS *pCG = (CANON_GLOBALS *) p;
  636|  3.50M|    int ret;
  637|  3.50M|    ret = CompareNeighListLexUpToMaxRank( pCG->m_pNeighList_RankForSort[*( (const AT_RANK*) a1 )],
  638|  3.50M|                                          pCG->m_pNeighList_RankForSort[*( (const AT_RANK*) a2 )],
  639|  3.50M|                                          pCG->m_pn_RankForSort, pCG->m_nMaxAtNeighRankForSort );
  640|       |
  641|  3.50M|    return ret;
  642|  3.50M|}
CompNeighListRanksOrd:
  647|  4.13k|{
  648|  4.13k|    int ret = CompNeighListRanks( a1, a2, p );
  649|  4.13k|    if (!ret)
  ------------------
  |  Branch (649:9): [True: 3.11k, False: 1.01k]
  ------------------
  650|  3.11k|    {
  651|  3.11k|        ret = ( int )*( (const AT_RANK*) a1 ) - ( int )*( (const AT_RANK*) a2 ); /*  keep original order if identical */
  652|  3.11k|    }
  653|       |
  654|  4.13k|    return ret;
  655|  4.13k|}
CreateNeighListFromLinearCT:
  691|      3|{
  692|       |    /* Atom numbers in LinearCT are canonical numbers
  693|       |     * order: parent[i] > neigh[i][0] < neigh[i][1]...<neigh[i][n] < parent[i+1] > neigh[i+1][0] < ...
  694|       |     *        parent[i] < parent[i+1]
  695|       |     */
  696|      3|    int i, j;
  697|      3|    S_CHAR     *valence = NULL;
  698|      3|    NEIGH_LIST *pp = NULL;
  699|      3|    AT_NUMB    *pAtList = NULL;
  700|      3|    AT_RANK     n_vertex, n_neigh;
  701|      3|    int err = 1, num_bonds;
  702|      3|    int length, start;
  703|       |
  704|      3|    if ((int) LinearCT[0] > num_atoms)
  ------------------
  |  Branch (704:9): [True: 0, False: 3]
  ------------------
  705|      0|    {
  706|      0|        goto exit_function;
  707|      0|    }
  708|      3|    if (!( valence = (S_CHAR*) inchi_calloc( num_atoms + 1, sizeof( valence[0] ) ) ))
  ------------------
  |  | 1133|      3|#define inchi_calloc   calloc
  ------------------
  |  Branch (708:9): [True: 0, False: 3]
  ------------------
  709|      0|    {
  710|      0|        goto exit_function;
  711|      0|    }
  712|       |
  713|     27|    for (i = 1, num_bonds = 0, n_vertex = LinearCT[0]; i < nLenCT; i++)
  ------------------
  |  Branch (713:56): [True: 24, False: 3]
  ------------------
  714|     24|    {
  715|     24|        if (( n_neigh = LinearCT[i] ) < n_vertex)
  ------------------
  |  Branch (715:13): [True: 12, False: 12]
  ------------------
  716|     12|        {
  717|     12|            valence[n_neigh] ++;
  718|     12|            valence[n_vertex] ++;
  719|     12|            num_bonds += 2;
  720|     12|        }
  721|     12|        else
  722|     12|        {
  723|     12|            if ((int) ( n_vertex = n_neigh ) > num_atoms)
  ------------------
  |  Branch (723:17): [True: 0, False: 12]
  ------------------
  724|      0|            {
  725|      0|                goto exit_function;
  726|      0|            }
  727|     12|        }
  728|     24|    }
  729|      3|    if ((int) n_vertex != num_atoms)
  ------------------
  |  Branch (729:9): [True: 0, False: 3]
  ------------------
  730|      0|    {
  731|      0|        goto exit_function;
  732|      0|    }
  733|      3|    length = num_bonds + num_atoms + 1;
  734|      3|    if (pp = (NEIGH_LIST *) inchi_calloc( ( num_atoms + 1 ), sizeof( NEIGH_LIST ) ))
  ------------------
  |  | 1133|      3|#define inchi_calloc   calloc
  ------------------
  |  Branch (734:9): [True: 3, False: 0]
  ------------------
  735|      3|    {
  736|      3|        if (pAtList = (AT_NUMB *) inchi_malloc( length * sizeof( *pAtList ) ))
  ------------------
  |  | 1130|      3|#define inchi_malloc   malloc
  ------------------
  |  Branch (736:13): [True: 3, False: 0]
  ------------------
  737|      3|        {
  738|       |            /*  Create empty connection table */
  739|     18|            for (i = 1, length = 0; i <= num_atoms; i++)
  ------------------
  |  Branch (739:37): [True: 15, False: 3]
  ------------------
  740|     15|            {
  741|     15|                start = length;
  742|     15|                length += ( valence[i] + 1 );
  743|     15|                pp[i - 1] = pAtList + start;
  744|     15|                pp[i - 1][0] = 0;
  745|     15|            }
  746|       |            /*  Fill out the CT */
  747|     27|            for (i = 1, n_vertex = LinearCT[0] - 1; i < nLenCT; i++)
  ------------------
  |  Branch (747:53): [True: 24, False: 3]
  ------------------
  748|     24|            {
  749|     24|                if (( n_neigh = LinearCT[i] - 1 ) < n_vertex)
  ------------------
  |  Branch (749:21): [True: 12, False: 12]
  ------------------
  750|     12|                {
  751|       |                    /*  Vertex - neighbor connection */
  752|     12|                    j = (int) ( ++pp[(int) n_vertex][0] );
  753|     12|                    pp[(int) n_vertex][j] = n_neigh;
  754|       |                    /*  neighbor - vertex connection */
  755|     12|                    j = (int) ( ++pp[(int) n_neigh][0] );
  756|     12|                    pp[(int) n_neigh][j] = n_vertex;
  757|     12|                }
  758|     12|                else
  759|     12|                {
  760|     12|                    if ((int) ( n_vertex = n_neigh ) >= num_atoms)
  ------------------
  |  Branch (760:25): [True: 0, False: 12]
  ------------------
  761|      0|                    {
  762|      0|                        goto exit_function;
  763|      0|                    }
  764|     12|                }
  765|     24|            }
  766|      3|            err = 0;
  767|      3|        }
  768|      3|    }
  769|       |
  770|      3|exit_function:
  771|      3|    if (valence)
  ------------------
  |  Branch (771:9): [True: 3, False: 0]
  ------------------
  772|      3|    {
  773|      3|        inchi_free( valence );
  ------------------
  |  | 1136|      3|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 3, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  774|      3|    }
  775|      3|    if (err)
  ------------------
  |  Branch (775:9): [True: 0, False: 3]
  ------------------
  776|      0|    {
  777|      0|        if (pAtList)
  ------------------
  |  Branch (777:13): [True: 0, False: 0]
  ------------------
  778|      0|        {
  779|      0|            inchi_free( pAtList );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  780|      0|        }
  781|      0|        if (pp)
  ------------------
  |  Branch (781:13): [True: 0, False: 0]
  ------------------
  782|      0|        {
  783|      0|            inchi_free( pp );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  784|      0|            pp = NULL;
  785|      0|        }
  786|      0|    }
  787|       |
  788|      3|    return pp;
  789|      3|}
CreateNeighList:
  804|   110k|{
  805|       |    /*  +1 to add NULL termination */
  806|   110k|    NEIGH_LIST *pp = (NEIGH_LIST *) inchi_calloc( ( num_at_tg + 1 ), sizeof( NEIGH_LIST ) );
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
  807|   110k|    T_GROUP   *t_group = NULL;
  808|   110k|    AT_NUMB   *nEndpointAtomNumber = NULL;
  809|   110k|    int        num_t_groups = 0;
  810|   110k|    int        nFirstEndpointAtNoPos;
  811|       |
  812|   110k|    AT_NUMB   *pAtList = NULL;
  813|   110k|    int        length, start, val, i, j;
  814|   110k|    if (pp)
  ------------------
  |  Branch (814:9): [True: 110k, False: 0]
  ------------------
  815|   110k|    {
  816|   110k|        if (num_at_tg > num_atoms)
  ------------------
  |  Branch (816:13): [True: 4, False: 110k]
  ------------------
  817|      4|        {
  818|      4|            t_group = t_group_info->t_group;
  819|      4|            num_t_groups = t_group_info->num_t_groups;
  820|      4|            nEndpointAtomNumber = t_group_info->nEndpointAtomNumber;
  821|      4|        }
  822|       |
  823|   110k|        if (!bDoubleBondSquare)
  ------------------
  |  Branch (823:13): [True: 110k, False: 0]
  ------------------
  824|   110k|        {
  825|   222k|            for (i = 0, length = 0; i < num_atoms; i++)
  ------------------
  |  Branch (825:37): [True: 112k, False: 110k]
  ------------------
  826|   112k|            {
  827|   112k|                length += (int) at[i].valence + ( num_t_groups && at[i].endpoint );
  ------------------
  |  Branch (827:51): [True: 20, False: 112k]
  |  Branch (827:67): [True: 8, False: 12]
  ------------------
  828|   112k|            }
  829|   110k|            length += num_atoms;
  830|   110k|            for (i = 0; i < num_t_groups; i++)
  ------------------
  |  Branch (830:25): [True: 4, False: 110k]
  ------------------
  831|      4|            {
  832|      4|                length += (int) t_group[i].nNumEndpoints;
  833|      4|            }
  834|   110k|            length += num_t_groups;
  835|   110k|        }
  836|      0|        else
  837|      0|        {
  838|      0|            for (i = 0, length = 0; i < num_atoms; i++)
  ------------------
  |  Branch (838:37): [True: 0, False: 0]
  ------------------
  839|      0|            {
  840|      0|                val = (int) at[i].valence;
  841|      0|                for (j = 0; j < val; j++)
  ------------------
  |  Branch (841:29): [True: 0, False: 0]
  ------------------
  842|      0|                {
  843|      0|                    length += 1 + ( bDoubleBondSquare && BOND_DOUBLE == at[i].bond_type[j] );
  ------------------
  |  |  206|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (843:37): [True: 0, False: 0]
  |  Branch (843:58): [True: 0, False: 0]
  ------------------
  844|      0|                }
  845|      0|                length += ( num_t_groups && at[i].endpoint );
  ------------------
  |  Branch (845:29): [True: 0, False: 0]
  |  Branch (845:45): [True: 0, False: 0]
  ------------------
  846|      0|            }
  847|      0|            length += num_atoms;
  848|      0|            for (i = 0; i < num_t_groups; i++)
  ------------------
  |  Branch (848:25): [True: 0, False: 0]
  ------------------
  849|      0|            {
  850|      0|                length += (int) t_group[i].nNumEndpoints;
  851|      0|            }
  852|      0|            length += num_t_groups;
  853|      0|        }
  854|   110k|        length++; /*  +1 to save number of neighbors */
  855|   110k|        if (pAtList = (AT_NUMB *) inchi_malloc( length * sizeof( *pAtList ) ))
  ------------------
  |  | 1130|   110k|#define inchi_malloc   malloc
  ------------------
  |  Branch (855:13): [True: 110k, False: 0]
  ------------------
  856|   110k|        {
  857|   110k|            if (!bDoubleBondSquare)
  ------------------
  |  Branch (857:17): [True: 110k, False: 0]
  ------------------
  858|   110k|            {
  859|   222k|                for (i = 0, length = 0; i < num_atoms; i++)
  ------------------
  |  Branch (859:41): [True: 112k, False: 110k]
  ------------------
  860|   112k|                {
  861|   112k|                    val = at[i].valence;
  862|   112k|                    start = length++;
  863|   112k|                    for (j = 0; j < val; j++)
  ------------------
  |  Branch (863:33): [True: 80, False: 112k]
  ------------------
  864|     80|                    {
  865|     80|                        pAtList[length++] = at[i].neighbor[j];
  866|     80|                    }
  867|       |                    /*  add endpoint */
  868|   112k|                    if (num_t_groups && at[i].endpoint)
  ------------------
  |  Branch (868:25): [True: 20, False: 112k]
  |  Branch (868:41): [True: 8, False: 12]
  ------------------
  869|      8|                    {
  870|      8|                        pAtList[length++] = num_atoms + (int) at[i].endpoint - 1;
  871|      8|                    }
  872|   112k|                    pAtList[start] = length - start - 1;  /*  number of neighbors before the list of neighbors */
  873|   112k|                    pp[i] = pAtList + start;              /*  pointer to the <num.neigh.><list of neigh> */
  874|   112k|                }
  875|   110k|            }
  876|      0|            else
  877|      0|            {
  878|      0|                for (i = 0, length = 0; i < num_atoms; i++)
  ------------------
  |  Branch (878:41): [True: 0, False: 0]
  ------------------
  879|      0|                {
  880|      0|                    val = at[i].valence;
  881|      0|                    start = length++;
  882|      0|                    for (j = 0; j < val; j++)
  ------------------
  |  Branch (882:33): [True: 0, False: 0]
  ------------------
  883|      0|                    {
  884|      0|                        pAtList[length++] = at[i].neighbor[j];
  885|      0|                        if (bDoubleBondSquare && BOND_DOUBLE == at[i].bond_type[j])
  ------------------
  |  |  206|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (885:29): [True: 0, False: 0]
  |  Branch (885:50): [True: 0, False: 0]
  ------------------
  886|      0|                        {
  887|      0|                            pAtList[length++] = at[i].neighbor[j]; /*  a list of neighbor orig. numbers */
  888|      0|                        }
  889|      0|                    }
  890|       |                    /*  Add endpoint */
  891|      0|                    if (num_t_groups && at[i].endpoint)
  ------------------
  |  Branch (891:25): [True: 0, False: 0]
  |  Branch (891:41): [True: 0, False: 0]
  ------------------
  892|      0|                    {
  893|      0|                        pAtList[length++] = num_atoms + (int) at[i].endpoint - 1;
  894|      0|                    }
  895|      0|                    pAtList[start] = length - start - 1;  /*  number of neighbors before the list of neighbors */
  896|      0|                    pp[i] = pAtList + start;              /*  pointer to the <num.neigh.><list of neigh> */
  897|      0|                }
  898|      0|            }
  899|       |
  900|       |            /*  Add t-groups */
  901|   110k|            for (i = 0; i < num_t_groups; i++)
  ------------------
  |  Branch (901:25): [True: 4, False: 110k]
  ------------------
  902|      4|            {
  903|      4|                val = (int) t_group[i].nNumEndpoints;
  904|      4|                start = length++;
  905|      4|                nFirstEndpointAtNoPos = (int) t_group[i].nFirstEndpointAtNoPos;
  906|     12|                for (j = 0; j < val; j++)
  ------------------
  |  Branch (906:29): [True: 8, False: 4]
  ------------------
  907|      8|                {
  908|      8|                    pAtList[length++] = nEndpointAtomNumber[nFirstEndpointAtNoPos + j];
  909|      8|                }
  910|      4|                pAtList[start] = length - start - 1;  /*  number of neighbors before the list of neighbors */
  911|      4|                pp[num_atoms + i] = pAtList + start;    /*  pointer to the <num.neigh.><list of neigh> */
  912|      4|            }
  913|   110k|        }
  914|      0|        else
  915|      0|        {
  916|      0|            inchi_free( pp );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  917|      0|            return NULL;
  918|      0|        }
  919|   110k|    }
  920|       |
  921|   110k|    return pp;
  922|   110k|}
FreeNeighList:
  927|   660k|{
  928|   660k|    if (pp)
  ------------------
  |  Branch (928:9): [True: 110k, False: 550k]
  ------------------
  929|   110k|    {
  930|   110k|        if (pp[0])
  ------------------
  |  Branch (930:13): [True: 110k, False: 0]
  ------------------
  931|   110k|        {
  932|   110k|            inchi_free( pp[0] );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  933|   110k|        }
  934|   110k|        inchi_free( pp );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  935|   110k|    }
  936|       |
  937|   660k|}

bCanInpAtomBeAStereoCenter:
 1415|   225k|{
 1416|       |/*************************************************************************************
 1417|       | * current version
 1418|       | *************************************************************************************
 1419|       | *       Use #define to split the stereocenter description table into parts
 1420|       | *       to make it easier to read
 1421|       | *
 1422|       | *                      --------- 4 single bonds stereocenters -------
 1423|       | *                       0       1       2       3      4       5
 1424|       | *
 1425|       | *                       |       |       |       |      |       |
 1426|       | *                      -C-     -Si-    -Ge-    -Sn-   >As[+]  >B[-]
 1427|       | *                       |       |       |       |      |       |
 1428|       | */
 1429|   225k|#define SZELEM1         "C\000","Si",   "Ge",   "Sn",   "As", "B\000",
 1430|   225k|#define CCHARGE1         0,      0,      0,      0,      1,   -1,
 1431|   225k|#define CNUMBONDSANDH1   4,      4,      4,      4,      4,    4,
 1432|   225k|#define CCHEMVALENCEH1   4,      4,      4,      4,      4,    4,
 1433|   225k|#define CHAS3MEMBRING1   0,      0,      0,      0,      0,    0,
 1434|   225k|#define CREQUIRDNEIGH1   0,      0,      0,      0,      3,    0,
 1435|       |/*
 1436|       | *                      --------------- S, Se stereocenters ----------
 1437|       | *                       6       7       8       9      10     11    12    13
 1438|       | *
 1439|       | *                               |       |      ||             |     |     ||
 1440|       | *                      -S=     =S=     -S[+]   >S[+]   -Se=  =Se=  -Se[+] >Se[+]
 1441|       | *                       |       |       |       |       |     |     |      |
 1442|       | */
 1443|   225k|#define SZELEM2         "S\000","S\000","S\000","S\000","Se", "Se", "Se",  "Se",
 1444|   225k|#define CCHARGE2         0,      0,      1,      1,      0,    0,    1,     1,
 1445|   225k|#define CNUMBONDSANDH2   3,      4,      3,      4,      3,    4,    3,     4,
 1446|   225k|#define CCHEMVALENCEH2   4,      6,      3,      5,      4,    6,    3,     5,
 1447|   225k|#define CHAS3MEMBRING2   0,      0,      0,      0,      0,    0,    0,     0,
 1448|   225k|#define CREQUIRDNEIGH2   3,      3,      3,      3,      3,    3,    3,     3,
 1449|       |/*
 1450|       | *                      ------------------ N, P stereocenters -----------------
 1451|       | *                        14     15       16     17     18       19       20
 1452|       | *
 1453|       | *                                                             Phosphine Arsine
 1454|       | *                                      X---Y
 1455|       | *                        |      |       \ /     |       |       \ /      \ /
 1456|       | *                       =N-    >N[+]     N     >P[+]   =P-       P        As
 1457|       | *                        |      |        |      |       |        |        |
 1458|       | */
 1459|   225k|#define SZELEM3         "N\000","N\000","N\000","P\000","P\000","P\000", "As",
 1460|   225k|#define CCHARGE3         0,      1,      0,      1,      0,      0,       0,
 1461|   225k|#define CNUMBONDSANDH3   4,      4,      3,      4,      4,      3,       3,
 1462|   225k|#define CCHEMVALENCEH3   5,      4,      3,      4,      5,      3,       3,
 1463|   225k|#define CHAS3MEMBRING3   0,      0,      1,      0,      0,      0,       0,
 1464|   225k|#define CREQUIRDNEIGH3   3,      3,      1,      3,      3,      2,       2,
 1465|       |
 1466|   225k|#define PHOSPHINE_STEREO  19  /* the number must match Phosphine number in the comments, see above */
 1467|   225k|#define ARSINE_STEREO     20  /* the number must match Arsine number in the comments, see above */
 1468|       |
 1469|   225k|    static const char        szElem[][3] = { SZELEM1         SZELEM2         SZELEM3 };
  ------------------
  |  | 1429|   225k|#define SZELEM1         "C\000","Si",   "Ge",   "Sn",   "As", "B\000",
  ------------------
                  static const char        szElem[][3] = { SZELEM1         SZELEM2         SZELEM3 };
  ------------------
  |  | 1443|   225k|#define SZELEM2         "S\000","S\000","S\000","S\000","Se", "Se", "Se",  "Se",
  ------------------
                  static const char        szElem[][3] = { SZELEM1         SZELEM2         SZELEM3 };
  ------------------
  |  | 1459|   225k|#define SZELEM3         "N\000","N\000","N\000","P\000","P\000","P\000", "As",
  ------------------
 1470|   225k|    static const S_CHAR        cCharge[] = { CCHARGE1        CCHARGE2        CCHARGE3 };
  ------------------
  |  | 1430|   225k|#define CCHARGE1         0,      0,      0,      0,      1,   -1,
  ------------------
                  static const S_CHAR        cCharge[] = { CCHARGE1        CCHARGE2        CCHARGE3 };
  ------------------
  |  | 1444|   225k|#define CCHARGE2         0,      0,      1,      1,      0,    0,    1,     1,
  ------------------
                  static const S_CHAR        cCharge[] = { CCHARGE1        CCHARGE2        CCHARGE3 };
  ------------------
  |  | 1460|   225k|#define CCHARGE3         0,      1,      0,      1,      0,      0,       0,
  ------------------
 1471|   225k|    static const S_CHAR  cNumBondsAndH[] = { CNUMBONDSANDH1  CNUMBONDSANDH2  CNUMBONDSANDH3 };
  ------------------
  |  | 1431|   225k|#define CNUMBONDSANDH1   4,      4,      4,      4,      4,    4,
  ------------------
                  static const S_CHAR  cNumBondsAndH[] = { CNUMBONDSANDH1  CNUMBONDSANDH2  CNUMBONDSANDH3 };
  ------------------
  |  | 1445|   225k|#define CNUMBONDSANDH2   3,      4,      3,      4,      3,    4,    3,     4,
  ------------------
                  static const S_CHAR  cNumBondsAndH[] = { CNUMBONDSANDH1  CNUMBONDSANDH2  CNUMBONDSANDH3 };
  ------------------
  |  | 1461|   225k|#define CNUMBONDSANDH3   4,      4,      3,      4,      4,      3,       3,
  ------------------
 1472|   225k|    static const S_CHAR  cChemValenceH[] = { CCHEMVALENCEH1  CCHEMVALENCEH2  CCHEMVALENCEH3 };
  ------------------
  |  | 1432|   225k|#define CCHEMVALENCEH1   4,      4,      4,      4,      4,    4,
  ------------------
                  static const S_CHAR  cChemValenceH[] = { CCHEMVALENCEH1  CCHEMVALENCEH2  CCHEMVALENCEH3 };
  ------------------
  |  | 1446|   225k|#define CCHEMVALENCEH2   4,      6,      3,      5,      4,    6,    3,     5,
  ------------------
                  static const S_CHAR  cChemValenceH[] = { CCHEMVALENCEH1  CCHEMVALENCEH2  CCHEMVALENCEH3 };
  ------------------
  |  | 1462|   225k|#define CCHEMVALENCEH3   5,      4,      3,      4,      5,      3,       3,
  ------------------
 1473|   225k|    static const S_CHAR  cHas3MembRing[] = { CHAS3MEMBRING1  CHAS3MEMBRING2  CHAS3MEMBRING3 };
  ------------------
  |  | 1433|   225k|#define CHAS3MEMBRING1   0,      0,      0,      0,      0,    0,
  ------------------
                  static const S_CHAR  cHas3MembRing[] = { CHAS3MEMBRING1  CHAS3MEMBRING2  CHAS3MEMBRING3 };
  ------------------
  |  | 1447|   225k|#define CHAS3MEMBRING2   0,      0,      0,      0,      0,    0,    0,     0,
  ------------------
                  static const S_CHAR  cHas3MembRing[] = { CHAS3MEMBRING1  CHAS3MEMBRING2  CHAS3MEMBRING3 };
  ------------------
  |  | 1463|   225k|#define CHAS3MEMBRING3   0,      0,      1,      0,      0,      0,       0,
  ------------------
 1474|   225k|    static const S_CHAR  cRequirdNeigh[] = { CREQUIRDNEIGH1  CREQUIRDNEIGH2  CREQUIRDNEIGH3 };
  ------------------
  |  | 1434|   225k|#define CREQUIRDNEIGH1   0,      0,      0,      0,      3,    0,
  ------------------
                  static const S_CHAR  cRequirdNeigh[] = { CREQUIRDNEIGH1  CREQUIRDNEIGH2  CREQUIRDNEIGH3 };
  ------------------
  |  | 1448|   225k|#define CREQUIRDNEIGH2   3,      3,      3,      3,      3,    3,    3,     3,
  ------------------
                  static const S_CHAR  cRequirdNeigh[] = { CREQUIRDNEIGH1  CREQUIRDNEIGH2  CREQUIRDNEIGH3 };
  ------------------
  |  | 1464|   225k|#define CREQUIRDNEIGH3   3,      3,      1,      3,      3,      2,       2,
  ------------------
 1475|       |
 1476|   225k|    static const int n = sizeof( szElem ) / sizeof( szElem[0] );
 1477|       |    /* reqired neighbor types (bitmap):
 1478|       |       0 => check bonds only
 1479|       |       1 => no terminal hydrogen atom neighbors
 1480|       |       2 => no terminal -X and -XH together (don't care the bond type, charge, radical)
 1481|       |            (X = tautomeric endpoint atom)
 1482|       |       Note: whenever cChemValenceH[] > cNumBondsAndH[]
 1483|       |             the tautomeric and/or alternating bonds
 1484|       |             are permitted
 1485|       |
 1486|       |    */
 1487|   225k|    int i, ret = 0;
 1488|  4.96M|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (1488:17): [True: 4.74M, False: 225k]
  ------------------
 1489|  4.74M|    {
 1490|  4.74M|        if (!strcmp( at[cur_at].elname, szElem[i] ) &&
  ------------------
  |  Branch (1490:13): [True: 5.41k, False: 4.73M]
  ------------------
 1491|  4.74M|            ( at[cur_at].charge == cCharge[i]
  ------------------
  |  Branch (1491:13): [True: 3.38k, False: 2.03k]
  ------------------
 1492|       |#ifdef ALLOW_NO_CHARGE_ON_STEREO_CENTERS
 1493|       |              || at[cur_at].charge == 0
 1494|       |#endif
 1495|  5.41k|              ) &&
 1496|  4.74M|              ( !at[cur_at].radical || at[cur_at].radical == 1 ) &&
  ------------------
  |  Branch (1496:17): [True: 3.38k, False: 0]
  |  Branch (1496:40): [True: 0, False: 0]
  ------------------
 1497|  4.74M|             at[cur_at].valence + at[cur_at].num_H == cNumBondsAndH[i] &&
  ------------------
  |  Branch (1497:14): [True: 0, False: 3.38k]
  ------------------
 1498|  4.74M|             at[cur_at].chem_bonds_valence + at[cur_at].num_H == cChemValenceH[i] &&
  ------------------
  |  Branch (1498:14): [True: 0, False: 0]
  ------------------
 1499|  4.74M|             ( cHas3MembRing[i] ? is_atom_in_3memb_ring( at, cur_at ) : 1 ) &&
  ------------------
  |  Branch (1499:14): [True: 0, False: 0]
  |  Branch (1499:16): [True: 0, False: 0]
  ------------------
 1500|  4.74M|             bInpAtomHasRequirdNeigh( at, cur_at, cRequirdNeigh[i], cChemValenceH[i] - cNumBondsAndH[i], bStereoAtZz ))
  ------------------
  |  Branch (1500:14): [True: 0, False: 0]
  ------------------
 1501|       |            /*
 1502|       |            if (!strcmp( at[cur_at].elname, szElem[i] ) &&
 1503|       |             at[cur_at].charge == cCharge[i] &&
 1504|       |             ( !at[cur_at].radical || at[cur_at].radical == 1 ) &&
 1505|       |             at[cur_at].valence + at[cur_at].num_H == cNumBondsAndH[i] &&
 1506|       |             at[cur_at].chem_bonds_valence + at[cur_at].num_H == cChemValenceH[i] &&
 1507|       |             ( cHas3MembRing[i] ? is_atom_in_3memb_ring( at, cur_at ) : 1 ) &&
 1508|       |             bInpAtomHasRequirdNeigh( at, cur_at, cRequirdNeigh[i], cChemValenceH[i] - cNumBondsAndH[i], bStereoAtZz ))*/
 1509|      0|        {
 1510|      0|            ret = cNumBondsAndH[i];
 1511|      0|            break;
 1512|      0|        }
 1513|  4.74M|    }
 1514|       |
 1515|   225k|    if (i == PHOSPHINE_STEREO && !( bPointedEdgeStereo & PES_BIT_PHOSPHINE_STEREO ))
  ------------------
  |  | 1466|   451k|#define PHOSPHINE_STEREO  19  /* the number must match Phosphine number in the comments, see above */
  ------------------
                  if (i == PHOSPHINE_STEREO && !( bPointedEdgeStereo & PES_BIT_PHOSPHINE_STEREO ))
  ------------------
  |  |   73|      0|#define PES_BIT_PHOSPHINE_STEREO     2
  ------------------
  |  Branch (1515:9): [True: 0, False: 225k]
  |  Branch (1515:34): [True: 0, False: 0]
  ------------------
 1516|      0|    {
 1517|      0|        ret = 0;
 1518|      0|    }
 1519|   225k|    if (i == ARSINE_STEREO && !( bPointedEdgeStereo & PES_BIT_ARSINE_STEREO ))
  ------------------
  |  | 1467|   451k|#define ARSINE_STEREO     20  /* the number must match Arsine number in the comments, see above */
  ------------------
                  if (i == ARSINE_STEREO && !( bPointedEdgeStereo & PES_BIT_ARSINE_STEREO ))
  ------------------
  |  |   74|      0|#define PES_BIT_ARSINE_STEREO        4
  ------------------
  |  Branch (1519:9): [True: 0, False: 225k]
  |  Branch (1519:31): [True: 0, False: 0]
  ------------------
 1520|      0|    {
 1521|      0|        ret = 0;
 1522|      0|    }
 1523|       |
 1524|   225k|    return ret;
 1525|   225k|}
bCanAtomHaveAStereoBond:
 1574|     56|{
 1575|     56|    static const char   szElem[][3] = { "C\000", "Si", "Ge", "N\000", "N\000" };
 1576|     56|    static const S_CHAR   cCharge[] = { 0,        0,    0,   0,       1, };
 1577|     56|    static const int       n = sizeof( szElem ) / sizeof( szElem[0] );
 1578|     56|    int i, ret = 0;
 1579|    336|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (1579:17): [True: 280, False: 56]
  ------------------
 1580|    280|    {
 1581|    280|        if (!strcmp( elname, szElem[i] ) && ( charge == cCharge[i] ))
  ------------------
  |  Branch (1581:13): [True: 28, False: 252]
  |  Branch (1581:45): [True: 0, False: 28]
  ------------------
 1582|      0|        {
 1583|      0|            ret = ( !radical || radical == RADICAL_SINGLET );
  ------------------
  |  |  103|      0|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (1583:21): [True: 0, False: 0]
  |  Branch (1583:33): [True: 0, False: 0]
  ------------------
 1584|      0|            break;
 1585|      0|        }
 1586|    280|    }
 1587|     56|    return ret;
 1588|     56|}
FixUnkn0DStereoBonds:
 1986|   110k|{
 1987|   110k|    int i, m, num = 0;
 1988|       |
 1989|       |    /* Add usual Unknown stereobond descriptors to each Unknown bond */
 1990|   222k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (1990:17): [True: 112k, False: 110k]
  ------------------
 1991|   112k|    {
 1992|   112k|        for (m = 0; m < MAX_NUM_STEREO_BONDS && at[i].sb_parity[m]; m++)
  ------------------
  |  |  876|   225k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (1992:21): [True: 112k, False: 0]
  |  Branch (1992:49): [True: 0, False: 112k]
  ------------------
 1993|      0|        {
 1994|      0|            if (AB_PARITY_UNKN == at[i].sb_parity[m])
  ------------------
  |  |  249|      0|#define AB_PARITY_UNKN   3  /* 3 => user marked as unknown parity */
  ------------------
  |  Branch (1994:17): [True: 0, False: 0]
  ------------------
 1995|      0|            {
 1996|      0|                at[i].bond_stereo[(int) at[i].sb_ord[m]] = STEREO_DBLE_EITHER;
  ------------------
  |  |   68|      0|#define STEREO_DBLE_EITHER   3
  ------------------
 1997|      0|                num++;
 1998|      0|            }
 1999|      0|        }
 2000|   112k|    }
 2001|       |#ifdef NEVER
 2002|       |    if (num)
 2003|       |    {
 2004|       |        int j;
 2005|       |        /* how to remove Unknown stereo bond parities */
 2006|       |        for (i = 0; i < num_at; i++)
 2007|       |        {
 2008|       |            for (m = 0; m < MAX_NUM_STEREO_BONDS && at[i].sb_parity[m]; m++)
 2009|       |            {
 2010|       |                if (AB_PARITY_UNKN == at[i].sb_parity[m])
 2011|       |                {
 2012|       |                    for (j = m + 1; j < MAX_NUM_STEREO_BONDS; j++)
 2013|       |                    {
 2014|       |                        at[i].sb_parity[j - 1] = at[i].sb_parity[j];
 2015|       |                        at[i].sb_ord[j - 1] = at[i].sb_ord[j];
 2016|       |                        at[i].sn_ord[j - 1] = at[i].sn_ord[j];
 2017|       |                        at[i].sn_orig_at_num[j - 1] = at[i].sn_orig_at_num[j];
 2018|       |                    }
 2019|       |                    at[i].sb_parity[j - 1] = 0;
 2020|       |                    at[i].sb_ord[j - 1] = 0;
 2021|       |                    at[i].sn_ord[j - 1] = 0;
 2022|       |                    at[i].sn_orig_at_num[j - 1] = 0;
 2023|       |                }
 2024|       |            }
 2025|       |        }
 2026|       |    }
 2027|       |#endif
 2028|       |
 2029|   110k|    return num;
 2030|   110k|}
set_stereo_parity:
 4367|   110k|{
 4368|   110k|    int num_3D_stereo_atoms = 0;
 4369|   110k|    int num_stereo_bonds = 0; /* added to fix allene stereo bug reported for FClC=C=CFCl by Burt Leland - 2009-02-05 DT */
 4370|       |
 4371|   110k|    int i, is_stereo, num_stereo, max_stereo_atoms = 0, max_stereo_bonds = 0;
 4372|   110k|    QUEUE *q = NULL;
 4373|   110k|    AT_RANK *nAtomLevel = NULL;
 4374|   110k|    S_CHAR  *cSource = NULL;
 4375|   110k|    AT_RANK min_sb_ring_size = 0;
 4376|       |
 4377|       |    /**********************************************************
 4378|       |     *
 4379|       |     * Note: this parity reflects only relative positions of
 4380|       |     *       the atoms-neighbors and their ordering in the
 4381|       |     *       lists of neighbors.
 4382|       |     *
 4383|       |     *       To obtain the actual parity, the parity of a number
 4384|       |     *       of neighbors transpositions (to obtain a sorted
 4385|       |     *       list of numbers assigned to the atoms) should be
 4386|       |     *       added.
 4387|       |     *
 4388|       |     **********************************************************/
 4389|       |
 4390|       |    /*********************************************************************************
 4391|       |
 4392|       |     An example of parity=1 for stereogenic center, tetrahedral asymmetric atom
 4393|       |
 4394|       |
 4395|       |
 4396|       |                  (1)
 4397|       |                   |
 4398|       |                   |
 4399|       |               [C] |
 4400|       |                   |
 4401|       |         (2)------(0)
 4402|       |                  /
 4403|       |                /
 4404|       |              /
 4405|       |            /
 4406|       |         (3)
 4407|       |
 4408|       |
 4409|       |     Notation: (n) is a tetrahedral atom neighbor; n is an index of a neighbor in
 4410|       |     the central_at->neighbor[] array : neighbor atom number is central_at->neighbor[n].
 4411|       |
 4412|       |     (0)-(1), (0)-(2), (0)-(3) are lines connecting atom [C] neighbors to neighbor (0)
 4413|       |     (0), (1) and (2) are in the plane
 4414|       |     (0)-(3) is directed from the plain to the viewer
 4415|       |     [C] is somewhere between (0), (1), (2), (3)
 4416|       |     Since (1)-(2)-(3)  are in a clockwise order when looking from (0), parity is 2, or even;
 4417|       |     otherwise parity would be 1, or odd.
 4418|       |
 4419|       |    **********************************************************************************
 4420|       |
 4421|       |      Examples of a stereogenic bond.
 4422|       |
 4423|       |      Notation:   [atom number], (index of a neighbor):
 4424|       |                  [1] and [2] are atoms connected by the stereogenic bond
 4425|       |                  numbers in () are indexes of neighbors of [1] or [2].
 4426|       |                  (12 x 16)z = z-component of [1]-[2] and [1]-[6] cross-product
 4427|       |
 4428|       |                                     atom [1]                     atom [2]
 4429|       |     [8]                    [4]      prod01 = (12 x 16)z < 0      prod01 = (21 x 24)z < 0
 4430|       |       \                    /        prod02 = (12 x 18)z > 0      prod02 = (21 x 25)z > 0
 4431|       |        (2)               (1)        0 transpositions because     0 transpositions because
 4432|       |          \              /           double bond is in 0 posit.   double bond is in 0 position
 4433|       |          [1]==(0)(0)==[2]           0 = (prod01 > prod02)        0 = (prod01 > prod02)
 4434|       |          /              \
 4435|       |        (1)               (2)        result: parity = 2, even     result: parity=2, even
 4436|       |       /                    \
 4437|       |     [6]                    [5]
 4438|       |
 4439|       |
 4440|       |
 4441|       |                                     atom [1]                     atom [2]
 4442|       |     [8]                    [5]      prod01 = (12 x 18)z > 0      prod01 = (21 x 24)z > 0
 4443|       |       \                    /        prod02 = (12 x 16)z < 0      prod02 = (21 x 25)z < 0
 4444|       |        (0)               (2)        2 transpositions to move     1 transposition to move
 4445|       |          \              /           at [2] from 2 to 0 pos.      at [1] from 1 to 0 position
 4446|       |          [1]==(2)(1)==[2]           1 = (prod01 > prod02)        1 = (prod01 > prod02)
 4447|       |          /              \
 4448|       |        (1)               (0)        result: parity = (1+2)       result: parity=(1+1)
 4449|       |       /                    \        2-(1+2)%2 = 1, odd           2-(1+1)%2 = 2, even
 4450|       |     [6]                    [4]
 4451|       |
 4452|       |
 4453|       |    ***********************************************************************************
 4454|       |    Note: atoms' numbers [1], [2], [4],... are not used to calculate parity at this
 4455|       |          point. They will be used for each numbering in the canonicalization.
 4456|       |    Note: parity=3 for a stereo atom means entered undefined bond direction
 4457|       |          parity=4 for an atom means parity cannot be determined from the given geometry
 4458|       |    ***********************************************************************************/
 4459|       |
 4460|   110k|    if (!at_output || !at)
  ------------------
  |  Branch (4460:9): [True: 0, False: 110k]
  |  Branch (4460:23): [True: 0, False: 110k]
  ------------------
 4461|      0|    {
 4462|      0|        return -1;
 4463|      0|    }
 4464|       |
 4465|       |    /*  Clear stereo descriptors */
 4466|   222k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (4466:17): [True: 112k, False: 110k]
  ------------------
 4467|   112k|    {
 4468|   112k|        at_output[i].parity = 0;
 4469|   112k|        at_output[i].parity2 = 0;
 4470|   112k|        memset( &at_output[i].stereo_bond_neighbor[0], 0, sizeof( at_output[0].stereo_bond_neighbor ) );
 4471|   112k|        memset( &at_output[i].stereo_bond_neighbor2[0], 0, sizeof( at_output[0].stereo_bond_neighbor2 ) );
 4472|   112k|        memset( &at_output[i].stereo_bond_ord[0], 0, sizeof( at_output[0].stereo_bond_ord ) );
 4473|   112k|        memset( &at_output[i].stereo_bond_ord2[0], 0, sizeof( at_output[0].stereo_bond_ord2 ) );
 4474|   112k|        memset( &at_output[i].stereo_bond_z_prod[0], 0, sizeof( at_output[0].stereo_bond_z_prod ) );
 4475|   112k|        memset( &at_output[i].stereo_bond_z_prod2[0], 0, sizeof( at_output[0].stereo_bond_z_prod2 ) );
 4476|   112k|        memset( &at_output[i].stereo_bond_parity[0], 0, sizeof( at_output[0].stereo_bond_parity ) );
 4477|   112k|        memset( &at_output[i].stereo_bond_parity2[0], 0, sizeof( at_output[0].stereo_bond_parity2 ) );
 4478|   112k|    }
 4479|       |
 4480|       |    /*  Estimate max numbers of stereo atoms and bonds if isotopic H are added */
 4481|   110k|    if (nMaxNumStereoAtoms || nMaxNumStereoBonds)
  ------------------
  |  Branch (4481:9): [True: 110k, False: 0]
  |  Branch (4481:31): [True: 0, False: 0]
  ------------------
 4482|   110k|    {
 4483|   222k|        for (i = 0, num_stereo = 0; i < num_at; i++)
  ------------------
  |  Branch (4483:37): [True: 112k, False: 110k]
  ------------------
 4484|   112k|        {
 4485|   112k|            int num;
 4486|   112k|            num = can_be_a_stereo_atom_with_isotopic_H( at, i, bPointedEdgeStereo, bStereoAtZz );
 4487|   112k|            if (num)
  ------------------
  |  Branch (4487:17): [True: 0, False: 112k]
  ------------------
 4488|      0|            {
 4489|      0|                max_stereo_atoms += num;
 4490|      0|            }
 4491|   112k|            else
 4492|   112k|            {
 4493|   112k|                if (( num = can_be_a_stereo_bond_with_isotopic_H( at, i, nMode ) ))
  ------------------
  |  Branch (4493:21): [True: 0, False: 112k]
  ------------------
 4494|      0|                {
 4495|       |                    /*  accept cumulenes */
 4496|      0|                    max_stereo_bonds += num;
 4497|      0|                }
 4498|   112k|            }
 4499|   112k|        }
 4500|   110k|        if (nMaxNumStereoAtoms)
  ------------------
  |  Branch (4500:13): [True: 110k, False: 0]
  ------------------
 4501|   110k|        {
 4502|   110k|            *nMaxNumStereoAtoms = max_stereo_atoms;
 4503|   110k|        }
 4504|   110k|        if (nMaxNumStereoBonds)
  ------------------
  |  Branch (4504:13): [True: 110k, False: 0]
  ------------------
 4505|   110k|        {
 4506|   110k|            *nMaxNumStereoBonds = max_stereo_bonds;
 4507|   110k|        }
 4508|   110k|    }
 4509|       |
 4510|       |    /*  Calculate stereo descriptors */
 4511|   110k|#if ( MIN_SB_RING_SIZE > 0 )
 4512|   110k|    min_sb_ring_size = (AT_RANK) ( ( ( nMode & REQ_MODE_MIN_SB_RING_MASK ) >> REQ_MODE_MIN_SB_RING_SHFT ) & AT_RANK_MASK );
  ------------------
  |  |   71|   110k|#define REQ_MODE_MIN_SB_RING_MASK   0x0F0000    /* RSB  */
  ------------------
                  min_sb_ring_size = (AT_RANK) ( ( ( nMode & REQ_MODE_MIN_SB_RING_MASK ) >> REQ_MODE_MIN_SB_RING_SHFT ) & AT_RANK_MASK );
  ------------------
  |  |   72|   110k|#define REQ_MODE_MIN_SB_RING_SHFT      16
  ------------------
                  min_sb_ring_size = (AT_RANK) ( ( ( nMode & REQ_MODE_MIN_SB_RING_MASK ) >> REQ_MODE_MIN_SB_RING_SHFT ) & AT_RANK_MASK );
  ------------------
  |  |   40|   110k|#define AT_RANK_MASK   ((AT_RANK)~0)
  ------------------
 4513|   110k|    if (min_sb_ring_size >= 3)
  ------------------
  |  Branch (4513:9): [True: 110k, False: 0]
  ------------------
 4514|   110k|    {
 4515|       |        /* Create BFS data structure for finding for each stereo bond its min. ring sizes */
 4516|   110k|        q = QueueCreate( num_at + 1, sizeof( qInt ) );
 4517|   110k|        nAtomLevel = (AT_RANK*) inchi_calloc( sizeof( nAtomLevel[0] ), num_at );
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
 4518|   110k|        cSource = (S_CHAR *) inchi_calloc( sizeof( cSource[0] ), num_at );
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
 4519|   110k|        if (!q || !cSource || !nAtomLevel)
  ------------------
  |  Branch (4519:13): [True: 0, False: 110k]
  |  Branch (4519:19): [True: 0, False: 110k]
  |  Branch (4519:31): [True: 0, False: 110k]
  ------------------
 4520|      0|        {
 4521|      0|            num_3D_stereo_atoms = CT_OUT_OF_RAM;
  ------------------
  |  |   49|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 4522|      0|            goto exit_function;
 4523|      0|        }
 4524|   110k|    }
 4525|      0|    else
 4526|      0|    {
 4527|      0|        min_sb_ring_size = 2;
 4528|      0|    }
 4529|   110k|#endif
 4530|       |
 4531|       |    /* Main cycle: set stereo parities */
 4532|   222k|    for (i = 0, num_stereo = 0; i < num_at; i++)
  ------------------
  |  Branch (4532:33): [True: 112k, False: 110k]
  ------------------
 4533|   112k|    {
 4534|   112k|        is_stereo = set_stereo_atom_parity( pCG, at_output, at, i, at + num_at, num_removed_H,
 4535|   112k|                                            bPointedEdgeStereo, vABParityUnknown, bLooseTSACheck, bStereoAtZz );
 4536|   112k|        if (is_stereo)
  ------------------
  |  Branch (4536:13): [True: 0, False: 112k]
  ------------------
 4537|      0|        {
 4538|      0|            num_3D_stereo_atoms += ATOM_PARITY_WELL_DEF( is_stereo );
  ------------------
  |  |  287|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  265|      0|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  264|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (287:38): [True: 0, False: 0]
  |  |  |  Branch (287:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4539|      0|        }
 4540|   112k|        else
 4541|   112k|        {
 4542|   112k|            is_stereo = set_stereo_bonds_parity( at_output, at, i, at + num_at,
 4543|   112k|                                                 num_removed_H, nMode,q,
 4544|   112k|                                                 nAtomLevel, cSource,
 4545|   112k|                                                 min_sb_ring_size,
 4546|   112k|                                                 bPointedEdgeStereo,
 4547|   112k|                                                 vABParityUnknown );
 4548|   112k|            if (RETURNED_ERROR( is_stereo ))
  ------------------
  |  |   72|   112k|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   68|   112k|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   66|   112k|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|   112k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   69|   112k|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   46|   112k|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (72:31): [True: 112k, False: 0]
  |  |  |  Branch (72:53): [True: 0, False: 112k]
  |  |  ------------------
  ------------------
 4549|      0|            {
 4550|      0|                num_3D_stereo_atoms = is_stereo;
 4551|      0|                break;
 4552|      0|            }
 4553|   112k|            num_stereo_bonds += ( is_stereo != 0 ); /* added to fix bug reported by Burt Leland - 2009-02-05 DT */
 4554|   112k|        }
 4555|   112k|        num_stereo += ( is_stereo != 0 );
 4556|   112k|        is_stereo = is_stereo;
 4557|   112k|    }
 4558|       |
 4559|       |    /* Added to fix bug reported by Burt Leland - 2009-02-05 DT */
 4560|   110k|    if (max_stereo_atoms < num_3D_stereo_atoms && nMaxNumStereoAtoms)
  ------------------
  |  Branch (4560:9): [True: 0, False: 110k]
  |  Branch (4560:51): [True: 0, False: 0]
  ------------------
 4561|      0|    {
 4562|      0|        *nMaxNumStereoAtoms = num_3D_stereo_atoms;
 4563|      0|    }
 4564|   110k|    if (max_stereo_bonds < num_stereo_bonds && nMaxNumStereoBonds)
  ------------------
  |  Branch (4564:9): [True: 0, False: 110k]
  |  Branch (4564:48): [True: 0, False: 0]
  ------------------
 4565|      0|    {
 4566|      0|        *nMaxNumStereoBonds = num_stereo_bonds;
 4567|      0|    }
 4568|       |
 4569|       |    /*
 4570|       |    if ( (nMode & REQ_MODE_SC_IGN_ALL_UU )
 4571|       |    REQ_MODE_SC_IGN_ALL_UU
 4572|       |    REQ_MODE_SB_IGN_ALL_UU
 4573|       |    */
 4574|       |
 4575|   110k|#if ( MIN_SB_RING_SIZE > 0 )
 4576|   110k|    if (q)
  ------------------
  |  Branch (4576:9): [True: 110k, False: 0]
  ------------------
 4577|   110k|    {
 4578|   110k|        q = QueueDelete( q );
 4579|   110k|    }
 4580|   110k|    if (nAtomLevel)
  ------------------
  |  Branch (4580:9): [True: 110k, False: 0]
  ------------------
 4581|   110k|    {
 4582|   110k|        inchi_free( nAtomLevel );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4583|   110k|    }
 4584|   110k|    if (cSource)
  ------------------
  |  Branch (4584:9): [True: 110k, False: 0]
  ------------------
 4585|   110k|    {
 4586|   110k|        inchi_free( cSource );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4587|   110k|    }
 4588|       |
 4589|   110k|exit_function:
 4590|   110k|#endif
 4591|       |
 4592|   110k|    return num_3D_stereo_atoms;
 4593|   110k|}
ReconcileAllCmlBondParities:
 4620|   165k|{
 4621|   165k|    int i, ret = 0;
 4622|   165k|    S_CHAR *visited = (S_CHAR*) inchi_calloc( num_atoms, sizeof( *visited ) );
  ------------------
  |  | 1133|   165k|#define inchi_calloc   calloc
  ------------------
 4623|   165k|    if (!visited)
  ------------------
  |  Branch (4623:9): [True: 0, False: 165k]
  ------------------
 4624|      0|    {
 4625|      0|        return -1; /* out of RAM */
 4626|      0|    }
 4627|   986k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (4627:17): [True: 820k, False: 165k]
  ------------------
 4628|   820k|    {
 4629|   820k|        if (at[i].sb_parity[0] && !visited[i] && !( bDisconnected && is_el_a_metal( at[i].el_number ) ))
  ------------------
  |  Branch (4629:13): [True: 0, False: 820k]
  |  Branch (4629:35): [True: 0, False: 0]
  |  Branch (4629:53): [True: 0, False: 0]
  |  Branch (4629:70): [True: 0, False: 0]
  ------------------
 4630|      0|        {
 4631|      0|            if (ret = ReconcileCmlIncidentBondParities( at, i, -1, visited, bDisconnected ))
  ------------------
  |  Branch (4631:17): [True: 0, False: 0]
  ------------------
 4632|      0|            {
 4633|      0|                break; /* error */
 4634|      0|            }
 4635|      0|        }
 4636|   820k|    }
 4637|   165k|    inchi_free( visited );
  ------------------
  |  | 1136|   165k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 165k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4638|       |
 4639|   165k|    return ret;
 4640|   165k|}
ichister.c:can_be_a_stereo_atom_with_isotopic_H:
 3666|   112k|{
 3667|   112k|    int nNumNeigh;
 3668|   112k|    if (( nNumNeigh = bCanInpAtomBeAStereoCenter( at, cur_at, bPointedEdgeStereo, bStereoAtZz ) ) &&
  ------------------
  |  Branch (3668:9): [True: 0, False: 112k]
  ------------------
 3669|   112k|         at[cur_at].valence + at[cur_at].num_H == nNumNeigh &&
  ------------------
  |  Branch (3669:10): [True: 0, False: 0]
  ------------------
 3670|   112k|         at[cur_at].num_H <= NUM_H_ISOTOPES
  ------------------
  |  |   53|      0|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (3670:10): [True: 0, False: 0]
  ------------------
 3671|   112k|       )
 3672|      0|    {
 3673|      0|        return 1;
 3674|      0|    }
 3675|       |
 3676|   112k|    return 0;
 3677|   112k|}
ichister.c:can_be_a_stereo_bond_with_isotopic_H:
 2613|   112k|{
 2614|   112k|    int i, j, next_at, num_stereo_bonds, bFound;
 2615|   112k|    int bond_type, num_2s, num_alt;
 2616|   112k|    int num_2s_next, num_alt_next, num_wrong_bonds_1, num_wrong_bonds_2;
 2617|   112k|#if ( N_V_STEREOBONDS == 1 )
 2618|   112k|    int n2sh, num_2s_hetero[2], num_2s_hetero_next[2], next_next_at, type_N, type_N_next;
 2619|   112k|#endif
 2620|       |
 2621|   112k|    if (MAX_NUM_STEREO_BOND_NEIGH < at[cur_at].valence + at[cur_at].num_H ||
  ------------------
  |  |  877|   112k|#define MAX_NUM_STEREO_BOND_NEIGH 3
  ------------------
  |  Branch (2621:9): [True: 0, False: 112k]
  ------------------
 2622|   112k|         MIN_NUM_STEREO_BOND_NEIGH > at[cur_at].valence + at[cur_at].num_H)
  ------------------
  |  |  878|   112k|#define MIN_NUM_STEREO_BOND_NEIGH 2
  ------------------
  |  Branch (2622:10): [True: 112k, False: 28]
  ------------------
 2623|   112k|    {
 2624|   112k|        return 0;
 2625|   112k|    }
 2626|     28|    if (!bCanAtomHaveAStereoBond( at[cur_at].elname, at[cur_at].charge, at[cur_at].radical ))
  ------------------
  |  Branch (2626:9): [True: 28, False: 0]
  ------------------
 2627|     28|    {
 2628|     28|        return 0;
 2629|     28|    }
 2630|       |
 2631|       |    /*  Count bonds and find the second atom on the stereo bond */
 2632|      0|    num_2s = num_alt = num_wrong_bonds_1 = 0;
 2633|      0|#if ( N_V_STEREOBONDS == 1 )
 2634|      0|    num_2s_hetero[0] = num_2s_hetero[1] = type_N = 0;
 2635|      0|    if (0 == at[cur_at].num_H && 0 == at[cur_at].charge && 0 == at[cur_at].radical &&
  ------------------
  |  Branch (2635:9): [True: 0, False: 0]
  |  Branch (2635:34): [True: 0, False: 0]
  |  Branch (2635:60): [True: 0, False: 0]
  ------------------
 2636|      0|         3 == get_endpoint_valence( at[cur_at].el_number ))
  ------------------
  |  Branch (2636:10): [True: 0, False: 0]
  ------------------
 2637|      0|    {
 2638|      0|        if (2 == at[cur_at].valence && 3 == at[cur_at].chem_bonds_valence)
  ------------------
  |  Branch (2638:13): [True: 0, False: 0]
  |  Branch (2638:40): [True: 0, False: 0]
  ------------------
 2639|      0|        {
 2640|      0|            type_N = 1;
 2641|      0|        }
 2642|      0|        else
 2643|      0|        {
 2644|      0|            if (3 == at[cur_at].valence && 5 == at[cur_at].chem_bonds_valence)
  ------------------
  |  Branch (2644:17): [True: 0, False: 0]
  |  Branch (2644:44): [True: 0, False: 0]
  ------------------
 2645|      0|            {
 2646|      0|                type_N = 2; /* unfortunately includes >N# */
 2647|      0|            }
 2648|      0|        }
 2649|      0|    }
 2650|      0|#endif
 2651|      0|    for (i = 0, num_stereo_bonds = 0; i < at[cur_at].valence; i++)
  ------------------
  |  Branch (2651:39): [True: 0, False: 0]
  ------------------
 2652|      0|    {
 2653|      0|        bFound = 0;
 2654|      0|        next_at = at[cur_at].neighbor[i];
 2655|      0|        bond_type = get_allowed_stereo_bond_type( (int) at[cur_at].bond_type[i] );
 2656|      0|        if (bond_type == BOND_ALTERN)
  ------------------
  |  |  208|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   63|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (2656:13): [True: 0, False: 0]
  ------------------
 2657|      0|        {
 2658|      0|            num_alt++;
 2659|      0|            if (cur_at > next_at && !( nMode & CMODE_NO_ALT_SBONDS ))
  ------------------
  |  |  780|      0|#define CMODE_NO_ALT_SBONDS      0x000100 /* 6-14-2002: do not assign stereo to alternating bonds */
  ------------------
  |  Branch (2659:17): [True: 0, False: 0]
  |  Branch (2659:37): [True: 0, False: 0]
  ------------------
 2660|      0|            {
 2661|      0|                bFound = 1;
 2662|      0|            }
 2663|      0|        }
 2664|      0|        else
 2665|      0|        {
 2666|      0|            if (bond_type == BOND_DOUBLE)
  ------------------
  |  |  206|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (2666:17): [True: 0, False: 0]
  ------------------
 2667|      0|            {
 2668|      0|                num_2s++;
 2669|      0|#if ( N_V_STEREOBONDS == 1 )
 2670|      0|                if (0 <= ( n2sh = bIsSuitableHeteroInpAtom( at + next_at ) ))
  ------------------
  |  Branch (2670:21): [True: 0, False: 0]
  ------------------
 2671|      0|                {
 2672|      0|                    num_2s_hetero[n2sh] ++; /* n2sh=0 -> =N- or =NH; n2sh=1 -> =O */
 2673|      0|                }
 2674|      0|#endif
 2675|      0|                if (cur_at > next_at)
  ------------------
  |  Branch (2675:21): [True: 0, False: 0]
  ------------------
 2676|      0|                    bFound = 1;
 2677|      0|            }
 2678|      0|            else
 2679|      0|            {
 2680|      0|                if (bond_type != BOND_SINGLE && bond_type != BOND_TAUTOM)
  ------------------
  |  |  205|      0|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
                              if (bond_type != BOND_SINGLE && bond_type != BOND_TAUTOM)
  ------------------
  |  |  213|      0|#define BOND_TAUTOM              8
  ------------------
  |  Branch (2680:21): [True: 0, False: 0]
  |  Branch (2680:49): [True: 0, False: 0]
  ------------------
 2681|      0|                {
 2682|      0|                    num_wrong_bonds_1++;
 2683|      0|#if ( ONE_BAD_SB_NEIGHBOR == 1 )
 2684|      0|                    if (num_wrong_bonds_1 > 1 || num_wrong_bonds_1 && 2 >= at[cur_at].valence)
  ------------------
  |  Branch (2684:25): [True: 0, False: 0]
  |  Branch (2684:50): [True: 0, False: 0]
  |  Branch (2684:71): [True: 0, False: 0]
  ------------------
 2685|      0|                    {
 2686|      0|                        return 0; /* wrong bond type */
 2687|      0|                    }
 2688|      0|                    else
 2689|      0|                    {
 2690|      0|                        continue;
 2691|      0|                    }
 2692|       |#else
 2693|       |                    return 0; /*  wrong bond type */
 2694|       |#endif
 2695|      0|                }
 2696|      0|            }
 2697|      0|        }
 2698|       |
 2699|      0|        if (bFound)
  ------------------
  |  Branch (2699:13): [True: 0, False: 0]
  ------------------
 2700|      0|        {
 2701|       |            /*  check "next_at" atom on the opposite side of the bond */
 2702|      0|            if (MAX_NUM_STEREO_BOND_NEIGH < at[next_at].valence + at[next_at].num_H ||
  ------------------
  |  |  877|      0|#define MAX_NUM_STEREO_BOND_NEIGH 3
  ------------------
  |  Branch (2702:17): [True: 0, False: 0]
  ------------------
 2703|      0|                 MIN_NUM_STEREO_BOND_NEIGH > at[next_at].valence + at[next_at].num_H)
  ------------------
  |  |  878|      0|#define MIN_NUM_STEREO_BOND_NEIGH 2
  ------------------
  |  Branch (2703:18): [True: 0, False: 0]
  ------------------
 2704|      0|            {
 2705|      0|                continue;
 2706|      0|            }
 2707|      0|            if (!bCanAtomHaveAStereoBond( at[next_at].elname, at[next_at].charge, at[next_at].radical ))
  ------------------
  |  Branch (2707:17): [True: 0, False: 0]
  ------------------
 2708|      0|            {
 2709|      0|                continue;
 2710|      0|            }
 2711|       |            /*  next atom neighbors */
 2712|      0|            num_2s_next = num_alt_next = num_wrong_bonds_2 = 0;
 2713|      0|#if ( N_V_STEREOBONDS == 1 )
 2714|      0|            num_2s_hetero_next[0] = num_2s_hetero_next[1] = type_N_next = 0;
 2715|      0|            if (0 == at[next_at].num_H && 0 == at[next_at].charge && 0 == at[next_at].radical &&
  ------------------
  |  Branch (2715:17): [True: 0, False: 0]
  |  Branch (2715:43): [True: 0, False: 0]
  |  Branch (2715:70): [True: 0, False: 0]
  ------------------
 2716|      0|                 3 == get_endpoint_valence( at[next_at].el_number ))
  ------------------
  |  Branch (2716:18): [True: 0, False: 0]
  ------------------
 2717|      0|            {
 2718|      0|                if (2 == at[next_at].valence && 3 == at[next_at].chem_bonds_valence)
  ------------------
  |  Branch (2718:21): [True: 0, False: 0]
  |  Branch (2718:49): [True: 0, False: 0]
  ------------------
 2719|      0|                {
 2720|      0|                    type_N_next = 1; /* -N= */
 2721|      0|                }
 2722|      0|                else
 2723|      0|                {
 2724|      0|                    if (3 == at[next_at].valence && 5 == at[next_at].chem_bonds_valence)
  ------------------
  |  Branch (2724:25): [True: 0, False: 0]
  |  Branch (2724:53): [True: 0, False: 0]
  ------------------
 2725|      0|                    {
 2726|      0|                        type_N_next = 2; /* unfortunately includes >N# */
 2727|      0|                    }
 2728|      0|                }
 2729|      0|            }
 2730|      0|#endif
 2731|      0|            for (j = 0; j < at[next_at].valence; j++)
  ------------------
  |  Branch (2731:25): [True: 0, False: 0]
  ------------------
 2732|      0|            {
 2733|      0|                bond_type = get_allowed_stereo_bond_type( (int) at[next_at].bond_type[j] );
 2734|      0|                if (bond_type == BOND_ALTERN)
  ------------------
  |  |  208|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   63|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (2734:21): [True: 0, False: 0]
  ------------------
 2735|      0|                {
 2736|      0|                    num_alt_next++;
 2737|      0|                }
 2738|      0|                else
 2739|      0|                {
 2740|      0|                    if (bond_type == BOND_DOUBLE)
  ------------------
  |  |  206|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (2740:25): [True: 0, False: 0]
  ------------------
 2741|      0|                    {
 2742|      0|                        num_2s_next++;
 2743|      0|#if ( N_V_STEREOBONDS == 1 )
 2744|      0|                        next_next_at = at[next_at].neighbor[j];
 2745|      0|                        if (0 <= ( n2sh = bIsSuitableHeteroInpAtom( at + next_next_at ) ))
  ------------------
  |  Branch (2745:29): [True: 0, False: 0]
  ------------------
 2746|      0|                        {
 2747|      0|                            num_2s_hetero_next[n2sh] ++; /* n2sh=0 -> =N- or =NH; n2sh=1 -> =O */
 2748|      0|                        }
 2749|      0|#endif
 2750|      0|                    }
 2751|      0|                    else
 2752|      0|                    {
 2753|      0|                        if (bond_type != BOND_SINGLE && bond_type != BOND_TAUTOM)
  ------------------
  |  |  205|      0|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
                                      if (bond_type != BOND_SINGLE && bond_type != BOND_TAUTOM)
  ------------------
  |  |  213|      0|#define BOND_TAUTOM              8
  ------------------
  |  Branch (2753:29): [True: 0, False: 0]
  |  Branch (2753:57): [True: 0, False: 0]
  ------------------
 2754|      0|                        {
 2755|      0|                            num_wrong_bonds_2++;
 2756|      0|#if ( ONE_BAD_SB_NEIGHBOR == 1 )
 2757|      0|                            if (num_wrong_bonds_1 > 1 || num_wrong_bonds_1 && 2 >= at[cur_at].valence)
  ------------------
  |  Branch (2757:33): [True: 0, False: 0]
  |  Branch (2757:58): [True: 0, False: 0]
  |  Branch (2757:79): [True: 0, False: 0]
  ------------------
 2758|      0|                            {
 2759|      0|                                break; /* wrong bond type */
 2760|      0|                            }
 2761|      0|                            else
 2762|      0|                            {
 2763|      0|                                continue;
 2764|      0|                            }
 2765|       |#else
 2766|       |                            break; /*  wrong bond type */
 2767|       |#endif
 2768|      0|                        }
 2769|      0|                    }
 2770|      0|                }
 2771|      0|            }
 2772|       |            /* figure out whether the at[cur_at]--at[next_at] bond may not be stereogenic */
 2773|       |
 2774|      0|#if ( N_V_STEREOBONDS == 1 )
 2775|      0|            if (3 == ( type_N | type_N_next ) &&
  ------------------
  |  Branch (2775:17): [True: 0, False: 0]
  ------------------
 2776|      0|                ( 2 == type_N && !bIsOxide( at, cur_at ) ||
  ------------------
  |  Branch (2776:19): [True: 0, False: 0]
  |  Branch (2776:34): [True: 0, False: 0]
  ------------------
 2777|      0|                    2 == type_N_next && !bIsOxide( at, next_at ) ))
  ------------------
  |  Branch (2777:21): [True: 0, False: 0]
  |  Branch (2777:41): [True: 0, False: 0]
  ------------------
 2778|      0|            {
 2779|      0|                bFound = 0;
 2780|      0|            }
 2781|      0|            else
 2782|      0|#endif
 2783|      0|            {
 2784|      0|                if (j < at[next_at].valence ||                  /* at[next_at] has a wrong bond type*/
  ------------------
  |  Branch (2784:21): [True: 0, False: 0]
  ------------------
 2785|      0|                    ( num_alt_next > 0 ) + ( num_2s_next > 0 ) != 1     /* only one type of stereogenic bond permitted */
  ------------------
  |  Branch (2785:21): [True: 0, False: 0]
  ------------------
 2786|      0|                       )
 2787|      0|                {
 2788|      0|                    bFound = 0;
 2789|      0|                }
 2790|      0|                else
 2791|      0|                {
 2792|      0|                    if (2 < num_2s_next)
  ------------------
  |  Branch (2792:25): [True: 0, False: 0]
  ------------------
 2793|      0|                    {
 2794|      0|                        bFound = 0;
 2795|      0|                    }
 2796|      0|                    else
 2797|      0|                    {
 2798|      0|                        if (2 == num_2s_next)
  ------------------
  |  Branch (2798:29): [True: 0, False: 0]
  ------------------
 2799|      0|                        {
 2800|      0|                            if (2 == at[next_at].valence)
  ------------------
  |  Branch (2800:33): [True: 0, False: 0]
  ------------------
 2801|      0|                            {
 2802|      0|                                ; /* only one double bond permitted except cumulenes */
 2803|      0|#if ( N_V_STEREOBONDS == 1 )
 2804|      0|                            }
 2805|      0|                            else
 2806|      0|                            {
 2807|      0|                                if (1 == ( num_2s_hetero_next[0] | num_2s_hetero_next[1] ) &&
  ------------------
  |  Branch (2807:37): [True: 0, False: 0]
  ------------------
 2808|      0|                                        3 == at[next_at].valence + at[next_at].num_H &&
  ------------------
  |  Branch (2808:41): [True: 0, False: 0]
  ------------------
 2809|      0|                                        5 == at[next_at].chem_bonds_valence + at[next_at].num_H &&
  ------------------
  |  Branch (2809:41): [True: 0, False: 0]
  ------------------
 2810|      0|                                        3 == get_endpoint_valence( at[next_at].el_number ) &&
  ------------------
  |  Branch (2810:41): [True: 0, False: 0]
  ------------------
 2811|      0|                                        ( !type_N || bIsOxide( at, next_at ) ))
  ------------------
  |  Branch (2811:43): [True: 0, False: 0]
  |  Branch (2811:54): [True: 0, False: 0]
  ------------------
 2812|      0|                                {
 2813|      0|                                    ; /*
 2814|       |                                       *   found:
 2815|       |                                       *
 2816|       |                                       *    \      /    \      /    \      /
 2817|       |                                       *     \    /      \    /      \    /
 2818|       |                                       *      N==C   or   N==C   or   N==N
 2819|       |                                       *    //    \     //    \     //    \
 2820|       |                                       *   O  ^    \   N  ^    \   O  ^    \
 2821|       |                                       *      |           |           |
 2822|       |                                       *      |           |           |
 2823|       |                                       *      at[next_at] at[next_at] at[next_at]
 2824|       |                                       */
 2825|      0|#endif
 2826|      0|                                }
 2827|      0|                                else
 2828|      0|                                {
 2829|      0|                                    bFound = 0;
 2830|      0|                                }
 2831|      0|                            }
 2832|      0|                        }
 2833|      0|                    }
 2834|      0|                }
 2835|      0|            }
 2836|      0|        }
 2837|      0|        if (bFound)
  ------------------
  |  Branch (2837:13): [True: 0, False: 0]
  ------------------
 2838|      0|        {
 2839|      0|            num_stereo_bonds++;
 2840|      0|        }
 2841|      0|    }
 2842|       |
 2843|      0|    if (( num_alt > 0 ) + ( num_2s > 0 ) != 1 || !num_stereo_bonds)
  ------------------
  |  Branch (2843:9): [True: 0, False: 0]
  |  Branch (2843:50): [True: 0, False: 0]
  ------------------
 2844|      0|    {
 2845|      0|        return 0;
 2846|      0|    }
 2847|       |
 2848|      0|    if (num_2s > 1)
  ------------------
  |  Branch (2848:9): [True: 0, False: 0]
  ------------------
 2849|      0|    {
 2850|      0|#if ( N_V_STEREOBONDS == 1 )
 2851|      0|        if (2 == num_2s &&
  ------------------
  |  Branch (2851:13): [True: 0, False: 0]
  ------------------
 2852|      0|             1 == ( num_2s_hetero[0] | num_2s_hetero[1] ) &&
  ------------------
  |  Branch (2852:14): [True: 0, False: 0]
  ------------------
 2853|      0|             3 == at[cur_at].valence + at[cur_at].num_H &&
  ------------------
  |  Branch (2853:14): [True: 0, False: 0]
  ------------------
 2854|      0|             5 == at[cur_at].chem_bonds_valence + at[cur_at].num_H &&
  ------------------
  |  Branch (2854:14): [True: 0, False: 0]
  ------------------
 2855|      0|             3 == get_endpoint_valence( at[cur_at].el_number ))
  ------------------
  |  Branch (2855:14): [True: 0, False: 0]
  ------------------
 2856|      0|        {
 2857|      0|            ;
 2858|      0|        }
 2859|      0|        else
 2860|      0|        {
 2861|      0|            return 0;
 2862|      0|        }
 2863|       |#else
 2864|       |        return 0;
 2865|       |#endif
 2866|      0|    }
 2867|       |
 2868|      0|    return num_stereo_bonds;
 2869|      0|}
ichister.c:set_stereo_atom_parity:
 3772|   112k|{
 3773|   112k|    int    j, k, next_at, num_z, j1, nType, num_explicit_H, tot_num_iso_H, nMustHaveNumNeigh;
 3774|   112k|    int    num_explicit_iso_H[NUM_H_ISOTOPES + 1];
 3775|       |                    /*  numbers of removed hydrogen atoms   */
 3776|   112k|    int    index_H[MAX_NUM_STEREO_ATOM_NEIGH];
 3777|       |                    /*  cannot have more than 4 elements: 1 H, 1 D, 1 T atom(s) */
 3778|   112k|    double z, sum_xyz[3], min_sine, triple_product;
 3779|   112k|    double at_coord[MAX_NUM_STEREO_ATOM_NEIGH][3];
 3780|   112k|    double bond_len_xy[4], rmax = 0.0, rmin = 0.0;
 3781|   112k|    double at_coord_center[3];
 3782|   112k|    int    parity, bAmbiguous = 0, bAddExplicitNeighbor = 0, b2D = 0, n2DTetrahedralAmbiguity = 0;
 3783|   112k|    int    bIgnoreIsotopicH = ( 0 != ( at[cur_at].cFlags & AT_FLAG_ISO_H_POINT ) );
  ------------------
  |  |   82|   112k|#define AT_FLAG_ISO_H_POINT 0x01  /* may have isotopic H */
  ------------------
 3784|   112k|    AT_NUMB nSbNeighOrigAtNumb[MAX_NUM_STEREO_ATOM_NEIGH];
 3785|       |
 3786|   112k|    double vMinAngle = MIN_ANGLE;
  ------------------
  |  |   54|   112k|#define MIN_ANGLE             0.10    /*  5.73 degrees */ /* treshold for proximity to in-line angle of 180 deg */
  ------------------
 3787|   112k|    double vMinSine = MIN_SINE;
  ------------------
  |  |   55|   112k|#define MIN_SINE              0.03    /*min edge/plane angle in case the tetrahedra has significantly different edge length */
  ------------------
 3788|   112k|    if (LooseTSACheck)
  ------------------
  |  Branch (3788:9): [True: 0, False: 112k]
  ------------------
 3789|      0|    {
 3790|       |        /* Relax check for principal 3-atomic angles close to 180 deg, for 2D tetrahedron, to account for           */
 3791|       |        /* large cycles drawn as appear after applying some structure 'cleaning' algorithms/softwares               */
 3792|       |
 3793|      0|        if (at[cur_at].nNumAtInRingSystem >= 3) /* Ensure that central atom is in ring (ideally, one should check   */
  ------------------
  |  Branch (3793:13): [True: 0, False: 0]
  ------------------
 3794|       |                                                /* also that neighbors are in-ring, and for large enough ring)      */
 3795|      0|        {
 3796|      0|            vMinAngle = MIN_ANGLE_RELAXED;
  ------------------
  |  |   56|      0|#define MIN_ANGLE_RELAXED     0.001
  ------------------
 3797|      0|            vMinSine = MIN_SINE_RELAXED;
  ------------------
  |  |   57|      0|#define MIN_SINE_RELAXED      0.001
  ------------------
 3798|      0|        }
 3799|      0|    }
 3800|       |
 3801|   112k|    out_at[cur_at].parity =
 3802|   112k|        out_at[cur_at].parity2 =
 3803|   112k|        out_at[cur_at].stereo_atom_parity =
 3804|   112k|        out_at[cur_at].stereo_atom_parity2 =
 3805|   112k|        AB_PARITY_NONE;
  ------------------
  |  |  246|   112k|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
 3806|   112k|    parity = AB_PARITY_NONE;
  ------------------
  |  |  246|   112k|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
 3807|       |
 3808|   112k|    memset( num_explicit_iso_H, 0, sizeof( num_explicit_iso_H ) );
 3809|   112k|    num_explicit_H = 0;
 3810|       |
 3811|   112k|#if ( NEW_STEREOCENTER_CHECK == 1 )
 3812|   112k|    if (!( nMustHaveNumNeigh = bCanInpAtomBeAStereoCenter( at, cur_at, bPointedEdgeStereo, bStereoAtZz ) ) ||
  ------------------
  |  Branch (3812:9): [True: 112k, False: 0]
  ------------------
 3813|   112k|         at[cur_at].num_H > NUM_H_ISOTOPES)
  ------------------
  |  |   53|      0|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (3813:10): [True: 0, False: 0]
  ------------------
 3814|   112k|    {
 3815|   112k|        goto exit_function;
 3816|   112k|    }
 3817|       |#else
 3818|       |    nMustHaveNumNeigh = MAX_NUM_STEREO_ATOM_NEIGH;
 3819|       |    if (!bCanAtomBeAStereoCenter( at[cur_at].elname, at[cur_at].charge, at[cur_at].radical ) ||
 3820|       |         at[cur_at].valence + at[cur_at].num_H != nMustHaveNumNeigh ||
 3821|       |         at[cur_at].num_H > NUM_H_ISOTOPES
 3822|       |       )
 3823|       |    {
 3824|       |        goto exit_function;
 3825|       |    }
 3826|       |    for (j = 0; j < at[cur_at].valence; j++)
 3827|       |    {
 3828|       |        if (( at[cur_at].bond_type[j] & ~BOND_MARK_ALL ) != BOND_SINGLE)
 3829|       |        {
 3830|       |            goto exit_function;
 3831|       |        }
 3832|       |    }
 3833|       |#endif
 3834|       |
 3835|       |    /*  numbers of isotopic H atoms */
 3836|      0|    for (j = 0, tot_num_iso_H = 0; j < NUM_H_ISOTOPES; j++)
  ------------------
  |  |   53|      0|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (3836:36): [True: 0, False: 0]
  ------------------
 3837|      0|    {
 3838|      0|        if (at[cur_at].num_iso_H[j] > 1)
  ------------------
  |  Branch (3838:13): [True: 0, False: 0]
  ------------------
 3839|      0|        {
 3840|      0|            goto exit_function; /*  two or more identical hydrogen isotopic neighbors */
 3841|      0|        }
 3842|      0|        tot_num_iso_H += at[cur_at].num_iso_H[j];
 3843|      0|    }
 3844|      0|    if (bIgnoreIsotopicH)
  ------------------
  |  Branch (3844:9): [True: 0, False: 0]
  ------------------
 3845|      0|    {
 3846|      0|        tot_num_iso_H = 0; /* isotopic H considered subject to exchange => ignore isotopic */
 3847|      0|    }
 3848|       |    /*  number of non-isotopic H atoms */
 3849|      0|    if (at[cur_at].num_H - tot_num_iso_H > 1)
  ------------------
  |  Branch (3849:9): [True: 0, False: 0]
  ------------------
 3850|      0|    {
 3851|      0|        goto exit_function; /*  two or more identical hydrogen non-isotopic neighbors */
 3852|      0|    }
 3853|       |
 3854|       |    /*  count removed explicit terminal hydrogens attached to at[cur_at]. */
 3855|       |    /*  the result is num_explicit_H. */
 3856|       |    /*  Removed hydrogens are sorted in increasing isotopic shift order */
 3857|      0|    if (at_removed_H && num_removed_H > 0)
  ------------------
  |  Branch (3857:9): [True: 0, False: 0]
  |  Branch (3857:25): [True: 0, False: 0]
  ------------------
 3858|      0|    {
 3859|      0|        for (j = 0; j < num_removed_H; j++)
  ------------------
  |  Branch (3859:21): [True: 0, False: 0]
  ------------------
 3860|      0|        {
 3861|      0|            if (at_removed_H[j].neighbor[0] == cur_at)
  ------------------
  |  Branch (3861:17): [True: 0, False: 0]
  ------------------
 3862|      0|            {
 3863|      0|                k = at_removed_H[j].iso_atw_diff;
 3864|       |                /*  iso_atw_diff values: H=>0, 1H=>1, D=2H=>2, T=3H=>3 */
 3865|      0|                if (k < 0 || k > NUM_H_ISOTOPES || bIgnoreIsotopicH)
  ------------------
  |  |   53|      0|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (3865:21): [True: 0, False: 0]
  |  Branch (3865:30): [True: 0, False: 0]
  |  Branch (3865:52): [True: 0, False: 0]
  ------------------
 3866|      0|                {
 3867|      0|                    k = 0; /*  treat wrong H isotopes as non-isotopic H */
 3868|      0|                }
 3869|      0|                num_explicit_iso_H[k] ++;
 3870|      0|                index_H[num_explicit_H++] = j;
 3871|      0|            }
 3872|      0|        }
 3873|      0|    }
 3874|       |
 3875|       |    /*  coordinates initialization */
 3876|      0|    num_z = 0;
 3877|      0|    sum_xyz[0] = sum_xyz[1] = sum_xyz[2] = 0.0;
 3878|       |
 3879|      0|    at_coord_center[0]      =
 3880|      0|        at_coord_center[1]  =
 3881|      0|        at_coord_center[2]  =
 3882|      0|        0.0;
 3883|       |
 3884|       |        /*  fill out stereo center neighbors coordinates */
 3885|       |        /*  and obtain the parity from the geometry */
 3886|       |
 3887|      0|    for (k = 0, j1 = 0; k < 2; k++)
  ------------------
  |  Branch (3887:25): [True: 0, False: 0]
  ------------------
 3888|      0|    {
 3889|      0|        switch (k)
  ------------------
  |  Branch (3889:17): [True: 0, False: 0]
  ------------------
 3890|      0|        {
 3891|       |
 3892|      0|            case 0:
  ------------------
  |  Branch (3892:13): [True: 0, False: 0]
  ------------------
 3893|       |                /*   add coordinates of removed hydrogens */
 3894|      0|                for (j = 0; j < num_explicit_H; j++, j1++)
  ------------------
  |  Branch (3894:29): [True: 0, False: 0]
  ------------------
 3895|      0|                {
 3896|      0|                    next_at = index_H[j];
 3897|       |                    /*  Use bond description located at removed_H atom */
 3898|       |                    /*  minus sign at get_z_coord: at_removed_H[] contains bonds TO at[cur_at], not FROM it. */
 3899|       |                    /*  Note: &at[(at_removed_H-at)+ next_at] == &at_removed_H[next_at] */
 3900|      0|                    z = -get_z_coord( at,
 3901|      0|                                      (int) ( at_removed_H - at ) + next_at,
 3902|      0|                                      0 /*neighbor #*/,
 3903|      0|                                      &nType,
 3904|      0|                                      -( bPointedEdgeStereo & PES_BIT_POINT_EDGE_STEREO ) );
  ------------------
  |  |   72|      0|#define PES_BIT_POINT_EDGE_STEREO    1
  ------------------
 3905|      0|                    switch (nType)
  ------------------
  |  Branch (3905:29): [True: 0, False: 0]
  ------------------
 3906|      0|                    {
 3907|      0|                        case ZTYPE_EITHER:
  ------------------
  |  |   51|      0|#define    ZTYPE_EITHER   9999
  ------------------
  |  Branch (3907:25): [True: 0, False: 0]
  ------------------
 3908|      0|                            parity = vABParityUnknown /*AB_PARITY_UNKN*/; /*  no parity: bond in "Either" direction. */
 3909|      0|                            goto exit_function;
 3910|      0|                        case ZTYPE_UP:
  ------------------
  |  |   49|      0|#define    ZTYPE_UP       1     /*  should be equal to -ZTYPE_DOWN */
  ------------------
  |  Branch (3910:25): [True: 0, False: 0]
  ------------------
 3911|      0|                        case ZTYPE_DOWN:
  ------------------
  |  |   47|      0|#define    ZTYPE_DOWN     (-1)  /*  should be equal to -ZTYPE_UP */
  ------------------
  |  Branch (3911:25): [True: 0, False: 0]
  ------------------
 3912|      0|                            nType = -nType; /*  at_removed_H[] contains bonds TO the center, not from */
 3913|      0|                            b2D++;
 3914|       |                            /*  no break; here */
 3915|      0|                        case ZTYPE_3D:
  ------------------
  |  |   50|      0|#define    ZTYPE_3D       3
  ------------------
  |  Branch (3915:25): [True: 0, False: 0]
  ------------------
 3916|      0|                            num_z++;
 3917|      0|                    }
 3918|       |
 3919|      0|                    nSbNeighOrigAtNumb[j1] = at_removed_H[next_at].orig_at_number;
 3920|      0|                    at_coord[j1][0] = at_removed_H[next_at].x - at[cur_at].x;
 3921|      0|                    at_coord[j1][1] = at_removed_H[next_at].y - at[cur_at].y;
 3922|      0|                    bond_len_xy[j1] = len2( at_coord[j1] );
 3923|       |                    /* bond_len_xy[j1] = sqrt(at_coord[j1][0]*at_coord[j1][0]+at_coord[j1][1]*at_coord[j1][1]); */
 3924|      0|                    at_coord[j1][2] = ( nType == ZTYPE_3D ? z : nType == ZTYPE_UP
  ------------------
  |  |   50|      0|#define    ZTYPE_3D       3
  ------------------
                                  at_coord[j1][2] = ( nType == ZTYPE_3D ? z : nType == ZTYPE_UP
  ------------------
  |  |   49|      0|#define    ZTYPE_UP       1     /*  should be equal to -ZTYPE_DOWN */
  ------------------
  |  Branch (3924:41): [True: 0, False: 0]
  |  Branch (3924:65): [True: 0, False: 0]
  ------------------
 3925|      0|                                            ? bond_len_xy[j1] : nType == ZTYPE_DOWN
  ------------------
  |  |   47|      0|#define    ZTYPE_DOWN     (-1)  /*  should be equal to -ZTYPE_UP */
  ------------------
  |  Branch (3925:65): [True: 0, False: 0]
  ------------------
 3926|      0|                                                ? -bond_len_xy[j1] : 0.0 );
 3927|      0|                }
 3928|      0|                break;
 3929|      0|            case 1:
  ------------------
  |  Branch (3929:13): [True: 0, False: 0]
  ------------------
 3930|       |                /*  add all coordinates of other neighboring atoms */
 3931|      0|                for (j = 0; j < at[cur_at].valence; j++, j1++)
  ------------------
  |  Branch (3931:29): [True: 0, False: 0]
  ------------------
 3932|      0|                {
 3933|      0|                    next_at = at[cur_at].neighbor[j];
 3934|      0|                    z = get_z_coord( at, cur_at, j, &nType, ( bPointedEdgeStereo & PES_BIT_POINT_EDGE_STEREO ) );
  ------------------
  |  |   72|      0|#define PES_BIT_POINT_EDGE_STEREO    1
  ------------------
 3935|      0|                    switch (nType)
  ------------------
  |  Branch (3935:29): [True: 0, False: 0]
  ------------------
 3936|      0|                    {
 3937|      0|                        case ZTYPE_EITHER:
  ------------------
  |  |   51|      0|#define    ZTYPE_EITHER   9999
  ------------------
  |  Branch (3937:25): [True: 0, False: 0]
  ------------------
 3938|      0|                            parity = vABParityUnknown /*AB_PARITY_UNKN*/; /*  unknown parity: bond in "Either" direction. */
 3939|      0|                            goto exit_function;
 3940|      0|                        case ZTYPE_UP:
  ------------------
  |  |   49|      0|#define    ZTYPE_UP       1     /*  should be equal to -ZTYPE_DOWN */
  ------------------
  |  Branch (3940:25): [True: 0, False: 0]
  ------------------
 3941|      0|                        case ZTYPE_DOWN:
  ------------------
  |  |   47|      0|#define    ZTYPE_DOWN     (-1)  /*  should be equal to -ZTYPE_UP */
  ------------------
  |  Branch (3941:25): [True: 0, False: 0]
  ------------------
 3942|      0|                            b2D++;
 3943|      0|                        case ZTYPE_3D:
  ------------------
  |  |   50|      0|#define    ZTYPE_3D       3
  ------------------
  |  Branch (3943:25): [True: 0, False: 0]
  ------------------
 3944|      0|                            num_z++;
 3945|      0|                    }
 3946|       |
 3947|      0|                    nSbNeighOrigAtNumb[j1] = at[next_at].orig_at_number;
 3948|      0|                    at_coord[j1][0] = at[next_at].x - at[cur_at].x;
 3949|      0|                    at_coord[j1][1] = at[next_at].y - at[cur_at].y;
 3950|      0|                    bond_len_xy[j1] = len2( at_coord[j1] );
 3951|       |                    /* bond_len_xy[j1] = sqrt(at_coord[j1][0]*at_coord[j1][0]+at_coord[j1][1]*at_coord[j1][1]); */
 3952|      0|                    at_coord[j1][2] = ( nType == ZTYPE_3D ? z :
  ------------------
  |  |   50|      0|#define    ZTYPE_3D       3
  ------------------
  |  Branch (3952:41): [True: 0, False: 0]
  ------------------
 3953|      0|                                            nType == ZTYPE_UP ? bond_len_xy[j1] :
  ------------------
  |  |   49|      0|#define    ZTYPE_UP       1     /*  should be equal to -ZTYPE_DOWN */
  ------------------
  |  Branch (3953:45): [True: 0, False: 0]
  ------------------
 3954|      0|                                                nType == ZTYPE_DOWN ? -bond_len_xy[j1] : 0.0 );
  ------------------
  |  |   47|      0|#define    ZTYPE_DOWN     (-1)  /*  should be equal to -ZTYPE_UP */
  ------------------
  |  Branch (3954:49): [True: 0, False: 0]
  ------------------
 3955|      0|                }
 3956|      0|                break;
 3957|      0|        }
 3958|      0|    }
 3959|       |    /* j1 is the number of explicit neighbors (that is, all neighbors except implicit H) */
 3960|      0|    b2D = ( b2D == num_z && num_z );  /*  1 => two-dimensional */
  ------------------
  |  Branch (3960:13): [True: 0, False: 0]
  |  Branch (3960:29): [True: 0, False: 0]
  ------------------
 3961|       |
 3962|      0|    if (MAX_NUM_STEREO_ATOM_NEIGH != at[cur_at].valence + num_explicit_H &&
  ------------------
  |  |  880|      0|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (3962:9): [True: 0, False: 0]
  ------------------
 3963|      0|         MAX_NUM_STEREO_ATOM_NEIGH - 1 != at[cur_at].valence + num_explicit_H)
  ------------------
  |  |  880|      0|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (3963:10): [True: 0, False: 0]
  ------------------
 3964|      0|    {
 3965|       |        /*  not enough geometry data to find the central atom parity */
 3966|      0|        if (nMustHaveNumNeigh == at[cur_at].valence + at[cur_at].num_H &&
  ------------------
  |  Branch (3966:13): [True: 0, False: 0]
  ------------------
 3967|      0|            at[cur_at].num_H > 1)
  ------------------
  |  Branch (3967:13): [True: 0, False: 0]
  ------------------
 3968|      0|        {
 3969|       |            /*  only isotopic parity is possible; no non-isotopic parity */
 3970|      0|            if (parity == vABParityUnknown /*AB_PARITY_UNKN*/)
  ------------------
  |  Branch (3970:17): [True: 0, False: 0]
  ------------------
 3971|      0|            {
 3972|      0|                parity = -vABParityUnknown /*AB_PARITY_UNKN*/; /*  the user marked the center as "unknown" */
 3973|      0|            }
 3974|      0|            else
 3975|      0|            {
 3976|      0|                parity = -AB_PARITY_UNDF; /*  not enough geometry; only isotopic parity is possible */
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 3977|      0|            }
 3978|      0|        }
 3979|      0|        else
 3980|      0|        {
 3981|      0|            parity = AB_PARITY_NONE;      /*  not a stereocenter at all */
  ------------------
  |  |  246|      0|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
 3982|      0|        }
 3983|      0|        goto exit_function;
 3984|      0|    }
 3985|       |    /*  make all vector lengths equal to 1; exit if too short. 9-10-2002 */
 3986|      0|    for (j = 0; j < j1; j++)
  ------------------
  |  Branch (3986:17): [True: 0, False: 0]
  ------------------
 3987|      0|    {
 3988|      0|        z = len3( at_coord[j] );
 3989|      0|        if (z < MIN_BOND_LEN)
  ------------------
  |  |   64|      0|#define MIN_BOND_LEN          0.000001
  ------------------
  |  Branch (3989:13): [True: 0, False: 0]
  ------------------
 3990|      0|        {
 3991|       |            /* bond length is too small: use 0D parities */
 3992|      0|            if (AB_PARITY_NONE == ( parity = GetStereocenter0DParity( pCG, at, cur_at,
  ------------------
  |  |  246|      0|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
  |  Branch (3992:17): [True: 0, False: 0]
  ------------------
 3993|      0|                                                                      j1,nSbNeighOrigAtNumb,
 3994|      0|                                                                      FlagSC_0D ) ))
  ------------------
  |  |   91|      0|#define FlagSC_0D  1  /* bUsed0DParity */
  ------------------
 3995|      0|            {
 3996|      0|                parity = AB_PARITY_UNDF;
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 3997|      0|            }
 3998|      0|            goto exit_function;
 3999|      0|        }
 4000|      0|#if ( STEREO_CENTER_BONDS_NORM == 1 )
 4001|      0|        else
 4002|      0|        {
 4003|      0|            mult3( at_coord[j], 1.0 / z, at_coord[j] );
 4004|      0|        }
 4005|      0|#endif
 4006|      0|        rmax = j ? inchi_max( rmax, z ) : z;
  ------------------
  |  |  166|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (4006:16): [True: 0, False: 0]
  ------------------
 4007|      0|        rmin = j ? inchi_min( rmin, z ) : z;
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (4007:16): [True: 0, False: 0]
  ------------------
 4008|      0|    }
 4009|      0|    if (rmin / rmax < MIN_SINE)
  ------------------
  |  |   55|      0|#define MIN_SINE              0.03    /*min edge/plane angle in case the tetrahedra has significantly different edge length */
  ------------------
  |  Branch (4009:9): [True: 0, False: 0]
  ------------------
 4010|      0|    {
 4011|       |        /* bond ratio is too small: use 0D parities */
 4012|      0|        if (AB_PARITY_NONE == ( parity = GetStereocenter0DParity( pCG, at, cur_at, j1,
  ------------------
  |  |  246|      0|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
  |  Branch (4012:13): [True: 0, False: 0]
  ------------------
 4013|      0|            nSbNeighOrigAtNumb,
 4014|      0|            FlagSC_0D ) ))
  ------------------
  |  |   91|      0|#define FlagSC_0D  1  /* bUsed0DParity */
  ------------------
 4015|      0|        {
 4016|      0|            parity = AB_PARITY_UNDF;
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 4017|      0|        }
 4018|      0|        goto exit_function;
 4019|      0|    }
 4020|      0|    for (j = 0; j < j1; j++)
  ------------------
  |  Branch (4020:17): [True: 0, False: 0]
  ------------------
 4021|      0|    {
 4022|      0|        add3( sum_xyz, at_coord[j], sum_xyz );
 4023|      0|    }
 4024|       |
 4025|       |    /*  Here j1 is a number of neighbors including explicit terminal isotopic H */
 4026|       |    /*  num_explicit_iso_H[0] = number of explicit non-isotopic hydrogen atom neighbors */
 4027|      0|    j = j1;
 4028|       |    /*  Add Explicit Neighbor */
 4029|      0|    if (j1 == MAX_NUM_STEREO_ATOM_NEIGH - 1)
  ------------------
  |  |  880|      0|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (4029:9): [True: 0, False: 0]
  ------------------
 4030|      0|    {
 4031|       |        /*  Add an explicit neighbor if possible */
 4032|      0|        if (nMustHaveNumNeigh == MAX_NUM_STEREO_ATOM_NEIGH - 1)
  ------------------
  |  |  880|      0|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (4032:13): [True: 0, False: 0]
  ------------------
 4033|      0|        {
 4034|      0|            bAddExplicitNeighbor = ADD_EXPLICIT_LONE_PAIR_NEIGH;
  ------------------
  |  | 3761|      0|#define ADD_EXPLICIT_LONE_PAIR_NEIGH 2
  ------------------
 4035|      0|        }
 4036|      0|        else
 4037|      0|        {
 4038|      0|            if (nMustHaveNumNeigh == MAX_NUM_STEREO_ATOM_NEIGH)
  ------------------
  |  |  880|      0|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (4038:17): [True: 0, False: 0]
  ------------------
 4039|      0|            {
 4040|       |                /*  Check whether an explicit non-isotopic hydrogen can be added */
 4041|       |                /*  to an atom that is a stereogenic atom */
 4042|      0|                if (1 == at[cur_at].num_H - num_explicit_H &&     /*  the atom has only one one implicit hydrogen */
  ------------------
  |  Branch (4042:21): [True: 0, False: 0]
  ------------------
 4043|      0|                    1 == at[cur_at].num_H - tot_num_iso_H)
  ------------------
  |  Branch (4043:21): [True: 0, False: 0]
  ------------------
 4044|      0|                {
 4045|       |                    /*  this hydrogen is non-isotopic */
 4046|      0|                    bAddExplicitNeighbor = ADD_EXPLICIT_HYDROGEN_NEIGH;
  ------------------
  |  | 3760|      0|#define ADD_EXPLICIT_HYDROGEN_NEIGH  1
  ------------------
 4047|      0|                }
 4048|      0|            }
 4049|      0|        }
 4050|      0|    }
 4051|       |
 4052|      0|    if (bAddExplicitNeighbor)
  ------------------
  |  Branch (4052:9): [True: 0, False: 0]
  ------------------
 4053|      0|    {
 4054|       |        /***********************************************************
 4055|       |         * May happen only if (j1 == MAX_NUM_STEREO_ATOM_NEIGH-1)
 4056|       |         * 3 neighbors only, no H-neighbors. Create and add coordinates of an implicit H
 4057|       |         * or a fake 4th neighbor, that is, a lone pair
 4058|       |         */
 4059|      0|        if (parity == vABParityUnknown /*AB_PARITY_UNKN*/)
  ------------------
  |  Branch (4059:13): [True: 0, False: 0]
  ------------------
 4060|      0|        {
 4061|      0|            goto exit_function;  /*  the user insists the parity is unknown and the isotopic */
 4062|       |                                 /*  composition of the neighbors does not contradict */
 4063|      0|        }
 4064|      0|        else
 4065|      0|        {
 4066|      0|            if (num_z == 0 || are_3_vect_in_one_plane( at_coord, vMinSine ))
  ------------------
  |  Branch (4066:17): [True: 0, False: 0]
  |  Branch (4066:31): [True: 0, False: 0]
  ------------------
 4067|      0|            {
 4068|       |                /*  "hydrogen down" rule is needed to resolve an ambiguity */
 4069|      0|                if (num_z > 0)
  ------------------
  |  Branch (4069:21): [True: 0, False: 0]
  ------------------
 4070|      0|                {
 4071|      0|                    bAmbiguous |= AMBIGUOUS_STEREO;
  ------------------
  |  |  273|      0|#define AMBIGUOUS_STEREO           1
  ------------------
 4072|      0|                }
 4073|       |#if ( APPLY_IMPLICIT_H_DOWN_RULE == 1 )  /* { */
 4074|       |                /*  Although H should be at the top of the list, add it to the bottom. */
 4075|       |                /*  This will be taken care of later by inverting parity 1<->2 */
 4076|       |                at_coord[j][0] = 0.0;
 4077|       |                at_coord[j][1] = 0.0;
 4078|       |#if ( STEREO_CENTER_BONDS_NORM == 1 )
 4079|       |                at_coord[j][2] = -1.0;
 4080|       |#else
 4081|       |                at_coord[j][2] = -( bond_len_xy[0] + bond_len_xy[1] + bond_len_xy[2] ) / 3.0;
 4082|       |#endif
 4083|       |#else /* } APPLY_IMPLICIT_H_DOWN_RULE { */
 4084|       |#if (ALWAYS_SET_STEREO_PARITY == 1)
 4085|       |                parity = AB_PARITY_EVEN; /*  suppose atoms are pre-sorted (testing) */
 4086|       |#else
 4087|       |                /* All 3 bonds are in one plane: try to get 0D parities */
 4088|      0|                if (AB_PARITY_NONE == ( parity = GetStereocenter0DParity( pCG, at, cur_at,
  ------------------
  |  |  246|      0|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
  |  Branch (4088:21): [True: 0, False: 0]
  ------------------
 4089|      0|                                                                          j1,
 4090|      0|                                                                          nSbNeighOrigAtNumb,
 4091|      0|                                                                          FlagSC_0D ) ))
  ------------------
  |  |   91|      0|#define FlagSC_0D  1  /* bUsed0DParity */
  ------------------
 4092|      0|                {
 4093|      0|                    parity = AB_PARITY_UNDF;
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 4094|      0|                }
 4095|       |                /*parity =  AB_PARITY_UNDF;*/ /*  no parity can be calculated found */
 4096|      0|#endif
 4097|      0|                goto exit_function;
 4098|      0|#endif /* } APPLY_IMPLICIT_H_DOWN_RULE */
 4099|      0|            }
 4100|      0|            else
 4101|      0|            {
 4102|       |                /*  we have enough information to find implicit hydrogen coordinates */
 4103|       |                /*
 4104|       |                at_coord[j][0] = -sum_x;
 4105|       |                at_coord[j][1] = -sum_y;
 4106|       |                at_coord[j][2] = -sum_z;
 4107|       |                */
 4108|      0|                copy3( sum_xyz, at_coord[j] );
 4109|      0|                change_sign3( at_coord[j], at_coord[j] );
 4110|      0|                z = len3( at_coord[j] );
 4111|       |#if ( FIX_STEREO_SCALING_BUG == 1 )
 4112|       |                if (z > 1.0)
 4113|       |                {
 4114|       |                    rmax *= z;
 4115|       |                }
 4116|       |                else
 4117|       |                {
 4118|       |                    rmin *= z;
 4119|       |                }
 4120|       |#else
 4121|       |                /* Comparing the original bond lengths to lenghts derived from normalized to 1 */
 4122|       |                /* This bug leads to pronouncing legitimate stereogenic atoms */
 4123|       |                /* connected by 3 bonds "undefined" if in a nicely drawn 2D structure */
 4124|       |                /* bond lengths are about 20 or greater. Reported by Reinhard Dunkel 2005-08-05 */
 4125|      0|                if (bPointedEdgeStereo & PES_BIT_FIX_SP3_BUG)
  ------------------
  |  |   75|      0|#define PES_BIT_FIX_SP3_BUG          8
  ------------------
  |  Branch (4125:21): [True: 0, False: 0]
  ------------------
 4126|      0|                {
 4127|       |                    /* coordinate scaling bug fixed here */
 4128|      0|                    if (z > 1.0)
  ------------------
  |  Branch (4128:25): [True: 0, False: 0]
  ------------------
 4129|      0|                    {
 4130|      0|                        rmax *= z;
 4131|      0|                    }
 4132|      0|                    else
 4133|      0|                    {
 4134|      0|                        rmin *= z;
 4135|      0|                    }
 4136|      0|                }
 4137|      0|                else
 4138|      0|                {
 4139|       |                    /* original InChI v.1 bug */
 4140|      0|                    rmax = inchi_max( rmax, z );
  ------------------
  |  |  166|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4141|      0|                    rmin = inchi_min( rmin, z );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4142|      0|                }
 4143|      0|#endif
 4144|      0|                if (z < MIN_BOND_LEN || rmin / rmax < MIN_SINE)
  ------------------
  |  |   64|      0|#define MIN_BOND_LEN          0.000001
  ------------------
                              if (z < MIN_BOND_LEN || rmin / rmax < MIN_SINE)
  ------------------
  |  |   55|      0|#define MIN_SINE              0.03    /*min edge/plane angle in case the tetrahedra has significantly different edge length */
  ------------------
  |  Branch (4144:21): [True: 0, False: 0]
  |  Branch (4144:41): [True: 0, False: 0]
  ------------------
 4145|      0|                {
 4146|       |                    /* the new 4th bond is too short: try to get 0D parities */
 4147|      0|                    if (AB_PARITY_NONE == ( parity = GetStereocenter0DParity( pCG, at, cur_at, j1, nSbNeighOrigAtNumb, FlagSC_0D ) ))
  ------------------
  |  |  246|      0|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
                                  if (AB_PARITY_NONE == ( parity = GetStereocenter0DParity( pCG, at, cur_at, j1, nSbNeighOrigAtNumb, FlagSC_0D ) ))
  ------------------
  |  |   91|      0|#define FlagSC_0D  1  /* bUsed0DParity */
  ------------------
  |  Branch (4147:25): [True: 0, False: 0]
  ------------------
 4148|      0|                    {
 4149|      0|                        parity = AB_PARITY_UNDF;
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 4150|      0|                    }
 4151|      0|                    goto exit_function;
 4152|      0|                }
 4153|       |#if ( STEREO_CENTER_BOND4_NORM == 1 )
 4154|       |                else
 4155|       |                {
 4156|       |                    mult3( at_coord[j], 1.0 / z, at_coord[j] );
 4157|       |                }
 4158|       |#endif
 4159|      0|            }
 4160|      0|        }
 4161|      0|    }
 4162|       |
 4163|      0|    else if (j1 != MAX_NUM_STEREO_ATOM_NEIGH)
  ------------------
  |  |  880|      0|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (4163:14): [True: 0, False: 0]
  ------------------
 4164|      0|    {
 4165|      0|        if (parity == vABParityUnknown /*AB_PARITY_UNKN*/)
  ------------------
  |  Branch (4165:13): [True: 0, False: 0]
  ------------------
 4166|      0|        {
 4167|      0|            parity = -AB_PARITY_UNDF; /*  isotopic composition of H-neighbors contradicts 'unknown' */
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 4168|      0|        }
 4169|      0|        goto exit_function;
 4170|      0|    }
 4171|       |
 4172|      0|    else /*  j1 == MAX_NUM_STEREO_ATOM_NEIGH */
 4173|      0|    {
 4174|      0|        if (num_z == 0 || are_4at_in_one_plane( at_coord, vMinSine ))
  ------------------
  |  Branch (4174:13): [True: 0, False: 0]
  |  Branch (4174:27): [True: 0, False: 0]
  ------------------
 4175|      0|        {
 4176|       |            /*  all four neighours in xy plane: undefined geometry. */
 4177|      0|            if (num_z > 0)
  ------------------
  |  Branch (4177:17): [True: 0, False: 0]
  ------------------
 4178|      0|            {
 4179|      0|                bAmbiguous |= AMBIGUOUS_STEREO;
  ------------------
  |  |  273|      0|#define AMBIGUOUS_STEREO           1
  ------------------
 4180|      0|            }
 4181|      0|            if (parity != vABParityUnknown /*AB_PARITY_UNKN*/)
  ------------------
  |  Branch (4181:17): [True: 0, False: 0]
  ------------------
 4182|      0|            {
 4183|       |#if (ALWAYS_SET_STEREO_PARITY == 1)
 4184|       |                parity = AB_PARITY_EVEN; /*  suppose atoms are pre-sorted (testing) */
 4185|       |#else
 4186|       |                /* All 4 bonds are in one plane: try to get 0D parities */
 4187|      0|                if (AB_PARITY_NONE == ( parity = GetStereocenter0DParity( pCG, at, cur_at, j1, nSbNeighOrigAtNumb, FlagSC_0D ) ))
  ------------------
  |  |  246|      0|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
                              if (AB_PARITY_NONE == ( parity = GetStereocenter0DParity( pCG, at, cur_at, j1, nSbNeighOrigAtNumb, FlagSC_0D ) ))
  ------------------
  |  |   91|      0|#define FlagSC_0D  1  /* bUsed0DParity */
  ------------------
  |  Branch (4187:21): [True: 0, False: 0]
  ------------------
 4188|      0|                {
 4189|      0|                    parity = AB_PARITY_UNDF;
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 4190|      0|                }
 4191|      0|                else if (ATOM_PARITY_WELL_DEF( parity ))
  ------------------
  |  |  287|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  265|      0|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  264|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (287:38): [True: 0, False: 0]
  |  |  |  Branch (287:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4192|      0|                {
 4193|      0|                    bAmbiguous &= ~AMBIGUOUS_STEREO; /* 0D parity has resolved the ambiguity */
  ------------------
  |  |  273|      0|#define AMBIGUOUS_STEREO           1
  ------------------
 4194|      0|                }
 4195|      0|#endif
 4196|      0|            }
 4197|      0|            goto exit_function;
 4198|      0|        }
 4199|      0|    }
 4200|       |
 4201|       |    /***********************************************************
 4202|       |    * At this point we have 4 neighboring atoms.
 4203|       |    * check for tetrahedral ambiguity in 2D case
 4204|       |    */
 4205|      0|    if (b2D)
  ------------------
  |  Branch (4205:9): [True: 0, False: 0]
  ------------------
 4206|      0|    {
 4207|       |
 4208|      0|        n2DTetrahedralAmbiguity = Get2DTetrahedralAmbiguity( pCG,at_coord,
 4209|      0|                                                             bAddExplicitNeighbor,
 4210|      0|                                                             ( bPointedEdgeStereo & PES_BIT_FIX_SP3_BUG ),
  ------------------
  |  |   75|      0|#define PES_BIT_FIX_SP3_BUG          8
  ------------------
 4211|      0|                                                             vMinAngle );
 4212|       |
 4213|      0|        if (0 < n2DTetrahedralAmbiguity)
  ------------------
  |  Branch (4213:13): [True: 0, False: 0]
  ------------------
 4214|      0|        {
 4215|      0|            if (T2D_WARN & n2DTetrahedralAmbiguity)
  ------------------
  |  |  376|      0|#define T2D_WARN  2
  ------------------
  |  Branch (4215:17): [True: 0, False: 0]
  ------------------
 4216|      0|            {
 4217|      0|                bAmbiguous |= AMBIGUOUS_STEREO;
  ------------------
  |  |  273|      0|#define AMBIGUOUS_STEREO           1
  ------------------
 4218|      0|            }
 4219|      0|            if (T2D_UNDF & n2DTetrahedralAmbiguity)
  ------------------
  |  |  377|      0|#define T2D_UNDF  4
  ------------------
  |  Branch (4219:17): [True: 0, False: 0]
  ------------------
 4220|      0|            {
 4221|      0|                if (parity != vABParityUnknown /*AB_PARITY_UNKN*/)
  ------------------
  |  Branch (4221:21): [True: 0, False: 0]
  ------------------
 4222|      0|                {
 4223|       |#if (ALWAYS_SET_STEREO_PARITY == 1)
 4224|       |                    parity = AB_PARITY_EVEN; /*  suppose atoms are pre-sorted (testing) */
 4225|       |#else
 4226|      0|                    parity = AB_PARITY_UNDF; /*  no parity */
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 4227|      0|#endif
 4228|      0|                }
 4229|      0|                goto exit_function;
 4230|      0|            }
 4231|      0|        }
 4232|      0|        else if (n2DTetrahedralAmbiguity < 0)
  ------------------
  |  Branch (4232:18): [True: 0, False: 0]
  ------------------
 4233|      0|        {
 4234|      0|            bAmbiguous |= AMBIGUOUS_STEREO_ERROR; /*  error */
  ------------------
  |  |  278|      0|#define AMBIGUOUS_STEREO_ERROR     32
  ------------------
 4235|      0|            parity = AB_PARITY_UNDF;
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 4236|      0|            goto exit_function;
 4237|      0|        }
 4238|      0|    }
 4239|       |
 4240|       |    /************************************************************/
 4241|       |    /*  Move coordinates origin to the neighbor #0 */
 4242|      0|    for (j = 1; j < MAX_NUM_STEREO_ATOM_NEIGH; j++)
  ------------------
  |  |  880|      0|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (4242:17): [True: 0, False: 0]
  ------------------
 4243|      0|    {
 4244|      0|        diff3( at_coord[j], at_coord[0], at_coord[j] );
 4245|      0|    }
 4246|      0|    diff3( at_coord_center, at_coord[0], at_coord_center );
 4247|       |
 4248|       |    /*
 4249|       |    for ( k = 0; k < 3; k++ )
 4250|       |    {
 4251|       |        for ( j = 1; j < MAX_NUM_STEREO_ATOM_NEIGH; j ++ )
 4252|       |        {
 4253|       |            at_coord[j][k] -= at_coord[0][k];
 4254|       |        }
 4255|       |        at_coord_center[k] -= at_coord[0][k];
 4256|       |    }
 4257|       |    */
 4258|       |
 4259|       |
 4260|       |    /********************************************************
 4261|       |     *  Find the central (cur_at) atom's parity
 4262|       |     *  (orientation of atoms #1-3 when looking from #0)
 4263|       |     ********************************************************/
 4264|      0|    triple_product = triple_prod_and_min_abs_sine2( &at_coord[1], at_coord_center, bAddExplicitNeighbor, &min_sine, &bAmbiguous, vMinSine );
 4265|       |
 4266|       |    /*
 4267|       |     *  Check for tetrahedral ambiguity -- leave it out for now
 4268|       |     */
 4269|      0|    if (fabs( triple_product ) > ZERO_FLOAT && ( min_sine > vMinSine || fabs( min_sine ) > ZERO_FLOAT && ( n2DTetrahedralAmbiguity & T2D_OKAY ) ))
  ------------------
  |  |   66|      0|#define ZERO_FLOAT            1.0e-12
  ------------------
                  if (fabs( triple_product ) > ZERO_FLOAT && ( min_sine > vMinSine || fabs( min_sine ) > ZERO_FLOAT && ( n2DTetrahedralAmbiguity & T2D_OKAY ) ))
  ------------------
  |  |   66|      0|#define ZERO_FLOAT            1.0e-12
  ------------------
                  if (fabs( triple_product ) > ZERO_FLOAT && ( min_sine > vMinSine || fabs( min_sine ) > ZERO_FLOAT && ( n2DTetrahedralAmbiguity & T2D_OKAY ) ))
  ------------------
  |  |  375|      0|#define T2D_OKAY  1
  ------------------
  |  Branch (4269:9): [True: 0, False: 0]
  |  Branch (4269:50): [True: 0, False: 0]
  |  Branch (4269:73): [True: 0, False: 0]
  |  Branch (4269:106): [True: 0, False: 0]
  ------------------
 4270|      0|    {
 4271|       |         /* Even => sorted in correct order, Odd=>transposed */
 4272|      0|        parity = triple_product > 0.0 ? AB_PARITY_EVEN : AB_PARITY_ODD;
  ------------------
  |  |  248|      0|#define AB_PARITY_EVEN   2  /* 2 => even parity */
  ------------------
                      parity = triple_product > 0.0 ? AB_PARITY_EVEN : AB_PARITY_ODD;
  ------------------
  |  |  247|      0|#define AB_PARITY_ODD    1  /* 1 => odd parity */
  ------------------
  |  Branch (4272:18): [True: 0, False: 0]
  ------------------
 4273|       |        /* if ( num_explicit_H && at[cur_at].removed_H_parity % 2 )  */
 4274|       |              /* odd transposition of the removed implicit H */
 4275|       |        /*     out_at[cur_at].parity = 3 - out_at[cur_at].parity; */
 4276|       |
 4277|       |        /*  moved; see below */
 4278|       |        /* out_at[cur_at].bAmbiguousStereo |= bAmbiguous; */
 4279|       |        /* at[cur_at].bAmbiguousStereo |= bAmbiguous; */
 4280|       |
 4281|       |        /*  for 4 attached atoms, moving the implicit H from index=3 to index=0 */
 4282|       |        /*  can be done in odd number (3) transpositions: (23)(12)(01), which inverts the parity */
 4283|      0|        if (j1 == MAX_NUM_STEREO_ATOM_NEIGH - 1)
  ------------------
  |  |  880|      0|#define MAX_NUM_STEREO_ATOM_NEIGH 4
  ------------------
  |  Branch (4283:13): [True: 0, False: 0]
  ------------------
 4284|      0|        {
 4285|      0|            parity = 3 - parity;
 4286|      0|        }
 4287|      0|    }
 4288|      0|    else
 4289|      0|    {
 4290|       |#if (ALWAYS_SET_STEREO_PARITY == 1)
 4291|       |        parity = AT_PARITY_EVEN; /*  suppose atoms are pre-sorted (testing) */
 4292|       |#else
 4293|      0|        if (num_z > 0)
  ------------------
  |  Branch (4293:13): [True: 0, False: 0]
  ------------------
 4294|      0|        {
 4295|      0|            bAmbiguous |= AMBIGUOUS_STEREO;
  ------------------
  |  |  273|      0|#define AMBIGUOUS_STEREO           1
  ------------------
 4296|      0|        }
 4297|      0|        parity = AB_PARITY_UNDF; /*  no parity: 4 bonds are in one plane. */
  ------------------
  |  |  250|      0|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
 4298|      0|#endif
 4299|      0|    }
 4300|       |
 4301|   112k|exit_function:
 4302|       |
 4303|   112k|    if (parity)
  ------------------
  |  Branch (4303:9): [True: 0, False: 112k]
  ------------------
 4304|      0|    {
 4305|      0|        out_at[cur_at].bAmbiguousStereo |= bAmbiguous;
 4306|      0|        at[cur_at].bAmbiguousStereo |= bAmbiguous;
 4307|      0|    }
 4308|       |
 4309|       |    /*  Non-isotopic parity */
 4310|   112k|    if (at[cur_at].num_H > 1 || parity <= 0)
  ------------------
  |  Branch (4310:9): [True: 0, False: 112k]
  |  Branch (4310:33): [True: 112k, False: 0]
  ------------------
 4311|   112k|    {
 4312|   112k|        ; /*  no non-isotopic parity */
 4313|   112k|    }
 4314|      0|    else
 4315|      0|    {
 4316|      0|        out_at[cur_at].parity = parity;
 4317|      0|    }
 4318|       |
 4319|       |    /*  isotopic parity */
 4320|   112k|    if (parity == -AB_PARITY_UNDF || parity == -vABParityUnknown /*AB_PARITY_UNKN*/)
  ------------------
  |  |  250|   225k|#define AB_PARITY_UNDF   4  /* 4 => parity cannot be defined because of symmetry or not well defined geometry */
  ------------------
  |  Branch (4320:9): [True: 0, False: 112k]
  |  Branch (4320:38): [True: 0, False: 112k]
  ------------------
 4321|      0|    {
 4322|      0|        parity = -parity;
 4323|      0|    }
 4324|   112k|    if (parity < 0)
  ------------------
  |  Branch (4324:9): [True: 0, False: 112k]
  ------------------
 4325|      0|    {
 4326|      0|        parity = AB_PARITY_NONE;
  ------------------
  |  |  246|      0|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
 4327|      0|    }
 4328|   112k|    out_at[cur_at].parity2 = parity;
 4329|       |
 4330|   112k|    parity = PARITY_VAL( out_at[cur_at].parity );
  ------------------
  |  |  290|   112k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  ------------------
  |  |  |  |  232|   112k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  ------------------
  ------------------
 4331|   112k|    out_at[cur_at].stereo_atom_parity = ATOM_PARITY_WELL_DEF( parity ) ? AB_PARITY_CALC : parity;
  ------------------
  |  |  287|   112k|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  265|   112k|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  264|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (287:38): [True: 0, False: 112k]
  |  |  |  Branch (287:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                  out_at[cur_at].stereo_atom_parity = ATOM_PARITY_WELL_DEF( parity ) ? AB_PARITY_CALC : parity;
  ------------------
  |  |  252|      0|#define AB_PARITY_CALC   6  /* 6 => calculate parity later */
  ------------------
 4332|   112k|    parity = PARITY_VAL( out_at[cur_at].parity2 );
  ------------------
  |  |  290|   112k|#define PARITY_VAL(X)               ((X) & BITS_PARITY)
  |  |  ------------------
  |  |  |  |  232|   112k|#define BITS_PARITY        0x07  /* mask to retrieve half-bond parity */
  |  |  ------------------
  ------------------
 4333|   112k|    out_at[cur_at].stereo_atom_parity2 = ATOM_PARITY_WELL_DEF( parity ) ? AB_PARITY_CALC : parity;
  ------------------
  |  |  287|   112k|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  265|   112k|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  264|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (287:38): [True: 0, False: 112k]
  |  |  |  Branch (287:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                  out_at[cur_at].stereo_atom_parity2 = ATOM_PARITY_WELL_DEF( parity ) ? AB_PARITY_CALC : parity;
  ------------------
  |  |  252|      0|#define AB_PARITY_CALC   6  /* 6 => calculate parity later */
  ------------------
 4334|       |    /*
 4335|       |    out_at[cur_at].parity2 = out_at[cur_at].parity; // save for stereo + isotopic canon.
 4336|       |    if ( out_at[cur_at].parity ) {
 4337|       |        if ( num_explicit_H > 1 || j1 == MAX_NUM_STEREO_ATOM_NEIGH-1 && num_explicit_H ) {
 4338|       |            //              X   H      X
 4339|       |            // for example,  >C<   or   >C-D
 4340|       |            //              Y   D      Y
 4341|       |            // parity exists for stereo + isotopic atoms canonicalization only
 4342|       |            out_at[cur_at].parity  = 0;
 4343|       |        }
 4344|       |    }
 4345|       |    returning 0 means this can be an adjacent to a stereogenic bond atom
 4346|       |    */
 4347|       |
 4348|   112k|    return (int) out_at[cur_at].parity2;
 4349|      0|}
ichister.c:set_stereo_bonds_parity:
 2992|   112k|{
 2993|   112k|    int j, k, next_at_1, i_next_at_1, i_next_at_2, at_2, next_at_2, num_stereo_bonds, bFound, bAllene;
 2994|   112k|    int bond_type, num_2s_1, num_alt_1;
 2995|   112k|    int num_2s_2, num_alt_2;
 2996|   112k|#if ( ONE_BAD_SB_NEIGHBOR == 1 )
 2997|   112k|    int num_wrong_bonds_1, num_wrong_bonds_2;
 2998|   112k|#endif
 2999|   112k|#if ( N_V_STEREOBONDS == 1 )
 3000|   112k|    int n2sh, num_2s_hetero[2], num_2s_hetero_next[2], next_next_at, type_N, type_N_next;
 3001|   112k|#endif
 3002|   112k|    int num_stored_stereo_bonds, num_stored_isotopic_stereo_bonds;
 3003|   112k|    int chain_length, num_chains, cur_chain_length;
 3004|   112k|    int all_at_2[MAX_NUM_STEREO_BONDS];
 3005|   112k|    int all_pos_1[MAX_NUM_STEREO_BONDS], all_pos_2[MAX_NUM_STEREO_BONDS];
 3006|   112k|    S_CHAR all_unkn[MAX_NUM_STEREO_BONDS];
 3007|   112k|    int /*at_1_parity, at_2_parity,*/ nUnknown, stop = 0;
 3008|       |
 3009|       |    /* at_1_parity = AB_PARITY_NONE; */ /*  do not know */
 3010|       |
 3011|       |    /*  Check valence */
 3012|   112k|    if (MAX_NUM_STEREO_BOND_NEIGH < at[at_1].valence + at[at_1].num_H ||
  ------------------
  |  |  877|   112k|#define MAX_NUM_STEREO_BOND_NEIGH 3
  ------------------
  |  Branch (3012:9): [True: 0, False: 112k]
  ------------------
 3013|   112k|         MIN_NUM_STEREO_BOND_NEIGH > at[at_1].valence + at[at_1].num_H)
  ------------------
  |  |  878|   112k|#define MIN_NUM_STEREO_BOND_NEIGH 2
  ------------------
  |  Branch (3013:10): [True: 112k, False: 28]
  ------------------
 3014|   112k|    {
 3015|   112k|        return 0;
 3016|   112k|    }
 3017|     28|    if (!bCanAtomHaveAStereoBond( at[at_1].elname, at[at_1].charge, at[at_1].radical ))
  ------------------
  |  Branch (3017:9): [True: 28, False: 0]
  ------------------
 3018|     28|    {
 3019|     28|        return 0;
 3020|     28|    }
 3021|      0|    if (at[at_1].c_point)
  ------------------
  |  Branch (3021:9): [True: 0, False: 0]
  ------------------
 3022|      0|    {
 3023|      0|        return 0; /* rejects atoms that can lose or gain a (positive) charge. 01-24-2003 */
 3024|      0|    }
 3025|       |
 3026|       |    /*  middle cumulene atoms, for example, =C=, should be ignored here */
 3027|       |    /*  only atoms at the ends of cumulene chains are considered. */
 3028|      0|    if (!at[at_1].num_H && 2 == at[at_1].valence &&
  ------------------
  |  Branch (3028:9): [True: 0, False: 0]
  |  Branch (3028:28): [True: 0, False: 0]
  ------------------
 3029|      0|         BOND_DOUBLE == get_allowed_stereo_bond_type( (int) at[at_1].bond_type[0] ) &&
  ------------------
  |  |  206|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (3029:10): [True: 0, False: 0]
  ------------------
 3030|      0|         BOND_DOUBLE == get_allowed_stereo_bond_type( (int) at[at_1].bond_type[1] ))
  ------------------
  |  |  206|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (3030:10): [True: 0, False: 0]
  ------------------
 3031|      0|    {
 3032|      0|        return 0;
 3033|      0|    }
 3034|       |
 3035|       |    /*  count bonds and find the second atom on the stereo bond */
 3036|      0|    num_2s_1 = num_alt_1 = 0;
 3037|      0|    chain_length = 0;
 3038|      0|    num_chains = 0;
 3039|      0|#if ( ONE_BAD_SB_NEIGHBOR == 1 )
 3040|      0|    num_wrong_bonds_1 = 0;
 3041|      0|#endif
 3042|      0|#if ( N_V_STEREOBONDS == 1 )
 3043|      0|    num_2s_hetero[0] = num_2s_hetero[1] = type_N = 0;
 3044|      0|    if (0 == at[at_1].num_H && 0 == at[at_1].charge && 0 == at[at_1].radical &&
  ------------------
  |  Branch (3044:9): [True: 0, False: 0]
  |  Branch (3044:32): [True: 0, False: 0]
  |  Branch (3044:56): [True: 0, False: 0]
  ------------------
 3045|      0|         3 == get_endpoint_valence( at[at_1].el_number ))
  ------------------
  |  Branch (3045:10): [True: 0, False: 0]
  ------------------
 3046|      0|    {
 3047|      0|        if (2 == at[at_1].valence && 3 == at[at_1].chem_bonds_valence)
  ------------------
  |  Branch (3047:13): [True: 0, False: 0]
  |  Branch (3047:38): [True: 0, False: 0]
  ------------------
 3048|      0|        {
 3049|      0|            type_N = 1;
 3050|      0|        }
 3051|      0|        else
 3052|      0|        {
 3053|      0|            if (3 == at[at_1].valence && 5 == at[at_1].chem_bonds_valence)
  ------------------
  |  Branch (3053:17): [True: 0, False: 0]
  |  Branch (3053:42): [True: 0, False: 0]
  ------------------
 3054|      0|            {
 3055|      0|                type_N = 2; /* unfortunately includes >N# */
 3056|      0|            }
 3057|      0|        }
 3058|      0|    }
 3059|      0|#endif
 3060|      0|    for (i_next_at_1 = 0, num_stereo_bonds = 0; i_next_at_1 < at[at_1].valence; i_next_at_1++)
  ------------------
  |  Branch (3060:49): [True: 0, False: 0]
  ------------------
 3061|      0|    {
 3062|      0|        nUnknown = ( at[at_1].bond_stereo[i_next_at_1] == STEREO_DBLE_EITHER );
  ------------------
  |  |   68|      0|#define STEREO_DBLE_EITHER   3
  ------------------
 3063|      0|        bond_type = get_allowed_stereo_bond_type( (int) at[at_1].bond_type[i_next_at_1] );
 3064|      0|        at_2 = -1; /* not found */
 3065|      0|        if (bond_type == BOND_ALTERN ||
  ------------------
  |  |  208|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   63|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (3065:13): [True: 0, False: 0]
  ------------------
 3066|      0|             bond_type == BOND_DOUBLE)
  ------------------
  |  |  206|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (3066:14): [True: 0, False: 0]
  ------------------
 3067|      0|        {
 3068|      0|            next_at_1 = at_2 = at[at_1].neighbor[i_next_at_1];
 3069|      0|            next_at_2 = at_1;
 3070|      0|        }
 3071|      0|        switch (bond_type)
 3072|      0|        {
 3073|      0|            case BOND_ALTERN:
  ------------------
  |  |  208|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   63|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (3073:13): [True: 0, False: 0]
  ------------------
 3074|      0|                num_alt_1++;
 3075|      0|#if ( FIND_RING_SYSTEMS == 1 )
 3076|      0|                if (at[at_1].nRingSystem != at[at_2].nRingSystem)
  ------------------
  |  Branch (3076:21): [True: 0, False: 0]
  ------------------
 3077|      0|                {
 3078|      0|                    continue; /* reject alt. bond connecting different ring systems */
 3079|      0|                }
 3080|      0|#endif
 3081|      0|                if (( nMode & CMODE_NO_ALT_SBONDS ) ||
  ------------------
  |  |  780|      0|#define CMODE_NO_ALT_SBONDS      0x000100 /* 6-14-2002: do not assign stereo to alternating bonds */
  ------------------
  |  Branch (3081:21): [True: 0, False: 0]
  ------------------
 3082|      0|                     !bCanAtomHaveAStereoBond( at[at_2].elname, at[at_2].charge, at[at_2].radical ))
  ------------------
  |  Branch (3082:22): [True: 0, False: 0]
  ------------------
 3083|      0|                {
 3084|      0|                    continue; /*  reject non-stereogenic bond to neighbor ord. #i_next_at_1 */
 3085|      0|                }
 3086|      0|                break;
 3087|      0|            case BOND_DOUBLE:
  ------------------
  |  |  206|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (3087:13): [True: 0, False: 0]
  ------------------
 3088|       |                /*  check for cumulene/allene */
 3089|      0|                num_2s_1++;
 3090|      0|                cur_chain_length = 0;
 3091|      0|                if (bCanAtomBeTerminalAllene( at[at_1].elname, at[at_1].charge, at[at_1].radical ))
  ------------------
  |  Branch (3091:21): [True: 0, False: 0]
  ------------------
 3092|      0|                {
 3093|       |                    /*
 3094|       |                     * Example of cumulene
 3095|       |                     * chain length = 2:     >X=C=C=Y<
 3096|       |                     *                        | | | |
 3097|       |                     *  1st cumulene atom= at_1 | | at_2 =last cumlene chain atom
 3098|       |                     *  next to at_1=   next_at_1 next_at_2  =previous to at_2
 3099|       |                     *
 3100|       |                     *  chain length odd:  stereocenter on the middle atom ( 1=> allene )
 3101|       |                     *  chain length even: "long stereogenic bond"
 3102|       |                     */
 3103|      0|                    while (( bAllene =
  ------------------
  |  Branch (3103:28): [True: 0, False: 0]
  ------------------
 3104|      0|                        !at[at_2].num_H && at[at_2].valence == 2 &&
  ------------------
  |  Branch (3104:25): [True: 0, False: 0]
  |  Branch (3104:44): [True: 0, False: 0]
  ------------------
 3105|      0|                        BOND_DOUBLE == get_allowed_stereo_bond_type( (int) at[at_2].bond_type[0] ) &&
  ------------------
  |  |  206|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (3105:25): [True: 0, False: 0]
  ------------------
 3106|      0|                        BOND_DOUBLE == get_allowed_stereo_bond_type( (int) at[at_2].bond_type[1] ) ) &&
  ------------------
  |  |  206|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (3106:25): [True: 0, False: 0]
  ------------------
 3107|      0|                            bCanAtomBeMiddleAllene( at[at_2].elname, at[at_2].charge, at[at_2].radical ))
  ------------------
  |  Branch (3107:29): [True: 0, False: 0]
  ------------------
 3108|      0|                    {
 3109|      0|                        k = ( (int) at[at_2].neighbor[0] == next_at_2 ); /*  opposite neighbor position */
 3110|      0|                        next_at_2 = at_2;
 3111|      0|                        nUnknown += ( at[at_2].bond_stereo[k] == STEREO_DBLE_EITHER );
  ------------------
  |  |   68|      0|#define STEREO_DBLE_EITHER   3
  ------------------
 3112|      0|                        at_2 = (int) at[at_2].neighbor[k];
 3113|      0|                        cur_chain_length++;  /*  count =C= atoms */
 3114|      0|                    }
 3115|      0|                    if (cur_chain_length)
  ------------------
  |  Branch (3115:25): [True: 0, False: 0]
  ------------------
 3116|      0|                    {
 3117|      0|                        num_chains++;
 3118|      0|                        if (bAllene /* at the end of the chain atom Y is =Y=, not =Y< or =Y- */ ||
  ------------------
  |  Branch (3118:29): [True: 0, False: 0]
  ------------------
 3119|      0|                             !bCanAtomBeTerminalAllene( at[at_2].elname, at[at_2].charge, at[at_2].radical ))
  ------------------
  |  Branch (3119:30): [True: 0, False: 0]
  ------------------
 3120|      0|                        {
 3121|      0|                            cur_chain_length = 0;
 3122|      0|                            continue; /*  ignore: does not fit cumulene description; go to check next at_1 neighbor */
 3123|      0|                        }
 3124|      0|                        chain_length = cur_chain_length; /*  accept a stereogenic cumulele */
 3125|      0|                    }
 3126|      0|                }
 3127|      0|#if ( N_V_STEREOBONDS == 1 )
 3128|      0|                if (!cur_chain_length &&
  ------------------
  |  Branch (3128:21): [True: 0, False: 0]
  ------------------
 3129|      0|                     0 <= ( n2sh = bIsSuitableHeteroInpAtom( at + at_2 ) ))
  ------------------
  |  Branch (3129:22): [True: 0, False: 0]
  ------------------
 3130|      0|                {
 3131|      0|                    num_2s_hetero[n2sh] ++; /* n2sh=0 -> =N- or =NH; n2sh=1 -> =O */
 3132|      0|                }
 3133|      0|#endif
 3134|      0|                if (!cur_chain_length &&
  ------------------
  |  Branch (3134:21): [True: 0, False: 0]
  ------------------
 3135|      0|                     !bCanAtomHaveAStereoBond( at[at_2].elname, at[at_2].charge, at[at_2].radical ))
  ------------------
  |  Branch (3135:22): [True: 0, False: 0]
  ------------------
 3136|      0|                {
 3137|      0|                    continue; /*  reject non-stereogenic bond to neighbor #i_next_at_1 */
 3138|      0|                }
 3139|       |
 3140|      0|                break;
 3141|       |
 3142|      0|            case BOND_SINGLE:
  ------------------
  |  |  205|      0|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (3142:13): [True: 0, False: 0]
  ------------------
 3143|      0|            case BOND_TAUTOM:
  ------------------
  |  |  213|      0|#define BOND_TAUTOM              8
  ------------------
  |  Branch (3143:13): [True: 0, False: 0]
  ------------------
 3144|      0|                continue; /*  reject non-stereogenic bond to neighbor #i_next_at_1 */
 3145|      0|            default:
  ------------------
  |  Branch (3145:13): [True: 0, False: 0]
  ------------------
 3146|      0|#if ( ONE_BAD_SB_NEIGHBOR == 1 )
 3147|      0|                num_wrong_bonds_1++;
 3148|      0|                continue;
 3149|       |#else
 3150|       |                return 0; /*  wrong bond type; */
 3151|       |#endif
 3152|      0|        }
 3153|       |
 3154|       |        /*  Check atom at the opposite end of possibly stereogenic bond */
 3155|       |
 3156|      0|        bFound = ( at_2 >= 0 && at_1 > at_2 ); /*  i_next_at_1 = at_1 stereogenic bond neighbor attachment number */
  ------------------
  |  Branch (3156:20): [True: 0, False: 0]
  |  Branch (3156:33): [True: 0, False: 0]
  ------------------
 3157|       |
 3158|      0|        if (bFound)
  ------------------
  |  Branch (3158:13): [True: 0, False: 0]
  ------------------
 3159|      0|        {
 3160|       |            /*  Check "at_2" atom on the opposite side of the bond or cumulene chain */
 3161|      0|            if (MAX_NUM_STEREO_BOND_NEIGH < at[at_2].valence + at[at_2].num_H ||
  ------------------
  |  |  877|      0|#define MAX_NUM_STEREO_BOND_NEIGH 3
  ------------------
  |  Branch (3161:17): [True: 0, False: 0]
  ------------------
 3162|      0|                 MIN_NUM_STEREO_BOND_NEIGH > at[at_2].valence + at[at_2].num_H)
  ------------------
  |  |  878|      0|#define MIN_NUM_STEREO_BOND_NEIGH 2
  ------------------
  |  Branch (3162:18): [True: 0, False: 0]
  ------------------
 3163|      0|                continue;
 3164|       |
 3165|       |            /*  Check at_2 neighbors and bonds */
 3166|      0|            num_2s_2 = num_alt_2 = 0;
 3167|      0|#if ( N_V_STEREOBONDS == 1 )
 3168|      0|            num_2s_hetero_next[0] = num_2s_hetero_next[1] = type_N_next = 0;
 3169|      0|            if (0 == at[at_2].num_H && 0 == at[at_2].charge && 0 == at[at_2].radical &&
  ------------------
  |  Branch (3169:17): [True: 0, False: 0]
  |  Branch (3169:40): [True: 0, False: 0]
  |  Branch (3169:64): [True: 0, False: 0]
  ------------------
 3170|      0|                 3 == get_endpoint_valence( at[at_2].el_number ))
  ------------------
  |  Branch (3170:18): [True: 0, False: 0]
  ------------------
 3171|      0|            {
 3172|      0|                if (2 == at[at_2].valence && 3 == at[at_2].chem_bonds_valence)
  ------------------
  |  Branch (3172:21): [True: 0, False: 0]
  |  Branch (3172:46): [True: 0, False: 0]
  ------------------
 3173|      0|                {
 3174|      0|                    type_N_next = 1; /* -N= */
 3175|      0|                }
 3176|      0|                else
 3177|      0|                {
 3178|      0|                    if (3 == at[at_2].valence && 5 == at[at_2].chem_bonds_valence)
  ------------------
  |  Branch (3178:25): [True: 0, False: 0]
  |  Branch (3178:50): [True: 0, False: 0]
  ------------------
 3179|      0|                    {
 3180|      0|                        type_N_next = 2; /* unfortunately includes >N# */
 3181|      0|                    }
 3182|      0|                }
 3183|      0|            }
 3184|      0|#endif
 3185|      0|            i_next_at_2 = -1;  /*  unassigned mark */
 3186|      0|#if ( ONE_BAD_SB_NEIGHBOR == 1 )
 3187|      0|            num_wrong_bonds_2 = 0;
 3188|      0|#endif
 3189|      0|            for (j = 0; j < at[at_2].valence; j++)
  ------------------
  |  Branch (3189:25): [True: 0, False: 0]
  ------------------
 3190|      0|            {
 3191|      0|                bond_type = get_allowed_stereo_bond_type( (int) at[at_2].bond_type[j] );
 3192|      0|                if (!bond_type)
  ------------------
  |  Branch (3192:21): [True: 0, False: 0]
  ------------------
 3193|      0|                {
 3194|      0|#if ( ONE_BAD_SB_NEIGHBOR == 1 )
 3195|      0|                    num_wrong_bonds_2++;
 3196|      0|                    continue;  /*  this bond type is not allowed to be adjacent to a stereo bond */
 3197|       |#else
 3198|       |                    break;
 3199|       |#endif
 3200|      0|                }
 3201|      0|                if (bond_type == BOND_DOUBLE)
  ------------------
  |  |  206|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (3201:21): [True: 0, False: 0]
  ------------------
 3202|      0|                {
 3203|      0|                    num_2s_2++;
 3204|      0|#if ( N_V_STEREOBONDS == 1 )
 3205|      0|                    next_next_at = at[at_2].neighbor[j];
 3206|      0|                    if (0 <= ( n2sh = bIsSuitableHeteroInpAtom( at + next_next_at ) ))
  ------------------
  |  Branch (3206:25): [True: 0, False: 0]
  ------------------
 3207|      0|                    {
 3208|      0|                        num_2s_hetero_next[n2sh] ++; /* n2sh=0 -> =N- or =NH; n2sh=1 -> =O */
 3209|      0|                    }
 3210|      0|#endif
 3211|      0|                }
 3212|      0|                else
 3213|      0|                {
 3214|      0|                    num_alt_2 += ( bond_type == BOND_ALTERN );
  ------------------
  |  |  208|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   63|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
 3215|      0|                }
 3216|      0|                if ((int) at[at_2].neighbor[j] == next_at_2)
  ------------------
  |  Branch (3216:21): [True: 0, False: 0]
  ------------------
 3217|      0|                {
 3218|      0|                    i_next_at_2 = j; /*  assigned */
 3219|      0|                }
 3220|      0|            }
 3221|      0|            if (
 3222|      0|#if ( ONE_BAD_SB_NEIGHBOR == 1 )
 3223|      0|                 num_wrong_bonds_2 > 1 || num_wrong_bonds_2 && 2 >= at[at_2].valence ||
  ------------------
  |  Branch (3223:18): [True: 0, False: 0]
  |  Branch (3223:43): [True: 0, False: 0]
  |  Branch (3223:64): [True: 0, False: 0]
  ------------------
 3224|       |#else
 3225|       |                 j < at[at_2].valence /* "next" has a wrong bond type*/ ||
 3226|       |#endif
 3227|      0|( num_alt_2 > 0 ) + ( num_2s_2 > 0 ) != 1 || /* all double XOR all alt bonds only */
  ------------------
  |  Branch (3227:1): [True: 0, False: 0]
  ------------------
 3228|       | /* num_2s_2 > 1  ||*/ /* only one double bond permitted */
 3229|      0|                  i_next_at_2 < 0 /* atom next to the opposite atom not found */)
  ------------------
  |  Branch (3229:19): [True: 0, False: 0]
  ------------------
 3230|      0|            {
 3231|      0|                bFound = 0;
 3232|      0|            }
 3233|      0|            else
 3234|      0|                if (at[at_2].c_point)
  ------------------
  |  Branch (3234:21): [True: 0, False: 0]
  ------------------
 3235|      0|                {
 3236|      0|                    bFound = 0; /* rejects atoms that can lose or gain a (positive) charge. 01-24-2003 */
 3237|      0|                }
 3238|      0|                else
 3239|      0|                    if (num_2s_2 > 2)
  ------------------
  |  Branch (3239:25): [True: 0, False: 0]
  ------------------
 3240|      0|                    {
 3241|      0|                        bFound = 0;
 3242|      0|                    }
 3243|      0|                    else
 3244|      0|#if ( N_V_STEREOBONDS == 1 )
 3245|      0|                        if ( 3==( type_N | type_N_next ) && ( 2==type_N && !bIsOxide( at, at_1 ) ||
  ------------------
  |  Branch (3245:30): [True: 0, False: 0]
  |  Branch (3245:63): [True: 0, False: 0]
  |  Branch (3245:76): [True: 0, False: 0]
  ------------------
 3246|      0|                             2==type_N_next && !bIsOxide( at, at_2 ) ))
  ------------------
  |  Branch (3246:30): [True: 0, False: 0]
  |  Branch (3246:48): [True: 0, False: 0]
  ------------------
 3247|      0|                        {
 3248|      0|                            bFound = 0;
 3249|      0|                        }
 3250|      0|                        else
 3251|      0|#endif
 3252|      0|                        {
 3253|      0|                            if (2 == num_2s_2)
  ------------------
  |  Branch (3253:33): [True: 0, False: 0]
  ------------------
 3254|      0|                            {
 3255|      0|#if ( N_V_STEREOBONDS == 1 )
 3256|      0|                                if (!chain_length &&
  ------------------
  |  Branch (3256:37): [True: 0, False: 0]
  ------------------
 3257|      0|                                     1 == ( num_2s_hetero_next[0] | num_2s_hetero_next[1] ) &&
  ------------------
  |  Branch (3257:38): [True: 0, False: 0]
  ------------------
 3258|      0|                                     3 == at[at_2].valence + at[at_2].num_H &&
  ------------------
  |  Branch (3258:38): [True: 0, False: 0]
  ------------------
 3259|      0|                                     5 == at[at_2].chem_bonds_valence + at[at_2].num_H &&
  ------------------
  |  Branch (3259:38): [True: 0, False: 0]
  ------------------
 3260|      0|                                     3 == get_endpoint_valence( at[at_2].el_number ) &&
  ------------------
  |  Branch (3260:38): [True: 0, False: 0]
  ------------------
 3261|      0|                                     ( !type_N || bIsOxide( at, at_2 ) ))
  ------------------
  |  Branch (3261:40): [True: 0, False: 0]
  |  Branch (3261:51): [True: 0, False: 0]
  ------------------
 3262|      0|                                {
 3263|       |                                    /*
 3264|       |                                     *   found:
 3265|       |                                     *
 3266|       |                                     *    \      /    \      /    \      /
 3267|       |                                     *     \    /      \    /      \    /
 3268|       |                                     *      N==C   or   N==C   or   N==N
 3269|       |                                     *    //    \     //    \     //    \
 3270|       |                                     *   O  ^    \   N  ^    \   O  ^    \
 3271|       |                                     *      |           |           |
 3272|       |                                     *      |           |           |
 3273|       |                                     *      at[at_2]    at[at_2]    at[at_2]
 3274|       |                                     */
 3275|      0|                                    ;
 3276|      0|                                }
 3277|      0|                                else
 3278|      0|                                {
 3279|      0|                                    bFound = 0;
 3280|      0|                                }
 3281|       |#else
 3282|       |                                bFound = 0;
 3283|       |#endif
 3284|      0|                                }
 3285|      0|                            }
 3286|       |
 3287|      0|            if (chain_length && num_alt_2)
  ------------------
  |  Branch (3287:17): [True: 0, False: 0]
  |  Branch (3287:33): [True: 0, False: 0]
  ------------------
 3288|      0|            {
 3289|      0|                return 0; /*  allow no alt bonds in cumulenes */
 3290|      0|            }
 3291|      0|        }
 3292|       |
 3293|      0|        if (bFound)
  ------------------
  |  Branch (3293:13): [True: 0, False: 0]
  ------------------
 3294|      0|        {
 3295|      0|            all_pos_1[num_stereo_bonds] = i_next_at_1; /* neighbor to at_1 position */
 3296|      0|            all_pos_2[num_stereo_bonds] = i_next_at_2; /* neighbor to at_2 position */
 3297|      0|            all_at_2[num_stereo_bonds] = at_2;        /* at_2 */
 3298|      0|            all_unkn[num_stereo_bonds] = nUnknown;    /* stereogenic bond has Unknown configuration */
 3299|       |            /*
 3300|       |            if ( (at[at_1].bUsed0DParity & 2) || (at[at_2].bUsed0DParity & 2) ) {
 3301|       |                for ( k = 0; k < MAX_NUM_STEREO_BONDS && at[at_1].sb_parity[k]; k ++ ) {
 3302|       |                    if ( at[at_1].sb_neigh[k] == i_next_at_1 ) {
 3303|       |                        if ( at[at_1].sb_parity[k] == AB_PARITY_UNKN && !nUnknown ) {
 3304|       |                            all_unkn[num_stereo_bonds] = 1;
 3305|       |                        }
 3306|       |                        break;
 3307|       |                    }
 3308|       |                }
 3309|       |            }
 3310|       |            */
 3311|      0|            num_stereo_bonds++;
 3312|      0|        }
 3313|      0|    }
 3314|      0|    if (num_chains > 1)
  ------------------
  |  Branch (3314:9): [True: 0, False: 0]
  ------------------
 3315|      0|    {
 3316|      0|        return 0; /*  cannot be more than 1 cumulene chain. */
 3317|      0|    }
 3318|      0|#if ( ONE_BAD_SB_NEIGHBOR == 1 )
 3319|      0|    if (num_wrong_bonds_1 > 1 || num_wrong_bonds_1 && 2 >= at[at_1].valence)
  ------------------
  |  Branch (3319:9): [True: 0, False: 0]
  |  Branch (3319:34): [True: 0, False: 0]
  |  Branch (3319:55): [True: 0, False: 0]
  ------------------
 3320|      0|    {
 3321|      0|        return 0; /* wrong bond type */
 3322|      0|    }
 3323|      0|#endif
 3324|       |    /*  Accept only short chains for now */
 3325|       |    /*  chain_length=1: >C=C=C<      tetrahedral center, allene */
 3326|       |    /*  chain_length=2: >C=C=C=C<    stereogenic bond, cumulene */
 3327|      0|    if (chain_length && ( num_stereo_bonds != 1 || num_alt_1 || chain_length > MAX_CUMULENE_LEN ))
  ------------------
  |  |  235|      0|#define MAX_CUMULENE_LEN   2     /* max number of bonds in a cumulene chain - 1                     */
  ------------------
  |  Branch (3327:9): [True: 0, False: 0]
  |  Branch (3327:27): [True: 0, False: 0]
  |  Branch (3327:52): [True: 0, False: 0]
  |  Branch (3327:65): [True: 0, False: 0]
  ------------------
 3328|      0|    {
 3329|      0|        return 0;
 3330|      0|    }
 3331|       |
 3332|       |    /*  We need 1 double bond/chain XOR up to 3 arom. bonds */
 3333|       |    /*  to have a stereogenic bond */
 3334|      0|    if (( num_alt_1 > 0 ) + ( num_2s_1 > 0 ) != 1 || !num_stereo_bonds /*|| num_2s_1 > 1*/)
  ------------------
  |  Branch (3334:9): [True: 0, False: 0]
  |  Branch (3334:54): [True: 0, False: 0]
  ------------------
 3335|      0|        return 0;
 3336|       |
 3337|      0|    if (num_2s_1 > 1)
  ------------------
  |  Branch (3337:9): [True: 0, False: 0]
  ------------------
 3338|      0|    {
 3339|      0|#if ( N_V_STEREOBONDS == 1 )
 3340|      0|        if (2 == num_2s_1 &&
  ------------------
  |  Branch (3340:13): [True: 0, False: 0]
  ------------------
 3341|      0|             2 == type_N &&
  ------------------
  |  Branch (3341:14): [True: 0, False: 0]
  ------------------
 3342|      0|             1 == ( num_2s_hetero[0] | num_2s_hetero[1] ) &&
  ------------------
  |  Branch (3342:14): [True: 0, False: 0]
  ------------------
 3343|      0|             3 == at[at_1].valence + at[at_1].num_H &&
  ------------------
  |  Branch (3343:14): [True: 0, False: 0]
  ------------------
 3344|      0|             5 == at[at_1].chem_bonds_valence + at[at_1].num_H &&
  ------------------
  |  Branch (3344:14): [True: 0, False: 0]
  ------------------
 3345|      0|             3 == get_endpoint_valence( at[at_1].el_number ))
  ------------------
  |  Branch (3345:14): [True: 0, False: 0]
  ------------------
 3346|      0|        {
 3347|      0|            ;
 3348|      0|        }
 3349|      0|        else
 3350|      0|        {
 3351|      0|            return 0;
 3352|      0|        }
 3353|       |#else
 3354|       |        return 0;
 3355|       |#endif
 3356|      0|    }
 3357|       |
 3358|       |    /* ================== Calculate parities ====================== */
 3359|       |
 3360|       |
 3361|       |    /*  Find possibly stereo bonds and save them */
 3362|      0|    num_stored_isotopic_stereo_bonds = 0;
 3363|      0|    num_stored_stereo_bonds = 0;
 3364|      0|    for (k = 0; k < num_stereo_bonds; k++)
  ------------------
  |  Branch (3364:17): [True: 0, False: 0]
  ------------------
 3365|      0|    {
 3366|       |
 3367|      0|        int cur_parity, next_parity, abs_cur_parity, abs_next_parity, dot_prod_z;
 3368|      0|        S_CHAR z_dir1[3], z_dir2[3]; /*  3D vectors for half stereo bond parity direction */
 3369|      0|        int  chain_len_bits = MAKE_BITS_CUMULENE_LEN( chain_length );
  ------------------
  |  |  240|      0|#define MAKE_BITS_CUMULENE_LEN(X)   ((X)*MULT_STEREOBOND)
  |  |  ------------------
  |  |  |  |  237|      0|#define MULT_STEREOBOND    0x08  /* multiplier for cumulene chain length
  |  |  ------------------
  ------------------
 3370|      0|        int  cur_parity_defined, next_parity_defined;
 3371|      0|        int  cur_action, next_action, result_action;
 3372|       |
 3373|      0|        at_2 = all_at_2[k];
 3374|      0|        i_next_at_1 = all_pos_1[k];
 3375|       |
 3376|      0|#if ( MIN_SB_RING_SIZE > 0 )
 3377|      0|        if (at[at_1].nRingSystem == at[at_2].nRingSystem)
  ------------------
  |  Branch (3377:13): [True: 0, False: 0]
  ------------------
 3378|      0|        {
 3379|       |            /*  check min. ring size only if both double bond/cumulene */
 3380|       |            /*  ending atoms belong to the same ring system */
 3381|      0|            j = is_bond_in_Nmax_memb_ring( at, at_1, i_next_at_1, q, nAtomLevel, cSource, min_sb_ring_size );
 3382|      0|            if (j > 0)
  ------------------
  |  Branch (3382:17): [True: 0, False: 0]
  ------------------
 3383|      0|            {
 3384|      0|                continue;
 3385|      0|            }
 3386|      0|            else
 3387|      0|            {
 3388|      0|                if (j < 0)
  ------------------
  |  Branch (3388:21): [True: 0, False: 0]
  ------------------
 3389|      0|                {
 3390|      0|                    return CT_STEREOBOND_ERROR;
  ------------------
  |  |   59|      0|#define CT_STEREOBOND_ERROR  (CT_ERR_FIRST-12)  /*(-30012) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 3391|      0|                }
 3392|      0|            }
 3393|      0|        }
 3394|      0|#endif
 3395|       |
 3396|      0|        i_next_at_2 = all_pos_2[k];
 3397|      0|        nUnknown = all_unkn[k];
 3398|      0|        memset( z_dir1, 0, sizeof( z_dir1 ) );
 3399|      0|        memset( z_dir2, 0, sizeof( z_dir2 ) );
 3400|       |
 3401|       |        /********************************************************************************
 3402|       |         * Find atom parities (negative means parity due to H-isotopes only)
 3403|       |         * and half stereo bond parity directions z_dir1, z_dir2.
 3404|       |         *
 3405|       |         * Bond can have unknown or undefined parity or no parity because of:
 3406|       |         * 1. Geometry (poorly defined, cannot calculate, for example linear =C-F
 3407|       |         *    or =CHD with no geometry) -- Undefined parity
 3408|       |         *                                                              H
 3409|       |         * 2. Identical H atoms (no parity in principle, for example =C<  )
 3410|       |         *    -- No parity                                              H
 3411|       |         *
 3412|       |         * 3. The user said double bond stereo is unknown
 3413|       |         *    or at least one of single bonds is in unknown direction
 3414|       |         *    -- Unknown parity
 3415|       |         *
 3416|       |         * These 3 cases (see above) are referred below as 1, 2, 3.
 3417|       |         * Each of the cases may be present or not (2 possibilities)
 3418|       |         * Total number of combination is 2*2*2=8
 3419|       |         *
 3420|       |         * Since a case when all 3 are not present is a well-defined parity,
 3421|       |         * we do not consider this case here. Then 2*2*2-1=7 cases are left.
 3422|       |         *
 3423|       |         * If several cases are present, list them below separated by "+".
 3424|       |         * For example, 1+2 means (1) undefined geometry and (2) no parity
 3425|       |         * is possible because of identical H atoms.
 3426|       |         *
 3427|       |         * N) Decision table, Non-isotopic, 2*2*2-1=7 cases:
 3428|       |         * =================================================
 3429|       |         * none     : 2+any: 1+2(e.g.=CH2); 1+2+3; 2; 2+3  AB_PARITY_NONE=0
 3430|       |         * undefined: 1                                    AB_PARITY_UNDF
 3431|       |         * unknown  : 1+3; 3                               AB_PARITY_UNKN
 3432|       |         *
 3433|       |         * I) Decision table, Isotopic, 2*2*2-1=7 cases:
 3434|       |         * =============================================
 3435|       |         * none     : none
 3436|       |         * undefined: 1; 1+2; 1+2+3; 2; 2+3
 3437|       |         * unknown  : 1+3; 3
 3438|       |         *
 3439|       |         * Note: When defining identical atoms H atoms in case 2,
 3440|       |         *       Isotopic and Non-isotopic cases are different:
 3441|       |         *  N: do NOT take into account the isotopic composition of H atoms
 3442|       |         *  I: DO take into account the isotopic composition of H atoms
 3443|       |         *     (it is assumed that H isotopes are always different)
 3444|       |         *
 3445|       |         * half_stereo_bond_parity() returns:
 3446|       |         * ==================================
 3447|       |         * Note: half_stereo_bond_parity() is unaware of case 3.
 3448|       |         *
 3449|       |         * can't be a half of a stereo bond    AB_PARITY_NONE
 3450|       |         * 1, isotopic & non-isotopic:         AB_PARITY_UNDF
 3451|       |         * 1, isotopic only                   -AB_PARITY_UNDF
 3452|       |         * 2, no parity: identical H isotopes  AB_PARITY_IISO
 3453|       |         * 3, 'Either' single bond(s)          AB_PARITY_UNKN ???
 3454|       |         * 3, 'Either' single bond(s), iso H  -AB_PARITY_UNKN ???
 3455|       |         * defined parity                      AB_PARITY_ODD,  AB_PARITY_EVEN
 3456|       |         * defined parity for isotopic only:  -AB_PARITY_ODD, -AB_PARITY_EVEN
 3457|       |         *
 3458|       |         * Resultant value for the stereo bond parity
 3459|       |         * ---+-------------------+-------+--------+----------------+
 3460|       |         * 3? | half_stereo_bond_ | N or I| case 1,| bond parity    |
 3461|       |         *    |  parity()=        |       | 2 or 3 |                |
 3462|       |         * ---+-------------------+-------+--------+----------------+
 3463|       |         *   ( AB_PARITY_ODD/EVEN) => N&I: -       => AB_PARITY_CALC (=6, calc.later)
 3464|       |         * 3+( AB_PARITY_ODD/EVEN) => N&I: 3       => AB_PARITY_UNKN (=3)
 3465|       |         *   (-AB_PARITY_ODD/EVEN) => N:   2       => AB_PARITY_NONE (=0)
 3466|       |         *   (-AB_PARITY_ODD/EVEN) => I:   -       => AB_PARITY_CALC
 3467|       |         * 3+(-AB_PARITY_ODD/EVEN) => N:   2+3     => AB_PARITY_UNDF (=4)
 3468|       |         * 3+(-AB_PARITY_ODD/EVEN) => I:   3       => AB_PARITY_UNKN
 3469|       |         *   ( AB_PARITY_IISO )    => N:   1+2, 2  => AB_PARITY_NONE (=0)
 3470|       |         *   ( AB_PARITY_IISO )    => I:   1+2, 2  => AB_PARITY_UNDF
 3471|       |         * 3+( AB_PARITY_IISO )    => N:  1+2+3,2+3=> AB_PARITY_NONE
 3472|       |         * 3+( AB_PARITY_IISO )    => I:  1+2+3,2+3=> AB_PARITY_UNDF
 3473|       |         *   ( AB_PARITY_UNDF )    => N&I: 1       => AB_PARITY_UNDF
 3474|       |         * 3+( AB_PARITY_UNDF )    => N&I: 1+3     => AB_PARITY_UNKN
 3475|       |         *   (-AB_PARITY_UNDF )    => N:   1+2     => AB_PARITY_NONE
 3476|       |         *   (-AB_PARITY_UNDF )    => I:   1       => AB_PARITY_UNDF
 3477|       |         * 3+(-AB_PARITY_UNDF )    => N:   1+2+3   => AB_PARITY_NONE
 3478|       |         * 3+(-AB_PARITY_UNDF )    => I:   1+3     => AB_PARITY_UNKN
 3479|       |         * ---+-------------------+-------+--------+----------------+
 3480|       |
 3481|       |         * If bond parity is undefined because abs(dot_prod_z) < MIN_DOT_PROD
 3482|       |         * then replace: AB_PARITY_CALC
 3483|       |         *         with: AB_PARITY_UNDF
 3484|       |         * Joining two half_bond_parity() results:
 3485|       |         *
 3486|       |         *
 3487|       |         * atom1 \ atom2   | AB_PARITY_NONE  AB_PARITY_UNKN  AB_PARITY_UNDF  AB_PARITY_CALC
 3488|       |         * ----------------+---------------------------------------------------------------
 3489|       |         *0=AB_PARITY_NONE | AB_PARITY_NONE  AB_PARITY_NONE  AB_PARITY_NONE  AB_PARITY_NONE
 3490|       |         *3=AB_PARITY_UNKN |                 AB_PARITY_UNKN  AB_PARITY_UNKN  AB_PARITY_UNKN
 3491|       |         *4=AB_PARITY_UNDF |                                 AB_PARITY_UNDF  AB_PARITY_UNDF
 3492|       |         *6=AB_PARITY_CALC |                                                 AB_PARITY_CALC
 3493|       |         *
 3494|       |         * that is, take min out of the two
 3495|       |         *********************************************************************************/
 3496|       |
 3497|      0|        cur_parity = half_stereo_bond_parity( at, at_1, at_removed_H, num_removed_H,
 3498|      0|                                                z_dir1, bPointedEdgeStereo, vABParityUnknown );
 3499|      0|        next_parity = half_stereo_bond_parity( at, at_2, at_removed_H, num_removed_H,
 3500|      0|                                                z_dir2, bPointedEdgeStereo, vABParityUnknown );
 3501|       |
 3502|      0|        if (RETURNED_ERROR( cur_parity ) || RETURNED_ERROR( next_parity ))
  ------------------
  |  |   72|      0|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   68|      0|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   66|      0|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   69|      0|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (72:31): [True: 0, False: 0]
  |  |  |  Branch (72:53): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                      if (RETURNED_ERROR( cur_parity ) || RETURNED_ERROR( next_parity ))
  ------------------
  |  |   72|      0|#define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   68|      0|#define CT_ERR_MIN CT_UNKNOWN_ERR
  |  |  |  |  ------------------
  |  |  |  |  |  |   66|      0|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define RETURNED_ERROR(nVal) (CT_ERR_MIN<=(nVal) && (nVal)<=CT_ERR_MAX)
  |  |  ------------------
  |  |  |  |   69|      0|#define CT_ERR_MAX CT_ERR_FIRST
  |  |  |  |  ------------------
  |  |  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (72:31): [True: 0, False: 0]
  |  |  |  Branch (72:53): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3503|      0|        {
 3504|      0|            return CT_CALC_STEREO_ERR;
  ------------------
  |  |   62|      0|#define CT_CALC_STEREO_ERR   (CT_ERR_FIRST-15)  /*(-30015) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 3505|      0|        }
 3506|      0|        if (( at[at_1].bUsed0DParity & FlagSB_0D ) || ( at[at_1].bUsed0DParity & FlagSB_0D ))
  ------------------
  |  |   92|      0|#define FlagSB_0D  2  /* bUsed0DParity */
  ------------------
                      if (( at[at_1].bUsed0DParity & FlagSB_0D ) || ( at[at_1].bUsed0DParity & FlagSB_0D ))
  ------------------
  |  |   92|      0|#define FlagSB_0D  2  /* bUsed0DParity */
  ------------------
  |  Branch (3506:13): [True: 0, False: 0]
  |  Branch (3506:55): [True: 0, False: 0]
  ------------------
 3507|      0|        {
 3508|      0|            FixSb0DParities( at, /* at_removed_H, num_removed_H,*/ chain_length,
 3509|      0|                             at_1, i_next_at_1, z_dir1,
 3510|      0|                             at_2, i_next_at_2, z_dir2, &cur_parity, &next_parity );
 3511|      0|        }
 3512|       |
 3513|      0|        if (cur_parity == AB_PARITY_NONE || abs( cur_parity ) == AB_PARITY_IISO)
  ------------------
  |  |  246|      0|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
                      if (cur_parity == AB_PARITY_NONE || abs( cur_parity ) == AB_PARITY_IISO)
  ------------------
  |  |  251|      0|#define AB_PARITY_IISO   5  /* 5 => no parity because of identical atoms */
  ------------------
  |  Branch (3513:13): [True: 0, False: 0]
  |  Branch (3513:45): [True: 0, False: 0]
  ------------------
 3514|      0|        {
 3515|      0|            continue;
 3516|      0|        }
 3517|      0|        if (next_parity == AB_PARITY_NONE || abs( next_parity ) == AB_PARITY_IISO)
  ------------------
  |  |  246|      0|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
                      if (next_parity == AB_PARITY_NONE || abs( next_parity ) == AB_PARITY_IISO)
  ------------------
  |  |  251|      0|#define AB_PARITY_IISO   5  /* 5 => no parity because of identical atoms */
  ------------------
  |  Branch (3517:13): [True: 0, False: 0]
  |  Branch (3517:46): [True: 0, False: 0]
  ------------------
 3518|      0|        {
 3519|      0|            continue;
 3520|      0|        }
 3521|       |
 3522|      0|        cur_action = half_stereo_bond_action( cur_parity, nUnknown, 0, vABParityUnknown ); /*  -1 => program error */
 3523|      0|        next_action = half_stereo_bond_action( next_parity, nUnknown, 0, vABParityUnknown );
 3524|      0|        result_action = inchi_min( cur_action, next_action );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3525|       |
 3526|      0|        if (result_action == -1)
  ------------------
  |  Branch (3526:13): [True: 0, False: 0]
  ------------------
 3527|      0|        {
 3528|      0|            stop = 1; /*  program error <BRKPT> */
 3529|      0|        }
 3530|       |
 3531|      0|        abs_cur_parity = abs( cur_parity );
 3532|      0|        abs_next_parity = abs( next_parity );
 3533|      0|        cur_parity_defined = ATOM_PARITY_WELL_DEF( abs_cur_parity );
  ------------------
  |  |  287|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  265|      0|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  264|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (287:38): [True: 0, False: 0]
  |  |  |  Branch (287:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3534|      0|        next_parity_defined = ATOM_PARITY_WELL_DEF( abs_next_parity );
  ------------------
  |  |  287|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  265|      0|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  264|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (287:38): [True: 0, False: 0]
  |  |  |  Branch (287:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3535|       |
 3536|      0|        if (cur_parity_defined && next_parity_defined)
  ------------------
  |  Branch (3536:13): [True: 0, False: 0]
  |  Branch (3536:35): [True: 0, False: 0]
  ------------------
 3537|      0|        {
 3538|       |            /*  find how the whole bond parity depend on geometry */
 3539|       |            /*  if dot_prod_z < 0 then bond_parity := 3-bond_parity */
 3540|       |            /*  can be done only for a well-defined geometry */
 3541|       |            /*
 3542|       |            dot_prod_z  = (chain_len_bits & BIT_CUMULENE_CHI)?
 3543|       |                           triple_prod_char( at, at_1, i_next_at_1, z_dir1, at_2, i_next_at_2, z_dir2 ) :
 3544|       |                           dot_prodchar3(z_dir1, z_dir2);
 3545|       |            */
 3546|       |
 3547|      0|            dot_prod_z = ( chain_len_bits && BOND_CHAIN_LEN( chain_len_bits ) % 2 )
  ------------------
  |  |  242|      0|#define BOND_CHAIN_LEN(X)           (GET_BITS_CUMULENE_LEN(X)/MULT_STEREOBOND) /* 0 => double bond, 1 => allene, 2 => cumulene,..*/
  |  |  ------------------
  |  |  |  |  241|      0|#define GET_BITS_CUMULENE_LEN(X)    ((X)&MASK_CUMULENE_LEN)
  |  |  |  |  ------------------
  |  |  |  |  |  |  233|      0|#define MASK_CUMULENE_LEN  0x38  /* mask to retrieve (cumulene chain length - 1)*MULT_STEREOBOND    */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define BOND_CHAIN_LEN(X)           (GET_BITS_CUMULENE_LEN(X)/MULT_STEREOBOND) /* 0 => double bond, 1 => allene, 2 => cumulene,..*/
  |  |  ------------------
  |  |  |  |  237|      0|#define MULT_STEREOBOND    0x08  /* multiplier for cumulene chain length
  |  |  ------------------
  ------------------
  |  Branch (3547:28): [True: 0, False: 0]
  |  Branch (3547:46): [True: 0, False: 0]
  ------------------
 3548|      0|                ?  triple_prod_char( at, at_1, i_next_at_1, z_dir1, at_2, i_next_at_2, z_dir2 )
 3549|      0|                :  dot_prodchar3( z_dir1, z_dir2 );
 3550|       |
 3551|      0|            if (abs( dot_prod_z ) < MIN_DOT_PROD)
  ------------------
  |  |  281|      0|#define MIN_DOT_PROD 50          /* min value of at->stereo_bond_z_prod[i] to define parity */
  ------------------
  |  Branch (3551:17): [True: 0, False: 0]
  ------------------
 3552|      0|            {
 3553|       |                /*  The geometry is not well-defined. Eliminate AB_PARITY_CALC */
 3554|      0|                result_action = inchi_min( result_action, AB_PARITY_UNDF );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3555|      0|            }
 3556|      0|        }
 3557|      0|        else
 3558|      0|        {
 3559|      0|            dot_prod_z = 0;
 3560|      0|        }
 3561|       |
 3562|      0|        if (result_action != AB_PARITY_NONE && result_action != -1)
  ------------------
  |  |  246|      0|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
  |  Branch (3562:13): [True: 0, False: 0]
  |  Branch (3562:48): [True: 0, False: 0]
  ------------------
 3563|      0|        {
 3564|       |            /*  Stereo, no isotopes (only positive) */
 3565|      0|            if (cur_parity > 0 && next_parity > 0)
  ------------------
  |  Branch (3565:17): [True: 0, False: 0]
  |  Branch (3565:35): [True: 0, False: 0]
  ------------------
 3566|      0|            {
 3567|      0|                if (save_a_stereo_bond( dot_prod_z, result_action | chain_len_bits,
  ------------------
  |  Branch (3567:21): [True: 0, False: 0]
  ------------------
 3568|      0|                    at_1, i_next_at_1, out_at[at_1].stereo_bond_neighbor,
 3569|      0|                    out_at[at_1].stereo_bond_ord, out_at[at_1].stereo_bond_z_prod,
 3570|      0|                    out_at[at_1].stereo_bond_parity,
 3571|      0|                    at_2, i_next_at_2, out_at[at_2].stereo_bond_neighbor,
 3572|      0|                    out_at[at_2].stereo_bond_ord, out_at[at_2].stereo_bond_z_prod,
 3573|      0|                    out_at[at_2].stereo_bond_parity ))
 3574|      0|                {
 3575|      0|                    if (!out_at[at_1].parity ||
  ------------------
  |  Branch (3575:25): [True: 0, False: 0]
  ------------------
 3576|      0|                         cur_parity_defined && !ATOM_PARITY_WELL_DEF( abs( out_at[at_1].parity ) ))
  ------------------
  |  |  287|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  265|      0|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  264|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (287:38): [True: 0, False: 0]
  |  |  |  Branch (287:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (3576:26): [True: 0, False: 0]
  ------------------
 3577|      0|                    {
 3578|      0|                        out_at[at_1].parity = cur_parity;
 3579|      0|                        memcpy( out_at[at_1].z_dir, z_dir1, sizeof( out_at[0].z_dir ) );
 3580|      0|                    }
 3581|      0|                    if (!out_at[at_2].parity ||
  ------------------
  |  Branch (3581:25): [True: 0, False: 0]
  ------------------
 3582|      0|                         next_parity_defined && !ATOM_PARITY_WELL_DEF( abs( out_at[at_2].parity ) ))
  ------------------
  |  |  287|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  265|      0|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  264|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (287:38): [True: 0, False: 0]
  |  |  |  Branch (287:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (3582:26): [True: 0, False: 0]
  ------------------
 3583|      0|                    {
 3584|      0|                        out_at[at_2].parity = next_parity;
 3585|      0|                        memcpy( out_at[at_2].z_dir, z_dir2, sizeof( out_at[0].z_dir ) );
 3586|      0|                    }
 3587|      0|                    out_at[at_1].bAmbiguousStereo |= at[at_1].bAmbiguousStereo;
 3588|      0|                    out_at[at_2].bAmbiguousStereo |= at[at_2].bAmbiguousStereo;
 3589|      0|                    num_stored_stereo_bonds++;
 3590|      0|                }
 3591|      0|            }
 3592|      0|        }
 3593|       |
 3594|       |        /*  Stereo + isotopic (all non-zero) */
 3595|      0|        cur_action = half_stereo_bond_action( cur_parity, nUnknown, 1, vABParityUnknown ); /*  -1 => program error */
 3596|      0|        next_action = half_stereo_bond_action( next_parity, nUnknown, 1, vABParityUnknown );
 3597|      0|        result_action = inchi_min( cur_action, next_action );
  ------------------
  |  |  167|      0|#define inchi_min(a,b)  (((a)<(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (167:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3598|      0|        cur_parity = abs_cur_parity;
 3599|      0|        next_parity = abs_next_parity;
 3600|      0|        if (result_action != AB_PARITY_NONE && result_action != -1)
  ------------------
  |  |  246|      0|#define AB_PARITY_NONE   0  /* 0 => no parity; also parity&0x38 = 0 */
  ------------------
  |  Branch (3600:13): [True: 0, False: 0]
  |  Branch (3600:48): [True: 0, False: 0]
  ------------------
 3601|      0|        {
 3602|       |            /*  Stereo, isotopic */
 3603|      0|            if (cur_parity > 0 && next_parity > 0)
  ------------------
  |  Branch (3603:17): [True: 0, False: 0]
  |  Branch (3603:35): [True: 0, False: 0]
  ------------------
 3604|      0|            {
 3605|      0|                if (save_a_stereo_bond( dot_prod_z, result_action | chain_len_bits,
  ------------------
  |  Branch (3605:21): [True: 0, False: 0]
  ------------------
 3606|      0|                    at_1, i_next_at_1, out_at[at_1].stereo_bond_neighbor2,
 3607|      0|                    out_at[at_1].stereo_bond_ord2, out_at[at_1].stereo_bond_z_prod2,
 3608|      0|                    out_at[at_1].stereo_bond_parity2,
 3609|      0|                    at_2, i_next_at_2, out_at[at_2].stereo_bond_neighbor2,
 3610|      0|                    out_at[at_2].stereo_bond_ord2, out_at[at_2].stereo_bond_z_prod2,
 3611|      0|                    out_at[at_2].stereo_bond_parity2 ))
 3612|      0|                {
 3613|      0|                    if (!out_at[at_1].parity2 ||
  ------------------
  |  Branch (3613:25): [True: 0, False: 0]
  ------------------
 3614|      0|                         cur_parity_defined && !ATOM_PARITY_WELL_DEF( abs( out_at[at_1].parity2 ) ))
  ------------------
  |  |  287|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  265|      0|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  264|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (287:38): [True: 0, False: 0]
  |  |  |  Branch (287:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (3614:26): [True: 0, False: 0]
  ------------------
 3615|      0|                    {
 3616|      0|                        out_at[at_1].parity2 = cur_parity /*| chain_len_bits*/;
 3617|      0|                        if (!out_at[at_1].parity)
  ------------------
  |  Branch (3617:29): [True: 0, False: 0]
  ------------------
 3618|      0|                        {
 3619|      0|                            memcpy( out_at[at_1].z_dir, z_dir1, sizeof( out_at[0].z_dir ) );
 3620|      0|                        }
 3621|      0|                    }
 3622|      0|                    if (!out_at[at_2].parity2 || /* next line changed from abs(out_at[at_2].parity) 2006-03-05 */
  ------------------
  |  Branch (3622:25): [True: 0, False: 0]
  ------------------
 3623|      0|                         next_parity_defined && !ATOM_PARITY_WELL_DEF( abs( out_at[at_2].parity2 ) ))
  ------------------
  |  |  287|      0|#define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  265|      0|#define AB_MIN_WELL_DEFINED_PARITY 1 /* min(AB_PARITY_ODD, AB_PARITY_EVEN) */
  |  |  ------------------
  |  |               #define ATOM_PARITY_WELL_DEF(X)     (AB_MIN_WELL_DEFINED_PARITY <= (X) && (X) <= AB_MAX_WELL_DEFINED_PARITY)
  |  |  ------------------
  |  |  |  |  264|      0|#define AB_MAX_WELL_DEFINED_PARITY 2 /* 1, 2 => well defined parities, uncluding 'unknown' */
  |  |  ------------------
  |  |  |  Branch (287:38): [True: 0, False: 0]
  |  |  |  Branch (287:75): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (3623:26): [True: 0, False: 0]
  ------------------
 3624|      0|                    {
 3625|      0|                        out_at[at_2].parity2 = next_parity /*| chain_len_bits*/;
 3626|      0|                        if (!out_at[at_2].parity)
  ------------------
  |  Branch (3626:29): [True: 0, False: 0]
  ------------------
 3627|      0|                        {
 3628|      0|                            memcpy( out_at[at_2].z_dir, z_dir2, sizeof( out_at[0].z_dir ) );
 3629|      0|                        }
 3630|      0|                    }
 3631|      0|                    out_at[at_1].bAmbiguousStereo |= at[at_1].bAmbiguousStereo;
 3632|      0|                    out_at[at_2].bAmbiguousStereo |= at[at_2].bAmbiguousStereo;
 3633|      0|                    num_stored_isotopic_stereo_bonds++;
 3634|      0|                }
 3635|      0|            }
 3636|      0|        }
 3637|      0|        else
 3638|      0|        {
 3639|      0|            if (result_action == -1)
  ------------------
  |  Branch (3639:17): [True: 0, False: 0]
  ------------------
 3640|      0|            {
 3641|      0|                stop = 1; /*  program error? <BRKPT> */
 3642|      0|            }
 3643|      0|        }
 3644|      0|    }
 3645|       |
 3646|      0|    if (stop)
  ------------------
  |  Branch (3646:9): [True: 0, False: 0]
  ------------------
 3647|      0|    {
 3648|      0|        return CT_CALC_STEREO_ERR;
  ------------------
  |  |   62|      0|#define CT_CALC_STEREO_ERR   (CT_ERR_FIRST-15)  /*(-30015) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 3649|      0|    }
 3650|       |
 3651|      0|    return /*num_stored_stereo_bonds+*/ num_stored_isotopic_stereo_bonds;
 3652|      0|}

is_centerpoint_elem:
  150|   112k|{
  151|   112k|    static U_CHAR el_numb[12];
  152|   112k|    static int len;
  153|   112k|    int len2;
  154|   112k|    int i;
  155|   112k|    if (!len)
  ------------------
  |  Branch (155:9): [True: 1, False: 112k]
  ------------------
  156|      1|    {
  157|      1|        len2 = 0;
  158|      1|        el_numb[len2++] = (U_CHAR) get_periodic_table_number( "C" );
  159|      1|        el_numb[len2++] = (U_CHAR) get_periodic_table_number( "N" );
  160|      1|        el_numb[len2++] = (U_CHAR) get_periodic_table_number( "P" );
  161|      1|        el_numb[len2++] = (U_CHAR) get_periodic_table_number( "S" );
  162|      1|        el_numb[len2++] = (U_CHAR) get_periodic_table_number( "I" );
  163|      1|        el_numb[len2++] = (U_CHAR) get_periodic_table_number( "As" );
  164|      1|        el_numb[len2++] = (U_CHAR) get_periodic_table_number( "Sb" );
  165|      1|        el_numb[len2++] = (U_CHAR) get_periodic_table_number( "Se" );
  166|      1|        el_numb[len2++] = (U_CHAR) get_periodic_table_number( "Te" );
  167|      1|        el_numb[len2++] = (U_CHAR) get_periodic_table_number( "Cl" );
  168|      1|        el_numb[len2++] = (U_CHAR) get_periodic_table_number( "Br" );
  169|      1|        len = len2;
  170|      1|    }
  171|  1.34M|    for (i = 0; i < len; i++)
  ------------------
  |  Branch (171:17): [True: 1.23M, False: 111k]
  ------------------
  172|  1.23M|    {
  173|  1.23M|        if (el_numb[i] == el_number)
  ------------------
  |  Branch (173:13): [True: 1.63k, False: 1.22M]
  ------------------
  174|  1.63k|        {
  175|  1.63k|            return 1;
  176|  1.63k|        }
  177|  1.23M|    }
  178|       |
  179|   111k|    return 0;
  180|   112k|}
AddAtom2num:
  244|      8|{  /*  bSubtract: 0=> add, 1=>subtract, 2=> fill */
  245|      8|    inp_ATOM *at = atom + at_no;
  246|      8|    int       k;
  247|      8|    int       nMobile = ( at->charge == -1 );
  248|      8|    if (bSubtract == 1)
  ------------------
  |  Branch (248:9): [True: 0, False: 8]
  ------------------
  249|      0|    {
  250|       |        /* 1: subtract */
  251|      0|        num[1] -= nMobile;
  252|      0|        nMobile += at->num_H;
  253|      0|        num[0] -= nMobile;
  254|      0|        for (k = 0; k < T_NUM_ISOTOPIC; k++)
  ------------------
  |  |   98|      0|#define           T_NUM_ISOTOPIC    NUM_H_ISOTOPES /* was 2, now 3 */
  |  |  ------------------
  |  |  |  |   53|      0|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  |  |  ------------------
  ------------------
  |  Branch (254:21): [True: 0, False: 0]
  ------------------
  255|      0|        {
  256|       |            /*  T (3H isotope) first because it has higher weight */
  257|      0|            num[T_NUM_NO_ISOTOPIC + k] -= at->num_iso_H[NUM_H_ISOTOPES - k - 1];
  ------------------
  |  |   97|      0|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
                          num[T_NUM_NO_ISOTOPIC + k] -= at->num_iso_H[NUM_H_ISOTOPES - k - 1];
  ------------------
  |  |   53|      0|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  258|      0|        }
  259|      0|    }
  260|      8|    else
  261|      8|    {
  262|      8|        if (bSubtract == 2)
  ------------------
  |  Branch (262:13): [True: 8, False: 0]
  ------------------
  263|      8|        {
  264|       |            /* fill */
  265|      8|            memset( num, 0, ( T_NUM_NO_ISOTOPIC + T_NUM_ISOTOPIC ) * sizeof( num[0] ) );
  ------------------
  |  |   97|      8|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
                          memset( num, 0, ( T_NUM_NO_ISOTOPIC + T_NUM_ISOTOPIC ) * sizeof( num[0] ) );
  ------------------
  |  |   98|      8|#define           T_NUM_ISOTOPIC    NUM_H_ISOTOPES /* was 2, now 3 */
  |  |  ------------------
  |  |  |  |   53|      8|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  |  |  ------------------
  ------------------
  266|      8|        }
  267|       |        /* else (0): add */
  268|      8|        num[1] += nMobile;
  269|      8|        nMobile += at->num_H;
  270|      8|        num[0] += nMobile;
  271|     32|        for (k = 0; k < T_NUM_ISOTOPIC; k++)
  ------------------
  |  |   98|     32|#define           T_NUM_ISOTOPIC    NUM_H_ISOTOPES /* was 2, now 3 */
  |  |  ------------------
  |  |  |  |   53|     32|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  |  |  ------------------
  ------------------
  |  Branch (271:21): [True: 24, False: 8]
  ------------------
  272|     24|        {
  273|       |            /*  T (3H isotope) first because it has higher weight */
  274|     24|            num[T_NUM_NO_ISOTOPIC + k] += at->num_iso_H[NUM_H_ISOTOPES - k - 1];
  ------------------
  |  |   97|     24|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
                          num[T_NUM_NO_ISOTOPIC + k] += at->num_iso_H[NUM_H_ISOTOPES - k - 1];
  ------------------
  |  |   53|     24|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  275|     24|        }
  276|      8|    }
  277|      8|    return nMobile;
  278|      8|}
AddAtom2DA:
  283|      8|{   /*  bSubtract: 0=> add, 1=>subtract, 2=> fill */
  284|      8|    inp_ATOM *at = atom + at_no;
  285|      8|    int       nDelta, nAcidic_O;
  286|       |
  287|      8|    if (at->charge < -1 || at->charge == 1 && !at->c_point || at->charge > 1)
  ------------------
  |  Branch (287:9): [True: 0, False: 8]
  |  Branch (287:28): [True: 0, False: 8]
  |  Branch (287:47): [True: 0, False: 0]
  |  Branch (287:63): [True: 0, False: 8]
  ------------------
  288|      0|    {
  289|      0|        return;
  290|      0|    }
  291|       |
  292|      8|    nDelta = ( bSubtract == 1 ) ? -1 : 1;
  ------------------
  |  Branch (292:14): [True: 0, False: 8]
  ------------------
  293|       |
  294|       |    /* "Acidic" O, S, Se, Te recognition */
  295|      8|    if (at->at_type & ATT_ACIDIC_CO)
  ------------------
  |  |   63|      8|#define ATT_ACIDIC_CO    0x0001
  ------------------
  |  Branch (295:9): [True: 0, False: 8]
  ------------------
  296|      0|    {
  297|      0|        nAcidic_O = nDelta;
  298|      0|    }
  299|      8|    else
  300|      8|    {
  301|      8|        nAcidic_O = 0;
  302|      8|    }
  303|       |
  304|      8|    if (bSubtract == 2)
  ------------------
  |  Branch (304:9): [True: 8, False: 0]
  ------------------
  305|      8|    {
  306|       |        /* 2: fill, otherwise add */
  307|      8|        memset( num_DA, 0, TG_NUM_DA * sizeof( num_DA[0] ) );
  308|      8|    }
  309|      8|    if (at->charge <= 0 && at->valence == at->chem_bonds_valence ||
  ------------------
  |  Branch (309:9): [True: 8, False: 0]
  |  Branch (309:28): [True: 8, False: 0]
  ------------------
  310|       |         /* neutral or negative donor */
  311|      8|         at->charge > 0 && at->valence + 1 == at->chem_bonds_valence
  ------------------
  |  Branch (311:10): [True: 0, False: 0]
  |  Branch (311:28): [True: 0, False: 0]
  ------------------
  312|       |         /* positively charged donor */
  313|      8|         )
  314|      8|    {
  315|      8|        if (at->charge < 0)
  ------------------
  |  Branch (315:13): [True: 4, False: 4]
  ------------------
  316|      4|        {
  317|      4|            num_DA[TG_Num_dM] += nDelta;
  318|      4|            num_DA[TG_Num_dO] += nAcidic_O;
  319|      4|        }
  320|      4|        else
  321|      4|        {
  322|      4|            if (at->num_H)
  ------------------
  |  Branch (322:17): [True: 4, False: 0]
  ------------------
  323|      4|            {
  324|      4|                num_DA[TG_Num_dH] += nDelta;
  325|      4|                num_DA[TG_Num_dO] += nAcidic_O;
  326|      4|            }
  327|      4|        }
  328|      8|    }
  329|      0|    else
  330|      0|    {
  331|      0|        if (at->charge <= 0 && at->valence + 1 == at->chem_bonds_valence ||
  ------------------
  |  Branch (331:13): [True: 0, False: 0]
  |  Branch (331:32): [True: 0, False: 0]
  ------------------
  332|      0|             at->charge  > 0 && at->valence + 2 == at->chem_bonds_valence)
  ------------------
  |  Branch (332:14): [True: 0, False: 0]
  |  Branch (332:33): [True: 0, False: 0]
  ------------------
  333|      0|        {
  334|       |            /* acceptor */
  335|      0|            if (at->charge < 0)
  ------------------
  |  Branch (335:17): [True: 0, False: 0]
  ------------------
  336|      0|            {
  337|      0|                num_DA[TG_Num_aM] += nDelta;
  338|      0|            }
  339|      0|            else
  340|      0|            {
  341|      0|                if (at->num_H)
  ------------------
  |  Branch (341:21): [True: 0, False: 0]
  ------------------
  342|      0|                {
  343|      0|                    num_DA[TG_Num_aH] += nDelta;
  344|      0|                }
  345|      0|                else
  346|      0|                {
  347|      0|                    num_DA[TG_Num_aO] += nAcidic_O; /* acidic O-acceptor has no H or charge */
  348|      0|                }
  349|      0|            }
  350|      0|        }
  351|      0|    }
  352|      8|    return;
  353|      8|}
AddEndPoint:
  363|      8|{
  364|      8|    pEndPoint->nAtomNumber = iat;
  365|      8|    pEndPoint->nEquNumber = 0;
  366|      8|    pEndPoint->nGroupNumber = at[iat].endpoint;
  367|      8|    if (at[iat].endpoint)
  ------------------
  |  Branch (367:9): [True: 0, False: 8]
  ------------------
  368|      0|    {
  369|       |        /* already an endpoint */
  370|      0|        memset( pEndPoint->num, 0, sizeof( pEndPoint->num ) );
  371|      0|    }
  372|      8|    else
  373|      8|    {
  374|       |        /* not an endpoint yet, make it an endpoint */
  375|      8|        AddAtom2num( pEndPoint->num, at, iat, 2 );  /* fill */
  376|      8|        AddAtom2DA( pEndPoint->num_DA, at, iat, 2 );
  377|       |        /*
  378|       |        nMobile  = pEndPoint->num[1] = (at[iat].charge == -1);
  379|       |        nMobile  = pEndPoint->num[0] = at[iat].num_H + nMobile;
  380|       |        for ( k = 0; k < T_NUM_ISOTOPIC; k ++ ) {
  381|       |        pEndPoint->num[T_NUM_NO_ISOTOPIC+k] = at[iat].num_iso_H[NUM_H_ISOTOPES-k-1];
  382|       |        }
  383|       |        */
  384|      8|    }
  385|       |
  386|      8|    return 0;
  387|      8|}
nGetEndpointInfo:
  392|   564k|{
  393|   564k|    int  nEndpointValence;
  394|   564k|    int  nMobile;
  395|   564k|    S_CHAR cChargeSubtype;
  396|       |
  397|   564k|    if (atom[iat].radical && atom[iat].radical != RADICAL_SINGLET)
  ------------------
  |  |  103|     30|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (397:9): [True: 30, False: 564k]
  |  Branch (397:30): [True: 30, False: 0]
  ------------------
  398|     30|    {
  399|     30|        return 0; /* a radical */
  400|     30|    }
  401|   564k|    if (!( nEndpointValence = get_endpoint_valence( atom[iat].el_number ) ))
  ------------------
  |  Branch (401:9): [True: 560k, False: 3.92k]
  ------------------
  402|   560k|    {
  403|   560k|        return 0; /* not an endpoint */
  404|   560k|    }
  405|  3.92k|    if (nEndpointValence <= atom[iat].valence)
  ------------------
  |  Branch (405:9): [True: 20, False: 3.90k]
  ------------------
  406|     20|    {
  407|     20|        return 0; /* not an endpoint, for example >N(+)< or >N<  or >O(+)- or >O- or >N- or -O- */
  408|     20|    }
  409|       |
  410|  3.90k|    if (atom[iat].charge == -1 || atom[iat].charge == 0)
  ------------------
  |  Branch (410:9): [True: 44, False: 3.85k]
  |  Branch (410:35): [True: 3.85k, False: 0]
  ------------------
  411|  3.90k|    {
  412|       |        /* not a positive charge-point */
  413|  3.90k|        if (nEndpointValence < atom[iat].chem_bonds_valence)
  ------------------
  |  Branch (413:13): [True: 0, False: 3.90k]
  ------------------
  414|      0|        {
  415|      0|            return 0; /* abnormal valence > standard endpoint valence */
  416|      0|        }
  417|  3.90k|        nMobile = atom[iat].num_H + ( atom[iat].charge == -1 );
  418|  3.90k|        if (nMobile + atom[iat].chem_bonds_valence != nEndpointValence)
  ------------------
  |  Branch (418:13): [True: 3.83k, False: 68]
  ------------------
  419|  3.83k|        {
  420|  3.83k|            return 0; /* non-standard endpoint valence */
  421|  3.83k|        }
  422|     68|        switch (atom[iat].chem_bonds_valence - atom[iat].valence)
  423|     68|        {
  424|     68|            case 0:
  ------------------
  |  Branch (424:13): [True: 68, False: 0]
  ------------------
  425|     68|                eif->cDonor = 1;
  426|     68|                eif->cAcceptor = 0;
  427|     68|                break;
  428|      0|            case 1:
  ------------------
  |  Branch (428:13): [True: 0, False: 68]
  ------------------
  429|      0|                eif->cDonor = 0;
  430|      0|                eif->cAcceptor = 1;
  431|      0|                break;
  432|      0|            default:
  ------------------
  |  Branch (432:13): [True: 0, False: 68]
  ------------------
  433|      0|                return 0;
  434|     68|        }
  435|     68|        eif->cMobile = nMobile;
  436|     68|        eif->cNeutralBondsValence = nEndpointValence - nMobile;
  437|     68|        eif->cMoveableCharge = 0;
  438|     68|#if ( KETO_ENOL_TAUT == 1 )
  439|     68|        eif->cKetoEnolCode = 0;
  440|     68|#endif
  441|     68|        return nEndpointValence;
  442|     68|    }
  443|      0|    else
  444|      0|    {
  445|      0|        if (atom[iat].c_point &&
  ------------------
  |  Branch (445:13): [True: 0, False: 0]
  ------------------
  446|      0|             0 <= GetChargeType( atom, iat, &cChargeSubtype ) &&
  ------------------
  |  Branch (446:14): [True: 0, False: 0]
  ------------------
  447|      0|             ( (int) cChargeSubtype & ( C_SUBTYPE_H_ACCEPT | C_SUBTYPE_H_DONOR ) ))
  ------------------
  |  |  134|      0|#define C_SUBTYPE_H_ACCEPT    4
  ------------------
                           ( (int) cChargeSubtype & ( C_SUBTYPE_H_ACCEPT | C_SUBTYPE_H_DONOR ) ))
  ------------------
  |  |  135|      0|#define C_SUBTYPE_H_DONOR     8
  ------------------
  |  Branch (447:14): [True: 0, False: 0]
  ------------------
  448|      0|        {
  449|       |            /* charge-point */
  450|      0|            {
  451|      0|                if (cChargeSubtype & C_SUBTYPE_H_ACCEPT)
  ------------------
  |  |  134|      0|#define C_SUBTYPE_H_ACCEPT    4
  ------------------
  |  Branch (451:21): [True: 0, False: 0]
  ------------------
  452|      0|                {
  453|      0|                    eif->cDonor = 0;
  454|      0|                    eif->cAcceptor = 1;
  455|      0|                }
  456|      0|                else
  457|      0|                {
  458|      0|                    if (cChargeSubtype & C_SUBTYPE_H_DONOR)
  ------------------
  |  |  135|      0|#define C_SUBTYPE_H_DONOR     8
  ------------------
  |  Branch (458:25): [True: 0, False: 0]
  ------------------
  459|      0|                    {
  460|      0|                        eif->cDonor = 1;
  461|      0|                        eif->cAcceptor = 0;
  462|      0|                    }
  463|      0|                    else
  464|      0|                    {
  465|      0|                        return 0;
  466|      0|                    }
  467|      0|                }
  468|      0|            }
  469|      0|            eif->cMobile = atom[iat].num_H;
  470|      0|            eif->cNeutralBondsValence = nEndpointValence - atom[iat].num_H;
  471|      0|            eif->cMoveableCharge = atom[iat].charge;
  472|      0|#if ( KETO_ENOL_TAUT == 1 )
  473|      0|            eif->cKetoEnolCode = 0;
  474|      0|#endif
  475|      0|            return nEndpointValence;
  476|      0|        }
  477|      0|    }
  478|       |
  479|      0|    return 0;
  480|  3.90k|}
RegisterEndPoints:
  606|      4|{
  607|      4|    T_GROUP  *t_group = t_group_info->t_group;
  608|      4|    int      *pnum_t = &t_group_info->num_t_groups;
  609|      4|    int       max_num_t = t_group_info->max_num_t_groups;
  610|      4|    int       nNumZeroEqu, nNumNewTGroups;
  611|      4|    AT_NUMB   group, prev_group, prev_eqnum, nNextGroupNumber, nLeastGroupNumber;
  612|      4|    int       nNumGroups, num_t, difference;
  613|      4|    int       i, j, k, ret;
  614|      4|    AT_NUMB   nNewTgNumberStackArray[MAX_STACK_ARRAY_LEN + 1];
  615|      4|    AT_NUMB   nGroupNumberStackArray[MAX_STACK_ARRAY_LEN + 1];
  616|      4|    AT_NUMB   nGroupNewNumberStackArray[MAX_STACK_ARRAY_LEN + 1];
  617|      4|    AT_NUMB  *nNewTgNumber = nNewTgNumberStackArray;
  618|      4|    AT_NUMB  *nGroupNumber = nGroupNumberStackArray;
  619|      4|    AT_NUMB  *nGroupNewNumber = nGroupNewNumberStackArray;
  620|       |
  621|      4|    if (nNumEndPoints <= 0)
  ------------------
  |  Branch (621:9): [True: 0, False: 4]
  ------------------
  622|      0|    {
  623|      0|        return 0; /* nothing to do */
  624|      0|    }
  625|      4|    num_t = *pnum_t;
  626|      4|    difference = 0;
  627|      4|    nNextGroupNumber = 0;
  628|      4|    nNumZeroEqu = 0;
  629|      4|    ret = 0;
  630|       |    /* find max group number; increment it to obtain next available group number */
  631|      4|    for (i = 0; i < num_t; i++)
  ------------------
  |  Branch (631:17): [True: 0, False: 4]
  ------------------
  632|      0|    {
  633|      0|        if (nNextGroupNumber < t_group[i].nGroupNumber)
  ------------------
  |  Branch (633:13): [True: 0, False: 0]
  ------------------
  634|      0|        {
  635|      0|            nNextGroupNumber = t_group[i].nGroupNumber;
  636|      0|        }
  637|      0|    }
  638|      4|    nNextGroupNumber++;
  639|       |
  640|       |    /* find min non-zero group number nLeastGroupNumber;
  641|       |    count zero EndPoint[i].nEquNumber
  642|       |    if all EndPoint[i].nGroupNumber are equal and non-zero then exit: nothing to do.
  643|       |    */
  644|      4|    nLeastGroupNumber = nNextGroupNumber;
  645|      4|    prev_group = EndPoint[0].nGroupNumber;
  646|      4|    prev_eqnum = EndPoint[0].nEquNumber;
  647|     12|    for (i = j = k = 0; i < nNumEndPoints; i++)
  ------------------
  |  Branch (647:25): [True: 8, False: 4]
  ------------------
  648|      8|    {
  649|      8|        if (group = EndPoint[i].nGroupNumber)
  ------------------
  |  Branch (649:13): [True: 0, False: 8]
  ------------------
  650|      0|        {
  651|      0|            if (group < nLeastGroupNumber)
  ------------------
  |  Branch (651:17): [True: 0, False: 0]
  ------------------
  652|      0|            {
  653|      0|                nLeastGroupNumber = group;
  654|      0|            }
  655|      0|        }
  656|      8|        j += ( prev_group == EndPoint[i].nGroupNumber ); /* count endpoints that belong to the 1st group */
  657|      8|        k += ( prev_eqnum == EndPoint[i].nEquNumber );   /* count endpoints that belongo to a group equivalent to the 1st group */
  658|      8|        nNumZeroEqu += !EndPoint[i].nEquNumber;        /* count endpoints that have been processed by FindAccessibleEndPoints() */
  659|      8|    }
  660|      4|    if (j == nNumEndPoints && prev_group && k == nNumEndPoints)
  ------------------
  |  Branch (660:9): [True: 4, False: 0]
  |  Branch (660:31): [True: 0, False: 4]
  |  Branch (660:45): [True: 0, False: 0]
  ------------------
  661|      0|    {
  662|       |        /* all endpoints already belong to one t-group;
  663|       |        the last comparison is not needed for now
  664|       |        because EndPoint[i].nEquNumber cannot make
  665|       |        endpont partitioning finer
  666|       |        */
  667|      0|        return 0;
  668|      0|    }
  669|       |
  670|      4|    nNumNewTGroups = 0;
  671|       |
  672|      4|    if (!nNumZeroEqu)
  ------------------
  |  Branch (672:9): [True: 0, False: 4]
  ------------------
  673|      0|    {
  674|       |        /* EndPoint[] has been processed by FindAccessibleEndPoints;
  675|       |        * equal EndPoint[i].nEquNumber mark endpoints belonging to
  676|       |        * the same t-group
  677|       |        * Since now the next available t-group number, nNextGroupNumber,
  678|       |        * is known,replace fict. IDs assigned by FindAccessibleEndPoints
  679|       |        * with correct new t-group numbers.
  680|       |        */
  681|      0|        for (i = 0; i < nNumEndPoints; i++)
  ------------------
  |  Branch (681:21): [True: 0, False: 0]
  ------------------
  682|      0|        {
  683|      0|            if (( group = EndPoint[i].nEquNumber ) >= nNextGroupNumber)
  ------------------
  |  Branch (683:17): [True: 0, False: 0]
  ------------------
  684|      0|            {
  685|       |                /* replace fict. IDs assigned by FindAccessibleEndPoints() with new t-group numbers */
  686|       |                /* these fict. IDs have values = (num_atoms+1), (num_atoms+2),...; they may be non-contiguous */
  687|      0|                for (j = 0; j < nNumNewTGroups; j++)
  ------------------
  |  Branch (687:29): [True: 0, False: 0]
  ------------------
  688|      0|                {
  689|      0|                    if (group == nGroupNewNumber[j])
  ------------------
  |  Branch (689:25): [True: 0, False: 0]
  ------------------
  690|      0|                    {
  691|      0|                        break;
  692|      0|                    }
  693|      0|                }
  694|      0|                if (j == nNumNewTGroups)
  ------------------
  |  Branch (694:21): [True: 0, False: 0]
  ------------------
  695|      0|                {
  696|       |                    /* found new fict. ID = group */
  697|      0|                    if (j == MAX_STACK_ARRAY_LEN && nGroupNewNumber == nGroupNewNumberStackArray)
  ------------------
  |  |  139|      0|#define MAX_STACK_ARRAY_LEN 127
  ------------------
  |  Branch (697:25): [True: 0, False: 0]
  |  Branch (697:53): [True: 0, False: 0]
  ------------------
  698|      0|                    {
  699|       |                        /* stack array overflow; allocate more memory than may be needed */
  700|      0|                        nGroupNewNumber = (AT_NUMB *) inchi_malloc( nNumEndPoints * sizeof( nGroupNewNumber[0] ) );
  ------------------
  |  | 1130|      0|#define inchi_malloc   malloc
  ------------------
  701|      0|                        if (!nGroupNewNumber)
  ------------------
  |  Branch (701:29): [True: 0, False: 0]
  ------------------
  702|      0|                        {
  703|      0|                            ret = -1;
  704|      0|                            goto exit_function;
  705|      0|                        }
  706|      0|                        memcpy( nGroupNewNumber, nGroupNewNumberStackArray, nNumNewTGroups * sizeof( nGroupNewNumber[0] ) );
  707|      0|                    }
  708|       |                    /* save newly found fict. t-group ID to compare to the next values of EndPoint[].nEquNumber  */
  709|      0|                    nGroupNewNumber[j] = group;
  710|      0|                    nNumNewTGroups++;
  711|      0|                }
  712|      0|                EndPoint[i].nEquNumber = nNextGroupNumber + j;
  713|      0|            }
  714|      0|        }   /* after this point the values just stored in nGroupNewNumber[] will not
  715|       |            be used. However, the obtained nNumNewTGroups value will be used */
  716|      0|    }
  717|      4|    else
  718|      4|    {
  719|      4|        if (nNumZeroEqu == nNumEndPoints)
  ------------------
  |  Branch (719:13): [True: 4, False: 0]
  ------------------
  720|      4|        {
  721|       |            /* EndPoint[] has NOT been processed by FindAccessibleEndPoints;
  722|       |            all atoms and t-groups to which endpoints belong should
  723|       |            be merged into a single t-group                              */
  724|      4|            if (nLeastGroupNumber == nNextGroupNumber)
  ------------------
  |  Branch (724:17): [True: 4, False: 0]
  ------------------
  725|      4|            {
  726|       |                /* flag to create a new t-group: none of the found
  727|       |                endpoints belong to an already known t-group             */
  728|      4|                nNumNewTGroups = 1; /* otherwise 0 */
  729|      4|            }
  730|       |            /* All EndPoint[*].nEquNumber are zeroes. All endpoints will
  731|       |            * belong to one new or old t-group; its ID is nLeastGroupNumber.
  732|       |            * Set  EndPoint[i].nEquNumber = nLeastGroupNumber;             */
  733|     12|            for (i = 0; i < nNumEndPoints; i++)
  ------------------
  |  Branch (733:25): [True: 8, False: 4]
  ------------------
  734|      8|            {
  735|      8|                EndPoint[i].nEquNumber = nLeastGroupNumber;
  736|      8|            }
  737|      4|        }
  738|      0|        else
  739|      0|        {
  740|      0|            ret = -1; /* program error: only some of EndPoint[i].nEquNumber are zero */ /*   <BRKPT> */
  741|      0|            goto exit_function;
  742|      0|        }
  743|      4|    }
  744|       |
  745|      4|    if (nNumNewTGroups)
  ------------------
  |  Branch (745:9): [True: 4, False: 0]
  ------------------
  746|      4|    {
  747|       |        /* create new nNumNewTGroups t-group(s) */
  748|      4|        if (num_t + nNumNewTGroups > max_num_t)
  ------------------
  |  Branch (748:13): [True: 0, False: 4]
  ------------------
  749|      0|        {
  750|      0|            ret = -1; /* found too many t-groups */ /*   <BRKPT> */
  751|      0|            goto exit_function;
  752|      0|        }
  753|       |        /* initialize new t-group(s) */
  754|      4|        memset( t_group + num_t, 0, nNumNewTGroups * sizeof( t_group[0] ) );
  755|      8|        for (i = 0; i < nNumNewTGroups; i++)
  ------------------
  |  Branch (755:21): [True: 4, False: 4]
  ------------------
  756|      4|        {
  757|      4|            t_group[num_t + i].nGroupNumber = nNextGroupNumber + i;
  758|      4|        }
  759|      4|    }
  760|       |
  761|       |    /* At this point:
  762|       |    *   EndPoint[i].nGroupNumber == 0   => the endpoint atom does not belong to a t-group yet
  763|       |    *   EndPoint[i].nGroupNumber  > 0   => current t-group ID of the endpoint atom
  764|       |    *   EndPoint[i].nEquNumber      -->    new ID of a tautomeric group of this endpoint atom
  765|       |    *   EndPoint[i].nAtomNumber     -->    number of the endpoint atom
  766|       |    */
  767|       |
  768|      4|    nNumGroups = 0; /* counts the groups to be renumbered */
  769|     12|    for (i = j = 0; i < nNumEndPoints; i++)
  ------------------
  |  Branch (769:21): [True: 8, False: 4]
  ------------------
  770|      8|    {
  771|      8|        if (group = EndPoint[i].nGroupNumber)
  ------------------
  |  Branch (771:13): [True: 0, False: 8]
  ------------------
  772|      0|        {
  773|      0|            if (group == EndPoint[i].nEquNumber)
  ------------------
  |  Branch (773:17): [True: 0, False: 0]
  ------------------
  774|      0|            {
  775|      0|                continue; /* ignore: the endpoint belongs to the same t-group as before */
  776|      0|            }
  777|       |            /* save information for renumbering of the existing t-groups */
  778|      0|            for (j = 0; j < nNumGroups; j++)
  ------------------
  |  Branch (778:25): [True: 0, False: 0]
  ------------------
  779|      0|            {
  780|      0|                if (group == nGroupNumber[j])
  ------------------
  |  Branch (780:21): [True: 0, False: 0]
  ------------------
  781|      0|                {
  782|      0|                    if (EndPoint[i].nEquNumber != nGroupNewNumber[j])
  ------------------
  |  Branch (782:25): [True: 0, False: 0]
  ------------------
  783|      0|                    {
  784|      0|                        ret = -1; /* program error */ /*   <BRKPT> */
  785|      0|                        goto exit_function;
  786|      0|                    }
  787|      0|                    break;
  788|      0|                }
  789|      0|            }
  790|      0|            if (j == nNumGroups)
  ------------------
  |  Branch (790:17): [True: 0, False: 0]
  ------------------
  791|      0|            {
  792|       |                /* discovered a new t-group number; store it together with its nEquNumber */
  793|      0|                if (j == MAX_STACK_ARRAY_LEN)
  ------------------
  |  |  139|      0|#define MAX_STACK_ARRAY_LEN 127
  ------------------
  |  Branch (793:21): [True: 0, False: 0]
  ------------------
  794|      0|                {
  795|      0|                    if (nGroupNewNumber == nGroupNewNumberStackArray)
  ------------------
  |  Branch (795:25): [True: 0, False: 0]
  ------------------
  796|      0|                    {
  797|      0|                        nGroupNewNumber = (AT_NUMB *) inchi_malloc( nNumEndPoints * sizeof( nGroupNewNumber[0] ) );
  ------------------
  |  | 1130|      0|#define inchi_malloc   malloc
  ------------------
  798|      0|                        if (!nGroupNewNumber)
  ------------------
  |  Branch (798:29): [True: 0, False: 0]
  ------------------
  799|      0|                        {
  800|      0|                            ret = -1;
  801|      0|                            goto exit_function;
  802|      0|                        }
  803|      0|                        memcpy( nGroupNewNumber, nGroupNewNumberStackArray, nNumGroups * sizeof( nGroupNewNumber[0] ) );
  804|      0|                    }
  805|      0|                    if (nGroupNumber == nGroupNumberStackArray)
  ------------------
  |  Branch (805:25): [True: 0, False: 0]
  ------------------
  806|      0|                    {
  807|      0|                        nGroupNumber = (AT_NUMB *) inchi_malloc( nNumEndPoints * sizeof( nGroupNumber[0] ) );
  ------------------
  |  | 1130|      0|#define inchi_malloc   malloc
  ------------------
  808|      0|                        if (!nGroupNumber)
  ------------------
  |  Branch (808:29): [True: 0, False: 0]
  ------------------
  809|      0|                        {
  810|      0|                            ret = -1;
  811|      0|                            goto exit_function;
  812|      0|                        }
  813|      0|                        memcpy( nGroupNumber, nGroupNumberStackArray, nNumGroups * sizeof( nGroupNumber[0] ) );
  814|      0|                    }
  815|      0|                }
  816|       |
  817|      0|                nGroupNumber[j] = group;  /* old t-group ID */
  818|      0|                nGroupNewNumber[j] = EndPoint[i].nEquNumber; /* new t-group ID */
  819|      0|                nNumGroups++;
  820|      0|            }
  821|      0|        }
  822|      8|        else
  823|      8|        {
  824|       |            /* add a new endpoint to the newly created or previously existing t-groups */
  825|      8|            group = EndPoint[i].nEquNumber;
  826|      8|            if (group >= nNextGroupNumber)
  ------------------
  |  Branch (826:17): [True: 8, False: 0]
  ------------------
  827|      8|            {
  828|       |                /* get index of a new t-group from equ number */
  829|      8|                j = num_t + group - nNextGroupNumber; /* newly assigned IDs are contiguous */
  830|      8|            }
  831|      0|            else
  832|      0|            {
  833|       |                /* old t-group */
  834|      0|                if (j >= num_t || group != t_group[j].nGroupNumber)
  ------------------
  |  Branch (834:21): [True: 0, False: 0]
  |  Branch (834:35): [True: 0, False: 0]
  ------------------
  835|      0|                {
  836|       |                    /* search only if j is not a needed group index */
  837|      0|                    for (j = 0; j < num_t; j++)
  ------------------
  |  Branch (837:33): [True: 0, False: 0]
  ------------------
  838|      0|                    {
  839|      0|                        if (group == t_group[j].nGroupNumber)
  ------------------
  |  Branch (839:29): [True: 0, False: 0]
  ------------------
  840|      0|                        {
  841|      0|                            break;
  842|      0|                        }
  843|      0|                    }
  844|      0|                    if (j == num_t)
  ------------------
  |  Branch (844:25): [True: 0, False: 0]
  ------------------
  845|      0|                    {
  846|      0|                        ret = -1; /* program error: t-group not found */ /*   <BRKPT> */
  847|      0|                        goto exit_function;
  848|      0|                    }
  849|      0|                }
  850|      0|            }
  851|       |            /* add aton to existing or new t-group */
  852|      8|            t_group[j].nNumEndpoints++;
  853|     48|            for (k = 0; k < (int) ( sizeof( t_group->num ) / sizeof( t_group->num[0] ) ); k++)
  ------------------
  |  Branch (853:25): [True: 40, False: 8]
  ------------------
  854|     40|            {
  855|     40|                t_group[j].num[k] += EndPoint[i].num[k];
  856|     40|            }
  857|     56|            for (k = 0; k < (int) ( sizeof( t_group->num_DA ) / sizeof( t_group->num_DA[0] ) ); k++)
  ------------------
  |  Branch (857:25): [True: 48, False: 8]
  ------------------
  858|     48|            {
  859|     48|                t_group[j].num_DA[k] += EndPoint[i].num_DA[k];
  860|     48|            }
  861|       |            /* mark endpoint */
  862|      8|            at[EndPoint[i].nAtomNumber].endpoint = group;
  863|      8|            difference++;
  864|      8|        }
  865|      8|    }
  866|       |
  867|      4|    difference += nNumGroups;
  868|      4|    num_t += nNumNewTGroups;
  869|      4|    if (!difference)
  ------------------
  |  Branch (869:9): [True: 0, False: 4]
  ------------------
  870|      0|    {
  871|      0|        ret = 0; /* nothing to do. Not necessarily a program error: happens if all EndPoint[i].nGroupNumber==EndPoint[i].nEquNumber  */
  872|      0|        goto exit_function;
  873|      0|    }
  874|       |
  875|      4|    if (nNumGroups)
  ------------------
  |  Branch (875:9): [True: 0, False: 4]
  ------------------
  876|      0|    {
  877|       |        /* prepare for renumbering: find max t-group number */
  878|      0|        for (i = 0, nNextGroupNumber = 0; i < num_t; i++)
  ------------------
  |  Branch (878:43): [True: 0, False: 0]
  ------------------
  879|      0|        {
  880|      0|            if (nNextGroupNumber < t_group[i].nGroupNumber)
  ------------------
  |  Branch (880:17): [True: 0, False: 0]
  ------------------
  881|      0|            {
  882|      0|                nNextGroupNumber = t_group[i].nGroupNumber;
  883|      0|            }
  884|      0|        }
  885|      0|    }
  886|       |    /* renumber and merge t-groups */
  887|      4|    for (i = 0; i < nNumGroups; i++)
  ------------------
  |  Branch (887:17): [True: 0, False: 4]
  ------------------
  888|      0|    {
  889|      0|        int i1, i2;
  890|      0|        AT_NUMB group1 = nGroupNumber[i];
  891|      0|        AT_NUMB group2 = nGroupNewNumber[i];
  892|       |        /* add group1 to group2, then delete group1. */
  893|      0|        for (j = 0, i1 = i2 = -1; j < num_t && ( i1 < 0 || i2 < 0 ); j++)
  ------------------
  |  Branch (893:35): [True: 0, False: 0]
  |  Branch (893:50): [True: 0, False: 0]
  |  Branch (893:60): [True: 0, False: 0]
  ------------------
  894|      0|        {
  895|      0|            if (i1 < 0 && group1 == t_group[j].nGroupNumber)
  ------------------
  |  Branch (895:17): [True: 0, False: 0]
  |  Branch (895:27): [True: 0, False: 0]
  ------------------
  896|      0|            {
  897|      0|                i1 = j;
  898|      0|            }
  899|      0|            if (i2 < 0 && group2 == t_group[j].nGroupNumber)
  ------------------
  |  Branch (899:17): [True: 0, False: 0]
  |  Branch (899:27): [True: 0, False: 0]
  ------------------
  900|      0|            {
  901|      0|                i2 = j;
  902|      0|            }
  903|      0|        }
  904|      0|        if (i1 < 0 || i2 < 0)
  ------------------
  |  Branch (904:13): [True: 0, False: 0]
  |  Branch (904:23): [True: 0, False: 0]
  ------------------
  905|      0|        {
  906|      0|            ret = -1; /* program error */ /*   <BRKPT> */
  907|      0|            goto exit_function;
  908|      0|        }
  909|       |        /*  add t_group[i1] to t_group[i2] and remove t_group[i1] */
  910|      0|        for (k = 0; k < (int) ( sizeof( t_group->num ) / sizeof( t_group->num[0] ) ); k++)
  ------------------
  |  Branch (910:21): [True: 0, False: 0]
  ------------------
  911|      0|        {
  912|      0|            t_group[i2].num[k] += t_group[i1].num[k];
  913|      0|        }
  914|      0|        for (k = 0; k < (int) ( sizeof( t_group->num_DA ) / sizeof( t_group->num_DA[0] ) ); k++)
  ------------------
  |  Branch (914:21): [True: 0, False: 0]
  ------------------
  915|      0|        {
  916|      0|            t_group[i2].num_DA[k] += t_group[i1].num_DA[k];
  917|      0|        }
  918|      0|        t_group[i2].nNumEndpoints += t_group[i1].nNumEndpoints;
  919|      0|        num_t--;
  920|      0|        if (num_t > i1)
  ------------------
  |  Branch (920:13): [True: 0, False: 0]
  ------------------
  921|      0|        {
  922|      0|            memmove( t_group + i1, t_group + i1 + 1, ( num_t - i1 ) * sizeof( t_group[0] ) );
  923|      0|        }
  924|      0|    }
  925|       |
  926|      4|    if (nNumGroups)
  ------------------
  |  Branch (926:9): [True: 0, False: 4]
  ------------------
  927|      0|    {
  928|       |        /* there are groups to merge */
  929|      0|        if (nNextGroupNumber >= MAX_STACK_ARRAY_LEN)
  ------------------
  |  |  139|      0|#define MAX_STACK_ARRAY_LEN 127
  ------------------
  |  Branch (929:13): [True: 0, False: 0]
  ------------------
  930|      0|        {
  931|      0|            nNewTgNumber = (AT_NUMB *) inchi_malloc( ( nNextGroupNumber + 1 ) * sizeof( *nNewTgNumber ) );
  ------------------
  |  | 1130|      0|#define inchi_malloc   malloc
  ------------------
  932|      0|            if (!nNewTgNumber)
  ------------------
  |  Branch (932:17): [True: 0, False: 0]
  ------------------
  933|      0|            {
  934|      0|                ret = -1;
  935|      0|                goto exit_function; /* error: out of RAM */
  936|      0|            }
  937|      0|        }
  938|      0|        memset( nNewTgNumber, 0, ( nNextGroupNumber + 1 ) * sizeof( *nNewTgNumber ) );
  939|      0|        for (i = 0; i < num_t; i++)
  ------------------
  |  Branch (939:21): [True: 0, False: 0]
  ------------------
  940|      0|        {
  941|      0|            nNewTgNumber[t_group[i].nGroupNumber] = i + 1; /* new t-group numbers */
  942|      0|        }
  943|      0|        for (j = 0; j < nNumGroups; j++)
  ------------------
  |  Branch (943:21): [True: 0, False: 0]
  ------------------
  944|      0|        {
  945|      0|            if (!nNewTgNumber[nGroupNumber[j]] && nNewTgNumber[nGroupNewNumber[j]])
  ------------------
  |  Branch (945:17): [True: 0, False: 0]
  |  Branch (945:51): [True: 0, False: 0]
  ------------------
  946|      0|            {
  947|      0|                nNewTgNumber[nGroupNumber[j]] = nNewTgNumber[nGroupNewNumber[j]];
  948|      0|            }
  949|      0|            else
  950|      0|            {
  951|      0|                ret = -1; /* program error: all new numbers must have been marked */
  952|      0|                goto exit_function;
  953|      0|            }
  954|      0|        }
  955|       |        /* renumber t-groups */
  956|      0|        for (i = 0; i < num_t; i++)
  ------------------
  |  Branch (956:21): [True: 0, False: 0]
  ------------------
  957|      0|        {
  958|      0|            t_group[i].nGroupNumber = nNewTgNumber[t_group[i].nGroupNumber];
  959|      0|        }
  960|       |#if ( bRELEASE_VERSION != 1 )
  961|       |        /* Check: debug only */
  962|       |        for (i = 1; i < num_t; i++)
  963|       |        {
  964|       |            if (1 != t_group[i].nGroupNumber - t_group[i - 1].nGroupNumber)
  965|       |            {
  966|       |                ret = -1; /* debug */
  967|       |                goto exit_function;
  968|       |            }
  969|       |        }
  970|       |#endif
  971|       |        /* renumber endpoints */
  972|      0|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (972:21): [True: 0, False: 0]
  ------------------
  973|      0|        {
  974|      0|            if (group = at[i].endpoint)
  ------------------
  |  Branch (974:17): [True: 0, False: 0]
  ------------------
  975|      0|            {
  976|      0|                if (!( at[i].endpoint = nNewTgNumber[group] ) || nNextGroupNumber <= nNewTgNumber[group])
  ------------------
  |  Branch (976:21): [True: 0, False: 0]
  |  Branch (976:66): [True: 0, False: 0]
  ------------------
  977|      0|                {
  978|      0|                    ret = -1; /* program error */
  979|      0|                    goto exit_function;
  980|      0|                }
  981|      0|            }
  982|      0|        }
  983|      0|    }
  984|      4|    if (nNewTgNumber != nNewTgNumberStackArray)
  ------------------
  |  Branch (984:9): [True: 0, False: 4]
  ------------------
  985|      0|    {
  986|      0|        inchi_free( nNewTgNumber );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  987|      0|        nNewTgNumber = nNewTgNumberStackArray;
  988|      0|    }
  989|      4|    if (nGroupNumber != nGroupNumberStackArray)
  ------------------
  |  Branch (989:9): [True: 0, False: 4]
  ------------------
  990|      0|    {
  991|      0|        inchi_free( nGroupNumber );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  992|      0|        nGroupNumber = nGroupNumberStackArray;
  993|      0|    }
  994|      4|    if (nGroupNewNumber != nGroupNewNumberStackArray)
  ------------------
  |  Branch (994:9): [True: 0, False: 4]
  ------------------
  995|      0|    {
  996|      0|        inchi_free( nGroupNewNumber );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  997|      0|        nGroupNewNumber = nGroupNewNumberStackArray;
  998|      0|    }
  999|      4|    if (!t_group_info->tGroupNumber)
  ------------------
  |  Branch (999:9): [True: 0, False: 4]
  ------------------
 1000|      0|    {
 1001|      0|        t_group_info->tGroupNumber = (AT_NUMB *) inchi_malloc( 2 * max_num_t * sizeof( t_group_info->tGroupNumber[0] ) );
  ------------------
  |  | 1130|      0|#define inchi_malloc   malloc
  ------------------
 1002|      0|        if (!t_group_info->tGroupNumber)
  ------------------
  |  Branch (1002:13): [True: 0, False: 0]
  ------------------
 1003|      0|        {
 1004|      0|            ret = -1;
 1005|      0|            goto exit_function;
 1006|      0|        }
 1007|      0|    }
 1008|       |    /* fill out t-group index 2004-02-27 */
 1009|      4|    memset( t_group_info->tGroupNumber, 0, 2 * max_num_t * sizeof( t_group_info->tGroupNumber[0] ) );
 1010|      8|    for (i = 0; i < num_t; i++)
  ------------------
  |  Branch (1010:17): [True: 4, False: 4]
  ------------------
 1011|      4|    {
 1012|      4|        if (t_group[i].nNumEndpoints && t_group[i].nGroupNumber)
  ------------------
  |  Branch (1012:13): [True: 4, False: 0]
  |  Branch (1012:41): [True: 4, False: 0]
  ------------------
 1013|      4|        {
 1014|      4|            t_group_info->tGroupNumber[t_group[i].nGroupNumber] = i + 1;
 1015|      4|        }
 1016|      4|    }
 1017|       |
 1018|      4|    if (pBNS && ( pBNS->tot_st_cap == pBNS->tot_st_flow || ALWAYS_ADD_TG_ON_THE_FLY ))
  ------------------
  |  |  544|      2|#define ALWAYS_ADD_TG_ON_THE_FLY    1  /* 1 => disables radical calcellation by taut-charge movement */
  |  |  ------------------
  |  |  |  Branch (544:37): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (1018:9): [True: 4, False: 0]
  |  Branch (1018:19): [True: 2, False: 2]
  ------------------
 1019|      4|    {
 1020|      4|        T_GROUP_INFO tgi;
 1021|      4|        int ret_bns;
 1022|      4|        memset( &tgi, 0, sizeof( tgi ) );
 1023|      4|        tgi.num_t_groups = num_t;
 1024|      4|        tgi.t_group = t_group;
 1025|      4|#if ( KETO_ENOL_TAUT == 1 )
 1026|      4|        tgi.bTautFlags |= ( t_group_info->bTautFlags & TG_FLAG_KETO_ENOL_TAUT ); /* needed in AddTGroups2BnStruct() */
  ------------------
  |  |  949|      4|#define TG_FLAG_KETO_ENOL_TAUT           0x00080000   /* turn on keto-enol tautomerism detection */
  ------------------
 1027|      4|#endif
 1028|       |        /* reinitialize BN Structure */
 1029|      4|        ret_bns = ReInitBnStruct( pBNS, at, num_atoms, 0 );
 1030|      4|        if (IS_BNS_ERROR( ret_bns ))
  ------------------
  |  |   95|      4|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      4|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      4|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      4|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 4, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 4]
  |  |  ------------------
  ------------------
 1031|      0|        {
 1032|      0|            return ret_bns;
 1033|      0|        }
 1034|      4|        if (*pBNS->pbTautFlags & TG_FLAG_MOVE_POS_CHARGES)
  ------------------
  |  |  924|      4|#define TG_FLAG_MOVE_POS_CHARGES         0x00000008   /* MOVE_CHARGES allow long-range movement of N(+), P(+) charges           */
  ------------------
  |  Branch (1034:13): [True: 4, False: 0]
  ------------------
 1035|      4|        {
 1036|       |            /* set new charge groups */
 1037|      4|            ret_bns = AddCGroups2BnStruct( pCG, pBNS, at, num_atoms, cgi );
 1038|      4|            if (IS_BNS_ERROR( ret_bns ))
  ------------------
  |  |   95|      4|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      4|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      4|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      4|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 4, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 4]
  |  |  ------------------
  ------------------
 1039|      0|            {
 1040|      0|                return ret_bns;
 1041|      0|            }
 1042|      4|        }
 1043|       |        /* set new tautomeric groups */
 1044|      4|        ret_bns = AddTGroups2BnStruct( pCG, pBNS, at, num_atoms, &tgi );
 1045|      4|        if (IS_BNS_ERROR( ret_bns ))
  ------------------
  |  |   95|      4|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      4|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      4|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      4|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 4, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 4]
  |  |  ------------------
  ------------------
 1046|      0|        {
 1047|      0|            return ret_bns;
 1048|      0|        }
 1049|      4|    }
 1050|       |
 1051|      4|    *pnum_t = num_t;
 1052|      4|    return difference;
 1053|       |
 1054|      0|exit_function:
 1055|      0|    if (nNewTgNumber != nNewTgNumberStackArray)
  ------------------
  |  Branch (1055:9): [True: 0, False: 0]
  ------------------
 1056|      0|    {
 1057|      0|        inchi_free( nNewTgNumber );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1058|      0|    }
 1059|      0|    if (nGroupNumber != nGroupNumberStackArray)
  ------------------
  |  Branch (1059:9): [True: 0, False: 0]
  ------------------
 1060|      0|    {
 1061|      0|        inchi_free( nGroupNumber );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1062|      0|    }
 1063|      0|    if (nGroupNewNumber != nGroupNewNumberStackArray)
  ------------------
  |  Branch (1063:9): [True: 0, False: 0]
  ------------------
 1064|      0|    {
 1065|      0|        inchi_free( nGroupNewNumber );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1066|      0|    }
 1067|       |
 1068|      0|    return ret;
 1069|      4|}
bCanBeACPoint:
 1607|    480|{
 1608|    480|    int nChangeValence;
 1609|    480|    int nNumBonds;
 1610|    480|    int nBondsValence;
 1611|    480|    int bNegCharge = ( at->charge == -1 );  /* add fict. bonds to (-) 2004-02-24*/
 1612|       |
 1613|    480|    if (at->charge == cCharge && at->valence == at->chem_bonds_valence && at->num_H)
  ------------------
  |  Branch (1613:9): [True: 0, False: 480]
  |  Branch (1613:34): [True: 0, False: 0]
  |  Branch (1613:75): [True: 0, False: 0]
  ------------------
 1614|      0|    {
 1615|       |        /* proton donors candidates >NH(+)-, >NH2(+), -NH3(+), >OH(+), -OH2(+) */
 1616|       |        /* charged, added p-transfer -- 01-28-2004 */
 1617|      0|        nChangeValence = at->charge * cChangeValence; /* +1 or -1; currently only +1 */
 1618|      0|        nBondsValence = at->chem_bonds_valence + at->num_H;
 1619|      0|        if (nBondsValence == neutral_bonds_valence + nChangeValence && nEndpointValence)
  ------------------
  |  Branch (1619:13): [True: 0, False: 0]
  |  Branch (1619:72): [True: 0, False: 0]
  ------------------
 1620|      0|        {
 1621|      0|            *cChargeSubtype = C_SUBTYPE_CHARGED_p_DONOR; /* ignore Phosphorus p-donors for now */
  ------------------
  |  | 1586|      0|#define C_SUBTYPE_CHARGED_p_DONOR           (C_SUBTYPE_CHARGED|C_SUBTYPE_p_DONOR)
  |  |  ------------------
  |  |  |  | 1576|      0|#define C_SUBTYPE_CHARGED     0
  |  |  ------------------
  |  |               #define C_SUBTYPE_CHARGED_p_DONOR           (C_SUBTYPE_CHARGED|C_SUBTYPE_p_DONOR)
  |  |  ------------------
  |  |  |  | 1577|      0|#define C_SUBTYPE_p_DONOR     1  /* new */
  |  |  ------------------
  ------------------
 1622|      0|        }
 1623|      0|        return 0;
 1624|      0|    }
 1625|       |
 1626|    480|    else
 1627|    480|    {
 1628|    480|        if (at->charge == cCharge && at->valence < at->chem_bonds_valence)
  ------------------
  |  Branch (1628:13): [True: 0, False: 480]
  |  Branch (1628:38): [True: 0, False: 0]
  ------------------
 1629|      0|        {
 1630|       |            /* the requirement at->valence < at->chem_bonds_valence rejects
 1631|       |            candidates >NH(+)-, >NH2(+), -NH3(+), >N(+)<, >OH(+), -OH2(+), >O(+)-
 1632|       |            Moveable charge requires double bonds; these ions have no double bonds
 1633|       |            */
 1634|       |
 1635|       |            /* charged */
 1636|      0|            nChangeValence = at->charge * cChangeValence; /* +1 or -1; currently only +1 */
 1637|      0|            nBondsValence = at->chem_bonds_valence + at->num_H;
 1638|      0|            nNumBonds = at->valence + at->num_H;
 1639|      0|            if (nBondsValence == neutral_bonds_valence + nChangeValence)
  ------------------
  |  Branch (1639:17): [True: 0, False: 0]
  ------------------
 1640|      0|            {
 1641|       |                /* known valence */
 1642|      0|                if (nNumBonds == neutral_valence)
  ------------------
  |  Branch (1642:21): [True: 0, False: 0]
  ------------------
 1643|      0|                {
 1644|       |                    /* non-tautomeric: >N(+)=, =O(+)-
 1645|       |                    possibly tautomeric donor: =NH(+)-, =NH2(+), =OH(+) */
 1646|      0|                    if (at->valence == neutral_valence || !nEndpointValence)
  ------------------
  |  Branch (1646:25): [True: 0, False: 0]
  |  Branch (1646:59): [True: 0, False: 0]
  ------------------
 1647|      0|                    {
 1648|       |                        /* non-tautomeric: >N(+)=, =O(+)-; any suitable P+: >P(+)=, =PH(+)-, =PH2(+) */
 1649|      0|                        *cChargeSubtype = C_SUBTYPE_CHARGED_NON_TAUT;
  ------------------
  |  | 1585|      0|#define C_SUBTYPE_CHARGED_NON_TAUT          (C_SUBTYPE_CHARGED)
  |  |  ------------------
  |  |  |  | 1576|      0|#define C_SUBTYPE_CHARGED     0
  |  |  ------------------
  ------------------
 1650|      0|                    }
 1651|      0|                    else
 1652|      0|                    {
 1653|       |                        /* possibly tautomeric donor: =NH(+)-, =NH2(+), =OH(+) */
 1654|      0|                        *cChargeSubtype = C_SUBTYPE_CHARGED_H_DONOR;
  ------------------
  |  | 1589|      0|#define C_SUBTYPE_CHARGED_H_DONOR           (C_SUBTYPE_CHARGED|C_SUBTYPE_H_DONOR |C_SUBTYPE_p_DONOR)
  |  |  ------------------
  |  |  |  | 1576|      0|#define C_SUBTYPE_CHARGED     0
  |  |  ------------------
  |  |               #define C_SUBTYPE_CHARGED_H_DONOR           (C_SUBTYPE_CHARGED|C_SUBTYPE_H_DONOR |C_SUBTYPE_p_DONOR)
  |  |  ------------------
  |  |  |  | 1580|      0|#define C_SUBTYPE_H_DONOR     8
  |  |  ------------------
  |  |               #define C_SUBTYPE_CHARGED_H_DONOR           (C_SUBTYPE_CHARGED|C_SUBTYPE_H_DONOR |C_SUBTYPE_p_DONOR)
  |  |  ------------------
  |  |  |  | 1577|      0|#define C_SUBTYPE_p_DONOR     1  /* new */
  |  |  ------------------
  ------------------
 1655|      0|                    }
 1656|      0|                    return 1;
 1657|      0|                }
 1658|      0|                if (nNumBonds == neutral_valence - 1)
  ------------------
  |  Branch (1658:21): [True: 0, False: 0]
  ------------------
 1659|      0|                {
 1660|       |                    /* possibly tutomeric acceptor: =N(+)=, #N(+)-, #NH(+), #O(+) */
 1661|      0|                    if (nEndpointValence)
  ------------------
  |  Branch (1661:25): [True: 0, False: 0]
  ------------------
 1662|      0|                    {
 1663|      0|                        *cChargeSubtype = at->num_H ? C_SUBTYPE_CHARGED_H_ACCEPT_p_DONOR : C_SUBTYPE_CHARGED_H_ACCEPT;
  ------------------
  |  | 1588|      0|#define C_SUBTYPE_CHARGED_H_ACCEPT_p_DONOR  (C_SUBTYPE_CHARGED|C_SUBTYPE_H_ACCEPT|C_SUBTYPE_p_DONOR)
  |  |  ------------------
  |  |  |  | 1576|      0|#define C_SUBTYPE_CHARGED     0
  |  |  ------------------
  |  |               #define C_SUBTYPE_CHARGED_H_ACCEPT_p_DONOR  (C_SUBTYPE_CHARGED|C_SUBTYPE_H_ACCEPT|C_SUBTYPE_p_DONOR)
  |  |  ------------------
  |  |  |  | 1579|      0|#define C_SUBTYPE_H_ACCEPT    4
  |  |  ------------------
  |  |               #define C_SUBTYPE_CHARGED_H_ACCEPT_p_DONOR  (C_SUBTYPE_CHARGED|C_SUBTYPE_H_ACCEPT|C_SUBTYPE_p_DONOR)
  |  |  ------------------
  |  |  |  | 1577|      0|#define C_SUBTYPE_p_DONOR     1  /* new */
  |  |  ------------------
  ------------------
                                      *cChargeSubtype = at->num_H ? C_SUBTYPE_CHARGED_H_ACCEPT_p_DONOR : C_SUBTYPE_CHARGED_H_ACCEPT;
  ------------------
  |  | 1587|      0|#define C_SUBTYPE_CHARGED_H_ACCEPT          (C_SUBTYPE_CHARGED|C_SUBTYPE_H_ACCEPT)
  |  |  ------------------
  |  |  |  | 1576|      0|#define C_SUBTYPE_CHARGED     0
  |  |  ------------------
  |  |               #define C_SUBTYPE_CHARGED_H_ACCEPT          (C_SUBTYPE_CHARGED|C_SUBTYPE_H_ACCEPT)
  |  |  ------------------
  |  |  |  | 1579|      0|#define C_SUBTYPE_H_ACCEPT    4
  |  |  ------------------
  ------------------
  |  Branch (1663:43): [True: 0, False: 0]
  ------------------
 1664|      0|                    }
 1665|      0|                    else
 1666|      0|                    {
 1667|       |                        /* =P(+)=, #P(+)-, #PH(+) */
 1668|      0|                        *cChargeSubtype = C_SUBTYPE_CHARGED_NON_TAUT;
  ------------------
  |  | 1585|      0|#define C_SUBTYPE_CHARGED_NON_TAUT          (C_SUBTYPE_CHARGED)
  |  |  ------------------
  |  |  |  | 1576|      0|#define C_SUBTYPE_CHARGED     0
  |  |  ------------------
  ------------------
 1669|      0|                    }
 1670|      0|                    return 1; /* charge type, charged */
 1671|      0|                }
 1672|      0|            }
 1673|      0|        }
 1674|    480|        else
 1675|    480|        {
 1676|    480|            if (at->charge == 0 || bNegCharge)
  ------------------
  |  Branch (1676:17): [True: 478, False: 2]
  |  Branch (1676:36): [True: 2, False: 0]
  ------------------
 1677|    480|            {
 1678|       |                /* neutral atom or anion, all bonds are single */
 1679|    480|                nBondsValence = at->chem_bonds_valence + at->num_H + bNegCharge; /* add fict. bonds to (-) 2004-02-24*/
 1680|    480|                nNumBonds = at->valence + at->num_H + bNegCharge; /* add fict. bonds to (-) 2004-02-24*/
 1681|    480|                if (nBondsValence == neutral_bonds_valence)
  ------------------
  |  Branch (1681:21): [True: 2, False: 478]
  ------------------
 1682|      2|                {
 1683|      2|                    if (nNumBonds == neutral_valence)
  ------------------
  |  Branch (1683:25): [True: 2, False: 0]
  ------------------
 1684|      2|                    {
 1685|       |                        /* only single bonds: >N-, >NH, -NH2, -O-, -OH, >P- >PH -PH2 */
 1686|       |                        /*                    >N(-), -NH(-), -O(-). >P(-) -PH(-) */
 1687|      2|                        {
 1688|      2|                            if (at->valence == neutral_valence || !nEndpointValence)
  ------------------
  |  Branch (1688:33): [True: 0, False: 2]
  |  Branch (1688:67): [True: 0, False: 2]
  ------------------
 1689|      0|                            {
 1690|       |                                /* >N-, -O-, any P(3 single bonds): >P- >PH -PH2  */
 1691|      0|                                *cChargeSubtype = C_SUBTYPE_NEUTRAL_NON_TAUT;
  ------------------
  |  | 1591|      0|#define C_SUBTYPE_NEUTRAL_NON_TAUT          (C_SUBTYPE_NEUTRAL)
  |  |  ------------------
  |  |  |  | 1581|      0|#define C_SUBTYPE_NEUTRAL    16
  |  |  ------------------
  ------------------
 1692|      0|                            }
 1693|      2|                            else
 1694|      2|                            {
 1695|      2|                                if (at->valence < neutral_valence /*&& nEndpointValence */)
  ------------------
  |  Branch (1695:37): [True: 2, False: 0]
  ------------------
 1696|      2|                                {
 1697|       |                                    /* num_H > 0: >NH -NH2 -OH */
 1698|       |                                    /* num_H = 0: none C_SUBTYPE_NEUTRAL_H_ACCEPT for now */
 1699|      2|                                    *cChargeSubtype = at->num_H ? C_SUBTYPE_NEUTRAL_H_DONOR : C_SUBTYPE_NEUTRAL_H_ACCEPT;
  ------------------
  |  | 1594|      0|#define C_SUBTYPE_NEUTRAL_H_DONOR           (C_SUBTYPE_NEUTRAL|C_SUBTYPE_H_DONOR)
  |  |  ------------------
  |  |  |  | 1581|      0|#define C_SUBTYPE_NEUTRAL    16
  |  |  ------------------
  |  |               #define C_SUBTYPE_NEUTRAL_H_DONOR           (C_SUBTYPE_NEUTRAL|C_SUBTYPE_H_DONOR)
  |  |  ------------------
  |  |  |  | 1580|      0|#define C_SUBTYPE_H_DONOR     8
  |  |  ------------------
  ------------------
                                                  *cChargeSubtype = at->num_H ? C_SUBTYPE_NEUTRAL_H_DONOR : C_SUBTYPE_NEUTRAL_H_ACCEPT;
  ------------------
  |  | 1592|      4|#define C_SUBTYPE_NEUTRAL_H_ACCEPT          (C_SUBTYPE_NEUTRAL|C_SUBTYPE_H_ACCEPT)
  |  |  ------------------
  |  |  |  | 1581|      2|#define C_SUBTYPE_NEUTRAL    16
  |  |  ------------------
  |  |               #define C_SUBTYPE_NEUTRAL_H_ACCEPT          (C_SUBTYPE_NEUTRAL|C_SUBTYPE_H_ACCEPT)
  |  |  ------------------
  |  |  |  | 1579|      2|#define C_SUBTYPE_H_ACCEPT    4
  |  |  ------------------
  ------------------
  |  Branch (1699:55): [True: 0, False: 2]
  ------------------
 1700|      2|                                }
 1701|      0|                                else
 1702|      0|                                {
 1703|      0|                                    return 0;
 1704|      0|                                }
 1705|      2|                            }
 1706|      2|                        }
 1707|      2|                        return 1; /* charge type, neutral */
 1708|      2|                    }
 1709|      0|                    if (nNumBonds == neutral_valence - 1)
  ------------------
  |  Branch (1709:25): [True: 0, False: 0]
  ------------------
 1710|      0|                    {
 1711|       |                        /* possibly tautomeric acceptor =N-, =NH, =O or non-taut =P-, =PH */
 1712|      0|                        if (nEndpointValence)
  ------------------
  |  Branch (1712:29): [True: 0, False: 0]
  ------------------
 1713|      0|                        {
 1714|       |                            /* =N-,  =NH, =O  */
 1715|      0|                            *cChargeSubtype = C_SUBTYPE_NEUTRAL_H_ACCEPT_p_ACCEPT;
  ------------------
  |  | 1593|      0|#define C_SUBTYPE_NEUTRAL_H_ACCEPT_p_ACCEPT (C_SUBTYPE_NEUTRAL|C_SUBTYPE_H_ACCEPT|C_SUBTYPE_p_ACCEPT)
  |  |  ------------------
  |  |  |  | 1581|      0|#define C_SUBTYPE_NEUTRAL    16
  |  |  ------------------
  |  |               #define C_SUBTYPE_NEUTRAL_H_ACCEPT_p_ACCEPT (C_SUBTYPE_NEUTRAL|C_SUBTYPE_H_ACCEPT|C_SUBTYPE_p_ACCEPT)
  |  |  ------------------
  |  |  |  | 1579|      0|#define C_SUBTYPE_H_ACCEPT    4
  |  |  ------------------
  |  |               #define C_SUBTYPE_NEUTRAL_H_ACCEPT_p_ACCEPT (C_SUBTYPE_NEUTRAL|C_SUBTYPE_H_ACCEPT|C_SUBTYPE_p_ACCEPT)
  |  |  ------------------
  |  |  |  | 1578|      0|#define C_SUBTYPE_p_ACCEPT    2  /* new */
  |  |  ------------------
  ------------------
 1716|      0|                        }
 1717|      0|                        else
 1718|      0|                        {
 1719|       |                            /* =P-, =PH */
 1720|      0|                            *cChargeSubtype = C_SUBTYPE_NEUTRAL_NON_TAUT;
  ------------------
  |  | 1591|      0|#define C_SUBTYPE_NEUTRAL_NON_TAUT          (C_SUBTYPE_NEUTRAL)
  |  |  ------------------
  |  |  |  | 1581|      0|#define C_SUBTYPE_NEUTRAL    16
  |  |  ------------------
  ------------------
 1721|      0|                        }
 1722|      0|                        return 1; /* charge type, (+) => neutral */
 1723|      0|                    }
 1724|      0|                }
 1725|    480|            }
 1726|    480|        }
 1727|    480|    }
 1728|       |
 1729|    478|    return 0;
 1730|    480|}
GetChargeType:
 1735|  3.68k|{
 1736|  3.68k|    int i, n;
 1737|  3.68k|    S_CHAR    nEndpointValence;
 1738|  3.68k|    inp_ATOM *at = atom + iat;
 1739|       |
 1740|  3.68k|    *cChargeSubtype = 0;
 1741|       |    /* ignore ion pairs and charges != 1 */
 1742|  3.68k|    if (abs( at->charge ) == 1)
  ------------------
  |  Branch (1742:9): [True: 22, False: 3.66k]
  ------------------
 1743|     22|    {
 1744|     56|        for (i = 0; i < at->valence; i++)
  ------------------
  |  Branch (1744:21): [True: 34, False: 22]
  ------------------
 1745|     34|        {
 1746|     34|            n = at->neighbor[i];
 1747|       |            /* allow negatively charged tautomeric neighbors 2004-02-26 */
 1748|     34|            if (abs( atom[n].charge + at->charge ) < abs( atom[n].charge - at->charge ) && !atom[n].endpoint)
  ------------------
  |  Branch (1748:17): [True: 0, False: 34]
  |  Branch (1748:92): [True: 0, False: 0]
  ------------------
 1749|      0|            {
 1750|      0|                return -1; /* charges have different signs */
 1751|      0|            }
 1752|     34|        }
 1753|     22|    }
 1754|  3.66k|    else
 1755|  3.66k|    {
 1756|  3.66k|        if (at->charge)
  ------------------
  |  Branch (1756:13): [True: 8, False: 3.65k]
  ------------------
 1757|      8|        {
 1758|      8|            return -1; /* abs(charge) != 1 */
 1759|      8|        }
 1760|  3.66k|    }
 1761|       |
 1762|       |    /* find candidates */
 1763|  25.7k|    for (i = 0; i < NUM_C_TYPES; i++)
  ------------------
  |  | 1596|  25.7k|#define NUM_C_TYPES  (int)(sizeof( CType )/sizeof(CType[0]))
  ------------------
  |  Branch (1763:17): [True: 22.0k, False: 3.67k]
  ------------------
 1764|  22.0k|    {
 1765|  22.0k|        if (!strcmp( at->elname, CType[i].elname ) &&
  ------------------
  |  Branch (1765:13): [True: 699, False: 21.3k]
  ------------------
 1766|  22.0k|            ( !CType[i].num_bonds || CType[i].num_bonds == at->valence && at->nNumAtInRingSystem >= 5 ))
  ------------------
  |  Branch (1766:15): [True: 480, False: 219]
  |  Branch (1766:38): [True: 6, False: 213]
  |  Branch (1766:75): [True: 0, False: 6]
  ------------------
 1767|    480|        {
 1768|    480|            nEndpointValence = (S_CHAR) get_endpoint_valence( at->el_number );
 1769|    480|            if (bCanBeACPoint( at, CType[i].charge, CType[i].cChangeValence, CType[i].neutral_bonds_valence,
  ------------------
  |  Branch (1769:17): [True: 2, False: 478]
  ------------------
 1770|    480|                               CType[i].neutral_valence, nEndpointValence, cChargeSubtype ))
 1771|      2|            {
 1772|      2|                return CType[i].cChargeType;
 1773|      2|            }
 1774|    480|        }
 1775|  22.0k|    }
 1776|       |
 1777|  3.67k|    return -1;
 1778|  3.67k|}
MarkChargeGroups:
 1957|   110k|{
 1958|   110k|    int nNumChanges = 0;
 1959|       |
 1960|   110k|    if (c_group_info && c_group_info->c_candidate && c_group_info->max_num_candidates > 0)
  ------------------
  |  Branch (1960:9): [True: 110k, False: 0]
  |  Branch (1960:25): [True: 806, False: 109k]
  |  Branch (1960:54): [True: 806, False: 0]
  ------------------
 1961|    806|    {
 1962|    806|        int i, i1, i2, i3, j, num_tested;
 1963|    806|        C_CANDIDATE *c_candidate = c_group_info->c_candidate;
 1964|    806|        int          nMaxNumCandidates = c_group_info->max_num_candidates;
 1965|    806|        int          nNumCandidates = c_group_info->num_candidates;
 1966|    806|        S_CHAR       c_type, c_subtype;
 1967|    806|        int          iat1, iat2, ret, nDelta;
 1968|       |
 1969|    806|        if (nNumCandidates == -1)
  ------------------
  |  Branch (1969:13): [True: 0, False: 806]
  ------------------
 1970|      0|        {
 1971|      0|            nNumCandidates = 0; /* 2004-02-26 they could appear after t-group discovery */
 1972|       |                                /*return 0;*/
 1973|      0|        }
 1974|    806|        if (nNumCandidates == 0)
  ------------------
  |  Branch (1974:13): [True: 806, False: 0]
  ------------------
 1975|    806|        {
 1976|  4.49k|            for (i = 0, nNumCandidates = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1976:45): [True: 3.68k, False: 806]
  ------------------
 1977|  3.68k|            {
 1978|  3.68k|                if (0 <= ( c_type = GetChargeType( at, i, &c_subtype ) ))
  ------------------
  |  Branch (1978:21): [True: 2, False: 3.68k]
  ------------------
 1979|      2|                {
 1980|      2|                    if (nNumCandidates >= nMaxNumCandidates)
  ------------------
  |  Branch (1980:25): [True: 0, False: 2]
  ------------------
 1981|      0|                    {
 1982|      0|                        return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   82|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 1983|      0|                    }
 1984|      2|                    c_candidate[nNumCandidates].atnumber = i;
 1985|      2|                    c_candidate[nNumCandidates].type = c_type;
 1986|      2|                    c_candidate[nNumCandidates].subtype = c_subtype;
 1987|      2|                    nNumCandidates++;
 1988|      2|                }
 1989|  3.68k|            }
 1990|    806|            if (nNumCandidates <= 1)
  ------------------
  |  Branch (1990:17): [True: 806, False: 0]
  ------------------
 1991|    806|            {
 1992|    806|                c_group_info->num_candidates = -1; /* no candidate exists */
 1993|    806|                return 0;
 1994|    806|            }
 1995|    806|        }
 1996|       |        /* sorting keys: (1) atom type (N,P); (2) uncharged=16/charged=0; (3) other;
 1997|       |        atom-charged-N .... i1
 1998|       |        ...
 1999|       |        atom-charged-N
 2000|       |        atom-neutral-N .... i2
 2001|       |        ...
 2002|       |        atom-neutral-N
 2003|       |        atom-charged-P .... i3 ... i1
 2004|       |        ...
 2005|       |        atom-charged-P
 2006|       |        atom-neutral-P ........... i2
 2007|       |        ...
 2008|       |        atom-neutral-P
 2009|       |        end.           ........... i3
 2010|       |        */
 2011|       |
 2012|      0|        qsort( c_candidate, nNumCandidates, sizeof( c_candidate[0] ), CmpCCandidates );
 2013|       |
 2014|      0|        i1 = 0;
 2015|      0|        num_tested = 0;
 2016|      0|        nDelta = 0;
 2017|       |
 2018|      0|        while (i1 < nNumCandidates)
  ------------------
  |  Branch (2018:16): [True: 0, False: 0]
  ------------------
 2019|      0|        {
 2020|       |            /* the the first charged candidate of a new atom type */
 2021|      0|            for (; i1 < nNumCandidates && ( c_candidate[i1].subtype & C_SUBTYPE_NEUTRAL ); i1++)
  ------------------
  |  | 1581|      0|#define C_SUBTYPE_NEUTRAL    16
  ------------------
  |  Branch (2021:20): [True: 0, False: 0]
  |  Branch (2021:43): [True: 0, False: 0]
  ------------------
 2022|      0|            {
 2023|      0|                ;
 2024|      0|            }
 2025|      0|            if (i1 == nNumCandidates)
  ------------------
  |  Branch (2025:17): [True: 0, False: 0]
  ------------------
 2026|      0|            {
 2027|      0|                break; /* not found */
 2028|      0|            }
 2029|       |
 2030|       |            /* bypass other charged candidates of the same atom type */
 2031|      0|            for (i2 = i1 + 1; i2 < nNumCandidates &&
  ------------------
  |  Branch (2031:31): [True: 0, False: 0]
  ------------------
 2032|      0|                  c_candidate[i2].type == c_candidate[i1].type &&
  ------------------
  |  Branch (2032:19): [True: 0, False: 0]
  ------------------
 2033|      0|                  !( c_candidate[i2].subtype & C_SUBTYPE_NEUTRAL );
  ------------------
  |  | 1581|      0|#define C_SUBTYPE_NEUTRAL    16
  ------------------
  |  Branch (2033:19): [True: 0, False: 0]
  ------------------
 2034|      0|                  i2++)
 2035|      0|            {
 2036|      0|                ;
 2037|      0|            }
 2038|      0|            if (i2 == nNumCandidates)
  ------------------
  |  Branch (2038:17): [True: 0, False: 0]
  ------------------
 2039|      0|            {
 2040|      0|                break; /* no neutral candidates */
 2041|      0|            }
 2042|       |
 2043|       |            /* find next to the last neutral candidate of the same atom type */
 2044|      0|            for (i3 = i2;  i3 < nNumCandidates &&
  ------------------
  |  Branch (2044:28): [True: 0, False: 0]
  ------------------
 2045|      0|                  c_candidate[i3].type == c_candidate[i1].type;
  ------------------
  |  Branch (2045:19): [True: 0, False: 0]
  ------------------
 2046|      0|                  i3++)
 2047|      0|            {
 2048|      0|                ;
 2049|      0|            }
 2050|       |
 2051|      0|            if (i3 == i2)
  ------------------
  |  Branch (2051:17): [True: 0, False: 0]
  ------------------
 2052|      0|            {
 2053|       |                /* no neutral candidates found */
 2054|      0|                if (i2 < nNumCandidates)
  ------------------
  |  Branch (2054:21): [True: 0, False: 0]
  ------------------
 2055|      0|                {
 2056|      0|                    i1 = i3;
 2057|      0|                    continue;  /* move to the next atom type */
 2058|      0|                }
 2059|      0|                break; /* nothing more to do */
 2060|      0|            }
 2061|       |
 2062|       |            /* found charged candidates: i1...i2-1;  neutral candidates: i2...i3-1 */
 2063|      0|            for (i = i1; i < i2; i++)
  ------------------
  |  Branch (2063:26): [True: 0, False: 0]
  ------------------
 2064|      0|            {
 2065|      0|                iat1 = c_candidate[i].atnumber;
 2066|      0|                for (j = i2; j < i3; j++)
  ------------------
  |  Branch (2066:30): [True: 0, False: 0]
  ------------------
 2067|      0|                {
 2068|       |                    /* check alt path at[iat1]=-=-...-at[iat2]; at[iat1] is charged, at[iat2] is neutral */
 2069|      0|                    num_tested++;
 2070|      0|                    iat2 = c_candidate[j].atnumber;
 2071|      0|                    if (at[iat1].c_point && at[iat1].c_point == at[iat2].c_point)
  ------------------
  |  Branch (2071:25): [True: 0, False: 0]
  |  Branch (2071:45): [True: 0, False: 0]
  ------------------
 2072|      0|                    {
 2073|      0|                        continue;
 2074|      0|                    }
 2075|       |
 2076|      0|                    ret = bExistsAltPath( pCG, pBNS, pBD, NULL, at, num_atoms, iat1, iat2, ALT_PATH_MODE_CHARGE );
  ------------------
  |  |  339|      0|#define ALT_PATH_MODE_CHARGE     2
  ------------------
 2077|       |
 2078|      0|                    if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2079|      0|                    {
 2080|      0|                        return ret;
 2081|      0|                    }
 2082|      0|                    if (ret & 1)
  ------------------
  |  Branch (2082:25): [True: 0, False: 0]
  ------------------
 2083|      0|                    {
 2084|      0|                        nDelta = ( ret & ~3 ) >> 2;
 2085|      0|                        nNumChanges += ( ret & 2 );
 2086|       |
 2087|      0|                        ret = RegisterCPoints( c_group_info->c_group, &c_group_info->num_c_groups,
 2088|      0|                                               c_group_info->max_num_c_groups, t_group_info,
 2089|      0|                                               iat1, iat2, c_candidate[i1].type, at, num_atoms );
 2090|       |
 2091|      0|                        if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2092|      0|                        {
 2093|      0|                            return ret;
 2094|      0|                        }
 2095|      0|                        if (nDelta)
  ------------------
  |  Branch (2095:29): [True: 0, False: 0]
  ------------------
 2096|      0|                        {
 2097|      0|                            goto quick_exit;
 2098|      0|                        }
 2099|      0|                    }
 2100|      0|                }
 2101|      0|            }
 2102|      0|            i1 = i3;
 2103|      0|        }
 2104|       |
 2105|      0|    quick_exit:
 2106|      0|        if (c_group_info->num_candidates == 0)
  ------------------
  |  Branch (2106:13): [True: 0, False: 0]
  ------------------
 2107|      0|        {
 2108|       |            /* first time: initialize */
 2109|      0|            c_group_info->num_candidates = num_tested ? nNumCandidates : -1; /* no candidate exists */
  ------------------
  |  Branch (2109:44): [True: 0, False: 0]
  ------------------
 2110|      0|        }
 2111|      0|    }
 2112|       |
 2113|   109k|    return nNumChanges;
 2114|   110k|}
GetSaltChargeType:
 2122|   338k|{
 2123|       |    /*
 2124|       |    type (returned value):
 2125|       |    -1 => ignore
 2126|       |    0 => oxygen
 2127|       |    subtype:
 2128|       |    1 = SALT_DONOR_H   => has H
 2129|       |    2 = SALT_DONOR_Neg => has (-) charge
 2130|       |    4 = SALT_ACCEPTOR  => may be an acceptor of H or (-), but not necessarily
 2131|       |
 2132|       |    O-atom should be:
 2133|       |    - a terminal atom
 2134|       |    - connected to unsaturated, uncharged, non-radical atom C that has chemical valence 4:
 2135|       |    H-donors:             =CH-OH, =C(-X)-OH
 2136|       |    possible H-acceptors: -CH=O, >C=O
 2137|       |    H-acceptors are true if O is tautomeric
 2138|       |    */
 2139|       |
 2140|   338k|    int iC, tg, i, type;
 2141|       |
 2142|   338k|    *s_subtype = 0; /* initialize the output */
 2143|       |                    /* check whether it is a candidate */
 2144|   338k|    if (at[at_no].valence != 1 ||
  ------------------
  |  Branch (2144:9): [True: 338k, False: 36]
  ------------------
 2145|   338k|         at[at_no].radical && at[at_no].radical != RADICAL_SINGLET ||
  ------------------
  |  |  103|   338k|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (2145:10): [True: 6, False: 30]
  |  Branch (2145:31): [True: 6, False: 0]
  ------------------
 2146|   338k|         at[at_no].charge < -1 ||
  ------------------
  |  Branch (2146:10): [True: 0, False: 30]
  ------------------
 2147|   338k|         at[at_no].charge > 0 && !at[at_no].c_point)
  ------------------
  |  Branch (2147:10): [True: 0, False: 30]
  |  Branch (2147:34): [True: 0, False: 0]
  ------------------
 2148|   338k|    {
 2149|   338k|        return -1;
 2150|   338k|    }
 2151|       |
 2152|     30|    if (at[at_no].el_number == EL_NUMBER_O ||
  ------------------
  |  |   45|     60|#define EL_NUMBER_O ((U_CHAR) 8)
  ------------------
  |  Branch (2152:9): [True: 12, False: 18]
  ------------------
 2153|     30|         at[at_no].el_number == EL_NUMBER_S ||
  ------------------
  |  |   49|     48|#define EL_NUMBER_S ((U_CHAR) 16)
  ------------------
  |  Branch (2153:10): [True: 18, False: 0]
  ------------------
 2154|     30|         at[at_no].el_number == EL_NUMBER_SE ||
  ------------------
  |  |   52|     30|#define EL_NUMBER_SE ((U_CHAR) 34)
  ------------------
  |  Branch (2154:10): [True: 0, False: 0]
  ------------------
 2155|     30|         at[at_no].el_number == EL_NUMBER_TE)
  ------------------
  |  |   54|      0|#define EL_NUMBER_TE ((U_CHAR) 52)
  ------------------
  |  Branch (2155:10): [True: 0, False: 0]
  ------------------
 2156|     30|    {
 2157|     30|        type = 0;  /* terminal oxygen atom, needs more to be checked... */
 2158|     30|    }
 2159|      0|    else
 2160|      0|    {
 2161|      0|        type = -1; /* ignore this atom */
 2162|      0|    }
 2163|       |
 2164|     30|    if (type < 0 ||
  ------------------
  |  Branch (2164:9): [True: 0, False: 30]
  ------------------
 2165|     30|         at[at_no].chem_bonds_valence + at[at_no].num_H !=
  ------------------
  |  Branch (2165:10): [True: 0, False: 30]
  ------------------
 2166|     30|         get_el_valence( at[at_no].el_number, at[at_no].charge, 0 ))
 2167|      0|    {
 2168|      0|        return -1; /* non-standard valence or not an oxygen */
 2169|      0|    }
 2170|       |
 2171|     30|    iC = at[at_no].neighbor[0];
 2172|       |
 2173|     30|#if ( SALT_WITH_PROTONS == 1 )
 2174|     30|    if (at[iC].el_number != EL_NUMBER_C ||
  ------------------
  |  |   43|     60|#define EL_NUMBER_C ((U_CHAR) 6)
  ------------------
  |  Branch (2174:9): [True: 12, False: 18]
  ------------------
 2175|     30|         at[iC].chem_bonds_valence + at[iC].num_H != 4 || /* allow =C(H)-OH or -C(H)=O */
  ------------------
  |  Branch (2175:10): [True: 18, False: 0]
  ------------------
 2176|     30|         at[iC].charge ||
  ------------------
  |  Branch (2176:10): [True: 0, False: 0]
  ------------------
 2177|     30|         at[iC].radical && at[iC].radical != RADICAL_SINGLET ||
  ------------------
  |  |  103|     30|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (2177:10): [True: 0, False: 0]
  |  Branch (2177:28): [True: 0, False: 0]
  ------------------
 2178|     30|         at[iC].valence == at[iC].chem_bonds_valence)
  ------------------
  |  Branch (2178:10): [True: 0, False: 0]
  ------------------
 2179|     30|    {
 2180|     30|        return -1; /* oxigen is connected to a wrong atom */
 2181|     30|    }
 2182|       |#else
 2183|       |    if (at[iC].el_number != EL_NUMBER_C ||
 2184|       |         at[iC].num_H ||
 2185|       |         at[iC].chem_bonds_valence != 4 ||  /* allow only no H on C */
 2186|       |         at[iC].charge ||
 2187|       |         at[iC].radical && at[iC].radical != RADICAL_SINGLET ||
 2188|       |         at[iC].valence == at[iC].chem_bonds_valence)
 2189|       |    {
 2190|       |        return -1; /* oxigen is connected to a wrong atom */
 2191|       |    }
 2192|       |#endif
 2193|      0|    if (( tg = at[at_no].endpoint ) && t_group_info && t_group_info->t_group)
  ------------------
  |  Branch (2193:9): [True: 0, False: 0]
  |  Branch (2193:40): [True: 0, False: 0]
  |  Branch (2193:56): [True: 0, False: 0]
  ------------------
 2194|      0|    {
 2195|       |        /* O-atom is in a tautomeric group */
 2196|      0|        for (i = 0; i < t_group_info->num_t_groups; i++)
  ------------------
  |  Branch (2196:21): [True: 0, False: 0]
  ------------------
 2197|      0|        {
 2198|      0|            if (tg == t_group_info->t_group[i].nGroupNumber)
  ------------------
  |  Branch (2198:17): [True: 0, False: 0]
  ------------------
 2199|      0|            {
 2200|       |                /*
 2201|       |                t_group_info->t_group[i].num[0] = number of attached H-atoms and negative charges
 2202|       |                t_group_info->t_group[i].num[1] = number of attached negative charges
 2203|       |                */
 2204|      0|                if (t_group_info->t_group[i].num[0] > t_group_info->t_group[i].num[1])
  ------------------
  |  Branch (2204:21): [True: 0, False: 0]
  ------------------
 2205|      0|                {
 2206|      0|                    *s_subtype |= SALT_DONOR_H; /* has H */
  ------------------
  |  |   90|      0|#define SALT_DONOR_H      1
  ------------------
 2207|      0|                }
 2208|      0|                if (t_group_info->t_group[i].num[1])
  ------------------
  |  Branch (2208:21): [True: 0, False: 0]
  ------------------
 2209|      0|                {
 2210|      0|                    *s_subtype |= SALT_DONOR_Neg; /* has (-) */
  ------------------
  |  |   91|      0|#define SALT_DONOR_Neg    2
  ------------------
 2211|      0|                }
 2212|      0|                *s_subtype |= SALT_ACCEPTOR; /* there is always an acceptor in a t-group */
  ------------------
  |  |   92|      0|#define SALT_ACCEPTOR     4
  ------------------
 2213|      0|                return type;
 2214|      0|            }
 2215|      0|        }
 2216|      0|        return -1; /* error: t-group not found */
 2217|      0|    }
 2218|       |
 2219|       |    /* O is not not in a tautomeric group */
 2220|       |    /* assume valence(O-) < valence(O) < valence(O+) */
 2221|      0|    if (at[at_no].charge == -1)
  ------------------
  |  Branch (2221:9): [True: 0, False: 0]
  ------------------
 2222|      0|    {
 2223|      0|        *s_subtype |= SALT_DONOR_Neg; /* has (-) */
  ------------------
  |  |   91|      0|#define SALT_DONOR_Neg    2
  ------------------
 2224|      0|    }
 2225|      0|    if (at[at_no].charge <= 0 && at[at_no].num_H)
  ------------------
  |  Branch (2225:9): [True: 0, False: 0]
  |  Branch (2225:34): [True: 0, False: 0]
  ------------------
 2226|      0|    {
 2227|      0|        *s_subtype |= SALT_DONOR_H; /* has H */
  ------------------
  |  |   90|      0|#define SALT_DONOR_H      1
  ------------------
 2228|      0|    }
 2229|      0|    if (at[at_no].charge == 0 && at[at_no].chem_bonds_valence == 2)
  ------------------
  |  Branch (2229:9): [True: 0, False: 0]
  |  Branch (2229:34): [True: 0, False: 0]
  ------------------
 2230|      0|    {
 2231|      0|        *s_subtype |= SALT_ACCEPTOR;
  ------------------
  |  |   92|      0|#define SALT_ACCEPTOR     4
  ------------------
 2232|      0|    }
 2233|       |    /* since O cannot be a charge point, the following cannot happen: */
 2234|      0|    if (at[at_no].charge == 1 && at[at_no].c_point && at[at_no].chem_bonds_valence == 2 && at[at_no].num_H)
  ------------------
  |  Branch (2234:9): [True: 0, False: 0]
  |  Branch (2234:34): [True: 0, False: 0]
  |  Branch (2234:55): [True: 0, False: 0]
  |  Branch (2234:92): [True: 0, False: 0]
  ------------------
 2235|      0|    {
 2236|      0|        *s_subtype |= SALT_DONOR_H; /* has H */
  ------------------
  |  |   90|      0|#define SALT_DONOR_H      1
  ------------------
 2237|      0|    }
 2238|       |
 2239|      0|    return type;
 2240|      0|}
bDoNotMergeNonTautAtom:
 2245|     12|{
 2246|     12|    if (at[at_no].el_number == EL_NUMBER_N)
  ------------------
  |  |   44|     12|#define EL_NUMBER_N ((U_CHAR) 7)
  ------------------
  |  Branch (2246:9): [True: 2, False: 10]
  ------------------
 2247|      2|    {
 2248|      2|        return 1;
 2249|      2|    }
 2250|     10|    return 0;
 2251|     12|}
GetOtherSaltChargeType:
 2260|   338k|{
 2261|       |    /*
 2262|       |    type (returned value):
 2263|       |    -1 => ignore
 2264|       |    1 => not an oxygen
 2265|       |    subtype:
 2266|       |    1 = SALT_DONOR_H   => has H
 2267|       |    2 = SALT_DONOR_Neg => has (-) charge
 2268|       |    4 = SALT_ACCEPTOR  => may be an acceptor of H or (-), but not necessarily
 2269|       |
 2270|       |    the atom should be:
 2271|       |    - a tautomeric endpoint atom
 2272|       |    - connected to possible centerpoint atom
 2273|       |
 2274|       |    another description of the atom searched here:
 2275|       |
 2276|       |    any possibly tautomeric atom adjacent to a possibly centerpoint
 2277|       |    that has at least one double bond (possibly if positively charged);
 2278|       |    if eif.cAcceptor then the bond between the atom and the centerpoint must be possibly double
 2279|       |    if eif.cAcceptor then the bond must be possibly single
 2280|       |    Donors that belong to a t-group are also acceptors
 2281|       |    */
 2282|       |
 2283|   338k|    int tg, i, j, type, endpoint_valence, num_centerpoints, bond_type, centerpoint;
 2284|   338k|    ENDPOINT_INFO eif;
 2285|       |
 2286|   338k|    *s_subtype = 0; /* initialize the output */
 2287|   338k|    if (!bAccept_O /* only N */ &&
  ------------------
  |  Branch (2287:9): [True: 0, False: 338k]
  ------------------
 2288|   338k|        ( at[at_no].el_number == EL_NUMBER_O ||
  ------------------
  |  |   45|      0|#define EL_NUMBER_O ((U_CHAR) 8)
  ------------------
  |  Branch (2288:11): [True: 0, False: 0]
  ------------------
 2289|      0|          at[at_no].el_number == EL_NUMBER_S ||
  ------------------
  |  |   49|      0|#define EL_NUMBER_S ((U_CHAR) 16)
  ------------------
  |  Branch (2289:11): [True: 0, False: 0]
  ------------------
 2290|      0|          at[at_no].el_number == EL_NUMBER_SE ||
  ------------------
  |  |   52|      0|#define EL_NUMBER_SE ((U_CHAR) 34)
  ------------------
  |  Branch (2290:11): [True: 0, False: 0]
  ------------------
 2291|      0|          at[at_no].el_number == EL_NUMBER_TE ))
  ------------------
  |  |   54|      0|#define EL_NUMBER_TE ((U_CHAR) 52)
  ------------------
  |  Branch (2291:11): [True: 0, False: 0]
  ------------------
 2292|      0|    {
 2293|      0|        return -1; /* we are not looking for oxygen here */
 2294|      0|    }
 2295|       |
 2296|   338k|    type = 1;
 2297|   338k|    if (!( endpoint_valence = nGetEndpointInfo( at, at_no, &eif ) ))
  ------------------
  |  Branch (2297:9): [True: 338k, False: 36]
  ------------------
 2298|   338k|    {
 2299|   338k|        return -1; /* not a possible endpoint */
 2300|   338k|    }
 2301|     36|    else
 2302|     36|    {
 2303|       |        /* at[at_no] is not not in a tautomeric group; use eif previously filled out by nGetEndpointInfo */
 2304|       |        /* check whether there is adjacent atom-candidate for a centerpoint */
 2305|     36|        num_centerpoints = 0;
 2306|     54|        for (j = 0; j < at[at_no].valence; j++)
  ------------------
  |  Branch (2306:21): [True: 42, False: 12]
  ------------------
 2307|     42|        {
 2308|     42|            bond_type = (int) at[at_no].bond_type[j] & BOND_TYPE_MASK;
  ------------------
  |  |  217|     42|#define BOND_TYPE_MASK        0x0f
  ------------------
 2309|     42|            centerpoint = (int) at[at_no].neighbor[j];  /*  a centerpoint candidate */
 2310|     42|            if (( eif.cAcceptor && ( bond_type == BOND_DOUBLE ||
  ------------------
  |  |  206|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (2310:19): [True: 0, False: 42]
  |  Branch (2310:38): [True: 0, False: 0]
  ------------------
 2311|      0|                                     bond_type == BOND_ALTERN || /* possibly double */
  ------------------
  |  |  208|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   63|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (2311:38): [True: 0, False: 0]
  ------------------
 2312|      0|                                     bond_type == BOND_ALT12NS ||
  ------------------
  |  |  214|      0|#define BOND_ALT12NS             9
  ------------------
  |  Branch (2312:38): [True: 0, False: 0]
  ------------------
 2313|      0|                                     bond_type == BOND_TAUTOM ) ||
  ------------------
  |  |  213|      0|#define BOND_TAUTOM              8
  ------------------
  |  Branch (2313:38): [True: 0, False: 0]
  ------------------
 2314|     42|                  eif.cDonor && ( bond_type == BOND_SINGLE ||
  ------------------
  |  |  205|     42|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   60|     84|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (2314:19): [True: 42, False: 0]
  |  Branch (2314:35): [True: 42, False: 0]
  ------------------
 2315|     42|                                  bond_type == BOND_ALTERN || /* possibly single */
  ------------------
  |  |  208|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   63|     42|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (2315:35): [True: 0, False: 0]
  ------------------
 2316|     42|                                  bond_type == BOND_ALT12NS ||
  ------------------
  |  |  214|     42|#define BOND_ALT12NS             9
  ------------------
  |  Branch (2316:35): [True: 0, False: 0]
  ------------------
 2317|     42|                                  bond_type == BOND_TAUTOM ) ) &&
  ------------------
  |  |  213|      0|#define BOND_TAUTOM              8
  ------------------
  |  Branch (2317:35): [True: 0, False: 0]
  ------------------
 2318|     42|                                  ( at[centerpoint].chem_bonds_valence > at[centerpoint].valence ||
  ------------------
  |  Branch (2318:37): [True: 24, False: 18]
  ------------------
 2319|       |                                    /* check for possible endpoint added 2004-02-24 */
 2320|     42|                                    at[centerpoint].chem_bonds_valence == at[centerpoint].valence &&
  ------------------
  |  Branch (2320:37): [True: 18, False: 0]
  ------------------
 2321|     18|                                    ( at[centerpoint].endpoint || at[centerpoint].c_point ) /* tautomerism or charge may increment at[centerpoint].chem_bonds_valence*/ ) &&
  ------------------
  |  Branch (2321:39): [True: 0, False: 18]
  |  Branch (2321:67): [True: 0, False: 18]
  ------------------
 2322|     42|                 is_centerpoint_elem( at[centerpoint].el_number ))
  ------------------
  |  Branch (2322:18): [True: 24, False: 0]
  ------------------
 2323|     24|            {
 2324|     24|                num_centerpoints++;
 2325|     24|                break; /* at least one possibly centerpoint neighbor has been found */
 2326|     24|            }
 2327|     42|        }
 2328|     36|        if (!num_centerpoints)
  ------------------
  |  Branch (2328:13): [True: 12, False: 24]
  ------------------
 2329|     12|        {
 2330|     12|            return -1;
 2331|     12|        }
 2332|       |        /* moved here from just after "type = 1;" line 2004-02-26 */
 2333|     24|        if (( tg = at[at_no].endpoint ) && t_group_info && t_group_info->t_group)
  ------------------
  |  Branch (2333:13): [True: 0, False: 24]
  |  Branch (2333:44): [True: 0, False: 0]
  |  Branch (2333:60): [True: 0, False: 0]
  ------------------
 2334|      0|        {
 2335|       |            /* atom is in a tautomeric group */
 2336|      0|            for (i = 0; i < t_group_info->num_t_groups; i++)
  ------------------
  |  Branch (2336:25): [True: 0, False: 0]
  ------------------
 2337|      0|            {
 2338|      0|                if (tg == t_group_info->t_group[i].nGroupNumber)
  ------------------
  |  Branch (2338:21): [True: 0, False: 0]
  ------------------
 2339|      0|                {
 2340|       |                    /*
 2341|       |                    t_group_info->t_group[i].num[0] = number of attached H-atoms and negative charges
 2342|       |                    t_group_info->t_group[i].num[1] = number of attached negative charges
 2343|       |                    */
 2344|      0|                    if (t_group_info->t_group[i].num[0] > t_group_info->t_group[i].num[1])
  ------------------
  |  Branch (2344:25): [True: 0, False: 0]
  ------------------
 2345|      0|                    {
 2346|      0|                        *s_subtype |= SALT_DONOR_H; /* has H */
  ------------------
  |  |   90|      0|#define SALT_DONOR_H      1
  ------------------
 2347|      0|                    }
 2348|      0|                    if (t_group_info->t_group[i].num[1])
  ------------------
  |  Branch (2348:25): [True: 0, False: 0]
  ------------------
 2349|      0|                    {
 2350|      0|                        *s_subtype |= SALT_DONOR_Neg; /* has (-) */
  ------------------
  |  |   91|      0|#define SALT_DONOR_Neg    2
  ------------------
 2351|      0|                    }
 2352|      0|                    *s_subtype |= SALT_ACCEPTOR; /* there is always an acceptor in a t-group */
  ------------------
  |  |   92|      0|#define SALT_ACCEPTOR     4
  ------------------
 2353|      0|                    return type;
 2354|      0|                }
 2355|      0|            }
 2356|      0|            return -1; /* error: t-group not found */
 2357|      0|        }
 2358|       |
 2359|     24|        if (eif.cAcceptor)
  ------------------
  |  Branch (2359:13): [True: 0, False: 24]
  ------------------
 2360|      0|        {
 2361|      0|            *s_subtype |= SALT_ACCEPTOR;
  ------------------
  |  |   92|      0|#define SALT_ACCEPTOR     4
  ------------------
 2362|      0|        }
 2363|     24|        if (eif.cDonor)
  ------------------
  |  Branch (2363:13): [True: 24, False: 0]
  ------------------
 2364|     24|        {
 2365|     24|            if (at[at_no].charge == -1)
  ------------------
  |  Branch (2365:17): [True: 24, False: 0]
  ------------------
 2366|     24|            {
 2367|     24|                *s_subtype |= SALT_DONOR_Neg; /* has (-) */
  ------------------
  |  |   91|     24|#define SALT_DONOR_Neg    2
  ------------------
 2368|     24|            }
 2369|     24|            if (at[at_no].num_H)
  ------------------
  |  Branch (2369:17): [True: 0, False: 24]
  ------------------
 2370|      0|            {
 2371|      0|                *s_subtype |= SALT_DONOR_H; /* has H */
  ------------------
  |  |   90|      0|#define SALT_DONOR_H      1
  ------------------
 2372|      0|            }
 2373|     24|        }
 2374|     24|    }
 2375|       |
 2376|     24|    return type;
 2377|   338k|}
GetOtherSaltType:
 2382|   338k|{
 2383|       |    /*
 2384|       |    type (returned value):
 2385|       |    -1 => ignore
 2386|       |    2 => found:                           SH
 2387|       |    proton donor     -CH2-SH, >CH-SH, >C<    S(-)
 2388|       |    proton acceptor  -CH2-S(-), >CH-S(-), >C<
 2389|       |    subtype:
 2390|       |    1 = SALT_DONOR_H   => has H
 2391|       |    2 = SALT_DONOR_Neg => has (-) charge
 2392|       |    4 = SALT_ACCEPTOR  => may be an acceptor of H or (-), but not necessarily
 2393|       |
 2394|       |    non-O-atom should be:
 2395|       |    - a tautomeric endpoint atom
 2396|       |    - connected to possible middle point atom
 2397|       |    */
 2398|       |
 2399|   338k|    int type, endpoint_valence, bond_type, centerpoint;
 2400|   338k|    ENDPOINT_INFO eif;
 2401|       |
 2402|   338k|    if (at[at_no].valence != 1 || at[at_no].chem_bonds_valence != 1 ||
  ------------------
  |  Branch (2402:9): [True: 338k, False: 18]
  |  Branch (2402:35): [True: 0, False: 18]
  ------------------
 2403|   338k|         1 != ( at[at_no].num_H == 1 ) + ( at[at_no].charge == -1 ))
  ------------------
  |  Branch (2403:10): [True: 6, False: 12]
  ------------------
 2404|   338k|    {
 2405|   338k|        return -1;
 2406|   338k|    }
 2407|       |
 2408|     12|    *s_subtype = 0; /* initialize the output */
 2409|     12|    if (!( at[at_no].el_number == EL_NUMBER_S ||
  ------------------
  |  |   49|     24|#define EL_NUMBER_S ((U_CHAR) 16)
  ------------------
  |  Branch (2409:12): [True: 0, False: 12]
  ------------------
 2410|     12|           at[at_no].el_number == EL_NUMBER_SE ||
  ------------------
  |  |   52|     24|#define EL_NUMBER_SE ((U_CHAR) 34)
  ------------------
  |  Branch (2410:12): [True: 0, False: 12]
  ------------------
 2411|     12|           at[at_no].el_number == EL_NUMBER_TE ))
  ------------------
  |  |   54|     12|#define EL_NUMBER_TE ((U_CHAR) 52)
  ------------------
  |  Branch (2411:12): [True: 0, False: 12]
  ------------------
 2412|     12|    {
 2413|     12|        return -1; /* we are not looking for oxygen here */
 2414|     12|    }
 2415|       |
 2416|      0|    type = 2; /* non-tautomeric p-donor or acceptor: C-SH, C-S(-) */
 2417|       |
 2418|      0|    if (!( endpoint_valence = nGetEndpointInfo( at, at_no, &eif ) ) ||
  ------------------
  |  Branch (2418:9): [True: 0, False: 0]
  ------------------
 2419|      0|         eif.cMoveableCharge && !at[at_no].c_point || !eif.cDonor || eif.cAcceptor)
  ------------------
  |  Branch (2419:10): [True: 0, False: 0]
  |  Branch (2419:33): [True: 0, False: 0]
  |  Branch (2419:55): [True: 0, False: 0]
  |  Branch (2419:70): [True: 0, False: 0]
  ------------------
 2420|      0|    {
 2421|      0|        return -1; /* not a possible -SH or -S(-) */
 2422|      0|    }
 2423|      0|    else
 2424|      0|    {
 2425|       |        /* at[at_no] is not not in a tautomeric group; use eif previously filled out by nGetEndpointInfo */
 2426|       |        /* check whether there is adjacent atom-candidate for a centerpoint */
 2427|      0|        centerpoint = (int) at[at_no].neighbor[0];
 2428|      0|        bond_type = (int) at[at_no].bond_type[0] & BOND_TYPE_MASK;
  ------------------
  |  |  217|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
 2429|      0|        if (at[centerpoint].el_number != EL_NUMBER_C ||
  ------------------
  |  |   43|      0|#define EL_NUMBER_C ((U_CHAR) 6)
  ------------------
  |  Branch (2429:13): [True: 0, False: 0]
  ------------------
 2430|      0|             at[centerpoint].charge ||
  ------------------
  |  Branch (2430:14): [True: 0, False: 0]
  ------------------
 2431|      0|             at[centerpoint].radical && at[centerpoint].radical != RADICAL_SINGLET ||
  ------------------
  |  |  103|      0|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (2431:14): [True: 0, False: 0]
  |  Branch (2431:41): [True: 0, False: 0]
  ------------------
 2432|      0|             at[centerpoint].valence != at[centerpoint].chem_bonds_valence)
  ------------------
  |  Branch (2432:14): [True: 0, False: 0]
  ------------------
 2433|      0|        {
 2434|      0|            return -1; /* not a carbon with all single bonds */
 2435|      0|        }
 2436|      0|        if (at[at_no].num_H == 1)
  ------------------
  |  Branch (2436:13): [True: 0, False: 0]
  ------------------
 2437|      0|        {
 2438|      0|            *s_subtype |= SALT_p_DONOR;
  ------------------
  |  |   93|      0|#define SALT_p_DONOR      8  /* >C-SH   */
  ------------------
 2439|      0|        }
 2440|      0|        else
 2441|      0|        {
 2442|      0|            if (at[at_no].charge == -1)
  ------------------
  |  Branch (2442:17): [True: 0, False: 0]
  ------------------
 2443|      0|            {
 2444|      0|                *s_subtype |= SALT_p_ACCEPTOR;
  ------------------
  |  |   94|      0|#define SALT_p_ACCEPTOR  16  /* >C-S(-) */
  ------------------
 2445|      0|            }
 2446|      0|            else
 2447|      0|            {
 2448|      0|                return -1;
 2449|      0|            }
 2450|      0|        }
 2451|      0|    }
 2452|       |
 2453|      0|    return type;
 2454|      0|}
MarkSaltChargeGroups2:
 2522|   110k|{
 2523|       |    /* BNS_EDGE_FORBIDDEN_TEMP */
 2524|   110k|#define ALT_PATH_FOUND    (MAX_ATOMS+1)
 2525|   110k|#define NO_ENDPOINT       (MAX_ATOMS+2)  /* the two defines must be different */
 2526|   110k|#define DISABLE_CANDIDATE 10
 2527|   110k|#define cPAIR(a,b) cPair[a+b*nNumLeftCandidates]
 2528|   110k|#define ACCEPTOR_PAIR 1
 2529|   110k|#define DONOR_PAIR    2
 2530|       |
 2531|   110k|    int nNumChanges = 0, nNumOtherChanges = 0, nNumAcidicChanges = 0, nTotNumChanges = 0;
 2532|   110k|    S_CHAR      *cPair = NULL;
 2533|   110k|    T_ENDPOINT  *EndPoint = NULL;
 2534|   110k|    if (s_group_info && s_group_info->s_candidate && s_group_info->max_num_candidates > 0)
  ------------------
  |  Branch (2534:9): [True: 110k, False: 0]
  |  Branch (2534:25): [True: 110k, False: 0]
  |  Branch (2534:54): [True: 110k, False: 0]
  ------------------
 2535|   110k|    {
 2536|   110k|        int i, j, i1, j1;
 2537|   110k|        S_CANDIDATE *s_candidate = s_group_info->s_candidate;
 2538|   110k|        int          nMaxNumCandidates = s_group_info->max_num_candidates;
 2539|   110k|        int          nNumCandidates = s_group_info->num_candidates;
 2540|   110k|        int          nNumOtherCandidates = s_group_info->num_other_candidates;
 2541|   110k|        int          nNumPOnlyCandidates = s_group_info->num_p_only_candidates;
 2542|   110k|        int          nNumLeftCandidates = 0;
 2543|   110k|        int          nNumMarkedCandidates = 0;
 2544|   110k|        int          s_type, s_subtype;
 2545|   110k|        int          ret, nDelta;
 2546|   110k|        int          bHardAddedRemovedProtons = t_group_info && ( t_group_info->tni.bNormalizationFlags & FLAG_FORCE_SALT_TAUT );
  ------------------
  |  |  200|   110k|#define FLAG_FORCE_SALT_TAUT         ( FLAG_PROTON_NP_HARD_REMOVED  | \
  |  |  ------------------
  |  |  |  |  175|   110k|#define FLAG_PROTON_NP_HARD_REMOVED    0x0002
  |  |  ------------------
  |  |  201|   110k|                                       FLAG_PROTON_AC_HARD_REMOVED  | \
  |  |  ------------------
  |  |  |  |  178|   110k|#define FLAG_PROTON_AC_HARD_REMOVED    0x0010
  |  |  ------------------
  |  |  202|   110k|                                       FLAG_PROTON_AC_HARD_ADDED    )
  |  |  ------------------
  |  |  |  |  179|   110k|#define FLAG_PROTON_AC_HARD_ADDED      0x0020
  |  |  ------------------
  ------------------
  |  Branch (2546:49): [True: 110k, False: 0]
  |  Branch (2546:65): [True: 0, False: 110k]
  ------------------
 2547|       |
 2548|   110k|        int          s_subtype_all = 0;
 2549|   110k|        int          nDonorPairs, nAcceptorPairs, nCurDonorPairs, nCurAcceptorPairs, bAlreadyTested;
 2550|       |        /*
 2551|       |        ENDPOINT_INFO    eif;
 2552|       |        */
 2553|       |
 2554|   110k|#if ( IGNORE_TGROUP_WITHOUT_H == 1 )
 2555|   110k|        int          bTGroupHasNegativeChargesOnly = 1;
 2556|   110k|#endif
 2557|       |        /*return 0;*/ /* debug only */
 2558|       |
 2559|   110k|        i1 = -1;
 2560|       |
 2561|   110k|        if (nNumCandidates <= -2 || !t_group_info || !t_group_info->t_group)
  ------------------
  |  Branch (2561:13): [True: 0, False: 110k]
  |  Branch (2561:37): [True: 0, False: 110k]
  |  Branch (2561:54): [True: 0, False: 110k]
  ------------------
 2562|      0|        {
 2563|      0|            return 0;
 2564|      0|        }
 2565|       |
 2566|       |        /*************************************************************************/
 2567|       |        /* Find all candidates including those with differen s_type (other type) */
 2568|       |        /*************************************************************************/
 2569|   222k|        for (i = 0, nNumCandidates = nNumOtherCandidates = nNumPOnlyCandidates = 0; i < num_atoms; i++)
  ------------------
  |  Branch (2569:85): [True: 112k, False: 110k]
  ------------------
 2570|   112k|        {
 2571|   112k|            if (0 == ( s_type = GetSaltChargeType( at, i, t_group_info, &s_subtype ) ) ||
  ------------------
  |  Branch (2571:17): [True: 0, False: 112k]
  ------------------
 2572|       |                 /* -C=O or =C-OH, O = S, Se, Te */
 2573|   112k|                 1 == ( s_type = GetOtherSaltChargeType( at, i, t_group_info, &s_subtype, 1/* bAccept_O*/ ) ) ||
  ------------------
  |  Branch (2573:18): [True: 8, False: 112k]
  ------------------
 2574|       |                 /* =Z-MH or -Z=M, Z = centerpoint, M = endpoint, other than above */
 2575|   112k|                 2 == ( s_type = GetOtherSaltType( at, i, &s_subtype ) ) ||
  ------------------
  |  Branch (2575:18): [True: 0, False: 112k]
  ------------------
 2576|   112k|                 ( bHardAddedRemovedProtons && 4 == ( s_type = bIsHardRemHCandidate( at, i, &s_subtype ) ) )
  ------------------
  |  Branch (2576:20): [True: 0, False: 112k]
  |  Branch (2576:48): [True: 0, False: 0]
  ------------------
 2577|       |                 /* >C-SH, >C-S(-); S=S,Se,Te */
 2578|   112k|                 )
 2579|      8|            {
 2580|       |
 2581|      8|                if (nNumCandidates >= nMaxNumCandidates)
  ------------------
  |  Branch (2581:21): [True: 0, False: 8]
  ------------------
 2582|      0|                {
 2583|      0|                    return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   82|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2584|      0|                }
 2585|      8|                s_candidate[nNumCandidates].atnumber = i;
 2586|      8|                s_candidate[nNumCandidates].type = s_type;
 2587|      8|                s_candidate[nNumCandidates].subtype = s_subtype;
 2588|      8|                s_candidate[nNumCandidates].endpoint = at[i].endpoint;
 2589|      8|                nNumCandidates++;
 2590|      8|                nNumOtherCandidates += ( 1 == s_type );
 2591|      8|                s_subtype_all |= s_subtype;
 2592|      8|                i1 = i; /* save a representative of a tautomeric group */
 2593|      8|            }
 2594|   112k|        }
 2595|       |
 2596|   110k|        if (nNumCandidates <= 1 ||  /* TG_FLAG_ALLOW_NO_NEGTV_O <=> CHARGED_SALTS_ONLY=0 */
  ------------------
  |  Branch (2596:13): [True: 110k, False: 2]
  ------------------
 2597|   110k|             !( s_subtype_all & SALT_ACCEPTOR ) ||
  ------------------
  |  |   92|      2|#define SALT_ACCEPTOR     4
  ------------------
  |  Branch (2597:14): [True: 2, False: 0]
  ------------------
 2598|   110k|             ( ( ( t_group_info->bTautFlags & TG_FLAG_ALLOW_NO_NEGTV_O ) ||
  ------------------
  |  |  926|      0|#define TG_FLAG_ALLOW_NO_NEGTV_O         0x00000020   /* CHARGED_SALTS_ONLY=0 (debug) find long-range H-only tautomerism on =C-OH, >C=O */
  ------------------
  |  Branch (2598:14): [True: 0, False: 0]
  |  Branch (2598:18): [True: 0, False: 0]
  ------------------
 2599|      0|             ( t_group_info->bTautFlagsDone & TG_FLAG_FOUND_SALT_CHARGES_DONE ) ||
  ------------------
  |  |  977|      0|#define TG_FLAG_FOUND_SALT_CHARGES_DONE  0x00002000   /* not assigned: preprocessing detected possibility of salt-type tautomerism */
  ------------------
  |  Branch (2599:14): [True: 0, False: 0]
  ------------------
 2600|      0|                 ( t_group_info->tni.bNormalizationFlags & FLAG_FORCE_SALT_TAUT ) ) ?
  ------------------
  |  |  200|      0|#define FLAG_FORCE_SALT_TAUT         ( FLAG_PROTON_NP_HARD_REMOVED  | \
  |  |  ------------------
  |  |  |  |  175|      0|#define FLAG_PROTON_NP_HARD_REMOVED    0x0002
  |  |  ------------------
  |  |  201|      0|                                       FLAG_PROTON_AC_HARD_REMOVED  | \
  |  |  ------------------
  |  |  |  |  178|      0|#define FLAG_PROTON_AC_HARD_REMOVED    0x0010
  |  |  ------------------
  |  |  202|      0|                                       FLAG_PROTON_AC_HARD_ADDED    )
  |  |  ------------------
  |  |  |  |  179|      0|#define FLAG_PROTON_AC_HARD_ADDED      0x0020
  |  |  ------------------
  ------------------
  |  Branch (2600:18): [True: 0, False: 0]
  ------------------
 2601|      0|               !( s_subtype_all & ( SALT_DONOR ) ) :
  ------------------
  |  |   98|      0|#define SALT_DONOR         (SALT_DONOR_Neg | SALT_DONOR_H)
  |  |  ------------------
  |  |  |  |   91|      0|#define SALT_DONOR_Neg    2
  |  |  ------------------
  |  |               #define SALT_DONOR         (SALT_DONOR_Neg | SALT_DONOR_H)
  |  |  ------------------
  |  |  |  |   90|      0|#define SALT_DONOR_H      1
  |  |  ------------------
  ------------------
 2602|      0|               ( !( s_subtype_all & SALT_DONOR_Neg ) || nNumOtherCandidates == nNumCandidates ) )
  ------------------
  |  |   91|      0|#define SALT_DONOR_Neg    2
  ------------------
  |  Branch (2602:18): [True: 0, False: 0]
  |  Branch (2602:57): [True: 0, False: 0]
  ------------------
 2603|   110k|             )
 2604|   110k|        {
 2605|   110k|            s_group_info->num_candidates = 0; /* no candidate exists */
 2606|   110k|            return 0;
 2607|   110k|        }
 2608|       |
 2609|      0|        if (!( s_subtype_all & ( SALT_DONOR_Neg ) ))
  ------------------
  |  |   91|      0|#define SALT_DONOR_Neg    2
  ------------------
  |  Branch (2609:13): [True: 0, False: 0]
  ------------------
 2610|      0|        {
 2611|      0|            t_group_info->bTautFlagsDone |= TG_FLAG_ALLOW_NO_NEGTV_O_DONE;
  ------------------
  |  |  965|      0|#define TG_FLAG_ALLOW_NO_NEGTV_O_DONE    0x00000040
  ------------------
 2612|      0|        }
 2613|       |
 2614|       |        /************************************************************************************/
 2615|       |        /* Mark redundant candidates so that only one candidate from one t-group is left in */
 2616|       |        /************************************************************************************/
 2617|      0|        for (i = 0; i < nNumCandidates; i++)
  ------------------
  |  Branch (2617:21): [True: 0, False: 0]
  ------------------
 2618|      0|        {
 2619|      0|            if (2 == s_candidate[nNumCandidates].type)
  ------------------
  |  Branch (2619:17): [True: 0, False: 0]
  ------------------
 2620|      0|            {
 2621|      0|                s_candidate[i].type -= DISABLE_CANDIDATE; /* disable >C-SH candidates */
  ------------------
  |  | 2526|      0|#define DISABLE_CANDIDATE 10
  ------------------
 2622|      0|                nNumLeftCandidates++; /* count rejected */
 2623|      0|                continue;
 2624|      0|            }
 2625|      0|            if (s_candidate[i].endpoint)
  ------------------
  |  Branch (2625:17): [True: 0, False: 0]
  ------------------
 2626|      0|            {
 2627|      0|                for (j = i - 1; 0 <= j; j--)
  ------------------
  |  Branch (2627:33): [True: 0, False: 0]
  ------------------
 2628|      0|                {
 2629|      0|                    if (s_candidate[i].endpoint == s_candidate[j].endpoint)
  ------------------
  |  Branch (2629:25): [True: 0, False: 0]
  ------------------
 2630|      0|                    {
 2631|      0|                        s_candidate[i].type -= DISABLE_CANDIDATE; /* disable subsequent redundant */
  ------------------
  |  | 2526|      0|#define DISABLE_CANDIDATE 10
  ------------------
 2632|      0|                        nNumLeftCandidates++; /* count rejected */
 2633|      0|                        break;
 2634|      0|                    }
 2635|      0|                }
 2636|      0|            }
 2637|      0|        }
 2638|       |
 2639|      0|        nNumLeftCandidates = nNumCandidates - nNumLeftCandidates; /* subtract num. rejected from the total */
 2640|      0|        s_group_info->num_candidates = 0; /* reinit next time */
 2641|       |                                          /*********************************************************************/
 2642|       |                                          /* reorder so that all disabled are at the end, tautomeric are first */
 2643|       |                                          /*********************************************************************/
 2644|       |
 2645|      0|        qsort( s_candidate, nNumCandidates, sizeof( s_candidate[0] ), comp_candidates );
 2646|       |
 2647|      0|        cPair = (S_CHAR *) inchi_calloc( nNumLeftCandidates*nNumLeftCandidates, sizeof( cPair[0] ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 2648|      0|        if (!cPair)
  ------------------
  |  Branch (2648:13): [True: 0, False: 0]
  ------------------
 2649|      0|        {
 2650|       |            /*printf("BNS_OUT_OF_RAM-6\n");*/
 2651|      0|            nTotNumChanges = BNS_OUT_OF_RAM;
  ------------------
  |  |   77|      0|#define BNS_OUT_OF_RAM     (BNS_ERR +  1) /*(-9998)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2652|      0|            goto quick_exit;
 2653|      0|        }
 2654|      0|        nDonorPairs = nAcceptorPairs = 0;
 2655|       |
 2656|       |        /**********************************************************************/
 2657|       |        /* Find whether we have at least one donor pair and one acceptor pair */
 2658|       |        /**********************************************************************/
 2659|      0|        for (i = 0; i < nNumLeftCandidates; i++)
  ------------------
  |  Branch (2659:21): [True: 0, False: 0]
  ------------------
 2660|      0|        {
 2661|      0|            nCurDonorPairs = nCurAcceptorPairs = 0;
 2662|      0|            for (j = 0; j <= i; j++)
  ------------------
  |  Branch (2662:25): [True: 0, False: 0]
  ------------------
 2663|      0|            {
 2664|      0|                if (i == j && !s_candidate[i].endpoint)
  ------------------
  |  Branch (2664:21): [True: 0, False: 0]
  |  Branch (2664:31): [True: 0, False: 0]
  ------------------
 2665|      0|                {
 2666|      0|                    continue;  /* same non-taut atom. However, success for i==j means     *
 2667|       |                               * that the whole tautomeric group may donate or accept 2H */
 2668|      0|                }
 2669|       |                /* check for acceptor pair */
 2670|      0|                if (( s_candidate[i].subtype & SALT_ACCEPTOR ) && ( s_candidate[j].subtype & SALT_ACCEPTOR ) &&
  ------------------
  |  |   92|      0|#define SALT_ACCEPTOR     4
  ------------------
                              if (( s_candidate[i].subtype & SALT_ACCEPTOR ) && ( s_candidate[j].subtype & SALT_ACCEPTOR ) &&
  ------------------
  |  |   92|      0|#define SALT_ACCEPTOR     4
  ------------------
  |  Branch (2670:21): [True: 0, False: 0]
  |  Branch (2670:67): [True: 0, False: 0]
  ------------------
 2671|      0|                    ( ret = bExistsAltPath( pCG, pBNS, pBD, NULL, at, num_atoms, s_candidate[i].atnumber,
  ------------------
  |  Branch (2671:21): [True: 0, False: 0]
  ------------------
 2672|      0|                                            s_candidate[j].atnumber, ALT_PATH_MODE_ADD2H_TST ) ))
  ------------------
  |  |  345|      0|#define ALT_PATH_MODE_ADD2H_TST  8   /* test-add 2 H along alt. path A=-=B => AH-=-BH; restore changed bonds */
  ------------------
 2673|      0|                {
 2674|      0|                    if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2675|      0|                    {
 2676|      0|                        nTotNumChanges = ret;
 2677|      0|                        goto quick_exit;
 2678|      0|                    }
 2679|      0|                    if (ret & 1)
  ------------------
  |  Branch (2679:25): [True: 0, False: 0]
  ------------------
 2680|      0|                    {
 2681|      0|                        nDelta = ( ret & ~3 ) >> 2;
 2682|       |                        /*nNumChanges += (ret & 2);*/
 2683|      0|                        if (nDelta)
  ------------------
  |  Branch (2683:29): [True: 0, False: 0]
  ------------------
 2684|      0|                        {
 2685|       |                            /* alt path unleashed previously localized radicals and they annihilated */
 2686|      0|                            nNumChanges = 0;
 2687|      0|                            nTotNumChanges = BNS_RADICAL_ERR;
  ------------------
  |  |   87|      0|#define BNS_RADICAL_ERR    (BNS_ERR + 11) /*(-9988)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2688|      0|                            goto quick_exit;
 2689|      0|                        }
 2690|      0|                        cPAIR( i, j ) |= ACCEPTOR_PAIR; /* the result: mark the pair */
  ------------------
  |  | 2527|      0|#define cPAIR(a,b) cPair[a+b*nNumLeftCandidates]
  ------------------
                                      cPAIR( i, j ) |= ACCEPTOR_PAIR; /* the result: mark the pair */
  ------------------
  |  | 2528|      0|#define ACCEPTOR_PAIR 1
  ------------------
 2691|       |                                                        /*cPAIR(j,i) |= ACCEPTOR_PAIR;*/
 2692|      0|                    }
 2693|      0|                }
 2694|       |                /* Check for donor pair */
 2695|      0|                if (( s_candidate[i].subtype & SALT_DONOR ) && ( s_candidate[j].subtype & SALT_DONOR ) &&
  ------------------
  |  |   98|      0|#define SALT_DONOR         (SALT_DONOR_Neg | SALT_DONOR_H)
  |  |  ------------------
  |  |  |  |   91|      0|#define SALT_DONOR_Neg    2
  |  |  ------------------
  |  |               #define SALT_DONOR         (SALT_DONOR_Neg | SALT_DONOR_H)
  |  |  ------------------
  |  |  |  |   90|      0|#define SALT_DONOR_H      1
  |  |  ------------------
  ------------------
                              if (( s_candidate[i].subtype & SALT_DONOR ) && ( s_candidate[j].subtype & SALT_DONOR ) &&
  ------------------
  |  |   98|      0|#define SALT_DONOR         (SALT_DONOR_Neg | SALT_DONOR_H)
  |  |  ------------------
  |  |  |  |   91|      0|#define SALT_DONOR_Neg    2
  |  |  ------------------
  |  |               #define SALT_DONOR         (SALT_DONOR_Neg | SALT_DONOR_H)
  |  |  ------------------
  |  |  |  |   90|      0|#define SALT_DONOR_H      1
  |  |  ------------------
  ------------------
  |  Branch (2695:21): [True: 0, False: 0]
  |  Branch (2695:64): [True: 0, False: 0]
  ------------------
 2696|      0|                    ( ret = bExistsAltPath( pCG, pBNS, pBD, NULL, at, num_atoms, s_candidate[i].atnumber,
  ------------------
  |  Branch (2696:21): [True: 0, False: 0]
  ------------------
 2697|      0|                                            s_candidate[j].atnumber, ALT_PATH_MODE_REM2H_TST ) ))
  ------------------
  |  |  344|      0|#define ALT_PATH_MODE_REM2H_TST  7   /* test-remove 2 H along alt. path AH-=-BH => A=-=B; restore changed bonds */
  ------------------
 2698|      0|                {
 2699|      0|                    if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2700|      0|                    {
 2701|      0|                        nTotNumChanges = ret;
 2702|      0|                        goto quick_exit;
 2703|      0|                    }
 2704|      0|                    if (ret & 1)
  ------------------
  |  Branch (2704:25): [True: 0, False: 0]
  ------------------
 2705|      0|                    {
 2706|      0|                        nDelta = ( ret & ~3 ) >> 2;
 2707|       |                        /*nNumChanges += (ret & 2);*/
 2708|      0|                        if (nDelta)
  ------------------
  |  Branch (2708:29): [True: 0, False: 0]
  ------------------
 2709|      0|                        {
 2710|       |                            /* Alt path unleashed previously localized radicals and they annihilated */
 2711|      0|                            nNumChanges = 0;
 2712|      0|                            nTotNumChanges = BNS_RADICAL_ERR;
  ------------------
  |  |   87|      0|#define BNS_RADICAL_ERR    (BNS_ERR + 11) /*(-9988)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2713|      0|                            goto quick_exit;
 2714|      0|                        }
 2715|      0|                        cPAIR( i, j ) |= DONOR_PAIR; /* the result: mark the pair */
  ------------------
  |  | 2527|      0|#define cPAIR(a,b) cPair[a+b*nNumLeftCandidates]
  ------------------
                                      cPAIR( i, j ) |= DONOR_PAIR; /* the result: mark the pair */
  ------------------
  |  | 2529|      0|#define DONOR_PAIR    2
  ------------------
 2716|       |                                                     /*cPAIR(j,i) |= ACCEPTOR_PAIR;*/
 2717|      0|                    }
 2718|      0|                }
 2719|       |                /* Since the results will be used later to change bonds, check only now */
 2720|       |                /* when both results for (i,j) have been obtained. */
 2721|      0|                if (cPAIR( i, j ) & ACCEPTOR_PAIR)
  ------------------
  |  | 2527|      0|#define cPAIR(a,b) cPair[a+b*nNumLeftCandidates]
  ------------------
                              if (cPAIR( i, j ) & ACCEPTOR_PAIR)
  ------------------
  |  | 2528|      0|#define ACCEPTOR_PAIR 1
  ------------------
  |  Branch (2721:21): [True: 0, False: 0]
  ------------------
 2722|      0|                {
 2723|      0|                    nCurAcceptorPairs++;
 2724|      0|                    if (nDonorPairs)
  ------------------
  |  Branch (2724:25): [True: 0, False: 0]
  ------------------
 2725|      0|                    {
 2726|       |                        /* Find donor pair (i1,j1) such that i!=i1, i!=j1, j!=i1, j!=j1 */
 2727|      0|                        for (i1 = 0; i1 < i; i1++)
  ------------------
  |  Branch (2727:38): [True: 0, False: 0]
  ------------------
 2728|      0|                        {
 2729|      0|                            for (j1 = 0; j1 <= i1; j1++)
  ------------------
  |  Branch (2729:42): [True: 0, False: 0]
  ------------------
 2730|      0|                            {
 2731|       |                                /* Here always j1 < i && i1 < i therefore we do not compare i to i1 or j1 */
 2732|      0|                                if (j1 != j && i1 != j && ( cPAIR( i1, j1 ) & DONOR_PAIR ))
  ------------------
  |  | 2527|      0|#define cPAIR(a,b) cPair[a+b*nNumLeftCandidates]
  ------------------
                                              if (j1 != j && i1 != j && ( cPAIR( i1, j1 ) & DONOR_PAIR ))
  ------------------
  |  | 2529|      0|#define DONOR_PAIR    2
  ------------------
  |  Branch (2732:37): [True: 0, False: 0]
  |  Branch (2732:48): [True: 0, False: 0]
  |  Branch (2732:59): [True: 0, False: 0]
  ------------------
 2733|      0|                                {
 2734|       |                                    /* Both the donor and the acceptor pairs have been found */
 2735|      0|                                    goto bFound2Pairs;
 2736|      0|                                }
 2737|      0|                            }
 2738|      0|                        }
 2739|      0|                    }
 2740|      0|                }
 2741|      0|                if (cPAIR( i, j ) & DONOR_PAIR)
  ------------------
  |  | 2527|      0|#define cPAIR(a,b) cPair[a+b*nNumLeftCandidates]
  ------------------
                              if (cPAIR( i, j ) & DONOR_PAIR)
  ------------------
  |  | 2529|      0|#define DONOR_PAIR    2
  ------------------
  |  Branch (2741:21): [True: 0, False: 0]
  ------------------
 2742|      0|                {
 2743|      0|                    nCurDonorPairs++;
 2744|      0|                    if (nAcceptorPairs)
  ------------------
  |  Branch (2744:25): [True: 0, False: 0]
  ------------------
 2745|      0|                    {
 2746|       |                        /* Find acceptor pair (i1,j1) such that i!=i1, i!=j1, j!=i1, j!=j1 */
 2747|      0|                        for (i1 = 0; i1 < i; i1++)
  ------------------
  |  Branch (2747:38): [True: 0, False: 0]
  ------------------
 2748|      0|                        {
 2749|      0|                            for (j1 = 0; j1 <= i1; j1++)
  ------------------
  |  Branch (2749:42): [True: 0, False: 0]
  ------------------
 2750|      0|                            {
 2751|       |                                /* Here always j1 < i && i1 < i therefore we do not compare i to i1 or j1 */
 2752|      0|                                if (j1 != j && i1 != j && ( cPAIR( i1, j1 ) & ACCEPTOR_PAIR ))
  ------------------
  |  | 2527|      0|#define cPAIR(a,b) cPair[a+b*nNumLeftCandidates]
  ------------------
                                              if (j1 != j && i1 != j && ( cPAIR( i1, j1 ) & ACCEPTOR_PAIR ))
  ------------------
  |  | 2528|      0|#define ACCEPTOR_PAIR 1
  ------------------
  |  Branch (2752:37): [True: 0, False: 0]
  |  Branch (2752:48): [True: 0, False: 0]
  |  Branch (2752:59): [True: 0, False: 0]
  ------------------
 2753|      0|                                {
 2754|       |                                    /* Both the donor and the acceptor pairs have been found */
 2755|      0|                                    goto bFound2Pairs;
 2756|      0|                                }
 2757|      0|                            }
 2758|      0|                        }
 2759|      0|                    }
 2760|      0|                }
 2761|      0|            }
 2762|      0|            nDonorPairs += nCurDonorPairs;
 2763|      0|            nAcceptorPairs += nCurAcceptorPairs;
 2764|      0|        }
 2765|       |
 2766|       |        /* Nothing has been found */
 2767|      0|        nNumChanges = 0;
 2768|      0|        inchi_free( cPair );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2769|      0|        cPair = NULL;
 2770|      0|        goto quick_exit;
 2771|       |
 2772|       |
 2773|       |        /* Both the donor and the acceptor pairs have been found */
 2774|      0|    bFound2Pairs:
 2775|       |        /* first, try already found pairs */
 2776|      0|        i1 = i;
 2777|      0|        j1 = j;
 2778|       |
 2779|       |        /* Find all possible donor and acceptor pairs */
 2780|      0|        nNumMarkedCandidates = 0;
 2781|      0|        for (i = 0; i < nNumLeftCandidates; i++)
  ------------------
  |  Branch (2781:21): [True: 0, False: 0]
  ------------------
 2782|      0|        {
 2783|      0|            nCurDonorPairs = nCurAcceptorPairs = 0;
 2784|      0|            for (j = 0; j <= i; j++)
  ------------------
  |  Branch (2784:25): [True: 0, False: 0]
  ------------------
 2785|      0|            {
 2786|      0|                bAlreadyTested = ( i < i1 || i == i1 && j <= j1 );
  ------------------
  |  Branch (2786:36): [True: 0, False: 0]
  |  Branch (2786:46): [True: 0, False: 0]
  |  Branch (2786:57): [True: 0, False: 0]
  ------------------
 2787|      0|                if (bAlreadyTested && ( cPAIR( i, j ) & ACCEPTOR_PAIR ) || !bAlreadyTested)
  ------------------
  |  | 2527|      0|#define cPAIR(a,b) cPair[a+b*nNumLeftCandidates]
  ------------------
                              if (bAlreadyTested && ( cPAIR( i, j ) & ACCEPTOR_PAIR ) || !bAlreadyTested)
  ------------------
  |  | 2528|      0|#define ACCEPTOR_PAIR 1
  ------------------
  |  Branch (2787:21): [True: 0, False: 0]
  |  Branch (2787:39): [True: 0, False: 0]
  |  Branch (2787:76): [True: 0, False: 0]
  ------------------
 2788|      0|                {
 2789|       |                    /* Checking for acceptor pair */
 2790|      0|                    if (( s_candidate[i].subtype & SALT_ACCEPTOR ) && ( s_candidate[j].subtype & SALT_ACCEPTOR ) &&
  ------------------
  |  |   92|      0|#define SALT_ACCEPTOR     4
  ------------------
                                  if (( s_candidate[i].subtype & SALT_ACCEPTOR ) && ( s_candidate[j].subtype & SALT_ACCEPTOR ) &&
  ------------------
  |  |   92|      0|#define SALT_ACCEPTOR     4
  ------------------
  |  Branch (2790:25): [True: 0, False: 0]
  |  Branch (2790:71): [True: 0, False: 0]
  ------------------
 2791|      0|                        ( ret = bExistsAltPath( pCG, pBNS, pBD, NULL, at, num_atoms, s_candidate[i].atnumber,
  ------------------
  |  Branch (2791:25): [True: 0, False: 0]
  ------------------
 2792|      0|                                                s_candidate[j].atnumber, ALT_PATH_MODE_ADD2H_CHG ) ))
  ------------------
  |  |  343|      0|#define ALT_PATH_MODE_ADD2H_CHG  6   /* add 2 H along alt. path A=-=B => AH-=-BH    and change bonds to alternating */
  ------------------
 2793|      0|                    {
 2794|      0|                        if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2795|      0|                        {
 2796|      0|                            nTotNumChanges = ret;
 2797|      0|                            goto quick_exit;
 2798|      0|                        }
 2799|      0|                        if (ret & 1)
  ------------------
  |  Branch (2799:29): [True: 0, False: 0]
  ------------------
 2800|      0|                        {
 2801|      0|                            nDelta = ( ret & ~3 ) >> 2;
 2802|      0|                            nNumChanges += ( ret & 2 );
 2803|      0|                            if (nDelta)
  ------------------
  |  Branch (2803:33): [True: 0, False: 0]
  ------------------
 2804|      0|                            {
 2805|       |                                /* Alt path unleashed previously localized radicals and they annihilated */
 2806|      0|                                nNumChanges = 0;
 2807|      0|                                nTotNumChanges = BNS_RADICAL_ERR;
  ------------------
  |  |   87|      0|#define BNS_RADICAL_ERR    (BNS_ERR + 11) /*(-9988)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2808|      0|                                goto quick_exit;
 2809|      0|                            }
 2810|      0|                            cPAIR( i, j ) |= ACCEPTOR_PAIR;
  ------------------
  |  | 2527|      0|#define cPAIR(a,b) cPair[a+b*nNumLeftCandidates]
  ------------------
                                          cPAIR( i, j ) |= ACCEPTOR_PAIR;
  ------------------
  |  | 2528|      0|#define ACCEPTOR_PAIR 1
  ------------------
 2811|       |                            /*cPAIR(j,i) |= ACCEPTOR_PAIR;*/
 2812|      0|                            nCurAcceptorPairs += !bAlreadyTested;
 2813|      0|                            if (!( s_candidate[i].subtype & SALT_SELECTED ))
  ------------------
  |  |  100|      0|#define SALT_SELECTED    32
  ------------------
  |  Branch (2813:33): [True: 0, False: 0]
  ------------------
 2814|      0|                            {
 2815|      0|                                s_candidate[i].subtype |= SALT_SELECTED;
  ------------------
  |  |  100|      0|#define SALT_SELECTED    32
  ------------------
 2816|      0|                                nNumMarkedCandidates++;
 2817|      0|                                if (!s_candidate[i].endpoint && s_candidate[i].type)
  ------------------
  |  Branch (2817:37): [True: 0, False: 0]
  |  Branch (2817:65): [True: 0, False: 0]
  ------------------
 2818|      0|                                {
 2819|      0|                                    nNumOtherChanges++;
 2820|      0|                                }
 2821|      0|                                else
 2822|      0|                                {
 2823|      0|                                    nNumAcidicChanges++;
 2824|      0|                                }
 2825|      0|                            }
 2826|      0|                            if (!( s_candidate[j].subtype & SALT_SELECTED ))
  ------------------
  |  |  100|      0|#define SALT_SELECTED    32
  ------------------
  |  Branch (2826:33): [True: 0, False: 0]
  ------------------
 2827|      0|                            {
 2828|      0|                                s_candidate[j].subtype |= SALT_SELECTED;
  ------------------
  |  |  100|      0|#define SALT_SELECTED    32
  ------------------
 2829|      0|                                nNumMarkedCandidates++;
 2830|      0|                                if (!s_candidate[j].endpoint && s_candidate[j].type)
  ------------------
  |  Branch (2830:37): [True: 0, False: 0]
  |  Branch (2830:65): [True: 0, False: 0]
  ------------------
 2831|      0|                                {
 2832|      0|                                    nNumOtherChanges++;
 2833|      0|                                }
 2834|      0|                                else
 2835|      0|                                {
 2836|      0|                                    nNumAcidicChanges++;
 2837|      0|                                }
 2838|      0|                            }
 2839|      0|                        }
 2840|      0|                    }
 2841|      0|                }
 2842|       |
 2843|      0|                if (bAlreadyTested && ( cPAIR( i, j ) & DONOR_PAIR ) || !bAlreadyTested)
  ------------------
  |  | 2527|      0|#define cPAIR(a,b) cPair[a+b*nNumLeftCandidates]
  ------------------
                              if (bAlreadyTested && ( cPAIR( i, j ) & DONOR_PAIR ) || !bAlreadyTested)
  ------------------
  |  | 2529|      0|#define DONOR_PAIR    2
  ------------------
  |  Branch (2843:21): [True: 0, False: 0]
  |  Branch (2843:39): [True: 0, False: 0]
  |  Branch (2843:73): [True: 0, False: 0]
  ------------------
 2844|      0|                {
 2845|       |                    /* Checking for donor pair */
 2846|      0|                    if (( s_candidate[i].subtype & SALT_DONOR ) && ( s_candidate[j].subtype & SALT_DONOR ) &&
  ------------------
  |  |   98|      0|#define SALT_DONOR         (SALT_DONOR_Neg | SALT_DONOR_H)
  |  |  ------------------
  |  |  |  |   91|      0|#define SALT_DONOR_Neg    2
  |  |  ------------------
  |  |               #define SALT_DONOR         (SALT_DONOR_Neg | SALT_DONOR_H)
  |  |  ------------------
  |  |  |  |   90|      0|#define SALT_DONOR_H      1
  |  |  ------------------
  ------------------
                                  if (( s_candidate[i].subtype & SALT_DONOR ) && ( s_candidate[j].subtype & SALT_DONOR ) &&
  ------------------
  |  |   98|      0|#define SALT_DONOR         (SALT_DONOR_Neg | SALT_DONOR_H)
  |  |  ------------------
  |  |  |  |   91|      0|#define SALT_DONOR_Neg    2
  |  |  ------------------
  |  |               #define SALT_DONOR         (SALT_DONOR_Neg | SALT_DONOR_H)
  |  |  ------------------
  |  |  |  |   90|      0|#define SALT_DONOR_H      1
  |  |  ------------------
  ------------------
  |  Branch (2846:25): [True: 0, False: 0]
  |  Branch (2846:68): [True: 0, False: 0]
  ------------------
 2847|      0|                        ( ret = bExistsAltPath( pCG, pBNS, pBD, NULL, at, num_atoms, s_candidate[i].atnumber,
  ------------------
  |  Branch (2847:25): [True: 0, False: 0]
  ------------------
 2848|      0|                                                s_candidate[j].atnumber, ALT_PATH_MODE_REM2H_CHG ) ))
  ------------------
  |  |  342|      0|#define ALT_PATH_MODE_REM2H_CHG  5   /* remove 2 H along alt. path AH-=-BH => A=-=B and change bonds to alternating */
  ------------------
 2849|      0|                    {
 2850|      0|                        if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2851|      0|                        {
 2852|      0|                            nTotNumChanges = ret;
 2853|      0|                            goto quick_exit;
 2854|      0|                        }
 2855|      0|                        if (ret & 1)
  ------------------
  |  Branch (2855:29): [True: 0, False: 0]
  ------------------
 2856|      0|                        {
 2857|      0|                            nDelta = ( ret & ~3 ) >> 2;
 2858|      0|                            nNumChanges += ( ret & 2 );
 2859|      0|                            if (nDelta)
  ------------------
  |  Branch (2859:33): [True: 0, False: 0]
  ------------------
 2860|      0|                            {
 2861|       |                                /* Alt path unleashed previously localized radicals and they annihilated */
 2862|      0|                                nNumChanges = 0;
 2863|      0|                                nTotNumChanges = BNS_RADICAL_ERR;
  ------------------
  |  |   87|      0|#define BNS_RADICAL_ERR    (BNS_ERR + 11) /*(-9988)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2864|      0|                                goto quick_exit;
 2865|      0|                            }
 2866|      0|                            cPAIR( i, j ) |= DONOR_PAIR;
  ------------------
  |  | 2527|      0|#define cPAIR(a,b) cPair[a+b*nNumLeftCandidates]
  ------------------
                                          cPAIR( i, j ) |= DONOR_PAIR;
  ------------------
  |  | 2529|      0|#define DONOR_PAIR    2
  ------------------
 2867|       |                            /*cPAIR(j,i) |= ACCEPTOR_PAIR;*/
 2868|      0|                            nCurDonorPairs += !bAlreadyTested;
 2869|      0|                            if (!( s_candidate[i].subtype & SALT_SELECTED ))
  ------------------
  |  |  100|      0|#define SALT_SELECTED    32
  ------------------
  |  Branch (2869:33): [True: 0, False: 0]
  ------------------
 2870|      0|                            {
 2871|      0|                                s_candidate[i].subtype |= SALT_SELECTED;
  ------------------
  |  |  100|      0|#define SALT_SELECTED    32
  ------------------
 2872|      0|                                nNumMarkedCandidates++;
 2873|      0|                                if (!s_candidate[i].endpoint && s_candidate[i].type)
  ------------------
  |  Branch (2873:37): [True: 0, False: 0]
  |  Branch (2873:65): [True: 0, False: 0]
  ------------------
 2874|      0|                                {
 2875|      0|                                    nNumOtherChanges++;
 2876|      0|                                }
 2877|      0|                                else
 2878|      0|                                {
 2879|      0|                                    nNumAcidicChanges++;
 2880|      0|                                }
 2881|      0|                            }
 2882|      0|                            if (!( s_candidate[j].subtype & SALT_SELECTED ))
  ------------------
  |  |  100|      0|#define SALT_SELECTED    32
  ------------------
  |  Branch (2882:33): [True: 0, False: 0]
  ------------------
 2883|      0|                            {
 2884|      0|                                s_candidate[j].subtype |= SALT_SELECTED;
  ------------------
  |  |  100|      0|#define SALT_SELECTED    32
  ------------------
 2885|      0|                                nNumMarkedCandidates++;
 2886|      0|                                if (!s_candidate[j].endpoint && s_candidate[j].type)
  ------------------
  |  Branch (2886:37): [True: 0, False: 0]
  |  Branch (2886:65): [True: 0, False: 0]
  ------------------
 2887|      0|                                {
 2888|      0|                                    nNumOtherChanges++;
 2889|      0|                                }
 2890|      0|                                else
 2891|      0|                                {
 2892|      0|                                    nNumAcidicChanges++;
 2893|      0|                                }
 2894|      0|                            }
 2895|      0|                        }
 2896|      0|                    }
 2897|      0|                }
 2898|      0|            }
 2899|      0|            nDonorPairs += nCurDonorPairs;
 2900|      0|            nAcceptorPairs += nCurAcceptorPairs;
 2901|      0|        }
 2902|       |
 2903|      0|        inchi_free( cPair );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2904|      0|        cPair = NULL;
 2905|       |
 2906|      0|        if (nNumMarkedCandidates)
  ------------------
  |  Branch (2906:13): [True: 0, False: 0]
  ------------------
 2907|      0|        {
 2908|      0|            EndPoint = (T_ENDPOINT *) inchi_calloc( nNumMarkedCandidates, sizeof( EndPoint[0] ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 2909|      0|            if (!EndPoint)
  ------------------
  |  Branch (2909:17): [True: 0, False: 0]
  ------------------
 2910|      0|            {
 2911|       |                /*printf("BNS_OUT_OF_RAM-7\n");*/
 2912|      0|                nTotNumChanges = BNS_OUT_OF_RAM;
  ------------------
  |  |   77|      0|#define BNS_OUT_OF_RAM     (BNS_ERR +  1) /*(-9998)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2913|      0|                goto quick_exit;
 2914|      0|            }
 2915|      0|            for (i = 0, j = 0; i < nNumLeftCandidates; i++)
  ------------------
  |  Branch (2915:32): [True: 0, False: 0]
  ------------------
 2916|      0|            {
 2917|      0|                if (s_candidate[i].subtype & SALT_SELECTED)
  ------------------
  |  |  100|      0|#define SALT_SELECTED    32
  ------------------
  |  Branch (2917:21): [True: 0, False: 0]
  ------------------
 2918|      0|                {
 2919|      0|                    s_candidate[i].subtype ^= SALT_SELECTED; /* remove the flag */
  ------------------
  |  |  100|      0|#define SALT_SELECTED    32
  ------------------
 2920|      0|                    if (j < nNumMarkedCandidates)
  ------------------
  |  Branch (2920:25): [True: 0, False: 0]
  ------------------
 2921|      0|                    {
 2922|      0|                        i1 = s_candidate[i].atnumber; /* save a representative of the t-group to be created */
 2923|      0|                        AddEndPoint( EndPoint + j, at, i1 );
 2924|      0|                    }
 2925|      0|                    j++;
 2926|      0|                }
 2927|      0|            }
 2928|      0|            if (j != nNumMarkedCandidates)
  ------------------
  |  Branch (2928:17): [True: 0, False: 0]
  ------------------
 2929|      0|            {
 2930|      0|                nTotNumChanges = BNS_PROGRAM_ERR;
  ------------------
  |  |   78|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2931|      0|                goto quick_exit;
 2932|      0|            }
 2933|       |
 2934|       |            /* Merge all marked atoms and their t-groups into one t-group */
 2935|      0|            ret = RegisterEndPoints( pCG, t_group_info, EndPoint,
 2936|      0|                                     nNumMarkedCandidates, at,
 2937|      0|                                     num_atoms, c_group_info, pBNS );
 2938|       |
 2939|      0|            if (ret == -1)
  ------------------
  |  Branch (2939:17): [True: 0, False: 0]
  ------------------
 2940|      0|            {
 2941|      0|                ret = BNS_PROGRAM_ERR;
  ------------------
  |  |   78|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 2942|      0|            }
 2943|      0|            if (ret < 0)
  ------------------
  |  Branch (2943:17): [True: 0, False: 0]
  ------------------
 2944|      0|            {
 2945|      0|                nTotNumChanges = ret;
 2946|      0|                goto quick_exit;
 2947|      0|            }
 2948|      0|            nTotNumChanges += ( ret > 0 );
 2949|      0|            inchi_free( EndPoint );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2950|      0|            EndPoint = NULL;
 2951|       |
 2952|      0|            if (nNumMarkedCandidates)
  ------------------
  |  Branch (2952:17): [True: 0, False: 0]
  ------------------
 2953|      0|            {
 2954|      0|                for (i = nNumLeftCandidates; i < nNumCandidates; i++)
  ------------------
  |  Branch (2954:46): [True: 0, False: 0]
  ------------------
 2955|      0|                {
 2956|      0|                    s_candidate[i].type += DISABLE_CANDIDATE;
  ------------------
  |  | 2526|      0|#define DISABLE_CANDIDATE 10
  ------------------
 2957|      0|                    j1 = s_candidate[i].atnumber;
 2958|      0|                    if (at[j1].endpoint == at[i1].endpoint)
  ------------------
  |  Branch (2958:25): [True: 0, False: 0]
  ------------------
 2959|      0|                    {
 2960|      0|                        if (!s_candidate[i].endpoint && s_candidate[i].type)
  ------------------
  |  Branch (2960:29): [True: 0, False: 0]
  |  Branch (2960:57): [True: 0, False: 0]
  ------------------
 2961|      0|                        {
 2962|      0|                            nNumOtherChanges++;
 2963|      0|                        }
 2964|      0|                        else
 2965|      0|                        {
 2966|      0|                            nNumAcidicChanges++;
 2967|      0|                        }
 2968|      0|                    }
 2969|      0|                }
 2970|      0|            }
 2971|      0|            else
 2972|      0|            {
 2973|      0|                for (i = nNumLeftCandidates; i < nNumCandidates; i++)
  ------------------
  |  Branch (2973:46): [True: 0, False: 0]
  ------------------
 2974|      0|                {
 2975|      0|                    s_candidate[i].type += DISABLE_CANDIDATE;
  ------------------
  |  | 2526|      0|#define DISABLE_CANDIDATE 10
  ------------------
 2976|      0|                }
 2977|      0|            }
 2978|       |
 2979|       |            /* Find whether the new t-group have any movable H */
 2980|      0|            for (i = 0, bTGroupHasNegativeChargesOnly = 0; i < t_group_info->num_t_groups; i++)
  ------------------
  |  Branch (2980:60): [True: 0, False: 0]
  ------------------
 2981|      0|            {
 2982|      0|                if (t_group_info->t_group[i].nGroupNumber == at[i1].endpoint &&
  ------------------
  |  Branch (2982:21): [True: 0, False: 0]
  ------------------
 2983|      0|                     t_group_info->t_group[i].num[0] == t_group_info->t_group[i].num[1])
  ------------------
  |  Branch (2983:22): [True: 0, False: 0]
  ------------------
 2984|      0|                {
 2985|      0|                    bTGroupHasNegativeChargesOnly = 1;
 2986|      0|                    break;
 2987|      0|                }
 2988|      0|            }
 2989|      0|        }
 2990|      0|        nTotNumChanges = ( nTotNumChanges > 0 );
 2991|       |
 2992|      0|#if ( IGNORE_TGROUP_WITHOUT_H == 1 )
 2993|      0|        if (nTotNumChanges && bTGroupHasNegativeChargesOnly)
  ------------------
  |  Branch (2993:13): [True: 0, False: 0]
  |  Branch (2993:31): [True: 0, False: 0]
  ------------------
 2994|      0|        {
 2995|      0|            nTotNumChanges = 2;  /* means no moveable H has been affected */
 2996|      0|        }
 2997|      0|#endif
 2998|      0|    }
 2999|       |
 3000|      0|quick_exit:
 3001|      0|    if (nNumOtherChanges && nTotNumChanges == 1)
  ------------------
  |  Branch (3001:9): [True: 0, False: 0]
  |  Branch (3001:29): [True: 0, False: 0]
  ------------------
 3002|      0|    {
 3003|      0|        nTotNumChanges = 5; /* not only acidic atoms merged */
 3004|      0|    }
 3005|      0|    if (cPair)
  ------------------
  |  Branch (3005:9): [True: 0, False: 0]
  ------------------
 3006|      0|    {
 3007|      0|        inchi_free( cPair );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3008|       |        /*cPair = NULL;*/
 3009|      0|    }
 3010|      0|    if (EndPoint)
  ------------------
  |  Branch (3010:9): [True: 0, False: 0]
  ------------------
 3011|      0|    {
 3012|      0|        inchi_free( EndPoint );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3013|       |        /*EndPoint = NULL;*/
 3014|      0|    }
 3015|       |
 3016|      0|    return nTotNumChanges; /* 0=>no changes, 1=>new salt tautomerism found, 2=>only new charge tautomerism found */
 3017|   110k|#undef ALT_PATH_FOUND
 3018|   110k|#undef NO_ENDPOINT
 3019|   110k|}
MarkSaltChargeGroups:
 3057|   110k|{
 3058|       |
 3059|   110k|    int nNumChanges = 0, nTotNumChanges = 0;
 3060|   110k|    if (s_group_info && s_group_info->s_candidate && s_group_info->max_num_candidates > 0)
  ------------------
  |  Branch (3060:9): [True: 110k, False: 0]
  |  Branch (3060:25): [True: 110k, False: 0]
  |  Branch (3060:54): [True: 110k, False: 0]
  ------------------
 3061|   110k|    {
 3062|   110k|        int i, i1, i2, j, j1, j2, jj, ii1, ii2, jj1, jj2, /*k,*/ num_tested;
 3063|   110k|        S_CANDIDATE *s_candidate = s_group_info->s_candidate;
 3064|   110k|        int          nMaxNumCandidates = s_group_info->max_num_candidates;
 3065|   110k|        int          nNumCandidates = s_group_info->num_candidates;
 3066|   110k|        int          nNumOtherCandidates = s_group_info->num_other_candidates;
 3067|   110k|        int          nNumPOnlyCandidates = s_group_info->num_p_only_candidates;
 3068|   110k|        int          s_type, s_subtype;
 3069|   110k|        int          ret, nDelta, /*nMobile,*/ err = 0;
 3070|   110k|        int          s_subtype_all = 0;
 3071|   110k|        int          nGroupNumber;
 3072|   110k|        T_ENDPOINT   EndPoint[2];
 3073|       |#if ( MAX_LOCAL_TGNUM > 0 )
 3074|       |        TGroupData   tgData[MAX_LOCAL_TGNUM];
 3075|       |        TGroupData   *ptgData = tgData;
 3076|       |#endif
 3077|   110k|        int cond1 = 0, cond2a = 0, cond2b = 0, cond2c = 0, cond2 = 0;
 3078|       |
 3079|   110k|        if (nNumCandidates <= -1 || !t_group_info || !t_group_info->t_group)
  ------------------
  |  Branch (3079:13): [True: 0, False: 110k]
  |  Branch (3079:37): [True: 0, False: 110k]
  |  Branch (3079:54): [True: 0, False: 110k]
  ------------------
 3080|      0|        {
 3081|      0|            return 0;
 3082|      0|        }
 3083|       |
 3084|       |        /* count t-groups */
 3085|   110k|        for (i = 0, nGroupNumber = 0; i < t_group_info->num_t_groups; i++)
  ------------------
  |  Branch (3085:39): [True: 0, False: 110k]
  ------------------
 3086|      0|        {
 3087|      0|            if (nGroupNumber < t_group_info->t_group[i].nGroupNumber)
  ------------------
  |  Branch (3087:17): [True: 0, False: 0]
  ------------------
 3088|      0|            {
 3089|      0|                nGroupNumber = t_group_info->t_group[i].nGroupNumber; /* max. t-group number */
 3090|      0|            }
 3091|      0|        }
 3092|       |#if ( MAX_LOCAL_TGNUM > 0 )
 3093|       |        /* prepare memory */
 3094|       |        if (nGroupNumber >= MAX_LOCAL_TGNUM)
 3095|       |        {
 3096|       |            if (!( ptgData = (TGroupData*) inchi_calloc( nGroupNumber + 1, sizeof( TGroupData ) ) ))
 3097|       |            {
 3098|       |                err = BNS_OUT_OF_RAM;
 3099|       |                goto quick_exit;
 3100|       |            }
 3101|       |        }
 3102|       |        else
 3103|       |        {
 3104|       |            memset( ptgData, 0, sizeof( tgData ) );
 3105|       |        }
 3106|       |        ptgData[0].nGroupIndex = -1; /* data for non-tautomeric atoms */
 3107|       |        for (i = 0, nGroupNumber = 0; i < t_group_info->num_t_groups; i++)
 3108|       |        {
 3109|       |            if (nGroupNumber = t_group_info->t_group[i].nGroupNumber)
 3110|       |            {
 3111|       |                ptgData[nGroupNumber].nGroupIndex = i;
 3112|       |                ptgData[i].nGroupNumber = nGroupNumber;
 3113|       |            }
 3114|       |        }
 3115|       |#endif
 3116|   110k|        nNumCandidates = 0; /* always recalculate 2004-03-22 */
 3117|   110k|        num_tested = 0;
 3118|       |
 3119|   110k|        if (nNumCandidates == 0)
  ------------------
  |  Branch (3119:13): [True: 110k, False: 0]
  ------------------
 3120|   110k|        {
 3121|   222k|            for (i = 0, nNumCandidates = nNumOtherCandidates = nNumPOnlyCandidates = 0; i < num_atoms; i++)
  ------------------
  |  Branch (3121:89): [True: 112k, False: 110k]
  ------------------
 3122|   112k|            {
 3123|   112k|                if (0 == ( s_type = GetSaltChargeType( at, i, t_group_info, &s_subtype ) ) ||
  ------------------
  |  Branch (3123:21): [True: 0, False: 112k]
  ------------------
 3124|       |                     /* -C=O or =C-OH, O = S, Se, Te */
 3125|   112k|#if ( INCL_NON_SALT_CANDIDATATES == 1 )
 3126|   112k|                     1 == ( s_type = GetOtherSaltChargeType( at, i, t_group_info, &s_subtype, 1 ) ) ||
  ------------------
  |  Branch (3126:22): [True: 8, False: 112k]
  ------------------
 3127|       |                     /* =Z-MH or -Z=M, Z = centerpoint, M = endpoint, other than above */
 3128|   112k|#endif
 3129|   112k|                     2 == ( s_type = GetOtherSaltType( at, i, &s_subtype ) )
  ------------------
  |  Branch (3129:22): [True: 0, False: 112k]
  ------------------
 3130|       |                     /* >C-SH, >C-S(-); S=S,Se,Te */
 3131|   112k|                     )
 3132|      8|                {
 3133|       |
 3134|      8|                    if (nNumCandidates >= nMaxNumCandidates)
  ------------------
  |  Branch (3134:25): [True: 0, False: 8]
  ------------------
 3135|      0|                    {
 3136|      0|                        err = BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   82|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3137|      0|                        goto quick_exit;
 3138|      0|                    }
 3139|      8|                    s_candidate[nNumCandidates].atnumber = i;
 3140|      8|                    s_candidate[nNumCandidates].type = s_type;
 3141|      8|                    s_candidate[nNumCandidates].subtype = s_subtype;
 3142|      8|                    s_candidate[nNumCandidates].endpoint = at[i].endpoint;
 3143|      8|                    nNumCandidates++;
 3144|      8|                    nNumOtherCandidates += ( 1 == s_type );
 3145|      8|                    nNumPOnlyCandidates += ( 2 == s_type );
 3146|      8|                    s_subtype_all |= s_subtype;
 3147|       |                    /*i1 = i;*/ /* save a representative of a tautomeric group */
 3148|      8|                }
 3149|   112k|            } /* for */
 3150|       |
 3151|       |              /* changes: TG_FLAG_ALLOW_NO_NEGTV_O replaced CHARGED_SALTS_ONLY==0 */
 3152|   110k|            cond1 = s_subtype_all & SALT_ACCEPTOR;
  ------------------
  |  |   92|   110k|#define SALT_ACCEPTOR     4
  ------------------
 3153|   110k|            cond2a = t_group_info->bTautFlags & TG_FLAG_ALLOW_NO_NEGTV_O;
  ------------------
  |  |  926|   110k|#define TG_FLAG_ALLOW_NO_NEGTV_O         0x00000020   /* CHARGED_SALTS_ONLY=0 (debug) find long-range H-only tautomerism on =C-OH, >C=O */
  ------------------
 3154|   110k|            cond2b = t_group_info->bTautFlagsDone & TG_FLAG_FOUND_SALT_CHARGES_DONE;
  ------------------
  |  |  977|   110k|#define TG_FLAG_FOUND_SALT_CHARGES_DONE  0x00002000   /* not assigned: preprocessing detected possibility of salt-type tautomerism */
  ------------------
 3155|   110k|            cond2c = t_group_info->tni.bNormalizationFlags & FLAG_FORCE_SALT_TAUT;
  ------------------
  |  |  200|   110k|#define FLAG_FORCE_SALT_TAUT         ( FLAG_PROTON_NP_HARD_REMOVED  | \
  |  |  ------------------
  |  |  |  |  175|   110k|#define FLAG_PROTON_NP_HARD_REMOVED    0x0002
  |  |  ------------------
  |  |  201|   110k|                                       FLAG_PROTON_AC_HARD_REMOVED  | \
  |  |  ------------------
  |  |  |  |  178|   110k|#define FLAG_PROTON_AC_HARD_REMOVED    0x0010
  |  |  ------------------
  |  |  202|   110k|                                       FLAG_PROTON_AC_HARD_ADDED    )
  |  |  ------------------
  |  |  |  |  179|   110k|#define FLAG_PROTON_AC_HARD_ADDED      0x0020
  |  |  ------------------
  ------------------
 3156|   110k|            if (cond2a || cond2b || cond2c)
  ------------------
  |  Branch (3156:17): [True: 0, False: 110k]
  |  Branch (3156:27): [True: 0, False: 110k]
  |  Branch (3156:37): [True: 0, False: 110k]
  ------------------
 3157|      0|            {
 3158|      0|                cond2 = !( s_subtype_all & ( SALT_DONOR_Neg | SALT_DONOR_H ) );
  ------------------
  |  |   91|      0|#define SALT_DONOR_Neg    2
  ------------------
                              cond2 = !( s_subtype_all & ( SALT_DONOR_Neg | SALT_DONOR_H ) );
  ------------------
  |  |   90|      0|#define SALT_DONOR_H      1
  ------------------
 3159|      0|            }
 3160|   110k|            else
 3161|   110k|            {
 3162|   110k|                cond2 = !( s_subtype_all & SALT_DONOR_Neg ) || nNumOtherCandidates == nNumCandidates;
  ------------------
  |  |   91|   110k|#define SALT_DONOR_Neg    2
  ------------------
  |  Branch (3162:25): [True: 110k, False: 6]
  |  Branch (3162:64): [True: 6, False: 0]
  ------------------
 3163|   110k|            }
 3164|   110k|            if (nNumCandidates <= 1 || !cond1 || cond2
  ------------------
  |  Branch (3164:17): [True: 110k, False: 2]
  |  Branch (3164:40): [True: 2, False: 0]
  |  Branch (3164:50): [True: 0, False: 0]
  ------------------
 3165|       |                 /*(
 3166|       |                 ( cond2a || cond2b    || cond2c )
 3167|       |                 ?        !(s_subtype_all & (SALT_DONOR_Neg | SALT_DONOR_H))
 3168|       |                 :        ( !(s_subtype_all & SALT_DONOR_Neg) || nNumOtherCandidates==nNumCandidates) ) */
 3169|   110k|                 )
 3170|   110k|            {
 3171|   110k|                s_group_info->num_candidates = -1; /* no candidate exists */
 3172|   110k|                goto quick_exit;
 3173|   110k|            }
 3174|      0|            if (!( s_subtype_all & ( SALT_DONOR_Neg ) ))
  ------------------
  |  |   91|      0|#define SALT_DONOR_Neg    2
  ------------------
  |  Branch (3174:17): [True: 0, False: 0]
  ------------------
 3175|      0|            {
 3176|      0|                t_group_info->bTautFlagsDone |= TG_FLAG_ALLOW_NO_NEGTV_O_DONE;
  ------------------
  |  |  965|      0|#define TG_FLAG_ALLOW_NO_NEGTV_O_DONE    0x00000040
  ------------------
 3177|      0|            }
 3178|      0|        }
 3179|      0|        else
 3180|      0|        {
 3181|      0|            for (i = 0; i < nNumCandidates; i++)
  ------------------
  |  Branch (3181:25): [True: 0, False: 0]
  ------------------
 3182|      0|            {
 3183|      0|                i1 = s_candidate[i].atnumber;
 3184|      0|                if (0 <= ( s_type = GetSaltChargeType( at, i1, t_group_info, &s_subtype ) )
  ------------------
  |  Branch (3184:21): [True: 0, False: 0]
  ------------------
 3185|      0|#if ( INCL_NON_SALT_CANDIDATATES == 1 )
 3186|      0|                     || 0 < ( s_type = GetOtherSaltChargeType( at, i1, t_group_info, &s_subtype, 1 /* bAccept_O*/ ) )
  ------------------
  |  Branch (3186:25): [True: 0, False: 0]
  ------------------
 3187|      0|#endif
 3188|      0|                     )
 3189|      0|                {
 3190|      0|                    s_candidate[nNumCandidates].type = s_type;
 3191|      0|                    s_candidate[nNumCandidates].subtype = s_subtype;
 3192|      0|                    s_candidate[nNumCandidates].endpoint = at[i1].endpoint;
 3193|      0|                }
 3194|      0|            }
 3195|      0|        }
 3196|       |
 3197|       |        /* Look for alt paths connecting:
 3198|       |        SALT_DONOR_Neg to SALT_ACCEPTOR  : long distance migration of negative charges
 3199|       |        SALT_DONOR_H   to SALT_ACCEPTOR  : long distance migration of H-atoms
 3200|       |        */
 3201|      0|        do
 3202|      0|        {
 3203|      0|            nNumChanges = 0;
 3204|      0|            for (i1 = 0; i1 < nNumCandidates; i1++)
  ------------------
  |  Branch (3204:26): [True: 0, False: 0]
  ------------------
 3205|      0|            {
 3206|      0|                j1 = s_candidate[i1].atnumber;
 3207|      0|                for (i2 = i1 + 1; i2 < nNumCandidates; i2++)
  ------------------
  |  Branch (3207:35): [True: 0, False: 0]
  ------------------
 3208|      0|                {
 3209|       |                    /* prev. approach: do not test if both candidates are not "salt-type". Disabled 2004-03-18
 3210|       |                    if ( s_candidate[i1].type && s_candidate[i2].type )
 3211|       |                    continue;
 3212|       |                    */
 3213|      0|                    j2 = s_candidate[i2].atnumber;
 3214|      0|                    if (at[j1].endpoint && at[j1].endpoint == at[j2].endpoint)
  ------------------
  |  Branch (3214:25): [True: 0, False: 0]
  |  Branch (3214:44): [True: 0, False: 0]
  ------------------
 3215|      0|                    {
 3216|      0|                        continue;
 3217|      0|                    }
 3218|      0|                    for (j = 0; j < 2; j++)
  ------------------
  |  Branch (3218:33): [True: 0, False: 0]
  ------------------
 3219|      0|                    {
 3220|      0|                        if (j)
  ------------------
  |  Branch (3220:29): [True: 0, False: 0]
  ------------------
 3221|      0|                        {
 3222|      0|                            ii1 = i2; /* candidate 1 (donor)    ordering number */
 3223|      0|                            ii2 = i1; /* candidate 2 (acceptor) ordering number */
 3224|      0|                            jj1 = j2; /* candidate 1 (donor)    atom number */
 3225|      0|                            jj2 = j1; /* candidate 2 (acceptor) atom number */
 3226|      0|                        }
 3227|      0|                        else
 3228|      0|                        {
 3229|       |                            /* transposition */
 3230|      0|                            ii1 = i1; /* candidate 1 (donor)    ordering number */
 3231|      0|                            ii2 = i2; /* candidate 2 (acceptor) ordering number */
 3232|      0|                            jj1 = j1; /* candidate 1 (donor)    atom number     */
 3233|      0|                            jj2 = j2; /* candidate 2 (acceptor) atom number     */
 3234|      0|                        }
 3235|       |
 3236|      0|                        if (( s_candidate[ii1].subtype & ( SALT_DONOR_Neg | SALT_DONOR_H ) ) &&
  ------------------
  |  |   91|      0|#define SALT_DONOR_Neg    2
  ------------------
                                      if (( s_candidate[ii1].subtype & ( SALT_DONOR_Neg | SALT_DONOR_H ) ) &&
  ------------------
  |  |   90|      0|#define SALT_DONOR_H      1
  ------------------
  |  Branch (3236:29): [True: 0, False: 0]
  ------------------
 3237|      0|                            ( s_candidate[ii2].subtype & SALT_ACCEPTOR ))
  ------------------
  |  |   92|      0|#define SALT_ACCEPTOR     4
  ------------------
  |  Branch (3237:29): [True: 0, False: 0]
  ------------------
 3238|      0|                        {
 3239|       |                            /****printf("\nChkpt @ %-s:%-d ", __FILE__,__LINE__); fflush(stdout);*/
 3240|       |
 3241|      0|                            ret = bExistsAltPath( pCG, pBNS, pBD, NULL, at, num_atoms, jj2, jj1, ALT_PATH_MODE_4_SALT );
  ------------------
  |  |  340|      0|#define ALT_PATH_MODE_4_SALT     3   /* mark alt bonds along the path */
  ------------------
 3242|       |
 3243|      0|                            num_tested++;
 3244|      0|                            if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3245|      0|                            {
 3246|      0|                                err = ret;
 3247|      0|                                goto quick_exit;
 3248|      0|                            }
 3249|       |
 3250|      0|                            if (ret & 1)
  ------------------
  |  Branch (3250:33): [True: 0, False: 0]
  ------------------
 3251|      0|                            {
 3252|      0|                                nDelta = ( ret & ~3 ) >> 2;
 3253|      0|                                nNumChanges += ( ret & 2 );
 3254|      0|                                for (i = 0; i < 2; i++)
  ------------------
  |  Branch (3254:45): [True: 0, False: 0]
  ------------------
 3255|      0|                                {
 3256|      0|                                    jj = i ? jj2 : jj1;
  ------------------
  |  Branch (3256:42): [True: 0, False: 0]
  ------------------
 3257|      0|                                    AddEndPoint( EndPoint + i, at, jj );
 3258|      0|                                }
 3259|       |
 3260|       |                                /* add/merge taut groups and reinit pBNS in the fly */
 3261|      0|                                ret = RegisterEndPoints( pCG, t_group_info,
 3262|      0|                                                         EndPoint, 2, at,
 3263|      0|                                                         num_atoms, c_group_info,
 3264|      0|                                                         pBNS );
 3265|      0|                                if (ret == -1)
  ------------------
  |  Branch (3265:37): [True: 0, False: 0]
  ------------------
 3266|      0|                                {
 3267|      0|                                    ret = BNS_PROGRAM_ERR;
  ------------------
  |  |   78|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3268|      0|                                }
 3269|      0|                                if (ret < 0)
  ------------------
  |  Branch (3269:37): [True: 0, False: 0]
  ------------------
 3270|      0|                                {
 3271|      0|                                    err = ret;
 3272|      0|                                    goto quick_exit;
 3273|      0|                                }
 3274|      0|                                if (nDelta)
  ------------------
  |  Branch (3274:37): [True: 0, False: 0]
  ------------------
 3275|      0|                                {
 3276|      0|                                    err = BNS_RADICAL_ERR;
  ------------------
  |  |   87|      0|#define BNS_RADICAL_ERR    (BNS_ERR + 11) /*(-9988)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3277|      0|                                    goto quick_exit;
 3278|      0|                                }
 3279|      0|                                nNumChanges += ( ret > 0 );
 3280|      0|                                break; /* avoid redundant repetition */
 3281|      0|                            }
 3282|      0|                        }
 3283|      0|                    }
 3284|      0|                }
 3285|      0|            }
 3286|      0|            nTotNumChanges += nNumChanges;
 3287|      0|        } while (num_tested && nNumChanges);
  ------------------
  |  Branch (3287:18): [True: 0, False: 0]
  |  Branch (3287:32): [True: 0, False: 0]
  ------------------
 3288|       |
 3289|   110k|    quick_exit:
 3290|   110k|        if (!err)
  ------------------
  |  Branch (3290:13): [True: 110k, False: 0]
  ------------------
 3291|   110k|        {
 3292|   110k|            nTotNumChanges += nNumChanges; /* nNumChanges != 0 only in case of 'goto quick_exit' */
 3293|   110k|            if (s_group_info->num_candidates == 0)
  ------------------
  |  Branch (3293:17): [True: 0, False: 110k]
  ------------------
 3294|      0|            {
 3295|       |                /* first time: initialize */
 3296|      0|                s_group_info->num_candidates = num_tested ? nNumCandidates : -1; /* no candidate exists */
  ------------------
  |  Branch (3296:48): [True: 0, False: 0]
  ------------------
 3297|      0|            }
 3298|   110k|        }
 3299|      0|        else
 3300|      0|        {
 3301|      0|            nTotNumChanges = err;
 3302|      0|        }
 3303|       |#if ( MAX_LOCAL_TGNUM > 0 )
 3304|       |        if (ptgData != tgData)
 3305|       |        {
 3306|       |            inchi_free( ptgData );
 3307|       |        }
 3308|       |#endif
 3309|   110k|    }
 3310|       |
 3311|   110k|    return nTotNumChanges;
 3312|   110k|}
MergeSaltTautGroups:
 3526|   110k|{
 3527|       |    /* Count candidates to be connected: exclude pure donors that do not belong to any t-group */
 3528|   110k|    AT_NUMB    nCurTGroupNumber;
 3529|   110k|    int        i, j, /*k,*/ ret, iat, /*nMobile,*/ nMinNumEndpoints;
 3530|   110k|    int        s_subtype_all, s_subtype_taut;
 3531|   110k|    int        nMaxNumCandidates, nNumCandidates, nNumCandidates2;
 3532|   110k|    T_ENDPOINT EndPointStackArray[MAX_STACK_ARRAY_LEN]; /* will be reallocated if too short */
 3533|   110k|    T_ENDPOINT  *EndPoint = EndPointStackArray;
 3534|       |
 3535|       |
 3536|   110k|    if (!s_group_info || !s_group_info->s_candidate || /*s_group_info->num_candidates <= 0 ||*/
  ------------------
  |  Branch (3536:9): [True: 0, False: 110k]
  |  Branch (3536:26): [True: 0, False: 110k]
  ------------------
 3537|   110k|         !t_group_info || !t_group_info->t_group || !c_group_info)
  ------------------
  |  Branch (3537:10): [True: 0, False: 110k]
  |  Branch (3537:27): [True: 0, False: 110k]
  |  Branch (3537:53): [True: 0, False: 110k]
  ------------------
 3538|      0|    {
 3539|      0|        return 0;
 3540|      0|    }
 3541|   110k|    nMinNumEndpoints = 0;
 3542|   110k|    nMaxNumCandidates = s_group_info->max_num_candidates;
 3543|   110k|    nCurTGroupNumber = MAX_ATOMS;  /* impossible t-group number */
  ------------------
  |  |   43|   110k|#define MAX_ATOMS  32766
  ------------------
 3544|   110k|    s_subtype_all = s_subtype_taut = 0;
 3545|       |
 3546|       |    /* Collect tautomeric acidic O and previously non-tautomeric C-OH, C-SH, C-O(-), C-S(-)  */
 3547|       |    /* find whether previously found tautomeric atoms have both mobile H and (-) */
 3548|   110k|    if (1 || ( s_group_info->num_candidates < 0 ))
  ------------------
  |  Branch (3548:9): [Folded - Ignored]
  |  Branch (3548:14): [True: 0, False: 0]
  ------------------
 3549|   110k|    {
 3550|       |        /* Can be only -O(-)  and -OH */
 3551|   110k|        int          s_type, s_subtype;
 3552|   110k|        S_CANDIDATE *s_candidate = s_group_info->s_candidate;
 3553|   222k|        for (i = 0, nNumCandidates = nNumCandidates2 = 0; i < num_atoms; i++)
  ------------------
  |  Branch (3553:59): [True: 112k, False: 110k]
  ------------------
 3554|   112k|        {
 3555|   112k|            s_subtype = 0;
 3556|   112k|            if (0 == ( s_type = GetSaltChargeType( at, i, t_group_info, &s_subtype ) ) ||
  ------------------
  |  Branch (3556:17): [True: 0, False: 112k]
  ------------------
 3557|       |                 /* -C=O or =C-OH, O = S, Se, Te */
 3558|       |
 3559|       |                 /*(t_group_info->tni.bNormalizationFlags & FLAG_FORCE_SALT_TAUT) &&*/
 3560|   112k|                 1 == ( s_type = GetOtherSaltChargeType( at, i, t_group_info, &s_subtype, 1/* bAccept_O*/ ) ) ||
  ------------------
  |  Branch (3560:18): [True: 8, False: 112k]
  ------------------
 3561|       |                 /* =Z-MH or -Z=M, Z = centerpoint, M = endpoint, other than above. M may be N */
 3562|       |
 3563|   112k|                 2 == ( s_type = GetOtherSaltType( at, i, &s_subtype ) ) ||
  ------------------
  |  Branch (3563:18): [True: 0, False: 112k]
  ------------------
 3564|       |                 /* >C-SH, >C-S(-); S=S,Se,Te */
 3565|       |
 3566|       |                 /* other proton donor or acceptor */
 3567|   112k|                 bHasAcidicHydrogen( at, i ) && ( ( s_type = 3 ), ( s_subtype = SALT_p_DONOR ) ) ||
  ------------------
  |  |   93|      4|#define SALT_p_DONOR      8  /* >C-SH   */
  ------------------
  |  Branch (3567:18): [True: 4, False: 112k]
  |  Branch (3567:49): [True: 4, False: 0]
  ------------------
 3568|   112k|                 bHasAcidicMinus( at, i ) && ( ( s_type = 3 ), ( s_subtype = SALT_p_ACCEPTOR ) )
  ------------------
  |  |   94|      0|#define SALT_p_ACCEPTOR  16  /* >C-S(-) */
  ------------------
  |  Branch (3568:18): [True: 0, False: 112k]
  |  Branch (3568:46): [True: 0, False: 0]
  ------------------
 3569|   112k|                 )
 3570|     12|            {
 3571|       |
 3572|     12|                if (nNumCandidates >= nMaxNumCandidates)
  ------------------
  |  Branch (3572:21): [True: 0, False: 12]
  ------------------
 3573|      0|                {
 3574|      0|                    return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   82|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3575|      0|                }
 3576|     12|                if (at[i].endpoint)
  ------------------
  |  Branch (3576:21): [True: 0, False: 12]
  ------------------
 3577|      0|                {
 3578|      0|                    s_subtype_taut |= s_subtype;
 3579|      0|                }
 3580|     12|                else
 3581|     12|                {
 3582|     12|                    if (bDoNotMergeNonTautAtom( at, i ))
  ------------------
  |  Branch (3582:25): [True: 2, False: 10]
  ------------------
 3583|      2|                    {
 3584|      2|                        continue; /* ignore non-tautomeric N */
 3585|      2|                    }
 3586|     12|                }
 3587|     10|                if (!( s_subtype & SALT_DONOR_ALL ) ||
  ------------------
  |  |   95|     10|#define SALT_DONOR_ALL     (SALT_DONOR_Neg | SALT_DONOR_H | SALT_p_ACCEPTOR | SALT_p_DONOR)
  |  |  ------------------
  |  |  |  |   91|     10|#define SALT_DONOR_Neg    2
  |  |  ------------------
  |  |               #define SALT_DONOR_ALL     (SALT_DONOR_Neg | SALT_DONOR_H | SALT_p_ACCEPTOR | SALT_p_DONOR)
  |  |  ------------------
  |  |  |  |   90|     10|#define SALT_DONOR_H      1
  |  |  ------------------
  |  |               #define SALT_DONOR_ALL     (SALT_DONOR_Neg | SALT_DONOR_H | SALT_p_ACCEPTOR | SALT_p_DONOR)
  |  |  ------------------
  |  |  |  |   94|     10|#define SALT_p_ACCEPTOR  16  /* >C-S(-) */
  |  |  ------------------
  |  |               #define SALT_DONOR_ALL     (SALT_DONOR_Neg | SALT_DONOR_H | SALT_p_ACCEPTOR | SALT_p_DONOR)
  |  |  ------------------
  |  |  |  |   93|     10|#define SALT_p_DONOR      8  /* >C-SH   */
  |  |  ------------------
  ------------------
  |  Branch (3587:21): [True: 0, False: 10]
  ------------------
 3588|     10|                    ( s_subtype & SALT_ACCEPTOR ) && !at[i].endpoint)
  ------------------
  |  |   92|     10|#define SALT_ACCEPTOR     4
  ------------------
  |  Branch (3588:21): [True: 0, False: 10]
  |  Branch (3588:54): [True: 0, False: 0]
  ------------------
 3589|      0|                {
 3590|      0|                    continue;  /* do not include non-taut acceptors like -C=O */
 3591|      0|                }
 3592|     10|                s_candidate[nNumCandidates].atnumber = i;
 3593|     10|                s_candidate[nNumCandidates].type = s_type;
 3594|     10|                s_candidate[nNumCandidates].subtype = s_subtype;
 3595|     10|                s_candidate[nNumCandidates].endpoint = at[i].endpoint;
 3596|     10|                nNumCandidates++;
 3597|     10|                s_subtype_all |= s_subtype;
 3598|     10|            }
 3599|   112k|        }
 3600|       |
 3601|       |        /*
 3602|       |        Forced merging occurs upon:
 3603|       |        ===========================
 3604|       |        (t_group_info->bTautFlags & TG_FLAG_ALLOW_NO_NEGTV_O) or
 3605|       |        (t_group_info->tni.bNormalizationFlags & FLAG_FORCE_SALT_TAUT)
 3606|       |
 3607|       |
 3608|       |        Allow forced merging in cases:
 3609|       |        {t-groups}  (H, (-)}  {H, (-), t-groups}
 3610|       |
 3611|       |
 3612|       |        Normal salt merging in cases:
 3613|       |        (H, (-)} {H, (-), t-groups},
 3614|       |
 3615|       |        Cannot merge H into t-groups if no (-) is present
 3616|       |        */
 3617|   110k|        if (( t_group_info->bTautFlags & TG_FLAG_ALLOW_NO_NEGTV_O ) ||
  ------------------
  |  |  926|   110k|#define TG_FLAG_ALLOW_NO_NEGTV_O         0x00000020   /* CHARGED_SALTS_ONLY=0 (debug) find long-range H-only tautomerism on =C-OH, >C=O */
  ------------------
  |  Branch (3617:13): [True: 0, False: 110k]
  ------------------
 3618|   110k|            ( t_group_info->bTautFlagsDone & TG_FLAG_FOUND_SALT_CHARGES_DONE ) ||
  ------------------
  |  |  977|   110k|#define TG_FLAG_FOUND_SALT_CHARGES_DONE  0x00002000   /* not assigned: preprocessing detected possibility of salt-type tautomerism */
  ------------------
  |  Branch (3618:13): [True: 0, False: 110k]
  ------------------
 3619|   110k|             ( t_group_info->tni.bNormalizationFlags & FLAG_FORCE_SALT_TAUT ))
  ------------------
  |  |  200|   110k|#define FLAG_FORCE_SALT_TAUT         ( FLAG_PROTON_NP_HARD_REMOVED  | \
  |  |  ------------------
  |  |  |  |  175|   110k|#define FLAG_PROTON_NP_HARD_REMOVED    0x0002
  |  |  ------------------
  |  |  201|   110k|                                       FLAG_PROTON_AC_HARD_REMOVED  | \
  |  |  ------------------
  |  |  |  |  178|   110k|#define FLAG_PROTON_AC_HARD_REMOVED    0x0010
  |  |  ------------------
  |  |  202|   110k|                                       FLAG_PROTON_AC_HARD_ADDED    )
  |  |  ------------------
  |  |  |  |  179|   110k|#define FLAG_PROTON_AC_HARD_ADDED      0x0020
  |  |  ------------------
  ------------------
  |  Branch (3619:14): [True: 0, False: 110k]
  ------------------
 3620|      0|        {
 3621|       |            /* Force merge even though no negative charges are present */
 3622|      0|            if (nNumCandidates <= 1 ||
  ------------------
  |  Branch (3622:17): [True: 0, False: 0]
  ------------------
 3623|      0|                ( !( s_subtype_all & SALT_DONOR_Neg2 ) || !( s_subtype_all & SALT_DONOR_H2 ) ) &&
  ------------------
  |  |   96|      0|#define SALT_DONOR_Neg2    (SALT_DONOR_Neg | SALT_p_ACCEPTOR)
  |  |  ------------------
  |  |  |  |   91|      0|#define SALT_DONOR_Neg    2
  |  |  ------------------
  |  |               #define SALT_DONOR_Neg2    (SALT_DONOR_Neg | SALT_p_ACCEPTOR)
  |  |  ------------------
  |  |  |  |   94|      0|#define SALT_p_ACCEPTOR  16  /* >C-S(-) */
  |  |  ------------------
  ------------------
                              ( !( s_subtype_all & SALT_DONOR_Neg2 ) || !( s_subtype_all & SALT_DONOR_H2 ) ) &&
  ------------------
  |  |   97|      0|#define SALT_DONOR_H2      (SALT_DONOR_H   | SALT_p_DONOR)
  |  |  ------------------
  |  |  |  |   90|      0|#define SALT_DONOR_H      1
  |  |  ------------------
  |  |               #define SALT_DONOR_H2      (SALT_DONOR_H   | SALT_p_DONOR)
  |  |  ------------------
  |  |  |  |   93|      0|#define SALT_p_DONOR      8  /* >C-SH   */
  |  |  ------------------
  ------------------
  |  Branch (3623:19): [True: 0, False: 0]
  |  Branch (3623:59): [True: 0, False: 0]
  ------------------
 3624|      0|                 !t_group_info->num_t_groups)
  ------------------
  |  Branch (3624:18): [True: 0, False: 0]
  ------------------
 3625|      0|            {
 3626|      0|                s_group_info->num_candidates = -1; /* no candidate exists */
 3627|      0|                return 0;
 3628|      0|            }
 3629|      0|        }
 3630|   110k|        else
 3631|   110k|        {
 3632|       |            /* normal salt mode: merge if both -XH and -X(-) are present */
 3633|   110k|            if (nNumCandidates <= 1 ||
  ------------------
  |  Branch (3633:17): [True: 110k, False: 4]
  ------------------
 3634|   110k|                ( !( s_subtype_all & SALT_DONOR_Neg2 ) || !( s_subtype_all & SALT_DONOR_H2 ) ))
  ------------------
  |  |   96|      4|#define SALT_DONOR_Neg2    (SALT_DONOR_Neg | SALT_p_ACCEPTOR)
  |  |  ------------------
  |  |  |  |   91|      4|#define SALT_DONOR_Neg    2
  |  |  ------------------
  |  |               #define SALT_DONOR_Neg2    (SALT_DONOR_Neg | SALT_p_ACCEPTOR)
  |  |  ------------------
  |  |  |  |   94|      4|#define SALT_p_ACCEPTOR  16  /* >C-S(-) */
  |  |  ------------------
  ------------------
                              ( !( s_subtype_all & SALT_DONOR_Neg2 ) || !( s_subtype_all & SALT_DONOR_H2 ) ))
  ------------------
  |  |   97|      4|#define SALT_DONOR_H2      (SALT_DONOR_H   | SALT_p_DONOR)
  |  |  ------------------
  |  |  |  |   90|      4|#define SALT_DONOR_H      1
  |  |  ------------------
  |  |               #define SALT_DONOR_H2      (SALT_DONOR_H   | SALT_p_DONOR)
  |  |  ------------------
  |  |  |  |   93|      4|#define SALT_p_DONOR      8  /* >C-SH   */
  |  |  ------------------
  ------------------
  |  Branch (3634:19): [True: 0, False: 4]
  |  Branch (3634:59): [True: 0, False: 4]
  ------------------
 3635|   110k|            {
 3636|   110k|                s_group_info->num_candidates = -1; /* no candidate exists */
 3637|   110k|                return 0;
 3638|   110k|            }
 3639|   110k|        }
 3640|       |        /* -- old code --
 3641|       |        if ( nNumCandidates <= 1 ||
 3642|       |        (((t_group_info->bTautFlags & TG_FLAG_ALLOW_NO_NEGTV_O) ||
 3643|       |        (t_group_info->tni.bNormalizationFlags & FLAG_FORCE_SALT_TAUT)) ?
 3644|       |        !(s_subtype_all & SALT_DONOR_ALL):
 3645|       |        !(s_subtype_all & SALT_DONOR_Neg2)
 3646|       |        )
 3647|       |        ) {
 3648|       |        s_group_info->num_candidates = -1;
 3649|       |        return 0;
 3650|       |        }
 3651|       |        */
 3652|      4|        if (!( s_subtype_all & ( SALT_DONOR_Neg2 ) ))
  ------------------
  |  |   96|      4|#define SALT_DONOR_Neg2    (SALT_DONOR_Neg | SALT_p_ACCEPTOR)
  |  |  ------------------
  |  |  |  |   91|      4|#define SALT_DONOR_Neg    2
  |  |  ------------------
  |  |               #define SALT_DONOR_Neg2    (SALT_DONOR_Neg | SALT_p_ACCEPTOR)
  |  |  ------------------
  |  |  |  |   94|      4|#define SALT_p_ACCEPTOR  16  /* >C-S(-) */
  |  |  ------------------
  ------------------
  |  Branch (3652:13): [True: 0, False: 4]
  ------------------
 3653|      0|        {
 3654|      0|            t_group_info->bTautFlagsDone |= TG_FLAG_ALLOW_NO_NEGTV_O_DONE;
  ------------------
  |  |  965|      0|#define TG_FLAG_ALLOW_NO_NEGTV_O_DONE    0x00000040
  ------------------
 3655|      0|        }
 3656|      4|        s_group_info->num_candidates = nNumCandidates;
 3657|      4|    }
 3658|       |
 3659|     12|    for (i = 0; i < s_group_info->num_candidates; i++)
  ------------------
  |  Branch (3659:17): [True: 8, False: 4]
  ------------------
 3660|      8|    {
 3661|      8|        iat = s_group_info->s_candidate[i].atnumber;
 3662|      8|        if (( s_group_info->s_candidate[i].subtype & SALT_ACCEPTOR ) && !at[iat].endpoint)
  ------------------
  |  |   92|      8|#define SALT_ACCEPTOR     4
  ------------------
  |  Branch (3662:13): [True: 0, False: 8]
  |  Branch (3662:73): [True: 0, False: 0]
  ------------------
 3663|      0|        {
 3664|      0|            continue; /* should not happen */
 3665|      0|        }
 3666|      8|        s_subtype_all |= s_group_info->s_candidate[i].subtype;
 3667|      8|        if (at[iat].endpoint != nCurTGroupNumber || !at[iat].endpoint)
  ------------------
  |  Branch (3667:13): [True: 4, False: 4]
  |  Branch (3667:53): [True: 4, False: 0]
  ------------------
 3668|      8|        {
 3669|      8|            nMinNumEndpoints++;
 3670|      8|        }
 3671|      8|        nCurTGroupNumber = (int) at[iat].endpoint;
 3672|      8|    }
 3673|      4|    if (nMinNumEndpoints <= 1)
  ------------------
  |  Branch (3673:9): [True: 0, False: 4]
  ------------------
 3674|      0|    {
 3675|      0|        return 0; /* too few endpoints */
 3676|      0|    }
 3677|       |
 3678|       |    /* Make sure we have enough memory */
 3679|      4|    if (nMinNumEndpoints > MAX_STACK_ARRAY_LEN)
  ------------------
  |  |  139|      4|#define MAX_STACK_ARRAY_LEN 127
  ------------------
  |  Branch (3679:9): [True: 0, False: 4]
  ------------------
 3680|      0|    {
 3681|      0|        if (!( EndPoint = (T_ENDPOINT *) inchi_calloc( nMinNumEndpoints, sizeof( EndPoint[0] ) ) ))
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  |  Branch (3681:13): [True: 0, False: 0]
  ------------------
 3682|      0|        {
 3683|       |            /*printf("BNS_OUT_OF_RAM-8\n");*/
 3684|      0|            return BNS_OUT_OF_RAM;
  ------------------
  |  |   77|      0|#define BNS_OUT_OF_RAM     (BNS_ERR +  1) /*(-9998)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3685|      0|        }
 3686|      0|    }
 3687|       |
 3688|      4|    nCurTGroupNumber = MAX_ATOMS;  /* impossible t-group number */
  ------------------
  |  |   43|      4|#define MAX_ATOMS  32766
  ------------------
 3689|     12|    for (i = j = 0; i < s_group_info->num_candidates; i++)
  ------------------
  |  Branch (3689:21): [True: 8, False: 4]
  ------------------
 3690|      8|    {
 3691|      8|        iat = s_group_info->s_candidate[i].atnumber;
 3692|      8|        if (s_group_info->s_candidate[i].subtype == SALT_ACCEPTOR && !at[iat].endpoint)
  ------------------
  |  |   92|     16|#define SALT_ACCEPTOR     4
  ------------------
  |  Branch (3692:13): [True: 0, False: 8]
  |  Branch (3692:70): [True: 0, False: 0]
  ------------------
 3693|      0|        {
 3694|      0|            continue;
 3695|      0|        }
 3696|      8|        if (at[iat].endpoint != nCurTGroupNumber || !at[iat].endpoint)
  ------------------
  |  Branch (3696:13): [True: 4, False: 4]
  |  Branch (3696:53): [True: 4, False: 0]
  ------------------
 3697|      8|        {
 3698|      8|            AddEndPoint( EndPoint + j, at, iat );
 3699|      8|            j++;
 3700|      8|        }
 3701|      8|        nCurTGroupNumber = (int) at[iat].endpoint;
 3702|      8|    }
 3703|       |
 3704|      4|    ret = RegisterEndPoints( pCG, t_group_info, EndPoint, j, at,
 3705|      4|                             num_atoms, c_group_info, pBNS );
 3706|       |
 3707|      4|    if (ret == -1)
  ------------------
  |  Branch (3707:9): [True: 0, False: 4]
  ------------------
 3708|      0|    {
 3709|      0|        ret = BNS_PROGRAM_ERR;
  ------------------
  |  |   78|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3710|      0|    }
 3711|       |
 3712|      4|    if (EndPoint != EndPointStackArray)
  ------------------
  |  Branch (3712:9): [True: 0, False: 4]
  ------------------
 3713|      0|    {
 3714|      0|        inchi_free( EndPoint );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3715|      0|    }
 3716|       |
 3717|      4|    return ret;
 3718|      4|}
MakeIsotopicHGroup:
 3726|     45|{
 3727|       |    /* All tautomeric atoms and all possible H+ donors and acceptors that have H */
 3728|     45|    int        i, j, k, n, bHasH, tg, nError = 0;
 3729|     45|    int        s_subtype_all, s_subtype_taut;
 3730|     45|    int        nMaxNumCandidates, nNumCandidates, nNumNonTautCandidates;
 3731|       |
 3732|       |
 3733|     45|    if (!s_group_info || !s_group_info->s_candidate || /*s_group_info->num_candidates <= 0 ||*/
  ------------------
  |  Branch (3733:9): [True: 0, False: 45]
  |  Branch (3733:26): [True: 0, False: 45]
  ------------------
 3734|     45|         !t_group_info || !t_group_info->t_group)
  ------------------
  |  Branch (3734:10): [True: 0, False: 45]
  |  Branch (3734:27): [True: 0, False: 45]
  ------------------
 3735|      0|    {
 3736|      0|        return 0;
 3737|      0|    }
 3738|     45|    nMaxNumCandidates = s_group_info->max_num_candidates;
 3739|     45|    s_subtype_all = s_subtype_taut = 0;
 3740|     45|    memset( t_group_info->num_iso_H, 0, sizeof( t_group_info->num_iso_H ) );
 3741|     45|    if (1 || ( s_group_info->num_candidates < 0 ))
  ------------------
  |  Branch (3741:9): [Folded - Ignored]
  |  Branch (3741:14): [True: 0, False: 0]
  ------------------
 3742|     45|    {
 3743|     45|        int s_type, s_subtype;
 3744|     45|        S_CANDIDATE *s_candidate = s_group_info->s_candidate;
 3745|  1.35k|        for (i = 0, nNumCandidates = nNumNonTautCandidates = 0; i < num_atoms; i++)
  ------------------
  |  Branch (3745:65): [True: 1.31k, False: 45]
  ------------------
 3746|  1.31k|        {
 3747|  1.31k|            s_subtype = 0;
 3748|  1.31k|            s_type = 0;
 3749|  1.31k|            if (at[i].endpoint)
  ------------------
  |  Branch (3749:17): [True: 4, False: 1.31k]
  ------------------
 3750|      4|            {
 3751|      4|                if (( tg = t_group_info->tGroupNumber[at[i].endpoint] ) &&
  ------------------
  |  Branch (3751:21): [True: 4, False: 0]
  ------------------
 3752|      4|                     at[i].endpoint == t_group_info->t_group[tg -= 1].nGroupNumber)
  ------------------
  |  Branch (3752:22): [True: 4, False: 0]
  ------------------
 3753|      4|                {
 3754|      4|                    bHasH = (int) t_group_info->t_group[tg].num[0] - (int) t_group_info->t_group[tg].num[1];
 3755|      4|                }
 3756|      0|                else
 3757|      0|                {
 3758|      0|                    nError = BNS_PROGRAM_ERR;
  ------------------
  |  |   78|      0|#define BNS_PROGRAM_ERR    (BNS_ERR +  2) /*(-9997)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3759|      0|                    break;
 3760|      0|                }
 3761|      4|            }
 3762|  1.31k|            else
 3763|  1.31k|            {
 3764|  1.31k|                bHasH = (int) at[i].num_H;
 3765|  1.31k|            }
 3766|  1.31k|            if (bHasH && at[i].endpoint || /* tautomeric atoms */
  ------------------
  |  Branch (3766:17): [True: 4, False: 1.31k]
  |  Branch (3766:26): [True: 4, False: 0]
  ------------------
 3767|       |                                           /* non-tautomeric heteroatoms that
 3768|       |                                           (a) have H and
 3769|       |                                           (b) may be donors of H
 3770|       |                                           therefore may exchange isotopic-non-isotopic H */
 3771|  1.31k|                 bHasH &&
  ------------------
  |  Branch (3771:18): [True: 0, False: 1.31k]
  ------------------
 3772|  1.31k|                 ( 0 == ( s_type = GetSaltChargeType( at, i, t_group_info, &s_subtype ) ) ||
  ------------------
  |  Branch (3772:20): [True: 0, False: 0]
  ------------------
 3773|       |                   /* -C=O or =C-OH, O = S, Se, Te */
 3774|       |
 3775|       |                   /*(t_group_info->tni.bNormalizationFlags & FLAG_FORCE_SALT_TAUT) &&*/
 3776|      0|                   1 == ( s_type = GetOtherSaltChargeType( at, i, t_group_info, &s_subtype, 1/* bAccept_O*/ ) ) ||
  ------------------
  |  Branch (3776:20): [True: 0, False: 0]
  ------------------
 3777|       |                   /* =Z-MH or -Z=M, Z = centerpoint, M = endpoint, other than above. M may be N */
 3778|       |
 3779|      0|                   2 == ( s_type = GetOtherSaltType( at, i, &s_subtype ) ) ||
  ------------------
  |  Branch (3779:20): [True: 0, False: 0]
  ------------------
 3780|       |                   /* >C-SH, >C-S(-); S=S,Se,Te */
 3781|       |
 3782|       |                   /* other proton donor or acceptor */
 3783|      0|                   bHasAcidicHydrogen( at, i ) && ( ( s_type = 3 ), ( s_subtype = SALT_p_DONOR ) ) ||
  ------------------
  |  |   93|      0|#define SALT_p_DONOR      8  /* >C-SH   */
  ------------------
  |  Branch (3783:20): [True: 0, False: 0]
  |  Branch (3783:51): [True: 0, False: 0]
  ------------------
 3784|      0|                   bHasAcidicMinus( at, i ) && ( ( s_type = 3 ), ( s_subtype = SALT_p_ACCEPTOR ) ) ||
  ------------------
  |  |   94|      0|#define SALT_p_ACCEPTOR  16  /* >C-S(-) */
  ------------------
  |  Branch (3784:20): [True: 0, False: 0]
  |  Branch (3784:48): [True: 0, False: 0]
  ------------------
 3785|      0|                   bHasOtherExchangableH( at, i ) && ( ( s_type = 3 ), ( s_subtype = SALT_DONOR_H ) ) )
  ------------------
  |  |   90|      0|#define SALT_DONOR_H      1
  ------------------
  |  Branch (3785:20): [True: 0, False: 0]
  |  Branch (3785:54): [True: 0, False: 0]
  ------------------
 3786|       |
 3787|  1.31k|                 )
 3788|      4|            {
 3789|      4|                if (nNumCandidates >= nMaxNumCandidates)
  ------------------
  |  Branch (3789:21): [True: 0, False: 4]
  ------------------
 3790|      0|                {
 3791|      0|                    return BNS_VERT_EDGE_OVFL;
  ------------------
  |  |   82|      0|#define BNS_VERT_EDGE_OVFL (BNS_ERR +  6) /*(-9993)*/
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  ------------------
 3792|      0|                }
 3793|      4|                s_candidate[nNumCandidates].atnumber = i;
 3794|      4|                s_candidate[nNumCandidates].type = s_type;
 3795|      4|                s_candidate[nNumCandidates].subtype = s_subtype;
 3796|      4|                s_candidate[nNumCandidates].endpoint = at[i].endpoint;
 3797|      4|                nNumCandidates++;
 3798|      4|                nNumNonTautCandidates += !at[i].endpoint;
 3799|      4|                s_subtype_all |= s_subtype;
 3800|      4|            }
 3801|  1.31k|        }
 3802|       |
 3803|     45|        if (nError)
  ------------------
  |  Branch (3803:13): [True: 0, False: 45]
  ------------------
 3804|      0|        {
 3805|      0|            return nError;
 3806|      0|        }
 3807|       |
 3808|     45|        if (nNumCandidates > 0)
  ------------------
  |  Branch (3808:13): [True: 2, False: 43]
  ------------------
 3809|      2|        {
 3810|      2|            t_group_info->nIsotopicEndpointAtomNumber = (AT_NUMB *) inchi_calloc( nNumNonTautCandidates + 1, sizeof( t_group_info->nIsotopicEndpointAtomNumber[0] ) );
  ------------------
  |  | 1133|      2|#define inchi_calloc   calloc
  ------------------
 3811|      2|            t_group_info->nIsotopicEndpointAtomNumber[0] = nNumNonTautCandidates;
 3812|      6|            for (i = 0, n = 1; i < nNumCandidates; i++)
  ------------------
  |  Branch (3812:32): [True: 4, False: 2]
  ------------------
 3813|      4|            {
 3814|      4|                k = s_candidate[i].atnumber;
 3815|      4|                if (!at[k].endpoint)
  ------------------
  |  Branch (3815:21): [True: 0, False: 4]
  ------------------
 3816|      0|                {
 3817|      0|                    t_group_info->nIsotopicEndpointAtomNumber[n++] = k;
 3818|      0|                }
 3819|     16|                for (j = 0; j < NUM_H_ISOTOPES; j++)
  ------------------
  |  |   53|     16|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (3819:29): [True: 12, False: 4]
  ------------------
 3820|     12|                {
 3821|     12|                    t_group_info->num_iso_H[j] += at[k].num_iso_H[j];
 3822|     12|                }
 3823|      4|                at[k].cFlags |= AT_FLAG_ISO_H_POINT;
  ------------------
  |  |   82|      4|#define AT_FLAG_ISO_H_POINT 0x01  /* may have isotopic H */
  ------------------
 3824|      4|            }
 3825|      2|            t_group_info->nNumIsotopicEndpoints = nNumNonTautCandidates + 1;
 3826|      2|        }
 3827|     45|    }
 3828|       |
 3829|     45|    return nNumCandidates;
 3830|     45|}
MarkTautomerGroups:
 3906|   110k|{
 3907|   110k|    int i, j, k, m, endpoint_valence, centerpoint, endpoint, bond_type, nMobile, num_changes = 0, tot_changes = 0;
 3908|   110k|    T_ENDPOINT EndPoint[MAXVAL];
 3909|   110k|    T_BONDPOS  BondPos[MAXVAL];
 3910|   110k|    AT_NUMB    nGroupNumber;
 3911|   110k|    int        bDiffGroups;
 3912|   110k|    int  nNumEndPoints, nNumBondPos, nNumPossibleMobile;
 3913|   110k|    int  bTautBond, bNonTautBond, bAltBond;
 3914|   110k|    int  nNumDonor, nNumAcceptor, bPossiblyEndpoint;
 3915|   110k|    T_GROUP *t_group;
 3916|   110k|    int *pnum_t, max_num_t, bIgnoreIsotopic;
 3917|   110k|    ENDPOINT_INFO eif1, eif2;
 3918|   110k|    int nErr = 0;
 3919|   110k|#define ALLOWED_EDGE(PBNS, IAT,IBOND)  ( !(PBNS) || !(PBNS)->edge || !(PBNS)->vert || !(PBNS)->edge[(PBNS)->vert[IAT].iedge[IBOND]].forbidden)
 3920|   110k|#define ACTUAL_ORDER(PBNS, IAT,IBOND, BTYPE)  ( ((PBNS) && (PBNS)->edge && (PBNS)->vert &&\
 3921|   110k|    ((BTYPE)==BOND_ALT_123 || (BTYPE)==BOND_ALT_13 || (BTYPE)==BOND_ALT_23))? (PBNS)->edge[(PBNS)->vert[IAT].iedge[IBOND]].flow+BOND_TYPE_SINGLE:(BTYPE))
 3922|       |
 3923|       |
 3924|   110k|    if (!t_group_info || !( t_group_info->bTautFlags & TG_FLAG_TEST_TAUT__ATOMS ))
  ------------------
  |  |  921|   110k|#define TG_FLAG_TEST_TAUT__ATOMS         0x00000001   /* find regular tautomerism */
  ------------------
  |  Branch (3924:9): [True: 3, False: 110k]
  |  Branch (3924:26): [True: 0, False: 110k]
  ------------------
 3925|      3|    {
 3926|      3|        return 0;
 3927|      3|    }
 3928|       |
 3929|       |    /*  Initial t_group allocation */
 3930|   110k|    if (!t_group_info->t_group && !t_group_info->max_num_t_groups)
  ------------------
  |  Branch (3930:9): [True: 110k, False: 0]
  |  Branch (3930:35): [True: 110k, False: 0]
  ------------------
 3931|   110k|    {
 3932|   110k|        INCHI_MODE bTautFlags = t_group_info->bTautFlags;       /*  save initial setting */
 3933|   110k|        INCHI_MODE bTautFlagsDone = t_group_info->bTautFlagsDone;   /*  save previous findings, if any */
 3934|   110k|        TNI       tni = t_group_info->tni;
 3935|   110k|        AT_NUMB   *tGroupNumber = t_group_info->tGroupNumber;
 3936|   110k|        bIgnoreIsotopic = t_group_info->bIgnoreIsotopic;
 3937|   110k|        memset( t_group_info, 0, sizeof( *t_group_info ) );
 3938|   110k|        t_group_info->bIgnoreIsotopic = bIgnoreIsotopic; /*  restore initial setting */
 3939|   110k|        t_group_info->bTautFlags = bTautFlags;
 3940|   110k|        t_group_info->bTautFlagsDone = bTautFlagsDone;
 3941|   110k|        t_group_info->tni = tni;
 3942|   110k|        t_group_info->tGroupNumber = tGroupNumber;
 3943|   110k|        t_group_info->max_num_t_groups = num_atoms / 2 + 1; /*  upper limit */
 3944|   110k|        if (!( t_group_info->t_group = (T_GROUP*) inchi_calloc( t_group_info->max_num_t_groups, sizeof( t_group[0] ) ) ))
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
  |  Branch (3944:13): [True: 0, False: 110k]
  ------------------
 3945|      0|        {
 3946|      0|            return ( t_group_info->max_num_t_groups = -1 ); /*  failed, out of RAM */
 3947|      0|        }
 3948|   110k|    }
 3949|       |
 3950|       |    /*  Check if t_group_info exists */
 3951|   110k|    if (!t_group_info->t_group || !t_group_info->max_num_t_groups)
  ------------------
  |  Branch (3951:9): [True: 0, False: 110k]
  |  Branch (3951:35): [True: 0, False: 110k]
  ------------------
 3952|      0|    {
 3953|      0|        return 0;
 3954|      0|    }
 3955|       |
 3956|   110k|    if (0 > t_group_info->max_num_t_groups)
  ------------------
  |  Branch (3956:9): [True: 0, False: 110k]
  ------------------
 3957|      0|    {
 3958|      0|        return t_group_info->max_num_t_groups;
 3959|      0|    }
 3960|       |
 3961|   110k|    pnum_t = &t_group_info->num_t_groups; /*  number of found tautomer endpoint groups */
 3962|   110k|    t_group = t_group_info->t_group;
 3963|   110k|    max_num_t = t_group_info->max_num_t_groups;
 3964|   110k|    bIgnoreIsotopic = t_group_info->bIgnoreIsotopic;
 3965|       |
 3966|       |    /*  1-3 tautomers */
 3967|   222k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (3967:17): [True: 112k, False: 110k]
  ------------------
 3968|   112k|    {
 3969|       |        /*  Find possible endpoint Z = at[i] */
 3970|   112k|        if (endpoint_valence = nGetEndpointInfo( at, i, &eif1 ))
  ------------------
  |  Branch (3970:13): [True: 12, False: 112k]
  ------------------
 3971|     12|        {
 3972|       |            /*  1st endpoint candidate found. Find centerpoint candidate */
 3973|     26|            for (j = 0; j < at[i].valence; j++)
  ------------------
  |  Branch (3973:25): [True: 14, False: 12]
  ------------------
 3974|     14|            {
 3975|     14|                bond_type = (int) at[i].bond_type[j] & ~BOND_MARK_ALL;
  ------------------
  |  |  219|     14|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 3976|       |#if ( FIX_BOND23_IN_TAUT == 1 )
 3977|       |                bond_type = ACTUAL_ORDER( pBNS, i, j, bond_type );
 3978|       |#endif
 3979|     14|                centerpoint = (int) at[i].neighbor[j];  /*  a centerpoint candidate */
 3980|     14|                if (( bond_type == BOND_DOUBLE ||
  ------------------
  |  |  206|     14|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   61|     28|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (3980:23): [True: 0, False: 14]
  ------------------
 3981|     14|                      bond_type == BOND_ALTERN ||
  ------------------
  |  |  208|     14|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   63|     28|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (3981:23): [True: 0, False: 14]
  ------------------
 3982|     14|                      bond_type == BOND_ALT12NS ||
  ------------------
  |  |  214|     28|#define BOND_ALT12NS             9
  ------------------
  |  Branch (3982:23): [True: 0, False: 14]
  ------------------
 3983|     14|                      bond_type == BOND_TAUTOM ) && is_centerpoint_elem( at[centerpoint].el_number )
  ------------------
  |  |  213|     14|#define BOND_TAUTOM              8
  ------------------
  |  Branch (3983:23): [True: 0, False: 14]
  |  Branch (3983:53): [True: 0, False: 0]
  ------------------
 3984|     14|                     && ALLOWED_EDGE( pBNS, i, j )
  ------------------
  |  | 3919|      0|#define ALLOWED_EDGE(PBNS, IAT,IBOND)  ( !(PBNS) || !(PBNS)->edge || !(PBNS)->vert || !(PBNS)->edge[(PBNS)->vert[IAT].iedge[IBOND]].forbidden)
  |  |  ------------------
  |  |  |  Branch (3919:42): [True: 0, False: 0]
  |  |  |  Branch (3919:53): [True: 0, False: 0]
  |  |  |  Branch (3919:70): [True: 0, False: 0]
  |  |  |  Branch (3919:87): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3985|     14|                     )
 3986|      0|                {
 3987|       |                    /*  Test a centerpoint candidate. */
 3988|       |                    /*  find all endpoints including at[i] and store them into EndPoint[] */
 3989|      0|                    nNumPossibleMobile = 0;
 3990|      0|                    nGroupNumber = (AT_NUMB) num_atoms; /*  greater than any tautomeric group number */
 3991|      0|                    bDiffGroups = -1;         /*  ignore the first difference */
 3992|      0|                    nNumDonor = nNumAcceptor = 0;
 3993|      0|                    for (k = 0, nNumEndPoints = 0, nNumBondPos = 0; k < at[centerpoint].valence; k++)
  ------------------
  |  Branch (3993:69): [True: 0, False: 0]
  ------------------
 3994|      0|                    {
 3995|      0|                        endpoint = at[centerpoint].neighbor[k]; /*  endpoint candidate */
 3996|      0|                        bond_type = (int) at[centerpoint].bond_type[k] & ~BOND_MARK_ALL;
  ------------------
  |  |  219|      0|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 3997|       |#if ( FIX_BOND23_IN_TAUT == 1 )
 3998|       |                        bond_type = ACTUAL_ORDER( pBNS, centerpoint, k, bond_type );
 3999|       |#endif
 4000|      0|                        bTautBond =
 4001|      0|                            bNonTautBond =
 4002|      0|                            bAltBond =
 4003|      0|                            bPossiblyEndpoint = 0;
 4004|      0|                        if (!ALLOWED_EDGE( pBNS, centerpoint, k ))
  ------------------
  |  | 3919|      0|#define ALLOWED_EDGE(PBNS, IAT,IBOND)  ( !(PBNS) || !(PBNS)->edge || !(PBNS)->vert || !(PBNS)->edge[(PBNS)->vert[IAT].iedge[IBOND]].forbidden)
  |  |  ------------------
  |  |  |  Branch (3919:42): [True: 0, False: 0]
  |  |  |  Branch (3919:53): [True: 0, False: 0]
  |  |  |  Branch (3919:70): [True: 0, False: 0]
  |  |  |  Branch (3919:87): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4005|      0|                        {
 4006|      0|                            continue;
 4007|      0|                        }
 4008|      0|                        else
 4009|      0|                        {
 4010|      0|                            if (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_TAUTOM)
  ------------------
  |  |  208|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   63|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
                                          if (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_TAUTOM)
  ------------------
  |  |  214|      0|#define BOND_ALT12NS             9
  ------------------
                                          if (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_TAUTOM)
  ------------------
  |  |  213|      0|#define BOND_TAUTOM              8
  ------------------
  |  Branch (4010:33): [True: 0, False: 0]
  |  Branch (4010:61): [True: 0, False: 0]
  |  Branch (4010:90): [True: 0, False: 0]
  ------------------
 4011|      0|                            {
 4012|      0|                                bTautBond = 1;
 4013|      0|#if ( REPLACE_ALT_WITH_TAUT == 1 )
 4014|      0|                                bAltBond = ( bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS );
  ------------------
  |  |  208|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   63|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
                                              bAltBond = ( bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS );
  ------------------
  |  |  214|      0|#define BOND_ALT12NS             9
  ------------------
  |  Branch (4014:46): [True: 0, False: 0]
  |  Branch (4014:74): [True: 0, False: 0]
  ------------------
 4015|      0|#endif
 4016|      0|                            }
 4017|      0|                            else
 4018|      0|                            {
 4019|      0|                                if (bond_type == BOND_SINGLE || bond_type == BOND_DOUBLE)
  ------------------
  |  |  205|      0|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
                                              if (bond_type == BOND_SINGLE || bond_type == BOND_DOUBLE)
  ------------------
  |  |  206|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (4019:37): [True: 0, False: 0]
  |  Branch (4019:65): [True: 0, False: 0]
  ------------------
 4020|      0|                                {
 4021|      0|                                    bNonTautBond = 1;
 4022|      0|                                }
 4023|      0|                                else
 4024|      0|                                {
 4025|      0|                                    continue;
 4026|      0|                                }
 4027|      0|                            }
 4028|      0|                        }
 4029|       |
 4030|      0|                        if (!( endpoint_valence = nGetEndpointInfo( at, endpoint, &eif1 ) ))
  ------------------
  |  Branch (4030:29): [True: 0, False: 0]
  ------------------
 4031|      0|                            continue; /*  not an endpoint element or can't have mobile groups */
 4032|       |                                      /*  save information about the found possible tautomeric endpoint */
 4033|       |                                      /*  2 = T_NUM_NO_ISOTOPIC non-isotopic values */
 4034|      0|                        nMobile =
 4035|      0|                            AddAtom2num( EndPoint[nNumEndPoints].num, at, endpoint, 2 ); /* fill out */
 4036|      0|                        AddAtom2DA( EndPoint[nNumEndPoints].num_DA, at, endpoint, 2 );
 4037|       |                        /* --- why is isitopic info missing ? -- see below
 4038|       |                        nMobile  = EndPoint[nNumEndPoints].num[1] = (at[endpoint].charge == -1);
 4039|       |                        nMobile  = EndPoint[nNumEndPoints].num[0] = at[endpoint].num_H + nMobile;
 4040|       |                        */
 4041|      0|                        if (bNonTautBond)
  ------------------
  |  Branch (4041:29): [True: 0, False: 0]
  ------------------
 4042|      0|                        {
 4043|      0|                            m = ( bond_type == BOND_SINGLE && ( nMobile || at[endpoint].endpoint ) );
  ------------------
  |  |  205|      0|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (4043:35): [True: 0, False: 0]
  |  Branch (4043:65): [True: 0, False: 0]
  |  Branch (4043:76): [True: 0, False: 0]
  ------------------
 4044|      0|                            nNumDonor += m;
 4045|      0|                            bPossiblyEndpoint += m;
 4046|      0|                            m = ( bond_type == BOND_DOUBLE );
  ------------------
  |  |  206|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
 4047|      0|                            nNumAcceptor += m;
 4048|      0|                            bPossiblyEndpoint += m;
 4049|      0|                        }
 4050|      0|                        else
 4051|      0|                        {
 4052|       |                            /*  Tautomeric or alternating bond */
 4053|      0|                            m = ( 0 != at[endpoint].endpoint || eif1.cDonor );
  ------------------
  |  Branch (4053:35): [True: 0, False: 0]
  |  Branch (4053:65): [True: 0, False: 0]
  ------------------
 4054|      0|                            nNumDonor += m;
 4055|      0|                            bPossiblyEndpoint += m;
 4056|      0|                            m = ( at[endpoint].endpoint ||
  ------------------
  |  Branch (4056:35): [True: 0, False: 0]
  ------------------
 4057|      0|                                  eif1.cNeutralBondsValence > at[endpoint].valence );
  ------------------
  |  Branch (4057:35): [True: 0, False: 0]
  ------------------
 4058|      0|                            nNumAcceptor += m;
 4059|      0|                            bPossiblyEndpoint += m;
 4060|      0|                        }
 4061|      0|                        if (!bPossiblyEndpoint)
  ------------------
  |  Branch (4061:29): [True: 0, False: 0]
  ------------------
 4062|      0|                        {
 4063|      0|                            continue;
 4064|      0|                        }
 4065|      0|                        EndPoint[nNumEndPoints].nGroupNumber = at[endpoint].endpoint; /* =0 if it is an endpoint for the 1st time */
 4066|      0|                        EndPoint[nNumEndPoints].nEquNumber = 0;
 4067|      0|                        EndPoint[nNumEndPoints].nAtomNumber = (AT_NUMB) endpoint;
 4068|      0|                        if (nGroupNumber != at[endpoint].endpoint)
  ------------------
  |  Branch (4068:29): [True: 0, False: 0]
  ------------------
 4069|      0|                        {
 4070|      0|                            bDiffGroups++;
 4071|      0|                            nGroupNumber = at[endpoint].endpoint;
 4072|      0|                        }
 4073|       |
 4074|       |                        /*  save positions of all, not only possibly tautomeric bonds */
 4075|       |#if ( REPLACE_ALT_WITH_TAUT != 1 )
 4076|       |                        if (bNonTautBond || bAltBond)
 4077|       |                        {
 4078|       |#endif
 4079|      0|                            BondPos[nNumBondPos].nAtomNumber = (AT_NUMB) centerpoint;
 4080|      0|                            BondPos[nNumBondPos].neighbor_index = (AT_NUMB) k; /* bond ordering number; used to change bonds to tautomeric only  */
 4081|      0|                            nNumBondPos++;
 4082|       |#if ( REPLACE_ALT_WITH_TAUT != 1 )
 4083|       |                        }
 4084|       |#endif
 4085|       |                        /*  mobile group is possible if (a) the endpoint has a mobile group or */
 4086|       |                        /*                              (b) the centerpoint is adjacent to another endpoint */
 4087|      0|                        nNumPossibleMobile += ( nMobile > 0 || at[endpoint].endpoint );
  ------------------
  |  Branch (4087:49): [True: 0, False: 0]
  |  Branch (4087:64): [True: 0, False: 0]
  ------------------
 4088|      0|                        nNumEndPoints++;
 4089|       |                        /*printf("Found %d %d %d %d\n", centerpoint+1, at[centerpoint].el_number, endpoint+1, at[endpoint].el_number);*/
 4090|      0|                    }
 4091|      0|                    if (nNumEndPoints > 1 && nNumPossibleMobile && nNumDonor && nNumAcceptor)
  ------------------
  |  Branch (4091:25): [True: 0, False: 0]
  |  Branch (4091:46): [True: 0, False: 0]
  |  Branch (4091:68): [True: 0, False: 0]
  |  Branch (4091:81): [True: 0, False: 0]
  ------------------
 4092|      0|                    {
 4093|       |                        /*
 4094|       |                        * a tautomeric group has been found
 4095|       |                        *
 4096|       |                        * at this point:
 4097|       |                        * nGroupNumber = 0 if all endpoints belong to a newly discovered tautomeric group
 4098|       |                        * bDiffGroups  > 0 if at least 2 tautomeric groups are to be merged (one of them can be new)
 4099|       |                        * case (nGroupNumber != 0 && bDiffGroups = 0 ) ignored because all endpoints belong to the same known t-group
 4100|       |                        * case (nGroupNumber != 0 && bDiffGroups < 0 ) cannot happen
 4101|       |                        */
 4102|       |
 4103|      0|                        nErr = FindAccessibleEndPoints( pCG, EndPoint,
 4104|      0|                                                        &nNumEndPoints,
 4105|      0|                                                        BondPos, &nNumBondPos,
 4106|      0|                                                        pBNS, pBD, at,
 4107|      0|                                                        num_atoms, c_group_info,
 4108|      0|                                                        ALT_PATH_MODE_TAUTOM );
  ------------------
  |  |  338|      0|#define ALT_PATH_MODE_TAUTOM     1
  ------------------
 4109|       |
 4110|      0|                        if (IS_BNS_ERROR( nErr ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4111|      0|                        {
 4112|      0|                            return nErr;
 4113|      0|                        }
 4114|      0|                        nErr = 0;
 4115|      0|                        if (nNumEndPoints > 0) {
  ------------------
  |  Branch (4115:29): [True: 0, False: 0]
  ------------------
 4116|      0|                            if (!nGroupNumber || bDiffGroups > 0) {
  ------------------
  |  Branch (4116:33): [True: 0, False: 0]
  |  Branch (4116:50): [True: 0, False: 0]
  ------------------
 4117|       |
 4118|      0|                                num_changes = RegisterEndPoints(pCG, t_group_info, EndPoint, nNumEndPoints, at, num_atoms, c_group_info, pBNS);
 4119|      0|                                if (num_changes == -1) {
  ------------------
  |  Branch (4119:37): [True: 0, False: 0]
  ------------------
 4120|      0|                                    nErr = CT_TAUCOUNT_ERR;
  ------------------
  |  |   52|      0|#define CT_TAUCOUNT_ERR      (CT_ERR_FIRST- 5)  /*(-30005) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 4121|      0|                                }
 4122|      0|                                if (num_changes < 0) {
  ------------------
  |  Branch (4122:37): [True: 0, False: 0]
  ------------------
 4123|      0|                                    nErr = num_changes;
 4124|      0|                                }
 4125|      0|                                if (nErr)
  ------------------
  |  Branch (4125:37): [True: 0, False: 0]
  ------------------
 4126|      0|                                    goto exit_function;
 4127|      0|                                tot_changes += (num_changes>0);
 4128|      0|                            }
 4129|      0|                            if (nNumBondPos > 0) {
  ------------------
  |  Branch (4129:33): [True: 0, False: 0]
  ------------------
 4130|       |                                /*  some of the bonds have not been marked as tautomeric yet */
 4131|      0|                                num_changes = SetTautomericBonds(at, nNumBondPos, BondPos);
 4132|      0|                                tot_changes += (num_changes>0);
 4133|      0|                            }
 4134|      0|                        }
 4135|      0|                    }
 4136|      0|                }
 4137|     14|            }
 4138|     12|        }
 4139|   112k|    }
 4140|       |
 4141|       |
 4142|   110k|#if ( KETO_ENOL_TAUT == 1 )  /***** post v.1 feature *****/
 4143|   110k|    if (t_group_info->bTautFlags & TG_FLAG_KETO_ENOL_TAUT)
  ------------------
  |  |  949|   110k|#define TG_FLAG_KETO_ENOL_TAUT           0x00080000   /* turn on keto-enol tautomerism detection */
  ------------------
  |  Branch (4143:9): [True: 0, False: 110k]
  ------------------
 4144|      0|    {
 4145|       |        /* 1,3 keto-enol tautomerism */
 4146|      0|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (4146:21): [True: 0, False: 0]
  ------------------
 4147|      0|        {
 4148|       |            /*  Find possible endpoint Z = at[i] */
 4149|      0|            if (endpoint_valence = nGetEndpointInfo_KET( at, i, &eif1 ))
  ------------------
  |  Branch (4149:17): [True: 0, False: 0]
  ------------------
 4150|      0|            {
 4151|       |                /*  1st endpoint candidate found. Find centerpoint candidate */
 4152|      0|                for (j = 0; j < at[i].valence; j++)
  ------------------
  |  Branch (4152:29): [True: 0, False: 0]
  ------------------
 4153|      0|                {
 4154|      0|                    bond_type = (int) at[i].bond_type[j] & ~BOND_MARK_ALL;
  ------------------
  |  |  219|      0|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 4155|       |#if ( FIX_BOND23_IN_TAUT == 1 )
 4156|       |                    bond_type = ACTUAL_ORDER( pBNS, i, j, bond_type );
 4157|       |#endif
 4158|      0|                    centerpoint = (int) at[i].neighbor[j];  /*  a centerpoint candidate */
 4159|      0|                    if (( bond_type == BOND_DOUBLE ||
  ------------------
  |  |  206|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (4159:27): [True: 0, False: 0]
  ------------------
 4160|      0|                          bond_type == BOND_ALTERN ||
  ------------------
  |  |  208|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   63|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (4160:27): [True: 0, False: 0]
  ------------------
 4161|      0|                          bond_type == BOND_ALT12NS ||
  ------------------
  |  |  214|      0|#define BOND_ALT12NS             9
  ------------------
  |  Branch (4161:27): [True: 0, False: 0]
  ------------------
 4162|      0|                          bond_type == BOND_TAUTOM ) &&
  ------------------
  |  |  213|      0|#define BOND_TAUTOM              8
  ------------------
  |  Branch (4162:27): [True: 0, False: 0]
  ------------------
 4163|      0|                         is_centerpoint_elem_KET( at[centerpoint].el_number ) &&
  ------------------
  |  Branch (4163:26): [True: 0, False: 0]
  ------------------
 4164|      0|                         !at[centerpoint].charge && !at[centerpoint].radical &&
  ------------------
  |  Branch (4164:26): [True: 0, False: 0]
  |  Branch (4164:53): [True: 0, False: 0]
  ------------------
 4165|       |                         /* only normal carbon is allowed */
 4166|      0|                         4 == at[centerpoint].chem_bonds_valence + at[centerpoint].num_H
  ------------------
  |  Branch (4166:26): [True: 0, False: 0]
  ------------------
 4167|      0|                         && ALLOWED_EDGE( pBNS, i, j ))
  ------------------
  |  | 3919|      0|#define ALLOWED_EDGE(PBNS, IAT,IBOND)  ( !(PBNS) || !(PBNS)->edge || !(PBNS)->vert || !(PBNS)->edge[(PBNS)->vert[IAT].iedge[IBOND]].forbidden)
  |  |  ------------------
  |  |  |  Branch (3919:42): [True: 0, False: 0]
  |  |  |  Branch (3919:53): [True: 0, False: 0]
  |  |  |  Branch (3919:70): [True: 0, False: 0]
  |  |  |  Branch (3919:87): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4168|      0|                    {
 4169|      0|                        int num_O = 0;
 4170|      0|                        int num_C = 0;
 4171|       |                        /*  Test a centerpoint candidate. */
 4172|       |                        /*  find all endpoints including at[i] and store them into EndPoint[] */
 4173|      0|                        nNumPossibleMobile = 0;
 4174|      0|                        nGroupNumber = (AT_NUMB) num_atoms; /*  greater than any tautomeric group number */
 4175|      0|                        bDiffGroups = -1;         /*  ignore the first difference */
 4176|      0|                        nNumDonor = nNumAcceptor = 0;
 4177|      0|                        for (k = 0, nNumEndPoints = 0, nNumBondPos = 0; k < at[centerpoint].valence; k++)
  ------------------
  |  Branch (4177:73): [True: 0, False: 0]
  ------------------
 4178|      0|                        {
 4179|      0|                            endpoint = at[centerpoint].neighbor[k]; /*  endpoint candidate */
 4180|      0|                            bond_type = (int) at[centerpoint].bond_type[k] & ~BOND_MARK_ALL;
  ------------------
  |  |  219|      0|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 4181|       |#if ( FIX_BOND23_IN_TAUT == 1 )
 4182|       |                            bond_type = ACTUAL_ORDER( pBNS, centerpoint, k, bond_type );
 4183|       |#endif
 4184|      0|                            bTautBond =
 4185|      0|                                bNonTautBond =
 4186|      0|                                bAltBond =
 4187|      0|                                bPossiblyEndpoint = 0;
 4188|      0|                            if (!ALLOWED_EDGE( pBNS, centerpoint, k ))
  ------------------
  |  | 3919|      0|#define ALLOWED_EDGE(PBNS, IAT,IBOND)  ( !(PBNS) || !(PBNS)->edge || !(PBNS)->vert || !(PBNS)->edge[(PBNS)->vert[IAT].iedge[IBOND]].forbidden)
  |  |  ------------------
  |  |  |  Branch (3919:42): [True: 0, False: 0]
  |  |  |  Branch (3919:53): [True: 0, False: 0]
  |  |  |  Branch (3919:70): [True: 0, False: 0]
  |  |  |  Branch (3919:87): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4189|      0|                            {
 4190|      0|                                continue;
 4191|      0|                            }
 4192|      0|                            else
 4193|      0|                            {
 4194|      0|                                if (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_TAUTOM)
  ------------------
  |  |  208|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   63|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
                                              if (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_TAUTOM)
  ------------------
  |  |  214|      0|#define BOND_ALT12NS             9
  ------------------
                                              if (bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS || bond_type == BOND_TAUTOM)
  ------------------
  |  |  213|      0|#define BOND_TAUTOM              8
  ------------------
  |  Branch (4194:37): [True: 0, False: 0]
  |  Branch (4194:65): [True: 0, False: 0]
  |  Branch (4194:94): [True: 0, False: 0]
  ------------------
 4195|      0|                                {
 4196|      0|                                    bTautBond = 1;
 4197|      0|#if ( REPLACE_ALT_WITH_TAUT == 1 )
 4198|      0|                                    bAltBond = ( bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS );
  ------------------
  |  |  208|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   63|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
                                                  bAltBond = ( bond_type == BOND_ALTERN || bond_type == BOND_ALT12NS );
  ------------------
  |  |  214|      0|#define BOND_ALT12NS             9
  ------------------
  |  Branch (4198:50): [True: 0, False: 0]
  |  Branch (4198:78): [True: 0, False: 0]
  ------------------
 4199|      0|#endif
 4200|      0|                                }
 4201|      0|                                else
 4202|      0|                                {
 4203|      0|                                    if (bond_type == BOND_SINGLE || bond_type == BOND_DOUBLE)
  ------------------
  |  |  205|      0|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
                                                  if (bond_type == BOND_SINGLE || bond_type == BOND_DOUBLE)
  ------------------
  |  |  206|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (4203:41): [True: 0, False: 0]
  |  Branch (4203:69): [True: 0, False: 0]
  ------------------
 4204|      0|                                    {
 4205|      0|                                        bNonTautBond = 1;
 4206|      0|                                    }
 4207|      0|                                    else
 4208|      0|                                    {
 4209|      0|                                        continue;
 4210|      0|                                    }
 4211|      0|                                }
 4212|      0|                            }
 4213|       |
 4214|      0|                            if (!( endpoint_valence = nGetEndpointInfo_KET( at, endpoint, &eif2 ) ))
  ------------------
  |  Branch (4214:33): [True: 0, False: 0]
  ------------------
 4215|      0|                            {
 4216|      0|                                continue;
 4217|      0|                            }
 4218|       |                            /*
 4219|       |                            if ( 3 != eif1.cKetoEnolCode + eif2.cKetoEnolCode && endpoint != i )
 4220|       |                            continue;
 4221|       |                            */
 4222|       |                            /*  save information about the found possible tautomeric endpoint */
 4223|       |                            /*  2 = T_NUM_NO_ISOTOPIC non-isotopic values */
 4224|      0|                            nMobile =
 4225|      0|                                AddAtom2num( EndPoint[nNumEndPoints].num, at, endpoint, 2 ); /* fill out */
 4226|      0|                            AddAtom2DA( EndPoint[nNumEndPoints].num_DA, at, endpoint, 2 );
 4227|       |                            /* --- why is isitopic info missing ? -- see below
 4228|       |                            nMobile  = EndPoint[nNumEndPoints].num[1] = (at[endpoint].charge == -1);
 4229|       |                            nMobile  = EndPoint[nNumEndPoints].num[0] = at[endpoint].num_H + nMobile;
 4230|       |                            */
 4231|      0|                            if (bNonTautBond)
  ------------------
  |  Branch (4231:33): [True: 0, False: 0]
  ------------------
 4232|      0|                            {
 4233|      0|                                m = ( bond_type == BOND_SINGLE && ( nMobile || at[endpoint].endpoint ) );
  ------------------
  |  |  205|      0|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (4233:39): [True: 0, False: 0]
  |  Branch (4233:69): [True: 0, False: 0]
  |  Branch (4233:80): [True: 0, False: 0]
  ------------------
 4234|      0|                                nNumDonor += m;
 4235|      0|                                bPossiblyEndpoint += m;
 4236|      0|                                m = ( bond_type == BOND_DOUBLE );
  ------------------
  |  |  206|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
 4237|      0|                                nNumAcceptor += m;
 4238|      0|                                bPossiblyEndpoint += m;
 4239|      0|                            }
 4240|      0|                            else
 4241|      0|                            {
 4242|       |                                /*  Tautomeric or alternating bond */
 4243|      0|                                m = ( 0 != at[endpoint].endpoint || eif1.cDonor );
  ------------------
  |  Branch (4243:39): [True: 0, False: 0]
  |  Branch (4243:69): [True: 0, False: 0]
  ------------------
 4244|      0|                                nNumDonor += m;
 4245|      0|                                bPossiblyEndpoint += m;
 4246|      0|                                m = ( at[endpoint].endpoint ||
  ------------------
  |  Branch (4246:39): [True: 0, False: 0]
  ------------------
 4247|      0|                                      eif1.cNeutralBondsValence > at[endpoint].valence );
  ------------------
  |  Branch (4247:39): [True: 0, False: 0]
  ------------------
 4248|      0|                                nNumAcceptor += m;
 4249|      0|                                bPossiblyEndpoint += m;
 4250|      0|                            }
 4251|      0|                            if (!bPossiblyEndpoint)
  ------------------
  |  Branch (4251:33): [True: 0, False: 0]
  ------------------
 4252|      0|                            {
 4253|      0|                                continue;
 4254|      0|                            }
 4255|       |
 4256|      0|                            num_O += ( endpoint_valence == 2 );
 4257|      0|                            num_C += ( endpoint_valence == 4 );
 4258|       |
 4259|      0|                            EndPoint[nNumEndPoints].nGroupNumber = at[endpoint].endpoint; /* =0 if it is an endpoint for the 1st time */
 4260|      0|                            EndPoint[nNumEndPoints].nEquNumber = 0;
 4261|      0|                            EndPoint[nNumEndPoints].nAtomNumber = (AT_NUMB) endpoint;
 4262|      0|                            if (nGroupNumber != at[endpoint].endpoint)
  ------------------
  |  Branch (4262:33): [True: 0, False: 0]
  ------------------
 4263|      0|                            {
 4264|      0|                                bDiffGroups++;
 4265|      0|                                nGroupNumber = at[endpoint].endpoint;
 4266|      0|                            }
 4267|       |
 4268|       |                            /*  Save positions of all, not only possibly tautomeric bonds */
 4269|       |#if ( REPLACE_ALT_WITH_TAUT != 1 )
 4270|       |                            if (bNonTautBond || bAltBond)
 4271|       |                            {
 4272|       |#endif
 4273|      0|                                BondPos[nNumBondPos].nAtomNumber = (AT_NUMB) centerpoint;
 4274|      0|                                BondPos[nNumBondPos].neighbor_index = (AT_NUMB) k; /* bond ordering number; used to change bonds to tautomeric only  */
 4275|      0|                                nNumBondPos++;
 4276|       |#if ( REPLACE_ALT_WITH_TAUT != 1 )
 4277|       |                            }
 4278|       |#endif
 4279|       |                            /*  Mobile group is possible if (a) the endpoint has a mobile group or */
 4280|       |                            /*                              (b) the centerpoint is adjacent to another endpoint */
 4281|      0|                            nNumPossibleMobile += ( nMobile > 0 || at[endpoint].endpoint );
  ------------------
  |  Branch (4281:53): [True: 0, False: 0]
  |  Branch (4281:68): [True: 0, False: 0]
  ------------------
 4282|      0|                            nNumEndPoints++;
 4283|      0|                        }
 4284|      0|                        if (nNumEndPoints > 1 && nNumPossibleMobile &&
  ------------------
  |  Branch (4284:29): [True: 0, False: 0]
  |  Branch (4284:50): [True: 0, False: 0]
  ------------------
 4285|      0|                             nNumDonor && nNumAcceptor &&
  ------------------
  |  Branch (4285:30): [True: 0, False: 0]
  |  Branch (4285:43): [True: 0, False: 0]
  ------------------
 4286|      0|                             num_O == 1 && num_C)
  ------------------
  |  Branch (4286:30): [True: 0, False: 0]
  |  Branch (4286:44): [True: 0, False: 0]
  ------------------
 4287|      0|                        {
 4288|       |                            /*
 4289|       |                            * A tautomeric group has been found
 4290|       |                            *
 4291|       |                            * at this point:
 4292|       |                            * nGroupNumber = 0 if all endpoints belong to a newly discovered tautomeric group
 4293|       |                            * bDiffGroups  > 0 if at least 2 tautomeric groups are to be merged (one of them can be new)
 4294|       |                            * case (nGroupNumber != 0 && bDiffGroups = 0 ) ignored because all endpoints belong to the same known t-group
 4295|       |                            * case (nGroupNumber != 0 && bDiffGroups < 0 ) cannot happen
 4296|       |                            */
 4297|       |
 4298|      0|                            nErr = FindAccessibleEndPoints( pCG, EndPoint, &nNumEndPoints, BondPos, &nNumBondPos,
 4299|      0|                                                            pBNS, pBD, at, num_atoms, c_group_info, ALT_PATH_MODE_TAUTOM_KET );
  ------------------
  |  |  348|      0|#define ALT_PATH_MODE_TAUTOM_KET 10  /* same as ALT_PATH_MODE_TAUTOM, applies to C=-OH or CH-=O; H may be (-) */
  ------------------
 4300|       |
 4301|      0|                            if (IS_BNS_ERROR( nErr ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4302|      0|                            {
 4303|      0|                                return nErr;
 4304|      0|                            }
 4305|      0|                            nErr = 0;
 4306|       |
 4307|      0|                            if (nNumEndPoints > 0)
  ------------------
  |  Branch (4307:33): [True: 0, False: 0]
  ------------------
 4308|      0|                            {
 4309|      0|                                if (!nGroupNumber || bDiffGroups > 0)
  ------------------
  |  Branch (4309:37): [True: 0, False: 0]
  |  Branch (4309:54): [True: 0, False: 0]
  ------------------
 4310|      0|                                {
 4311|       |
 4312|      0|                                    num_changes = RegisterEndPoints( pCG, t_group_info, EndPoint, nNumEndPoints, at, num_atoms, c_group_info, pBNS );
 4313|      0|                                    if (num_changes == -1)
  ------------------
  |  Branch (4313:41): [True: 0, False: 0]
  ------------------
 4314|      0|                                    {
 4315|      0|                                        nErr = CT_TAUCOUNT_ERR;
  ------------------
  |  |   52|      0|#define CT_TAUCOUNT_ERR      (CT_ERR_FIRST- 5)  /*(-30005) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 4316|      0|                                    }
 4317|      0|                                    if (num_changes < 0)
  ------------------
  |  Branch (4317:41): [True: 0, False: 0]
  ------------------
 4318|      0|                                    {
 4319|      0|                                        nErr = num_changes;
 4320|      0|                                    }
 4321|      0|                                    if (nErr)
  ------------------
  |  Branch (4321:41): [True: 0, False: 0]
  ------------------
 4322|      0|                                    {
 4323|      0|                                        goto exit_function;
 4324|      0|                                    }
 4325|      0|                                    tot_changes += ( num_changes > 0 );
 4326|      0|                                }
 4327|      0|                                if (nNumBondPos > 0)
  ------------------
  |  Branch (4327:37): [True: 0, False: 0]
  ------------------
 4328|      0|                                {
 4329|       |                                    /*  Some of the bonds have not been marked as tautomeric yet */
 4330|      0|                                    num_changes = SetTautomericBonds( at, nNumBondPos, BondPos );
 4331|      0|                                    tot_changes += ( num_changes > 0 );
 4332|      0|                                }
 4333|      0|                            }
 4334|      0|                        }
 4335|      0|                    }
 4336|      0|                }
 4337|      0|            }
 4338|      0|        }
 4339|      0|    }
 4340|   110k|#endif  /* KETO_ENOL_TAUT */
 4341|       |
 4342|   110k|#if ( TAUT_OTHER == 1 ) /* { */
 4343|   110k|    if (!tot_changes)
  ------------------
  |  Branch (4343:9): [True: 110k, False: 0]
  ------------------
 4344|   110k|    {
 4345|   110k|#define MAX_ALT_PATH_LEN 8
 4346|   110k|        int nMaxLenDfsPath = MAX_ALT_PATH_LEN;
  ------------------
  |  | 4345|   110k|#define MAX_ALT_PATH_LEN 8
  ------------------
 4347|   110k|        int i1, i2;
 4348|   110k|        AT_RANK *nDfsPathPos = (AT_RANK  *) inchi_calloc( num_atoms, sizeof( nDfsPathPos[0] ) );
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
 4349|   110k|        DFS_PATH DfsPath[MAX_ALT_PATH_LEN];
 4350|   110k|        int      ret;
 4351|       |
 4352|   110k|        if (!nDfsPathPos || !DfsPath)
  ------------------
  |  Branch (4352:13): [True: 0, False: 110k]
  |  Branch (4352:29): [Folded - Ignored]
  ------------------
 4353|      0|        {
 4354|      0|            tot_changes = CT_OUT_OF_RAM;  /*   <BRKPT> */
  ------------------
  |  |   49|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 4355|      0|            goto free_memory;
 4356|      0|        }
 4357|       |
 4358|   110k|#if ( TAUT_15_NON_RING      == 1 ) /***** post v.1 feature *****/
 4359|   110k|        if (t_group_info->bTautFlags & TG_FLAG_1_5_TAUT)
  ------------------
  |  |  950|   110k|#define TG_FLAG_1_5_TAUT                 0x00100000   /* turn on 1,5 tautomerism detection */
  ------------------
  |  Branch (4359:13): [True: 0, False: 110k]
  ------------------
 4360|      0|        {
 4361|       |            /*  1,5 tautomerism; one of the endpoints should no be on a ring  */
 4362|       |            /*
 4363|       |            O                OH                 O
 4364|       |            ||               |                  ||
 4365|       |            A--pos-          A--pos-            A--pos-
 4366|       |            /   sib-        //   sib-     ?     /   sib-
 4367|       |            C    ly          C    ly            CH   ly
 4368|       |            \\   a     <-->   \   a       <-->   \   a
 4369|       |            B--ring          B--ring            B--ring
 4370|       |            |                ||                 ||
 4371|       |            NH               N                  N
 4372|       |
 4373|       |            Note: few recent modifications now allow the terminal N be in a ring, too
 4374|       |            */
 4375|      0|            for (i1 = 0; i1 < num_atoms; i1++)
  ------------------
  |  Branch (4375:26): [True: 0, False: 0]
  ------------------
 4376|      0|            {
 4377|       |                /*  Find possible endpoint Z = at[i1] */
 4378|      0|                if (!( endpoint_valence = nGetEndpointInfo( at, i1, &eif1 ) ) /*||
  ------------------
  |  Branch (4378:21): [True: 0, False: 0]
  ------------------
 4379|      0|                                                                              at[i1].nNumAtInRingSystem > 1*/)
 4380|      0|                {
 4381|      0|                    continue; /*  not a possibly endpoint */
 4382|      0|                }
 4383|       |
 4384|      0|                if (1)
  ------------------
  |  Branch (4384:21): [Folded - Ignored]
  ------------------
 4385|      0|                {
 4386|      0|                    nNumEndPoints = 0;
 4387|      0|                    nNumBondPos = 0;
 4388|       |
 4389|      0|                    ret = nGet15TautInAltPath( pCG, at, i1, nDfsPathPos,
 4390|      0|                                               DfsPath, nMaxLenDfsPath,
 4391|      0|                                               EndPoint, sizeof( EndPoint ) / sizeof( EndPoint[0] ),
 4392|      0|                                               BondPos, sizeof( BondPos ) / sizeof( BondPos[0] ),
 4393|      0|                                               &nNumEndPoints, &nNumBondPos,
 4394|      0|                                               pBNS, pBD, num_atoms );
 4395|       |
 4396|      0|                    if (ret > 0)
  ------------------
  |  Branch (4396:25): [True: 0, False: 0]
  ------------------
 4397|      0|                    {
 4398|      0|                        if (nNumEndPoints)
  ------------------
  |  Branch (4398:29): [True: 0, False: 0]
  ------------------
 4399|      0|                        {
 4400|      0|                            num_changes = RegisterEndPoints( pCG, t_group_info, EndPoint, nNumEndPoints, at, num_atoms, c_group_info, pBNS );
 4401|      0|                            if (num_changes == -1)
  ------------------
  |  Branch (4401:33): [True: 0, False: 0]
  ------------------
 4402|      0|                            {
 4403|      0|                                nErr = CT_TAUCOUNT_ERR;
  ------------------
  |  |   52|      0|#define CT_TAUCOUNT_ERR      (CT_ERR_FIRST- 5)  /*(-30005) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 4404|      0|                            }
 4405|      0|                            if (num_changes < 0)
  ------------------
  |  Branch (4405:33): [True: 0, False: 0]
  ------------------
 4406|      0|                            {
 4407|      0|                                nErr = num_changes;
 4408|      0|                            }
 4409|      0|                            if (nErr)
  ------------------
  |  Branch (4409:33): [True: 0, False: 0]
  ------------------
 4410|      0|                            {
 4411|      0|                                goto free_memory;
 4412|      0|                            }
 4413|      0|                            tot_changes += ( num_changes > 0 );
 4414|      0|                        }
 4415|      0|                        if (nNumBondPos)
  ------------------
  |  Branch (4415:29): [True: 0, False: 0]
  ------------------
 4416|      0|                        {
 4417|      0|                            tot_changes += ( 0 < SetTautomericBonds( at, nNumBondPos, BondPos ) );
 4418|      0|                        }
 4419|      0|                    }
 4420|      0|                    else
 4421|      0|                    {
 4422|      0|                        if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4423|      0|                        {
 4424|      0|                            nErr = ret;
 4425|      0|                            goto free_memory;
 4426|      0|                        }
 4427|      0|                    }
 4428|      0|                }
 4429|      0|            }
 4430|      0|        }
 4431|   110k|#endif
 4432|       |
 4433|   110k|#if ( TAUT_4PYRIDINOL_RINGS == 1 )
 4434|       |        /*  6-member rings */
 4435|       |        /*
 4436|       |        O              OH             OH
 4437|       |        ||             |              |
 4438|       |        /  \          //  \           /  \\
 4439|       |        ||   ||  <-->  |    ||  <-->  ||   |
 4440|       |        \  /          \\  /           \  //
 4441|       |        NH             N              N
 4442|       |        */
 4443|   222k|        for (i1 = 0; i1 < num_atoms; i1++)
  ------------------
  |  Branch (4443:22): [True: 112k, False: 110k]
  ------------------
 4444|   112k|        {
 4445|       |            /*  Find possible endpoint Z = at[i1] */
 4446|   112k|            if (3 != ( endpoint_valence = nGetEndpointInfo( at, i1, &eif1 ) ) ||
  ------------------
  |  Branch (4446:17): [True: 112k, False: 2]
  ------------------
 4447|   112k|                 2 != at[i1].valence)
  ------------------
  |  Branch (4447:18): [True: 0, False: 2]
  ------------------
 4448|   112k|            {
 4449|   112k|                continue; /*  not a nitrogen atom or a wrong valence */
 4450|   112k|            }
 4451|       |
 4452|      2|            if (at[i1].nNumAtInRingSystem >= 6)
  ------------------
  |  Branch (4452:17): [True: 0, False: 2]
  ------------------
 4453|      0|            {
 4454|      0|                nNumEndPoints = 0;
 4455|      0|                nNumBondPos = 0;
 4456|       |
 4457|      0|                ret = nGet15TautIn6MembAltRing( pCG, at, i1, nDfsPathPos,
 4458|      0|                                                DfsPath, nMaxLenDfsPath, EndPoint,
 4459|      0|                                                sizeof( EndPoint ) / sizeof( EndPoint[0] ),
 4460|      0|                                                BondPos,
 4461|      0|                                                sizeof( BondPos ) / sizeof( BondPos[0] ),
 4462|      0|                                                &nNumEndPoints, &nNumBondPos,
 4463|      0|                                                pBNS, pBD, num_atoms );
 4464|      0|                if (ret > 0)
  ------------------
  |  Branch (4464:21): [True: 0, False: 0]
  ------------------
 4465|      0|                {
 4466|      0|                    if (nNumEndPoints)
  ------------------
  |  Branch (4466:25): [True: 0, False: 0]
  ------------------
 4467|      0|                    {
 4468|      0|                        num_changes = RegisterEndPoints( pCG, t_group_info, EndPoint, nNumEndPoints, at, num_atoms, c_group_info, pBNS );
 4469|      0|                        if (num_changes == -1)
  ------------------
  |  Branch (4469:29): [True: 0, False: 0]
  ------------------
 4470|      0|                        {
 4471|      0|                            nErr = CT_TAUCOUNT_ERR;
  ------------------
  |  |   52|      0|#define CT_TAUCOUNT_ERR      (CT_ERR_FIRST- 5)  /*(-30005) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 4472|      0|                        }
 4473|      0|                        if (num_changes < 0)
  ------------------
  |  Branch (4473:29): [True: 0, False: 0]
  ------------------
 4474|      0|                        {
 4475|      0|                            nErr = num_changes;
 4476|      0|                        }
 4477|      0|                        if (nErr)
  ------------------
  |  Branch (4477:29): [True: 0, False: 0]
  ------------------
 4478|      0|                        {
 4479|      0|                            goto free_memory;
 4480|      0|                        }
 4481|      0|                        tot_changes += ( num_changes > 0 );
 4482|      0|                    }
 4483|      0|                    if (nNumBondPos)
  ------------------
  |  Branch (4483:25): [True: 0, False: 0]
  ------------------
 4484|      0|                    {
 4485|      0|                        tot_changes += ( 0 < SetTautomericBonds( at, nNumBondPos, BondPos ) );
 4486|      0|                    }
 4487|      0|                }
 4488|      0|                else
 4489|      0|                {
 4490|      0|                    if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4491|      0|                    {
 4492|      0|                        nErr = ret;
 4493|      0|                        goto free_memory;
 4494|      0|                    }
 4495|      0|                }
 4496|      0|            }
 4497|      2|        }
 4498|   110k|#endif /* TAUT_4PYRIDINOL_RINGS */
 4499|       |
 4500|   110k|#if ( TAUT_PYRAZOLE_RINGS == 1 )
 4501|       |        /* 5-member rings:
 4502|       |
 4503|       |        Z               Z
 4504|       |        /  \\           //  \
 4505|       |        X     Y  <-->   X     Y
 4506|       |        \\   /          \    //
 4507|       |        N--NH           HN--N
 4508|       |
 4509|       |        ^             ^
 4510|       |        search for these NH
 4511|       |        */
 4512|       |        /*  5-member rings (pyrazole derivatives): look for the neighboring N */
 4513|   222k|        for (i1 = 0; i1 < num_atoms; i1++)
  ------------------
  |  Branch (4513:22): [True: 112k, False: 110k]
  ------------------
 4514|   112k|        {
 4515|   112k|            if (2 == at[i1].valence &&
  ------------------
  |  Branch (4515:17): [True: 18, False: 112k]
  ------------------
 4516|   112k|                 at[i1].nNumAtInRingSystem >= 5 &&
  ------------------
  |  Branch (4516:18): [True: 0, False: 18]
  ------------------
 4517|   112k|                 3 == ( endpoint_valence = nGetEndpointInfo( at, i1, &eif1 ) )
  ------------------
  |  Branch (4517:18): [True: 0, False: 0]
  ------------------
 4518|   112k|                 )
 4519|      0|            {
 4520|      0|                nMobile = at[i1].num_H + ( at[i1].charge == -1 );
 4521|      0|                for (j = 0; j < at[i1].valence; j++)
  ------------------
  |  Branch (4521:29): [True: 0, False: 0]
  ------------------
 4522|      0|                {
 4523|      0|                    int nMobile2, endpoint_valence2;
 4524|      0|                    i2 = at[i1].neighbor[j];
 4525|       |
 4526|       |                    /*  may be important */
 4527|      0|                    if (i2 >= i1)
  ------------------
  |  Branch (4527:25): [True: 0, False: 0]
  ------------------
 4528|      0|                    {
 4529|      0|                        continue; /*  do not try same pair 2 times */
 4530|      0|                    }
 4531|       |
 4532|      0|                    if (at[i2].nRingSystem != at[i1].nRingSystem)
  ------------------
  |  Branch (4532:25): [True: 0, False: 0]
  ------------------
 4533|      0|                    {
 4534|      0|                        continue;
 4535|      0|                    }
 4536|       |
 4537|      0|                    bond_type = ( at[i1].bond_type[j] & ~BOND_MARK_ALL );
  ------------------
  |  |  219|      0|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 4538|      0|                    if (bond_type != BOND_SINGLE &&
  ------------------
  |  |  205|      0|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (4538:25): [True: 0, False: 0]
  ------------------
 4539|      0|                         bond_type != BOND_TAUTOM &&
  ------------------
  |  |  213|      0|#define BOND_TAUTOM              8
  ------------------
  |  Branch (4539:26): [True: 0, False: 0]
  ------------------
 4540|      0|                         bond_type != BOND_ALT12NS &&
  ------------------
  |  |  214|      0|#define BOND_ALT12NS             9
  ------------------
  |  Branch (4540:26): [True: 0, False: 0]
  ------------------
 4541|      0|                         bond_type != BOND_ALTERN ||  /* added 1-15-2002 */
  ------------------
  |  |  208|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   63|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (4541:26): [True: 0, False: 0]
  ------------------
 4542|      0|                         2 != at[i2].valence ||
  ------------------
  |  Branch (4542:26): [True: 0, False: 0]
  ------------------
 4543|      0|                         3 != ( endpoint_valence2 = nGetEndpointInfo( at, i2, &eif2 ) ))
  ------------------
  |  Branch (4543:26): [True: 0, False: 0]
  ------------------
 4544|      0|                    {
 4545|      0|                        continue; /*  not a nitrogen atom or a wrong valence or not a single bond */
 4546|      0|                    }
 4547|      0|                    nMobile2 = at[i2].num_H + ( at[i2].charge == -1 );  /*  number of mobile groups */
 4548|       |#if ( TAUT_IGNORE_EQL_ENDPOINTS == 1 )
 4549|       |                    if (at[i1].endpoint && at[i1].endpoint == at[i2].endpoint)
 4550|       |                    {
 4551|       |                        continue; /* atoms already belong to the same t-group */
 4552|       |                    }
 4553|       |#endif
 4554|      0|                    if (!at[i1].endpoint && !at[i2].endpoint && 1 != nMobile + nMobile2)
  ------------------
  |  Branch (4554:25): [True: 0, False: 0]
  |  Branch (4554:45): [True: 0, False: 0]
  |  Branch (4554:65): [True: 0, False: 0]
  ------------------
 4555|      0|                    {
 4556|      0|                        continue;
 4557|      0|                    }
 4558|       |
 4559|      0|                    ret = nGet12TautIn5MembAltRing( pCG, at, i1, j, nDfsPathPos,
 4560|      0|                                                    DfsPath, nMaxLenDfsPath,
 4561|      0|                                                    EndPoint,
 4562|      0|                                                    sizeof( EndPoint ) / sizeof( EndPoint[0] ),
 4563|      0|                                                    BondPos,
 4564|      0|                                                    sizeof( BondPos ) / sizeof( BondPos[0] ),
 4565|      0|                                                    &nNumEndPoints, &nNumBondPos,
 4566|      0|                                                    pBNS, pBD, num_atoms );
 4567|      0|                    if (ret > 0)
  ------------------
  |  Branch (4567:25): [True: 0, False: 0]
  ------------------
 4568|      0|                    {
 4569|      0|                        if (nNumEndPoints)
  ------------------
  |  Branch (4569:29): [True: 0, False: 0]
  ------------------
 4570|      0|                        {
 4571|      0|                            num_changes = RegisterEndPoints( pCG, t_group_info, EndPoint, nNumEndPoints, at, num_atoms, c_group_info, pBNS );
 4572|      0|                            if (num_changes == -1)
  ------------------
  |  Branch (4572:33): [True: 0, False: 0]
  ------------------
 4573|      0|                            {
 4574|      0|                                nErr = CT_TAUCOUNT_ERR;
  ------------------
  |  |   52|      0|#define CT_TAUCOUNT_ERR      (CT_ERR_FIRST- 5)  /*(-30005) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 4575|      0|                            }
 4576|      0|                            if (num_changes < 0)
  ------------------
  |  Branch (4576:33): [True: 0, False: 0]
  ------------------
 4577|      0|                            {
 4578|      0|                                nErr = num_changes;
 4579|      0|                            }
 4580|      0|                            if (nErr)
  ------------------
  |  Branch (4580:33): [True: 0, False: 0]
  ------------------
 4581|      0|                                goto free_memory;
 4582|      0|                            tot_changes += ( num_changes > 0 );
 4583|      0|                        }
 4584|      0|                        if (nNumBondPos)
  ------------------
  |  Branch (4584:29): [True: 0, False: 0]
  ------------------
 4585|      0|                        {
 4586|      0|                            tot_changes += ( 0 < SetTautomericBonds( at, nNumBondPos, BondPos ) );
 4587|      0|                        }
 4588|      0|                    }
 4589|      0|                    else
 4590|      0|                    {
 4591|      0|                        if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4592|      0|                        {
 4593|      0|                            nErr = ret;
 4594|      0|                            goto free_memory;
 4595|      0|                        }
 4596|      0|                    }
 4597|      0|                }
 4598|      0|            }
 4599|   112k|        }
 4600|   110k|#endif /* TAUT_PYRAZOLE_RINGS */
 4601|       |
 4602|   110k|#if ( TAUT_TROPOLONE_7 == 1 || TAUT_TROPOLONE_5 == 1 ) /* { */
 4603|       |        /********************************************************
 4604|       |        *                                         A  B
 4605|       |        *                                         | ||
 4606|       |        * 7-member rings (tropolones): look for M=Q--R--ZH,
 4607|       |        *                                       ^ ^  ^  ^
 4608|       |        *                               endpoint1 i1 i2 endpoint2
 4609|       |        * where A-Q-R=B belong to a 7-member alt. (except Q-R bond) ring: ..=A-(Q-R)=B-..
 4610|       |        * Bond Q-R should be single or tautomeric or alternating
 4611|       |        * M=Q and R-ZH should be chain (non-ring) bonds
 4612|       |        * Same for 5-member rings
 4613|       |        */
 4614|   222k|        for (i1 = 0; i1 < num_atoms; i1++)
  ------------------
  |  Branch (4614:22): [True: 112k, False: 110k]
  ------------------
 4615|   112k|        {
 4616|   112k|            if (at[i1].nNumAtInRingSystem >=
  ------------------
  |  Branch (4616:17): [True: 0, False: 112k]
  ------------------
 4617|   112k|#if ( TAUT_TROPOLONE_5 == 1 )
 4618|   112k|                 5
 4619|       |#else
 4620|       |                 7
 4621|       |#endif
 4622|   112k|                 &&
 4623|   112k|                 bIsCenterPointStrict( at, i1 ) &&
  ------------------
  |  Branch (4623:18): [True: 0, False: 0]
  ------------------
 4624|   112k|#if ( TAUT_RINGS_ATTACH_CHAIN == 1 )
 4625|   112k|                 at[i1].bCutVertex &&
  ------------------
  |  Branch (4625:18): [True: 0, False: 0]
  ------------------
 4626|   112k|#endif
 4627|   112k|                 at[i1].valence == 3 && !at[i1].endpoint)
  ------------------
  |  Branch (4627:18): [True: 0, False: 0]
  |  Branch (4627:41): [True: 0, False: 0]
  ------------------
 4628|      0|            {
 4629|      0|                int nMobile1, endpoint1, endpoint1_valence, bond_type1;
 4630|      0|                int nMobile2, endpoint2, endpoint2_valence, bond_type2;
 4631|      0|                for (j = 0; j < at[i1].valence; j++)
  ------------------
  |  Branch (4631:29): [True: 0, False: 0]
  ------------------
 4632|      0|                {
 4633|      0|                    i2 = at[i1].neighbor[j];
 4634|       |                    /* may be important
 4635|       |                    if ( i2 > i1 )
 4636|       |                    continue;
 4637|       |                    do not try same pair 2 times
 4638|       |                    */
 4639|      0|                    if (at[i2].nRingSystem != at[i1].nRingSystem ||
  ------------------
  |  Branch (4639:25): [True: 0, False: 0]
  ------------------
 4640|      0|                         !bIsCenterPointStrict( at, i2 ) ||
  ------------------
  |  Branch (4640:26): [True: 0, False: 0]
  ------------------
 4641|      0|#if ( TAUT_RINGS_ATTACH_CHAIN == 1 )
 4642|      0|                         !at[i2].bCutVertex ||
  ------------------
  |  Branch (4642:26): [True: 0, False: 0]
  ------------------
 4643|      0|#endif
 4644|      0|                         at[i2].valence != 3 || at[i2].endpoint)
  ------------------
  |  Branch (4644:26): [True: 0, False: 0]
  |  Branch (4644:49): [True: 0, False: 0]
  ------------------
 4645|      0|                    {
 4646|      0|                        continue;
 4647|      0|                    }
 4648|      0|                    bond_type = ( at[i1].bond_type[j] & ~BOND_MARK_ALL );
  ------------------
  |  |  219|      0|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 4649|      0|                    if (bond_type != BOND_SINGLE &&
  ------------------
  |  |  205|      0|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (4649:25): [True: 0, False: 0]
  ------------------
 4650|      0|                         bond_type != BOND_TAUTOM &&
  ------------------
  |  |  213|      0|#define BOND_TAUTOM              8
  ------------------
  |  Branch (4650:26): [True: 0, False: 0]
  ------------------
 4651|      0|                         bond_type != BOND_ALT12NS &&
  ------------------
  |  |  214|      0|#define BOND_ALT12NS             9
  ------------------
  |  Branch (4651:26): [True: 0, False: 0]
  ------------------
 4652|      0|                         bond_type != BOND_ALTERN)
  ------------------
  |  |  208|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   63|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (4652:26): [True: 0, False: 0]
  ------------------
 4653|      0|                    {
 4654|      0|                        continue; /*  not a single bond between Q-R */
 4655|      0|                    }
 4656|       |
 4657|       |                    /*  Find endpoints */
 4658|      0|                    for (k = 0; k < at[i1].valence; k++)
  ------------------
  |  Branch (4658:33): [True: 0, False: 0]
  ------------------
 4659|      0|                    {
 4660|      0|                        endpoint1 = at[i1].neighbor[k];
 4661|      0|                        if (endpoint1 == i2)
  ------------------
  |  Branch (4661:29): [True: 0, False: 0]
  ------------------
 4662|      0|                        {
 4663|      0|                            continue; /*  j == k */
 4664|      0|                        }
 4665|      0|                        if (!( endpoint1_valence = nGetEndpointInfo( at, endpoint1, &eif1 ) ))
  ------------------
  |  Branch (4665:29): [True: 0, False: 0]
  ------------------
 4666|      0|                        {
 4667|      0|                            continue; /*  not an endpoint1 element or can't have mobile groups */
 4668|      0|                        }
 4669|      0|#if ( TAUT_RINGS_ATTACH_CHAIN == 1 )
 4670|      0|                        if (at[endpoint1].nRingSystem == at[i1].nRingSystem)
  ------------------
  |  Branch (4670:29): [True: 0, False: 0]
  ------------------
 4671|      0|                        {
 4672|      0|                            continue;
 4673|      0|                        }
 4674|      0|#endif
 4675|      0|                        nMobile1 = at[endpoint1].num_H + ( at[endpoint1].charge == -1 );  /*  number of mobile groups */
 4676|      0|                        if (nMobile1 + at[endpoint1].chem_bonds_valence != endpoint1_valence)
  ------------------
  |  Branch (4676:29): [True: 0, False: 0]
  ------------------
 4677|      0|                            continue; /*  abnormal endpoint1 valence; ignore. */
 4678|      0|                        bond_type1 = ( at[i1].bond_type[k] & ~BOND_MARK_ALL );
  ------------------
  |  |  219|      0|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 4679|       |
 4680|      0|                        if (bond_type1 != BOND_SINGLE &&
  ------------------
  |  |  205|      0|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (4680:29): [True: 0, False: 0]
  ------------------
 4681|      0|                             bond_type1 != BOND_DOUBLE &&
  ------------------
  |  |  206|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (4681:30): [True: 0, False: 0]
  ------------------
 4682|      0|                             bond_type1 != BOND_TAUTOM &&
  ------------------
  |  |  213|      0|#define BOND_TAUTOM              8
  ------------------
  |  Branch (4682:30): [True: 0, False: 0]
  ------------------
 4683|      0|                             bond_type1 != BOND_ALT12NS &&
  ------------------
  |  |  214|      0|#define BOND_ALT12NS             9
  ------------------
  |  Branch (4683:30): [True: 0, False: 0]
  ------------------
 4684|      0|                             bond_type1 != BOND_ALTERN)
  ------------------
  |  |  208|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   63|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (4684:30): [True: 0, False: 0]
  ------------------
 4685|      0|                        {
 4686|      0|                            continue;
 4687|      0|                        }
 4688|      0|                        for (m = 0; m < at[i2].valence; m++)
  ------------------
  |  Branch (4688:37): [True: 0, False: 0]
  ------------------
 4689|      0|                        {
 4690|      0|                            endpoint2 = at[i2].neighbor[m];
 4691|      0|                            if (endpoint2 == i1)
  ------------------
  |  Branch (4691:33): [True: 0, False: 0]
  ------------------
 4692|      0|                            {
 4693|      0|                                continue;
 4694|      0|                            }
 4695|      0|                            if (!( endpoint2_valence = nGetEndpointInfo( at, endpoint2, &eif2 ) ))
  ------------------
  |  Branch (4695:33): [True: 0, False: 0]
  ------------------
 4696|      0|                            {
 4697|      0|                                continue; /*  not an endpoint2 element or can't have mobile groups */
 4698|      0|                            }
 4699|      0|#if ( TAUT_RINGS_ATTACH_CHAIN == 1 )
 4700|      0|                            if (at[endpoint2].nRingSystem == at[i2].nRingSystem)
  ------------------
  |  Branch (4700:33): [True: 0, False: 0]
  ------------------
 4701|      0|                            {
 4702|      0|                                continue;
 4703|      0|                            }
 4704|      0|#endif
 4705|      0|                            nMobile2 = at[endpoint2].num_H + ( at[endpoint2].charge == -1 );  /*  number of mobile groups */
 4706|      0|                            bond_type2 = ( at[i2].bond_type[m] & ~BOND_MARK_ALL );
  ------------------
  |  |  219|      0|#define BOND_MARK_ALL         0xf0  /* complement to BOND_TYPE_MASK         */
  ------------------
 4707|       |
 4708|      0|                            if (bond_type2 != BOND_SINGLE &&
  ------------------
  |  |  205|      0|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (4708:33): [True: 0, False: 0]
  ------------------
 4709|      0|                                 bond_type2 != BOND_DOUBLE &&
  ------------------
  |  |  206|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (4709:34): [True: 0, False: 0]
  ------------------
 4710|      0|                                 bond_type2 != BOND_TAUTOM &&
  ------------------
  |  |  213|      0|#define BOND_TAUTOM              8
  ------------------
  |  Branch (4710:34): [True: 0, False: 0]
  ------------------
 4711|      0|                                 bond_type2 != BOND_ALT12NS &&
  ------------------
  |  |  214|      0|#define BOND_ALT12NS             9
  ------------------
  |  Branch (4711:34): [True: 0, False: 0]
  ------------------
 4712|      0|                                 bond_type2 != BOND_ALTERN)
  ------------------
  |  |  208|      0|#define BOND_ALTERN BOND_TYPE_ALTERN  /* 4 single/double                    */
  |  |  ------------------
  |  |  |  |   63|      0|#define BOND_TYPE_ALTERN    4
  |  |  ------------------
  ------------------
  |  Branch (4712:34): [True: 0, False: 0]
  ------------------
 4713|      0|                            {
 4714|      0|                                continue;
 4715|      0|                            }
 4716|       |
 4717|       |                            /*  Final test for possible tautomerism */
 4718|      0|                            nMobile = 0;
 4719|       |
 4720|      0|                            if (ALLOWED_EDGE( pBNS, i1, k ) && ALLOWED_EDGE( pBNS, i2, m ))
  ------------------
  |  | 3919|      0|#define ALLOWED_EDGE(PBNS, IAT,IBOND)  ( !(PBNS) || !(PBNS)->edge || !(PBNS)->vert || !(PBNS)->edge[(PBNS)->vert[IAT].iedge[IBOND]].forbidden)
  |  |  ------------------
  |  |  |  Branch (3919:42): [True: 0, False: 0]
  |  |  |  Branch (3919:53): [True: 0, False: 0]
  |  |  |  Branch (3919:70): [True: 0, False: 0]
  |  |  |  Branch (3919:87): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                                          if (ALLOWED_EDGE( pBNS, i1, k ) && ALLOWED_EDGE( pBNS, i2, m ))
  ------------------
  |  | 3919|      0|#define ALLOWED_EDGE(PBNS, IAT,IBOND)  ( !(PBNS) || !(PBNS)->edge || !(PBNS)->vert || !(PBNS)->edge[(PBNS)->vert[IAT].iedge[IBOND]].forbidden)
  |  |  ------------------
  |  |  |  Branch (3919:42): [True: 0, False: 0]
  |  |  |  Branch (3919:53): [True: 0, False: 0]
  |  |  |  Branch (3919:70): [True: 0, False: 0]
  |  |  |  Branch (3919:87): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4721|      0|                            {
 4722|       |                                /*  Can mobile group move from 1 to 2? */
 4723|      0|                                nMobile += ( at[endpoint1].endpoint || nMobile1 ) &&  /*  from endpoint1 */
  ------------------
  |  Branch (4723:46): [True: 0, False: 0]
  |  Branch (4723:72): [True: 0, False: 0]
  ------------------
 4724|      0|                                    ( bond_type1 != BOND_DOUBLE ) &&
  ------------------
  |  |  206|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (4724:37): [True: 0, False: 0]
  ------------------
 4725|       |
 4726|      0|                                    ( at[endpoint2].endpoint ||          /*  to endpoint2 */
  ------------------
  |  Branch (4726:39): [True: 0, False: 0]
  ------------------
 4727|      0|                                      eif2.cNeutralBondsValence > at[endpoint2].valence ) &&
  ------------------
  |  Branch (4727:39): [True: 0, False: 0]
  ------------------
 4728|      0|                                      ( bond_type2 != BOND_SINGLE );
  ------------------
  |  |  205|      0|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (4728:39): [True: 0, False: 0]
  ------------------
 4729|       |
 4730|       |                                /*  Can mobile group move from 2 to 1? */
 4731|      0|                                nMobile += ( at[endpoint2].endpoint || nMobile2 ) &&  /*  from endpoint2 */
  ------------------
  |  Branch (4731:46): [True: 0, False: 0]
  |  Branch (4731:72): [True: 0, False: 0]
  ------------------
 4732|      0|                                    ( bond_type2 != BOND_DOUBLE ) && /*changed from BOND_SINGLE 2004-02-26 */
  ------------------
  |  |  206|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (4732:37): [True: 0, False: 0]
  ------------------
 4733|       |
 4734|      0|                                    ( at[endpoint1].endpoint ||          /*  to endpoint1 */
  ------------------
  |  Branch (4734:39): [True: 0, False: 0]
  ------------------
 4735|      0|                                      eif1.cNeutralBondsValence > at[endpoint1].valence ) &&
  ------------------
  |  Branch (4735:39): [True: 0, False: 0]
  ------------------
 4736|      0|                                      ( bond_type1 != BOND_SINGLE );
  ------------------
  |  |  205|      0|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
  |  Branch (4736:39): [True: 0, False: 0]
  ------------------
 4737|      0|                            }
 4738|      0|                            if (!nMobile)
  ------------------
  |  Branch (4738:33): [True: 0, False: 0]
  ------------------
 4739|      0|                            {
 4740|      0|                                continue;
 4741|      0|                            }
 4742|       |
 4743|      0|                            if (bond_type1 == bond_type2 &&
  ------------------
  |  Branch (4743:33): [True: 0, False: 0]
  ------------------
 4744|      0|                                ( bond_type1 == BOND_SINGLE || bond_type1 == BOND_DOUBLE ))
  ------------------
  |  |  205|      0|#define BOND_SINGLE BOND_TYPE_SINGLE  /* 1                                  */
  |  |  ------------------
  |  |  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  |  |  ------------------
  ------------------
                                              ( bond_type1 == BOND_SINGLE || bond_type1 == BOND_DOUBLE ))
  ------------------
  |  |  206|      0|#define BOND_DOUBLE BOND_TYPE_DOUBLE  /* 2                                  */
  |  |  ------------------
  |  |  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  |  |  ------------------
  ------------------
  |  Branch (4744:35): [True: 0, False: 0]
  |  Branch (4744:64): [True: 0, False: 0]
  ------------------
 4745|      0|                            {
 4746|      0|                                continue;
 4747|      0|                            }
 4748|       |
 4749|       |                            /* -- old --
 4750|       |                            if ( !at[endpoint1].endpoint && !at[endpoint2].endpoint && 1 != nMobile1 + nMobile2 )
 4751|       |                            continue;
 4752|       |                            */
 4753|       |                            /* -- new --
 4754|       |
 4755|       |                            if ( !at[endpoint1].endpoint && !at[endpoint2].endpoint ) {
 4756|       |                            if ( !(bond_type1 == BOND_SINGLE || bond_type1 == BOND_DOUBLE) ||
 4757|       |                            !(bond_type2 == BOND_SINGLE || bond_type2 == BOND_DOUBLE) ) {
 4758|       |                            // at this point bond_type1 != bond_type2
 4759|       |                            continue;
 4760|       |                            }
 4761|       |                            if ( bond_type1 == BOND_SINGLE && !nMobile1 ||
 4762|       |                            bond_type2 == BOND_SINGLE && !nMobile2 ||
 4763|       |                            0 == nMobile1 + nMobile2 ) {
 4764|       |                            continue;
 4765|       |                            }
 4766|       |                            }
 4767|       |                            */
 4768|       |
 4769|      0|#if ( TAUT_TROPOLONE_7 == 1 )
 4770|      0|                            if (at[i1].nNumAtInRingSystem >= 7)
  ------------------
  |  Branch (4770:33): [True: 0, False: 0]
  ------------------
 4771|      0|                            {
 4772|       |
 4773|      0|                                ret = nGet14TautIn7MembAltRing( pCG, at, i1,
 4774|      0|                                                                j, k, m, nDfsPathPos,
 4775|      0|                                                                DfsPath, nMaxLenDfsPath,
 4776|      0|                                                                EndPoint,
 4777|      0|                                                                sizeof( EndPoint ) / sizeof( EndPoint[0] ),
 4778|      0|                                                                BondPos,
 4779|      0|                                                                sizeof( BondPos ) / sizeof( BondPos[0] ),
 4780|      0|                                                                &nNumEndPoints, &nNumBondPos,
 4781|      0|                                                                pBNS, pBD, num_atoms );
 4782|      0|                                if (ret > 0)
  ------------------
  |  Branch (4782:37): [True: 0, False: 0]
  ------------------
 4783|      0|                                {
 4784|      0|                                    if (nNumEndPoints)
  ------------------
  |  Branch (4784:41): [True: 0, False: 0]
  ------------------
 4785|      0|                                    {
 4786|      0|                                        num_changes = RegisterEndPoints( pCG, t_group_info, EndPoint, nNumEndPoints, at, num_atoms, c_group_info, pBNS );
 4787|      0|                                        if (num_changes == -1)
  ------------------
  |  Branch (4787:45): [True: 0, False: 0]
  ------------------
 4788|      0|                                        {
 4789|      0|                                            nErr = CT_TAUCOUNT_ERR;
  ------------------
  |  |   52|      0|#define CT_TAUCOUNT_ERR      (CT_ERR_FIRST- 5)  /*(-30005) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 4790|      0|                                        }
 4791|      0|                                        if (num_changes < 0)
  ------------------
  |  Branch (4791:45): [True: 0, False: 0]
  ------------------
 4792|      0|                                        {
 4793|      0|                                            nErr = num_changes;
 4794|      0|                                        }
 4795|      0|                                        if (nErr)
  ------------------
  |  Branch (4795:45): [True: 0, False: 0]
  ------------------
 4796|      0|                                        {
 4797|      0|                                            goto free_memory;
 4798|      0|                                        }
 4799|      0|                                        tot_changes += ( num_changes > 0 );
 4800|      0|                                    }
 4801|      0|                                    if (nNumBondPos)
  ------------------
  |  Branch (4801:41): [True: 0, False: 0]
  ------------------
 4802|      0|                                    {
 4803|      0|                                        tot_changes += ( 0 < SetTautomericBonds( at, nNumBondPos, BondPos ) );
 4804|      0|                                    }
 4805|      0|                                }
 4806|      0|                                else
 4807|      0|                                {
 4808|      0|                                    if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4809|      0|                                    {
 4810|      0|                                        nErr = ret;
 4811|      0|                                        goto free_memory;
 4812|      0|                                    }
 4813|      0|                                }
 4814|      0|                            }
 4815|      0|#endif
 4816|       |
 4817|      0|#if ( TAUT_TROPOLONE_5 == 1 )
 4818|      0|                            if (at[i1].nNumAtInRingSystem >= 5)
  ------------------
  |  Branch (4818:33): [True: 0, False: 0]
  ------------------
 4819|      0|                            {
 4820|       |
 4821|      0|                                ret = nGet14TautIn5MembAltRing( pCG, at, i1, j, k, m, nDfsPathPos,
 4822|      0|                                                                DfsPath, nMaxLenDfsPath,
 4823|      0|                                                                EndPoint, sizeof( EndPoint ) / sizeof( EndPoint[0] ),
 4824|      0|                                                                BondPos, sizeof( BondPos ) / sizeof( BondPos[0] ),
 4825|      0|                                                                &nNumEndPoints, &nNumBondPos,
 4826|      0|                                                                pBNS, pBD, num_atoms );
 4827|      0|                                if (ret > 0)
  ------------------
  |  Branch (4827:37): [True: 0, False: 0]
  ------------------
 4828|      0|                                {
 4829|      0|                                    if (nNumEndPoints)
  ------------------
  |  Branch (4829:41): [True: 0, False: 0]
  ------------------
 4830|      0|                                    {
 4831|      0|                                        num_changes = RegisterEndPoints( pCG, t_group_info, EndPoint, nNumEndPoints, at, num_atoms, c_group_info, pBNS );
 4832|      0|                                        if (num_changes == -1)
  ------------------
  |  Branch (4832:45): [True: 0, False: 0]
  ------------------
 4833|      0|                                        {
 4834|      0|                                            nErr = CT_TAUCOUNT_ERR;
  ------------------
  |  |   52|      0|#define CT_TAUCOUNT_ERR      (CT_ERR_FIRST- 5)  /*(-30005) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 4835|      0|                                        }
 4836|      0|                                        if (num_changes < 0)
  ------------------
  |  Branch (4836:45): [True: 0, False: 0]
  ------------------
 4837|      0|                                        {
 4838|      0|                                            nErr = num_changes;
 4839|      0|                                        }
 4840|      0|                                        if (nErr)
  ------------------
  |  Branch (4840:45): [True: 0, False: 0]
  ------------------
 4841|      0|                                        {
 4842|      0|                                            goto free_memory;
 4843|      0|                                        }
 4844|      0|                                        tot_changes += ( num_changes > 0 );
 4845|      0|                                    }
 4846|      0|                                    if (nNumBondPos)
  ------------------
  |  Branch (4846:41): [True: 0, False: 0]
  ------------------
 4847|      0|                                    {
 4848|      0|                                        tot_changes += ( 0 < SetTautomericBonds( at, nNumBondPos, BondPos ) );
 4849|      0|                                    }
 4850|      0|                                }
 4851|      0|                                else
 4852|      0|                                {
 4853|      0|                                    if (IS_BNS_ERROR( ret ))
  ------------------
  |  |   95|      0|#define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  ------------------
  |  |               #define IS_BNS_ERROR(X) (BNS_ERR <= (X) && (X) <= BNS_MAX_ERR_VALUE)
  |  |  ------------------
  |  |  |  |   93|      0|#define BNS_MAX_ERR_VALUE  (BNS_ERR + 19) /*(-9980)*/
  |  |  |  |  ------------------
  |  |  |  |  |  |   75|      0|#define BNS_ERR            -9999
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (95:26): [True: 0, False: 0]
  |  |  |  Branch (95:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 4854|      0|                                    {
 4855|      0|                                        nErr = ret;
 4856|      0|                                        goto free_memory;
 4857|      0|                                    }
 4858|      0|                                }
 4859|      0|                            }
 4860|      0|#endif
 4861|      0|                        }
 4862|      0|                    }
 4863|      0|                }
 4864|      0|            }
 4865|   112k|        }
 4866|   110k|#endif /* } TAUT_TROPOLONE */
 4867|       |
 4868|   110k|    free_memory:
 4869|   110k|        if (nDfsPathPos)
  ------------------
  |  Branch (4869:13): [True: 110k, False: 0]
  ------------------
 4870|   110k|        {
 4871|   110k|            inchi_free( nDfsPathPos );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4872|   110k|        }
 4873|   110k|#undef MAX_ALT_PATH_LEN
 4874|   110k|    }
 4875|   110k|#endif  /* } FIND_RING_SYSTEMS */
 4876|       |
 4877|   110k|exit_function:
 4878|       |
 4879|   110k|    return nErr < 0 ? nErr : tot_changes;
  ------------------
  |  Branch (4879:12): [True: 0, False: 110k]
  ------------------
 4880|   110k|}
free_t_group_info:
 4885|   384k|{
 4886|   384k|    if (t_group_info)
  ------------------
  |  Branch (4886:9): [True: 384k, False: 0]
  ------------------
 4887|   384k|    {
 4888|   384k|        if (t_group_info->t_group)
  ------------------
  |  Branch (4888:13): [True: 110k, False: 274k]
  ------------------
 4889|   110k|        {
 4890|   110k|            inchi_free( t_group_info->t_group );
  ------------------
  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4891|   110k|        }
 4892|   384k|        if (t_group_info->nEndpointAtomNumber)
  ------------------
  |  Branch (4892:13): [True: 47, False: 384k]
  ------------------
 4893|     47|        {
 4894|     47|            inchi_free( t_group_info->nEndpointAtomNumber );
  ------------------
  |  | 1136|     47|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 47, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4895|     47|        }
 4896|   384k|        if (t_group_info->tGroupNumber)
  ------------------
  |  Branch (4896:13): [True: 47, False: 384k]
  ------------------
 4897|     47|        {
 4898|     47|            inchi_free( t_group_info->tGroupNumber );
  ------------------
  |  | 1136|     47|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 47, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4899|     47|        }
 4900|   384k|        if (t_group_info->nIsotopicEndpointAtomNumber)
  ------------------
  |  Branch (4900:13): [True: 4, False: 384k]
  ------------------
 4901|      4|        {
 4902|      4|            inchi_free( t_group_info->nIsotopicEndpointAtomNumber );
  ------------------
  |  | 1136|      4|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 4, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4903|      4|        }
 4904|   384k|        memset( t_group_info, 0, sizeof( *t_group_info ) );
 4905|   384k|    }
 4906|       |
 4907|   384k|    return 0;
 4908|   384k|}
make_a_copy_of_t_group_info:
 4914|      5|{
 4915|      5|    int err = 0, len;
 4916|      5|    free_t_group_info( t_group_info );
 4917|      5|    if (t_group_info_orig && t_group_info)
  ------------------
  |  Branch (4917:9): [True: 5, False: 0]
  |  Branch (4917:30): [True: 5, False: 0]
  ------------------
 4918|      5|    {
 4919|      5|        if (( len = t_group_info_orig->max_num_t_groups ) > 0)
  ------------------
  |  Branch (4919:13): [True: 5, False: 0]
  ------------------
 4920|      5|        {
 4921|      5|            if (t_group_info->t_group =
  ------------------
  |  Branch (4921:17): [True: 5, False: 0]
  ------------------
 4922|      5|                (T_GROUP*) inchi_malloc( len * sizeof( t_group_info->t_group[0] ) ))
  ------------------
  |  | 1130|      5|#define inchi_malloc   malloc
  ------------------
 4923|      5|            {
 4924|      5|                memcpy( t_group_info->t_group,
 4925|      5|                        t_group_info_orig->t_group,
 4926|      5|                        len * sizeof( t_group_info->t_group[0] ) );
 4927|      5|            }
 4928|      0|            else
 4929|      0|            {
 4930|      0|                err++;
 4931|      0|            }
 4932|      5|        }
 4933|      5|        if (( len = t_group_info_orig->nNumEndpoints ) > 0)
  ------------------
  |  Branch (4933:13): [True: 4, False: 1]
  ------------------
 4934|      4|        {
 4935|      4|            if (t_group_info->nEndpointAtomNumber =
  ------------------
  |  Branch (4935:17): [True: 4, False: 0]
  ------------------
 4936|      4|                (AT_NUMB*) inchi_malloc( len * sizeof( t_group_info->nEndpointAtomNumber[0] ) ))
  ------------------
  |  | 1130|      4|#define inchi_malloc   malloc
  ------------------
 4937|      4|            {
 4938|      4|                memcpy( t_group_info->nEndpointAtomNumber,
 4939|      4|                        t_group_info_orig->nEndpointAtomNumber,
 4940|      4|                        len * sizeof( t_group_info->nEndpointAtomNumber[0] ) );
 4941|      4|            }
 4942|      0|            else
 4943|      0|            {
 4944|      0|                err++;
 4945|      0|            }
 4946|      4|        }
 4947|      5|        if (( len = t_group_info_orig->num_t_groups ) > 0)
  ------------------
  |  Branch (4947:13): [True: 4, False: 1]
  ------------------
 4948|      4|        {
 4949|      4|            if (t_group_info->tGroupNumber =
  ------------------
  |  Branch (4949:17): [True: 4, False: 0]
  ------------------
 4950|      4|                (AT_NUMB*) inchi_malloc( len * TGSO_TOTAL_LEN * sizeof( t_group_info->tGroupNumber[0] ) ))
  ------------------
  |  | 1130|      4|#define inchi_malloc   malloc
  ------------------
                              (AT_NUMB*) inchi_malloc( len * TGSO_TOTAL_LEN * sizeof( t_group_info->tGroupNumber[0] ) ))
  ------------------
  |  |  169|      4|#define TGSO_TOTAL_LEN   4
  ------------------
 4951|      4|            {
 4952|      4|                memcpy( t_group_info->tGroupNumber,
 4953|      4|                        t_group_info_orig->tGroupNumber,
 4954|      4|                        len * TGSO_TOTAL_LEN * sizeof( t_group_info->tGroupNumber[0] ) );
  ------------------
  |  |  169|      4|#define TGSO_TOTAL_LEN   4
  ------------------
 4955|      4|            }
 4956|      0|            else
 4957|      0|            {
 4958|      0|                err++;
 4959|      0|            }
 4960|      4|        }
 4961|      5|        if (( len = t_group_info_orig->nNumIsotopicEndpoints ) > 0)
  ------------------
  |  Branch (4961:13): [True: 2, False: 3]
  ------------------
 4962|      2|        {
 4963|      2|            if (t_group_info->nIsotopicEndpointAtomNumber =
  ------------------
  |  Branch (4963:17): [True: 2, False: 0]
  ------------------
 4964|      2|                (AT_NUMB*) inchi_malloc( len * sizeof( t_group_info->nIsotopicEndpointAtomNumber[0] ) ))
  ------------------
  |  | 1130|      2|#define inchi_malloc   malloc
  ------------------
 4965|      2|            {
 4966|      2|                memcpy( t_group_info->nIsotopicEndpointAtomNumber,
 4967|      2|                        t_group_info_orig->nIsotopicEndpointAtomNumber,
 4968|      2|                        len * sizeof( t_group_info->nIsotopicEndpointAtomNumber[0] ) );
 4969|      2|            }
 4970|      0|            else
 4971|      0|            {
 4972|      0|                err++;
 4973|      0|            }
 4974|      2|        }
 4975|      5|        if (!err)
  ------------------
  |  Branch (4975:13): [True: 5, False: 0]
  ------------------
 4976|      5|        {
 4977|      5|            t_group_info->nNumEndpoints = t_group_info_orig->nNumEndpoints;
 4978|      5|            t_group_info->num_t_groups = t_group_info_orig->num_t_groups;
 4979|      5|            t_group_info->max_num_t_groups = t_group_info_orig->max_num_t_groups;
 4980|      5|            t_group_info->bIgnoreIsotopic = t_group_info_orig->bIgnoreIsotopic;
 4981|      5|            t_group_info->nNumIsotopicEndpoints = t_group_info_orig->nNumIsotopicEndpoints;
 4982|      5|            t_group_info->tni = t_group_info_orig->tni;
 4983|       |            /*
 4984|       |            t_group_info->nNumRemovedExplicitH       = t_group_info_orig->nNumRemovedExplicitH;
 4985|       |            t_group_info->nNumRemovedProtons         = t_group_info_orig->nNumRemovedProtons;
 4986|       |            t_group_info->bNormalizationFlags        = t_group_info_orig->bNormalizationFlags;
 4987|       |            */
 4988|       |            /*
 4989|       |            t_group_info->bHardAddedRemovedProtons   = t_group_info_orig->bHardAddedRemovedProtons;
 4990|       |            t_group_info->bSimpleAddedRemovedProtons = t_group_info_orig->bSimpleAddedRemovedProtons;
 4991|       |            t_group_info->nNumCanceledCharges        = t_group_info_orig->nNumCanceledCharges;
 4992|       |            */
 4993|      5|        }
 4994|      5|        t_group_info->bTautFlags = t_group_info_orig->bTautFlags;
 4995|      5|        t_group_info->bTautFlagsDone = t_group_info_orig->bTautFlagsDone;
 4996|      5|    }
 4997|       |
 4998|      5|    return err;
 4999|      5|}
set_tautomer_iso_sort_keys:
 5006|      5|{
 5007|      5|    T_GROUP       *t_group;
 5008|      5|    T_GROUP_ISOWT Mult = 1;
 5009|      5|    int     i, j, num_t_groups, num_iso_t_groups = 0;
 5010|       |
 5011|      5|    if (!t_group_info || !( t_group = t_group_info->t_group ) ||
  ------------------
  |  Branch (5011:9): [True: 0, False: 5]
  |  Branch (5011:26): [True: 0, False: 5]
  ------------------
 5012|      5|         0 >= ( num_t_groups = t_group_info->num_t_groups ) || t_group_info->nNumIsotopicEndpoints)
  ------------------
  |  Branch (5012:10): [True: 1, False: 4]
  |  Branch (5012:64): [True: 2, False: 2]
  ------------------
 5013|      3|    {
 5014|      3|        return 0;
 5015|      3|    }
 5016|       |
 5017|      4|    for (i = 0; i < num_t_groups; i++)
  ------------------
  |  Branch (5017:17): [True: 2, False: 2]
  ------------------
 5018|      2|    {
 5019|      2|        t_group[i].iWeight = 0;
 5020|      2|        j = T_NUM_ISOTOPIC - 1;
  ------------------
  |  |   98|      2|#define           T_NUM_ISOTOPIC    NUM_H_ISOTOPES /* was 2, now 3 */
  |  |  ------------------
  |  |  |  |   53|      2|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  |  |  ------------------
  ------------------
 5021|      2|        Mult = 1;
 5022|      2|        do
 5023|      6|        {
 5024|      6|            t_group[i].iWeight += Mult * (T_GROUP_ISOWT) t_group[i].num[T_NUM_NO_ISOTOPIC + j];
  ------------------
  |  |   97|      6|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
 5025|      6|        } while (--j >= 0 && ( Mult *= T_GROUP_ISOWT_MULT ));
  ------------------
  |  |  109|      4|#define T_GROUP_ISOWT_MULT   1024 /* (max. number of identical isotopic hydrogens in a taut. group) + 1 */
  ------------------
  |  Branch (5025:18): [True: 4, False: 2]
  |  Branch (5025:30): [True: 4, False: 0]
  ------------------
 5026|       |
 5027|      2|        num_iso_t_groups += ( t_group[i].iWeight != 0 );
 5028|      2|    }
 5029|       |
 5030|      2|    return num_iso_t_groups;
 5031|      5|}
CountTautomerGroups:
 5050|   110k|{
 5051|   110k|    int i, j, ret = 0, nNumEndpoints, max_t_group, num_groups_noH;
 5052|       |
 5053|   110k|    AT_NUMB    nGroupNumber, nNewGroupNumber, *nCurrEndpointAtNoPos = NULL;
 5054|       |
 5055|   110k|    T_GROUP   *t_group;
 5056|   110k|    int        num_t;
 5057|       |    /* int bIgnoreIsotopic, max_num_t; */
 5058|   110k|    AT_NUMB   *nTautomerGroupNumber = NULL;
 5059|   110k|    AT_NUMB   *nEndpointAtomNumber = NULL;
 5060|   110k|    AT_NUMB   *tGroupNumber = NULL;
 5061|       |
 5062|   110k|    if (!t_group_info || !t_group_info->t_group || 0 >= t_group_info->max_num_t_groups)
  ------------------
  |  Branch (5062:9): [True: 0, False: 110k]
  |  Branch (5062:26): [True: 0, False: 110k]
  |  Branch (5062:52): [True: 0, False: 110k]
  ------------------
 5063|      0|    {
 5064|      0|        return 0; /* empty t-groups */
 5065|      0|    }
 5066|   110k|    num_t = t_group_info->num_t_groups;
 5067|   110k|    t_group = t_group_info->t_group;
 5068|       |    /*
 5069|       |    max_num_t       =  t_group_info->max_num_t_groups;
 5070|       |    bIgnoreIsotopic =  t_group_info->bIgnoreIsotopic;
 5071|       |    */
 5072|   110k|    num_groups_noH = 0;
 5073|       |
 5074|       |    /* the following 2 arrays are to be rebuilt here */
 5075|   110k|    if (t_group_info->nEndpointAtomNumber)
  ------------------
  |  Branch (5075:9): [True: 0, False: 110k]
  ------------------
 5076|      0|    {
 5077|      0|        inchi_free( t_group_info->nEndpointAtomNumber );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 5078|      0|        t_group_info->nEndpointAtomNumber = NULL;
 5079|      0|    }
 5080|   110k|    if (t_group_info->tGroupNumber)
  ------------------
  |  Branch (5080:9): [True: 0, False: 110k]
  ------------------
 5081|      0|    {
 5082|      0|        inchi_free( t_group_info->tGroupNumber );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 5083|      0|        t_group_info->tGroupNumber = NULL;
 5084|      0|    }
 5085|       |
 5086|       |    /*  Find max_t_group */
 5087|   110k|    for (i = 0, max_t_group = 0; i < t_group_info->num_t_groups; i++)
  ------------------
  |  Branch (5087:34): [True: 4, False: 110k]
  ------------------
 5088|      4|    {
 5089|      4|        if (max_t_group < t_group[i].nGroupNumber)
  ------------------
  |  Branch (5089:13): [True: 4, False: 0]
  ------------------
 5090|      4|            max_t_group = t_group[i].nGroupNumber;
 5091|      4|    }
 5092|       |    /*  Allocate memory for temp storage of numbers of endpoints  */
 5093|   110k|    if (max_t_group &&
  ------------------
  |  Branch (5093:9): [True: 4, False: 110k]
  ------------------
 5094|   110k|         !( nTautomerGroupNumber = (AT_NUMB*) inchi_calloc( max_t_group + 1, sizeof( nTautomerGroupNumber[0] ) ) /*temp*/ ))
  ------------------
  |  | 1133|      4|#define inchi_calloc   calloc
  ------------------
  |  Branch (5094:10): [True: 0, False: 4]
  ------------------
 5095|      0|    {
 5096|      0|        goto err_exit_function; /*  program error: out of RAM */ /*   <BRKPT> */
 5097|      0|    }
 5098|       |
 5099|       |    /*  Count endpoints for each tautomer group */
 5100|   222k|    for (i = 0, nNumEndpoints = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5100:36): [True: 112k, False: 110k]
  ------------------
 5101|   112k|    {
 5102|   112k|        if (( j = at[i].endpoint ) == 0)
  ------------------
  |  Branch (5102:13): [True: 112k, False: 8]
  ------------------
 5103|   112k|        {
 5104|   112k|            continue;
 5105|   112k|        }
 5106|      8|        if (j > max_t_group) /*  debug only */
  ------------------
  |  Branch (5106:13): [True: 0, False: 8]
  ------------------
 5107|      0|        {
 5108|      0|            goto err_exit_function; /*  program error */ /*   <BRKPT> */
 5109|      0|        }
 5110|      8|        nTautomerGroupNumber[j] ++;
 5111|      8|        nNumEndpoints++;
 5112|      8|    }
 5113|       |
 5114|   110k|    if (!nNumEndpoints)
  ------------------
  |  Branch (5114:9): [True: 110k, False: 4]
  ------------------
 5115|   110k|    {
 5116|   110k|        goto exit_function; /*  not a tautomer */
 5117|   110k|    }
 5118|       |
 5119|       |    /*  allocate temporary array */
 5120|      4|    if (!( nEndpointAtomNumber = (AT_NUMB*) inchi_calloc( nNumEndpoints, sizeof( nEndpointAtomNumber[0] ) ) ) ||
  ------------------
  |  | 1133|      4|#define inchi_calloc   calloc
  ------------------
  |  Branch (5120:9): [True: 0, False: 4]
  ------------------
 5121|      4|         !( nCurrEndpointAtNoPos = (AT_NUMB*) inchi_calloc( num_t, sizeof( nCurrEndpointAtNoPos[0] ) ) /*temp*/ ))
  ------------------
  |  | 1133|      4|#define inchi_calloc   calloc
  ------------------
  |  Branch (5121:10): [True: 0, False: 4]
  ------------------
 5122|      0|    {
 5123|      0|        goto err_exit_function; /*   program error: out of RAM */ /*   <BRKPT> */
 5124|      0|    }
 5125|       |
 5126|       |    /*
 5127|       |    * Remove missing endpoints from t_group. Since only one
 5128|       |    * disconnected part is processed, some endpoints groups may have disappeared.
 5129|       |    * Mark t_groups containing charges only for subsequent removal
 5130|       |    */
 5131|      8|    for (i = 0, nNewGroupNumber = 0; i < num_t; /*i ++*/)
  ------------------
  |  Branch (5131:38): [True: 4, False: 4]
  ------------------
 5132|      4|    {
 5133|      4|        int bNoH = 0, nNumH;
 5134|      4|        nGroupNumber = t_group[i].nGroupNumber;
 5135|      8|        for (j = 1, nNumH = t_group[i].num[0]; j < T_NUM_NO_ISOTOPIC; j++)
  ------------------
  |  |   97|      8|#define           T_NUM_NO_ISOTOPIC 2
  ------------------
  |  Branch (5135:48): [True: 4, False: 4]
  ------------------
 5136|      4|        {
 5137|      4|            nNumH -= (int) t_group[i].num[j];
 5138|      4|        }
 5139|      4|        if (t_group[i].nNumEndpoints != nTautomerGroupNumber[(int) nGroupNumber]
  ------------------
  |  Branch (5139:13): [True: 0, False: 4]
  ------------------
 5140|      4|#if ( IGNORE_TGROUP_WITHOUT_H == 1 )
 5141|      4|             || ( bNoH = ( t_group[i].num[0] == t_group[i].num[1] ) )  /* only for (H,-) t-groups; (+) t-groups are not removed */
  ------------------
  |  Branch (5141:17): [True: 0, False: 4]
  ------------------
 5142|      4|#endif
 5143|      4|             )
 5144|      0|        {
 5145|      0|            if (!nTautomerGroupNumber[(int) nGroupNumber] || bNoH)
  ------------------
  |  Branch (5145:17): [True: 0, False: 0]
  |  Branch (5145:62): [True: 0, False: 0]
  ------------------
 5146|      0|            {
 5147|       |                /*  The group belongs to another disconnected part of the structure or has only charges */
 5148|       |                /*  Remove the group */
 5149|      0|                num_t--;
 5150|      0|                if (i < num_t)
  ------------------
  |  Branch (5150:21): [True: 0, False: 0]
  ------------------
 5151|      0|                    memmove( t_group + i, t_group + i + 1, ( num_t - i ) * sizeof( t_group[0] ) );
 5152|      0|                if (bNoH)
  ------------------
  |  Branch (5152:21): [True: 0, False: 0]
  ------------------
 5153|      0|                {
 5154|       |                    /*  Group contains no mobile hydrogen atoms, only charges. Prepare to remove it. */
 5155|      0|                    nTautomerGroupNumber[(int) nGroupNumber] = 0;
 5156|      0|                    num_groups_noH++;
 5157|      0|                }
 5158|       |                /*i --;*/
 5159|      0|            }
 5160|      0|            else
 5161|      0|            {
 5162|       |                /*  Different number of endpoints */
 5163|      0|                goto err_exit_function; /*  program error */ /*   <BRKPT> */
 5164|      0|            }
 5165|      0|        }
 5166|      4|        else
 5167|      4|        {
 5168|       |            /*  Renumber t_group and prepare to renumber at[i].endpoint */
 5169|      4|            nTautomerGroupNumber[(int) nGroupNumber] =
 5170|      4|                t_group[i].nGroupNumber = ++nNewGroupNumber; /*  = i+1 */
 5171|       |                                                             /*  get first group atom orig. number position in the nEndpointAtomNumber[] */
 5172|       |                                                             /*  and in the tautomer endpoint canon numbers part of the connection table */
 5173|      4|            t_group[i].nFirstEndpointAtNoPos = nCurrEndpointAtNoPos[i] =
 5174|      4|                i ? ( t_group[i - 1].nFirstEndpointAtNoPos + t_group[i - 1].nNumEndpoints ) : 0;
  ------------------
  |  Branch (5174:17): [True: 0, False: 4]
  ------------------
 5175|      4|            t_group[i].num[0] = nNumH;
 5176|       |#if ( REMOVE_TGROUP_CHARGE == 1 )
 5177|       |            t_group[i].num[1] = 0;  /* remove only (-) charges */
 5178|       |#endif
 5179|       |                                    /* -- wrong condition. Disabled.
 5180|       |                                    if ( t_group[i].nGroupNumber != i + 1 ) { // for debug only
 5181|       |                                    goto err_exit_function; // program error
 5182|       |                                    }
 5183|       |                                    */
 5184|      4|            i++;
 5185|      4|        }
 5186|      4|    }
 5187|      4|    if (num_t != nNewGroupNumber)
  ------------------
  |  Branch (5187:9): [True: 0, False: 4]
  ------------------
 5188|      0|    {
 5189|       |        /*  for debug only */
 5190|      0|        goto err_exit_function; /*  program error */ /*   <BRKPT> */
 5191|      0|    }
 5192|       |
 5193|       |    /*  Check if any tautomer group was left */
 5194|      4|    if (!nNewGroupNumber)
  ------------------
  |  Branch (5194:9): [True: 0, False: 4]
  ------------------
 5195|      0|    {
 5196|      0|        if (!num_groups_noH)
  ------------------
  |  Branch (5196:13): [True: 0, False: 0]
  ------------------
 5197|      0|        {
 5198|      0|            goto err_exit_function; /*  program error: not a tautomer */ /*   <BRKPT> */
 5199|      0|        }
 5200|      0|        else
 5201|      0|        {
 5202|      0|            goto exit_function;
 5203|      0|        }
 5204|      0|    }
 5205|       |
 5206|       |    /*
 5207|       |    * An array for tautomer group sorting later, at the time of storing Connection Table
 5208|       |    * Later the sorting consists out of 2 steps:
 5209|       |    * 1) Sort t_group[i].nNumEndpoints endpoint atom ranks within each endpoint group
 5210|       |    *    starting from t_group[i].nFirstEndpointAtNoPos; i = 0..t_group_info->num_t_groups-1
 5211|       |    * 2) Sort the groups indexes t_group_info->tGroupNumber[]
 5212|       |    */
 5213|      4|    if (!( tGroupNumber =
  ------------------
  |  Branch (5213:9): [True: 0, False: 4]
  ------------------
 5214|      4|        (AT_NUMB*) inchi_calloc( nNewGroupNumber*TGSO_TOTAL_LEN, sizeof( tGroupNumber[0] ) ) ))
  ------------------
  |  | 1133|      4|#define inchi_calloc   calloc
  ------------------
                      (AT_NUMB*) inchi_calloc( nNewGroupNumber*TGSO_TOTAL_LEN, sizeof( tGroupNumber[0] ) ) ))
  ------------------
  |  |  169|      4|#define TGSO_TOTAL_LEN   4
  ------------------
 5215|      0|    {
 5216|      0|        goto err_exit_function; /*  out of RAM */
 5217|      0|    }
 5218|      8|    for (i = 0; i < nNewGroupNumber; i++)
  ------------------
  |  Branch (5218:17): [True: 4, False: 4]
  ------------------
 5219|      4|    {
 5220|      4|        tGroupNumber[i] = (AT_NUMB) i; /*  initialization: original t_group number = (at[i]->endpoint-1) */
 5221|      4|    }
 5222|       |    /*
 5223|       |    * Renumber endpoint atoms and save their orig. atom
 5224|       |    * numbers for filling out the tautomer part of the LinearCT.
 5225|       |    * nCurrEndpointAtNoPos[j] is an index of the atom number in the nEndpointAtomNumber[]
 5226|       |    */
 5227|     24|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (5227:17): [True: 20, False: 4]
  ------------------
 5228|     20|    {
 5229|     20|        if (j = (int) at[i].endpoint)
  ------------------
  |  Branch (5229:13): [True: 8, False: 12]
  ------------------
 5230|      8|        {
 5231|      8|            j = (int) ( at[i].endpoint = nTautomerGroupNumber[j] ) - 1; /*  new t_group number */
 5232|      8|            if (j >= 0)
  ------------------
  |  Branch (5232:17): [True: 8, False: 0]
  ------------------
 5233|      8|            {
 5234|       |                /*  j=-1 in case of no mobile hydrogen atoms (charges only), group being removed */
 5235|      8|                if (nCurrEndpointAtNoPos[j] >=   /*  debug only */
  ------------------
  |  Branch (5235:21): [True: 0, False: 8]
  ------------------
 5236|      8|                     t_group[j].nFirstEndpointAtNoPos + t_group[j].nNumEndpoints)
 5237|      0|                {
 5238|      0|                    goto err_exit_function; /*  program error */ /*   <BRKPT> */
 5239|      0|                }
 5240|      8|                nEndpointAtomNumber[(int) nCurrEndpointAtNoPos[j] ++] = (AT_NUMB) i;
 5241|      8|            }
 5242|      0|            else
 5243|      0|            {
 5244|      0|                nNumEndpoints--; /*  endpoint has been removed */
 5245|      0|            }
 5246|      8|        }
 5247|     20|    }
 5248|      4|    t_group_info->num_t_groups = nNewGroupNumber;
 5249|      4|    t_group_info->nNumEndpoints = nNumEndpoints;
 5250|      4|    t_group_info->nEndpointAtomNumber = nEndpointAtomNumber;
 5251|      4|    t_group_info->tGroupNumber = tGroupNumber; /* only the 1st segment filled */
 5252|      4|    inchi_free( nTautomerGroupNumber );
  ------------------
  |  | 1136|      4|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 4, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 5253|      4|    inchi_free( nCurrEndpointAtNoPos );
  ------------------
  |  | 1136|      4|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 4, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 5254|      4|    return nNumEndpoints + T_GROUP_HDR_LEN * nNewGroupNumber + 1; /*  nLenLinearCTTautomer */
  ------------------
  |  |  100|      4|#define           T_GROUP_HDR_LEN   (1+T_NUM_NO_ISOTOPIC /*+T_NUM_ISOTOPIC*/) /* LinearCTTautomer */
  |  |  ------------------
  |  |  |  |   97|      4|#define           T_NUM_NO_ISOTOPIC 2
  |  |  ------------------
  ------------------
 5255|       |
 5256|      0|err_exit_function:
 5257|      0|    ret = CT_TAUCOUNT_ERR;
  ------------------
  |  |   52|      0|#define CT_TAUCOUNT_ERR      (CT_ERR_FIRST- 5)  /*(-30005) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 5258|       |
 5259|   110k|exit_function:
 5260|       |
 5261|       |    /*  release allocated memory; set "no tautomeric group" */
 5262|   110k|    if (nEndpointAtomNumber)
  ------------------
  |  Branch (5262:9): [True: 0, False: 110k]
  ------------------
 5263|      0|    {
 5264|      0|        inchi_free( nEndpointAtomNumber );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 5265|      0|    }
 5266|   110k|    if (nTautomerGroupNumber)
  ------------------
  |  Branch (5266:9): [True: 0, False: 110k]
  ------------------
 5267|      0|    {
 5268|      0|        inchi_free( nTautomerGroupNumber );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 5269|      0|    }
 5270|   110k|    if (tGroupNumber)
  ------------------
  |  Branch (5270:9): [True: 0, False: 110k]
  ------------------
 5271|      0|    {
 5272|      0|        inchi_free( tGroupNumber );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 5273|      0|    }
 5274|   110k|    if (nCurrEndpointAtNoPos)
  ------------------
  |  Branch (5274:9): [True: 0, False: 110k]
  ------------------
 5275|      0|    {
 5276|      0|        inchi_free( nCurrEndpointAtNoPos );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 5277|      0|    }
 5278|   110k|    t_group_info->nNumEndpoints = 0;
 5279|   110k|    t_group_info->num_t_groups = 0;
 5280|   110k|    if (!ret && ( ( t_group_info->tni.bNormalizationFlags & FLAG_NORM_CONSIDER_TAUT ) ||
  ------------------
  |  |  184|   110k|#define FLAG_NORM_CONSIDER_TAUT      ( FLAG_PROTON_NPO_SIMPLE_REMOVED | \
  |  |  ------------------
  |  |  |  |  174|   110k|#define FLAG_PROTON_NPO_SIMPLE_REMOVED 0x0001
  |  |  ------------------
  |  |  185|   110k|                                       FLAG_PROTON_NP_HARD_REMOVED    | \
  |  |  ------------------
  |  |  |  |  175|   110k|#define FLAG_PROTON_NP_HARD_REMOVED    0x0002
  |  |  ------------------
  |  |  186|   110k|                                       FLAG_PROTON_AC_SIMPLE_ADDED    | \
  |  |  ------------------
  |  |  |  |  176|   110k|#define FLAG_PROTON_AC_SIMPLE_ADDED    0x0004
  |  |  ------------------
  |  |  187|   110k|                                       FLAG_PROTON_AC_SIMPLE_REMOVED  | \
  |  |  ------------------
  |  |  |  |  177|   110k|#define FLAG_PROTON_AC_SIMPLE_REMOVED  0x0008
  |  |  ------------------
  |  |  188|   110k|                                       FLAG_PROTON_AC_HARD_REMOVED    | \
  |  |  ------------------
  |  |  |  |  178|   110k|#define FLAG_PROTON_AC_HARD_REMOVED    0x0010
  |  |  ------------------
  |  |  189|   110k|                                       FLAG_PROTON_AC_HARD_ADDED      | \
  |  |  ------------------
  |  |  |  |  179|   110k|#define FLAG_PROTON_AC_HARD_ADDED      0x0020
  |  |  ------------------
  |  |  190|   110k|                                       FLAG_PROTON_SINGLE_REMOVED     | \
  |  |  ------------------
  |  |  |  |  181|   110k|#define FLAG_PROTON_SINGLE_REMOVED     0x0080
  |  |  ------------------
  |  |  191|   110k|                                       FLAG_PROTON_CHARGE_CANCEL    )
  |  |  ------------------
  |  |  |  |  180|   110k|#define FLAG_PROTON_CHARGE_CANCEL      0x0040
  |  |  ------------------
  ------------------
  |  Branch (5280:9): [True: 110k, False: 0]
  |  Branch (5280:19): [True: 1, False: 110k]
  ------------------
 5281|   110k|                  t_group_info->nNumIsotopicEndpoints > 1 && ( t_group_info->bTautFlagsDone & ( TG_FLAG_FOUND_ISOTOPIC_H_DONE | TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE ) ) ))
  ------------------
  |  |  978|      0|#define TG_FLAG_FOUND_ISOTOPIC_H_DONE    0x00004000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
                                t_group_info->nNumIsotopicEndpoints > 1 && ( t_group_info->bTautFlagsDone & ( TG_FLAG_FOUND_ISOTOPIC_H_DONE | TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE ) ) ))
  ------------------
  |  |  979|      0|#define TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE 0x00008000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
  |  Branch (5281:19): [True: 0, False: 110k]
  |  Branch (5281:62): [True: 0, False: 0]
  ------------------
 5282|      1|    {
 5283|      1|        ret = 1; /* only protons have been (re)moved or neitralization happened */
 5284|      1|    }
 5285|       |
 5286|   110k|    return ret;
 5287|      0|}
CompRankTautomer:
 5532|      4|{
 5533|      4|    AT_RANK *pn_tRankForSort = (AT_RANK *) p;
 5534|      4|    int ret = (int) pn_tRankForSort[(int) ( *(const AT_RANK*) a1 )] -
 5535|      4|        (int) pn_tRankForSort[(int) ( *(const AT_RANK*) a2 )];
 5536|       |
 5537|      4|    return ret;
 5538|      4|}
SortTautomerGroupsAndEndpoints:
 5547|   110k|{
 5548|   110k|    int i, nFirstEndpointAtNoPos, nNumEndpoints;
 5549|   110k|    AT_RANK *pn_tRankForSort;
 5550|   110k|    AT_NUMB  *nEndpointAtomNumber;
 5551|   110k|    int       num_t_groups = num_at_tg - num_atoms;
 5552|   110k|    T_GROUP   *t_group = NULL;
 5553|       |
 5554|       |    /*  Check if sorting is required */
 5555|   110k|    if (num_t_groups <= 0 || t_group_info->nNumEndpoints < 2)
  ------------------
  |  Branch (5555:9): [True: 110k, False: 4]
  |  Branch (5555:30): [True: 0, False: 4]
  ------------------
 5556|   110k|    {
 5557|   110k|        return 0; /*  no tautomer data */
 5558|   110k|    }
 5559|       |
 5560|      4|    t_group = t_group_info->t_group;
 5561|       |
 5562|       |    /*  Sort endpoints within the groups */
 5563|      8|    for (i = 0; i < num_t_groups; i++)
  ------------------
  |  Branch (5563:17): [True: 4, False: 4]
  ------------------
 5564|      4|    {
 5565|      4|        if (t_group[i].nNumEndpoints < 2)
  ------------------
  |  Branch (5565:13): [True: 0, False: 4]
  ------------------
 5566|      0|        {
 5567|      0|            continue;  /*  program error; should not happen */ /*   <BRKPT> */
 5568|      0|        }
 5569|       |
 5570|       |        /*  Set globals for sorting */
 5571|      4|        nFirstEndpointAtNoPos = t_group[i].nFirstEndpointAtNoPos;
 5572|      4|        nNumEndpoints = t_group[i].nNumEndpoints;
 5573|      4|        if (nNumEndpoints + nFirstEndpointAtNoPos > t_group_info->nNumEndpoints)
  ------------------
  |  Branch (5573:13): [True: 0, False: 4]
  ------------------
 5574|      0|        {
 5575|       |            /*  for debug only */
 5576|      0|            return CT_TAUCOUNT_ERR; /*  program error */ /*   <BRKPT> */
  ------------------
  |  |   52|      0|#define CT_TAUCOUNT_ERR      (CT_ERR_FIRST- 5)  /*(-30005) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 5577|      0|        }
 5578|      4|        nEndpointAtomNumber = t_group_info->nEndpointAtomNumber + (int) nFirstEndpointAtNoPos;
 5579|      4|        pn_tRankForSort = nRank;
 5580|       |
 5581|      4|        insertions_sort( pn_tRankForSort, nEndpointAtomNumber, nNumEndpoints,
 5582|      4|                         sizeof( nEndpointAtomNumber[0] ), CompRankTautomer );
 5583|      4|    }
 5584|       |
 5585|       |    /*  Sort the tautomeric groups according to their ranks only
 5586|       |    (that is, ignoring the isotopic composition of the mobile groups and ranks of the endpoints) */
 5587|      4|    if (t_group_info->num_t_groups > 1)
  ------------------
  |  Branch (5587:9): [True: 0, False: 4]
  ------------------
 5588|      0|    {
 5589|       |        /*  Set globals for sorting */
 5590|       |        /*  a hack: the ranks of all tautomeric groups are */
 5591|       |        /*  located at nRank[num_atoms..num_at_tg-1] */
 5592|      0|        pn_tRankForSort = nRank + num_atoms;
 5593|       |        /*  Sort */
 5594|       |        /*  ordering numbers to sort : t_group_info->tGroupNumber; */
 5595|       |
 5596|      0|        insertions_sort( pn_tRankForSort, t_group_info->tGroupNumber,
 5597|      0|                         num_t_groups, sizeof( t_group_info->tGroupNumber[0] ),
 5598|      0|                         CompRankTautomer );
 5599|      0|    }
 5600|       |
 5601|      4|    return t_group_info->num_t_groups;
 5602|      4|}

base26_triplet_1:
 1165|    558|{
 1166|    558|    UINT32 b0, b1, h;
 1167|    558|    b0 = (UINT32) a[0];             /* 1111 1111  */
 1168|    558|#ifndef FIX_BASE26_ENC_BUG
 1169|    558|    b1 = (UINT32) ( a[1] & 0x3f );  /* 0011 1111  */
 1170|    558|    h = (UINT32) ( b0 | b1 << 8 );
 1171|       |#else
 1172|       |    b1 = (UINT32) ( a[1] & 0xfc );  /* 1111 1100  */
 1173|       |    h = (UINT32) ( b0 << 8 | b1 ) >> 2;
 1174|       |#endif
 1175|    558|    return t26[h];
 1176|    558|}
base26_triplet_2:
 1183|    558|{
 1184|    558|    UINT32 b0, b1, b2, h;
 1185|    558|#ifndef FIX_BASE26_ENC_BUG
 1186|    558|    b0 = (UINT32) ( a[1] & 0xc0 );   /* 1100 0000  */
 1187|    558|    b1 = (UINT32) ( a[2] );         /* 1111 1111  */
 1188|    558|    b2 = (UINT32) ( a[3] & 0x0f );  /* 0000 1111  */
 1189|    558|    h = (UINT32) ( b0 | b1 << 8 | b2 << 16 ) >> 6;
 1190|       |#else
 1191|       |    b0 = (UINT32) ( a[1] & 0x03 );   /* 0000 0011 */
 1192|       |    b1 = (UINT32) ( a[2] );         /* 1111 1111 */
 1193|       |    b2 = (UINT32) ( a[3] & 0xf0 );  /* 1111 0000 */
 1194|       |    h = (UINT32) ( b0 << 16 | b1 << 8 | b2 ) >> 4;
 1195|       |#endif
 1196|    558|    return t26[h];
 1197|    558|}
base26_triplet_3:
 1204|    279|{
 1205|    279|    UINT32 b0, b1, b2, h;
 1206|    279|#ifndef FIX_BASE26_ENC_BUG
 1207|    279|    b0 = (UINT32) ( a[3] & 0xf0 );   /* 1111 0000  */
 1208|    279|    b1 = (UINT32) ( a[4] );         /* 1111 1111  */
 1209|    279|    b2 = (UINT32) ( a[5] & 0x03 );  /* 0000 0011  */
 1210|    279|    h = (UINT32) ( b0 | b1 << 8 | b2 << 16 ) >> 4;
 1211|       |#else
 1212|       |    b0 = (UINT32) ( a[3] & 0x0f );   /* 0000 1111 */
 1213|       |    b1 = (UINT32) ( a[4] );         /* 1111 1111  */
 1214|       |    b2 = (UINT32) ( a[5] & 0xc0 );  /* 1100 0000  */
 1215|       |    h = (UINT32) ( b0 << 16 | b1 << 8 | b2 ) >> 6;
 1216|       |#endif
 1217|    279|    return t26[h];
 1218|    279|}
base26_triplet_4:
 1225|    279|{
 1226|    279|    UINT32 b0, b1, h;
 1227|    279|#ifndef FIX_BASE26_ENC_BUG
 1228|    279|    b0 = (UINT32) ( a[5] & 0xfc );   /* 1111 1100  */
 1229|    279|    b1 = (UINT32) ( a[6] );         /* 1111 1111  */
 1230|    279|    h = (UINT32) ( b0 | b1 << 8 ) >> 2;
 1231|       |#else
 1232|       |    b0 = (UINT32) ( a[5] & 0x3f );   /* 0011 1111  */
 1233|       |    b1 = (UINT32) ( a[6] );         /* 1111 1111  */
 1234|       |    h = (UINT32) ( b0 << 8 | b1 );
 1235|       |#endif
 1236|    279|    return t26[h];
 1237|    279|}
base26_dublet_for_bits_28_to_36:
 1254|    279|{
 1255|    279|    UINT32 b0, b1, h;
 1256|    279|#ifndef FIX_BASE26_ENC_BUG
 1257|    279|    b0 = (UINT32) ( a[3] & 0xf0 );    /* 1111 0000  */
 1258|    279|    b1 = (UINT32) ( a[4] & 0x1f );    /* 0001 1111  */
 1259|    279|    h = (UINT32) ( b0 | b1 << 8 ) >> 4;
 1260|       |#else
 1261|       |    b0 = (UINT32) ( a[3] & 0x0f );    /* 0000 1111  */
 1262|       |    b1 = (UINT32) ( a[4] & 0xf8 );    /* 1111 1000  */
 1263|       |    h = (UINT32) ( b0 << 8 | b1 ) >> 3;
 1264|       |#endif
 1265|    279|    return d26[h];
 1266|    279|}
base26_dublet_for_bits_56_to_64:
 1279|    279|{
 1280|    279|    UINT32 b0, b1, h;
 1281|    279|#ifndef FIX_BASE26_ENC_BUG
 1282|    279|    b0 = (UINT32) ( a[7] );            /* 1111 1111  */
 1283|    279|    b1 = (UINT32) ( a[8] & 0x01 );    /* 0000 0001  */
 1284|    279|    h = (UINT32) ( b0 | b1 << 8 );
 1285|       |#else
 1286|       |    b0 = (UINT32) ( a[7] );            /* 1111 1111  */
 1287|       |    b1 = (UINT32) ( a[8] & 0x80 );    /* 1000 0000  */
 1288|       |    h = (UINT32) ( b0 << 8 | b1 ) >> 7;
 1289|       |#endif
 1290|    279|    return d26[h];
 1291|    279|}

GetINCHIKeyFromINCHI:
  111|    288|{
  112|    288|    int ret = INCHIKEY_OK;
  ------------------
  |  | 1043|    288|#define INCHIKEY_OK 0
  ------------------
  113|    288|    int ret1 = INCHIKEY_OK;
  ------------------
  |  | 1043|    288|#define INCHIKEY_OK 0
  ------------------
  114|    288|    int cn;
  115|    288|    size_t slen, i, j, jproto = 0, ncp, pos_slash1 = 0;
  116|    288|    char *str = NULL, *smajor = NULL, *sminor = NULL,
  117|    288|        *sproto = NULL, *stmp = NULL, tmp[MINOUTLENGTH];
  118|    288|    unsigned char
  119|    288|        digest_major[32], digest_minor[32];
  120|       |
  121|    288|    char flagstd = 'S', /* standard key */
  122|    288|        flagnonstd = 'N', /* non-standard key */
  123|    288|        flagexptl = 'B', /* experimental ('beta') key */
  124|    288|        flagver = 'A', /* InChI v. 1 */
  125|    288|        flagproto = 'N'; /* no [de]protonization , by default */
  126|    288|    int  nprotons;
  127|       |    /*
  128|       |    Protonization encoding:
  129|       |    N 0
  130|       |    O +1 P +2 Q +3 R +4 S +5 T +6 U +7 V +8 W +9 X +10 Y +11 Z +12
  131|       |    M -1 L-2 K -3 J -4 I -5 H -6 G -7 F -8 E -9 D -10 C -11 B -12
  132|       |    A < -12 or > +12
  133|       |    */
  134|    288|    static const char *pplus = "OPQRSTUVWXYZ";
  135|    288|    static const char *pminus = "MLKJIHGFEDCB";
  136|    288|    int is_stdinchi = 0;    /* 0 -  non-standard,
  137|       |                               1    standard
  138|       |                              -1    experimental ('beta') */
  139|       |
  140|       |
  141|       |
  142|    288|    if (NULL != szXtra1) /* Software version 1.06 added check to fix bug with NULL szXtra, thanks to WDI */
  ------------------
  |  Branch (142:9): [True: 288, False: 0]
  ------------------
  143|    288|    {
  144|    288|        szXtra1[0] = '\0';
  145|    288|    }
  146|    288|    if (NULL != szXtra2)
  ------------------
  |  Branch (146:9): [True: 288, False: 0]
  ------------------
  147|    288|    {
  148|    288|        szXtra2[0] = '\0';
  149|    288|    }
  150|       |
  151|       |    /* Check if input is a valid InChI string */
  152|       |
  153|       |    /* .. non-empty */
  154|    288|    if (szINCHISource == NULL)
  ------------------
  |  Branch (154:9): [True: 0, False: 288]
  ------------------
  155|      0|    {
  156|      0|        return INCHIKEY_EMPTY_INPUT;
  ------------------
  |  | 1045|      0|#define INCHIKEY_EMPTY_INPUT 2
  ------------------
  157|      0|    }
  158|       |
  159|    288|    slen = strlen( szINCHISource );
  160|       |
  161|       |    /* .. has valid prefix */
  162|    288|    if (slen < LEN_INCHI_STRING_PREFIX + 3)
  ------------------
  |  |  767|    288|#define LEN_INCHI_STRING_PREFIX 6
  ------------------
  |  Branch (162:9): [True: 3, False: 285]
  ------------------
  163|      3|    {
  164|      3|        return INCHIKEY_INVALID_INCHI_PREFIX;
  ------------------
  |  | 1046|      3|#define INCHIKEY_INVALID_INCHI_PREFIX 3
  ------------------
  165|      3|    }
  166|    285|    if (memcmp( szINCHISource, INCHI_STRING_PREFIX, LEN_INCHI_STRING_PREFIX ))
  ------------------
  |  |  766|    285|#define INCHI_STRING_PREFIX "InChI="
  ------------------
                  if (memcmp( szINCHISource, INCHI_STRING_PREFIX, LEN_INCHI_STRING_PREFIX ))
  ------------------
  |  |  767|    285|#define LEN_INCHI_STRING_PREFIX 6
  ------------------
  |  Branch (166:9): [True: 2, False: 283]
  ------------------
  167|      2|    {
  168|      2|        return INCHIKEY_INVALID_INCHI_PREFIX;
  ------------------
  |  | 1046|      2|#define INCHIKEY_INVALID_INCHI_PREFIX 3
  ------------------
  169|      2|    }
  170|       |
  171|       |    /* .. has InChI version 1 */
  172|       |    /* if (!isdigit(szINCHISource[LEN_INCHI_STRING_PREFIX]) )  */
  173|    283|    if (szINCHISource[LEN_INCHI_STRING_PREFIX] != '1')
  ------------------
  |  |  767|    283|#define LEN_INCHI_STRING_PREFIX 6
  ------------------
  |  Branch (173:9): [True: 0, False: 283]
  ------------------
  174|      0|        return INCHIKEY_INVALID_INCHI_PREFIX;
  ------------------
  |  | 1046|      0|#define INCHIKEY_INVALID_INCHI_PREFIX 3
  ------------------
  175|       |
  176|       |    /* .. optionally has a 'standard' flag character */
  177|    283|    pos_slash1 = LEN_INCHI_STRING_PREFIX + 1;
  ------------------
  |  |  767|    283|#define LEN_INCHI_STRING_PREFIX 6
  ------------------
  178|    283|    if (szINCHISource[pos_slash1] == 'S')
  ------------------
  |  Branch (178:9): [True: 0, False: 283]
  ------------------
  179|      0|    {
  180|       |        /* Standard InChI ==> standard InChIKey */
  181|      0|        is_stdinchi = 1;
  182|      0|        pos_slash1++;
  183|      0|    }
  184|    283|    else if (szINCHISource[pos_slash1] == 'B')
  ------------------
  |  Branch (184:14): [True: 0, False: 283]
  ------------------
  185|      0|    {
  186|       |        /* v. 1.05 Experimental ('beta') InChI ==> corresponding InChIKey */
  187|      0|        is_stdinchi = -1;
  188|      0|        pos_slash1++;
  189|      0|    }
  190|       |
  191|       |    /* .. has trailing slash in the right place */
  192|    283|    if (szINCHISource[pos_slash1] != '/')
  ------------------
  |  Branch (192:9): [True: 0, False: 283]
  ------------------
  193|      0|    {
  194|      0|        return INCHIKEY_INVALID_INCHI_PREFIX;
  ------------------
  |  | 1046|      0|#define INCHIKEY_INVALID_INCHI_PREFIX 3
  ------------------
  195|      0|    }
  196|       |
  197|       |    /* .. the rest of source string contains at least one a..Z0.9 or slash */
  198|    283|    if (!isalnum( szINCHISource[pos_slash1 + 1] ))
  ------------------
  |  Branch (198:9): [True: 21, False: 262]
  ------------------
  199|     21|    {
  200|     21|        int valid_empty_inchi = szINCHISource[pos_slash1 + 1] == '/';
  201|     21|        int allowed_and_valid_err_inchi = 0;
  202|     21|        if (!valid_empty_inchi)
  ------------------
  |  Branch (202:13): [True: 0, False: 21]
  ------------------
  203|      0|        {
  204|      0|            allowed_and_valid_err_inchi = szINCHISource[pos_slash1 + 1] == '?';
  205|      0|            if (!allowed_and_valid_err_inchi)
  ------------------
  |  Branch (205:17): [True: 0, False: 0]
  ------------------
  206|      0|            {
  207|      0|                return INCHIKEY_INVALID_INCHI;
  ------------------
  |  | 1048|      0|#define INCHIKEY_INVALID_INCHI 20
  ------------------
  208|      0|            }
  209|      0|        }
  210|     21|    }
  211|       |
  212|       |    /* Ok. Will use a local copy of the source. */
  213|       |
  214|    283|    extract_inchi_substring( &str, szINCHISource, slen );
  215|    283|    if (NULL == str)
  ------------------
  |  Branch (215:9): [True: 0, False: 283]
  ------------------
  216|      0|    {
  217|      0|        ret = INCHIKEY_NOT_ENOUGH_MEMORY;
  ------------------
  |  | 1047|      0|#define INCHIKEY_NOT_ENOUGH_MEMORY 4
  ------------------
  218|      0|        goto fin;
  219|      0|    }
  220|    283|    slen = strlen( str );
  221|       |
  222|       |
  223|       |    /* Make buffers. */
  224|    283|    smajor = (char*) inchi_calloc( slen + 1, sizeof( char ) );
  ------------------
  |  | 1133|    283|#define inchi_calloc   calloc
  ------------------
  225|    283|    if (NULL == smajor)
  ------------------
  |  Branch (225:9): [True: 0, False: 283]
  ------------------
  226|      0|    {
  227|      0|        ret = INCHIKEY_NOT_ENOUGH_MEMORY; goto fin;
  ------------------
  |  | 1047|      0|#define INCHIKEY_NOT_ENOUGH_MEMORY 4
  ------------------
  228|      0|    }
  229|    283|    sminor = (char*) inchi_calloc( 2 * slen + 2, sizeof( char ) ); /* we may double the length ... */
  ------------------
  |  | 1133|    283|#define inchi_calloc   calloc
  ------------------
  230|    283|    if (NULL == sminor)
  ------------------
  |  Branch (230:9): [True: 0, False: 283]
  ------------------
  231|      0|    {
  232|      0|        ret = INCHIKEY_NOT_ENOUGH_MEMORY; goto fin;
  ------------------
  |  | 1047|      0|#define INCHIKEY_NOT_ENOUGH_MEMORY 4
  ------------------
  233|      0|    }
  234|    283|    stmp = (char*) inchi_calloc( slen + 1, sizeof( char ) );
  ------------------
  |  | 1133|    283|#define inchi_calloc   calloc
  ------------------
  235|    283|    if (NULL == stmp)
  ------------------
  |  Branch (235:9): [True: 0, False: 283]
  ------------------
  236|      0|    {
  237|      0|        ret = INCHIKEY_NOT_ENOUGH_MEMORY; goto fin;
  ------------------
  |  | 1047|      0|#define INCHIKEY_NOT_ENOUGH_MEMORY 4
  ------------------
  238|      0|    }
  239|    283|    sproto = (char*) inchi_calloc( slen + 1, sizeof( char ) );
  ------------------
  |  | 1133|    283|#define inchi_calloc   calloc
  ------------------
  240|    283|    if (NULL == sproto)
  ------------------
  |  Branch (240:9): [True: 0, False: 283]
  ------------------
  241|      0|    {
  242|      0|        ret = INCHIKEY_NOT_ENOUGH_MEMORY; goto fin;
  ------------------
  |  | 1047|      0|#define INCHIKEY_NOT_ENOUGH_MEMORY 4
  ------------------
  243|      0|    }
  244|       |
  245|    283|    szINCHIKey[0] = '\0';
  246|       |
  247|       |    /* Extract the major block */
  248|    283|    smajor[0] = '\0';
  249|  1.90M|    for (j = pos_slash1 + 1; j < slen - 1; j++)
  ------------------
  |  Branch (249:30): [True: 1.90M, False: 69]
  ------------------
  250|  1.90M|    {
  251|  1.90M|        if (str[j] == '/')
  ------------------
  |  Branch (251:13): [True: 11.3k, False: 1.88M]
  ------------------
  252|  11.3k|        {
  253|  11.3k|            cn = str[j + 1];
  254|  11.3k|            switch (cn)
  255|  11.3k|            {
  256|       |                /* anything allowed from a major part */
  257|     41|                case 'c':
  ------------------
  |  Branch (257:17): [True: 41, False: 11.3k]
  ------------------
  258|    180|                case 'h':
  ------------------
  |  Branch (258:17): [True: 139, False: 11.2k]
  ------------------
  259|    186|                case 'q':   continue;
  ------------------
  |  Branch (259:17): [True: 6, False: 11.3k]
  ------------------
  260|       |
  261|       |                /* "/p"; protons now go to to special string, not to minor hash */
  262|  10.9k|                case 'p':
  ------------------
  |  Branch (262:17): [True: 10.9k, False: 400]
  ------------------
  263|  10.9k|                    jproto = j;
  264|  10.9k|                    continue;
  265|       |
  266|       |        /* "/f",  "/r" : may not occur in stdInChI */
  267|     45|                case 'f':
  ------------------
  |  Branch (267:17): [True: 45, False: 11.3k]
  ------------------
  268|     52|                case 'r':
  ------------------
  |  Branch (268:17): [True: 7, False: 11.3k]
  ------------------
  269|     52|                    if (is_stdinchi==1)
  ------------------
  |  Branch (269:25): [True: 0, False: 52]
  ------------------
  270|      0|                    {
  271|      0|                        ret = INCHIKEY_INVALID_STD_INCHI;
  ------------------
  |  | 1049|      0|#define INCHIKEY_INVALID_STD_INCHI 21
  ------------------
  272|      0|                        goto fin;
  273|      0|                    }
  274|     52|                    break;
  275|       |
  276|       |        /* anything allowed from a minor part */
  277|    162|                default:
  ------------------
  |  Branch (277:17): [True: 162, False: 11.1k]
  ------------------
  278|    162|                    break;
  279|  11.3k|            }
  280|    214|            break;
  281|  11.3k|        }
  282|  1.90M|    }
  283|    283|    j++;
  284|    283|    if (j == slen)
  ------------------
  |  Branch (284:9): [True: 69, False: 214]
  ------------------
  285|     69|    {
  286|     69|        j++;
  287|     69|    }
  288|    214|    else
  289|    214|    {
  290|    214|        j--;
  291|    214|    }
  292|       |
  293|    283|    if (jproto)
  ------------------
  |  Branch (293:9): [True: 6, False: 277]
  ------------------
  294|      6|    {
  295|      6|        ncp = jproto - pos_slash1 - 1;
  296|      6|    }
  297|    277|    else
  298|    277|    {
  299|    277|        ncp = j - pos_slash1 - 1;
  300|    277|    }
  301|       |
  302|       |
  303|       |    /* Trim 'InChI=1[S]/' */
  304|    283|    memcpy( smajor, str + pos_slash1 + 1, ncp * sizeof( str[0] ) );
  305|    283|    smajor[ncp] = '\0';
  306|       |
  307|       |
  308|       |    /* Treat protonization */
  309|    283|    if (jproto)
  ------------------
  |  Branch (309:9): [True: 6, False: 277]
  ------------------
  310|      6|    {
  311|       |        /* 2009-01-07 fix bug/typo: assigned incorrect length to the protonation segment of
  312|       |        /* source string ( was sproto[ncp]='\0'; should be sproto[lenproto]='\0'; )  */
  313|      6|        int lenproto = j - (int) jproto;
  314|      6|        if (lenproto < 3)
  ------------------
  |  Branch (314:13): [True: 0, False: 6]
  ------------------
  315|      0|        {
  316|       |            /* empty "/p", should not occur */
  317|      0|            ret = INCHIKEY_INVALID_INCHI;
  ------------------
  |  | 1048|      0|#define INCHIKEY_INVALID_INCHI 20
  ------------------
  318|      0|            goto fin;
  319|      0|        }
  320|       |
  321|      6|        memcpy( sproto, str + pos_slash1 + ncp + 1, lenproto * sizeof( str[0] ) );
  322|      6|        sproto[lenproto] = '\0';
  323|       |
  324|      6|        nprotons = strtol( sproto + 2, NULL, 10 );
  325|       |
  326|      6|        if (nprotons > 0)
  ------------------
  |  Branch (326:13): [True: 2, False: 4]
  ------------------
  327|      2|        {
  328|      2|            if (nprotons > 12)
  ------------------
  |  Branch (328:17): [True: 1, False: 1]
  ------------------
  329|      1|            {
  330|      1|                flagproto = 'A';
  331|      1|            }
  332|      1|            else
  333|      1|            {
  334|      1|                flagproto = pplus[nprotons - 1];
  335|      1|            }
  336|      2|        }
  337|      4|        else if (nprotons < 0)
  ------------------
  |  Branch (337:18): [True: 0, False: 4]
  ------------------
  338|      0|        {
  339|      0|            if (nprotons < -12)
  ------------------
  |  Branch (339:17): [True: 0, False: 0]
  ------------------
  340|      0|            {
  341|      0|                flagproto = 'A';
  342|      0|            }
  343|      0|            else
  344|      0|            {
  345|      0|                flagproto = pminus[-nprotons - 1];
  346|      0|            }
  347|      0|        }
  348|      4|        else
  349|      4|        {
  350|       |            /* should never occur */
  351|      4|            ret = INCHIKEY_INVALID_STD_INCHI;
  ------------------
  |  | 1049|      4|#define INCHIKEY_INVALID_STD_INCHI 21
  ------------------
  352|      4|            goto fin;
  353|      4|        }
  354|      6|    }
  355|       |
  356|       |    /* Extract the minor block. */
  357|       |
  358|    279|    if (j != slen + 1)    /* check that something exists at right.*/
  ------------------
  |  Branch (358:9): [True: 211, False: 68]
  ------------------
  359|    211|    {
  360|    211|        ncp = slen - j;
  361|    211|        memcpy( sminor, str + j, ( ncp ) * sizeof( str[0] ) );
  362|    211|        sminor[ncp] = '\0';
  363|    211|    }
  364|     68|    else
  365|     68|    {
  366|     68|        sminor[0] = '\0';
  367|     68|    }
  368|       |
  369|       |
  370|       |#if INCHIKEY_DEBUG
  371|       |    ITRACE_( "Source:  {%-s}\n", str );
  372|       |    ITRACE_( "SMajor:  {%-s}\n", smajor );
  373|       |    ITRACE_( "SMinor:  {%-s}\n", sminor );
  374|       |    ITRACE_( "SProto:  {%-s}\n", sproto );
  375|       |#endif
  376|       |
  377|       |    /* Compute and compose the InChIKey string. */
  378|       |
  379|       |    /* Major hash sub-string. */
  380|  9.20k|    for (i = 0; i < 32; i++)
  ------------------
  |  Branch (380:17): [True: 8.92k, False: 279]
  ------------------
  381|  8.92k|    {
  382|  8.92k|        digest_major[i] = 0;
  383|  8.92k|    }
  384|       |
  385|    279|    sha2_csum( (unsigned char *) smajor, (int) strlen( smajor ), digest_major );
  386|       |
  387|    279|    sprintf( tmp, "%-.3s%-.3s%-.3s%-.3s%-.2s",
  388|    279|             base26_triplet_1( digest_major ), base26_triplet_2( digest_major ),
  389|    279|             base26_triplet_3( digest_major ), base26_triplet_4( digest_major ),
  390|    279|             base26_dublet_for_bits_56_to_64( digest_major ) );
  391|    279|    strcat( szINCHIKey, tmp );
  392|       |#if (INCHIKEY_DEBUG>1)
  393|       |    fprint_digest( stderr, "Major hash, full SHA-256", digest_major );
  394|       |#endif
  395|       |
  396|       |
  397|       |    /* Minor hash sub-string. */
  398|  9.20k|    for (i = 0; i < 32; i++)
  ------------------
  |  Branch (398:17): [True: 8.92k, False: 279]
  ------------------
  399|  8.92k|    {
  400|  8.92k|        digest_minor[i] = 0;
  401|  8.92k|    }
  402|    279|    slen = strlen( sminor );
  403|    279|    if (( slen > 0 ) && ( slen < 255 ))
  ------------------
  |  Branch (403:9): [True: 211, False: 68]
  |  Branch (403:25): [True: 54, False: 157]
  ------------------
  404|     54|    {
  405|     54|        strcpy( stmp, sminor );
  406|     54|        strcpy( sminor + slen, stmp );
  407|     54|    }
  408|       |
  409|    279|    sha2_csum( (unsigned char *) sminor, (int) strlen( sminor ), digest_minor );
  410|       |
  411|       |#if (INCHIKEY_DEBUG>1)
  412|       |    fprint_digest( stderr, "Minor hash, full SHA-256", digest_minor );
  413|       |#endif
  414|       |
  415|    279|    strcat( szINCHIKey, "-" );
  416|    279|    sprintf( tmp, "%-.3s%-.3s%-.2s",
  417|    279|             base26_triplet_1( digest_minor ),
  418|    279|             base26_triplet_2( digest_minor ),
  419|    279|             base26_dublet_for_bits_28_to_36( digest_minor ) );
  420|    279|    strcat( szINCHIKey, tmp );
  421|       |
  422|       |    /* Append a standard/non-standard flag */
  423|    279|    slen = strlen( szINCHIKey );
  424|    279|    if (is_stdinchi == 1)
  ------------------
  |  Branch (424:9): [True: 0, False: 279]
  ------------------
  425|      0|    {
  426|      0|        szINCHIKey[slen] = flagstd;
  427|      0|    }
  428|    279|    else if (is_stdinchi == -1)
  ------------------
  |  Branch (428:14): [True: 0, False: 279]
  ------------------
  429|      0|    {
  430|      0|        szINCHIKey[slen] = flagexptl;
  431|      0|    }
  432|    279|    else
  433|    279|    {
  434|    279|        szINCHIKey[slen] = flagnonstd;
  435|    279|    }
  436|       |
  437|       |    /* Append InChI v.1 flag */
  438|    279|    szINCHIKey[slen + 1] = flagver;
  439|       |
  440|       |    /* Append dash  */
  441|    279|    szINCHIKey[slen + 2] = '-';
  442|       |
  443|       |    /* Append protonization flag */
  444|    279|    szINCHIKey[slen + 3] = flagproto;
  445|    279|    szINCHIKey[slen + 4] = '\0';
  446|       |
  447|       |
  448|       |#if INCHIKEY_DEBUG
  449|       |    ITRACE_( "szINCHIKey:  {%-s}\n", szINCHIKey );
  450|       |#endif
  451|       |
  452|       |    /* Hash extensions */
  453|    279|    if (xtra1 && szXtra1)
  ------------------
  |  Branch (453:9): [True: 0, False: 279]
  |  Branch (453:18): [True: 0, False: 0]
  ------------------
  454|      0|    {
  455|      0|        get_xtra_hash_major_hex( digest_major, szXtra1 );
  456|       |#if INCHIKEY_DEBUG
  457|       |        fprintf( stderr, "XHash1=%-s\n", szXtra1 );
  458|       |        fprintf( stderr, "j=%-d\n", j );
  459|       |#endif
  460|      0|    }
  461|    279|    if (xtra2 && szXtra2)
  ------------------
  |  Branch (461:9): [True: 0, False: 279]
  |  Branch (461:18): [True: 0, False: 0]
  ------------------
  462|      0|    {
  463|      0|        get_xtra_hash_minor_hex( digest_minor, szXtra2 );
  464|       |#if INCHIKEY_DEBUG
  465|       |        fprintf( stderr, "XHash2=%-s\n", szXtra2 );
  466|       |        fprintf( stderr, "j=%-d\n", j );
  467|       |#endif
  468|      0|    }
  469|       |
  470|       |
  471|    283|fin:
  472|    283|    if (NULL != str)
  ------------------
  |  Branch (472:9): [True: 283, False: 0]
  ------------------
  473|    283|    {
  474|    283|        inchi_free( str );
  ------------------
  |  | 1136|    283|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 283, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  475|    283|    }
  476|    283|    if (NULL != smajor)
  ------------------
  |  Branch (476:9): [True: 283, False: 0]
  ------------------
  477|    283|    {
  478|    283|        inchi_free( smajor );
  ------------------
  |  | 1136|    283|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 283, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  479|    283|    }
  480|    283|    if (NULL != sminor)
  ------------------
  |  Branch (480:9): [True: 283, False: 0]
  ------------------
  481|    283|    {
  482|    283|        inchi_free( sminor );
  ------------------
  |  | 1136|    283|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 283, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  483|    283|    }
  484|    283|    if (NULL != stmp)
  ------------------
  |  Branch (484:9): [True: 283, False: 0]
  ------------------
  485|    283|    {
  486|    283|        inchi_free( stmp );
  ------------------
  |  | 1136|    283|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 283, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  487|    283|    }
  488|    283|    if (NULL != sproto)
  ------------------
  |  Branch (488:9): [True: 283, False: 0]
  ------------------
  489|    283|    {
  490|    283|        inchi_free( sproto );
  ------------------
  |  | 1136|    283|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 283, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  491|    283|    }
  492|    283|    if (( ret == INCHIKEY_OK ) && ( ret1 != INCHIKEY_OK ))
  ------------------
  |  | 1043|    283|#define INCHIKEY_OK 0
  ------------------
                  if (( ret == INCHIKEY_OK ) && ( ret1 != INCHIKEY_OK ))
  ------------------
  |  | 1043|    279|#define INCHIKEY_OK 0
  ------------------
  |  Branch (492:9): [True: 279, False: 4]
  |  Branch (492:35): [True: 0, False: 279]
  ------------------
  493|      0|    {
  494|      0|        ret = ret1;
  495|      0|    }
  496|       |
  497|    283|    return ret;
  498|    279|}

CreateInpAtom:
 1013|   274k|{
 1014|   274k|    void *p = inchi_calloc( num_atoms, sizeof( inp_ATOM ) );
  ------------------
  |  | 1133|   274k|#define inchi_calloc   calloc
  ------------------
 1015|   274k|    return (inp_ATOM*) p;
 1016|   274k|}
FreeInpAtom:
 1021|  1.70M|{
 1022|  1.70M|    if (at && *at)
  ------------------
  |  Branch (1022:9): [True: 1.70M, False: 0]
  |  Branch (1022:15): [True: 383k, False: 1.31M]
  ------------------
 1023|   383k|    {
 1024|   383k|        inchi_free( *at );
  ------------------
  |  | 1136|   383k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 383k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1025|   383k|        *at = NULL;
 1026|   383k|    }
 1027|       |
 1028|  1.70M|    return;
 1029|  1.70M|}
FreeInpAtomData:
 1034|   660k|{
 1035|   660k|    if (inp_at_data)
  ------------------
  |  Branch (1035:9): [True: 604k, False: 55.4k]
  ------------------
 1036|   604k|    {
 1037|   604k|        FreeInpAtom( &inp_at_data->at );
 1038|   604k|        FreeInpAtom( &inp_at_data->at_fixed_bonds );
 1039|   604k|        memset( inp_at_data, 0, sizeof( *inp_at_data ) );
 1040|   604k|    }
 1041|       |
 1042|   660k|    return;
 1043|   660k|}
CreateInpAtomData:
 1050|   164k|{
 1051|   164k|    FreeInpAtomData( inp_at_data );
 1052|       |
 1053|   164k|    if (( inp_at_data->at = CreateInpAtom( num_atoms ) ) &&
  ------------------
  |  Branch (1053:9): [True: 164k, False: 0]
  ------------------
 1054|   164k|        ( !create_at_fixed_bonds || ( inp_at_data->at_fixed_bonds = CreateInpAtom( num_atoms ) ) ))
  ------------------
  |  Branch (1054:11): [True: 54.6k, False: 110k]
  |  Branch (1054:37): [True: 110k, False: 0]
  ------------------
 1055|   164k|    {
 1056|   164k|        inp_at_data->num_at = num_atoms;
 1057|   164k|        return 1;
 1058|   164k|    }
 1059|       |
 1060|      0|    FreeInpAtomData( inp_at_data );
 1061|       |
 1062|      0|    return 0;
 1063|   164k|}
FreeCompAtomData:
 1068|   327k|{
 1069|   327k|    FreeInpAtom( &inp_at_data->at );
 1070|       |
 1071|   327k|    if (inp_at_data->nOffsetAtAndH)
  ------------------
  |  Branch (1071:9): [True: 0, False: 327k]
  ------------------
 1072|      0|    {
 1073|      0|        inchi_free( inp_at_data->nOffsetAtAndH );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1074|      0|    }
 1075|   327k|    memset( inp_at_data, 0, sizeof( *inp_at_data ) );
 1076|   327k|}
FreeOrigAtData:
 1213|   163k|{
 1214|   163k|    if (!orig_at_data)
  ------------------
  |  Branch (1214:9): [True: 0, False: 163k]
  ------------------
 1215|      0|    {
 1216|      0|        return;
 1217|      0|    }
 1218|       |
 1219|   163k|    FreeInpAtom( &orig_at_data->at );
 1220|       |
 1221|   163k|    if (orig_at_data->nCurAtLen)
  ------------------
  |  Branch (1221:9): [True: 54.6k, False: 109k]
  ------------------
 1222|  54.6k|    {
 1223|  54.6k|        inchi_free( orig_at_data->nCurAtLen );
  ------------------
  |  | 1136|  54.6k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 54.6k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1224|  54.6k|    }
 1225|       |
 1226|   163k|    if (orig_at_data->nOldCompNumber)
  ------------------
  |  Branch (1226:9): [True: 54.6k, False: 109k]
  ------------------
 1227|  54.6k|    {
 1228|  54.6k|        inchi_free( orig_at_data->nOldCompNumber );
  ------------------
  |  | 1136|  54.6k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 54.6k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1229|  54.6k|    }
 1230|       |
 1231|   163k|    if (orig_at_data->szCoord)
  ------------------
  |  Branch (1231:9): [True: 0, False: 163k]
  ------------------
 1232|      0|    {
 1233|      0|        inchi_free( orig_at_data->szCoord );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1234|      0|    }
 1235|       |
 1236|   163k|    if (orig_at_data->nEquLabels)
  ------------------
  |  Branch (1236:9): [True: 0, False: 163k]
  ------------------
 1237|      0|    {
 1238|      0|        inchi_free( orig_at_data->nEquLabels );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1239|      0|    }
 1240|       |
 1241|   163k|    if (orig_at_data->nSortedOrder)
  ------------------
  |  Branch (1241:9): [True: 0, False: 163k]
  ------------------
 1242|      0|    {
 1243|      0|        inchi_free( orig_at_data->nSortedOrder );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1244|      0|    }
 1245|       |
 1246|       |    /* v 1.05 */
 1247|   163k|    FreeExtOrigAtData( orig_at_data->polymer, orig_at_data->v3000 );
 1248|       |
 1249|   163k|    memset( orig_at_data, 0, sizeof( *orig_at_data ) );
 1250|       |
 1251|   163k|    return;
 1252|   163k|}
FreeExtOrigAtData:
 1259|   164k|{
 1260|   164k|    int k;
 1261|       |
 1262|   164k|    OAD_Polymer_Free( pd );
 1263|   164k|    pd = NULL;
 1264|       |
 1265|   164k|    if (v3k)
  ------------------
  |  Branch (1265:9): [True: 0, False: 164k]
  ------------------
 1266|      0|    {
 1267|      0|        if (v3k->atom_index_orig)
  ------------------
  |  Branch (1267:13): [True: 0, False: 0]
  ------------------
 1268|      0|        {
 1269|      0|            inchi_free( v3k->atom_index_orig );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1270|      0|            v3k->atom_index_orig = NULL;
 1271|      0|        }
 1272|      0|        if (v3k->atom_index_fin)
  ------------------
  |  Branch (1272:13): [True: 0, False: 0]
  ------------------
 1273|      0|        {
 1274|      0|            inchi_free( v3k->atom_index_fin );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1275|      0|            v3k->atom_index_fin = NULL;
 1276|      0|        }
 1277|      0|        if (v3k->n_haptic_bonds && v3k->lists_haptic_bonds)
  ------------------
  |  Branch (1277:13): [True: 0, False: 0]
  |  Branch (1277:36): [True: 0, False: 0]
  ------------------
 1278|      0|        {
 1279|      0|            for (k = 0; k < v3k->n_haptic_bonds; k++)
  ------------------
  |  Branch (1279:25): [True: 0, False: 0]
  ------------------
 1280|      0|                if (v3k->lists_haptic_bonds[k])
  ------------------
  |  Branch (1280:21): [True: 0, False: 0]
  ------------------
 1281|      0|                {
 1282|      0|                    inchi_free( v3k->lists_haptic_bonds[k] );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1283|      0|                    v3k->lists_haptic_bonds[k] = NULL;
 1284|      0|                }
 1285|      0|            inchi_free( v3k->lists_haptic_bonds );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1286|      0|            v3k->lists_haptic_bonds = NULL;
 1287|      0|        }
 1288|      0|        if (v3k->n_steabs && v3k->lists_steabs)
  ------------------
  |  Branch (1288:13): [True: 0, False: 0]
  |  Branch (1288:30): [True: 0, False: 0]
  ------------------
 1289|      0|        {
 1290|      0|            for (k = 0; k < v3k->n_steabs; k++)
  ------------------
  |  Branch (1290:25): [True: 0, False: 0]
  ------------------
 1291|      0|                if (v3k->lists_steabs[k])
  ------------------
  |  Branch (1291:21): [True: 0, False: 0]
  ------------------
 1292|      0|                {
 1293|      0|                    inchi_free( v3k->lists_steabs[k] );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1294|      0|                    v3k->lists_steabs[k] = NULL;
 1295|      0|                }
 1296|      0|            inchi_free( v3k->lists_steabs );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1297|      0|            v3k->lists_steabs = NULL;
 1298|      0|        }
 1299|      0|        if (v3k->n_sterel && v3k->lists_sterel)
  ------------------
  |  Branch (1299:13): [True: 0, False: 0]
  |  Branch (1299:30): [True: 0, False: 0]
  ------------------
 1300|      0|        {
 1301|      0|            for (k = 0; k < v3k->n_sterel; k++)
  ------------------
  |  Branch (1301:25): [True: 0, False: 0]
  ------------------
 1302|      0|                if (v3k->lists_sterel[k])
  ------------------
  |  Branch (1302:21): [True: 0, False: 0]
  ------------------
 1303|      0|                {
 1304|      0|                    inchi_free( v3k->lists_sterel[k] );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1305|      0|                    v3k->lists_sterel[k] = NULL;
 1306|      0|                }
 1307|      0|            inchi_free( v3k->lists_sterel );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1308|      0|            v3k->lists_sterel = NULL;
 1309|      0|        }
 1310|      0|        if (v3k->n_sterac && v3k->lists_sterac)
  ------------------
  |  Branch (1310:13): [True: 0, False: 0]
  |  Branch (1310:30): [True: 0, False: 0]
  ------------------
 1311|      0|        {
 1312|      0|            for (k = 0; k < v3k->n_sterac; k++)
  ------------------
  |  Branch (1312:25): [True: 0, False: 0]
  ------------------
 1313|      0|                if (v3k->lists_sterac[k])
  ------------------
  |  Branch (1313:21): [True: 0, False: 0]
  ------------------
 1314|      0|                {
 1315|      0|                    inchi_free( v3k->lists_sterac[k] );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1316|      0|                    v3k->lists_sterac[k] = NULL;
 1317|      0|                }
 1318|      0|            inchi_free( v3k->lists_sterac );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1319|      0|            v3k->lists_sterac = NULL;
 1320|      0|        }
 1321|      0|        memset( v3k, 0, sizeof( *v3k ) );/**/
 1322|      0|        inchi_free( v3k );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1323|      0|    }
 1324|       |
 1325|   164k|    return;
 1326|   164k|}

IntArray_Alloc:
  497|    853|{
  498|    853|    if (items->item = (int *) inchi_calloc( nitems, sizeof( int ) ))
  ------------------
  |  | 1133|    853|#define inchi_calloc   calloc
  ------------------
  |  Branch (498:9): [True: 853, False: 0]
  ------------------
  499|    853|    {
  500|    853|        items->increment = items->allocated = nitems;
  501|    853|        items->used = 0;
  502|    853|        return 0;
  503|    853|    }
  504|       |
  505|      0|    return -1;
  506|    853|}
IntArray_ReAlloc:
  513|      2|{
  514|      2|    if (items)
  ------------------
  |  Branch (514:9): [True: 2, False: 0]
  ------------------
  515|      2|    {
  516|      2|        if (items->item && items->allocated > 0 && items->increment > 0)
  ------------------
  |  Branch (516:13): [True: 2, False: 0]
  |  Branch (516:28): [True: 2, False: 0]
  |  Branch (516:52): [True: 2, False: 0]
  ------------------
  517|      2|        {
  518|      2|            void *p = items->item;
  519|      2|            if (items->item =
  ------------------
  |  Branch (519:17): [True: 2, False: 0]
  ------------------
  520|      2|                (int *) inchi_calloc( items->allocated + items->increment, sizeof( items->item[0] ) ))
  ------------------
  |  | 1133|      2|#define inchi_calloc   calloc
  ------------------
  521|      2|            {
  522|      2|                memcpy( items->item, p, items->used * sizeof( items->item[0] ) );
  523|      2|                inchi_free( p );
  ------------------
  |  | 1136|      2|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 2, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  524|      2|                items->allocated += items->increment;
  525|      2|                return 0;
  526|      2|            }
  527|      2|        }
  528|      2|    }
  529|       |
  530|      0|    return -1;
  531|      2|}
IntArray_Append:
  538|  19.8k|{
  539|  19.8k|    if (items)
  ------------------
  |  Branch (539:9): [True: 19.8k, False: 0]
  ------------------
  540|  19.8k|    {
  541|  19.8k|        if (items->used + 1 > items->allocated)
  ------------------
  |  Branch (541:13): [True: 2, False: 19.8k]
  ------------------
  542|      2|        {
  543|       |            /* need to expand buffer */
  544|      2|            if (IntArray_ReAlloc( items ))
  ------------------
  |  Branch (544:17): [True: 0, False: 2]
  ------------------
  545|      0|            {
  546|      0|                return -1;
  547|      0|            }
  548|      2|        }
  549|  19.8k|        items->item[items->used++] = new_item;
  550|  19.8k|        return 0;
  551|  19.8k|    }
  552|       |
  553|      0|    return -1;
  554|  19.8k|}
IntArray_Reset:
  594|  16.9k|{
  595|  16.9k|    items->used = 0;
  596|  16.9k|    return;
  597|  16.9k|}
IntArray_Free:
  602|    853|{
  603|    853|    if (items)
  ------------------
  |  Branch (603:9): [True: 853, False: 0]
  ------------------
  604|    853|    {
  605|    853|        if (items->item)
  ------------------
  |  Branch (605:13): [True: 853, False: 0]
  ------------------
  606|    853|        {
  607|    853|            inchi_free( items->item );
  ------------------
  |  | 1136|    853|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 853, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  608|    853|        }
  609|    853|        memset( items, 0, sizeof( *items ) );
  610|    853|    }
  611|    853|    return;
  612|    853|}

ProcessOneStructure:
  225|  54.6k|{
  226|  54.6k|    int nRet = 0,
  227|  54.6k|        nRet1, i, k,
  228|  54.6k|        maxINChI = 0,
  229|  54.6k|        bSortPrintINChIFlags = 0;
  230|  54.6k|    COMP_ATOM_DATA
  231|  54.6k|        composite_norm_data[INCHI_NUM][TAUT_NUM + 1];    /*    [0]:non-taut,
  232|       |                                                        [1]:taut,
  233|       |                                                        [2]:intermediate taut struct */
  234|  54.6k|    NORM_CANON_FLAGS ncFlags;
  235|  54.6k|    NORM_CANON_FLAGS *pncFlags = &ncFlags;
  236|  54.6k|    ORIG_STRUCT OrigStruct;
  237|  54.6k|    ORIG_STRUCT *pOrigStruct = NULL;
  238|  54.6k|    int err, ret1 = 0;
  239|       |
  240|       |#if ( RING2CHAIN == 1 || UNDERIVATIZE == 1 )
  241|       |    int /*ret1=0,*/ret2 = 0;
  242|       |#endif
  243|       |
  244|       |    /*    1. Preliminary work */
  245|       |
  246|  54.6k|    int is_polymer = orig_inp_data
  ------------------
  |  Branch (246:22): [True: 54.6k, False: 0]
  ------------------
  247|  54.6k|                     && orig_inp_data->valid_polymer
  ------------------
  |  Branch (247:25): [True: 0, False: 54.6k]
  ------------------
  248|  54.6k|                     && orig_inp_data->polymer
  ------------------
  |  Branch (248:25): [True: 0, False: 0]
  ------------------
  249|  54.6k|                     && orig_inp_data->polymer->n ;
  ------------------
  |  Branch (249:25): [True: 0, False: 0]
  ------------------
  250|       |
  251|  54.6k|    int is_polymer2inchi = is_polymer && ( ip->nInputType == INPUT_MOLFILE || ip->nInputType == INPUT_SDFILE );
  ------------------
  |  Branch (251:28): [True: 0, False: 54.6k]
  |  Branch (251:44): [True: 0, False: 0]
  |  Branch (251:79): [True: 0, False: 0]
  ------------------
  252|       |
  253|  54.6k|    sd->bUserQuitComponent = 0;
  254|  54.6k|    sd->bUserQuitComponentDisplay = 0;
  255|  54.6k|    memset( composite_norm_data, 0, sizeof( composite_norm_data ) );
  256|  54.6k|    memset( pncFlags, 0, sizeof( *pncFlags ) );
  257|       |
  258|       |        
  259|       |    /* For experimental purposes only */
  260|       |    /*ret1 = DoOneStructureEarlyPreprocessing( num_inp, sd, ip, inp_file,
  261|       |                                             log_file, out_file, prb_file,
  262|       |                                             orig_inp_data, prep_inp_data );
  263|       |    */
  264|  54.6k|    ret1 = DoOneStructureEarlyPreprocessing( ic, pCG, num_inp, sd, ip,
  265|  54.6k|                                             inp_file, log_file, out_file, prb_file,
  266|  54.6k|                                             orig_inp_data, prep_inp_data );
  267|  54.6k|    switch (ret1)
  ------------------
  |  Branch (267:13): [True: 54.6k, False: 0]
  ------------------
  268|  54.6k|    {
  269|      0|        case _IS_SKIP:
  ------------------
  |  |   44|      0|#define _IS_SKIP   -2
  ------------------
  |  Branch (269:9): [True: 0, False: 54.6k]
  ------------------
  270|      0|        case _IS_ERROR:
  ------------------
  |  |   40|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (270:9): [True: 0, False: 54.6k]
  ------------------
  271|      0|        case _IS_FATAL:
  ------------------
  |  |   41|      0|#define _IS_FATAL   3
  ------------------
  |  Branch (271:9): [True: 0, False: 54.6k]
  ------------------
  272|      0|            nRet = ret1;
  273|  54.6k|    }
  274|       |
  275|  54.6k|    if (ret1)
  ------------------
  |  Branch (275:9): [True: 0, False: 54.6k]
  ------------------
  276|      0|    {
  277|      0|        goto exit_function;
  278|      0|    }
  279|       |
  280|       |
  281|  54.6k|    if (is_polymer)
  ------------------
  |  Branch (281:9): [True: 0, False: 54.6k]
  ------------------
  282|      0|    {
  283|       |        /* Polymer house-keeping related to possible CRU frame shift(s) */
  284|       |
  285|      0|        orig_inp_data->polymer->frame_shift_scheme = ip->bFrameShiftScheme;
  286|      0|        orig_inp_data->polymer->treat = ip->bPolymers;
  287|       |
  288|      0|        if (!is_polymer2inchi)
  ------------------
  |  Branch (288:13): [True: 0, False: 0]
  ------------------
  289|      0|        {
  290|       |            /* Polymer structure is being restored from InChI string            */
  291|       |            /* If CRUs were pre-cyclized, re-open them in preferred forms here  */
  292|      0|            if (orig_inp_data->polymer->frame_shift_scheme == FSS_STARS_CYCLED)
  ------------------
  |  Branch (292:17): [True: 0, False: 0]
  ------------------
  293|      0|            {
  294|      0|                OAD_Polymer_SmartReopenCyclizedUnits( orig_inp_data->polymer,
  295|      0|                                                      orig_inp_data->at,
  296|      0|                                                      orig_inp_data->num_inp_atoms,
  297|      0|                                                      &orig_inp_data->num_inp_bonds );
  298|      0|            }
  299|      0|        }
  300|      0|    }
  301|       |
  302|       |
  303|  54.6k|    ret1 = OrigAtData_SaveMolfile( orig_inp_data, sd, ip, num_inp, out_file );
  304|  54.6k|    if (ret1)
  ------------------
  |  Branch (304:9): [True: 0, False: 54.6k]
  ------------------
  305|      0|    {
  306|      0|        goto exit_function;
  307|      0|    }
  308|       |
  309|       |
  310|  54.6k|    pOrigStruct = &OrigStruct;
  311|  54.6k|    memset( pOrigStruct, 0, sizeof( *pOrigStruct ) );
  312|       |
  313|  54.6k|    OrigAtData_StoreNativeInput( pCG, &nRet, sd,  ip,  orig_inp_data, pOrigStruct );
  314|       |
  315|       |    /*    2. Create INChI for the whole disconnected or original structure */
  316|       |
  317|  54.6k|    if (nRet != _IS_FATAL && nRet != _IS_ERROR)
  ------------------
  |  |   41|   109k|#define _IS_FATAL   3
  ------------------
                  if (nRet != _IS_FATAL && nRet != _IS_ERROR)
  ------------------
  |  |   40|  54.6k|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (317:9): [True: 54.6k, False: 0]
  |  Branch (317:30): [True: 54.6k, False: 0]
  ------------------
  318|  54.6k|    {
  319|  54.6k|        nRet1 = CreateOneStructureINChI( pCG, ic, sd, ip, szTitle,
  320|  54.6k|                                         pINChI, pINChI_Aux, INCHI_BAS,
  ------------------
  |  |  575|  54.6k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  321|  54.6k|                                         inp_file, log_file, out_file, prb_file,
  322|  54.6k|                                         orig_inp_data, prep_inp_data,
  323|  54.6k|                                         composite_norm_data,
  324|  54.6k|                                         num_inp, strbuf, pncFlags );
  325|  54.6k|        nRet = inchi_max( nRet, nRet1 );
  ------------------
  |  |  166|  54.6k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 54.6k]
  |  |  ------------------
  ------------------
  326|       |
  327|       |        /* If we create InChI from polymer-containing structure */
  328|  54.6k|        if (is_polymer2inchi)
  ------------------
  |  Branch (328:13): [True: 0, False: 54.6k]
  ------------------
  329|      0|        {
  330|      0|            int polymer_repr_type = OAD_Polymer_GetRepresentation( orig_inp_data->polymer );
  331|       |
  332|      0|#ifdef ALLOW_MIXED_SRU_AND_MON
  333|      0|            if (polymer_repr_type == POLYMER_REPRESENTATION_STRUCTURE_BASED ||
  ------------------
  |  |  171|      0|#define POLYMER_REPRESENTATION_STRUCTURE_BASED  2
  ------------------
  |  Branch (333:17): [True: 0, False: 0]
  ------------------
  334|      0|                 polymer_repr_type == POLYMER_REPRESENTATION_MIXED)
  ------------------
  |  |  172|      0|#define POLYMER_REPRESENTATION_MIXED            3
  ------------------
  |  Branch (334:18): [True: 0, False: 0]
  ------------------
  335|       |#else
  336|       |            if (polymer_repr_type == POLYMER_REPRESENTATION_STRUCTURE_BASED)
  337|       |#endif
  338|      0|            {
  339|       |                /* Temporarily copy ptr to polymer data to prep_inp_data */
  340|      0|                OAD_Polymer *prep_polymer = prep_inp_data->polymer; /* may be NULL */
  341|      0|                prep_inp_data->polymer = orig_inp_data->polymer;
  342|       |
  343|      0|                OAD_Polymer_FindBackbones( prep_inp_data, /* NB: not orig_inp_data! */
  344|      0|                                           &( composite_norm_data[INCHI_BAS][TAUT_YES] ),
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                                                         &( composite_norm_data[INCHI_BAS][TAUT_YES] ),
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  345|      0|                                           &err, sd->pStrErrStruct );
  346|      0|                if (err)
  ------------------
  |  Branch (346:21): [True: 0, False: 0]
  ------------------
  347|      0|                {
  348|      0|                    ret1 = _IS_ERROR;
  ------------------
  |  |   40|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  349|      0|                }
  350|      0|                nRet = inchi_max( nRet, ret1 );
  ------------------
  |  |  166|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  351|      0|                prep_inp_data->polymer = prep_polymer;    /* restore temp copied*/
  352|      0|            }
  353|      0|        }
  354|  54.6k|    }
  355|       |
  356|  54.6k|    if (nRet != _IS_FATAL && nRet != _IS_ERROR)
  ------------------
  |  |   41|   109k|#define _IS_FATAL   3
  ------------------
                  if (nRet != _IS_FATAL && nRet != _IS_ERROR)
  ------------------
  |  |   40|  54.6k|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (356:9): [True: 54.6k, False: 0]
  |  Branch (356:30): [True: 54.6k, False: 0]
  ------------------
  357|  54.6k|    {
  358|  54.6k|        maxINChI = 1;
  359|  54.6k|    }
  360|       |
  361|       |
  362|       |    /* 3. Create INChI for the whole metal-reconnected structure */
  363|       |
  364|  54.6k|    if (nRet != _IS_FATAL                                              &&
  ------------------
  |  |   41|   109k|#define _IS_FATAL   3
  ------------------
  |  Branch (364:9): [True: 54.6k, False: 0]
  ------------------
  365|  54.6k|         nRet != _IS_ERROR &&
  ------------------
  |  |   40|   109k|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (365:10): [True: 54.6k, False: 0]
  ------------------
  366|  54.6k|         ( sd->bTautFlagsDone[INCHI_BAS] & TG_FLAG_DISCONNECT_COORD_DONE ) &&
  ------------------
  |  |  575|  54.6k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                       ( sd->bTautFlagsDone[INCHI_BAS] & TG_FLAG_DISCONNECT_COORD_DONE ) &&
  ------------------
  |  |  972|  54.6k|#define TG_FLAG_DISCONNECT_COORD_DONE    0x00000100   /* found and disconnected "coord. centers" */
  ------------------
  |  Branch (366:10): [True: 0, False: 54.6k]
  ------------------
  367|  54.6k|         ( ip->bTautFlags & TG_FLAG_RECONNECT_COORD ))
  ------------------
  |  |  935|      0|#define TG_FLAG_RECONNECT_COORD          0x00000100   /* reconnect disconnected "coord. centers" */
  ------------------
  |  Branch (367:10): [True: 0, False: 0]
  ------------------
  368|      0|    {
  369|       |
  370|      0|        nRet1 = CreateOneStructureINChI( pCG, ic, sd, ip, szTitle,
  371|      0|                                         pINChI, pINChI_Aux, INCHI_REC, inp_file,
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  372|      0|                                         log_file, out_file, prb_file,
  373|      0|                                         orig_inp_data, prep_inp_data,
  374|      0|                                         composite_norm_data,
  375|      0|                                         num_inp, strbuf, pncFlags );
  376|      0|        nRet = inchi_max( nRet, nRet1 );
  ------------------
  |  |  166|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  377|       |
  378|      0|        if (is_polymer2inchi)
  ------------------
  |  Branch (378:13): [True: 0, False: 0]
  ------------------
  379|      0|        {
  380|      0|            ret1 = 0;
  381|       |            /* temporarily copy ptr to polymer data to prep_inp_data */
  382|      0|            prep_inp_data->polymer = orig_inp_data->polymer;
  383|       |
  384|      0|            OAD_Polymer_FindBackbones( prep_inp_data, /* NB: not orig_inp_data! */
  385|      0|                                       &( composite_norm_data[INCHI_REC][TAUT_YES] ),
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                                                     &( composite_norm_data[INCHI_REC][TAUT_YES] ),
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  386|      0|                                       &err, sd->pStrErrStruct );
  387|      0|            if (err)
  ------------------
  |  Branch (387:17): [True: 0, False: 0]
  ------------------
  388|      0|            {
  389|      0|                ret1 = _IS_ERROR;
  ------------------
  |  |   40|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  390|      0|            }
  391|      0|            nRet = inchi_max( nRet, ret1 );
  ------------------
  |  |  166|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  392|      0|            prep_inp_data->polymer = NULL;    /* remove temp copied */
  393|      0|        }
  394|      0|        if (nRet != _IS_FATAL && nRet != _IS_ERROR)
  ------------------
  |  |   41|      0|#define _IS_FATAL   3
  ------------------
                      if (nRet != _IS_FATAL && nRet != _IS_ERROR)
  ------------------
  |  |   40|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (394:13): [True: 0, False: 0]
  |  Branch (394:34): [True: 0, False: 0]
  ------------------
  395|      0|        {
  396|      0|            maxINChI = 2;
  397|      0|        }
  398|      0|    }
  399|       |
  400|  54.6k|    if (nRet != _IS_FATAL && nRet != _IS_ERROR)
  ------------------
  |  |   41|   109k|#define _IS_FATAL   3
  ------------------
                  if (nRet != _IS_FATAL && nRet != _IS_ERROR)
  ------------------
  |  |   40|  54.6k|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (400:9): [True: 54.6k, False: 0]
  |  Branch (400:30): [True: 54.6k, False: 0]
  ------------------
  401|  54.6k|    {
  402|  54.6k|        if (( sd->bChiralFlag & FLAG_INP_AT_CHIRAL ) &&
  ------------------
  |  |  487|  54.6k|#define FLAG_INP_AT_CHIRAL        1
  ------------------
  |  Branch (402:13): [True: 0, False: 54.6k]
  ------------------
  403|  54.6k|            ( ip->nMode & REQ_MODE_STEREO ) &&
  ------------------
  |  |   47|      0|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
  |  Branch (403:13): [True: 0, False: 0]
  ------------------
  404|  54.6k|             !( ip->nMode & ( REQ_MODE_RELATIVE_STEREO | REQ_MODE_RACEMIC_STEREO ) ) &&
  ------------------
  |  |   54|      0|#define REQ_MODE_RELATIVE_STEREO    0x000200    /* REL All Relative Stereo */
  ------------------
                           !( ip->nMode & ( REQ_MODE_RELATIVE_STEREO | REQ_MODE_RACEMIC_STEREO ) ) &&
  ------------------
  |  |   56|      0|#define REQ_MODE_RACEMIC_STEREO     0x000400    /* RAC All Racemic Stereo */
  ------------------
  |  Branch (404:14): [True: 0, False: 0]
  ------------------
  405|  54.6k|             !bIsStructChiral( pINChI, sd->num_components ))
  ------------------
  |  Branch (405:14): [True: 0, False: 0]
  ------------------
  406|      0|        {
  407|      0|            if (!ip->bNoWarnings)
  ------------------
  |  Branch (407:17): [True: 0, False: 0]
  ------------------
  408|      0|            {
  409|      0|                WarningMessage( sd->pStrErrStruct, "Not chiral" );
  ------------------
  |  |  160|      0|#define WarningMessage AddErrorMessage
  ------------------
  410|      0|            }
  411|      0|        }
  412|  54.6k|        if (!sd->bUserQuitComponent && !sd->bUserQuit)
  ------------------
  |  Branch (412:13): [True: 54.6k, False: 0]
  |  Branch (412:40): [True: 54.6k, False: 0]
  ------------------
  413|  54.6k|        {
  414|  54.6k|            nRet1 = TreatCreateINChIWarning( sd, ip, prep_inp_data, num_inp,
  415|  54.6k|                                             inp_file, log_file, out_file, prb_file );
  416|  54.6k|            nRet = inchi_max( nRet, nRet1 );
  ------------------
  |  |  166|  54.6k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 54.6k]
  |  |  ------------------
  ------------------
  417|  54.6k|        }
  418|  54.6k|    }
  419|       |
  420|       |
  421|       |    /*    4. Sort and print INChI for the whole structure */
  422|       |
  423|  54.6k|    PrepareSaveOptBits( &save_opt_bits, ip );
  424|  54.6k|    if (nRet != _IS_FATAL && nRet != _IS_ERROR)
  ------------------
  |  |   41|   109k|#define _IS_FATAL   3
  ------------------
                  if (nRet != _IS_FATAL && nRet != _IS_ERROR)
  ------------------
  |  |   40|  54.6k|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (424:9): [True: 54.6k, False: 0]
  |  Branch (424:30): [True: 54.6k, False: 0]
  ------------------
  425|  54.6k|    {
  426|  54.6k|        nRet1 = SortAndPrintINChI( pCG, out_file, strbuf, log_file, ip,
  427|  54.6k|                                   orig_inp_data, prep_inp_data,
  428|  54.6k|                                   composite_norm_data,
  429|  54.6k|                                   pOrigStruct, sd->num_components,
  430|  54.6k|                                   sd->num_non_taut, sd->num_taut,
  431|  54.6k|                                   sd->bTautFlags, sd->bTautFlagsDone,
  432|  54.6k|                                   pncFlags, num_inp,
  433|  54.6k|                                   pINChI, pINChI_Aux,
  434|  54.6k|                                   &bSortPrintINChIFlags, save_opt_bits );
  435|  54.6k|    }
  436|       |
  437|       |
  438|       |    /*    5. Post-process */
  439|       |
  440|  54.6k|    DisplayOrigAndResultStructuresAndComponents( nRet, ic, pCG, sd, ip, szTitle,
  441|  54.6k|                                                 pINChI, pINChI_Aux,
  442|  54.6k|                                                 inp_file, log_file, out_file,
  443|  54.6k|                                                 orig_inp_data, prep_inp_data,
  444|  54.6k|                                                 num_inp, maxINChI,
  445|  54.6k|                                                 composite_norm_data );
  446|       |
  447|       |
  448|  54.6k|    SaveOkProcessedMolfile( nRet, sd, ip, prb_file, inp_file );
  449|       |
  450|       |
  451|       |    /* Cleanup */
  452|       |
  453|   163k|    for (i = 0; i < INCHI_NUM; i++)
  ------------------
  |  |  574|   163k|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (453:17): [True: 109k, False: 54.6k]
  ------------------
  454|   109k|    {
  455|   436k|        for (k = 0; k < TAUT_NUM + 1; k++)
  ------------------
  |  |  578|   436k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (455:21): [True: 327k, False: 109k]
  ------------------
  456|   327k|        {
  457|   327k|            FreeCompAtomData( &composite_norm_data[i][k] );
  458|   327k|        }
  459|   109k|    }
  460|       |
  461|  54.6k|    OrigStruct_Free( pOrigStruct );
  462|       |
  463|  54.6k|exit_function:
  464|       |
  465|  54.6k|    return nRet;
  466|  54.6k|}
OrigAtData_SaveMolfile:
  552|  54.6k|{
  553|  54.6k|    int ret = 0;
  554|       |
  555|  54.6k|    if (!( ip->bINChIOutputOptions & INCHI_OUT_SDFILE_ONLY ))
  ------------------
  |  |  161|  54.6k|#define INCHI_OUT_SDFILE_ONLY           0x0010   /* save input data in a Molfile instead of creating INChI */
  ------------------
  |  Branch (555:9): [True: 54.6k, False: 0]
  ------------------
  556|  54.6k|    {
  557|  54.6k|        return _IS_OKAY;
  ------------------
  |  |   38|  54.6k|#define _IS_OKAY    0
  ------------------
  558|  54.6k|    }
  559|      0|    else
  560|      0|    {
  561|      0|        char szNumber[256];
  562|      0|        sprintf( szNumber, "Structure #%ld. %s%s%s%s", num_inp, SDF_LBL_VAL( ip->pSdfLabel, ip->pSdfValue ) );
  ------------------
  |  |  410|      0|#define SDF_LBL_VAL(L,V)  ((L)&&(L)[0])?gsSpace:gsEmpty, ((L)&&(L)[0])?L:gsEmpty, ((L)&&(L)[0])? (((V)&&(V)[0])?gsEqual:gsSpace):gsEmpty, ((V)&&(V)[0])?V:((L)&&(L)[0])?gsMissing:gsEmpty
  |  |  ------------------
  |  |  |  Branch (410:28): [True: 0, False: 0]
  |  |  |  Branch (410:33): [True: 0, False: 0]
  |  |  |  Branch (410:59): [True: 0, False: 0]
  |  |  |  Branch (410:64): [True: 0, False: 0]
  |  |  |  Branch (410:84): [True: 0, False: 0]
  |  |  |  Branch (410:89): [True: 0, False: 0]
  |  |  |  Branch (410:100): [True: 0, False: 0]
  |  |  |  Branch (410:105): [True: 0, False: 0]
  |  |  |  Branch (410:140): [True: 0, False: 0]
  |  |  |  Branch (410:145): [True: 0, False: 0]
  |  |  |  Branch (410:156): [True: 0, False: 0]
  |  |  |  Branch (410:161): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  563|       |
  564|      0|        ret = OrigAtData_WriteToSDfile( orig_inp_data, out_file, szNumber, NULL,
  565|      0|                                        ( sd->bChiralFlag&FLAG_INP_AT_CHIRAL ) ? 1 : 0,
  ------------------
  |  |  487|      0|#define FLAG_INP_AT_CHIRAL        1
  ------------------
  |  Branch (565:41): [True: 0, False: 0]
  ------------------
  566|      0|                                        ( ip->bINChIOutputOptions&INCHI_OUT_SDFILE_ATOMS_DT ) ? 1 : 0,
  ------------------
  |  |  168|      0|#define INCHI_OUT_SDFILE_ATOMS_DT       0x0800   /* SDfile output H isotopes as D and T     */
  ------------------
  |  Branch (566:41): [True: 0, False: 0]
  ------------------
  567|      0|                                        ip->pSdfLabel, ip->pSdfValue );
  568|      0|    }
  569|       |
  570|      0|    return ret;
  571|  54.6k|}
CreateOneStructureINChI:
  798|  54.6k|{
  799|  54.6k|    int i, j, k, nRet = 0, n = 0l;
  800|       |#if defined (TARGET_EXE_STANDALONE) && defined(_WIN32)
  801|       |    int err_display;
  802|       |#endif
  803|       |
  804|  54.6k|    PINChI2     *pINChI = NULL;
  805|  54.6k|    PINChI_Aux2 *pINChI_Aux = NULL;
  806|       |
  807|  54.6k|    INP_ATOM_DATA InpCurAtData;
  808|  54.6k|    INP_ATOM_DATA *inp_cur_data;
  809|       |
  810|  54.6k|    INP_ATOM_DATA InpNormAtData, InpNormTautData;
  811|  54.6k|    INP_ATOM_DATA *inp_norm_data[TAUT_NUM]; /*  = { &InpNormAtData, &InpNormTautData }; */
  812|  54.6k|    ORIG_ATOM_DATA *cur_prep_inp_data = prep_inp_data + iINChI;
  813|  54.6k|    inchiTime      ulTStart;
  814|       |
  815|       |    /* Always create info data structures (but do not display them always )
  816|       |    #ifndef COMPILE_ANSI_ONLY
  817|       |    */
  818|  54.6k|    int            bShowStructure = 0;
  819|  54.6k|    int            bStructurePreprocessed = 0; /* All changes except disconnection */
  820|  54.6k|    int            bStructureDisconnected = 0;
  821|  54.6k|    int            bAlsoOutputReconnected = 0, bINCHI_LIB_Flag = 0;
  822|  54.6k|    COMP_ATOM_DATA *composite_norm_data = composite_norm_data2[iINChI];
  823|  54.6k|    INP_ATOM_DATA2 *all_inp_norm_data = NULL;
  824|       |    /*#endif*/
  825|       |
  826|       |    /*        Order of actions:
  827|       |
  828|       |        if ( orig_inp_data is NOT empty AND
  829|       |             prep_inp_data[0] IS empty ) then do
  830|       |             in PreprocessOneStructure()        :
  831|       |
  832|       |            1. copy orig_inp_data --> prep_inp_data[0]
  833|       |            2. fix odd things in prep_inp_data[0]
  834|       |            3. if( orig_inp_data->bDisconnectSalts ) then
  835|       |                  -- disconnect salts in prep_inp_data[0]
  836|       |            4. move protons to neutralize charges on heteroatoms
  837|       |            5. if( orig_inp_data->bDisconnectCoord ) then
  838|       |                  -- copy prep_inp_data[0] --> prep_inp_data[1]
  839|       |                  -- disconnect metals in prep_inp_data[0]
  840|       |
  841|       |        iINChI = 0
  842|       |        =========
  843|       |        (normal/disconnected layer)
  844|       |
  845|       |            1. normalize prep_inp_data[0] in inp_norm_data[0,1]
  846|       |            2. create INChI[ iINChI ] out of inp_norm_data[0,1]
  847|       |
  848|       |
  849|       |        iINChI = 1 AND orig_inp_data->bDisconnectCoord > 0
  850|       |        =================================================
  851|       |        (reconnected layer)
  852|       |
  853|       |            1. normalize prep_inp_data[1] in inp_norm_data[0,1]
  854|       |            2. create INChI[ iINChI ] out of inp_norm_data[0,1]
  855|       |
  856|       |    */
  857|       |
  858|  54.6k|    ip->msec_LeftTime = ip->msec_MaxTime; /* start timeout countdown for each component */
  859|       |
  860|  54.6k|    inp_cur_data = &InpCurAtData;
  861|  54.6k|    inp_norm_data[TAUT_NON] = &InpNormAtData;
  ------------------
  |  |  579|  54.6k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  862|  54.6k|    inp_norm_data[TAUT_YES] = &InpNormTautData;
  ------------------
  |  |  580|  54.6k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  863|       |
  864|  54.6k|    memset( inp_cur_data, 0, sizeof( *inp_cur_data ) );
  865|  54.6k|    memset( inp_norm_data[TAUT_NON], 0, sizeof( *inp_norm_data[0] ) );
  ------------------
  |  |  579|  54.6k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  866|  54.6k|    memset( inp_norm_data[TAUT_YES], 0, sizeof( *inp_norm_data[0] ) );
  ------------------
  |  |  580|  54.6k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  867|       |
  868|  54.6k|    {
  869|       |        /*#ifndef COMPILE_ANSI_ONLY*/
  870|  54.6k|        memset( composite_norm_data + TAUT_NON, 0, sizeof( composite_norm_data[0] ) );
  ------------------
  |  |  579|  54.6k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  871|  54.6k|        memset( composite_norm_data + TAUT_YES, 0, sizeof( composite_norm_data[0] ) );
  ------------------
  |  |  580|  54.6k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  872|  54.6k|        memset( composite_norm_data + TAUT_INI, 0, sizeof( composite_norm_data[0] ) );
  ------------------
  |  |  581|  54.6k|#define TAUT_INI            2    /* 2 => intermediate tautomeric structure */
  ------------------
  873|  54.6k|    }   /*#endif*/
  874|       |
  875|  54.6k|    if (ip->bAllowEmptyStructure && !orig_inp_data->at && !orig_inp_data->num_inp_atoms)
  ------------------
  |  Branch (875:9): [True: 0, False: 54.6k]
  |  Branch (875:37): [True: 0, False: 0]
  |  Branch (875:59): [True: 0, False: 0]
  ------------------
  876|      0|    {
  877|      0|        ;
  878|      0|    }
  879|  54.6k|    else if (!orig_inp_data->at || !orig_inp_data->num_inp_atoms)
  ------------------
  |  Branch (879:14): [True: 0, False: 54.6k]
  |  Branch (879:36): [True: 0, False: 54.6k]
  ------------------
  880|      0|    {
  881|      0|        return 0; /* nothing to do */
  882|      0|    }
  883|  54.6k|    if (iINChI == 1 && orig_inp_data->bDisconnectCoord <= 0)
  ------------------
  |  Branch (883:9): [True: 0, False: 54.6k]
  |  Branch (883:24): [True: 0, False: 0]
  ------------------
  884|      0|    {
  885|      0|        return 0;
  886|      0|    }
  887|       |
  888|       |    /* m = iINChI; */ /* orig_inp_data index */
  889|  54.6k|    if (iINChI != INCHI_BAS && iINChI != INCHI_REC)
  ------------------
  |  |  575|   109k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                  if (iINChI != INCHI_BAS && iINChI != INCHI_REC)
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (889:9): [True: 0, False: 54.6k]
  |  Branch (889:32): [True: 0, False: 0]
  ------------------
  890|      0|    {
  891|      0|        AddErrorMessage( sd->pStrErrStruct, "Fatal undetermined program error" );
  892|      0|        sd->nStructReadError = 97;
  893|      0|        nRet = sd->nErrorType = _IS_FATAL;
  ------------------
  |  |   41|      0|#define _IS_FATAL   3
  ------------------
  894|      0|        goto exit_function;
  895|      0|    }
  896|       |
  897|       |    /*******************************************************************
  898|       |     *                                                                 *
  899|       |     *                                                                 *
  900|       |     *  Whole structure preprocessing: 1st step of the normalization   *
  901|       |     *                                                                 *
  902|       |     *  Happen only on the first call to CreateOneStructureINChI()      *
  903|       |     *                                                                 *
  904|       |     *                                                                 *
  905|       |     *******************************************************************/
  906|       |
  907|  54.6k|    if (( !prep_inp_data->at || !prep_inp_data->num_inp_atoms ) &&
  ------------------
  |  Branch (907:11): [True: 54.6k, False: 0]
  |  Branch (907:33): [True: 0, False: 0]
  ------------------
  908|  54.6k|         orig_inp_data->num_inp_atoms > 0)
  ------------------
  |  Branch (908:10): [True: 54.6k, False: 0]
  ------------------
  909|  54.6k|    {
  910|       |        /* The structure has not been preprocessed */
  911|  54.6k|        if (ip->msec_MaxTime)
  ------------------
  |  Branch (911:13): [True: 0, False: 54.6k]
  ------------------
  912|      0|        {
  913|      0|            InchiTimeGet( &ulTStart );
  914|      0|        }
  915|       |
  916|  54.6k|        PreprocessOneStructure( ic, sd, ip, orig_inp_data, prep_inp_data );
  917|       |
  918|  54.6k|        pncFlags->bTautFlags[iINChI][TAUT_YES] =
  ------------------
  |  |  580|  54.6k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  919|  54.6k|                pncFlags->bTautFlags[iINChI][TAUT_NON] =
  ------------------
  |  |  579|  54.6k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  920|  54.6k|                    sd->bTautFlags[INCHI_BAS] | ip->bTautFlags;
  ------------------
  |  |  575|  54.6k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  921|       |
  922|  54.6k|        pncFlags->bTautFlagsDone[iINChI][TAUT_YES] =
  ------------------
  |  |  580|  54.6k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  923|  54.6k|            pncFlags->bTautFlagsDone[iINChI][TAUT_NON] =
  ------------------
  |  |  579|  54.6k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  924|  54.6k|            sd->bTautFlagsDone[INCHI_BAS] | ip->bTautFlagsDone;
  ------------------
  |  |  575|  54.6k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  925|       |
  926|  54.6k|        {
  927|       |            /*#ifndef COMPILE_ANSI_ONLY*/
  928|       |            /* in this location the call happens once for each input structure, before preprocessing */
  929|  54.6k|            bStructurePreprocessed = ( 0 != ( sd->bTautFlagsDone[INCHI_BAS] & (
  ------------------
  |  |  575|  54.6k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  930|  54.6k|                TG_FLAG_MOVE_HPLUS2NEUTR_DONE |
  ------------------
  |  |  959|  54.6k|#define TG_FLAG_MOVE_HPLUS2NEUTR_DONE    0x00000001   /* protons have been moved to neutralize */
  ------------------
  931|  54.6k|                TG_FLAG_DISCONNECT_SALTS_DONE |
  ------------------
  |  |  961|  54.6k|#define TG_FLAG_DISCONNECT_SALTS_DONE    0x00000004
  ------------------
  932|  54.6k|                TG_FLAG_MOVE_POS_CHARGES_DONE |
  ------------------
  |  |  963|  54.6k|#define TG_FLAG_MOVE_POS_CHARGES_DONE    0x00000010
  ------------------
  933|  54.6k|                TG_FLAG_FIX_ODD_THINGS_DONE ) ) );
  ------------------
  |  |  975|  54.6k|#define TG_FLAG_FIX_ODD_THINGS_DONE      0x00000800   /* fixed drawing ambiguities in fix_odd_things */
  ------------------
  934|       |
  935|  54.6k|            bStructureDisconnected = ( 0 != ( sd->bTautFlagsDone[INCHI_BAS] & TG_FLAG_DISCONNECT_COORD_DONE ) );
  ------------------
  |  |  575|  54.6k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          bStructureDisconnected = ( 0 != ( sd->bTautFlagsDone[INCHI_BAS] & TG_FLAG_DISCONNECT_COORD_DONE ) );
  ------------------
  |  |  972|  54.6k|#define TG_FLAG_DISCONNECT_COORD_DONE    0x00000100   /* found and disconnected "coord. centers" */
  ------------------
  936|       |
  937|  54.6k|            bShowStructure = ( bStructurePreprocessed ||
  ------------------
  |  Branch (937:32): [True: 0, False: 54.6k]
  ------------------
  938|  54.6k|                               bStructureDisconnected ||
  ------------------
  |  Branch (938:32): [True: 0, False: 54.6k]
  ------------------
  939|  54.6k|                               prep_inp_data[0].num_components > 1 );
  ------------------
  |  Branch (939:32): [True: 0, False: 54.6k]
  ------------------
  940|       |
  941|       |            /* sd->bTautFlags[] contains output flags
  942|       |               ip->bTautFlags   contains input flags
  943|       |            */
  944|  54.6k|            bAlsoOutputReconnected = ( sd->bTautFlagsDone[INCHI_BAS] & TG_FLAG_DISCONNECT_COORD_DONE ) &&
  ------------------
  |  |  575|  54.6k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          bAlsoOutputReconnected = ( sd->bTautFlagsDone[INCHI_BAS] & TG_FLAG_DISCONNECT_COORD_DONE ) &&
  ------------------
  |  |  972|  54.6k|#define TG_FLAG_DISCONNECT_COORD_DONE    0x00000100   /* found and disconnected "coord. centers" */
  ------------------
  |  Branch (944:38): [True: 0, False: 54.6k]
  ------------------
  945|  54.6k|                ( ip->bTautFlags               & TG_FLAG_RECONNECT_COORD );
  ------------------
  |  |  935|      0|#define TG_FLAG_RECONNECT_COORD          0x00000100   /* reconnect disconnected "coord. centers" */
  ------------------
  |  Branch (945:17): [True: 0, False: 0]
  ------------------
  946|  54.6k|            bINCHI_LIB_Flag = 0;
  947|       |
  948|       |            /*************** output structures to TARGET_LIB_FOR_WINCHI conditions *********************
  949|       |             *
  950|       |             *  Send to TARGET_LIB_FOR_WINCHI:
  951|       |             *
  952|       |             *  type                      component  conditions
  953|       |             *
  954|       |             *  COMPONENT_ORIGINAL              #0:  (num_components > 1)
  955|       |             *  COMPONENT_ORIGINAL_PREPROCESSED #0:  (num_components > 1) && (preprocessed)
  956|       |             *  COMPONENT_ORIGINAL              #1:  (num_components = 1) && (preprocessed)
  957|       |             *
  958|       |             *  Flags explanation:
  959|       |             *        MAIN => iINChI=0,  RECN => iINChI=1 (Reconnected)
  960|       |             *        ORIG => Original, PREP => Preprocessed
  961|       |             *
  962|       |             *  Possible flags:           k
  963|       |             *
  964|       |             *  COMP_ORIG_0_MAIN  0x0001  0  COMPONENT_ORIGINAL, bMain, component #0
  965|       |             *  COMP_ORIG_0_RECN  0x0002  1  COMPONENT_ORIGINAL, bRecn, component #0
  966|       |             *
  967|       |             *  COMP_PREP_0_MAIN  0x0004  2  COMPONENT_ORIGINAL_PREPROCESSED, bMain, component #0
  968|       |             *  COMP_PREP_0_RECN  0x0008  3  COMPONENT_ORIGINAL_PREPROCESSED, bRecn, component #0
  969|       |             *
  970|       |             *  COMP_ORIG_1_MAIN  0x0010  4  COMPONENT_ORIGINAL, bMain, component #1
  971|       |             *  COMP_ORIG_1_RECN  0x0020  5  COMPONENT_ORIGINAL, bRecn, component #1
  972|       |             *
  973|       |             *  bReconnected  = k%2     (0 or 1)
  974|       |             *  nComponent    = k/4     (0 or 1)
  975|       |             *  bPreprocessed = (k/2)%2 (0 or 1)
  976|       |             *
  977|       |             ******************************************************************************/
  978|       |
  979|       |            /* Original -> Main, component #0, Original */
  980|  54.6k|            if (prep_inp_data[INCHI_BAS].num_components > 1)
  ------------------
  |  |  575|  54.6k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (980:17): [True: 0, False: 54.6k]
  ------------------
  981|      0|            {
  982|      0|                bINCHI_LIB_Flag |= COMP_ORIG_0_MAIN;
  ------------------
  |  |   53|      0|#define COMP_ORIG_0_MAIN  0x0001
  ------------------
  983|      0|            }
  984|  54.6k|            else
  985|  54.6k|            {
  986|       |                /* Original -> Main, component #1, Original */
  987|  54.6k|                if (prep_inp_data[INCHI_BAS].num_components == 1 && bStructurePreprocessed)
  ------------------
  |  |  575|  54.6k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (987:21): [True: 54.6k, False: 0]
  |  Branch (987:69): [True: 0, False: 54.6k]
  ------------------
  988|      0|                {
  989|      0|                    bINCHI_LIB_Flag |= COMP_ORIG_1_MAIN;
  ------------------
  |  |   57|      0|#define COMP_ORIG_1_MAIN  0x0010
  ------------------
  990|       |                    /* preprocessed will be added when output canonicalization results */
  991|      0|                }
  992|  54.6k|            }
  993|       |
  994|  54.6k|            if (bAlsoOutputReconnected)
  ------------------
  |  Branch (994:17): [True: 0, False: 54.6k]
  ------------------
  995|      0|            {
  996|       |                /* Original -> Reconnected, component #0, Original */
  997|      0|                if (prep_inp_data[INCHI_REC].num_components > 1)
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (997:21): [True: 0, False: 0]
  ------------------
  998|      0|                {
  999|      0|                    bINCHI_LIB_Flag |= COMP_ORIG_0_RECN;
  ------------------
  |  |   54|      0|#define COMP_ORIG_0_RECN  0x0002
  ------------------
 1000|      0|                }
 1001|      0|                else if (prep_inp_data[INCHI_BAS].num_components == 1 && bStructurePreprocessed)
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (1001:26): [True: 0, False: 0]
  |  Branch (1001:74): [True: 0, False: 0]
  ------------------
 1002|      0|                {
 1003|       |                    /* Original -> Reconnected, component #1, Original */
 1004|      0|                    bINCHI_LIB_Flag |= COMP_ORIG_1_RECN;
  ------------------
  |  |   58|      0|#define COMP_ORIG_1_RECN  0x0020
  ------------------
 1005|       |                    /* preprocessed will be added when output canonicalization results */
 1006|      0|                }
 1007|      0|            }
 1008|  54.6k|            if (ip->msec_MaxTime)
  ------------------
  |  Branch (1008:17): [True: 0, False: 54.6k]
  ------------------
 1009|      0|            {
 1010|      0|                ip->msec_LeftTime -= InchiTimeElapsed( ic, &ulTStart );
 1011|      0|            }
 1012|       |
 1013|       |            /* display the ORIGINAL, UN-PREPROCESSED structure */
 1014|       |
 1015|  54.6k|            if (ip->bDisplay)
  ------------------
  |  Branch (1015:17): [True: 0, False: 54.6k]
  ------------------
 1016|      0|            {
 1017|      0|                if (DisplayTheWholeStructure( pCG, ic, sd, ip, szTitle,
  ------------------
  |  Branch (1017:21): [True: 0, False: 0]
  ------------------
 1018|      0|                    inp_file, log_file, orig_inp_data, num_inp,
 1019|      0|                    -1, bShowStructure, bINCHI_LIB_Flag ))
 1020|      0|                {
 1021|      0|                    goto exit_function;
 1022|      0|                }
 1023|      0|            }
 1024|  54.6k|        } /*#endif */
 1025|       |
 1026|  54.6k|        switch (sd->nErrorType)
  ------------------
  |  Branch (1026:17): [True: 54.6k, False: 0]
  ------------------
 1027|  54.6k|        {
 1028|      0|            case _IS_ERROR:
  ------------------
  |  |   40|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (1028:13): [True: 0, False: 54.6k]
  ------------------
 1029|      0|            case _IS_FATAL:
  ------------------
  |  |   41|      0|#define _IS_FATAL   3
  ------------------
  |  Branch (1029:13): [True: 0, False: 54.6k]
  ------------------
 1030|       |                /* error message */
 1031|      0|                nRet = TreatErrorsInReadTheStructure( sd, ip,
 1032|      0|                                                      LOG_MASK_ALL,
  ------------------
  |  |  126|      0|#define LOG_MASK_ALL     (LOG_MASK_WARN | LOG_MASK_ERR | LOG_MASK_FATAL)
  |  |  ------------------
  |  |  |  |  122|      0|#define LOG_MASK_WARN  1
  |  |  ------------------
  |  |               #define LOG_MASK_ALL     (LOG_MASK_WARN | LOG_MASK_ERR | LOG_MASK_FATAL)
  |  |  ------------------
  |  |  |  |  123|      0|#define LOG_MASK_ERR   2
  |  |  ------------------
  |  |               #define LOG_MASK_ALL     (LOG_MASK_WARN | LOG_MASK_ERR | LOG_MASK_FATAL)
  |  |  ------------------
  |  |  |  |  124|      0|#define LOG_MASK_FATAL 4
  |  |  ------------------
  ------------------
 1033|      0|                                                      inp_file, log_file, out_file, prb_file,
 1034|      0|                                                      prep_inp_data, &num_inp );
 1035|      0|                goto exit_cycle;
 1036|  54.6k|        }
 1037|  54.6k|    }
 1038|       |    /* tranfer flags from INChI_Aux to sd */
 1039|       |
 1040|       |
 1041|  54.6k|    {
 1042|       |        /*#ifndef COMPILE_ANSI_ONLY */ /* { */
 1043|       |
 1044|       |        /******************************************/
 1045|       |        /*      Displaying the structures         */
 1046|       |        /*          Only under WIN32              */
 1047|       |        /******************************************/
 1048|  54.6k|        if ( /* ip->bDisplayCompositeResults && !sd->bUserQuitComponentDisplay && */
 1049|  54.6k|             prep_inp_data[iINChI].num_components > 1
  ------------------
  |  Branch (1049:14): [True: 0, False: 54.6k]
  ------------------
 1050|  54.6k|           )
 1051|      0|        {
 1052|      0|            all_inp_norm_data = (INP_ATOM_DATA2 *) inchi_calloc( prep_inp_data[iINChI].num_components, sizeof( all_inp_norm_data[0] ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 1053|      0|        }
 1054|       |
 1055|       |        /* Display the input structure AFTER PREPROCESSING */
 1056|  54.6k|        switch (iINChI)
 1057|  54.6k|        {
 1058|  54.6k|            case INCHI_BAS:
  ------------------
  |  |  575|  54.6k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  |  Branch (1058:13): [True: 54.6k, False: 0]
  ------------------
 1059|       |                /*------------ Possibly disconnected structure -------------------*/
 1060|  54.6k|                bStructurePreprocessed = 0 != ( sd->bTautFlagsDone[iINChI] & (
 1061|  54.6k|                    TG_FLAG_MOVE_HPLUS2NEUTR_DONE |
  ------------------
  |  |  959|  54.6k|#define TG_FLAG_MOVE_HPLUS2NEUTR_DONE    0x00000001   /* protons have been moved to neutralize */
  ------------------
 1062|  54.6k|                    TG_FLAG_DISCONNECT_SALTS_DONE |
  ------------------
  |  |  961|  54.6k|#define TG_FLAG_DISCONNECT_SALTS_DONE    0x00000004
  ------------------
 1063|  54.6k|                    TG_FLAG_MOVE_POS_CHARGES_DONE |
  ------------------
  |  |  963|  54.6k|#define TG_FLAG_MOVE_POS_CHARGES_DONE    0x00000010
  ------------------
 1064|  54.6k|                    TG_FLAG_MOVE_CHARGE_COORD_DONE |
  ------------------
  |  |  974|  54.6k|#define TG_FLAG_MOVE_CHARGE_COORD_DONE   0x00000400   /* changed charge of a disconnected ligand to fit its valence */
  ------------------
 1065|  54.6k|                    TG_FLAG_DISCONNECT_COORD_DONE |
  ------------------
  |  |  972|  54.6k|#define TG_FLAG_DISCONNECT_COORD_DONE    0x00000100   /* found and disconnected "coord. centers" */
  ------------------
 1066|  54.6k|                    TG_FLAG_FIX_ODD_THINGS_DONE ) );
  ------------------
  |  |  975|  54.6k|#define TG_FLAG_FIX_ODD_THINGS_DONE      0x00000800   /* fixed drawing ambiguities in fix_odd_things */
  ------------------
 1067|  54.6k|                bINCHI_LIB_Flag = 0;
 1068|       |                /* Preprocessed/Main -> Main, component #0, Preprocessed */
 1069|  54.6k|                if (prep_inp_data[iINChI].num_components > 1 &&
  ------------------
  |  Branch (1069:21): [True: 0, False: 54.6k]
  ------------------
 1070|  54.6k|                     bStructurePreprocessed)
  ------------------
  |  Branch (1070:22): [True: 0, False: 0]
  ------------------
 1071|      0|                {
 1072|      0|                    bINCHI_LIB_Flag |= COMP_PREP_0_MAIN;
  ------------------
  |  |   55|      0|#define COMP_PREP_0_MAIN  0x0004
  ------------------
 1073|      0|                }
 1074|  54.6k|                bShowStructure = ( bStructurePreprocessed &&
  ------------------
  |  Branch (1074:36): [True: 0, False: 54.6k]
  ------------------
 1075|  54.6k|                                   prep_inp_data[iINChI].num_components > 1 );
  ------------------
  |  Branch (1075:36): [True: 0, False: 0]
  ------------------
 1076|  54.6k|                break;
 1077|       |
 1078|      0|            case INCHI_REC:
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (1078:13): [True: 0, False: 54.6k]
  ------------------
 1079|       |                /*------------ Reconnected structure ------------------------------*/
 1080|      0|                bAlsoOutputReconnected =
 1081|      0|                    ( sd->bTautFlagsDone[INCHI_BAS] & TG_FLAG_DISCONNECT_COORD_DONE ) &&
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                                  ( sd->bTautFlagsDone[INCHI_BAS] & TG_FLAG_DISCONNECT_COORD_DONE ) &&
  ------------------
  |  |  972|      0|#define TG_FLAG_DISCONNECT_COORD_DONE    0x00000100   /* found and disconnected "coord. centers" */
  ------------------
  |  Branch (1081:21): [True: 0, False: 0]
  ------------------
 1082|      0|                    ( ip->bTautFlags               & TG_FLAG_RECONNECT_COORD );
  ------------------
  |  |  935|      0|#define TG_FLAG_RECONNECT_COORD          0x00000100   /* reconnect disconnected "coord. centers" */
  ------------------
  |  Branch (1082:21): [True: 0, False: 0]
  ------------------
 1083|       |
 1084|      0|                if (!bAlsoOutputReconnected)
  ------------------
  |  Branch (1084:21): [True: 0, False: 0]
  ------------------
 1085|      0|                {
 1086|      0|                    break;
 1087|      0|                }
 1088|       |
 1089|      0|                bStructurePreprocessed = 0 != ( sd->bTautFlagsDone[iINChI] & (
 1090|      0|                    TG_FLAG_MOVE_HPLUS2NEUTR_DONE |
  ------------------
  |  |  959|      0|#define TG_FLAG_MOVE_HPLUS2NEUTR_DONE    0x00000001   /* protons have been moved to neutralize */
  ------------------
 1091|      0|                    TG_FLAG_DISCONNECT_SALTS_DONE |
  ------------------
  |  |  961|      0|#define TG_FLAG_DISCONNECT_SALTS_DONE    0x00000004
  ------------------
 1092|      0|                    TG_FLAG_MOVE_POS_CHARGES_DONE |
  ------------------
  |  |  963|      0|#define TG_FLAG_MOVE_POS_CHARGES_DONE    0x00000010
  ------------------
 1093|      0|                    TG_FLAG_FIX_ODD_THINGS_DONE ) );
  ------------------
  |  |  975|      0|#define TG_FLAG_FIX_ODD_THINGS_DONE      0x00000800   /* fixed drawing ambiguities in fix_odd_things */
  ------------------
 1094|      0|                bINCHI_LIB_Flag = 0;
 1095|       |                /* Preprocessed/Reconnected -> Reconnected, component #0, Preprocessed */
 1096|      0|                if (prep_inp_data[iINChI].num_components > 1 && bStructurePreprocessed)
  ------------------
  |  Branch (1096:21): [True: 0, False: 0]
  |  Branch (1096:65): [True: 0, False: 0]
  ------------------
 1097|      0|                {
 1098|      0|                    bINCHI_LIB_Flag |= COMP_PREP_0_RECN;
  ------------------
  |  |   56|      0|#define COMP_PREP_0_RECN  0x0008
  ------------------
 1099|      0|                }
 1100|      0|                bShowStructure = ( bStructurePreprocessed &&
  ------------------
  |  Branch (1100:36): [True: 0, False: 0]
  ------------------
 1101|      0|                                   prep_inp_data[iINChI].num_components > 1 );
  ------------------
  |  Branch (1101:36): [True: 0, False: 0]
  ------------------
 1102|      0|                break;
 1103|       |
 1104|      0|            default:
  ------------------
  |  Branch (1104:13): [True: 0, False: 54.6k]
  ------------------
 1105|      0|                bShowStructure = 0;
 1106|  54.6k|        }
 1107|       |
 1108|       |
 1109|  54.6k|        if (ip->bDisplay && prep_inp_data[iINChI].num_inp_atoms > 0)
  ------------------
  |  Branch (1109:13): [True: 0, False: 54.6k]
  |  Branch (1109:29): [True: 0, False: 0]
  ------------------
 1110|      0|        {
 1111|      0|            if (DisplayTheWholeStructure( pCG, ic, sd, ip, szTitle,
  ------------------
  |  Branch (1111:17): [True: 0, False: 0]
  ------------------
 1112|      0|                inp_file, log_file,
 1113|      0|                prep_inp_data + iINChI,
 1114|      0|                num_inp,
 1115|      0|                iINChI,
 1116|      0|                bShowStructure,
 1117|      0|                bINCHI_LIB_Flag ))
 1118|      0|            {
 1119|      0|                goto exit_function;
 1120|      0|            }
 1121|      0|        }
 1122|  54.6k|    } /* #endif */ /* } ifndef COMPILE_ANSI_ONLY */
 1123|       |
 1124|       |
 1125|       |    /* allocate pINChI[iINChI] and pINChI_Aux2[iINChI] -- arrays of pointers to INChI and INChI_Aux */
 1126|       |    /* assign values to sd->num_components[]                                                  */
 1127|  54.6k|    MYREALLOC2( PINChI2, PINChI_Aux2, pINChI2[iINChI], pINChI_Aux2[iINChI], sd->num_components[iINChI], cur_prep_inp_data->num_components, k );
  ------------------
  |  | 1165|  54.6k|    do { \
  |  | 1166|  54.6k|        if( (LEN1) <= (LEN2) ) {\
  |  |  ------------------
  |  |  |  Branch (1166:13): [True: 54.6k, False: 0]
  |  |  ------------------
  |  | 1167|  54.6k|            PTRTYPE1 * newPTR1 = (PTRTYPE1 *)inchi_calloc( (LEN2)+1, sizeof(PTRTYPE1) );\
  |  |  ------------------
  |  |  |  | 1133|  54.6k|#define inchi_calloc   calloc
  |  |  ------------------
  |  | 1168|  54.6k|            PTRTYPE2 * newPTR2 = (PTRTYPE2 *)inchi_calloc( (LEN2)+1, sizeof(PTRTYPE2) );\
  |  |  ------------------
  |  |  |  | 1133|  54.6k|#define inchi_calloc   calloc
  |  |  ------------------
  |  | 1169|  54.6k|            if ( newPTR1 && newPTR2 ) { \
  |  |  ------------------
  |  |  |  Branch (1169:18): [True: 54.6k, False: 0]
  |  |  |  Branch (1169:29): [True: 54.6k, False: 0]
  |  |  ------------------
  |  | 1170|  54.6k|                if ( (PTR1) && (LEN1) > 0 ) \
  |  |  ------------------
  |  |  |  Branch (1170:22): [True: 0, False: 54.6k]
  |  |  |  Branch (1170:32): [True: 0, False: 0]
  |  |  ------------------
  |  | 1171|  54.6k|                    (memcpy) ( newPTR1, (PTR1), (LEN1) * sizeof(PTRTYPE1) ); \
  |  | 1172|  54.6k|                if ( (PTR2) && (LEN1) > 0 ) \
  |  |  ------------------
  |  |  |  Branch (1172:22): [True: 0, False: 54.6k]
  |  |  |  Branch (1172:32): [True: 0, False: 0]
  |  |  ------------------
  |  | 1173|  54.6k|                    (memcpy) ( newPTR2, (PTR2), (LEN1) * sizeof(PTRTYPE2) ); \
  |  | 1174|  54.6k|                if ( PTR1 ) \
  |  |  ------------------
  |  |  |  Branch (1174:22): [True: 0, False: 54.6k]
  |  |  ------------------
  |  | 1175|  54.6k|                    inchi_free(PTR1);  \
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1176|  54.6k|                if ( PTR2 ) \
  |  |  ------------------
  |  |  |  Branch (1176:22): [True: 0, False: 54.6k]
  |  |  ------------------
  |  | 1177|  54.6k|                    inchi_free(PTR2);  \
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1178|  54.6k|                (PTR1) = newPTR1; \
  |  | 1179|  54.6k|                (PTR2) = newPTR2; \
  |  | 1180|  54.6k|                (LEN1) = (LEN2);  \
  |  | 1181|  54.6k|                (ERR)  = 0; \
  |  | 1182|  54.6k|            } else {        \
  |  | 1183|      0|                (ERR)  = 1; \
  |  | 1184|      0|            }               \
  |  | 1185|  54.6k|        } else { (ERR) = 0; } \
  |  | 1186|  54.6k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (1186:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1128|       |
 1129|  54.6k|    if (k)
  ------------------
  |  Branch (1129:9): [True: 0, False: 54.6k]
  ------------------
 1130|      0|    {
 1131|      0|        AddErrorMessage( sd->pStrErrStruct, "Cannot allocate output data. Terminating" );
 1132|      0|        sd->nStructReadError = 99;
 1133|      0|        sd->nErrorType = _IS_FATAL;
  ------------------
  |  |   41|      0|#define _IS_FATAL   3
  ------------------
 1134|      0|        goto exit_function;
 1135|      0|    }
 1136|       |
 1137|  54.6k|    pINChI = pINChI2[iINChI];
 1138|  54.6k|    pINChI_Aux = pINChI_Aux2[iINChI];
 1139|       |
 1140|       |    /**************************************************************************/
 1141|       |    /*                                                                        */
 1142|       |    /*                                                                        */
 1143|       |    /*   M A I N   C Y C L E:   P R O C E S S    C O M P O N E N T S          */
 1144|       |    /*                                                                        */
 1145|       |    /*                                                                        */
 1146|       |    /*                     O N E   B Y   O N E                                */
 1147|       |    /*                                                                        */
 1148|       |    /*                                                                        */
 1149|       |    /**************************************************************************/
 1150|       |
 1151|  54.6k|    for (i = 0, nRet = 0;
 1152|   109k|            !sd->bUserQuitComponent && i < cur_prep_inp_data->num_components;
  ------------------
  |  Branch (1152:13): [True: 109k, False: 0]
  |  Branch (1152:40): [True: 54.6k, False: 54.6k]
  ------------------
 1153|  54.6k|                i++)
 1154|  54.6k|    {
 1155|  54.6k|        if (ip->msec_MaxTime)
  ------------------
  |  Branch (1155:13): [True: 0, False: 54.6k]
  ------------------
 1156|      0|        {
 1157|      0|            InchiTimeGet( &ulTStart );
 1158|      0|        }
 1159|       |
 1160|  54.6k|#ifndef TARGET_LIB_FOR_WINCHI  /* { */
 1161|  54.6k|#if ( bREUSE_INCHI == 1 )
 1162|       |
 1163|  54.6k|        if (iINChI == INCHI_REC &&
  ------------------
  |  |  576|   109k|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
  |  Branch (1163:13): [True: 0, False: 54.6k]
  ------------------
 1164|       |             /*( !ip->bDisplay &&
 1165|       |               !ip->bDisplayCompositeResults && */
 1166|  54.6k|               !( ip->bCompareComponents & CMP_COMPONENTS ) ||
  ------------------
  |  |   82|      0|#define CMP_COMPONENTS              0x0001     /* perform compare components */
  ------------------
  |  Branch (1166:16): [True: 0, False: 0]
  ------------------
 1167|  54.6k|               sd->bUserQuitComponentDisplay)
  ------------------
  |  Branch (1167:16): [True: 0, False: 54.6k]
  ------------------
 1168|      0|        {
 1169|       |            /* Reconnected structure (06-20-2005: added "&& !ip->bDisplayCompositeResults" to display composite structure) */
 1170|      0|            int m = iINChI - 1;
 1171|       |
 1172|       |            /* Find whether we have already calculated this INChI in basic (disconnected) layer */
 1173|      0|            for (j = n = 0; j < prep_inp_data[m].num_components; j++)
  ------------------
  |  Branch (1173:29): [True: 0, False: 0]
  ------------------
 1174|      0|            {
 1175|      0|                if (i + 1 == prep_inp_data[m].nOldCompNumber[j] &&
  ------------------
  |  Branch (1175:21): [True: 0, False: 0]
  ------------------
 1176|      0|                    ( pINChI2[m][j][TAUT_NON] || pINChI2[m][j][TAUT_YES] ))
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                                  ( pINChI2[m][j][TAUT_NON] || pINChI2[m][j][TAUT_YES] ))
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1176:23): [True: 0, False: 0]
  |  Branch (1176:50): [True: 0, False: 0]
  ------------------
 1177|      0|                {
 1178|       |                    /* Yes, we have already done this */
 1179|      0|                    if (!n++)
  ------------------
  |  Branch (1179:25): [True: 0, False: 0]
  ------------------
 1180|      0|                    {
 1181|      0|                        memcpy( pINChI + i, pINChI2[m] + j, sizeof( pINChI[0] ) );
 1182|      0|                        memcpy( pINChI_Aux + i, pINChI_Aux2[m] + j, sizeof( pINChI_Aux[0] ) );
 1183|      0|                        for (k = 0; k < TAUT_NUM; k++)
  ------------------
  |  |  578|      0|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1183:37): [True: 0, False: 0]
  ------------------
 1184|      0|                        {
 1185|      0|                            if (pINChI[i][k])
  ------------------
  |  Branch (1185:33): [True: 0, False: 0]
  ------------------
 1186|      0|                            {
 1187|      0|                                pINChI[i][k]->nRefCount++;
 1188|      0|                                if (pINChI[i][k]->nNumberOfAtoms > 0)
  ------------------
  |  Branch (1188:37): [True: 0, False: 0]
  ------------------
 1189|      0|                                {
 1190|      0|                                    switch (k)
  ------------------
  |  Branch (1190:45): [True: 0, False: 0]
  ------------------
 1191|      0|                                    {
 1192|      0|                                        case TAUT_NON:
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1192:41): [True: 0, False: 0]
  ------------------
 1193|      0|                                            sd->num_non_taut[iINChI] ++;
 1194|      0|                                            break;
 1195|      0|                                        case TAUT_YES:
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1195:41): [True: 0, False: 0]
  ------------------
 1196|      0|                                            if (pINChI[i][k]->lenTautomer > 0)
  ------------------
  |  Branch (1196:49): [True: 0, False: 0]
  ------------------
 1197|      0|                                            {
 1198|      0|                                                sd->num_taut[iINChI] ++;
 1199|      0|                                            }
 1200|      0|                                            else
 1201|      0|                                                if (!pINChI[i][TAUT_NON] ||
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1201:53): [True: 0, False: 0]
  ------------------
 1202|      0|                                                     !pINChI[i][TAUT_NON]->nNumberOfAtoms)
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1202:54): [True: 0, False: 0]
  ------------------
 1203|      0|                                                {
 1204|      0|                                                    sd->num_non_taut[iINChI] ++;
 1205|      0|                                                }
 1206|      0|                                            break;
 1207|      0|                                    }
 1208|      0|                                }
 1209|      0|                            }
 1210|      0|                            if (pINChI_Aux[i][k])
  ------------------
  |  Branch (1210:33): [True: 0, False: 0]
  ------------------
 1211|      0|                            {
 1212|      0|                                pINChI_Aux[i][k]->nRefCount++;
 1213|      0|                            }
 1214|      0|                        }
 1215|      0|                    }
 1216|      0|                }
 1217|      0|            }
 1218|       |
 1219|      0|            if (n == 1)
  ------------------
  |  Branch (1219:17): [True: 0, False: 0]
  ------------------
 1220|      0|            {
 1221|      0|                continue;
 1222|      0|            }
 1223|      0|            if (n > 1)
  ------------------
  |  Branch (1223:17): [True: 0, False: 0]
  ------------------
 1224|      0|            {
 1225|       |                /* ith component is equivalent to more than one another component */
 1226|      0|                AddErrorMessage( sd->pStrErrStruct, "Cannot distinguish components" );
 1227|      0|                sd->nStructReadError = 99;
 1228|      0|                sd->nErrorType = _IS_ERROR;
  ------------------
  |  |   40|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
 1229|      0|                goto exit_function;
 1230|      0|            }
 1231|      0|        }
 1232|       |
 1233|  54.6k|#endif
 1234|  54.6k|#endif /* } TARGET_LIB_FOR_WINCHI */
 1235|       |
 1236|       |        /*****************************************************/
 1237|       |        /*  a) Allocate memory and extract current component */
 1238|       |        /*****************************************************/
 1239|       |
 1240|  54.6k|        nRet = GetOneComponent( ic, sd, ip,
 1241|  54.6k|                                log_file, out_file,
 1242|  54.6k|                                inp_cur_data, cur_prep_inp_data,
 1243|  54.6k|                                i, num_inp );
 1244|       |
 1245|  54.6k|        if (ip->msec_MaxTime)
  ------------------
  |  Branch (1245:13): [True: 0, False: 54.6k]
  ------------------
 1246|      0|        {
 1247|      0|            ip->msec_LeftTime -= InchiTimeElapsed( ic, &ulTStart );
 1248|      0|        }
 1249|       |
 1250|  54.6k|        switch (nRet)
  ------------------
  |  Branch (1250:17): [True: 54.6k, False: 0]
  ------------------
 1251|  54.6k|        {
 1252|      0|            case _IS_ERROR:
  ------------------
  |  |   40|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (1252:13): [True: 0, False: 54.6k]
  ------------------
 1253|      0|            case _IS_FATAL:
  ------------------
  |  |   41|      0|#define _IS_FATAL   3
  ------------------
  |  Branch (1253:13): [True: 0, False: 54.6k]
  ------------------
 1254|      0|                goto exit_cycle;
 1255|  54.6k|        }
 1256|       |
 1257|       |#if !defined(TARGET_API_LIB) && !defined(COMPILE_ANSI_ONLY)
 1258|       |        /*  console request: Display the component? */
 1259|       |        if (ip->bDisplay && inp_file->f != stdin)
 1260|       |        {
 1261|       |            if (user_quit( ic, "Enter=Display Component, Esc=Stop ?", ip->ulDisplTime ))
 1262|       |            {
 1263|       |                sd->bUserQuitComponent = 1;
 1264|       |                break;
 1265|       |            }
 1266|       |        }
 1267|       |#endif
 1268|       |
 1269|       |        /*#ifndef COMPILE_ANSI_ONLY  /* { */
 1270|       |
 1271|       |        /*  b) Display the extracted original component structure */
 1272|  54.6k|        if (ip->bDisplay && inp_cur_data->at && !sd->bUserQuitComponentDisplay)
  ------------------
  |  Branch (1272:13): [True: 0, False: 54.6k]
  |  Branch (1272:29): [True: 0, False: 0]
  |  Branch (1272:49): [True: 0, False: 0]
  ------------------
 1273|      0|        {
 1274|      0|            if (cur_prep_inp_data->num_components == 1)
  ------------------
  |  Branch (1274:17): [True: 0, False: 0]
  ------------------
 1275|      0|            {
 1276|      0|                sprintf( szTitle, "%sInput Structure #%ld.%s%s%s%s%s",
 1277|      0|                                  bStructurePreprocessed ? "Preprocessed " : "",
  ------------------
  |  Branch (1277:35): [True: 0, False: 0]
  ------------------
 1278|      0|                                  num_inp, SDF_LBL_VAL( ip->pSdfLabel, ip->pSdfValue ), iINChI ? " (Reconnected)" : "" );
  ------------------
  |  |  410|      0|#define SDF_LBL_VAL(L,V)  ((L)&&(L)[0])?gsSpace:gsEmpty, ((L)&&(L)[0])?L:gsEmpty, ((L)&&(L)[0])? (((V)&&(V)[0])?gsEqual:gsSpace):gsEmpty, ((V)&&(V)[0])?V:((L)&&(L)[0])?gsMissing:gsEmpty
  |  |  ------------------
  |  |  |  Branch (410:28): [True: 0, False: 0]
  |  |  |  Branch (410:33): [True: 0, False: 0]
  |  |  |  Branch (410:59): [True: 0, False: 0]
  |  |  |  Branch (410:64): [True: 0, False: 0]
  |  |  |  Branch (410:84): [True: 0, False: 0]
  |  |  |  Branch (410:89): [True: 0, False: 0]
  |  |  |  Branch (410:100): [True: 0, False: 0]
  |  |  |  Branch (410:105): [True: 0, False: 0]
  |  |  |  Branch (410:140): [True: 0, False: 0]
  |  |  |  Branch (410:145): [True: 0, False: 0]
  |  |  |  Branch (410:156): [True: 0, False: 0]
  |  |  |  Branch (410:161): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1278:89): [True: 0, False: 0]
  ------------------
 1279|      0|            }
 1280|      0|            else
 1281|      0|            {
 1282|      0|                sprintf( szTitle, "Component #%d of %d, Input Structure #%ld.%s%s%s%s%s",
 1283|      0|                                  i + 1, cur_prep_inp_data->num_components,
 1284|      0|                                  num_inp, SDF_LBL_VAL( ip->pSdfLabel, ip->pSdfValue ), iINChI ? " (Reconnected)" : "" );
  ------------------
  |  |  410|      0|#define SDF_LBL_VAL(L,V)  ((L)&&(L)[0])?gsSpace:gsEmpty, ((L)&&(L)[0])?L:gsEmpty, ((L)&&(L)[0])? (((V)&&(V)[0])?gsEqual:gsSpace):gsEmpty, ((V)&&(V)[0])?V:((L)&&(L)[0])?gsMissing:gsEmpty
  |  |  ------------------
  |  |  |  Branch (410:28): [True: 0, False: 0]
  |  |  |  Branch (410:33): [True: 0, False: 0]
  |  |  |  Branch (410:59): [True: 0, False: 0]
  |  |  |  Branch (410:64): [True: 0, False: 0]
  |  |  |  Branch (410:84): [True: 0, False: 0]
  |  |  |  Branch (410:89): [True: 0, False: 0]
  |  |  |  Branch (410:100): [True: 0, False: 0]
  |  |  |  Branch (410:105): [True: 0, False: 0]
  |  |  |  Branch (410:140): [True: 0, False: 0]
  |  |  |  Branch (410:145): [True: 0, False: 0]
  |  |  |  Branch (410:156): [True: 0, False: 0]
  |  |  |  Branch (410:161): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1284:89): [True: 0, False: 0]
  ------------------
 1285|      0|            }
 1286|       |
 1287|       |#if defined (TARGET_EXE_STANDALONE) && defined(_WIN32)
 1288|       |            err_display = DisplayStructure( pCG,
 1289|       |                                    inp_cur_data->at,
 1290|       |                                    inp_cur_data->num_at,
 1291|       |                                    NULL, /* OAD_Polymer *polymer, */
 1292|       |                                    0,
 1293|       |                                    1,
 1294|       |                                    0,
 1295|       |                                    NULL,
 1296|       |                                    1           /*isotopic*/,
 1297|       |                                    0           /*taut*/,
 1298|       |                                    NULL,
 1299|       |                                    NULL,
 1300|       |                                    ip->bAbcNumbers,
 1301|       |                                    &ip->dp,
 1302|       |                                    ip->nMode,
 1303|       |                                    szTitle );
 1304|       |
 1305|       |            sd->bUserQuitComponentDisplay = (err_display == ESC_KEY );
 1306|       |
 1307|       |            if (!err_display)
 1308|       |            {
 1309|       |                inchi_fprintf( stderr, "Cannot display the structure\n" );
 1310|       |            }
 1311|       |#endif
 1312|       |#ifdef TARGET_LIB_FOR_WINCHI
 1313|       |            if (DRAWDATA && DRAWDATA_EXISTS)
 1314|       |            {
 1315|       |                struct DrawData vDrawData;
 1316|       |                int    nType = COMPONENT_ORIGINAL;
 1317|       |                vDrawData.pWindowData = CreateWinData_( pCG,
 1318|       |                                                        inp_cur_data->at,
 1319|       |                                                        inp_cur_data->num_at,
 1320|       |                                                        0,
 1321|       |                                                        1 /* bAdd_DT_to_num_H */,
 1322|       |                                                        0,
 1323|       |                                                        NULL,
 1324|       |                                                        1 /* display isotopic if present */,
 1325|       |                                                        0,
 1326|       |                                                        NULL,
 1327|       |                                                        NULL,
 1328|       |                                                        ip->bAbcNumbers,
 1329|       |                                                        &ip->dp,
 1330|       |                                                        ip->nMode );
 1331|       |                if (vDrawData.pWindowData != NULL)
 1332|       |                {
 1333|       |                    if (DRAWDATA_EXISTS( i + 1, nType, iINChI ))
 1334|       |                    {
 1335|       |                        /* i = component number */
 1336|       |                        nType = COMPONENT_ORIGINAL_PREPROCESSED;
 1337|       |                    }
 1338|       |                    vDrawData.nComponent = i + 1;
 1339|       |                    vDrawData.nType = nType;
 1340|       |                    vDrawData.bReconnected = iINChI; /* 0=>main; 1=>reconnected */
 1341|       |                    vDrawData.szTitle = inchi__strdup( szTitle );
 1342|       |                    vDrawData.pWindowData->szTitle = inchi__strdup( szTitle );
 1343|       |                    DRAWDATA( &vDrawData );
 1344|       |                }
 1345|       |            }
 1346|       |#endif
 1347|      0|        }
 1348|       |        /*#endif */  /* } COMPILE_ANSI_ONLY */
 1349|       |
 1350|       |
 1351|       |        /*******************************************************************************/
 1352|       |        /*                                                                             */
 1353|       |        /*  N O R M A L I Z A T I O N    a n d     C A N O N I C A L I Z A T I O N     */
 1354|       |        /*                                                                             */
 1355|       |        /*         (both tautomeric and non-tautomeric if requested)                   */
 1356|       |        /*                                                                             */
 1357|       |        /*******************************************************************************/
 1358|       |        /*  c) Create the component's INChI ( copies ip->bTautFlags into sd->bTautFlags)*/
 1359|       |        /*******************************************************************************/
 1360|       |
 1361|  54.6k|        nRet = CreateOneComponentINChI( pCG, ic, sd, ip,
 1362|  54.6k|                                        inp_cur_data, orig_inp_data,
 1363|  54.6k|                                        pINChI/*2[iINChI]*/,
 1364|  54.6k|                                        pINChI_Aux/*2[iINChI]*/,
 1365|  54.6k|                                        iINChI, i, num_inp,
 1366|  54.6k|                                        inp_norm_data, pncFlags, log_file );
 1367|       |
 1368|       |
 1369|       |
 1370|       |        /*  d) Display one component structure and/or INChI results only if there was no error */
 1371|       |
 1372|       |        /* #ifndef COMPILE_ANSI_ONLY */ /* { */
 1373|  54.6k|        if (!nRet)
  ------------------
  |  Branch (1373:13): [True: 54.6k, False: 0]
  ------------------
 1374|  54.6k|        {
 1375|       |            /*  output one component INChI to the stdout if requested */
 1376|       |            /*
 1377|       |            if ( ip->bDisplayEachComponentINChI ) {
 1378|       |                int cur_num_non_taut = (pINChI[i][TAUT_NON] && pINChI[i][TAUT_NON]->nNumberOfAtoms>0);
 1379|       |                int cur_num_taut     = (pINChI[i][TAUT_YES] && pINChI[i][TAUT_YES]->nNumberOfAtoms>0);
 1380|       |                if ( ip->bDisplayEachComponentINChI && cur_num_non_taut + cur_num_taut ) {
 1381|       |                    SortAndPrintINChI( pCG, stdout, pStr, nStrLen, NULL,
 1382|       |                                       ip, 1, cur_num_non_taut, cur_num_taut,
 1383|       |                                       num_inp, pINChI+i, pINChI_Aux+i,
 1384|       |                                       save_opt_bits);
 1385|       |                }
 1386|       |            }
 1387|       |            */
 1388|       |            /**************************************************************************
 1389|       |             * display from one up to 4 structure pictures-results for each component *
 1390|       |             * Enable buttons:                                                        *
 1391|       |             * BN (non-tautomeric non-isotopic): inp_norm_data[0]->bExists            *
 1392|       |             * TN (tautomeric non-isotopic):     inp_norm_data[1]->bExists            *
 1393|       |             * BI (non-tautomeric isotopic):     inp_norm_data[0]->bExists &&         *
 1394|       |             *                                   inp_norm_data[0]->bHasIsotopicLayer  *
 1395|       |             * TI (tautomeric isotopic):         inp_norm_data[1]->bExists &&         *
 1396|       |             *                                   inp_norm_data[1]->bHasIsotopicLayer  *
 1397|       |             **************************************************************************/
 1398|       |
 1399|  54.6k|            int bIsotopic, bTautomeric, bDisplayTaut, bHasIsotopicLayer, bFixedBondsTaut, m_max, m, nNumDisplayedFixedBondTaut = 0;
 1400|       |
 1401|  54.6k|            for ( j = 0;
 1402|  54.6k|                  ip->bDisplay && !sd->bUserQuitComponentDisplay && j < TAUT_NUM;
  ------------------
  |  |  578|      0|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1402:19): [True: 0, False: 54.6k]
  |  Branch (1402:35): [True: 0, False: 0]
  |  Branch (1402:69): [True: 0, False: 0]
  ------------------
 1403|  54.6k|                  j++)
 1404|      0|            {
 1405|      0|                if (inp_norm_data[j]->bExists && !inp_norm_data[j]->bDeleted)
  ------------------
  |  Branch (1405:21): [True: 0, False: 0]
  |  Branch (1405:50): [True: 0, False: 0]
  ------------------
 1406|      0|                {
 1407|      0|                    bTautomeric = ( pINChI[i][j]->lenTautomer > 0 );
 1408|       |                     /* same as (inp_norm_data[j]->bTautomeric > 0) */
 1409|       |
 1410|       |                    /* If requested tautomeric and no tautmerism found then do not say mobile or fixed H. 2004-10-27 */
 1411|      0|                    bDisplayTaut = ( !( ip->nMode & REQ_MODE_BASIC ) && !bTautomeric ) ? -1 : bTautomeric;
  ------------------
  |  |   43|      0|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
  |  Branch (1411:38): [True: 0, False: 0]
  |  Branch (1411:73): [True: 0, False: 0]
  ------------------
 1412|      0|                    bHasIsotopicLayer = ( inp_norm_data[j]->bHasIsotopicLayer > 0 );
 1413|       |
 1414|      0|                    for (k = 0; k <= bHasIsotopicLayer; k++)
  ------------------
  |  Branch (1414:33): [True: 0, False: 0]
  ------------------
 1415|      0|                    {
 1416|      0|                        bIsotopic = ( k > 0 );
 1417|      0|                        m_max = inp_norm_data[j]->at_fixed_bonds && inp_norm_data[j]->bTautPreprocessed ? 1 : 0;
  ------------------
  |  Branch (1417:33): [True: 0, False: 0]
  |  Branch (1417:69): [True: 0, False: 0]
  ------------------
 1418|      0|                        for (m = m_max; 0 <= m; m--)
  ------------------
  |  Branch (1418:41): [True: 0, False: 0]
  ------------------
 1419|      0|                        {
 1420|      0|                            bFixedBondsTaut = ( m > 0 );
 1421|      0|                            nNumDisplayedFixedBondTaut += bFixedBondsTaut;
 1422|       |                                /* display only one time */
 1423|       |
 1424|       |                            /*  Added number of components, added another format for a single component case - DCh */
 1425|      0|                            if (cur_prep_inp_data->num_components > 1)
  ------------------
  |  Branch (1425:33): [True: 0, False: 0]
  ------------------
 1426|      0|                            {
 1427|      0|                                sprintf( szTitle, "%s Component #%d of %d, Structure #%ld%s%s.%s%s%s%s%s",
 1428|      0|                                              bFixedBondsTaut ? "Preprocessed" : "Result for",
  ------------------
  |  Branch (1428:47): [True: 0, False: 0]
  ------------------
 1429|      0|                                              i + 1, cur_prep_inp_data->num_components, num_inp,
 1430|      0|                                              bDisplayTaut == 1 ? ", mobile H" : bDisplayTaut == 0 ? ", fixed H" : "",
  ------------------
  |  Branch (1430:47): [True: 0, False: 0]
  |  Branch (1430:82): [True: 0, False: 0]
  ------------------
 1431|      0|                                              bIsotopic ? ", isotopic" : "",
  ------------------
  |  Branch (1431:47): [True: 0, False: 0]
  ------------------
 1432|      0|                                              SDF_LBL_VAL( ip->pSdfLabel, ip->pSdfValue ), iINChI ? " (Reconnected)" : "" );
  ------------------
  |  |  410|      0|#define SDF_LBL_VAL(L,V)  ((L)&&(L)[0])?gsSpace:gsEmpty, ((L)&&(L)[0])?L:gsEmpty, ((L)&&(L)[0])? (((V)&&(V)[0])?gsEqual:gsSpace):gsEmpty, ((V)&&(V)[0])?V:((L)&&(L)[0])?gsMissing:gsEmpty
  |  |  ------------------
  |  |  |  Branch (410:28): [True: 0, False: 0]
  |  |  |  Branch (410:33): [True: 0, False: 0]
  |  |  |  Branch (410:59): [True: 0, False: 0]
  |  |  |  Branch (410:64): [True: 0, False: 0]
  |  |  |  Branch (410:84): [True: 0, False: 0]
  |  |  |  Branch (410:89): [True: 0, False: 0]
  |  |  |  Branch (410:100): [True: 0, False: 0]
  |  |  |  Branch (410:105): [True: 0, False: 0]
  |  |  |  Branch (410:140): [True: 0, False: 0]
  |  |  |  Branch (410:145): [True: 0, False: 0]
  |  |  |  Branch (410:156): [True: 0, False: 0]
  |  |  |  Branch (410:161): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1432:92): [True: 0, False: 0]
  ------------------
 1433|      0|                            }
 1434|      0|                            else
 1435|      0|                            {
 1436|      0|                                sprintf( szTitle, "%s Structure #%ld%s%s.%s%s%s%s%s",
 1437|      0|                                              bFixedBondsTaut ? "Preprocessed" : "Result for",
  ------------------
  |  Branch (1437:47): [True: 0, False: 0]
  ------------------
 1438|      0|                                              num_inp,
 1439|      0|                                              bDisplayTaut == 1 ? ", mobile H" : bDisplayTaut == 0 ? ", fixed H" : "",
  ------------------
  |  Branch (1439:47): [True: 0, False: 0]
  |  Branch (1439:82): [True: 0, False: 0]
  ------------------
 1440|      0|                                              bIsotopic ? ", isotopic" : "",
  ------------------
  |  Branch (1440:47): [True: 0, False: 0]
  ------------------
 1441|      0|                                              SDF_LBL_VAL( ip->pSdfLabel, ip->pSdfValue ), iINChI ? " (Reconnected)" : "" );
  ------------------
  |  |  410|      0|#define SDF_LBL_VAL(L,V)  ((L)&&(L)[0])?gsSpace:gsEmpty, ((L)&&(L)[0])?L:gsEmpty, ((L)&&(L)[0])? (((V)&&(V)[0])?gsEqual:gsSpace):gsEmpty, ((V)&&(V)[0])?V:((L)&&(L)[0])?gsMissing:gsEmpty
  |  |  ------------------
  |  |  |  Branch (410:28): [True: 0, False: 0]
  |  |  |  Branch (410:33): [True: 0, False: 0]
  |  |  |  Branch (410:59): [True: 0, False: 0]
  |  |  |  Branch (410:64): [True: 0, False: 0]
  |  |  |  Branch (410:84): [True: 0, False: 0]
  |  |  |  Branch (410:89): [True: 0, False: 0]
  |  |  |  Branch (410:100): [True: 0, False: 0]
  |  |  |  Branch (410:105): [True: 0, False: 0]
  |  |  |  Branch (410:140): [True: 0, False: 0]
  |  |  |  Branch (410:145): [True: 0, False: 0]
  |  |  |  Branch (410:156): [True: 0, False: 0]
  |  |  |  Branch (410:161): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1441:92): [True: 0, False: 0]
  ------------------
 1442|      0|                            }
 1443|       |
 1444|       |#if defined (TARGET_EXE_STANDALONE) && defined(_WIN32)
 1445|       |                            if (bFixedBondsTaut && nNumDisplayedFixedBondTaut != 1)
 1446|       |                            {
 1447|       |                                continue;
 1448|       |                            }
 1449|       |                            if (ip->bDisplay)
 1450|       |                            {
 1451|       |                                if (bFixedBondsTaut)
 1452|       |                                {
 1453|       |                                    err_display = DisplayStructure( pCG,
 1454|       |                                                            inp_norm_data[j]->at_fixed_bonds,
 1455|       |                                                            inp_norm_data[j]->num_at,
 1456|       |                                                            NULL, /* OAD_Polymer *polymer, */
 1457|       |                                                            inp_norm_data[j]->num_removed_H,
 1458|       |                                                            0 /*bAdd_DT_to_num_H*/,
 1459|       |                                                            inp_norm_data[j]->nNumRemovedProtons,
 1460|       |                                                            inp_norm_data[j]->nNumRemovedProtonsIsotopic,
 1461|       |                                                            bHasIsotopicLayer,
 1462|       |                                                            j,
 1463|       |                                                            NULL,
 1464|       |                                                            NULL,
 1465|       |                                                            ip->bAbcNumbers,
 1466|       |                                                            &ip->dp,
 1467|       |                                                            ip->nMode,
 1468|       |                                                            szTitle );
 1469|       |                                }
 1470|       |                                else
 1471|       |                                {
 1472|       |                                    err_display = DisplayStructure( pCG,
 1473|       |                                                            inp_norm_data[j]->at,
 1474|       |                                                            inp_norm_data[j]->num_at,
 1475|       |                                                            NULL, /* OAD_Polymer *polymer, */
 1476|       |                                                            0,
 1477|       |                                                            0 /*bAdd_DT_to_num_H*/,
 1478|       |                                                            0,
 1479|       |                                                            NULL,
 1480|       |                                                            k,
 1481|       |                                                            j,
 1482|       |                                                            pINChI[i],
 1483|       |                                                            pINChI_Aux[i],
 1484|       |                                                            ip->bAbcNumbers,
 1485|       |                                                            &ip->dp,
 1486|       |                                                            ip->nMode, szTitle );
 1487|       |                                }
 1488|       |                                if (sd->bUserQuitComponentDisplay = (err_display == ESC_KEY ))
 1489|       |                                {
 1490|       |                                    break;
 1491|       |                                }
 1492|       |                            }
 1493|       |#endif
 1494|       |#ifdef TARGET_LIB_FOR_WINCHI
 1495|       |
 1496|       |                            if (DRAWDATA && !bFixedBondsTaut)
 1497|       |                            {
 1498|       |                                struct DrawData vDrawData;
 1499|       |                                vDrawData.pWindowData =
 1500|       |                                    CreateWinData_( pCG,
 1501|       |                                                    inp_norm_data[j]->at,
 1502|       |                                                    inp_norm_data[j]->num_at,
 1503|       |                                                    0,
 1504|       |                                                    0 /* bAdd_DT_to_num_H */,
 1505|       |                                                    0,
 1506|       |                                                    NULL,
 1507|       |                                                    k,
 1508|       |                                                    j,
 1509|       |                                                    pINChI[i],
 1510|       |                                                    pINChI_Aux[i],
 1511|       |                                                    ip->bAbcNumbers,
 1512|       |                                                    &ip->dp,
 1513|       |                                                    ip->nMode );
 1514|       |
 1515|       |                                if (vDrawData.pWindowData != NULL)
 1516|       |                                {
 1517|       |                                    int nType;
 1518|       |                                    vDrawData.nComponent = i + 1;
 1519|       |                                    if (bTautomeric == 0)
 1520|       |                                        nType = ( bIsotopic == 0 ) ? COMPONENT_BN
 1521|       |                                        : COMPONENT_BI;
 1522|       |                                    else
 1523|       |                                        nType = ( bIsotopic == 0 ) ? COMPONENT_TN
 1524|       |                                        : COMPONENT_TI;
 1525|       |                                    vDrawData.nType = nType;
 1526|       |
 1527|       |                                    vDrawData.bReconnected = iINChI; /* 0=>main; 1=>reconnected */
 1528|       |                                    vDrawData.szTitle = inchi__strdup( szTitle );
 1529|       |                                    vDrawData.pWindowData->szTitle = inchi__strdup( szTitle );
 1530|       |                                    DRAWDATA( &vDrawData );
 1531|       |                                }
 1532|       |                            }
 1533|       |                            else if (DRAWDATA && bFixedBondsTaut)
 1534|       |                            {
 1535|       |                                struct DrawData vDrawData;
 1536|       |                                if (( ip->bCompareComponents & CMP_COMPONENTS ) &&
 1537|       |                                     !( ip->bCompareComponents & CMP_COMPONENTS_NONTAUT ) &&
 1538|       |                                     !bIsotopic == !inp_norm_data[j]->bHasIsotopicLayer)
 1539|       |                                {
 1540|       |
 1541|       |                                    vDrawData.pWindowData =
 1542|       |                                        CreateWinData_( pCG,
 1543|       |                                                        inp_norm_data[j]->at_fixed_bonds,
 1544|       |                                                        inp_norm_data[j]->num_at,
 1545|       |                                                        inp_norm_data[j]->num_removed_H,
 1546|       |                                                        0 /* bAdd_DT_to_num_H */,
 1547|       |                                                        inp_norm_data[j]->nNumRemovedProtons,
 1548|       |                                                        inp_norm_data[j]->nNumRemovedProtonsIsotopic,
 1549|       |                                                        k,
 1550|       |                                                        j,
 1551|       |                                                        NULL,
 1552|       |                                                        NULL,
 1553|       |                                                        ip->bAbcNumbers,
 1554|       |                                                        &ip->dp,
 1555|       |                                                        ip->nMode );
 1556|       |                                }
 1557|       |                                else
 1558|       |                                {
 1559|       |                                    continue;
 1560|       |                                }
 1561|       |                                if (vDrawData.pWindowData != NULL)
 1562|       |                                {
 1563|       |                                    vDrawData.nComponent = i + 1;
 1564|       |                                    vDrawData.nType = COMPONENT_ORIGINAL_PREPROCESSED;
 1565|       |                                    vDrawData.bReconnected = iINChI; /* 0=>main; 1=>reconnected */
 1566|       |                                    vDrawData.szTitle = inchi__strdup( szTitle );
 1567|       |                                    vDrawData.pWindowData->szTitle = inchi__strdup( szTitle );
 1568|       |                                    DRAWDATA( &vDrawData );
 1569|       |                                }
 1570|       |                            }
 1571|       |#endif
 1572|      0|                        }
 1573|      0|                    }
 1574|      0|                }
 1575|      0|            }
 1576|       |
 1577|       |            /* Save normalized components for composite display */
 1578|  54.6k|            if ( /*ip->bDisplayCompositeResults && */
 1579|  54.6k|                 all_inp_norm_data
  ------------------
  |  Branch (1579:18): [True: 0, False: 54.6k]
  ------------------
 1580|  54.6k|                )
 1581|      0|            {
 1582|      0|                for (j = 0; j < TAUT_NUM; j++)
  ------------------
  |  |  578|      0|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1582:29): [True: 0, False: 0]
  ------------------
 1583|      0|                {
 1584|      0|                    if (inp_norm_data[j]->bExists)
  ------------------
  |  Branch (1584:25): [True: 0, False: 0]
  ------------------
 1585|      0|                    {
 1586|      0|                        all_inp_norm_data[i][j] = *inp_norm_data[j];
 1587|      0|                        memset( inp_norm_data[j], 0, sizeof( *inp_norm_data[0] ) );
 1588|      0|                    }
 1589|      0|                }
 1590|      0|            }
 1591|  54.6k|        }
 1592|       |
 1593|       |        /* #endif */ /* } COMPILE_ANSI_ONLY */
 1594|       |
 1595|       |
 1596|  54.6k|        if (nRet)
  ------------------
  |  Branch (1596:13): [True: 0, False: 54.6k]
  ------------------
 1597|      0|        {
 1598|      0|            nRet = TreatErrorsInCreateOneComponentINChI( sd, ip,
 1599|      0|                                                         cur_prep_inp_data,
 1600|      0|                                                         i, num_inp, inp_file,
 1601|      0|                                                         log_file, out_file, prb_file );
 1602|      0|            break;
 1603|      0|        }
 1604|  54.6k|    }
 1605|       |    /**************************************************************************/
 1606|       |    /*                                                                        */
 1607|       |    /*                                                                        */
 1608|       |    /*   E N D   O F   T H E    M A I N   C Y C L E   P R O C E S S I N G     */
 1609|       |    /*                                                                        */
 1610|       |    /*          C O M P O N E N T S    O N E   B Y   O N E                    */
 1611|       |    /*                                                                        */
 1612|       |    /*                                                                        */
 1613|       |    /**************************************************************************/
 1614|       |
 1615|  54.6k|exit_cycle:
 1616|  54.6k|    switch (nRet)
 1617|  54.6k|    {
 1618|      0|        case _IS_FATAL:
  ------------------
  |  |   41|      0|#define _IS_FATAL   3
  ------------------
  |  Branch (1618:9): [True: 0, False: 54.6k]
  ------------------
 1619|      0|        case _IS_ERROR:
  ------------------
  |  |   40|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (1619:9): [True: 0, False: 54.6k]
  ------------------
 1620|      0|            break;
 1621|  54.6k|        default:
  ------------------
  |  Branch (1621:9): [True: 54.6k, False: 0]
  ------------------
 1622|       |
 1623|       |        /* #ifndef COMPILE_ANSI_ONLY *//* { */
 1624|       |            /* composite results picture(s) */
 1625|  54.6k|            if (all_inp_norm_data)
  ------------------
  |  Branch (1625:17): [True: 0, False: 54.6k]
  ------------------
 1626|      0|            {
 1627|      0|                CreateCompositeNormAtom( composite_norm_data,
 1628|      0|                                         all_inp_norm_data,
 1629|      0|                                         prep_inp_data[iINChI].num_components );
 1630|       |                /*
 1631|       |                for ( i = 0; i < prep_inp_data[iINChI].num_components; i ++ ) {
 1632|       |                    for ( k = 0; k < TAUT_NUM; k ++ ) {
 1633|       |                       FreeInpAtomData( &all_inp_norm_data[i][k] );
 1634|       |                    }
 1635|       |                }
 1636|       |                inchi_free( all_inp_norm_data );
 1637|       |                all_inp_norm_data = NULL;
 1638|       |                */
 1639|      0|            }
 1640|       |            /* #endif */ /* } COMPILE_ANSI_ONLY */
 1641|       |
 1642|  54.6k|            break;
 1643|  54.6k|    }
 1644|       |
 1645|       |    /*#ifndef COMPILE_ANSI_ONLY*/ /* { */
 1646|       |
 1647|       |        /* avoid memory leaks in case of error */
 1648|  54.6k|    if (all_inp_norm_data)
  ------------------
  |  Branch (1648:9): [True: 0, False: 54.6k]
  ------------------
 1649|      0|    {
 1650|      0|        for (i = 0; i < prep_inp_data[iINChI].num_components; i++)
  ------------------
  |  Branch (1650:21): [True: 0, False: 0]
  ------------------
 1651|      0|        {
 1652|      0|            for (k = 0; k < TAUT_NUM; k++)
  ------------------
  |  |  578|      0|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1652:25): [True: 0, False: 0]
  ------------------
 1653|      0|            {
 1654|      0|                FreeInpAtomData( &all_inp_norm_data[i][k] );
 1655|      0|            }
 1656|      0|        }
 1657|      0|        inchi_free( all_inp_norm_data );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1658|      0|        all_inp_norm_data = NULL;
 1659|      0|    }
 1660|       |/*#endif */ /* } COMPILE_ANSI_ONLY */
 1661|       |
 1662|  54.6k|    FreeInpAtomData( inp_cur_data );
 1663|   163k|    for (i = 0; i < TAUT_NUM; i++)
  ------------------
  |  |  578|   163k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1663:17): [True: 109k, False: 54.6k]
  ------------------
 1664|   109k|    {
 1665|   109k|        FreeInpAtomData( inp_norm_data[i] );
 1666|   109k|    }
 1667|       |
 1668|       |
 1669|  54.6k|exit_function:
 1670|       |
 1671|  54.6k|    return nRet;
 1672|  54.6k|}
CreateOneComponentINChI:
 1693|  54.6k|{
 1694|  54.6k|    inchiTime     ulTStart, ulTEnd, *pulTEnd = NULL;
 1695|  54.6k|    int           k, num_at, ret = 0;
 1696|  54.6k|    int           bOrigCoord;
 1697|  54.6k|    INCHI_MODE     bTautFlags = ip->bTautFlags;
 1698|  54.6k|    INCHI_MODE     bTautFlagsDone = ( ip->bTautFlagsDone | sd->bTautFlagsDone[INCHI_BAS] );
  ------------------
  |  |  575|  54.6k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
 1699|  54.6k|    INChI       *cur_INChI[TAUT_NUM];
 1700|  54.6k|    INChI_Aux   *cur_INChI_Aux[TAUT_NUM];
 1701|  54.6k|    long          lElapsedTime;
 1702|       |
 1703|  54.6k|    InchiTimeGet( &ulTStart );
 1704|  54.6k|    bOrigCoord =
 1705|  54.6k|        !( ip->bINChIOutputOptions & ( INCHI_OUT_NO_AUX_INFO | INCHI_OUT_SHORT_AUX_INFO ) );
  ------------------
  |  |  157|  54.6k|#define INCHI_OUT_NO_AUX_INFO           0x0001   /* do not output Aux Info                  */
  ------------------
                      !( ip->bINChIOutputOptions & ( INCHI_OUT_NO_AUX_INFO | INCHI_OUT_SHORT_AUX_INFO ) );
  ------------------
  |  |  158|  54.6k|#define INCHI_OUT_SHORT_AUX_INFO        0x0002   /* output short version of Aux Info        */
  ------------------
 1706|       |
 1707|   163k|    for (k = 0; k < TAUT_NUM; k++)
  ------------------
  |  |  578|   163k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1707:17): [True: 109k, False: 54.6k]
  ------------------
 1708|   109k|    {
 1709|   109k|        cur_INChI[k] = NULL;
 1710|   109k|        cur_INChI_Aux[k] = NULL;
 1711|   109k|    }
 1712|       |
 1713|       |    /*  Allocate memory for non-tautomeric (k=0) and tautomeric (k=1) results */
 1714|   163k|    for (k = 0; k < TAUT_NUM; k++)
  ------------------
  |  |  578|   163k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1714:17): [True: 109k, False: 54.6k]
  ------------------
 1715|   109k|    {
 1716|   109k|        int nAllocMode = ( k == TAUT_YES ? REQ_MODE_TAUT : 0 ) |
  ------------------
  |  |  580|   109k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                      int nAllocMode = ( k == TAUT_YES ? REQ_MODE_TAUT : 0 ) |
  ------------------
  |  |   44|  54.6k|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
  |  Branch (1716:26): [True: 54.6k, False: 54.5k]
  |  Branch (1716:28): [True: 54.6k, False: 54.6k]
  ------------------
 1717|   109k|            ( bTautFlagsDone & ( TG_FLAG_FOUND_ISOTOPIC_H_DONE |
  ------------------
  |  |  978|   109k|#define TG_FLAG_FOUND_ISOTOPIC_H_DONE    0x00004000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
 1718|   109k|                TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE ) )
  ------------------
  |  |  979|   109k|#define TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE 0x00008000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
 1719|   109k|            ? ( ip->nMode & REQ_MODE_ISO ) : 0;
  ------------------
  |  |   45|  54.6k|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
 1720|       |
 1721|   109k|        if (k == TAUT_NON && ( ip->nMode & REQ_MODE_BASIC ) ||
  ------------------
  |  |  579|   218k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                      if (k == TAUT_NON && ( ip->nMode & REQ_MODE_BASIC ) ||
  ------------------
  |  |   43|  54.6k|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
  |  Branch (1721:13): [True: 54.6k, False: 54.6k]
  |  Branch (1721:30): [True: 18, False: 54.5k]
  ------------------
 1722|   109k|             k == TAUT_YES && ( ip->nMode & REQ_MODE_TAUT ))
  ------------------
  |  |  580|   218k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                           k == TAUT_YES && ( ip->nMode & REQ_MODE_TAUT ))
  ------------------
  |  |   44|  54.6k|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
  |  Branch (1722:14): [True: 54.6k, False: 54.5k]
  |  Branch (1722:31): [True: 54.6k, False: 0]
  ------------------
 1723|  54.6k|        {
 1724|       |            /*  alloc INChI and INChI_Aux */
 1725|  54.6k|            cur_INChI[k] = Alloc_INChI( inp_cur_data->at,
 1726|  54.6k|                                            inp_cur_data->num_at,
 1727|  54.6k|                                            &inp_cur_data->num_bonds,
 1728|  54.6k|                                            &inp_cur_data->num_isotopic,
 1729|  54.6k|                                            nAllocMode );
 1730|       |
 1731|  54.6k|            cur_INChI_Aux[k] = Alloc_INChI_Aux( inp_cur_data->num_at,
 1732|  54.6k|                                                inp_cur_data->num_isotopic,
 1733|  54.6k|                                                nAllocMode,
 1734|  54.6k|                                                bOrigCoord );
 1735|  54.6k|            if (cur_INChI_Aux[k])
  ------------------
  |  Branch (1735:17): [True: 54.6k, False: 0]
  ------------------
 1736|  54.6k|            {
 1737|  54.6k|                cur_INChI_Aux[k]->bIsIsotopic = inp_cur_data->num_isotopic;
 1738|  54.6k|            }
 1739|       |            /*  alloc memory for the output structure: non-tautomeric and tautomeric (for displaying) */
 1740|       |
 1741|  54.6k|            CreateInpAtomData( inp_norm_data[k], inp_cur_data->num_at, k );
 1742|  54.6k|        }
 1743|  54.5k|        else
 1744|  54.5k|        {
 1745|  54.5k|            FreeInpAtomData( inp_norm_data[k] );
 1746|  54.5k|        }
 1747|   109k|    }
 1748|       |
 1749|  54.6k|    lElapsedTime = InchiTimeElapsed( ic, &ulTStart );
 1750|  54.6k|    if (ip->msec_MaxTime)
  ------------------
  |  Branch (1750:9): [True: 0, False: 54.6k]
  ------------------
 1751|      0|    {
 1752|      0|        ip->msec_LeftTime -= lElapsedTime;
 1753|      0|    }
 1754|  54.6k|    sd->ulStructTime += lElapsedTime;
 1755|       |
 1756|       |    /*^^^#if ( !defined( TARGET_LIB_FOR_WINCHI ) && !defined( TARGET_API_LIB ) ) */
 1757|       |    #if ( !defined( TARGET_LIB_FOR_WINCHI ) && !defined( TARGET_API_LIB ) && !defined(TARGET_EXE_STANDALONE) )
 1758|       |    #endif
 1759|       |
 1760|       |    /******************************************************
 1761|       |     *
 1762|       |     *  Get one component canonical numberings, etc.
 1763|       |     *
 1764|       |     ******************************************************/
 1765|       |
 1766|       |    /* Create_INChI() return value:
 1767|       |     * num_at <= 0: error code
 1768|       |     * num_at >  0: number of atoms (excluding terminal hydrogen atoms)
 1769|       |     * inp_norm_data[0] => non-tautomeric, inp_norm_data[1] => tautomeric */
 1770|       |
 1771|  54.6k|    InchiTimeGet( &ulTStart );
 1772|       |
 1773|  54.6k|    if (ip->msec_MaxTime)
  ------------------
  |  Branch (1773:9): [True: 0, False: 54.6k]
  ------------------
 1774|      0|    {
 1775|      0|        ulTEnd = ulTStart;
 1776|      0|        pulTEnd = &ulTEnd;
 1777|      0|        if (ip->msec_LeftTime > 0)
  ------------------
  |  Branch (1777:13): [True: 0, False: 0]
  ------------------
 1778|      0|        {
 1779|      0|            InchiTimeAddMsec( ic, pulTEnd, ip->msec_LeftTime );
 1780|      0|        }
 1781|      0|    }
 1782|       |
 1783|  54.6k|    num_at = Create_INChI( pCG, ic, ip,
 1784|  54.6k|                           cur_INChI, cur_INChI_Aux,
 1785|  54.6k|                           orig_inp_data/* not used */,
 1786|  54.6k|                           inp_cur_data->at, inp_norm_data, inp_cur_data->num_at,
 1787|  54.6k|                           ip->nMode,
 1788|  54.6k|                           &bTautFlags, &bTautFlagsDone,
 1789|  54.6k|                           pulTEnd, NULL, sd->pStrErrStruct );
 1790|       |
 1791|  54.6k|    SetConnectedComponentNumber( inp_cur_data->at, inp_cur_data->num_at, i + 1 );
 1792|       |                        /*  NB: normalization alters structure component number */
 1793|       |
 1794|   163k|    for (k = 0; k < TAUT_NUM; k++)
  ------------------
  |  |  578|   163k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1794:17): [True: 109k, False: 54.6k]
  ------------------
 1795|   109k|    {
 1796|   109k|        if (cur_INChI_Aux[k] && cur_INChI_Aux[k]->nNumberOfAtoms > 0)
  ------------------
  |  Branch (1796:13): [True: 54.6k, False: 54.5k]
  |  Branch (1796:33): [True: 54.6k, False: 16]
  ------------------
 1797|  54.6k|        {
 1798|  54.6k|            pncFlags->bNormalizationFlags[iINChI][k] |=
 1799|  54.6k|                cur_INChI_Aux[k]->bNormalizationFlags;
 1800|  54.6k|            pncFlags->bTautFlags[iINChI][k] |=
 1801|  54.6k|                cur_INChI_Aux[k]->bTautFlags;
 1802|  54.6k|            pncFlags->bTautFlagsDone[iINChI][k] |=
 1803|  54.6k|                cur_INChI_Aux[k]->bTautFlagsDone;
 1804|  54.6k|            pncFlags->nCanonFlags[iINChI][k] |=
 1805|  54.6k|                cur_INChI_Aux[k]->nCanonFlags;
 1806|  54.6k|        }
 1807|   109k|    }
 1808|       |
 1809|       |    /*  Detect errors */
 1810|  54.6k|    if (num_at < 0)
  ------------------
  |  Branch (1810:9): [True: 0, False: 54.6k]
  ------------------
 1811|      0|    {
 1812|      0|        sd->nErrorCode = num_at;
 1813|      0|    }
 1814|  54.6k|    else if (num_at == 0)
  ------------------
  |  Branch (1814:14): [True: 0, False: 54.6k]
  ------------------
 1815|      0|    {
 1816|      0|        sd->nErrorCode = -1;
 1817|      0|    }
 1818|  54.6k|    else if (cur_INChI[TAUT_NON] && cur_INChI[TAUT_NON]->nErrorCode)
  ------------------
  |  |  579|  54.6k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                  else if (cur_INChI[TAUT_NON] && cur_INChI[TAUT_NON]->nErrorCode)
  ------------------
  |  |  579|     18|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1818:14): [True: 18, False: 54.5k]
  |  Branch (1818:37): [True: 0, False: 18]
  ------------------
 1819|      0|    {   /*  non-tautomeric error */
 1820|      0|        sd->nErrorCode = cur_INChI[TAUT_NON]->nErrorCode;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
 1821|      0|    }
 1822|  54.6k|    else if (cur_INChI[TAUT_YES] && cur_INChI[TAUT_YES]->nErrorCode)
  ------------------
  |  |  580|  54.6k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                  else if (cur_INChI[TAUT_YES] && cur_INChI[TAUT_YES]->nErrorCode)
  ------------------
  |  |  580|  54.6k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1822:14): [True: 54.6k, False: 0]
  |  Branch (1822:37): [True: 0, False: 54.6k]
  ------------------
 1823|      0|    {   /*  tautomeric error */
 1824|      0|        sd->nErrorCode = cur_INChI[TAUT_YES]->nErrorCode;
  ------------------
  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
 1825|      0|    }
 1826|       |
 1827|       |
 1828|       |#if ( bRELEASE_VERSION == 0 )
 1829|       |    if (cur_INChI[TAUT_NON]) sd->bExtract |= cur_INChI[TAUT_NON]->bExtract;
 1830|       |    if (cur_INChI[TAUT_YES]) sd->bExtract |= cur_INChI[TAUT_YES]->bExtract;
 1831|       |    if (( TG_FLAG_TEST_TAUT3_SALTS_DONE & bTautFlagsDone ))
 1832|       |    {
 1833|       |        sd->bExtract |= EXTR_TEST_TAUT3_SALTS_DONE;
 1834|       |    }
 1835|       |#endif
 1836|       |
 1837|       |    /*  Detect and store stereo warnings */
 1838|  54.6k|    if (!sd->nErrorCode)
  ------------------
  |  Branch (1838:9): [True: 54.6k, False: 0]
  ------------------
 1839|  54.6k|        GetProcessingWarningsOneComponentInChI( cur_INChI, inp_norm_data, sd, ip->bNoWarnings );
 1840|       |
 1841|  54.6k|    lElapsedTime = InchiTimeElapsed( ic, &ulTStart );
 1842|  54.6k|    if (ip->msec_MaxTime)
  ------------------
  |  Branch (1842:9): [True: 0, False: 54.6k]
  ------------------
 1843|      0|    {
 1844|      0|        ip->msec_LeftTime -= lElapsedTime;
 1845|      0|    }
 1846|  54.6k|    sd->ulStructTime += lElapsedTime;
 1847|       |
 1848|       |#if !defined(TARGET_API_LIB) && !defined(COMPILE_ANSI_ONLY)
 1849|       |    /*  Display the results */
 1850|       |    if (ip->bDisplay)
 1851|       |    {
 1852|       |        eat_keyboard_input( );
 1853|       |    }
 1854|       |#endif
 1855|       |
 1856|       |    /*  a) No matter what happened save the allocated INChI pointers */
 1857|       |    /*  save the INChI of the current component */
 1858|       |
 1859|  54.6k|    InchiTimeGet( &ulTStart );
 1860|   163k|    for (k = 0; k < TAUT_NUM; k++)
  ------------------
  |  |  578|   163k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1860:17): [True: 109k, False: 54.6k]
  ------------------
 1861|   109k|    {
 1862|   109k|        pINChI[i][k] = cur_INChI[k];
 1863|   109k|        pINChI_Aux[i][k] = cur_INChI_Aux[k];
 1864|   109k|        cur_INChI[k] = NULL;
 1865|   109k|        cur_INChI_Aux[k] = NULL;
 1866|   109k|    }
 1867|       |
 1868|       |    /*  b) Count one component structure and/or INChI results only
 1869|       |           if there was no error
 1870|       |           Set inp_norm_data[j]->num_removed_H = number of removed explicit H
 1871|       |    */
 1872|       |
 1873|  54.6k|    if (!sd->nErrorCode)
  ------------------
  |  Branch (1873:9): [True: 54.6k, False: 0]
  ------------------
 1874|  54.6k|    {
 1875|       |        /*  find where the current processed structure is located */
 1876|  54.6k|        int cur_is_in_non_taut = ( pINChI[i][TAUT_NON] &&
  ------------------
  |  |  579|  54.6k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1876:36): [True: 18, False: 54.5k]
  ------------------
 1877|  54.6k|                                   pINChI[i][TAUT_NON]->nNumberOfAtoms > 0 );
  ------------------
  |  |  579|     18|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1877:36): [True: 2, False: 16]
  ------------------
 1878|  54.6k|        int cur_is_in_taut = ( pINChI[i][TAUT_YES] &&
  ------------------
  |  |  580|  54.6k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1878:32): [True: 54.6k, False: 0]
  ------------------
 1879|  54.6k|                                   pINChI[i][TAUT_YES]->nNumberOfAtoms > 0 );
  ------------------
  |  |  580|  54.6k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1879:36): [True: 54.6k, False: 0]
  ------------------
 1880|       |
 1881|  54.6k|        int cur_is_non_taut = cur_is_in_non_taut && 0 == pINChI[i][TAUT_NON]->lenTautomer ||
  ------------------
  |  |  579|      2|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1881:31): [True: 2, False: 54.6k]
  |  Branch (1881:53): [True: 2, False: 0]
  ------------------
 1882|  54.6k|            cur_is_in_taut && 0 == pINChI[i][TAUT_YES]->lenTautomer;
  ------------------
  |  |  580|  54.6k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1882:13): [True: 54.6k, False: 0]
  |  Branch (1882:31): [True: 54.6k, False: 1]
  ------------------
 1883|  54.6k|        int cur_is_taut = cur_is_in_taut && 0 < pINChI[i][TAUT_YES]->lenTautomer;
  ------------------
  |  |  580|  54.6k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1883:27): [True: 54.6k, False: 0]
  |  Branch (1883:45): [True: 3, False: 54.6k]
  ------------------
 1884|       |
 1885|       |        /*
 1886|       |        sd->bTautFlags[iINChI]     |= bTautFlags;
 1887|       |        sd->bTautFlagsDone[iINChI] |= bTautFlagsDone;
 1888|       |        */
 1889|       |
 1890|  54.6k|        if (cur_is_non_taut + cur_is_taut)
  ------------------
  |  Branch (1890:13): [True: 54.6k, False: 0]
  ------------------
 1891|  54.6k|        {
 1892|       |            /*  count tautomeric and non-tautomeric components of the structures */
 1893|  54.6k|            int j1 = cur_is_in_non_taut ? TAUT_NON : TAUT_YES;
  ------------------
  |  |  579|      2|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
                          int j1 = cur_is_in_non_taut ? TAUT_NON : TAUT_YES;
  ------------------
  |  |  580|  54.6k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1893:22): [True: 2, False: 54.6k]
  ------------------
 1894|  54.6k|            int j2 = cur_is_in_taut ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  580|  54.6k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
                          int j2 = cur_is_in_taut ? TAUT_YES : TAUT_NON;
  ------------------
  |  |  579|      0|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (1894:22): [True: 54.6k, False: 0]
  ------------------
 1895|  54.6k|            int j;
 1896|  54.6k|            sd->num_non_taut[iINChI] += cur_is_non_taut;
 1897|  54.6k|            sd->num_taut[iINChI] += cur_is_taut;
 1898|   109k|            for (j = j1; j <= j2; j++)
  ------------------
  |  Branch (1898:26): [True: 54.6k, False: 54.6k]
  ------------------
 1899|  54.6k|            {
 1900|  54.6k|                int bIsotopic = ( pINChI[i][j]->nNumberOfIsotopicAtoms ||
  ------------------
  |  Branch (1900:35): [True: 16, False: 54.5k]
  ------------------
 1901|  54.6k|                                  pINChI[i][j]->nNumberOfIsotopicTGroups ||
  ------------------
  |  Branch (1901:35): [True: 0, False: 54.5k]
  ------------------
 1902|  54.6k|                                  pINChI[i][j]->nPossibleLocationsOfIsotopicH && pINChI[i][j]->nPossibleLocationsOfIsotopicH[0] > 1 );
  ------------------
  |  Branch (1902:35): [True: 54.5k, False: 1]
  |  Branch (1902:82): [True: 0, False: 54.5k]
  ------------------
 1903|  54.6k|                if (j == TAUT_YES)
  ------------------
  |  |  580|  54.6k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (1903:21): [True: 54.6k, False: 2]
  ------------------
 1904|  54.6k|                {
 1905|  54.6k|                    bIsotopic |= ( 0 < pINChI_Aux[i][j]->nNumRemovedIsotopicH[0] +
 1906|  54.6k|                                      pINChI_Aux[i][j]->nNumRemovedIsotopicH[1] +
 1907|  54.6k|                                      pINChI_Aux[i][j]->nNumRemovedIsotopicH[2] );
 1908|  54.6k|                }
 1909|       |
 1910|  54.6k|                inp_norm_data[j]->bExists = 1; /*  j=0: non-taut exists, j=1: taut exists */
 1911|  54.6k|                inp_norm_data[j]->bHasIsotopicLayer = bIsotopic;
 1912|       |                /*inp_norm_data[j]->num_removed_H = inp_norm_data[j]->num_at - num_at;*/
 1913|  54.6k|            }
 1914|  54.6k|        }
 1915|  54.6k|    }
 1916|       |
 1917|       |    /* return (sd->nErrorCode==CT_OUT_OF_RAM || sd->nErrorCode==CT_USER_QUIT_ERR)? _IS_FATAL :
 1918|       |            sd->nErrorCode? _IS_ERROR : 0; */
 1919|       |
 1920|  54.6k|    if (sd->nErrorCode == CT_OUT_OF_RAM || sd->nErrorCode == CT_USER_QUIT_ERR)
  ------------------
  |  |   49|   109k|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   46|  54.6k|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
                  if (sd->nErrorCode == CT_OUT_OF_RAM || sd->nErrorCode == CT_USER_QUIT_ERR)
  ------------------
  |  |   60|  54.6k|#define CT_USER_QUIT_ERR     (CT_ERR_FIRST-13)  /*(-30013) */
  |  |  ------------------
  |  |  |  |   46|  54.6k|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (1920:9): [True: 0, False: 54.6k]
  |  Branch (1920:44): [True: 0, False: 54.6k]
  ------------------
 1921|      0|    {
 1922|      0|        ret = _IS_FATAL;
  ------------------
  |  |   41|      0|#define _IS_FATAL   3
  ------------------
 1923|      0|    }
 1924|  54.6k|    else if (sd->nErrorCode)
  ------------------
  |  Branch (1924:14): [True: 0, False: 54.6k]
  ------------------
 1925|      0|    {
 1926|      0|        ret = _IS_ERROR;
  ------------------
  |  |   40|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
 1927|      0|    }
 1928|       |
 1929|  54.6k|    lElapsedTime = InchiTimeElapsed( ic, &ulTStart );
 1930|  54.6k|    if (ip->msec_MaxTime)
  ------------------
  |  Branch (1930:9): [True: 0, False: 54.6k]
  ------------------
 1931|      0|    {
 1932|      0|        ip->msec_LeftTime -= lElapsedTime;
 1933|      0|    }
 1934|  54.6k|    sd->ulStructTime += lElapsedTime;
 1935|       |
 1936|  54.6k|    return ret;
 1937|  54.6k|}
runichi.c:DoOneStructureEarlyPreprocessing:
  487|  54.6k|{
  488|       |
  489|       |#if ( RING2CHAIN == 1 || UNDERIVATIZE == 1 )
  490|       |    int ret1 = 0, ret2 = 0, nRet = 0;
  491|       |#endif
  492|       |
  493|       |#if ( REMOVE_ION_PAIRS_ORIG_STRU == 1 )
  494|       |    fix_odd_things( orig_inp_data->num_inp_atoms, orig_inp_data->at, 0, ip->bFixNonUniformDraw );
  495|       |#endif
  496|       |
  497|       |#if ( UNDERIVATIZE == 1 )
  498|       |    if (ip->bUnderivatize)
  499|       |    {
  500|       |        if (0 > ( ret2 = OAD_Edit_Underivatize( ic, pCG, orig_inp_data, ( ip->bINChIOutputOptions & INCHI_OUT_SDFILE_ONLY ), ip->bUnderivatize & 2, ip->pSdfValue ) ))
  501|       |        {
  502|       |            long num_inp2 = num_inp;
  503|       |            AddErrorMessage( sd->pStrErrStruct, "Underivatization error" );
  504|       |            sd->nStructReadError = 99;
  505|       |            sd->nErrorType = _IS_ERROR;
  506|       |            TreatErrorsInReadTheStructure( sd, ip, LOG_MASK_ALL, inp_file, log_file, out_file, prb_file,
  507|       |                                        prep_inp_data, &num_inp2 );
  508|       |            return _IS_ERROR; /* output only if derivatives found */
  509|       |        }
  510|       |        else if (0 < ret2)
  511|       |        {
  512|       |            if (!ip->bNoWarnings)
  513|       |            {
  514|       |                WarningMessage( sd->pStrErrStruct, "Input structure underivatized" );
  515|       |            }
  516|       |        }
  517|       |    }
  518|       |#endif /* UNDERIVATIZE == 1 */
  519|       |
  520|       |#if ( RING2CHAIN == 1 )
  521|       |    if (ip->bRing2Chain && 0 > ( ret1 = Ring2Chain( ic, pCG, orig_inp_data ) ))
  522|       |    {
  523|       |        long num_inp2 = num_inp;
  524|       |        AddErrorMessage( sd->pStrErrStruct, "Ring to chain error" );
  525|       |        sd->nStructReadError = 99;
  526|       |        sd->nErrorType = _IS_ERROR;
  527|       |        nRet = _IS_ERROR;
  528|       |        TreatErrorsInReadTheStructure( sd, ip, LOG_MASK_ALL,
  529|       |                                       inp_file, log_file,
  530|       |                                       out_file, prb_file,
  531|       |                                       prep_inp_data, &num_inp2 );
  532|       |        return _IS_ERROR; /* output only if derivatives found */
  533|       |    }
  534|       |#endif /* RING2CHAIN == 1 */
  535|       |#if ( RING2CHAIN == 1 || UNDERIVATIZE == 1 )  /***** post v.1 feature *****/
  536|       |    if (ip->bIgnoreUnchanged && !ret1 && !ret2)
  537|       |    {
  538|       |        return _IS_SKIP; /* output only if derivatives or ring/chain found */
  539|       |    }
  540|       |#endif /* RING2CHAIN == 1 || UNDERIVATIZE == 1 */
  541|  54.6k|    return 0;
  542|  54.6k|}
runichi.c:OrigAtData_StoreNativeInput:
  583|  54.6k|{
  584|       |
  585|       |    /*    v. 1.05 always create and fill OrigStruc as it may be used to store e.g. polymer info    */
  586|       |    /*    If normal AuxInfo is requested, create full reversibility information from native inp data
  587|       |    if ( ip->bINChIOutputOptions & (INCHI_OUT_NO_AUX_INFO | INCHI_OUT_SHORT_AUX_INFO))
  588|       |        return NULL; */
  589|       |
  590|  54.6k|    if (OrigStruct_FillOut( pCG, orig_inp_data, pOrigStruct, sd ))
  ------------------
  |  Branch (590:9): [True: 0, False: 54.6k]
  ------------------
  591|      0|    {
  592|      0|        AddErrorMessage( sd->pStrErrStruct, "Cannot interpret reversibility information" );
  593|      0|        sd->nStructReadError = 99;
  594|      0|        sd->nErrorType = _IS_ERROR;
  ------------------
  |  |   40|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  595|      0|        *nRet = _IS_ERROR;
  ------------------
  |  |   40|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  596|      0|    }
  597|       |
  598|  54.6k|    return pOrigStruct;
  599|  54.6k|}
runichi.c:PrepareSaveOptBits:
  606|  54.6k|{
  607|  54.6k|    if (ip->nInputType != INPUT_INCHI)
  ------------------
  |  Branch (607:9): [True: 0, False: 54.6k]
  ------------------
  608|      0|    {
  609|      0|        *save_opt_bits = 0;
  610|      0|        if (ip->bINChIOutputOptions & INCHI_OUT_SAVEOPT)
  ------------------
  |  |  174|      0|#define INCHI_OUT_SAVEOPT  0x8000
  ------------------
  |  Branch (610:13): [True: 0, False: 0]
  ------------------
  611|      0|        {
  612|      0|            if (0 != ( ip->bTautFlags & TG_FLAG_RECONNECT_COORD ))
  ------------------
  |  |  935|      0|#define TG_FLAG_RECONNECT_COORD          0x00000100   /* reconnect disconnected "coord. centers" */
  ------------------
  |  Branch (612:17): [True: 0, False: 0]
  ------------------
  613|      0|            {
  614|      0|                ( *save_opt_bits ) |= SAVE_OPT_RECMET;
  ------------------
  |  |  186|      0|#define SAVE_OPT_RECMET 0x0008
  ------------------
  615|      0|            }
  616|      0|            if (0 != ( ip->nMode & REQ_MODE_BASIC ))
  ------------------
  |  |   43|      0|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
  |  Branch (616:17): [True: 0, False: 0]
  ------------------
  617|      0|            {
  618|      0|                ( *save_opt_bits ) |= SAVE_OPT_FIXEDH;
  ------------------
  |  |  185|      0|#define SAVE_OPT_FIXEDH 0x0004
  ------------------
  619|      0|            }
  620|      0|            if (0 != ( ip->nMode & REQ_MODE_DIFF_UU_STEREO ))
  ------------------
  |  |   68|      0|#define REQ_MODE_DIFF_UU_STEREO     0x004000    /* SLUUD Make labels for unknown and undefined stereo different */
  ------------------
  |  Branch (620:17): [True: 0, False: 0]
  ------------------
  621|      0|            {
  622|      0|                ( *save_opt_bits ) |= SAVE_OPT_SLUUD;
  ------------------
  |  |  183|      0|#define SAVE_OPT_SLUUD  0x0001
  ------------------
  623|      0|            }
  624|      0|            if (0 == ( ip->nMode & ( REQ_MODE_SB_IGN_ALL_UU | REQ_MODE_SC_IGN_ALL_UU ) ))
  ------------------
  |  |   60|      0|#define REQ_MODE_SB_IGN_ALL_UU      0x001000    /* IAUSC Ignore stereobonds if All Undef/Unknown */
  ------------------
                          if (0 == ( ip->nMode & ( REQ_MODE_SB_IGN_ALL_UU | REQ_MODE_SC_IGN_ALL_UU ) ))
  ------------------
  |  |   58|      0|#define REQ_MODE_SC_IGN_ALL_UU      0x000800    /* IAUSC Ignore stereocenters if All Undef/Unknown */
  ------------------
  |  Branch (624:17): [True: 0, False: 0]
  ------------------
  625|      0|            {
  626|      0|                ( *save_opt_bits ) |= SAVE_OPT_SUU;
  ------------------
  |  |  184|      0|#define SAVE_OPT_SUU    0x0002
  ------------------
  627|      0|            }
  628|      0|            if (0 != ( ip->bTautFlags & TG_FLAG_KETO_ENOL_TAUT ))
  ------------------
  |  |  949|      0|#define TG_FLAG_KETO_ENOL_TAUT           0x00080000   /* turn on keto-enol tautomerism detection */
  ------------------
  |  Branch (628:17): [True: 0, False: 0]
  ------------------
  629|      0|            {
  630|      0|                ( *save_opt_bits ) |= SAVE_OPT_KET;
  ------------------
  |  |  187|      0|#define SAVE_OPT_KET    0x0010
  ------------------
  631|      0|            }
  632|      0|            if (0 != ( ip->bTautFlags & TG_FLAG_1_5_TAUT ))
  ------------------
  |  |  950|      0|#define TG_FLAG_1_5_TAUT                 0x00100000   /* turn on 1,5 tautomerism detection */
  ------------------
  |  Branch (632:17): [True: 0, False: 0]
  ------------------
  633|      0|            {
  634|      0|                ( *save_opt_bits ) |= SAVE_OPT_15T;
  ------------------
  |  |  188|      0|#define SAVE_OPT_15T    0x0020
  ------------------
  635|      0|            }
  636|       |            /* Check if /SNon requested and turn OFF stereo bits if so */
  637|      0|            if (!( ip->nMode & REQ_MODE_STEREO ))
  ------------------
  |  |   47|      0|#define REQ_MODE_STEREO             0x000010    /* S    */
  ------------------
  |  Branch (637:17): [True: 0, False: 0]
  ------------------
  638|      0|            {
  639|      0|                ( *save_opt_bits ) &= ~SAVE_OPT_SUU;
  ------------------
  |  |  184|      0|#define SAVE_OPT_SUU    0x0002
  ------------------
  640|      0|                ( *save_opt_bits ) &= ~SAVE_OPT_SLUUD;
  ------------------
  |  |  183|      0|#define SAVE_OPT_SLUUD  0x0001
  ------------------
  641|      0|            }
  642|      0|        }
  643|      0|    }
  644|  54.6k|}
runichi.c:DisplayOrigAndResultStructuresAndComponents:
  666|  54.6k|{
  667|       |
  668|       |
  669|  54.6k|    if (ip->bDisplay)    ip->bDisplayCompositeResults = 1;    /* v. 1.05 */
  ------------------
  |  Branch (669:9): [True: 0, False: 54.6k]
  ------------------
  670|       |
  671|       |#ifndef COMPILE_ANSI_ONLY /* { */
  672|       |
  673|       |    /* Display equivalent components on original or preprocessed structure(s) */
  674|       |#ifndef TARGET_LIB_FOR_WINCHI
  675|       |    if (nRet != _IS_FATAL && nRet != _IS_ERROR && /*ip->bDisplay &&*/
  676|       |        ( ip->bCompareComponents & CMP_COMPONENTS ) && !sd->bUserQuit && !sd->bUserQuitComponent)
  677|       |    {
  678|       |        int j, ret, ord;
  679|       |        int bDisplaySaved = ip->bDisplay;
  680|       |        ORIG_ATOM_DATA *inp_data;
  681|       |        AT_NUMB         nEquSet;
  682|       |        for (ord = -1; ord < INCHI_NUM; ord++)
  683|       |        {
  684|       |            switch (ord)
  685|       |            {
  686|       |                case -1:
  687|       |                    j = INCHI_BAS;  /* preprocessed non-tautomeric */
  688|       |                    break;
  689|       |                case 0:
  690|       |                    j = INCHI_REC;  /* preprocessed tautomeric */
  691|       |                    break;
  692|       |                case 1:
  693|       |                    j = -1;        /* original input */
  694|       |                    break;
  695|       |                default:
  696|       |                    continue;
  697|       |            }
  698|       |            inp_data = j < 0 ? orig_inp_data : prep_inp_data + j;
  699|       |            if (inp_data && inp_data->num_inp_atoms && inp_data->at &&
  700|       |                 inp_data->nEquLabels &&
  701|       |                 inp_data->nNumEquSets)
  702|       |            {
  703|       |                for (nEquSet = 1; nEquSet <= inp_data->nNumEquSets; nEquSet++)
  704|       |                {
  705|       |                    ip->dp.nEquLabels = inp_data->nEquLabels;
  706|       |                    ip->dp.nCurEquLabel = nEquSet;
  707|       |                    ip->dp.nNumEquSets = inp_data->nNumEquSets;
  708|       |                    ip->bDisplay = 1; /* force display if it was not requested */
  709|       |                    ret = DisplayTheWholeStructure( pCG, ic, sd, ip, szTitle,
  710|       |                                                    inp_file, log_file, inp_data,
  711|       |                                                    num_inp, j, 1 /*bShowStructure*/, 0 );
  712|       |                    ip->dp.nEquLabels = NULL;
  713|       |                    ip->dp.nCurEquLabel = 0;
  714|       |                    ip->dp.nNumEquSets = 0;
  715|       |                    ip->bDisplay = bDisplaySaved; /* restore display option */
  716|       |                    if (ret)
  717|       |                    {
  718|       |            /* user pressed Esc */
  719|       |                        goto exit_loop;
  720|       |                    }
  721|       |                }
  722|       |            }
  723|       |        }
  724|       |    exit_loop:;
  725|       |    }
  726|       |#endif
  727|       |
  728|       |    /* Display composite results and equivalent components on composite results */
  729|       |    if (nRet != _IS_FATAL && nRet != _IS_ERROR && /*ip->bDisplay &&*/ ip->bDisplayCompositeResults)
  730|       |    {
  731|       |        int iINChI;
  732|       |        for (iINChI = 0; iINChI < maxINChI && !sd->bUserQuitComponentDisplay; iINChI++)
  733|       |        {
  734|       |            DisplayTheWholeCompositeStructure( pCG, ic, ip, sd, num_inp,
  735|       |                                               iINChI, pINChI[iINChI], pINChI_Aux[iINChI],
  736|       |                                               orig_inp_data, prep_inp_data, composite_norm_data[iINChI] );
  737|       |        }
  738|       |#ifndef TARGET_LIB_FOR_WINCHI
  739|       |        if (!ip->bDisplay && sd->bUserQuitComponentDisplay)
  740|       |        {
  741|       |            sd->bUserQuit = 1;
  742|       |        }
  743|       |#endif
  744|       |    }
  745|       |
  746|       |#endif /* } COMPILE_ANSI_ONLY */
  747|       |
  748|  54.6k|    return;
  749|  54.6k|}
runichi.c:SaveOkProcessedMolfile:
  761|  54.6k|{
  762|  54.6k|    if (ip->bSaveAllGoodStructsAsProblem &&
  ------------------
  |  Branch (762:9): [True: 0, False: 54.6k]
  ------------------
  763|  54.6k|         nRet != _IS_FATAL                &&
  ------------------
  |  |   41|  54.6k|#define _IS_FATAL   3
  ------------------
  |  Branch (763:10): [True: 0, False: 0]
  ------------------
  764|  54.6k|         nRet != _IS_ERROR                &&
  ------------------
  |  |   40|  54.6k|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (764:10): [True: 0, False: 0]
  ------------------
  765|  54.6k|         prb_file                         &&
  ------------------
  |  Branch (765:10): [True: 0, False: 0]
  ------------------
  766|  54.6k|         prb_file->f &&
  ------------------
  |  Branch (766:10): [True: 0, False: 0]
  ------------------
  767|  54.6k|         0L <= sd->fPtrStart              &&
  ------------------
  |  Branch (767:10): [True: 0, False: 0]
  ------------------
  768|  54.6k|         sd->fPtrStart < sd->fPtrEnd)
  ------------------
  |  Branch (768:10): [True: 0, False: 0]
  ------------------
  769|      0|    {
  770|      0|        MolfileSaveCopy( inp_file, sd->fPtrStart, sd->fPtrEnd, prb_file->f, 0 );
  771|      0|    }
  772|       |
  773|  54.6k|    return;
  774|  54.6k|}

GetOneComponent:
  346|  54.6k|{
  347|  54.6k|    inchiTime ulTStart;
  348|       |
  349|  54.6k|    InchiTimeGet( &ulTStart );
  350|       |
  351|  54.6k|    CreateInpAtomData( inp_cur_data, orig_inp_data->nCurAtLen[i], 0 );
  352|       |
  353|  54.6k|    inp_cur_data->num_at = ExtractConnectedComponent( orig_inp_data->at, orig_inp_data->num_inp_atoms, i + 1, inp_cur_data->at );
  354|       |
  355|  54.6k|    sd->ulStructTime += InchiTimeElapsed( ic, &ulTStart );
  356|       |
  357|       |
  358|       |    /*  Error processing */
  359|  54.6k|    if (inp_cur_data->num_at <= 0 || orig_inp_data->nCurAtLen[i] != inp_cur_data->num_at)
  ------------------
  |  Branch (359:9): [True: 0, False: 54.6k]
  |  Branch (359:38): [True: 0, False: 54.6k]
  ------------------
  360|      0|    {
  361|       |        /*  Log error message */
  362|      0|        AddErrorMessage( sd->pStrErrStruct, "Cannot extract Component" );
  363|      0|        inchi_ios_eprint( log_file, "%s #%d structure #%ld.%s%s%s%s\n", sd->pStrErrStruct, i + 1, num_inp, SDF_LBL_VAL( ip->pSdfLabel, ip->pSdfValue ) );
  ------------------
  |  |  410|      0|#define SDF_LBL_VAL(L,V)  ((L)&&(L)[0])?gsSpace:gsEmpty, ((L)&&(L)[0])?L:gsEmpty, ((L)&&(L)[0])? (((V)&&(V)[0])?gsEqual:gsSpace):gsEmpty, ((V)&&(V)[0])?V:((L)&&(L)[0])?gsMissing:gsEmpty
  |  |  ------------------
  |  |  |  Branch (410:28): [True: 0, False: 0]
  |  |  |  Branch (410:33): [True: 0, False: 0]
  |  |  |  Branch (410:59): [True: 0, False: 0]
  |  |  |  Branch (410:64): [True: 0, False: 0]
  |  |  |  Branch (410:84): [True: 0, False: 0]
  |  |  |  Branch (410:89): [True: 0, False: 0]
  |  |  |  Branch (410:100): [True: 0, False: 0]
  |  |  |  Branch (410:105): [True: 0, False: 0]
  |  |  |  Branch (410:140): [True: 0, False: 0]
  |  |  |  Branch (410:145): [True: 0, False: 0]
  |  |  |  Branch (410:156): [True: 0, False: 0]
  |  |  |  Branch (410:161): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  364|      0|        sd->nErrorCode = inp_cur_data->num_at < 0 ? inp_cur_data->num_at : ( orig_inp_data->nCurAtLen[i] != inp_cur_data->num_at ) ? CT_ATOMCOUNT_ERR : CT_UNKNOWN_ERR;
  ------------------
  |  |   58|      0|#define CT_ATOMCOUNT_ERR     (CT_ERR_FIRST-11)  /*(-30011) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
                      sd->nErrorCode = inp_cur_data->num_at < 0 ? inp_cur_data->num_at : ( orig_inp_data->nCurAtLen[i] != inp_cur_data->num_at ) ? CT_ATOMCOUNT_ERR : CT_UNKNOWN_ERR;
  ------------------
  |  |   66|      0|#define CT_UNKNOWN_ERR       (CT_ERR_FIRST-19)  /*(-30019) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  |  Branch (364:26): [True: 0, False: 0]
  |  Branch (364:76): [True: 0, False: 0]
  ------------------
  365|       |        /* num_err ++; */
  366|      0|        sd->nErrorType = _IS_ERROR;
  ------------------
  |  |   40|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  367|       |#ifdef TARGET_LIB_FOR_WINCHI
  368|       |        if (( ip->bINChIOutputOptions & INCHI_OUT_WINCHI_WINDOW ) &&
  369|       |            ( ip->bINChIOutputOptions & INCHI_OUT_PLAIN_TEXT ))
  370|       |        {
  371|       |            sd->nErrorType = ProcessStructError( out_file,
  372|       |                                                 log_file,
  373|       |                                                 sd->pStrErrStruct,
  374|       |                                                 sd->nErrorType,
  375|       |                                                 num_inp,
  376|       |                                                 ip );
  377|       |        }
  378|       |#endif
  379|      0|    }
  380|       |
  381|  54.6k|    return sd->nErrorType;
  382|  54.6k|}

OrigAtData_Duplicate:
  144|  54.6k|{
  145|  54.6k|    inp_ATOM  *at = NULL;
  146|  54.6k|    AT_NUMB   *nCurAtLen = NULL;
  147|  54.6k|    AT_NUMB   *nOldCompNumber = NULL;
  148|  54.6k|    int k, m, nn;
  149|  54.6k|    int orig_nat = orig_atom->num_inp_atoms;
  150|       |
  151|  54.6k|    int ret = -1; /* fail; 0 - OK */
  152|       |
  153|  54.6k|    if (new_orig_atom->at &&
  ------------------
  |  Branch (153:9): [True: 0, False: 54.6k]
  ------------------
  154|  54.6k|         new_orig_atom->num_inp_atoms >= orig_nat)
  ------------------
  |  Branch (154:10): [True: 0, False: 0]
  ------------------
  155|      0|    {
  156|      0|        at = new_orig_atom->at;
  157|      0|    }
  158|  54.6k|    else
  159|  54.6k|    {
  160|  54.6k|        at = (inp_ATOM *) inchi_calloc( orig_nat + 1, sizeof( at[0] ) );
  ------------------
  |  | 1133|  54.6k|#define inchi_calloc   calloc
  ------------------
  161|  54.6k|        if (!at)
  ------------------
  |  Branch (161:13): [True: 0, False: 54.6k]
  ------------------
  162|      0|        {
  163|      0|            goto exit_function;
  164|      0|        }
  165|  54.6k|    }
  166|       |
  167|  54.6k|    if (new_orig_atom->nOldCompNumber &&
  ------------------
  |  Branch (167:9): [True: 0, False: 54.6k]
  ------------------
  168|  54.6k|         new_orig_atom->num_components >= orig_atom->num_components)
  ------------------
  |  Branch (168:10): [True: 0, False: 0]
  ------------------
  169|      0|    {
  170|      0|        nCurAtLen = new_orig_atom->nCurAtLen;
  171|      0|    }
  172|  54.6k|    else
  173|  54.6k|    {
  174|  54.6k|        nCurAtLen = (AT_NUMB *) inchi_calloc( orig_atom->num_components + 1, sizeof( nCurAtLen[0] ) );
  ------------------
  |  | 1133|  54.6k|#define inchi_calloc   calloc
  ------------------
  175|  54.6k|        if (!nCurAtLen)
  ------------------
  |  Branch (175:13): [True: 0, False: 54.6k]
  ------------------
  176|      0|        {
  177|      0|            goto exit_function;
  178|      0|        }
  179|  54.6k|    }
  180|       |
  181|  54.6k|    if (new_orig_atom->nCurAtLen &&
  ------------------
  |  Branch (181:9): [True: 0, False: 54.6k]
  ------------------
  182|  54.6k|         new_orig_atom->num_components >= orig_atom->num_components)
  ------------------
  |  Branch (182:10): [True: 0, False: 0]
  ------------------
  183|      0|    {
  184|      0|        nOldCompNumber = new_orig_atom->nOldCompNumber;
  185|      0|    }
  186|  54.6k|    else
  187|  54.6k|    {
  188|  54.6k|        nOldCompNumber = (AT_NUMB *) inchi_calloc( orig_atom->num_components + 1,
  ------------------
  |  | 1133|  54.6k|#define inchi_calloc   calloc
  ------------------
  189|  54.6k|                                                  sizeof( nOldCompNumber[0] ) );
  190|  54.6k|        if (!nOldCompNumber)
  ------------------
  |  Branch (190:13): [True: 0, False: 54.6k]
  ------------------
  191|      0|        {
  192|      0|            goto exit_function;
  193|      0|        }
  194|  54.6k|    }
  195|       |
  196|  54.6k|    if (at && nCurAtLen && nOldCompNumber)
  ------------------
  |  Branch (196:9): [True: 54.6k, False: 0]
  |  Branch (196:15): [True: 54.6k, False: 0]
  |  Branch (196:28): [True: 54.6k, False: 0]
  ------------------
  197|  54.6k|    {
  198|       |        /* Copy */
  199|  54.6k|        if (orig_atom->at)
  ------------------
  |  Branch (199:13): [True: 54.6k, False: 0]
  ------------------
  200|  54.6k|        {
  201|  54.6k|            memcpy( at, orig_atom->at,
  202|  54.6k|                 orig_nat * sizeof( new_orig_atom->at[0] ) );
  203|  54.6k|        }
  204|  54.6k|        if (orig_atom->nCurAtLen)
  ------------------
  |  Branch (204:13): [True: 0, False: 54.6k]
  ------------------
  205|      0|        {
  206|      0|            memcpy( nCurAtLen, orig_atom->nCurAtLen,
  207|      0|                 orig_atom->num_components * sizeof( nCurAtLen[0] ) );
  208|      0|        }
  209|  54.6k|        if (orig_atom->nOldCompNumber)
  ------------------
  |  Branch (209:13): [True: 0, False: 54.6k]
  ------------------
  210|      0|        {
  211|      0|            memcpy( nOldCompNumber, orig_atom->nOldCompNumber,
  212|      0|                 orig_atom->num_components * sizeof( nOldCompNumber[0] ) );
  213|      0|        }
  214|       |
  215|       |        /* Deallocate */
  216|  54.6k|        if (new_orig_atom->at && new_orig_atom->at != at)
  ------------------
  |  Branch (216:13): [True: 0, False: 54.6k]
  |  Branch (216:34): [True: 0, False: 0]
  ------------------
  217|      0|        {
  218|      0|            inchi_free( new_orig_atom->at );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  219|      0|        }
  220|  54.6k|        if (new_orig_atom->nCurAtLen && new_orig_atom->nCurAtLen != nCurAtLen)
  ------------------
  |  Branch (220:13): [True: 0, False: 54.6k]
  |  Branch (220:41): [True: 0, False: 0]
  ------------------
  221|      0|        {
  222|      0|            inchi_free( new_orig_atom->nCurAtLen );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  223|      0|        }
  224|  54.6k|        if (new_orig_atom->nOldCompNumber &&
  ------------------
  |  Branch (224:13): [True: 0, False: 54.6k]
  ------------------
  225|  54.6k|             new_orig_atom->nOldCompNumber != nOldCompNumber)
  ------------------
  |  Branch (225:14): [True: 0, False: 0]
  ------------------
  226|      0|        {
  227|      0|            inchi_free( new_orig_atom->nOldCompNumber );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  228|      0|        }
  229|       |
  230|  54.6k|        *new_orig_atom = *orig_atom;
  231|  54.6k|        new_orig_atom->at = at;
  232|  54.6k|        new_orig_atom->nCurAtLen = nCurAtLen;
  233|  54.6k|        new_orig_atom->nOldCompNumber = nOldCompNumber;
  234|       |
  235|       |        /* Data that are not to be copied */
  236|  54.6k|        new_orig_atom->nNumEquSets = 0;
  237|  54.6k|        memset( new_orig_atom->bSavedInINCHI_LIB, 0, sizeof( new_orig_atom->bSavedInINCHI_LIB ) );
  238|  54.6k|        memset( new_orig_atom->bPreprocessed, 0, sizeof( new_orig_atom->bPreprocessed ) );
  239|       |
  240|       |
  241|       |
  242|  54.6k|        new_orig_atom->szCoord = NULL; 
  243|  54.6k|        if (orig_atom->szCoord)
  ------------------
  |  Branch (243:13): [True: 0, False: 54.6k]
  ------------------
  244|      0|        {
  245|      0|            new_orig_atom->szCoord = (MOL_COORD *) inchi_calloc(orig_nat, sizeof(new_orig_atom->szCoord[0]));
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  246|      0|            if (!new_orig_atom->szCoord)
  ------------------
  |  Branch (246:17): [True: 0, False: 0]
  ------------------
  247|      0|            {
  248|      0|                goto exit_function;
  249|      0|            }
  250|      0|            memcpy(new_orig_atom->szCoord, orig_atom->szCoord, orig_nat * sizeof(new_orig_atom->szCoord[0]));
  251|      0|        }
  252|       |        
  253|       |
  254|       |        /* Arrays that are not to be copied */
  255|       |        
  256|  54.6k|        new_orig_atom->nEquLabels = NULL;
  257|  54.6k|        new_orig_atom->nSortedOrder = NULL;
  258|       |
  259|  54.6k|        new_orig_atom->polymer = NULL;
  260|  54.6k|        if (orig_atom->polymer)
  ------------------
  |  Branch (260:13): [True: 0, False: 54.6k]
  ------------------
  261|      0|        {
  262|       |            /* Polymer stuff -- deep copy */
  263|      0|            OAD_Polymer *oldp = orig_atom->polymer;
  264|      0|            OAD_Polymer *newp = NULL;
  265|       |
  266|      0|            newp = (OAD_Polymer *) inchi_calloc( 1, sizeof( OAD_Polymer ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  267|      0|            if (!newp)
  ------------------
  |  Branch (267:17): [True: 0, False: 0]
  ------------------
  268|      0|            {
  269|      0|                goto exit_function;
  270|      0|            }
  271|      0|            memcpy( newp, orig_atom->polymer, sizeof( OAD_Polymer ) );
  272|      0|            newp->units = (OAD_PolymerUnit**) inchi_calloc( newp->n, sizeof( newp->units ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  273|      0|            if (!newp->units)
  ------------------
  |  Branch (273:17): [True: 0, False: 0]
  ------------------
  274|      0|            {
  275|      0|                goto exit_function;
  276|      0|            }
  277|      0|            for (k = 0; k < orig_atom->polymer->n; k++)
  ------------------
  |  Branch (277:25): [True: 0, False: 0]
  ------------------
  278|      0|            {
  279|      0|                newp->units[k] = OAD_PolymerUnit_CreateCopy( orig_atom->polymer->units[k] );
  280|      0|            }
  281|      0|            if (oldp->n_pzz > 0)
  ------------------
  |  Branch (281:17): [True: 0, False: 0]
  ------------------
  282|      0|            {
  283|      0|                newp->n_pzz = oldp->n_pzz;
  284|      0|                newp->pzz = (int *) inchi_calloc( newp->n_pzz, sizeof( int ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  285|      0|                if (!newp->pzz)
  ------------------
  |  Branch (285:21): [True: 0, False: 0]
  ------------------
  286|      0|                {
  287|      0|                    goto exit_function;
  288|      0|                }
  289|      0|                memcpy( newp->pzz, oldp->pzz, newp->n_pzz * sizeof( oldp->pzz[0] ) );
  290|      0|            }
  291|      0|            new_orig_atom->polymer = newp;
  292|      0|        }
  293|       |
  294|  54.6k|        new_orig_atom->v3000 = NULL;
  295|  54.6k|        if (orig_atom->v3000)
  ------------------
  |  Branch (295:13): [True: 0, False: 54.6k]
  ------------------
  296|      0|        {
  297|       |            /* V3000 features -- deep copy */
  298|      0|            OAD_V3000 *new_v3000 = NULL;
  299|      0|            new_v3000 = (OAD_V3000 *) inchi_calloc( 1, sizeof( OAD_V3000 ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  300|      0|            if (!new_v3000)
  ------------------
  |  Branch (300:17): [True: 0, False: 0]
  ------------------
  301|      0|            {
  302|      0|                goto exit_function;
  303|      0|            }
  304|      0|            memcpy( new_v3000, orig_atom->v3000, sizeof( OAD_V3000 ) );
  305|      0|            if (orig_atom->v3000->atom_index_orig)
  ------------------
  |  Branch (305:17): [True: 0, False: 0]
  ------------------
  306|      0|            {
  307|      0|                new_v3000->atom_index_orig = (int *) inchi_calloc( orig_nat, sizeof( int ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  308|       |                /* if ( NULL==new_v3000->atom_index_orig ) {TREAT_ERR( err, 9001, "Out of RAM"); goto exit_function; } */
  309|      0|                if (!new_v3000->atom_index_orig)
  ------------------
  |  Branch (309:21): [True: 0, False: 0]
  ------------------
  310|      0|                {
  311|      0|                    goto exit_function;
  312|      0|                }
  313|      0|                memcpy( new_v3000->atom_index_orig, orig_atom->v3000->atom_index_orig, orig_nat * sizeof( int ) );
  314|      0|            }
  315|      0|            if (orig_atom->v3000->atom_index_fin)
  ------------------
  |  Branch (315:17): [True: 0, False: 0]
  ------------------
  316|      0|            {
  317|      0|                new_v3000->atom_index_fin = (int *) inchi_calloc( orig_nat, sizeof( int ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  318|       |                /* if ( NULL==new_v3000->atom_index_fin ) {TREAT_ERR( err, 9001, "Out of RAM"); goto exit_function; } */
  319|      0|                if (!new_v3000->atom_index_fin)
  ------------------
  |  Branch (319:21): [True: 0, False: 0]
  ------------------
  320|      0|                {
  321|      0|                    goto exit_function;
  322|      0|                }
  323|      0|                memcpy( new_v3000->atom_index_fin, orig_atom->v3000->atom_index_fin, orig_nat * sizeof( int ) );
  324|      0|            }
  325|      0|            if (orig_atom->v3000->n_haptic_bonds && orig_atom->v3000->lists_haptic_bonds)
  ------------------
  |  Branch (325:17): [True: 0, False: 0]
  |  Branch (325:53): [True: 0, False: 0]
  ------------------
  326|      0|            {
  327|      0|                new_v3000->lists_haptic_bonds = (int **) inchi_calloc( orig_atom->v3000->n_haptic_bonds, sizeof( int* ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  328|       |                /* if ( NULL==new_v3000->lists_haptic_bonds ) { TREAT_ERR( err, 9001, "Out of RAM"); goto exit_function; }*/
  329|      0|                for (m = 0; m < orig_atom->v3000->n_haptic_bonds; m++)
  ------------------
  |  Branch (329:29): [True: 0, False: 0]
  ------------------
  330|      0|                {
  331|      0|                    int *lst = NULL;
  332|      0|                    int *old_lst = orig_atom->v3000->lists_haptic_bonds[m];
  333|      0|                    nn = old_lst[2] + 3;
  334|      0|                    lst = new_v3000->lists_haptic_bonds[m] = (int *) inchi_calloc( nn, sizeof( int ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  335|      0|                    if (!lst)
  ------------------
  |  Branch (335:25): [True: 0, False: 0]
  ------------------
  336|      0|                    {
  337|      0|                        goto exit_function;
  338|      0|                    }
  339|      0|                    memcpy( lst, old_lst, nn * sizeof( int ) );
  340|      0|                }
  341|      0|            }
  342|      0|            if (orig_atom->v3000->n_steabs && orig_atom->v3000->lists_steabs)
  ------------------
  |  Branch (342:17): [True: 0, False: 0]
  |  Branch (342:47): [True: 0, False: 0]
  ------------------
  343|      0|            {
  344|      0|                new_v3000->lists_steabs = (int **) inchi_calloc( orig_atom->v3000->n_steabs, sizeof( int* ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  345|       |                /* if ( NULL==new_v3000->lists_steabs ) { TREAT_ERR( err, 9001, "Out of RAM"); goto exit_function; }*/
  346|      0|                for (m = 0; m < orig_atom->v3000->n_steabs; m++)
  ------------------
  |  Branch (346:29): [True: 0, False: 0]
  ------------------
  347|      0|                {
  348|      0|                    int *lst = NULL;
  349|      0|                    int *old_lst = orig_atom->v3000->lists_steabs[m];
  350|      0|                    nn = old_lst[1] + 2;
  351|      0|                    lst = new_v3000->lists_steabs[m] = (int *) inchi_calloc( nn, sizeof( int ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  352|      0|                    if (!lst)
  ------------------
  |  Branch (352:25): [True: 0, False: 0]
  ------------------
  353|      0|                    {
  354|      0|                        goto exit_function;
  355|      0|                    }
  356|      0|                    memcpy( lst, old_lst, nn * sizeof( int ) );
  357|      0|                }
  358|      0|            }
  359|      0|            if (orig_atom->v3000->n_sterel && orig_atom->v3000->lists_sterel)
  ------------------
  |  Branch (359:17): [True: 0, False: 0]
  |  Branch (359:47): [True: 0, False: 0]
  ------------------
  360|      0|            {
  361|      0|                new_v3000->lists_sterel = (int **) inchi_calloc( orig_atom->v3000->n_sterel, sizeof( int* ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  362|      0|                if (!new_v3000)
  ------------------
  |  Branch (362:21): [True: 0, False: 0]
  ------------------
  363|      0|                {
  364|      0|                    goto exit_function;
  365|      0|                }
  366|       |                /* if ( NULL==new_v3000->lists_sterel ) { TREAT_ERR( err, 9001, "Out of RAM"); goto exit_function; }*/
  367|      0|                for (m = 0; m < orig_atom->v3000->n_sterel; m++)
  ------------------
  |  Branch (367:29): [True: 0, False: 0]
  ------------------
  368|      0|                {
  369|      0|                    int *lst = NULL;
  370|      0|                    int *old_lst = orig_atom->v3000->lists_sterel[m];
  371|      0|                    nn = old_lst[1] + 2;
  372|      0|                    lst = new_v3000->lists_sterel[m] = (int *) inchi_calloc( nn, sizeof( int ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  373|      0|                    if (!lst)
  ------------------
  |  Branch (373:25): [True: 0, False: 0]
  ------------------
  374|      0|                    {
  375|      0|                        goto exit_function;
  376|      0|                    }
  377|      0|                    memcpy( lst, old_lst, nn * sizeof( int ) );
  378|      0|                }
  379|      0|            }
  380|      0|            if (orig_atom->v3000->n_sterac && orig_atom->v3000->lists_sterac)
  ------------------
  |  Branch (380:17): [True: 0, False: 0]
  |  Branch (380:47): [True: 0, False: 0]
  ------------------
  381|      0|            {
  382|      0|                new_v3000->lists_sterac = (int **) inchi_calloc( orig_atom->v3000->n_sterac, sizeof( int* ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  383|       |                /* if ( NULL==new_v3000->lists_sterac ) { TREAT_ERR( err, 9001, "Out of RAM"); goto exit_function; }*/
  384|      0|                for (m = 0; m < orig_atom->v3000->n_sterac; m++)
  ------------------
  |  Branch (384:29): [True: 0, False: 0]
  ------------------
  385|      0|                {
  386|      0|                    int *lst = NULL;
  387|      0|                    int *old_lst = orig_atom->v3000->lists_sterac[m];
  388|      0|                    nn = old_lst[1] + 2;
  389|      0|                    lst = new_v3000->lists_sterac[m] = (int *) inchi_calloc( nn, sizeof( int ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  390|      0|                    if (!lst)
  ------------------
  |  Branch (390:25): [True: 0, False: 0]
  ------------------
  391|      0|                    {
  392|      0|                        goto exit_function;
  393|      0|                    }
  394|      0|                    memcpy( lst, old_lst, nn * sizeof( int ) );
  395|      0|                }
  396|      0|            }
  397|       |
  398|      0|            new_orig_atom->v3000 = new_v3000;
  399|      0|        }
  400|       |
  401|       |        /* Success */
  402|  54.6k|        ret = 0;
  403|  54.6k|    }
  404|       |
  405|  54.6k|exit_function:
  406|       |
  407|  54.6k|    if (ret != 0)
  ------------------
  |  Branch (407:9): [True: 0, False: 54.6k]
  ------------------
  408|      0|    {
  409|      0|        if (at && new_orig_atom->at != at)
  ------------------
  |  Branch (409:13): [True: 0, False: 0]
  |  Branch (409:19): [True: 0, False: 0]
  ------------------
  410|      0|            inchi_free( at );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  411|      0|        if (nCurAtLen && new_orig_atom->nCurAtLen != nCurAtLen)
  ------------------
  |  Branch (411:13): [True: 0, False: 0]
  |  Branch (411:26): [True: 0, False: 0]
  ------------------
  412|      0|            inchi_free( nCurAtLen );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  413|      0|        if (nOldCompNumber && new_orig_atom->nOldCompNumber != nOldCompNumber)
  ------------------
  |  Branch (413:13): [True: 0, False: 0]
  |  Branch (413:31): [True: 0, False: 0]
  ------------------
  414|      0|            inchi_free( nOldCompNumber );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  415|      0|    }
  416|       |
  417|  54.6k|    return ret;
  418|  54.6k|}
PreprocessOneStructure:
  453|  54.6k|{
  454|  54.6k|    int i;
  455|  54.6k|    INCHI_MODE bTautFlags = 0;
  456|  54.6k|    INCHI_MODE bTautFlagsDone = 0;
  457|       |
  458|       |    /* 1. Copy orig_inp_data --> prep_inp_data */
  459|       |
  460|  54.6k|    if (0 > OrigAtData_Duplicate( prep_inp_data, orig_inp_data ))
  ------------------
  |  Branch (460:9): [True: 0, False: 54.6k]
  ------------------
  461|      0|    {
  462|      0|        AddErrorMessage( sd->pStrErrStruct, "Out of RAM" );
  463|      0|        sd->nStructReadError = 99;
  464|      0|        sd->nErrorType = _IS_FATAL;
  ------------------
  |  |   41|      0|#define _IS_FATAL   3
  ------------------
  465|      0|        goto exit_function;
  466|      0|    }
  467|       |
  468|       |#if ( bRELEASE_VERSION == 0 && (EXTR_HAS_METAL_ATOM & (EXTR_MASK | EXTR_FLAG) ) )
  469|       |    if (bHasMetalAtom( orig_inp_data ))
  470|       |    {
  471|       |        sd->bExtract |= EXTR_HAS_METAL_ATOM;
  472|       |    }
  473|       |#endif
  474|       |
  475|       |    /* 2. Fix odd things in prep_inp_data            */
  476|       |
  477|  54.6k|    if (0 < fix_odd_things( prep_inp_data->num_inp_atoms, prep_inp_data->at, /*0*/ip->bTautFlags & TG_FLAG_FIX_SP3_BUG, ip->bFixNonUniformDraw ))
  ------------------
  |  |  947|  54.6k|#define TG_FLAG_FIX_SP3_BUG              0x00040000   /* fix sp3 stereo bug: overlapping 2D stereo bond & coordinate scaling */
  ------------------
  |  Branch (477:9): [True: 0, False: 54.6k]
  ------------------
  478|      0|    {
  479|       |        /* changed 2010-03-17 DT */
  480|      0|        if (!ip->bNoWarnings)
  ------------------
  |  Branch (480:13): [True: 0, False: 0]
  ------------------
  481|      0|        {
  482|      0|            WarningMessage( sd->pStrErrStruct, "Charges were rearranged" );
  ------------------
  |  |  160|      0|#define WarningMessage AddErrorMessage
  ------------------
  483|      0|        }
  484|      0|        if (sd->nErrorType < _IS_WARNING)
  ------------------
  |  |   39|      0|#define _IS_WARNING 1
  ------------------
  |  Branch (484:13): [True: 0, False: 0]
  ------------------
  485|      0|        {
  486|      0|            sd->nErrorType = _IS_WARNING;
  ------------------
  |  |   39|      0|#define _IS_WARNING 1
  ------------------
  487|      0|        }
  488|      0|        sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_FIX_ODD_THINGS_DONE;
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                      sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_FIX_ODD_THINGS_DONE;
  ------------------
  |  |  975|      0|#define TG_FLAG_FIX_ODD_THINGS_DONE      0x00000800   /* fixed drawing ambiguities in fix_odd_things */
  ------------------
  489|      0|    }
  490|       |
  491|       |#if ( FIX_ADJ_RAD == 1 )
  492|       |    if (ip->bTautFlags & TG_FLAG_FIX_ADJ_RADICALS)
  493|       |    {
  494|       |        if (0 < FixAdjacentRadicals( prep_inp_data->num_inp_atoms, prep_inp_data->at ))
  495|       |        {
  496|       |            sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_FIX_ADJ_RADICALS_DONE;
  497|       |        }
  498|       |    }
  499|       |#endif
  500|       |
  501|       |#if ( bRELEASE_VERSION == 0 && (EXTR_FLAGS & EXTR_HAS_FEATURE) )
  502|       |    if (bFoundFeature( prep_inp_data->at, prep_inp_data->num_inp_atoms ))
  503|       |    {
  504|       |        sd->bExtract |= EXTR_HAS_FEATURE;
  505|       |    }
  506|       |#endif
  507|       |
  508|       |
  509|       |    /* Find whether the structure can be disconnected or is a salt */
  510|       |
  511|       |
  512|       |    /* Needs salt disconnection? */
  513|       |
  514|  54.6k|    if (ip->bTautFlags & TG_FLAG_DISCONNECT_SALTS)
  ------------------
  |  |  922|  54.6k|#define TG_FLAG_DISCONNECT_SALTS         0x00000002   /* DISCONNECT_SALTS disconnect */
  ------------------
  |  Branch (514:9): [True: 54.6k, False: 0]
  ------------------
  515|  54.6k|    {
  516|  54.6k|        prep_inp_data->bDisconnectSalts = ( 0 < DisconnectSalts( prep_inp_data, 0 ) );
  517|  54.6k|    }
  518|      0|    else
  519|      0|    {
  520|      0|        prep_inp_data->bDisconnectSalts = 0;
  521|      0|    }
  522|       |
  523|       |    /* Needs metal disconnection? */
  524|       |
  525|  54.6k|    if (ip->bTautFlags & TG_FLAG_DISCONNECT_COORD)
  ------------------
  |  |  934|  54.6k|#define TG_FLAG_DISCONNECT_COORD         0x00000080   /* find "coord. centers" and disconnect them */
  ------------------
  |  Branch (525:9): [True: 54.6k, False: 0]
  ------------------
  526|  54.6k|    {
  527|  54.6k|        i = ( 0 != ( ip->bTautFlags & TG_FLAG_CHECK_VALENCE_COORD ) );
  ------------------
  |  |  936|  54.6k|#define TG_FLAG_CHECK_VALENCE_COORD      0x00000200   /* do not disconnect "coord. centers" with usual valence */
  ------------------
  528|  54.6k|        bMayDisconnectMetals( prep_inp_data, i, &bTautFlagsDone ); /* changes prep_inp_data->bDisconnectCoord */
  529|  54.6k|        sd->bTautFlagsDone[INCHI_BAS] |= bTautFlagsDone; /* whether any disconnection has been rejected because of the metal proper valence */
  ------------------
  |  |  575|  54.6k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  530|       |
  531|       |#if ( bRELEASE_VERSION == 0 )
  532|       |        if (i && ( bTautFlagsDone & TG_FLAG_CHECK_VALENCE_COORD_DONE ))
  533|       |        {
  534|       |            sd->bExtract |= EXTR_METAL_WAS_NOT_DISCONNECTED;
  535|       |        }
  536|       |#endif
  537|  54.6k|    }
  538|      0|    else
  539|      0|    {
  540|      0|        prep_inp_data->bDisconnectCoord = 0;
  541|      0|    }
  542|  54.6k|    orig_inp_data->bDisconnectSalts = prep_inp_data->bDisconnectSalts;
  543|  54.6k|    orig_inp_data->bDisconnectCoord = prep_inp_data->bDisconnectCoord;
  544|       |
  545|       |    /* 3. if( orig_inp_data->bDisconnectSalts ) then
  546|       |          disconnect salts in prep_inp_data    */
  547|       |
  548|  54.6k|    if (( ip->bTautFlags & TG_FLAG_DISCONNECT_SALTS ) && prep_inp_data->bDisconnectSalts &&
  ------------------
  |  |  922|  54.6k|#define TG_FLAG_DISCONNECT_SALTS         0x00000002   /* DISCONNECT_SALTS disconnect */
  ------------------
  |  Branch (548:9): [True: 54.6k, False: 0]
  |  Branch (548:58): [True: 0, False: 54.6k]
  ------------------
  549|  54.6k|         0 < ( i = DisconnectSalts( prep_inp_data, 1 ) ))
  ------------------
  |  Branch (549:10): [True: 0, False: 0]
  ------------------
  550|      0|    {
  551|      0|        if (!ip->bNoWarnings)
  ------------------
  |  Branch (551:13): [True: 0, False: 0]
  ------------------
  552|      0|        {
  553|      0|            WarningMessage( sd->pStrErrStruct, "Salt was disconnected" );
  ------------------
  |  |  160|      0|#define WarningMessage AddErrorMessage
  ------------------
  554|      0|        }
  555|      0|        sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_DISCONNECT_SALTS_DONE;
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                      sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_DISCONNECT_SALTS_DONE;
  ------------------
  |  |  961|      0|#define TG_FLAG_DISCONNECT_SALTS_DONE    0x00000004
  ------------------
  556|      0|        if (sd->nErrorType < _IS_WARNING)
  ------------------
  |  |   39|      0|#define _IS_WARNING 1
  ------------------
  |  Branch (556:13): [True: 0, False: 0]
  ------------------
  557|      0|        {
  558|      0|            sd->nErrorType = _IS_WARNING;
  ------------------
  |  |   39|      0|#define _IS_WARNING 1
  ------------------
  559|      0|        }
  560|      0|        if (i = ReconcileAllCmlBondParities( prep_inp_data->at, prep_inp_data->num_inp_atoms, 0 ))
  ------------------
  |  Branch (560:13): [True: 0, False: 0]
  ------------------
  561|      0|        {
  562|      0|            char szErrCode[16];
  563|      0|            sprintf( szErrCode, "%d", i );
  564|      0|            AddErrorMessage( sd->pStrErrStruct, "0D Parities Reconciliation failed:" );
  565|      0|            AddErrorMessage( sd->pStrErrStruct, szErrCode );
  566|      0|        }
  567|       |
  568|       |#if ( bRELEASE_VERSION == 0 )
  569|       |        sd->bExtract |= EXTR_SALT_WAS_DISCONNECTED;
  570|       |#endif
  571|      0|    }
  572|  54.6k|    else
  573|  54.6k|    {
  574|  54.6k|        prep_inp_data->bDisconnectSalts = 0;
  575|  54.6k|    }
  576|       |
  577|       |    /*  Mark the (disconnected) components in prep_inp_data    */
  578|       |
  579|  54.6k|    prep_inp_data->num_components = MarkDisconnectedComponents( prep_inp_data, 0 );
  580|       |
  581|  54.6k|    if (prep_inp_data->num_components < 0)
  ------------------
  |  Branch (581:9): [True: 0, False: 54.6k]
  ------------------
  582|      0|    {
  583|      0|        AddErrorMessage( sd->pStrErrStruct, "Out of RAM" );
  584|      0|        sd->nStructReadError = 99;
  585|      0|        sd->nErrorType = _IS_FATAL;
  ------------------
  |  |   41|      0|#define _IS_FATAL   3
  ------------------
  586|      0|        goto exit_function;
  587|      0|    }
  588|       |
  589|       |    /* Detect isotopic H on heteroatoms -- necessary condition
  590|       |       for global isotopic tautomerism */
  591|       |
  592|  54.6k|    if (i = bNumHeterAtomHasIsotopicH( prep_inp_data->at, prep_inp_data->num_inp_atoms ))
  ------------------
  |  Branch (592:9): [True: 15, False: 54.5k]
  ------------------
  593|     15|    {
  594|     15|        if (i & 1)
  ------------------
  |  Branch (594:13): [True: 0, False: 15]
  ------------------
  595|      0|        {
  596|      0|            sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_FOUND_ISOTOPIC_H_DONE;
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_FOUND_ISOTOPIC_H_DONE;
  ------------------
  |  |  978|      0|#define TG_FLAG_FOUND_ISOTOPIC_H_DONE    0x00004000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
  597|      0|        }
  598|     15|        if (i & 2)
  ------------------
  |  Branch (598:13): [True: 15, False: 0]
  ------------------
  599|     15|        {
  600|     15|            sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE;
  ------------------
  |  |  575|     15|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE;
  ------------------
  |  |  979|     15|#define TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE 0x00008000   /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
  ------------------
  601|     15|        }
  602|     15|    }
  603|       |
  604|       |    /* 4a. Detect unusual valences                                              */
  605|       |
  606|  54.6k|    if (OrigAtData_bCheckUnusualValences( prep_inp_data, 1, sd->pStrErrStruct, ip->bNoWarnings ))
  ------------------
  |  Branch (606:9): [True: 2, False: 54.6k]
  ------------------
  607|      2|    {
  608|       |#if ( bRELEASE_VERSION == 0 )
  609|       |        sd->bExtract |= EXTR_UNUSUAL_VALENCES;
  610|       |#else
  611|      2|        ;
  612|      2|#endif
  613|      2|    }
  614|       |
  615|       |
  616|       |    /*    5. if( orig_inp_data->bDisconnectCoord ) then
  617|       |              -- copy prep_inp_data --> prep_inp_data+1
  618|       |              -- disconnect metals in prep_inp_data            */
  619|       |
  620|  54.6k|    if (prep_inp_data->bDisconnectCoord)
  ------------------
  |  Branch (620:9): [True: 0, False: 54.6k]
  ------------------
  621|      0|    {
  622|       |
  623|      0|        prep_inp_data->num_components = MarkDisconnectedComponents( prep_inp_data, 0 );
  624|      0|        if (prep_inp_data->num_components < 0)
  ------------------
  |  Branch (624:13): [True: 0, False: 0]
  ------------------
  625|      0|        {
  626|      0|            AddErrorMessage( sd->pStrErrStruct, "Out of RAM" );
  627|      0|            sd->nStructReadError = 99;
  628|      0|            sd->nErrorType = _IS_FATAL;
  ------------------
  |  |   41|      0|#define _IS_FATAL   3
  ------------------
  629|      0|            goto exit_function;
  630|      0|        }
  631|       |
  632|       |        /* Save reconnected structure in prep_inp_data+1 if requested */
  633|      0|        if (0 != ( ip->bTautFlags & TG_FLAG_RECONNECT_COORD ))
  ------------------
  |  |  935|      0|#define TG_FLAG_RECONNECT_COORD          0x00000100   /* reconnect disconnected "coord. centers" */
  ------------------
  |  Branch (633:13): [True: 0, False: 0]
  ------------------
  634|      0|        {
  635|      0|            if (0 > OrigAtData_Duplicate( prep_inp_data + 1, prep_inp_data ))
  ------------------
  |  Branch (635:17): [True: 0, False: 0]
  ------------------
  636|      0|            {
  637|      0|                AddErrorMessage( sd->pStrErrStruct, "Out of RAM" );
  638|      0|                sd->nStructReadError = 99;
  639|      0|                sd->nErrorType = _IS_FATAL;
  ------------------
  |  |   41|      0|#define _IS_FATAL   3
  ------------------
  640|      0|                goto exit_function;
  641|      0|            }
  642|      0|            sd->bTautFlags[INCHI_REC] = sd->bTautFlags[INCHI_BAS];
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                          sd->bTautFlags[INCHI_REC] = sd->bTautFlags[INCHI_BAS];
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  643|      0|            sd->bTautFlagsDone[INCHI_REC] = sd->bTautFlagsDone[INCHI_BAS];
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                          sd->bTautFlagsDone[INCHI_REC] = sd->bTautFlagsDone[INCHI_BAS];
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  644|      0|            {
  645|       |                /* Remove "parity undefined in disconnected structure" flag from reconnected structure */
  646|      0|                int k, m, p;
  647|      0|                inp_ATOM *at = ( prep_inp_data + 1 )->at;
  648|      0|                int       num_at = ( prep_inp_data + 1 )->num_inp_atoms;
  649|      0|                for (k = 0; k < num_at; k++)
  ------------------
  |  Branch (649:29): [True: 0, False: 0]
  ------------------
  650|      0|                {
  651|      0|                    for (m = 0; m < MAX_NUM_STEREO_BONDS && ( p = at[k].sb_parity[m] ); m++)
  ------------------
  |  |  876|      0|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (651:33): [True: 0, False: 0]
  |  Branch (651:61): [True: 0, False: 0]
  ------------------
  652|      0|                    {
  653|      0|                        at[k].sb_parity[m] &= SB_PARITY_MASK;
  ------------------
  |  |   96|      0|#define SB_PARITY_MASK  0x07
  ------------------
  654|      0|                    }
  655|      0|                }
  656|      0|            }
  657|      0|        }
  658|       |
  659|       |        /* Make disconnected structure in prep_inp_data */
  660|      0|        i = ( 0 != ( ip->bTautFlags & TG_FLAG_CHECK_VALENCE_COORD ) );
  ------------------
  |  |  936|      0|#define TG_FLAG_CHECK_VALENCE_COORD      0x00000200   /* do not disconnect "coord. centers" with usual valence */
  ------------------
  661|       |
  662|       |        /*    prep_inp_data->bDisconnectCoord > 1 means add
  663|       |                prep_inp_data->bDisconnectCoord-1 explicit H atoms    */
  664|      0|        if (0 < ( i = DisconnectMetals( prep_inp_data, i, &bTautFlagsDone ) ))
  ------------------
  |  Branch (664:13): [True: 0, False: 0]
  ------------------
  665|      0|        {
  666|      0|            if (!ip->bNoWarnings)
  ------------------
  |  Branch (666:17): [True: 0, False: 0]
  ------------------
  667|      0|            {
  668|      0|                WarningMessage( sd->pStrErrStruct, "Metal was disconnected" );
  ------------------
  |  |  160|      0|#define WarningMessage AddErrorMessage
  ------------------
  669|      0|            }
  670|      0|            sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_DISCONNECT_COORD_DONE;
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_DISCONNECT_COORD_DONE;
  ------------------
  |  |  972|      0|#define TG_FLAG_DISCONNECT_COORD_DONE    0x00000100   /* found and disconnected "coord. centers" */
  ------------------
  671|      0|            if (sd->nErrorType < _IS_WARNING)
  ------------------
  |  |   39|      0|#define _IS_WARNING 1
  ------------------
  |  Branch (671:17): [True: 0, False: 0]
  ------------------
  672|      0|            {
  673|      0|                sd->nErrorType = _IS_WARNING;
  ------------------
  |  |   39|      0|#define _IS_WARNING 1
  ------------------
  674|      0|            }
  675|       |
  676|       |#if ( bRELEASE_VERSION == 0 )
  677|       |            sd->bExtract |= EXTR_METAL_WAS_DISCONNECTED;
  678|       |#endif
  679|       |
  680|       |            /* last parm=1 means find link between unchanged by Metal Disconnection components */
  681|      0|            prep_inp_data->num_components = MarkDisconnectedComponents( prep_inp_data, 1 );
  682|       |
  683|      0|            if (prep_inp_data->num_components < 0)
  ------------------
  |  Branch (683:17): [True: 0, False: 0]
  ------------------
  684|      0|            {
  685|      0|                AddErrorMessage( sd->pStrErrStruct, "Out of RAM" );
  686|      0|                sd->nStructReadError = 99;
  687|      0|                sd->nErrorType = _IS_FATAL;
  ------------------
  |  |   41|      0|#define _IS_FATAL   3
  ------------------
  688|      0|                goto exit_function;
  689|      0|            }
  690|       |
  691|      0|            {
  692|       |                /* Set parities for the disconnected structure */
  693|      0|                int k, m, p;
  694|      0|                inp_ATOM *at = ( prep_inp_data )->at;
  695|      0|                int       num_at = ( prep_inp_data )->num_inp_atoms;
  696|      0|                for (k = 0; k < num_at; k++)
  ------------------
  |  Branch (696:29): [True: 0, False: 0]
  ------------------
  697|      0|                {
  698|      0|                    for (m = 0; m < MAX_NUM_STEREO_BONDS && ( p = at[k].sb_parity[m] ); m++)
  ------------------
  |  |  876|      0|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (698:33): [True: 0, False: 0]
  |  Branch (698:61): [True: 0, False: 0]
  ------------------
  699|      0|                    {
  700|      0|                        if (p & SB_PARITY_FLAG)
  ------------------
  |  |   94|      0|#define SB_PARITY_FLAG  0x38 /* mask for disconnected metal parity if it is different */
  ------------------
  |  Branch (700:29): [True: 0, False: 0]
  ------------------
  701|      0|                        {
  702|      0|                            at[k].sb_parity[m] = ( p >> SB_PARITY_SHFT ) & SB_PARITY_MASK;
  ------------------
  |  |   95|      0|#define SB_PARITY_SHFT  3    /* number of right shift bits to get disconnected metal parity */
  ------------------
                                          at[k].sb_parity[m] = ( p >> SB_PARITY_SHFT ) & SB_PARITY_MASK;
  ------------------
  |  |   96|      0|#define SB_PARITY_MASK  0x07
  ------------------
  703|      0|                        }
  704|      0|                    }
  705|      0|                }
  706|      0|            }
  707|       |
  708|      0|            if (i = ReconcileAllCmlBondParities( prep_inp_data->at, prep_inp_data->num_inp_atoms, 1 ))
  ------------------
  |  Branch (708:17): [True: 0, False: 0]
  ------------------
  709|      0|            {
  710|      0|                char szErrCode[16];
  711|      0|                sprintf( szErrCode, "%d", i );
  712|      0|                AddErrorMessage( sd->pStrErrStruct, "0D Parities Reconciliation failed:" );
  713|      0|                AddErrorMessage( sd->pStrErrStruct, szErrCode );
  714|      0|            }
  715|       |
  716|      0|#if ( REMOVE_ION_PAIRS_DISC_STRU == 1 )
  717|      0|            if (0 < remove_ion_pairs( prep_inp_data->num_inp_atoms, prep_inp_data->at ))
  ------------------
  |  Branch (717:17): [True: 0, False: 0]
  ------------------
  718|      0|            {
  719|      0|                if (!ip->bNoWarnings)
  ------------------
  |  Branch (719:21): [True: 0, False: 0]
  ------------------
  720|      0|                {
  721|      0|                    WarningMessage( sd->pStrErrStruct, "Charges were rearranged" );
  ------------------
  |  |  160|      0|#define WarningMessage AddErrorMessage
  ------------------
  722|      0|                }
  723|      0|                if (sd->nErrorType < _IS_WARNING)
  ------------------
  |  |   39|      0|#define _IS_WARNING 1
  ------------------
  |  Branch (723:21): [True: 0, False: 0]
  ------------------
  724|      0|                {
  725|      0|                    sd->nErrorType = _IS_WARNING;
  ------------------
  |  |   39|      0|#define _IS_WARNING 1
  ------------------
  726|      0|                }
  727|      0|                sd->bTautFlagsDone[INCHI_REC] |= TG_FLAG_FIX_ODD_THINGS_DONE;
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                              sd->bTautFlagsDone[INCHI_REC] |= TG_FLAG_FIX_ODD_THINGS_DONE;
  ------------------
  |  |  975|      0|#define TG_FLAG_FIX_ODD_THINGS_DONE      0x00000800   /* fixed drawing ambiguities in fix_odd_things */
  ------------------
  728|      0|                sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_FIX_ODD_THINGS_DONE;
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                              sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_FIX_ODD_THINGS_DONE;
  ------------------
  |  |  975|      0|#define TG_FLAG_FIX_ODD_THINGS_DONE      0x00000800   /* fixed drawing ambiguities in fix_odd_things */
  ------------------
  729|      0|            }
  730|      0|#endif
  731|       |
  732|       |            /*
  733|       |              if prep_inp_data->nOldCompNumber[i] = iINChI+1 > 0 then
  734|       |              component #(i+1) in prep_inp_data is identical to component #(iINChI+1) in prep_inp_data+1
  735|       |            */
  736|      0|        }
  737|      0|        else if (i < 0)
  ------------------
  |  Branch (737:18): [True: 0, False: 0]
  ------------------
  738|      0|        {
  739|      0|            AddErrorMessage( sd->pStrErrStruct, "Cannot disconnect metal error" );
  740|      0|            sd->nStructReadError = i;
  741|      0|            sd->nErrorType = _IS_ERROR;
  ------------------
  |  |   40|      0|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  742|      0|            goto exit_function;
  743|      0|        }
  744|      0|    }
  745|  54.6k|    else
  746|  54.6k|    {
  747|       |        /* Remove "disconnected structure parities" from the structure */
  748|  54.6k|        int k, m, p;
  749|  54.6k|        inp_ATOM *at = ( prep_inp_data )->at;
  750|  54.6k|        int       num_at = ( prep_inp_data )->num_inp_atoms;
  751|   109k|        for (k = 0; k < num_at; k++)
  ------------------
  |  Branch (751:21): [True: 54.6k, False: 54.6k]
  ------------------
  752|  54.6k|        {
  753|  54.6k|            for (m = 0; m < MAX_NUM_STEREO_BONDS && ( p = at[k].sb_parity[m] ); m++)
  ------------------
  |  |  876|   109k|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (753:25): [True: 54.6k, False: 0]
  |  Branch (753:53): [True: 0, False: 54.6k]
  ------------------
  754|      0|            {
  755|      0|                at[k].sb_parity[m] &= SB_PARITY_MASK;
  ------------------
  |  |   96|      0|#define SB_PARITY_MASK  0x07
  ------------------
  756|      0|            }
  757|  54.6k|        }
  758|  54.6k|    }
  759|       |
  760|  54.6k|exit_function:
  761|       |
  762|  54.6k|if (sd->nErrorType < _IS_ERROR && prep_inp_data)
  ------------------
  |  |   40|   109k|#define _IS_ERROR   2    /* Microsoft defined its own IS_ERROR() macro */
  ------------------
  |  Branch (762:5): [True: 54.6k, False: 0]
  |  Branch (762:35): [True: 54.6k, False: 0]
  ------------------
  763|  54.6k|    {
  764|  54.6k|        if (0 < post_fix_odd_things( prep_inp_data->num_inp_atoms, prep_inp_data->at ))
  ------------------
  |  Branch (764:13): [True: 0, False: 54.6k]
  ------------------
  765|      0|        {
  766|      0|            if (!ip->bNoWarnings)
  ------------------
  |  Branch (766:17): [True: 0, False: 0]
  ------------------
  767|      0|            {
  768|      0|                WarningMessage( sd->pStrErrStruct, "Charges were rearranged" );
  ------------------
  |  |  160|      0|#define WarningMessage AddErrorMessage
  ------------------
  769|      0|            }
  770|      0|            if (sd->nErrorType < _IS_WARNING)
  ------------------
  |  |   39|      0|#define _IS_WARNING 1
  ------------------
  |  Branch (770:17): [True: 0, False: 0]
  ------------------
  771|      0|            {
  772|      0|                sd->nErrorType = _IS_WARNING;
  ------------------
  |  |   39|      0|#define _IS_WARNING 1
  ------------------
  773|      0|            }
  774|      0|            sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_FIX_ODD_THINGS_DONE;
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                          sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_FIX_ODD_THINGS_DONE;
  ------------------
  |  |  975|      0|#define TG_FLAG_FIX_ODD_THINGS_DONE      0x00000800   /* fixed drawing ambiguities in fix_odd_things */
  ------------------
  775|      0|        }
  776|  54.6k|        if (( sd->bTautFlagsDone[INCHI_BAS] & TG_FLAG_DISCONNECT_COORD_DONE ) &&
  ------------------
  |  |  575|  54.6k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                      if (( sd->bTautFlagsDone[INCHI_BAS] & TG_FLAG_DISCONNECT_COORD_DONE ) &&
  ------------------
  |  |  972|  54.6k|#define TG_FLAG_DISCONNECT_COORD_DONE    0x00000100   /* found and disconnected "coord. centers" */
  ------------------
  |  Branch (776:13): [True: 0, False: 54.6k]
  ------------------
  777|  54.6k|            ( prep_inp_data + 1 )->at && ( prep_inp_data + 1 )->num_inp_atoms > 0)
  ------------------
  |  Branch (777:13): [True: 0, False: 0]
  |  Branch (777:42): [True: 0, False: 0]
  ------------------
  778|      0|        {
  779|      0|            if (0 < post_fix_odd_things( ( prep_inp_data + 1 )->num_inp_atoms, ( prep_inp_data + 1 )->at ))
  ------------------
  |  Branch (779:17): [True: 0, False: 0]
  ------------------
  780|      0|            {
  781|      0|                if (!ip->bNoWarnings)
  ------------------
  |  Branch (781:21): [True: 0, False: 0]
  ------------------
  782|      0|                {
  783|      0|                    WarningMessage( sd->pStrErrStruct, "Charges were rearranged" );
  ------------------
  |  |  160|      0|#define WarningMessage AddErrorMessage
  ------------------
  784|      0|                }
  785|      0|                if (sd->nErrorType < _IS_WARNING)
  ------------------
  |  |   39|      0|#define _IS_WARNING 1
  ------------------
  |  Branch (785:21): [True: 0, False: 0]
  ------------------
  786|      0|                {
  787|      0|                    sd->nErrorType = _IS_WARNING;
  ------------------
  |  |   39|      0|#define _IS_WARNING 1
  ------------------
  788|      0|                }
  789|      0|                sd->bTautFlagsDone[INCHI_REC] |= TG_FLAG_FIX_ODD_THINGS_DONE;
  ------------------
  |  |  576|      0|#define INCHI_REC            1    /* 1 => reconnected */
  ------------------
                              sd->bTautFlagsDone[INCHI_REC] |= TG_FLAG_FIX_ODD_THINGS_DONE;
  ------------------
  |  |  975|      0|#define TG_FLAG_FIX_ODD_THINGS_DONE      0x00000800   /* fixed drawing ambiguities in fix_odd_things */
  ------------------
  790|      0|                sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_FIX_ODD_THINGS_DONE;
  ------------------
  |  |  575|      0|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
                              sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_FIX_ODD_THINGS_DONE;
  ------------------
  |  |  975|      0|#define TG_FLAG_FIX_ODD_THINGS_DONE      0x00000800   /* fixed drawing ambiguities in fix_odd_things */
  ------------------
  791|      0|            }
  792|      0|        }
  793|  54.6k|    }
  794|       |
  795|  54.6k|    sd->bTautFlags[INCHI_BAS] |= bTautFlags;  /* TG_FLAG_CHECK_VALENCE_COORD_DONE, TG_FLAG_MOVE_CHARGE_COORD_DONE */
  ------------------
  |  |  575|  54.6k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  796|  54.6k|    sd->bTautFlagsDone[INCHI_BAS] |= bTautFlagsDone;  /* TG_FLAG_CHECK_VALENCE_COORD_DONE, TG_FLAG_MOVE_CHARGE_COORD_DONE */
  ------------------
  |  |  575|  54.6k|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  797|       |
  798|  54.6k|    return sd->nErrorType;
  799|  54.6k|}
OAD_PolymerUnit_New:
 1137|  16.2k|{
 1138|  16.2k|    int k, err = 0;
 1139|  16.2k|    OAD_PolymerUnit *u2 = NULL;
 1140|       |
 1141|  16.2k|    u2 = (OAD_PolymerUnit*) inchi_calloc( 1, sizeof( OAD_PolymerUnit ) );
  ------------------
  |  | 1133|  16.2k|#define inchi_calloc   calloc
  ------------------
 1142|  16.2k|    if (NULL == u2)
  ------------------
  |  Branch (1142:9): [True: 0, False: 16.2k]
  ------------------
 1143|      0|    {
 1144|      0|        err = 1;
 1145|      0|        goto exit_function;
 1146|      0|    }
 1147|       |
 1148|  16.2k|    u2->id = id;
 1149|  16.2k|    u2->label = label;
 1150|  16.2k|    u2->type = type;
 1151|  16.2k|    u2->subtype = subtype;
 1152|  16.2k|    u2->conn = conn;
 1153|  16.2k|    u2->na = na;
 1154|  16.2k|    u2->nb = nb;
 1155|  16.2k|    u2->cyclizable = CLOSING_SRU_NOT_APPLICABLE;
  ------------------
  |  |   51|  16.2k|#define CLOSING_SRU_NOT_APPLICABLE 0
  ------------------
 1156|  16.2k|    u2->cyclized = 0;
 1157|  81.1k|    for (k = 0; k < 4; k++)
  ------------------
  |  Branch (1157:17): [True: 64.8k, False: 16.2k]
  ------------------
 1158|  64.8k|    {
 1159|  64.8k|        u2->xbr1[k] = 0.0;
 1160|  64.8k|        u2->xbr2[k] = 0.0;
 1161|  64.8k|    }
 1162|  16.2k|    strcpy( u2->smt, smt );
 1163|  16.2k|    u2->cap1 = -1;
 1164|  16.2k|    u2->end_atom1 = -1;
 1165|  16.2k|    u2->cap2 = -1;
 1166|  16.2k|    u2->end_atom2 = -1;
 1167|  16.2k|    u2->maxbkbonds = maxbonds;
 1168|  16.2k|    u2->nbkbonds = nbkbonds;
 1169|  16.2k|    u2->cap1_is_undef = 0;
 1170|  16.2k|    u2->cap2_is_undef = 0;
 1171|       |
 1172|  16.2k|    u2->alist = NULL;
 1173|  16.2k|    if (na > 0 || maxatoms > 0)
  ------------------
  |  Branch (1173:9): [True: 16.2k, False: 0]
  |  Branch (1173:19): [True: 0, False: 0]
  ------------------
 1174|  16.2k|    {
 1175|  16.2k|        u2->alist	= (int *) inchi_calloc( na > 0 ? na : maxatoms, sizeof( int ) );
  ------------------
  |  | 1133|  16.2k|#define inchi_calloc   calloc
  ------------------
  |  Branch (1175:43): [True: 16.2k, False: 0]
  ------------------
 1176|  16.2k|        if (!u2->alist )
  ------------------
  |  Branch (1176:13): [True: 0, False: 16.2k]
  ------------------
 1177|      0|        {
 1178|      0|            err = 2;
 1179|      0|            goto exit_function;
 1180|      0|        }
 1181|  33.2k|        for (k = 0; k < na; k++)
  ------------------
  |  Branch (1181:21): [True: 16.9k, False: 16.2k]
  ------------------
 1182|  16.9k|        {
 1183|  16.9k|            u2->alist[k]	= alist->item[k];
 1184|  16.9k|        }
 1185|  16.2k|    }
 1186|  16.2k|    u2->blist = NULL;
 1187|  16.2k|    if (nb > 0 || maxbonds > 0)
  ------------------
  |  Branch (1187:9): [True: 0, False: 16.2k]
  |  Branch (1187:19): [True: 0, False: 16.2k]
  ------------------
 1188|      0|    {
 1189|      0|        u2->blist = (int *) inchi_calloc( nb > 0 ? 2 * nb : 2 * maxbonds, sizeof( int ) );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
  |  Branch (1189:43): [True: 0, False: 0]
  ------------------
 1190|      0|        if (!u2->blist)
  ------------------
  |  Branch (1190:13): [True: 0, False: 0]
  ------------------
 1191|      0|        {
 1192|      0|            err = 3;
 1193|      0|            goto exit_function;
 1194|      0|        }
 1195|      0|        if (blist)
  ------------------
  |  Branch (1195:13): [True: 0, False: 0]
  ------------------
 1196|      0|        {
 1197|      0|            for (k = 0; k < 2 * nb; k++)
  ------------------
  |  Branch (1197:25): [True: 0, False: 0]
  ------------------
 1198|      0|            {
 1199|      0|                u2->blist[k]	= blist->item[k];
 1200|      0|            }
 1201|      0|        }
 1202|       |        
 1203|      0|    }
 1204|  16.2k|    u2->bkbonds = NULL;
 1205|       |    
 1206|  16.2k|exit_function:
 1207|       |
 1208|  16.2k|    if (err)
  ------------------
  |  Branch (1208:9): [True: 0, False: 16.2k]
  ------------------
 1209|      0|    {
 1210|      0|        OAD_PolymerUnit_Free( u2 );
 1211|      0|        return NULL;
 1212|      0|    }
 1213|       |
 1214|  16.2k|    return u2;
 1215|  16.2k|}
OAD_PolymerUnit_Free:
 1304|  22.2k|{
 1305|       |
 1306|  22.2k|    ITRACE_( "\n************** About to free OAD_PolymerUnit @ %-p\n", unit );
  ------------------
  |  |  126|  22.2k|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (126:17): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (1306:5): [True: 0, False: 0]
  ------------------
 1307|  22.2k|    OAD_PolymerUnit_DebugTrace( unit );
 1308|       |
 1309|  22.2k|    if (unit)
  ------------------
  |  Branch (1309:9): [True: 16.2k, False: 6.05k]
  ------------------
 1310|  16.2k|    {
 1311|  16.2k|        if (unit->alist)
  ------------------
  |  Branch (1311:13): [True: 16.2k, False: 0]
  ------------------
 1312|  16.2k|        {
 1313|  16.2k|            inchi_free( unit->alist );
  ------------------
  |  | 1136|  16.2k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 16.2k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1314|  16.2k|            unit->alist = NULL;
 1315|  16.2k|        }
 1316|  16.2k|        if (unit->blist)
  ------------------
  |  Branch (1316:13): [True: 0, False: 16.2k]
  ------------------
 1317|      0|        {
 1318|      0|            inchi_free( unit->blist );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1319|      0|            unit->blist = NULL;
 1320|      0|        }
 1321|  16.2k|        if (unit->bkbonds)
  ------------------
  |  Branch (1321:13): [True: 722, False: 15.4k]
  ------------------
 1322|    722|        {
 1323|    722|            imat_free( unit->maxbkbonds, unit->bkbonds );
 1324|    722|            unit->bkbonds = NULL;
 1325|    722|        }
 1326|  16.2k|    }
 1327|       |
 1328|  22.2k|    inchi_free( unit );
  ------------------
  |  | 1136|  22.2k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 16.2k, False: 6.05k]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1329|       |
 1330|  22.2k|    return;
 1331|  22.2k|}
UnMarkRingSystemsInp:
 1922|      7|{
 1923|      7|    int i;
 1924|     34|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1924:17): [True: 27, False: 7]
  ------------------
 1925|     27|    {
 1926|     27|        at[i].bCutVertex = 0;
 1927|     27|        at[i].nRingSystem = 0;
 1928|     27|        at[i].nNumAtInRingSystem = 0;
 1929|     27|        at[i].nBlockSystem = 0;
 1930|     27|    }
 1931|       |
 1932|      7|    return 0;
 1933|      7|}
OAD_Polymer_Free:
 2032|   164k|{
 2033|   164k|    if (pd)
  ------------------
  |  Branch (2033:9): [True: 126, False: 164k]
  ------------------
 2034|    126|    {
 2035|    126|        if (pd->pzz)
  ------------------
  |  Branch (2035:13): [True: 0, False: 126]
  ------------------
 2036|      0|        {
 2037|      0|            inchi_free( pd->pzz );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2038|      0|            pd->pzz = NULL;
 2039|      0|            pd->n_pzz = 0;
 2040|      0|        }
 2041|    126|        if (pd->n && pd->units)
  ------------------
  |  Branch (2041:13): [True: 62, False: 64]
  |  Branch (2041:22): [True: 62, False: 0]
  ------------------
 2042|     62|        {
 2043|     62|            int k;
 2044|  22.3k|            for (k = 0; k < pd->n; k++)
  ------------------
  |  Branch (2044:25): [True: 22.2k, False: 62]
  ------------------
 2045|  22.2k|            {
 2046|  22.2k|                OAD_PolymerUnit_Free( pd->units[k] );
 2047|  22.2k|            }
 2048|     62|            inchi_free( pd->units );
  ------------------
  |  | 1136|     62|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 62, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2049|     62|            pd->units = NULL;
 2050|     62|            pd->n = 0;
 2051|     62|        }
 2052|    126|        inchi_free( pd );
  ------------------
  |  | 1136|    126|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 126, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2053|    126|        pd = NULL;
 2054|    126|    }
 2055|       |
 2056|   164k|    return;
 2057|   164k|}
OAD_Polymer_FindRingSystems:
 3186|      7|{
 3187|      7|    int i, j, nrings = 0, bond_type, bond_stereo;
 3188|       |
 3189|      7|    if (NULL == num_ring_sys)
  ------------------
  |  Branch (3189:9): [True: 0, False: 7]
  ------------------
 3190|      0|    {
 3191|      0|        return 0;
 3192|      0|    }
 3193|       |
 3194|       |    /* Remove polymer SRU 'cyclizing' bonds if any */
 3195|  8.47k|    for (j = 0; j < pd->n; j++)
  ------------------
  |  Branch (3195:17): [True: 8.46k, False: 7]
  ------------------
 3196|  8.46k|    {
 3197|  8.46k|        if (pd->units[j]->cyclized)
  ------------------
  |  Branch (3197:13): [True: 0, False: 8.46k]
  ------------------
 3198|      0|        {
 3199|      0|            OrigAtData_RemoveBond( pd->units[j]->end_atom1 - 1,
 3200|      0|                                   pd->units[j]->end_atom2 - 1,
 3201|      0|                                   at, &bond_type, &bond_stereo,
 3202|      0|                                   num_inp_bonds );
 3203|      0|        }
 3204|  8.46k|    }
 3205|       |
 3206|      7|    MarkRingSystemsInp( at, nat, start ); /*0 );*/
 3207|       |
 3208|     41|    for (i = 0; i <= nat; i++)
  ------------------
  |  Branch (3208:17): [True: 34, False: 7]
  ------------------
 3209|     34|    {
 3210|     34|        num_ring_sys[i] = -1;
 3211|     34|    }
 3212|     34|    for (i = 0; i < nat; i++)
  ------------------
  |  Branch (3212:17): [True: 27, False: 7]
  ------------------
 3213|     27|    {
 3214|     27|        if (at[i].nNumAtInRingSystem > 2)
  ------------------
  |  Branch (3214:13): [True: 0, False: 27]
  ------------------
 3215|      0|        {
 3216|      0|            int atnum = at[i].orig_at_number;
 3217|      0|            num_ring_sys[atnum] = at[i].nRingSystem;
 3218|      0|            if (NULL != size_ring_sys)
  ------------------
  |  Branch (3218:17): [True: 0, False: 0]
  ------------------
 3219|      0|            {
 3220|      0|                size_ring_sys[atnum] = at[i].nNumAtInRingSystem;
 3221|      0|            }
 3222|      0|        }
 3223|     27|    }
 3224|       |
 3225|      7|    UnMarkRingSystemsInp( at, nat );
 3226|       |
 3227|     34|    for (i = 0; i < nat; i++)
  ------------------
  |  Branch (3227:17): [True: 27, False: 7]
  ------------------
 3228|     27|    {
 3229|     27|        if (num_ring_sys[i] > -1)
  ------------------
  |  Branch (3229:13): [True: 0, False: 27]
  ------------------
 3230|      0|        {
 3231|      0|            nrings++;
 3232|      0|        }
 3233|     27|    }
 3234|       |
 3235|       |    /* Restore polymer SRU 'cyclizing' bonds if applicable */
 3236|  8.47k|    for (j = 0; j < pd->n; j++)
  ------------------
  |  Branch (3236:17): [True: 8.46k, False: 7]
  ------------------
 3237|  8.46k|    {
 3238|  8.46k|        if (pd->units[j]->cyclized)
  ------------------
  |  Branch (3238:13): [True: 0, False: 8.46k]
  ------------------
 3239|      0|        {
 3240|      0|            OrigAtData_AddSingleStereolessBond( pd->units[j]->end_atom1 - 1,
 3241|      0|                                                pd->units[j]->end_atom2 - 1,
 3242|      0|                                                at,
 3243|      0|                                                num_inp_bonds );
 3244|      0|        }
 3245|  8.46k|    }
 3246|       |
 3247|      7|    return nrings;
 3248|      7|}
OAD_Polymer_SetAtProps:
 3261|      7|{
 3262|       |/*  Max rank for in-ring atom is 216 which is achieved for N (element number 7 in Periodic system & erank_rule2[] ),*/
 3263|       |/*    then goes O with rank 215 (element number 8), and so on... lowest rank is 1 for H .                           */
 3264|       |/*                                                                                                                  */
 3265|       |/*  This follows to IUPAC rule 2 [Pure Appl. Chem., Vol. 74, No. 10, 2002, p. 1926] which states:                   */
 3266|       |/*  a. a ring or ring system containing nitrogen;                                                                   */
 3267|       |/*  b. a ring or ring system containing the heteroatom occurring earliest in the order given in Rule 4;             */
 3268|       |/*  ( which is     O > S > Se > Te > N > P > As > Sb > Bi > Si > Ge > Sn > Pb > B > Hg )                            */
 3269|       |/*  ...                                                                                                             */
 3270|       |
 3271|      7|    int erank_rule2[] = { 0,1,198,197,196,202,2,216,215,191,190,189,188,187,206,210,214,183,182,181,180,179,178,177,176,
 3272|      7|                          175,174,173,172,171,170,169,205,209,213,165,164,163,162,161,160,159,158,157,156,155,154,153,152,
 3273|      7|                          151,204,208,212,147,146,145,144,143,142,141,140,139,138,137,136,135,134,133,132,131,130,129,128,
 3274|      7|                          127,126,125,124,123,122,121,201,119,203,207,116,115,114,113,112,111,110,109,108,107,106,105,104,
 3275|      7|                          103,102,101,100,99,98,97,96,95,94,93,92,91,90,89,88,87,86,85,84,83,82,81 };
 3276|       |
 3277|       |
 3278|       |
 3279|       |    /*  Max rank for chain atom is 215 which is achieved for O (element number 8 in Periodic system & erank_rule4[] ),  */
 3280|       |    /*  then goes N with rank 212 (element number 8), and so on... lowest rank is 1 for H .                             */
 3281|       |    /*                                                                                                                  */
 3282|       |    /*  This follows to IUPAC rule 4 [Pure Appl. Chem., Vol. 74, No. 10, 2002, p. 1927] which states:                   */
 3283|       |    /*  O > S > Se > Te > N > P > As > Sb > Bi > Si > Ge > Sn > Pb > B > Hg                                             */
 3284|       |    /*  Note: Other heteroatoms may be placed within this order as indicated by their positions in the                  */
 3285|       |    /*  periodic table [5].                                                                                             */
 3286|       |
 3287|      7|    int erank_rule4[] = { 0,1,198,197,196,202,2,211,215,191,190,189,188,187,206,210,214,183,182,181,180,179,178,177,176,
 3288|      7|                          175,174,173,172,171,170,169,205,209,213,165,164,163,162,161,160,159,158,157,156,155,154,153,152,
 3289|      7|                          151,204,208,212,147,146,145,144,143,142,141,140,139,138,137,136,135,134,133,132,131,130,129,128,
 3290|      7|                          127,126,125,124,123,122,121,201,119,203,207,116,115,114,113,112,111,110,109,108,107,106,105,104,
 3291|      7|                          103,102,101,100,99,98,97,96,95,94,93,92,91,90,89,88,87,86,85,84,83,82,81 };
 3292|       |
 3293|       |
 3294|      7|    int i, j, k, nrings = 0;
 3295|      7|    int a1, a2, dummy = 0, bond_type = -1, bond_stereo = -1;
 3296|      7|    int *num_ring_sys = NULL, *size_ring_sys = NULL;
 3297|       |
 3298|      7|    if (NULL == aprops)
  ------------------
  |  Branch (3298:9): [True: 0, False: 7]
  ------------------
 3299|      0|    {
 3300|      0|        return;
 3301|      0|    }
 3302|       |
 3303|       |    /* Establish element ranks for atoms */
 3304|     34|    for (k = 0; k < nat; k++)
  ------------------
  |  Branch (3304:17): [True: 27, False: 7]
  ------------------
 3305|     27|    {
 3306|     27|        int atnum = at[k].orig_at_number, index = k;
 3307|     27|        if (cano_nums)
  ------------------
  |  Branch (3307:13): [True: 0, False: 27]
  ------------------
 3308|      0|        {
 3309|      0|            index = cano_nums[atnum];
 3310|      0|        }
 3311|     27|        if (index >= 0)
  ------------------
  |  Branch (3311:13): [True: 27, False: 0]
  ------------------
 3312|     27|        {
 3313|     27|            aprops[index].erank = erank_rule4[at[k].el_number];
 3314|     27|            aprops[index].ring_erank = 0;
 3315|     27|            aprops[index].ring_size = 0;
 3316|     27|            aprops[index].ring_num = -1;
 3317|     27|        }
 3318|      0|        else
 3319|      0|        {
 3320|       |            /* deleted H's go here */
 3321|      0|            ;
 3322|      0|        }
 3323|       |
 3324|     27|    }
 3325|       |
 3326|       |    /* Establish ring systems assignments for atoms */
 3327|      7|    num_ring_sys = (int *) inchi_calloc( nat + 1, sizeof( int ) );
  ------------------
  |  | 1133|      7|#define inchi_calloc   calloc
  ------------------
 3328|      7|    if (NULL == num_ring_sys)
  ------------------
  |  Branch (3328:9): [True: 0, False: 7]
  ------------------
 3329|      0|    {
 3330|      0|        goto exit_function;
 3331|      0|    }
 3332|      7|    size_ring_sys = (int *) inchi_calloc( nat + 1, sizeof( int ) );
  ------------------
  |  | 1133|      7|#define inchi_calloc   calloc
  ------------------
 3333|      7|    if (NULL == size_ring_sys)
  ------------------
  |  Branch (3333:9): [True: 0, False: 7]
  ------------------
 3334|      0|    {
 3335|      0|        goto exit_function;
 3336|      0|    }
 3337|       |
 3338|       |    /* Note that we get here on the way of InChI2Struct conversion.            */
 3339|       |    /* Break temporarily any of (actually, the first) SRU 'cyclizing' bonds    */
 3340|  8.47k|    for (j = 0; j < pd->n; j++)
  ------------------
  |  Branch (3340:17): [True: 8.46k, False: 7]
  ------------------
 3341|  8.46k|    {
 3342|  8.46k|        if (pd->units[j]->na > 2 && pd->units[j]->nbkbonds > 0 &&
  ------------------
  |  Branch (3342:13): [True: 259, False: 8.20k]
  |  Branch (3342:37): [True: 0, False: 259]
  ------------------
 3343|  8.46k|             pd->units[j]->cyclized == 0 &&
  ------------------
  |  Branch (3343:14): [True: 0, False: 0]
  ------------------
 3344|  8.46k|             pd->units[j]->cyclizable == CLOSING_SRU_RING)
  ------------------
  |  |   52|      0|#define CLOSING_SRU_RING 1
  ------------------
  |  Branch (3344:14): [True: 0, False: 0]
  ------------------
 3345|      0|        {
 3346|      0|            a1 = pd->units[j]->bkbonds[0][0] - 1;
 3347|      0|            a2 = pd->units[j]->bkbonds[0][1] - 1;
 3348|      0|            OrigAtData_RemoveBond( a1, a2, at, &bond_type, &bond_stereo, &dummy );
 3349|      0|        }
 3350|  8.46k|    }
 3351|       |
 3352|      7|    nrings = OAD_Polymer_FindRingSystems( pd, at, nat, num_inp_bonds, num_ring_sys, size_ring_sys, 0 );
 3353|       |
 3354|       |    /* Immediately restore just broken bond(s) */
 3355|  8.47k|    for (j = 0; j < pd->n; j++)
  ------------------
  |  Branch (3355:17): [True: 8.46k, False: 7]
  ------------------
 3356|  8.46k|    {
 3357|  8.46k|        if (pd->units[j]->na > 2 &&
  ------------------
  |  Branch (3357:13): [True: 259, False: 8.20k]
  ------------------
 3358|  8.46k|             pd->units[j]->nbkbonds > 0 &&
  ------------------
  |  Branch (3358:14): [True: 0, False: 259]
  ------------------
 3359|  8.46k|             pd->units[j]->cyclized == 0 &&
  ------------------
  |  Branch (3359:14): [True: 0, False: 0]
  ------------------
 3360|  8.46k|             pd->units[j]->cyclizable == CLOSING_SRU_RING)
  ------------------
  |  |   52|      0|#define CLOSING_SRU_RING 1
  ------------------
  |  Branch (3360:14): [True: 0, False: 0]
  ------------------
 3361|      0|        {
 3362|      0|            a1 = pd->units[j]->bkbonds[0][0] - 1;
 3363|      0|            a2 = pd->units[j]->bkbonds[0][1] - 1;
 3364|       |            /* OrigAtData_AddSingleStereolessBond( a1, a2, at, &dummy ); */
 3365|      0|            OrigAtData_AddBond( a1, a2, at, bond_type, bond_stereo, &dummy );
 3366|      0|        }
 3367|  8.46k|    }
 3368|       |
 3369|      7|    if (nrings)
  ------------------
  |  Branch (3369:9): [True: 0, False: 7]
  ------------------
 3370|      0|    {
 3371|      0|        int max_ring_num = 0;
 3372|       |        /* SRU contains ring[s], proceed with them following (not totally) the IUPAC guidelines */
 3373|      0|        for (k = 0; k < nat; k++)
  ------------------
  |  Branch (3373:21): [True: 0, False: 0]
  ------------------
 3374|      0|        {
 3375|       |            /* Browse 0-based original atoms, go to 1-based cano nums domain if cano_nums mapping is suppied */
 3376|      0|            int atnum = at[k].orig_at_number, index = k;
 3377|      0|            if (cano_nums)
  ------------------
  |  Branch (3377:17): [True: 0, False: 0]
  ------------------
 3378|      0|            {
 3379|      0|                index = cano_nums[atnum] + 1;
 3380|      0|            }
 3381|      0|            if (num_ring_sys[atnum] >= 0)
  ------------------
  |  Branch (3381:17): [True: 0, False: 0]
  ------------------
 3382|      0|            {
 3383|      0|                aprops[index].ring_num = num_ring_sys[atnum];  /* temporarily */
 3384|       |
 3385|      0|                if (max_ring_num < aprops[index].ring_num)
  ------------------
  |  Branch (3385:21): [True: 0, False: 0]
  ------------------
 3386|      0|                    max_ring_num = aprops[index].ring_num;          /* NB: OAD_Polymer_FindRingSystems may return num_ring_sys[]  */
 3387|       |                                                                    /* which is not a list of consecutive numbers                 */
 3388|       |
 3389|      0|                aprops[index].ring_size = size_ring_sys[atnum];     /* Size of ring system which includes the atom k .            */
 3390|       |                                                                    /* It is used as an additional score for in-ring              */
 3391|       |                                                                    /* atoms' prioritizing (instead of criteria in                */
 3392|       |                                                                    /* 2c-2h of IUPAC rule 2 which deal with ring sizes).         */
 3393|      0|            }
 3394|      0|        }
 3395|       |
 3396|      0|        for (i = 0; i <= max_ring_num; i++)
  ------------------
  |  Branch (3396:21): [True: 0, False: 0]
  ------------------
 3397|      0|        {
 3398|      0|            int erank, max_erank = 0;
 3399|      0|            for (k = 0; k < nat; k++)
  ------------------
  |  Branch (3399:25): [True: 0, False: 0]
  ------------------
 3400|      0|            {
 3401|      0|                int atnum = at[k].orig_at_number, index = k;
 3402|      0|                if (cano_nums)
  ------------------
  |  Branch (3402:21): [True: 0, False: 0]
  ------------------
 3403|      0|                {
 3404|      0|                    index = cano_nums[atnum] + 1;
 3405|      0|                }
 3406|      0|                if (aprops[index].ring_num == i)
  ------------------
  |  Branch (3406:21): [True: 0, False: 0]
  ------------------
 3407|      0|                {
 3408|      0|                    erank = erank_rule2[at[k].el_number];
 3409|      0|                    if (erank > max_erank)
  ------------------
  |  Branch (3409:25): [True: 0, False: 0]
  ------------------
 3410|      0|                        max_erank = erank;
 3411|      0|                }
 3412|      0|            }
 3413|      0|            for (k = 0; k < nat; k++)
  ------------------
  |  Branch (3413:25): [True: 0, False: 0]
  ------------------
 3414|      0|            {
 3415|      0|                int atnum = at[k].orig_at_number, index = k;
 3416|      0|                if (cano_nums)
  ------------------
  |  Branch (3416:21): [True: 0, False: 0]
  ------------------
 3417|      0|                {
 3418|      0|                    index = cano_nums[atnum] + 1;
 3419|      0|                }
 3420|      0|                if (aprops[index].ring_num == i)
  ------------------
  |  Branch (3420:21): [True: 0, False: 0]
  ------------------
 3421|      0|                {
 3422|      0|                    if (aprops[index].ring_size > 2)
  ------------------
  |  Branch (3422:25): [True: 0, False: 0]
  ------------------
 3423|      0|                    {
 3424|      0|                        aprops[index].ring_erank = max_erank;
 3425|      0|                    }
 3426|      0|                }
 3427|      0|            }
 3428|      0|        }
 3429|      0|    }
 3430|       |
 3431|      7|exit_function:
 3432|      7|    if (num_ring_sys)
  ------------------
  |  Branch (3432:9): [True: 7, False: 0]
  ------------------
 3433|      7|    {
 3434|      7|        inchi_free( num_ring_sys );
  ------------------
  |  | 1136|      7|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 7, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3435|      7|    }
 3436|      7|    if (size_ring_sys)
  ------------------
  |  Branch (3436:9): [True: 7, False: 0]
  ------------------
 3437|      7|    {
 3438|      7|        inchi_free( size_ring_sys );
  ------------------
  |  | 1136|      7|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 7, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3439|      7|    }
 3440|       |
 3441|      7|    return;
 3442|      7|}
OAD_PolymerUnit_DebugTrace:
 3582|  22.2k|{
 3583|  22.2k|    char *conn = "ABSENT", *typ = "ABSENT", *styp = "ABSENT";
 3584|       |
 3585|  22.2k|    if (!u)
  ------------------
  |  Branch (3585:9): [True: 6.05k, False: 16.2k]
  ------------------
 3586|  6.05k|    {
 3587|  6.05k|        return;
 3588|  6.05k|    }
 3589|       |
 3590|  16.2k|    if (u->conn == 1)
  ------------------
  |  Branch (3590:9): [True: 2.09k, False: 14.1k]
  ------------------
 3591|  2.09k|    {
 3592|  2.09k|        conn = "HT";
 3593|  2.09k|    }
 3594|  14.1k|    else if (u->conn == 2)
  ------------------
  |  Branch (3594:14): [True: 2.29k, False: 11.8k]
  ------------------
 3595|  2.29k|    {
 3596|  2.29k|        conn = "HH";
 3597|  2.29k|    }
 3598|  11.8k|    else if (u->conn == 3)
  ------------------
  |  Branch (3598:14): [True: 5, False: 11.8k]
  ------------------
 3599|      5|    {
 3600|      5|        conn = "EU";
 3601|      5|    }
 3602|       |
 3603|  16.2k|    if (u->type == 0)
  ------------------
  |  Branch (3603:9): [True: 16.2k, False: 0]
  ------------------
 3604|  16.2k|    {
 3605|  16.2k|        typ = "NONE";
 3606|  16.2k|    }
 3607|      0|    else if (u->type == 1)
  ------------------
  |  Branch (3607:14): [True: 0, False: 0]
  ------------------
 3608|      0|    {
 3609|      0|        typ = "SRU";
 3610|      0|    }
 3611|      0|    else if (u->type == 2)
  ------------------
  |  Branch (3611:14): [True: 0, False: 0]
  ------------------
 3612|      0|    {
 3613|      0|        typ = "MON";
 3614|      0|    }
 3615|      0|    else if (u->type == 3)
  ------------------
  |  Branch (3615:14): [True: 0, False: 0]
  ------------------
 3616|      0|    {
 3617|      0|        typ = "COP";
 3618|      0|    }
 3619|      0|    else if (u->type == 4)
  ------------------
  |  Branch (3619:14): [True: 0, False: 0]
  ------------------
 3620|      0|    {
 3621|      0|        typ = "MOD";
 3622|      0|    }
 3623|      0|    else if (u->type == 5)
  ------------------
  |  Branch (3623:14): [True: 0, False: 0]
  ------------------
 3624|      0|    {
 3625|      0|        typ = "MER";
 3626|      0|    }
 3627|       |
 3628|  16.2k|    if (u->subtype == 1)
  ------------------
  |  Branch (3628:9): [True: 0, False: 16.2k]
  ------------------
 3629|      0|    {
 3630|      0|        styp = "ALT";
 3631|      0|    }
 3632|  16.2k|    else if (u->subtype == 2)
  ------------------
  |  Branch (3632:14): [True: 0, False: 16.2k]
  ------------------
 3633|      0|    {
 3634|      0|        styp = "RAN";
 3635|      0|    }
 3636|  16.2k|    else if (u->subtype == 3)
  ------------------
  |  Branch (3636:14): [True: 0, False: 16.2k]
  ------------------
 3637|      0|    {
 3638|      0|        styp = "BLK";
 3639|      0|    }
 3640|       |
 3641|  16.2k|    {
 3642|  16.2k|        int i, k;
 3643|  16.2k|        int na, nb;
 3644|       |
 3645|  16.2k|        ITRACE_("\n\nPOLYMER UNIT @ %-p", u);
  ------------------
  |  |  126|  16.2k|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (126:17): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (3645:9): [True: 0, False: 0]
  ------------------
 3646|       |
 3647|  16.2k|        ITRACE_( "\n\tid=%-d   label=%-d   type=%-s   subtype=%-s   conn=%-s   subscr='%-s'\n",
  ------------------
  |  |  126|  16.2k|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (126:17): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (3647:9): [True: 0, False: 0]
  ------------------
 3648|      0|                u->id, u->label, typ, styp, conn, u->smt );
 3649|       |
 3650|  16.2k|        ITRACE_( "\tBracket1 coords: %-f, %-f, %-f, %-f\n", u->xbr1[0], u->xbr1[1], u->xbr1[2], u->xbr1[3] );
  ------------------
  |  |  126|  16.2k|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (126:17): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (3650:9): [True: 0, False: 0]
  ------------------
 3651|  16.2k|        ITRACE_( "\tBracket2 coords: %-f, %-f, %-f, %-f\n", u->xbr2[0], u->xbr2[1], u->xbr2[2], u->xbr2[3] );
  ------------------
  |  |  126|  16.2k|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (126:17): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (3651:9): [True: 0, False: 0]
  ------------------
 3652|       |
 3653|  16.2k|        na = u->na;
 3654|  16.2k|        ITRACE_( "\t%-d atoms { ", na );
  ------------------
  |  |  126|  16.2k|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (126:17): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (3654:9): [True: 0, False: 0]
  ------------------
 3655|  16.9k|        for (k = 0; k < na - 1; k++)
  ------------------
  |  Branch (3655:21): [True: 774, False: 16.2k]
  ------------------
 3656|    774|        {
 3657|    774|            ITRACE_( " %-d, ", u->alist[k] );
  ------------------
  |  |  126|    774|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (126:17): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (3657:13): [True: 0, False: 0]
  ------------------
 3658|    774|        }
 3659|  16.2k|        ITRACE_( " %-d }\n", u->alist[na - 1] );
  ------------------
  |  |  126|  16.2k|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (126:17): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (3659:9): [True: 0, False: 0]
  ------------------
 3660|       |
 3661|  16.2k|        nb = u->nb;
 3662|  16.2k|        ITRACE_( "\t%-d bonds crossing unit borders { ", nb );
  ------------------
  |  |  126|  16.2k|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (126:17): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (3662:9): [True: 0, False: 0]
  ------------------
 3663|       |
 3664|  16.2k|        for (k = 0; k < nb; k++)
  ------------------
  |  Branch (3664:21): [True: 0, False: 16.2k]
  ------------------
 3665|      0|        {
 3666|      0|            ITRACE_( " %-d-%-d ", u->blist[2 * k], u->blist[2 * k + 1] );
  ------------------
  |  |  126|      0|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (126:17): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (3666:13): [True: 0, False: 0]
  ------------------
 3667|      0|        }
 3668|  16.2k|        ITRACE_( "}\n" );
  ------------------
  |  |  126|  16.2k|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (126:17): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (3668:9): [True: 0, False: 0]
  ------------------
 3669|       |
 3670|  16.2k|        ITRACE_( "\tCRU caps and end atoms { " );
  ------------------
  |  |  126|  16.2k|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (126:17): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (3670:9): [True: 0, False: 0]
  ------------------
 3671|       |
 3672|  16.2k|        ITRACE_( "*%-d-[-%-d(end1) ... ", u->cap1, u->end_atom1 );
  ------------------
  |  |  126|  16.2k|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (126:17): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (3672:9): [True: 0, False: 0]
  ------------------
 3673|  16.2k|        ITRACE_( "%-d(end2)-]-*%-d", u->end_atom2, u->cap2 );
  ------------------
  |  |  126|  16.2k|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (126:17): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (3673:9): [True: 0, False: 0]
  ------------------
 3674|  16.2k|        ITRACE_( " }\n" );
  ------------------
  |  |  126|  16.2k|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (126:17): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (3674:9): [True: 0, False: 0]
  ------------------
 3675|       |
 3676|  16.2k|        ITRACE_( "\tBackbone bonds (may include 'artificially cyclizing' one) : %-d bonds ", u->nbkbonds );
  ------------------
  |  |  126|  16.2k|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (126:17): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (3676:9): [True: 0, False: 0]
  ------------------
 3677|  16.2k|        if (u->nbkbonds)
  ------------------
  |  Branch (3677:13): [True: 722, False: 15.4k]
  ------------------
 3678|    722|        {
 3679|    722|            ITRACE_(" { ");
  ------------------
  |  |  126|    722|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (126:17): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (3679:13): [True: 0, False: 0]
  ------------------
 3680|  1.44k|            for (i = 0; i < u->nbkbonds; i++)
  ------------------
  |  Branch (3680:25): [True: 722, False: 722]
  ------------------
 3681|    722|            {
 3682|    722|                ITRACE_( "(%-d, %-d)  ", u->bkbonds[i][0], u->bkbonds[i][1] );
  ------------------
  |  |  126|    722|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (126:17): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (3682:17): [True: 0, False: 0]
  ------------------
 3683|    722|            }
 3684|    722|            ITRACE_("}\n");
  ------------------
  |  |  126|    722|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (126:17): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (3684:13): [True: 0, False: 0]
  ------------------
 3685|    722|        }
 3686|  16.2k|    }
 3687|       |    
 3688|       |
 3689|  16.2k|    return;
 3690|  22.2k|}
OAD_Polymer_SmartReopenCyclizedUnits:
 3821|      7|{
 3822|      7|    int i;
 3823|      7|    OAD_AtProps *aprops = NULL;
 3824|       |
 3825|      7|    if (!p)
  ------------------
  |  Branch (3825:9): [True: 0, False: 7]
  ------------------
 3826|      0|    {
 3827|      0|        return;
 3828|      0|    }
 3829|      7|    if (p->n < 1)
  ------------------
  |  Branch (3829:9): [True: 0, False: 7]
  ------------------
 3830|      0|    {
 3831|      0|        return;
 3832|      0|    }
 3833|      7|    if (!p->really_do_frame_shift)
  ------------------
  |  Branch (3833:9): [True: 0, False: 7]
  ------------------
 3834|      0|    {
 3835|      0|        return;
 3836|      0|    }
 3837|       |
 3838|       |    /*ITRACE_( "\n\n*********************************************************************\n* ENTERING OAD_Polymer_SmartReopenCyclizedUnits()" );
 3839|       |    OAD_Polymer_DebugTrace( p );*/
 3840|       |
 3841|       |    /* Set atom properties for sorting */
 3842|      7|    aprops = (OAD_AtProps *) inchi_calloc( nat + 1, sizeof( OAD_AtProps ) );
  ------------------
  |  | 1133|      7|#define inchi_calloc   calloc
  ------------------
 3843|       |                                        /* nat + 1: add extra element for possibe 1-based indexing */
 3844|      7|    if (!aprops)
  ------------------
  |  Branch (3844:9): [True: 0, False: 7]
  ------------------
 3845|      0|    {
 3846|      0|        return;
 3847|      0|    }
 3848|      7|    OAD_Polymer_SetAtProps( p, at, nat, num_inp_bonds, aprops, NULL ); /* NULL as we alredy are in 1-based cano_nums while at i2s/i2i*/
 3849|  8.47k|    for (i = 0; i < p->n; i++)
  ------------------
  |  Branch (3849:17): [True: 8.46k, False: 7]
  ------------------
 3850|  8.46k|    {
 3851|  8.46k|        OAD_PolymerUnit *u = p->units[i];
 3852|  8.46k|        if (p->frame_shift_scheme == FSS_NONE)
  ------------------
  |  Branch (3852:13): [True: 0, False: 8.46k]
  ------------------
 3853|      0|        {
 3854|      0|            continue;
 3855|      0|        }
 3856|  8.46k|        if ( /* !u->cyclizable || u->cyclized  || */
 3857|  8.46k|            u->nbkbonds < 1 ||
  ------------------
  |  Branch (3857:13): [True: 8.46k, False: 0]
  ------------------
 3858|  8.46k|            u->cap1 < 1 || u->cap2 < 1 ||
  ------------------
  |  Branch (3858:13): [True: 0, False: 0]
  |  Branch (3858:28): [True: 0, False: 0]
  ------------------
 3859|  8.46k|            u->cap1 > nat || u->cap2 > nat)
  ------------------
  |  Branch (3859:13): [True: 0, False: 0]
  |  Branch (3859:30): [True: 0, False: 0]
  ------------------
 3860|  8.46k|        {
 3861|  8.46k|            continue;
 3862|  8.46k|        }
 3863|      0|        if (OAD_PolymerUnit_SetReopeningDetails( u, at ))
  ------------------
  |  Branch (3863:13): [True: 0, False: 0]
  ------------------
 3864|      0|        {
 3865|      0|            int senior_bond;
 3866|      0|            OAD_PolymerUnit_SortBackboneBondsAndSetSeniors( u, at, aprops, &senior_bond );
 3867|      0|        }
 3868|      0|        OAD_PolymerUnit_ReopenCyclized( u, at, aprops, nat, num_inp_bonds );
 3869|      0|    }
 3870|       |
 3871|      7|    p->really_do_frame_shift = 0;
 3872|      7|    inchi_free( aprops );
  ------------------
  |  | 1136|      7|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 7, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3873|       |
 3874|      7|    return;
 3875|      7|}
runichi3.c:OrigAtData_bCheckUnusualValences:
   87|  54.6k|{
   88|  54.6k|    int i, val, num_found = 0;
   89|  54.6k|    char msg[32];
   90|  54.6k|    int len, num_H;
   91|       |
   92|  54.6k|    int already_here = ( orig_at_data && orig_at_data->num_inp_atoms > 0 );
  ------------------
  |  Branch (92:26): [True: 54.6k, False: 0]
  |  Branch (92:42): [True: 54.6k, False: 0]
  ------------------
   93|       |
   94|  54.6k|    inp_ATOM *at = already_here ? orig_at_data->at : NULL;
  ------------------
  |  Branch (94:20): [True: 54.6k, False: 0]
  ------------------
   95|       |
   96|  54.6k|    if (at)
  ------------------
  |  Branch (96:9): [True: 54.6k, False: 0]
  ------------------
   97|  54.6k|    {
   98|   109k|        for (i = 0, num_found = 0; i < orig_at_data->num_inp_atoms; i++)
  ------------------
  |  Branch (98:36): [True: 54.6k, False: 54.6k]
  ------------------
   99|  54.6k|        {
  100|  54.6k|            num_H = bAddIsoH ? NUMH( at, i ) : at[i].num_H;
  ------------------
  |  |   88|  54.6k|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|  54.6k|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (100:21): [True: 54.6k, False: 0]
  ------------------
  101|       |
  102|  54.6k|            val = detect_unusual_el_valence( at[i].el_number,
  103|  54.6k|                                             at[i].charge,
  104|  54.6k|                                             at[i].radical,
  105|  54.6k|                                             at[i].chem_bonds_valence,
  106|  54.6k|                                             num_H,
  107|  54.6k|                                             at[i].valence );
  108|  54.6k|            if (val)
  ------------------
  |  Branch (108:17): [True: 2, False: 54.6k]
  ------------------
  109|      2|            {
  110|      2|                num_found++;
  111|      2|                if (!bNoWarnings)
  ------------------
  |  Branch (111:21): [True: 2, False: 0]
  ------------------
  112|      2|                {
  113|      2|                    WarningMessage( pStrErrStruct, "Accepted unusual valence(s):" );
  ------------------
  |  |  160|      2|#define WarningMessage AddErrorMessage
  ------------------
  114|      2|                }
  115|      2|                len = sprintf( msg, "%s", at[i].elname );
  116|      2|                if (at[i].charge)
  ------------------
  |  Branch (116:21): [True: 2, False: 0]
  ------------------
  117|      2|                {
  118|      2|                    len += sprintf( msg + len, "%+d", at[i].charge );
  119|      2|                }
  120|      2|                if (at[i].radical)
  ------------------
  |  Branch (120:21): [True: 2, False: 0]
  ------------------
  121|      2|                {
  122|      2|                    len += sprintf( msg + len, ",%s", at[i].radical == RADICAL_SINGLET ? "s" :
  ------------------
  |  |  103|      2|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (122:55): [True: 0, False: 2]
  ------------------
  123|      2|                                                      at[i].radical == RADICAL_DOUBLET ? "d" :
  ------------------
  |  |  104|      2|#define RADICAL_DOUBLET 2
  ------------------
  |  Branch (123:55): [True: 2, False: 0]
  ------------------
  124|      2|                                                      at[i].radical == RADICAL_TRIPLET ? "t" : "?" );
  ------------------
  |  |  105|      0|#define RADICAL_TRIPLET 3
  ------------------
  |  Branch (124:55): [True: 0, False: 0]
  ------------------
  125|      2|                }
  126|      2|                len += sprintf( msg + len, "(%d)", val );
  127|      2|                if (!bNoWarnings)
  ------------------
  |  Branch (127:21): [True: 2, False: 0]
  ------------------
  128|      2|                {
  129|      2|                    WarningMessage( pStrErrStruct, msg );
  ------------------
  |  |  160|      2|#define WarningMessage AddErrorMessage
  ------------------
  130|      2|                }
  131|      2|            }
  132|  54.6k|        }
  133|  54.6k|    }
  134|       |
  135|  54.6k|    return num_found;
  136|  54.6k|}

SortAndPrintINChI:
  114|  54.6k|{
  115|  54.6k|    INCHI_SORT *pINChISort[INCHI_NUM][TAUT_NUM];
  116|  54.6k|    int j, i, k, k1, ret, ret2, iINChI, max_num_components;
  117|  54.6k|    int INCHI_basic_or_INCHI_reconnected;
  118|  54.6k|    INCHI_MODE nMode;
  119|  54.6k|    int bDisconnectedCoord = ( 0 != ( bTautFlagsDone[0] & TG_FLAG_DISCONNECT_COORD_DONE ) );
  ------------------
  |  |  972|  54.6k|#define TG_FLAG_DISCONNECT_COORD_DONE    0x00000100   /* found and disconnected "coord. centers" */
  ------------------
  120|  54.6k|    int bINChIOutputOptions0, bCurOption, bINChIOutputOptionsCur, bEmbedReconnected;
  121|  54.6k|    static const char szAnnHdr[] = "InChI ANNOTATED CONTENTS";
  122|       |#ifdef TARGET_LIB_FOR_WINCHI
  123|       |    int ikflag = 0;
  124|       |    out_file->type = INCHI_IOS_TYPE_STRING;
  125|       |#endif
  126|       |
  127|       |    /*
  128|       |        Note:
  129|       |
  130|       |        pINChI[INCHI_BAS] refers to either disconnected or original structure;
  131|       |            num_components[INCHI_BAS] > 0 if there was input structure
  132|       |        pINChI[INCHI_REC] refers to the reconnected structure,
  133|       |            and only if the input structure has been disconnected, that is,
  134|       |            num_components[INCHI_REC] > 0
  135|       |    */
  136|       |
  137|  54.6k|    ret = 1;
  138|       |
  139|   164k|    for (i = 0; i < INCHI_NUM; i++)
  ------------------
  |  |  574|   164k|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (139:17): [True: 109k, False: 54.6k]
  ------------------
  140|   109k|    {
  141|   328k|        for (k = 0; k < TAUT_NUM; k++)
  ------------------
  |  |  578|   328k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (141:21): [True: 218k, False: 109k]
  ------------------
  142|   218k|        {
  143|   218k|            bTautFlags[i] |= pncFlags->bTautFlags[i][k];
  144|   218k|            bTautFlagsDone[i] |= pncFlags->bTautFlagsDone[i][k];
  145|   218k|        }
  146|   109k|    }
  147|       |
  148|  54.6k|    nMode = ip->nMode;
  149|  54.6k|    if (!( nMode & ( REQ_MODE_BASIC | REQ_MODE_TAUT ) ))
  ------------------
  |  |   43|  54.6k|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
                  if (!( nMode & ( REQ_MODE_BASIC | REQ_MODE_TAUT ) ))
  ------------------
  |  |   44|  54.6k|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
  |  Branch (149:9): [True: 0, False: 54.6k]
  ------------------
  150|      0|    {
  151|      0|        nMode |= ( REQ_MODE_BASIC | REQ_MODE_TAUT );
  ------------------
  |  |   43|      0|#define REQ_MODE_BASIC              0x000001    /* B include Fixed-H layer */
  ------------------
                      nMode |= ( REQ_MODE_BASIC | REQ_MODE_TAUT );
  ------------------
  |  |   44|      0|#define REQ_MODE_TAUT               0x000002    /* T include Mobile-H layer */
  ------------------
  152|      0|    }
  153|       |
  154|  54.6k|    max_num_components = 0;
  155|   164k|    for (j = 0; j < INCHI_NUM; j++)
  ------------------
  |  |  574|   164k|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (155:17): [True: 109k, False: 54.6k]
  ------------------
  156|   109k|    {
  157|   109k|        if (max_num_components < num_components[j])
  ------------------
  |  Branch (157:13): [True: 54.6k, False: 54.6k]
  ------------------
  158|  54.6k|        {
  159|  54.6k|            max_num_components = num_components[j];
  160|  54.6k|        }
  161|   109k|    }
  162|  54.6k|    if (max_num_components <= 0)
  ------------------
  |  Branch (162:9): [True: 0, False: 54.6k]
  ------------------
  163|      0|    {
  164|      0|        max_num_components = 1;
  165|      0|    }
  166|       |
  167|   164k|    for (j = 0, i = 0; j < INCHI_NUM; j++)
  ------------------
  |  |  574|   164k|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (167:24): [True: 109k, False: 54.6k]
  ------------------
  168|   109k|    {
  169|   109k|        if (num_components[j])
  ------------------
  |  Branch (169:13): [True: 54.6k, False: 54.6k]
  ------------------
  170|  54.6k|        {
  171|   164k|            for (k1 = 0; k1 < TAUT_NUM; k1++)
  ------------------
  |  |  578|   164k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (171:26): [True: 109k, False: 54.6k]
  ------------------
  172|   109k|            {
  173|   109k|                pINChISort[j][k1] =
  174|   109k|                    (INCHI_SORT *) inchi_calloc( max_num_components,
  ------------------
  |  | 1133|   109k|#define inchi_calloc   calloc
  ------------------
  175|   109k|                                               sizeof( pINChISort[0][0][0] ) );
  176|   109k|                i += !pINChISort[j][k1]; /* number of failed allocatons */
  177|   109k|            }
  178|  54.6k|        }
  179|  54.6k|        else
  180|  54.6k|        {
  181|   164k|            for (k1 = 0; k1 < TAUT_NUM; k1++)
  ------------------
  |  |  578|   164k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (181:26): [True: 109k, False: 54.6k]
  ------------------
  182|   109k|            {
  183|   109k|                pINChISort[j][k1] = NULL; /* keep BC happy */
  184|   109k|            }
  185|  54.6k|        }
  186|   109k|    }
  187|       |
  188|  54.6k|    if (i)
  ------------------
  |  Branch (188:9): [True: 0, False: 54.6k]
  ------------------
  189|      0|    {
  190|      0|        ret = CT_OUT_OF_RAM;
  ------------------
  |  |   49|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
  191|      0|        goto exit_function;
  192|      0|    }
  193|       |
  194|   164k|    for (j = 0; j < INCHI_NUM; j++)
  ------------------
  |  |  574|   164k|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (194:17): [True: 109k, False: 54.6k]
  ------------------
  195|   109k|    {
  196|   109k|        if (!num_components[j])
  ------------------
  |  Branch (196:13): [True: 54.6k, False: 54.6k]
  ------------------
  197|  54.6k|        {
  198|  54.6k|            continue;
  199|  54.6k|        }
  200|  54.6k|        iINChI = j;
  201|       |
  202|       |#if ( OUTPUT_CONNECTED_METAL_ONLY == 1 ) /* test: output connected as the only one INChI */
  203|       |        if (INCHI_BAS == j && num_components[INCHI_REC])
  204|       |        {
  205|       |            j = INCHI_REC;
  206|       |        }
  207|       |#endif
  208|       |
  209|       |        /* j = INCHI_BAS; <- for debug only */
  210|       |        /* for only normal or disconnected coord compounds */
  211|       |        /* (j=0=INCHI_BAS => normal or disconnected, j=1=INCHI_REC => reconnected */
  212|       |
  213|   164k|        for (k1 = 0; k1 < TAUT_NUM; k1++)
  ------------------
  |  |  578|   164k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (213:22): [True: 109k, False: 54.6k]
  ------------------
  214|   109k|        {
  215|   221k|            for (i = 0; i < num_components[j]; i++)
  ------------------
  |  Branch (215:25): [True: 111k, False: 109k]
  ------------------
  216|   111k|            {
  217|   334k|                for (k = 0; k < TAUT_NUM; k++)
  ------------------
  |  |  578|   334k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (217:29): [True: 223k, False: 111k]
  ------------------
  218|   223k|                {
  219|   223k|                    pINChISort[j][k1][i].pINChI[k] = pINChI[j][i][k];
  220|   223k|                    pINChISort[j][k1][i].pINChI_Aux[k] = pINChI_Aux[j][i][k];
  221|   223k|                }
  222|   111k|                pINChISort[j][k1][i].ord_number = i;
  223|   111k|            }
  224|   109k|        }
  225|       |
  226|       |        /* Sort component INChIs */
  227|   164k|        for (k1 = 0; k1 < TAUT_NUM; k1++)
  ------------------
  |  |  578|   164k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (227:22): [True: 109k, False: 54.6k]
  ------------------
  228|   109k|        {
  229|   109k|            switch (k1)
  ------------------
  |  Branch (229:21): [True: 0, False: 109k]
  ------------------
  230|   109k|            {
  231|  54.6k|                case TAUT_NON:
  ------------------
  |  |  579|  54.6k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (231:17): [True: 54.6k, False: 54.6k]
  ------------------
  232|  54.6k|                    qsort( pINChISort[j][k1],
  233|  54.6k|                           num_components[j],
  234|  54.6k|                           sizeof( pINChISort[0][0][0] ),
  235|  54.6k|                           CompINChINonTaut2 );
  236|  54.6k|                    break;
  237|  54.6k|                case TAUT_YES:
  ------------------
  |  |  580|  54.6k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (237:17): [True: 54.6k, False: 54.6k]
  ------------------
  238|  54.6k|                    qsort( pINChISort[j][k1],
  239|  54.6k|                           num_components[j],
  240|  54.6k|                           sizeof( pINChISort[0][0][0] ),
  241|  54.6k|                           CompINChITaut2 );
  242|  54.6k|                    break;
  243|   109k|            }
  244|   109k|        }
  245|       |
  246|       |#ifndef COMPILE_ANSI_ONLY
  247|       |        /* Find equivalent and wINChI display order;
  248|       |        use requested in ip->bCompareComponents comparison */
  249|       |
  250|       |        ret = SaveEquComponentsInfoAndSortOrder( iINChI, pINChISort[j],
  251|       |                                                  num_components,
  252|       |                                                  orig_inp_data, prep_inp_data,
  253|       |#if ( FIX_DALKE_BUGS == 1 )
  254|       |                                                  composite_norm_data ? composite_norm_data[j] : NULL,
  255|       |#else
  256|       |                                                  composite_norm_data[j],
  257|       |#endif
  258|       |                                                  ip->bCompareComponents );
  259|       |        if (RETURNED_ERROR( ret ))
  260|       |        {
  261|       |            ret = 0;
  262|       |            goto exit_function;
  263|       |        }
  264|       |        else
  265|       |        {
  266|       |            ret = 1;
  267|       |        }
  268|       |#endif
  269|  54.6k|    } /* j */
  270|       |
  271|  54.6k|    if (!( ip->bINChIOutputOptions & INCHI_OUT_PRINT_OPTIONS ))
  ------------------
  |  |  191|  54.6k|#define INCHI_OUT_PRINT_OPTIONS       (INCHI_OUT_EMBED_REC |           \
  |  |  ------------------
  |  |  |  |  160|  54.6k|#define INCHI_OUT_EMBED_REC             0x0008   /* embed reconnected INChI into disconnected INChI */
  |  |  ------------------
  |  |  192|  54.6k|                                       INCHI_OUT_PLAIN_TEXT |          \
  |  |  ------------------
  |  |  |  |  163|  54.6k|#define INCHI_OUT_PLAIN_TEXT            0x0040   /* output plain text INChI                 */
  |  |  ------------------
  |  |  193|  54.6k|                                       INCHI_OUT_PLAIN_TEXT_COMMENTS)
  |  |  ------------------
  |  |  |  |  164|  54.6k|#define INCHI_OUT_PLAIN_TEXT_COMMENTS   0x0080   /* output plain text annotation            */
  |  |  ------------------
  ------------------
  |  Branch (271:9): [True: 54.6k, False: 80]
  ------------------
  272|  54.6k|    {
  273|       |        /* Prepare InChI from the structures obtained by
  274|       |           reversing InChI for returning to the caller */
  275|   163k|        for (j = 0; j < INCHI_NUM; j++)
  ------------------
  |  |  574|   163k|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (275:21): [True: 109k, False: 54.6k]
  ------------------
  276|   109k|        {
  277|   109k|            if (!num_components[j])
  ------------------
  |  Branch (277:17): [True: 54.6k, False: 54.6k]
  ------------------
  278|  54.6k|            {
  279|  54.6k|                continue;
  280|  54.6k|            }
  281|       |
  282|       |            /* pINChI[iINCHI][iComponent][bTaut] */
  283|       |            /* j  = disconnected/connected */
  284|       |            /* k1 = sort order for Mobile or Fixed H */
  285|       |
  286|  54.6k|            k1 = TAUT_YES; /* in Mobile H order */
  ------------------
  |  |  580|  54.6k|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  287|       |            /* store components in Mobile H order */
  288|       |
  289|   109k|            for (i = 0; i < num_components[j]; i++)
  ------------------
  |  Branch (289:25): [True: 54.6k, False: 54.6k]
  ------------------
  290|  54.6k|            {
  291|       |
  292|  54.6k|                if (pINChISort[j][k1][i].pINChI[TAUT_NON] &&
  ------------------
  |  |  579|  54.6k|#define TAUT_NON            0    /* 0 => normal structure */
  ------------------
  |  Branch (292:21): [True: 18, False: 54.5k]
  ------------------
  293|  54.6k|                    !pINChISort[j][k1][i].pINChI[TAUT_YES])
  ------------------
  |  |  580|     18|#define TAUT_YES            1    /* 1 => tautomeric */
  ------------------
  |  Branch (293:21): [True: 0, False: 18]
  ------------------
  294|      0|                {
  295|       |                    /* make sure Mobile-H is always present */
  296|      0|                    for (k = 0; k < TAUT_NUM; k++)
  ------------------
  |  |  578|      0|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (296:33): [True: 0, False: 0]
  ------------------
  297|      0|                    {
  298|      0|                        pINChI[j][i][k] = pINChISort[j][k1][i].pINChI[ALT_TAUT( k )];
  ------------------
  |  |  582|      0|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (582:29): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  299|      0|                        pINChI_Aux[j][i][k] = pINChISort[j][k1][i].pINChI_Aux[ALT_TAUT( k )];
  ------------------
  |  |  582|      0|#define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |               #define ALT_TAUT(X)        ((X)>TAUT_YES? TAUT_YES : 1-(X))  /* was (1-(X)) */
  |  |  ------------------
  |  |  |  |  580|      0|#define TAUT_YES            1    /* 1 => tautomeric */
  |  |  ------------------
  |  |  |  Branch (582:29): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  300|      0|                    }
  301|      0|                }
  302|  54.6k|                else
  303|  54.6k|                {
  304|   163k|                    for (k = 0; k < TAUT_NUM; k++)
  ------------------
  |  |  578|   163k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (304:33): [True: 109k, False: 54.6k]
  ------------------
  305|   109k|                    {
  306|   109k|                        pINChI[j][i][k] = pINChISort[j][k1][i].pINChI[k];
  307|   109k|                        pINChI_Aux[j][i][k] = pINChISort[j][k1][i].pINChI_Aux[k];
  308|   109k|                    }
  309|  54.6k|                }
  310|  54.6k|            }
  311|  54.6k|        }
  312|  54.6k|    }
  313|     80|    else
  314|     80|    {
  315|       |        /* Print InChI string(s) */
  316|     80|        bINChIOutputOptions0 = ip->bINChIOutputOptions & ~INCHI_OUT_PRINT_OPTIONS;
  ------------------
  |  |  191|     80|#define INCHI_OUT_PRINT_OPTIONS       (INCHI_OUT_EMBED_REC |           \
  |  |  ------------------
  |  |  |  |  160|     80|#define INCHI_OUT_EMBED_REC             0x0008   /* embed reconnected INChI into disconnected INChI */
  |  |  ------------------
  |  |  192|     80|                                       INCHI_OUT_PLAIN_TEXT |          \
  |  |  ------------------
  |  |  |  |  163|     80|#define INCHI_OUT_PLAIN_TEXT            0x0040   /* output plain text INChI                 */
  |  |  ------------------
  |  |  193|     80|                                       INCHI_OUT_PLAIN_TEXT_COMMENTS)
  |  |  ------------------
  |  |  |  |  164|     80|#define INCHI_OUT_PLAIN_TEXT_COMMENTS   0x0080   /* output plain text annotation            */
  |  |  ------------------
  ------------------
  317|     80|        bEmbedReconnected = ip->bINChIOutputOptions & INCHI_OUT_EMBED_REC;
  ------------------
  |  |  160|     80|#define INCHI_OUT_EMBED_REC             0x0008   /* embed reconnected INChI into disconnected INChI */
  ------------------
  318|       |
  319|    240|        for (i = 1; i <= 2; i++)
  ------------------
  |  Branch (319:21): [True: 160, False: 80]
  ------------------
  320|    160|        {
  321|    160|            bCurOption = INCHI_OUT_PLAIN_TEXT;
  ------------------
  |  |  163|    160|#define INCHI_OUT_PLAIN_TEXT            0x0040   /* output plain text INChI                 */
  ------------------
  322|    160|            if (i == 2)
  ------------------
  |  Branch (322:17): [True: 80, False: 80]
  ------------------
  323|     80|            {
  324|     80|                bCurOption = INCHI_OUT_PLAIN_TEXT_COMMENTS;
  ------------------
  |  |  164|     80|#define INCHI_OUT_PLAIN_TEXT_COMMENTS   0x0080   /* output plain text annotation            */
  ------------------
  325|       |                /* continue; */
  326|     80|            }
  327|    160|            if (!( ip->bINChIOutputOptions & bCurOption ))
  ------------------
  |  Branch (327:17): [True: 80, False: 80]
  ------------------
  328|     80|            {
  329|     80|                continue;
  330|     80|            }
  331|       |
  332|     80|            bINChIOutputOptionsCur = bINChIOutputOptions0 | bCurOption;
  333|     80|            if (i == 1)
  ------------------
  |  Branch (333:17): [True: 80, False: 0]
  ------------------
  334|     80|            {
  335|       |                /* output INChI */
  336|     80|                bINChIOutputOptionsCur |= bEmbedReconnected;
  337|     80|            }
  338|      0|            else if (i == 2)
  ------------------
  |  Branch (338:22): [True: 0, False: 0]
  ------------------
  339|      0|            {
  340|       |                /* output annotation */
  341|      0|                inchi_ios_print( out_file, "\n==== %s ====\n", szAnnHdr );
  342|      0|                ITRACE_( "\n==== %s ====\n", szAnnHdr );
  ------------------
  |  |  126|      0|#define ITRACE_ 0 && _inchi_trace
  |  |  ------------------
  |  |  |  Branch (126:17): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (342:17): [True: 0, False: 0]
  ------------------
  343|      0|                bINChIOutputOptionsCur |= bEmbedReconnected;
  344|      0|                bINChIOutputOptionsCur &= ~INCHI_OUT_TABBED_OUTPUT;
  ------------------
  |  |  167|      0|#define INCHI_OUT_TABBED_OUTPUT         0x0400   /* tab-delimited (only for plain text)     */
  ------------------
  345|      0|            }
  346|      0|            else
  347|      0|            {
  348|      0|                continue;
  349|      0|            }
  350|       |
  351|       |#if 0 /*^^^#ifdef TARGET_LIB_FOR_WINCHI*/
  352|       |            inchi_ios_free_str( out_file );
  353|       |#endif
  354|       |
  355|     80|            INCHI_basic_or_INCHI_reconnected = INCHI_BAS;
  ------------------
  |  |  575|     80|#define INCHI_BAS            0    /* 0 => disconnected or normal */
  ------------------
  356|       |
  357|     80|            ret2 = OutputINChI2( pCG,
  358|     80|                                 strbuf,
  359|     80|                                 pINChISort,
  360|     80|                                 INCHI_basic_or_INCHI_reconnected,
  361|     80|                                 orig_inp_data,
  362|     80|                                 pOrigStruct,
  363|     80|                                 ip,
  364|     80|                                 bDisconnectedCoord,
  365|     80|                                 OUT_TN,
  ------------------
  |  |  588|     80|#define OUT_TN              3    /* tautomeric if present otherwise non-tautomeric;
  ------------------
  366|     80|                                 bINChIOutputOptionsCur,
  367|     80|                                 num_components,
  368|     80|                                 num_non_taut,
  369|     80|                                 num_taut,
  370|     80|                                 out_file,
  371|     80|                                 log_file,
  372|     80|                                 num_inp,
  373|     80|                                 pSortPrintINChIFlags,
  374|     80|                                 save_opt_bits );
  375|       |
  376|     80|            ret &= ret2;
  377|       |
  378|       |#ifdef TARGET_LIB_FOR_WINCHI
  379|       |            /* always calculate InChIKey */
  380|       |            winchi_calc_inchikey( ret, &ikflag, ip, out_file, log_file );
  381|       |            /*push_to_winchi_text_window( out_file );
  382|       |            inchi_ios_flush( out_file );*/
  383|       |
  384|       |#endif
  385|       |
  386|     80|            if (!ret)
  ------------------
  |  Branch (386:17): [True: 0, False: 80]
  ------------------
  387|      0|            {
  388|      0|                break;
  389|      0|            }
  390|     80|        } /* i */
  391|     80|    }
  392|       |
  393|       |
  394|  54.6k|exit_function:
  395|       |
  396|   164k|    for (j = 0; j < INCHI_NUM; j++)
  ------------------
  |  |  574|   164k|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (396:17): [True: 109k, False: 54.6k]
  ------------------
  397|   109k|    {
  398|   328k|        for (k1 = 0, i = 0; k1 < TAUT_NUM; k1++)
  ------------------
  |  |  578|   328k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (398:29): [True: 218k, False: 109k]
  ------------------
  399|   218k|        {
  400|   218k|            if (pINChISort[j][k1])
  ------------------
  |  Branch (400:17): [True: 109k, False: 109k]
  ------------------
  401|   109k|            {
  402|   109k|                inchi_free( pINChISort[j][k1] );
  ------------------
  |  | 1136|   109k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 109k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
  403|   109k|            }
  404|   218k|        }
  405|   109k|    }
  406|       |
  407|       |
  408|  54.6k|    ret = ret ? 0 : _IS_FATAL;
  ------------------
  |  |   41|  54.6k|#define _IS_FATAL   3
  ------------------
  |  Branch (408:11): [True: 54.6k, False: 0]
  ------------------
  409|       |
  410|  54.6k|    return ret;
  411|  54.6k|}
FreeAllINChIArrays:
 1323|   109k|{
 1324|   109k|    int k;
 1325|   328k|    for (k = 0; k < INCHI_NUM; k++)
  ------------------
  |  |  574|   328k|#define INCHI_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1325:17): [True: 218k, False: 109k]
  ------------------
 1326|   218k|    {
 1327|   218k|        int nk = num_components[k];
 1328|       |
 1329|   218k|        FreeINChIArrays( pINChI[k], pINChI_Aux[k], num_components[k] );
 1330|       |
 1331|   218k|        num_components[k] = 0;
 1332|       |
 1333|   218k|        if (nk &&                /* added check for nk: 2013-12-15 IPl */
  ------------------
  |  Branch (1333:13): [True: 54.6k, False: 164k]
  ------------------
 1334|   218k|             pINChI[k])
  ------------------
  |  Branch (1334:14): [True: 54.6k, False: 0]
  ------------------
 1335|  54.6k|        {
 1336|  54.6k|            inchi_free( pINChI[k] );
  ------------------
  |  | 1136|  54.6k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 54.6k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1337|  54.6k|            pINChI[k] = NULL;
 1338|  54.6k|        }
 1339|       |
 1340|   218k|        if (nk &&                /* added check for nk: 2013-12-15 IPl */
  ------------------
  |  Branch (1340:13): [True: 54.6k, False: 164k]
  ------------------
 1341|   218k|             pINChI_Aux[k])
  ------------------
  |  Branch (1341:14): [True: 54.6k, False: 0]
  ------------------
 1342|  54.6k|        {
 1343|  54.6k|            inchi_free( pINChI_Aux[k] );
  ------------------
  |  | 1136|  54.6k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 54.6k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1344|  54.6k|            pINChI_Aux[k] = NULL;
 1345|  54.6k|        }
 1346|   218k|    }
 1347|       |
 1348|   109k|    return;
 1349|   109k|}
FreeINChIArrays:
 1356|   218k|{
 1357|   218k|    int i, k;
 1358|       |    /* Release allocated memory */
 1359|   218k|    if (pINChI)
  ------------------
  |  Branch (1359:9): [True: 54.6k, False: 164k]
  ------------------
 1360|  54.6k|    {
 1361|   110k|        for (i = 0; i < num_components; i++)
  ------------------
  |  Branch (1361:21): [True: 55.8k, False: 54.6k]
  ------------------
 1362|  55.8k|        {
 1363|   167k|            for (k = 0; k < TAUT_NUM; k++)
  ------------------
  |  |  578|   167k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1363:25): [True: 111k, False: 55.8k]
  ------------------
 1364|   111k|            {
 1365|   111k|                Free_INChI( &pINChI[i][k] );
 1366|   111k|            }
 1367|  55.8k|        }
 1368|  54.6k|    }
 1369|   218k|    if (pINChI_Aux)
  ------------------
  |  Branch (1369:9): [True: 54.6k, False: 164k]
  ------------------
 1370|  54.6k|    {
 1371|   110k|        for (i = 0; i < num_components; i++)
  ------------------
  |  Branch (1371:21): [True: 55.8k, False: 54.6k]
  ------------------
 1372|  55.8k|        {
 1373|   167k|            for (k = 0; k < TAUT_NUM; k++)
  ------------------
  |  |  578|   167k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1373:25): [True: 111k, False: 55.8k]
  ------------------
 1374|   111k|            {
 1375|   111k|                Free_INChI_Aux( &pINChI_Aux[i][k] );
 1376|   111k|            }
 1377|  55.8k|        }
 1378|  54.6k|    }
 1379|   218k|}
TreatCreateINChIWarning:
 1459|  54.6k|{
 1460|       |
 1461|       |#if ( bRELEASE_VERSION == 0 && (EXTR_FLAGS || EXTR_MASK) )
 1462|       |    if (EXTR_MASK ? ( ( sd->bExtract & EXTR_MASK ) == EXTR_FLAGS )
 1463|       |                    : ( sd->bExtract & EXTR_FLAGS )
 1464|       |       )
 1465|       |    {
 1466|       |        char szMsg[64];
 1467|       |        sprintf( szMsg, "ExtractStruct.code=0x%X", sd->bExtract );
 1468|       |        if (!ip->bNoWarnings)
 1469|       |        {
 1470|       |            WarningMessage( sd->pStrErrStruct, szMsg );
 1471|       |        }
 1472|       |    }
 1473|       |#endif
 1474|       |
 1475|  54.6k|    if (!sd->nErrorCode && sd->pStrErrStruct[0])
  ------------------
  |  Branch (1475:9): [True: 54.6k, False: 0]
  |  Branch (1475:28): [True: 4, False: 54.6k]
  ------------------
 1476|      4|    {
 1477|      4|        inchi_ios_eprint( log_file, "Warning (%s) structure #%ld.%s%s%s%s\n",
 1478|      4|            sd->pStrErrStruct, num_inp, SDF_LBL_VAL( ip->pSdfLabel, ip->pSdfValue ) );
  ------------------
  |  |  410|      4|#define SDF_LBL_VAL(L,V)  ((L)&&(L)[0])?gsSpace:gsEmpty, ((L)&&(L)[0])?L:gsEmpty, ((L)&&(L)[0])? (((V)&&(V)[0])?gsEqual:gsSpace):gsEmpty, ((V)&&(V)[0])?V:((L)&&(L)[0])?gsMissing:gsEmpty
  |  |  ------------------
  |  |  |  Branch (410:28): [True: 0, False: 4]
  |  |  |  Branch (410:33): [True: 0, False: 0]
  |  |  |  Branch (410:59): [True: 0, False: 4]
  |  |  |  Branch (410:64): [True: 0, False: 0]
  |  |  |  Branch (410:84): [True: 0, False: 4]
  |  |  |  Branch (410:89): [True: 0, False: 0]
  |  |  |  Branch (410:100): [True: 0, False: 0]
  |  |  |  Branch (410:105): [True: 0, False: 0]
  |  |  |  Branch (410:140): [True: 0, False: 4]
  |  |  |  Branch (410:145): [True: 0, False: 0]
  |  |  |  Branch (410:156): [True: 0, False: 4]
  |  |  |  Branch (410:161): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1479|      4|        sd->nErrorType = _IS_WARNING;
  ------------------
  |  |   39|      4|#define _IS_WARNING 1
  ------------------
 1480|       |
 1481|       |#ifdef TARGET_LIB_FOR_WINCHI
 1482|       |        if (( ip->bINChIOutputOptions & INCHI_OUT_WINCHI_WINDOW ) &&
 1483|       |            ( ip->bINChIOutputOptions & INCHI_OUT_PLAIN_TEXT ))
 1484|       |        {
 1485|       |            sd->nErrorType = ProcessStructError( out_file,
 1486|       |                                                 log_file,
 1487|       |                                                 sd->pStrErrStruct,
 1488|       |                                                 sd->nErrorType,
 1489|       |                                                 num_inp,
 1490|       |                                                 ip );
 1491|       |        }
 1492|       |#endif
 1493|       |        /*  save the structure as a problem structure if requested */
 1494|      4|        if (ip->bSaveWarningStructsAsProblem && !ip->bSaveAllGoodStructsAsProblem &&
  ------------------
  |  Branch (1494:13): [True: 0, False: 4]
  |  Branch (1494:49): [True: 0, False: 0]
  ------------------
 1495|      4|             prb_file->f && 0L <= sd->fPtrStart && sd->fPtrStart < sd->fPtrEnd)
  ------------------
  |  Branch (1495:14): [True: 0, False: 0]
  |  Branch (1495:29): [True: 0, False: 0]
  |  Branch (1495:52): [True: 0, False: 0]
  ------------------
 1496|      0|        {
 1497|      0|            MolfileSaveCopy( inp_file,
 1498|      0|                             sd->fPtrStart,
 1499|      0|                             sd->fPtrEnd,
 1500|      0|                             prb_file->f,
 1501|      0|                             num_inp );
 1502|      0|        }
 1503|       |
 1504|       |#if ( bRELEASE_VERSION == 0 )
 1505|       |        /*  otherwise extract the structure as a problem structure if requested */
 1506|       |        else
 1507|       |            if (( EXTR_MASK ? ( ( sd->bExtract & EXTR_MASK ) == EXTR_FLAGS ) : ( sd->bExtract & EXTR_FLAGS ) )
 1508|       |                            && !ip->bSaveAllGoodStructsAsProblem &&
 1509|       |                               prb_file->f &&
 1510|       |                               0L <= sd->fPtrStart && sd->fPtrStart < sd->fPtrEnd)
 1511|       |            {
 1512|       |                MolfileSaveCopy( inp_file->f,
 1513|       |                                 sd->fPtrStart,
 1514|       |                                 sd->fPtrEnd,
 1515|       |                                 prb_file->f,
 1516|       |                                 num_inp );
 1517|       |            }
 1518|       |#endif
 1519|      4|    }
 1520|       |
 1521|       |#if ( bRELEASE_VERSION != 1 && bOUTPUT_ONE_STRUCT_TIME == 1 )
 1522|       |#ifndef TARGET_API_LIB
 1523|       |    if (log_file && log_file != stderr)
 1524|       |    {
 1525|       |        fprintf( log_file, "%10lu msec structure %1dD #%ld.%s%s%s%s (%d component%s, %d atom%s, error=%d).\n",
 1526|       |                sd->ulStructTime, orig_inp_data->num_dimensions, num_inp, SDF_LBL_VAL( ip->pSdfLabel, ip->pSdfValue ),
 1527|       |                orig_inp_data->num_components, orig_inp_data->num_components == 1 ? "" : "s",
 1528|       |                orig_inp_data->num_inp_atoms, orig_inp_data->num_inp_atoms == 1 ? "" : "s", sd->nErrorCode );
 1529|       |    }
 1530|       |#else
 1531|       |    if (log_file)
 1532|       |    {
 1533|       |        inchi_ios_eprint( log_file, "%10lu msec structure %1dD #%ld.%s%s%s%s (%d component%s, %d atom%s, error=%d).\n",
 1534|       |                sd->ulStructTime, orig_inp_data->num_dimensions, num_inp, SDF_LBL_VAL( ip->pSdfLabel, ip->pSdfValue ),
 1535|       |                orig_inp_data->num_components, orig_inp_data->num_components == 1 ? "" : "s",
 1536|       |                orig_inp_data->num_inp_atoms, orig_inp_data->num_inp_atoms == 1 ? "" : "s", sd->nErrorCode );
 1537|       |    }
 1538|       |#endif
 1539|       |#endif
 1540|       |
 1541|  54.6k|    return sd->nErrorType;
 1542|  54.6k|}
GetProcessingWarningsOneComponentInChI:
 1552|  54.6k|{
 1553|  54.6k|    int i, ret = 0;
 1554|   163k|    for (i = 0; i < TAUT_NUM; i++)
  ------------------
  |  |  578|   163k|#define TAUT_NUM            2    /* = array size; member indexes: */
  ------------------
  |  Branch (1554:17): [True: 109k, False: 54.6k]
  ------------------
 1555|   109k|    {
 1556|   109k|        if (cur_INChI[i] && cur_INChI[i]->nNumberOfAtoms > 0)
  ------------------
  |  Branch (1556:13): [True: 54.6k, False: 54.5k]
  |  Branch (1556:29): [True: 54.6k, False: 16]
  ------------------
 1557|  54.6k|        {
 1558|  54.6k|            ret |= GetProcessingWarningsOneInChI( cur_INChI[i],
 1559|  54.6k|                                                  inp_norm_data[i],
 1560|  54.6k|                                                  sd->pStrErrStruct,
 1561|  54.6k|                                                  bNoWarnings );
 1562|  54.6k|        }
 1563|   109k|    }
 1564|       |
 1565|  54.6k|    return ret;
 1566|  54.6k|}
GetProcessingWarningsOneInChI:
 1576|  54.6k|{
 1577|  54.6k|    int j;
 1578|  54.6k|    int nAmbiguousStereoAtoms, nAmbiguousStereoBonds;
 1579|  54.6k|    nAmbiguousStereoAtoms = 0;
 1580|  54.6k|    nAmbiguousStereoBonds = 0;
 1581|       |
 1582|  54.6k|    if (inp_norm_data->at)
  ------------------
  |  Branch (1582:9): [True: 54.6k, False: 0]
  ------------------
 1583|  54.6k|    {
 1584|   109k|        for (j = 0; j < pINChI->nNumberOfAtoms; j++)
  ------------------
  |  Branch (1584:21): [True: 54.6k, False: 54.6k]
  ------------------
 1585|  54.6k|        {
 1586|  54.6k|            if (inp_norm_data->at[j].bAmbiguousStereo & ( AMBIGUOUS_STEREO_ATOM | AMBIGUOUS_STEREO_ATOM_ISO ))
  ------------------
  |  |  274|  54.6k|#define AMBIGUOUS_STEREO_ATOM      2
  ------------------
                          if (inp_norm_data->at[j].bAmbiguousStereo & ( AMBIGUOUS_STEREO_ATOM | AMBIGUOUS_STEREO_ATOM_ISO ))
  ------------------
  |  |  276|  54.6k|#define AMBIGUOUS_STEREO_ATOM_ISO  8
  ------------------
  |  Branch (1586:17): [True: 0, False: 54.6k]
  ------------------
 1587|      0|            {
 1588|      0|                nAmbiguousStereoAtoms++;
 1589|      0|            }
 1590|  54.6k|            if (inp_norm_data->at[j].bAmbiguousStereo & ( AMBIGUOUS_STEREO_BOND | AMBIGUOUS_STEREO_BOND_ISO ))
  ------------------
  |  |  275|  54.6k|#define AMBIGUOUS_STEREO_BOND      4
  ------------------
                          if (inp_norm_data->at[j].bAmbiguousStereo & ( AMBIGUOUS_STEREO_BOND | AMBIGUOUS_STEREO_BOND_ISO ))
  ------------------
  |  |  277|  54.6k|#define AMBIGUOUS_STEREO_BOND_ISO  16
  ------------------
  |  Branch (1590:17): [True: 0, False: 54.6k]
  ------------------
 1591|      0|            {
 1592|      0|                nAmbiguousStereoBonds++;
 1593|      0|            }
 1594|  54.6k|        }
 1595|  54.6k|        if (nAmbiguousStereoAtoms)
  ------------------
  |  Branch (1595:13): [True: 0, False: 54.6k]
  ------------------
 1596|      0|        {
 1597|      0|            if (!bNoWarnings)
  ------------------
  |  Branch (1597:17): [True: 0, False: 0]
  ------------------
 1598|      0|            {
 1599|      0|                WarningMessage( pStrErrStruct, "Ambiguous stereo:" );
  ------------------
  |  |  160|      0|#define WarningMessage AddErrorMessage
  ------------------
 1600|      0|                WarningMessage( pStrErrStruct, "center(s)" );
  ------------------
  |  |  160|      0|#define WarningMessage AddErrorMessage
  ------------------
 1601|      0|            }
 1602|      0|        }
 1603|  54.6k|        if (nAmbiguousStereoBonds)
  ------------------
  |  Branch (1603:13): [True: 0, False: 54.6k]
  ------------------
 1604|      0|        {
 1605|      0|            if (!bNoWarnings)
  ------------------
  |  Branch (1605:17): [True: 0, False: 0]
  ------------------
 1606|      0|            {
 1607|      0|                WarningMessage( pStrErrStruct, "Ambiguous stereo:" );
  ------------------
  |  |  160|      0|#define WarningMessage AddErrorMessage
  ------------------
 1608|      0|                WarningMessage( pStrErrStruct, "bond(s)" );
  ------------------
  |  |  160|      0|#define WarningMessage AddErrorMessage
  ------------------
 1609|      0|            }
 1610|      0|        }
 1611|  54.6k|    }
 1612|       |
 1613|  54.6k|    return ( nAmbiguousStereoAtoms || nAmbiguousStereoBonds );
  ------------------
  |  Branch (1613:14): [True: 0, False: 54.6k]
  |  Branch (1613:39): [True: 0, False: 54.6k]
  ------------------
 1614|  54.6k|}

sha2_starts:
   73|    558|{
   74|    558|    ctx->total[0] = 0;
   75|    558|    ctx->total[1] = 0;
   76|       |
   77|    558|    ctx->state[0] = 0x6A09E667;
   78|    558|    ctx->state[1] = 0xBB67AE85;
   79|    558|    ctx->state[2] = 0x3C6EF372;
   80|    558|    ctx->state[3] = 0xA54FF53A;
   81|    558|    ctx->state[4] = 0x510E527F;
   82|    558|    ctx->state[5] = 0x9B05688C;
   83|    558|    ctx->state[6] = 0x1F83D9AB;
   84|    558|    ctx->state[7] = 0x5BE0CD19;
   85|    558|}
sha2_update:
  222|  1.67k|{
  223|  1.67k|    int fill;
  224|  1.67k|    unsigned long left;
  225|       |
  226|  1.67k|    if (ilen <= 0)
  ------------------
  |  Branch (226:9): [True: 89, False: 1.58k]
  ------------------
  227|     89|        return;
  228|       |
  229|  1.58k|    left = ctx->total[0] & 0x3F;
  230|  1.58k|    fill = 64 - left;
  231|       |
  232|  1.58k|    ctx->total[0] += ilen;
  233|  1.58k|    ctx->total[0] &= 0xFFFFFFFF;
  234|       |
  235|  1.58k|    if (ctx->total[0] < (unsigned long) ilen)
  ------------------
  |  Branch (235:9): [True: 0, False: 1.58k]
  ------------------
  236|      0|        ctx->total[1]++;
  237|       |
  238|  1.58k|    if (left && ilen >= fill)
  ------------------
  |  Branch (238:9): [True: 1.01k, False: 569]
  |  Branch (238:17): [True: 609, False: 407]
  ------------------
  239|    609|    {
  240|    609|        memcpy( (void *) ( ctx->buffer + left ),
  241|    609|            (void *) input, fill );
  242|    609|        sha2_process( ctx, ctx->buffer );
  243|    609|        input += fill;
  244|    609|        ilen -= fill;
  245|    609|        left = 0;
  246|    609|    }
  247|       |
  248|   100k|    while (ilen >= 64)
  ------------------
  |  Branch (248:12): [True: 98.8k, False: 1.58k]
  ------------------
  249|  98.8k|    {
  250|  98.8k|        sha2_process( ctx, input );
  251|  98.8k|        input += 64;
  252|  98.8k|        ilen -= 64;
  253|  98.8k|    }
  254|       |
  255|  1.58k|    if (ilen > 0)
  ------------------
  |  Branch (255:9): [True: 1.01k, False: 569]
  ------------------
  256|  1.01k|    {
  257|  1.01k|        memcpy( (void *) ( ctx->buffer + left ),
  258|  1.01k|            (void *) input, ilen );
  259|  1.01k|    }
  260|  1.58k|}
sha2_finish:
  274|    558|{
  275|    558|    unsigned long last, padn;
  276|    558|    unsigned long high, low;
  277|    558|    unsigned char msglen[8];
  278|       |
  279|    558|    high = ( ctx->total[0] >> 29 )
  280|    558|        | ( ctx->total[1] << 3 );
  281|    558|    low = ( ctx->total[0] << 3 );
  282|       |
  283|    558|    PUT_UINT32_BE( high, msglen, 0 );
  ------------------
  |  |   60|    558|#define PUT_UINT32_BE(n,b,i)                            \
  |  |   61|    558|{                                                       \
  |  |   62|    558|    (b)[(i)    ] = (unsigned char) ( (n) >> 24 );       \
  |  |   63|    558|    (b)[(i) + 1] = (unsigned char) ( (n) >> 16 );       \
  |  |   64|    558|    (b)[(i) + 2] = (unsigned char) ( (n) >>  8 );       \
  |  |   65|    558|    (b)[(i) + 3] = (unsigned char) ( (n)       );       \
  |  |   66|    558|}
  ------------------
  284|    558|    PUT_UINT32_BE( low, msglen, 4 );
  ------------------
  |  |   60|    558|#define PUT_UINT32_BE(n,b,i)                            \
  |  |   61|    558|{                                                       \
  |  |   62|    558|    (b)[(i)    ] = (unsigned char) ( (n) >> 24 );       \
  |  |   63|    558|    (b)[(i) + 1] = (unsigned char) ( (n) >> 16 );       \
  |  |   64|    558|    (b)[(i) + 2] = (unsigned char) ( (n) >>  8 );       \
  |  |   65|    558|    (b)[(i) + 3] = (unsigned char) ( (n)       );       \
  |  |   66|    558|}
  ------------------
  285|       |
  286|    558|    last = ctx->total[0] & 0x3F;
  287|    558|    padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last );
  ------------------
  |  Branch (287:12): [True: 507, False: 51]
  ------------------
  288|       |
  289|    558|    sha2_update( ctx, (unsigned char *) sha2_padding, padn );
  290|    558|    sha2_update( ctx, msglen, 8 );
  291|       |
  292|    558|    PUT_UINT32_BE( ctx->state[0], output, 0 );
  ------------------
  |  |   60|    558|#define PUT_UINT32_BE(n,b,i)                            \
  |  |   61|    558|{                                                       \
  |  |   62|    558|    (b)[(i)    ] = (unsigned char) ( (n) >> 24 );       \
  |  |   63|    558|    (b)[(i) + 1] = (unsigned char) ( (n) >> 16 );       \
  |  |   64|    558|    (b)[(i) + 2] = (unsigned char) ( (n) >>  8 );       \
  |  |   65|    558|    (b)[(i) + 3] = (unsigned char) ( (n)       );       \
  |  |   66|    558|}
  ------------------
  293|    558|    PUT_UINT32_BE( ctx->state[1], output, 4 );
  ------------------
  |  |   60|    558|#define PUT_UINT32_BE(n,b,i)                            \
  |  |   61|    558|{                                                       \
  |  |   62|    558|    (b)[(i)    ] = (unsigned char) ( (n) >> 24 );       \
  |  |   63|    558|    (b)[(i) + 1] = (unsigned char) ( (n) >> 16 );       \
  |  |   64|    558|    (b)[(i) + 2] = (unsigned char) ( (n) >>  8 );       \
  |  |   65|    558|    (b)[(i) + 3] = (unsigned char) ( (n)       );       \
  |  |   66|    558|}
  ------------------
  294|    558|    PUT_UINT32_BE( ctx->state[2], output, 8 );
  ------------------
  |  |   60|    558|#define PUT_UINT32_BE(n,b,i)                            \
  |  |   61|    558|{                                                       \
  |  |   62|    558|    (b)[(i)    ] = (unsigned char) ( (n) >> 24 );       \
  |  |   63|    558|    (b)[(i) + 1] = (unsigned char) ( (n) >> 16 );       \
  |  |   64|    558|    (b)[(i) + 2] = (unsigned char) ( (n) >>  8 );       \
  |  |   65|    558|    (b)[(i) + 3] = (unsigned char) ( (n)       );       \
  |  |   66|    558|}
  ------------------
  295|    558|    PUT_UINT32_BE( ctx->state[3], output, 12 );
  ------------------
  |  |   60|    558|#define PUT_UINT32_BE(n,b,i)                            \
  |  |   61|    558|{                                                       \
  |  |   62|    558|    (b)[(i)    ] = (unsigned char) ( (n) >> 24 );       \
  |  |   63|    558|    (b)[(i) + 1] = (unsigned char) ( (n) >> 16 );       \
  |  |   64|    558|    (b)[(i) + 2] = (unsigned char) ( (n) >>  8 );       \
  |  |   65|    558|    (b)[(i) + 3] = (unsigned char) ( (n)       );       \
  |  |   66|    558|}
  ------------------
  296|    558|    PUT_UINT32_BE( ctx->state[4], output, 16 );
  ------------------
  |  |   60|    558|#define PUT_UINT32_BE(n,b,i)                            \
  |  |   61|    558|{                                                       \
  |  |   62|    558|    (b)[(i)    ] = (unsigned char) ( (n) >> 24 );       \
  |  |   63|    558|    (b)[(i) + 1] = (unsigned char) ( (n) >> 16 );       \
  |  |   64|    558|    (b)[(i) + 2] = (unsigned char) ( (n) >>  8 );       \
  |  |   65|    558|    (b)[(i) + 3] = (unsigned char) ( (n)       );       \
  |  |   66|    558|}
  ------------------
  297|    558|    PUT_UINT32_BE( ctx->state[5], output, 20 );
  ------------------
  |  |   60|    558|#define PUT_UINT32_BE(n,b,i)                            \
  |  |   61|    558|{                                                       \
  |  |   62|    558|    (b)[(i)    ] = (unsigned char) ( (n) >> 24 );       \
  |  |   63|    558|    (b)[(i) + 1] = (unsigned char) ( (n) >> 16 );       \
  |  |   64|    558|    (b)[(i) + 2] = (unsigned char) ( (n) >>  8 );       \
  |  |   65|    558|    (b)[(i) + 3] = (unsigned char) ( (n)       );       \
  |  |   66|    558|}
  ------------------
  298|    558|    PUT_UINT32_BE( ctx->state[6], output, 24 );
  ------------------
  |  |   60|    558|#define PUT_UINT32_BE(n,b,i)                            \
  |  |   61|    558|{                                                       \
  |  |   62|    558|    (b)[(i)    ] = (unsigned char) ( (n) >> 24 );       \
  |  |   63|    558|    (b)[(i) + 1] = (unsigned char) ( (n) >> 16 );       \
  |  |   64|    558|    (b)[(i) + 2] = (unsigned char) ( (n) >>  8 );       \
  |  |   65|    558|    (b)[(i) + 3] = (unsigned char) ( (n)       );       \
  |  |   66|    558|}
  ------------------
  299|    558|    PUT_UINT32_BE( ctx->state[7], output, 28 );
  ------------------
  |  |   60|    558|#define PUT_UINT32_BE(n,b,i)                            \
  |  |   61|    558|{                                                       \
  |  |   62|    558|    (b)[(i)    ] = (unsigned char) ( (n) >> 24 );       \
  |  |   63|    558|    (b)[(i) + 1] = (unsigned char) ( (n) >> 16 );       \
  |  |   64|    558|    (b)[(i) + 2] = (unsigned char) ( (n) >>  8 );       \
  |  |   65|    558|    (b)[(i) + 3] = (unsigned char) ( (n)       );       \
  |  |   66|    558|}
  ------------------
  300|    558|}
sha2_csum:
  331|    558|{
  332|    558|    sha2_context ctx;
  333|       |
  334|    558|    sha2_starts( &ctx );
  335|    558|    sha2_update( &ctx, input, ilen );
  336|    558|    sha2_finish( &ctx, output );
  337|    558|}
sha2.c:sha2_process:
   88|  99.4k|{
   89|  99.4k|    unsigned long temp1, temp2, W[64];
   90|  99.4k|    unsigned long A, B, C, D, E, F, G, H;
   91|       |
   92|  99.4k|    GET_UINT32_BE( W[0], data, 0 );
  ------------------
  |  |   51|  99.4k|#define GET_UINT32_BE(n,b,i)                            \
  |  |   52|  99.4k|{                                                       \
  |  |   53|  99.4k|    (n) = ( (unsigned long) (b)[(i)    ] << 24 )        \
  |  |   54|  99.4k|        | ( (unsigned long) (b)[(i) + 1] << 16 )        \
  |  |   55|  99.4k|        | ( (unsigned long) (b)[(i) + 2] <<  8 )        \
  |  |   56|  99.4k|        | ( (unsigned long) (b)[(i) + 3]       );       \
  |  |   57|  99.4k|}
  ------------------
   93|  99.4k|    GET_UINT32_BE( W[1], data, 4 );
  ------------------
  |  |   51|  99.4k|#define GET_UINT32_BE(n,b,i)                            \
  |  |   52|  99.4k|{                                                       \
  |  |   53|  99.4k|    (n) = ( (unsigned long) (b)[(i)    ] << 24 )        \
  |  |   54|  99.4k|        | ( (unsigned long) (b)[(i) + 1] << 16 )        \
  |  |   55|  99.4k|        | ( (unsigned long) (b)[(i) + 2] <<  8 )        \
  |  |   56|  99.4k|        | ( (unsigned long) (b)[(i) + 3]       );       \
  |  |   57|  99.4k|}
  ------------------
   94|  99.4k|    GET_UINT32_BE( W[2], data, 8 );
  ------------------
  |  |   51|  99.4k|#define GET_UINT32_BE(n,b,i)                            \
  |  |   52|  99.4k|{                                                       \
  |  |   53|  99.4k|    (n) = ( (unsigned long) (b)[(i)    ] << 24 )        \
  |  |   54|  99.4k|        | ( (unsigned long) (b)[(i) + 1] << 16 )        \
  |  |   55|  99.4k|        | ( (unsigned long) (b)[(i) + 2] <<  8 )        \
  |  |   56|  99.4k|        | ( (unsigned long) (b)[(i) + 3]       );       \
  |  |   57|  99.4k|}
  ------------------
   95|  99.4k|    GET_UINT32_BE( W[3], data, 12 );
  ------------------
  |  |   51|  99.4k|#define GET_UINT32_BE(n,b,i)                            \
  |  |   52|  99.4k|{                                                       \
  |  |   53|  99.4k|    (n) = ( (unsigned long) (b)[(i)    ] << 24 )        \
  |  |   54|  99.4k|        | ( (unsigned long) (b)[(i) + 1] << 16 )        \
  |  |   55|  99.4k|        | ( (unsigned long) (b)[(i) + 2] <<  8 )        \
  |  |   56|  99.4k|        | ( (unsigned long) (b)[(i) + 3]       );       \
  |  |   57|  99.4k|}
  ------------------
   96|  99.4k|    GET_UINT32_BE( W[4], data, 16 );
  ------------------
  |  |   51|  99.4k|#define GET_UINT32_BE(n,b,i)                            \
  |  |   52|  99.4k|{                                                       \
  |  |   53|  99.4k|    (n) = ( (unsigned long) (b)[(i)    ] << 24 )        \
  |  |   54|  99.4k|        | ( (unsigned long) (b)[(i) + 1] << 16 )        \
  |  |   55|  99.4k|        | ( (unsigned long) (b)[(i) + 2] <<  8 )        \
  |  |   56|  99.4k|        | ( (unsigned long) (b)[(i) + 3]       );       \
  |  |   57|  99.4k|}
  ------------------
   97|  99.4k|    GET_UINT32_BE( W[5], data, 20 );
  ------------------
  |  |   51|  99.4k|#define GET_UINT32_BE(n,b,i)                            \
  |  |   52|  99.4k|{                                                       \
  |  |   53|  99.4k|    (n) = ( (unsigned long) (b)[(i)    ] << 24 )        \
  |  |   54|  99.4k|        | ( (unsigned long) (b)[(i) + 1] << 16 )        \
  |  |   55|  99.4k|        | ( (unsigned long) (b)[(i) + 2] <<  8 )        \
  |  |   56|  99.4k|        | ( (unsigned long) (b)[(i) + 3]       );       \
  |  |   57|  99.4k|}
  ------------------
   98|  99.4k|    GET_UINT32_BE( W[6], data, 24 );
  ------------------
  |  |   51|  99.4k|#define GET_UINT32_BE(n,b,i)                            \
  |  |   52|  99.4k|{                                                       \
  |  |   53|  99.4k|    (n) = ( (unsigned long) (b)[(i)    ] << 24 )        \
  |  |   54|  99.4k|        | ( (unsigned long) (b)[(i) + 1] << 16 )        \
  |  |   55|  99.4k|        | ( (unsigned long) (b)[(i) + 2] <<  8 )        \
  |  |   56|  99.4k|        | ( (unsigned long) (b)[(i) + 3]       );       \
  |  |   57|  99.4k|}
  ------------------
   99|  99.4k|    GET_UINT32_BE( W[7], data, 28 );
  ------------------
  |  |   51|  99.4k|#define GET_UINT32_BE(n,b,i)                            \
  |  |   52|  99.4k|{                                                       \
  |  |   53|  99.4k|    (n) = ( (unsigned long) (b)[(i)    ] << 24 )        \
  |  |   54|  99.4k|        | ( (unsigned long) (b)[(i) + 1] << 16 )        \
  |  |   55|  99.4k|        | ( (unsigned long) (b)[(i) + 2] <<  8 )        \
  |  |   56|  99.4k|        | ( (unsigned long) (b)[(i) + 3]       );       \
  |  |   57|  99.4k|}
  ------------------
  100|  99.4k|    GET_UINT32_BE( W[8], data, 32 );
  ------------------
  |  |   51|  99.4k|#define GET_UINT32_BE(n,b,i)                            \
  |  |   52|  99.4k|{                                                       \
  |  |   53|  99.4k|    (n) = ( (unsigned long) (b)[(i)    ] << 24 )        \
  |  |   54|  99.4k|        | ( (unsigned long) (b)[(i) + 1] << 16 )        \
  |  |   55|  99.4k|        | ( (unsigned long) (b)[(i) + 2] <<  8 )        \
  |  |   56|  99.4k|        | ( (unsigned long) (b)[(i) + 3]       );       \
  |  |   57|  99.4k|}
  ------------------
  101|  99.4k|    GET_UINT32_BE( W[9], data, 36 );
  ------------------
  |  |   51|  99.4k|#define GET_UINT32_BE(n,b,i)                            \
  |  |   52|  99.4k|{                                                       \
  |  |   53|  99.4k|    (n) = ( (unsigned long) (b)[(i)    ] << 24 )        \
  |  |   54|  99.4k|        | ( (unsigned long) (b)[(i) + 1] << 16 )        \
  |  |   55|  99.4k|        | ( (unsigned long) (b)[(i) + 2] <<  8 )        \
  |  |   56|  99.4k|        | ( (unsigned long) (b)[(i) + 3]       );       \
  |  |   57|  99.4k|}
  ------------------
  102|  99.4k|    GET_UINT32_BE( W[10], data, 40 );
  ------------------
  |  |   51|  99.4k|#define GET_UINT32_BE(n,b,i)                            \
  |  |   52|  99.4k|{                                                       \
  |  |   53|  99.4k|    (n) = ( (unsigned long) (b)[(i)    ] << 24 )        \
  |  |   54|  99.4k|        | ( (unsigned long) (b)[(i) + 1] << 16 )        \
  |  |   55|  99.4k|        | ( (unsigned long) (b)[(i) + 2] <<  8 )        \
  |  |   56|  99.4k|        | ( (unsigned long) (b)[(i) + 3]       );       \
  |  |   57|  99.4k|}
  ------------------
  103|  99.4k|    GET_UINT32_BE( W[11], data, 44 );
  ------------------
  |  |   51|  99.4k|#define GET_UINT32_BE(n,b,i)                            \
  |  |   52|  99.4k|{                                                       \
  |  |   53|  99.4k|    (n) = ( (unsigned long) (b)[(i)    ] << 24 )        \
  |  |   54|  99.4k|        | ( (unsigned long) (b)[(i) + 1] << 16 )        \
  |  |   55|  99.4k|        | ( (unsigned long) (b)[(i) + 2] <<  8 )        \
  |  |   56|  99.4k|        | ( (unsigned long) (b)[(i) + 3]       );       \
  |  |   57|  99.4k|}
  ------------------
  104|  99.4k|    GET_UINT32_BE( W[12], data, 48 );
  ------------------
  |  |   51|  99.4k|#define GET_UINT32_BE(n,b,i)                            \
  |  |   52|  99.4k|{                                                       \
  |  |   53|  99.4k|    (n) = ( (unsigned long) (b)[(i)    ] << 24 )        \
  |  |   54|  99.4k|        | ( (unsigned long) (b)[(i) + 1] << 16 )        \
  |  |   55|  99.4k|        | ( (unsigned long) (b)[(i) + 2] <<  8 )        \
  |  |   56|  99.4k|        | ( (unsigned long) (b)[(i) + 3]       );       \
  |  |   57|  99.4k|}
  ------------------
  105|  99.4k|    GET_UINT32_BE( W[13], data, 52 );
  ------------------
  |  |   51|  99.4k|#define GET_UINT32_BE(n,b,i)                            \
  |  |   52|  99.4k|{                                                       \
  |  |   53|  99.4k|    (n) = ( (unsigned long) (b)[(i)    ] << 24 )        \
  |  |   54|  99.4k|        | ( (unsigned long) (b)[(i) + 1] << 16 )        \
  |  |   55|  99.4k|        | ( (unsigned long) (b)[(i) + 2] <<  8 )        \
  |  |   56|  99.4k|        | ( (unsigned long) (b)[(i) + 3]       );       \
  |  |   57|  99.4k|}
  ------------------
  106|  99.4k|    GET_UINT32_BE( W[14], data, 56 );
  ------------------
  |  |   51|  99.4k|#define GET_UINT32_BE(n,b,i)                            \
  |  |   52|  99.4k|{                                                       \
  |  |   53|  99.4k|    (n) = ( (unsigned long) (b)[(i)    ] << 24 )        \
  |  |   54|  99.4k|        | ( (unsigned long) (b)[(i) + 1] << 16 )        \
  |  |   55|  99.4k|        | ( (unsigned long) (b)[(i) + 2] <<  8 )        \
  |  |   56|  99.4k|        | ( (unsigned long) (b)[(i) + 3]       );       \
  |  |   57|  99.4k|}
  ------------------
  107|  99.4k|    GET_UINT32_BE( W[15], data, 60 );
  ------------------
  |  |   51|  99.4k|#define GET_UINT32_BE(n,b,i)                            \
  |  |   52|  99.4k|{                                                       \
  |  |   53|  99.4k|    (n) = ( (unsigned long) (b)[(i)    ] << 24 )        \
  |  |   54|  99.4k|        | ( (unsigned long) (b)[(i) + 1] << 16 )        \
  |  |   55|  99.4k|        | ( (unsigned long) (b)[(i) + 2] <<  8 )        \
  |  |   56|  99.4k|        | ( (unsigned long) (b)[(i) + 3]       );       \
  |  |   57|  99.4k|}
  ------------------
  108|       |
  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  111|       |
  112|  99.4k|#define S0(x) (ROTR(x, 7) ^ ROTR(x,18) ^  SHR(x, 3))
  113|  99.4k|#define S1(x) (ROTR(x,17) ^ ROTR(x,19) ^  SHR(x,10))
  114|       |
  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  117|       |
  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  120|       |
  121|  99.4k|#define R(t)                                    \
  122|  99.4k|(                                               \
  123|  99.4k|    W[t] = S1(W[t -  2]) + W[t -  7] +          \
  124|  99.4k|           S0(W[t - 15]) + W[t - 16]            \
  125|  99.4k|)
  126|       |
  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  128|  99.4k|{                                               \
  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  132|  99.4k|}
  133|       |
  134|  99.4k|    A = ctx->state[0];
  135|  99.4k|    B = ctx->state[1];
  136|  99.4k|    C = ctx->state[2];
  137|  99.4k|    D = ctx->state[3];
  138|  99.4k|    E = ctx->state[4];
  139|  99.4k|    F = ctx->state[5];
  140|  99.4k|    G = ctx->state[6];
  141|  99.4k|    H = ctx->state[7];
  142|       |
  143|  99.4k|    P( A, B, C, D, E, F, G, H, W[0], 0x428A2F98 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  144|  99.4k|    P( H, A, B, C, D, E, F, G, W[1], 0x71374491 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  145|  99.4k|    P( G, H, A, B, C, D, E, F, W[2], 0xB5C0FBCF );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  146|  99.4k|    P( F, G, H, A, B, C, D, E, W[3], 0xE9B5DBA5 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  147|  99.4k|    P( E, F, G, H, A, B, C, D, W[4], 0x3956C25B );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  148|  99.4k|    P( D, E, F, G, H, A, B, C, W[5], 0x59F111F1 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  149|  99.4k|    P( C, D, E, F, G, H, A, B, W[6], 0x923F82A4 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  150|  99.4k|    P( B, C, D, E, F, G, H, A, W[7], 0xAB1C5ED5 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  151|  99.4k|    P( A, B, C, D, E, F, G, H, W[8], 0xD807AA98 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  152|  99.4k|    P( H, A, B, C, D, E, F, G, W[9], 0x12835B01 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  153|  99.4k|    P( G, H, A, B, C, D, E, F, W[10], 0x243185BE );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  154|  99.4k|    P( F, G, H, A, B, C, D, E, W[11], 0x550C7DC3 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  155|  99.4k|    P( E, F, G, H, A, B, C, D, W[12], 0x72BE5D74 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  156|  99.4k|    P( D, E, F, G, H, A, B, C, W[13], 0x80DEB1FE );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  157|  99.4k|    P( C, D, E, F, G, H, A, B, W[14], 0x9BDC06A7 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  158|  99.4k|    P( B, C, D, E, F, G, H, A, W[15], 0xC19BF174 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  159|  99.4k|    P( A, B, C, D, E, F, G, H, R( 16 ), 0xE49B69C1 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  160|  99.4k|    P( H, A, B, C, D, E, F, G, R( 17 ), 0xEFBE4786 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  161|  99.4k|    P( G, H, A, B, C, D, E, F, R( 18 ), 0x0FC19DC6 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  162|  99.4k|    P( F, G, H, A, B, C, D, E, R( 19 ), 0x240CA1CC );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  163|  99.4k|    P( E, F, G, H, A, B, C, D, R( 20 ), 0x2DE92C6F );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  164|  99.4k|    P( D, E, F, G, H, A, B, C, R( 21 ), 0x4A7484AA );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  165|  99.4k|    P( C, D, E, F, G, H, A, B, R( 22 ), 0x5CB0A9DC );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  166|  99.4k|    P( B, C, D, E, F, G, H, A, R( 23 ), 0x76F988DA );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  167|  99.4k|    P( A, B, C, D, E, F, G, H, R( 24 ), 0x983E5152 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  168|  99.4k|    P( H, A, B, C, D, E, F, G, R( 25 ), 0xA831C66D );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  169|  99.4k|    P( G, H, A, B, C, D, E, F, R( 26 ), 0xB00327C8 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  170|  99.4k|    P( F, G, H, A, B, C, D, E, R( 27 ), 0xBF597FC7 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  171|  99.4k|    P( E, F, G, H, A, B, C, D, R( 28 ), 0xC6E00BF3 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  172|  99.4k|    P( D, E, F, G, H, A, B, C, R( 29 ), 0xD5A79147 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  173|  99.4k|    P( C, D, E, F, G, H, A, B, R( 30 ), 0x06CA6351 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  174|  99.4k|    P( B, C, D, E, F, G, H, A, R( 31 ), 0x14292967 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  175|  99.4k|    P( A, B, C, D, E, F, G, H, R( 32 ), 0x27B70A85 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  176|  99.4k|    P( H, A, B, C, D, E, F, G, R( 33 ), 0x2E1B2138 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  177|  99.4k|    P( G, H, A, B, C, D, E, F, R( 34 ), 0x4D2C6DFC );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  178|  99.4k|    P( F, G, H, A, B, C, D, E, R( 35 ), 0x53380D13 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  179|  99.4k|    P( E, F, G, H, A, B, C, D, R( 36 ), 0x650A7354 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  180|  99.4k|    P( D, E, F, G, H, A, B, C, R( 37 ), 0x766A0ABB );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  181|  99.4k|    P( C, D, E, F, G, H, A, B, R( 38 ), 0x81C2C92E );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  182|  99.4k|    P( B, C, D, E, F, G, H, A, R( 39 ), 0x92722C85 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  183|  99.4k|    P( A, B, C, D, E, F, G, H, R( 40 ), 0xA2BFE8A1 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  184|  99.4k|    P( H, A, B, C, D, E, F, G, R( 41 ), 0xA81A664B );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  185|  99.4k|    P( G, H, A, B, C, D, E, F, R( 42 ), 0xC24B8B70 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  186|  99.4k|    P( F, G, H, A, B, C, D, E, R( 43 ), 0xC76C51A3 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  187|  99.4k|    P( E, F, G, H, A, B, C, D, R( 44 ), 0xD192E819 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  188|  99.4k|    P( D, E, F, G, H, A, B, C, R( 45 ), 0xD6990624 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  189|  99.4k|    P( C, D, E, F, G, H, A, B, R( 46 ), 0xF40E3585 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  190|  99.4k|    P( B, C, D, E, F, G, H, A, R( 47 ), 0x106AA070 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  191|  99.4k|    P( A, B, C, D, E, F, G, H, R( 48 ), 0x19A4C116 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  192|  99.4k|    P( H, A, B, C, D, E, F, G, R( 49 ), 0x1E376C08 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  193|  99.4k|    P( G, H, A, B, C, D, E, F, R( 50 ), 0x2748774C );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  194|  99.4k|    P( F, G, H, A, B, C, D, E, R( 51 ), 0x34B0BCB5 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  195|  99.4k|    P( E, F, G, H, A, B, C, D, R( 52 ), 0x391C0CB3 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  196|  99.4k|    P( D, E, F, G, H, A, B, C, R( 53 ), 0x4ED8AA4A );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  197|  99.4k|    P( C, D, E, F, G, H, A, B, R( 54 ), 0x5B9CCA4F );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  198|  99.4k|    P( B, C, D, E, F, G, H, A, R( 55 ), 0x682E6FF3 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  199|  99.4k|    P( A, B, C, D, E, F, G, H, R( 56 ), 0x748F82EE );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  200|  99.4k|    P( H, A, B, C, D, E, F, G, R( 57 ), 0x78A5636F );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  201|  99.4k|    P( G, H, A, B, C, D, E, F, R( 58 ), 0x84C87814 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  202|  99.4k|    P( F, G, H, A, B, C, D, E, R( 59 ), 0x8CC70208 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  203|  99.4k|    P( E, F, G, H, A, B, C, D, R( 60 ), 0x90BEFFFA );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  204|  99.4k|    P( D, E, F, G, H, A, B, C, R( 61 ), 0xA4506CEB );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  205|  99.4k|    P( C, D, E, F, G, H, A, B, R( 62 ), 0xBEF9A3F7 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  206|  99.4k|    P( B, C, D, E, F, G, H, A, R( 63 ), 0xC67178F2 );
  ------------------
  |  |  127|  99.4k|#define P(a,b,c,d,e,f,g,h,x,K)                  \
  |  |  128|  99.4k|{                                               \
  |  |  129|  99.4k|    temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  116|  99.4k|#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp1 = h + S3(e) + F1(e,f,g) + K + x;      \
  |  |  ------------------
  |  |  |  |  119|  99.4k|#define F1(x,y,z) (z ^ (x & (y ^ z)))
  |  |  ------------------
  |  |  130|  99.4k|    temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  115|  99.4k|#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  99.4k|#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  109|  99.4k|#define  SHR(x,n) ((x & 0xFFFFFFFF) >> n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   temp2 = S2(a) + F0(a,b,c);                  \
  |  |  ------------------
  |  |  |  |  118|  99.4k|#define F0(x,y,z) ((x & y) | (z & (x | y)))
  |  |  ------------------
  |  |  131|  99.4k|    d += temp1; h = temp1 + temp2;              \
  |  |  132|  99.4k|}
  ------------------
  207|       |
  208|  99.4k|    ctx->state[0] += A;
  209|  99.4k|    ctx->state[1] += B;
  210|  99.4k|    ctx->state[2] += C;
  211|  99.4k|    ctx->state[3] += D;
  212|  99.4k|    ctx->state[4] += E;
  213|  99.4k|    ctx->state[5] += F;
  214|  99.4k|    ctx->state[6] += G;
  215|  99.4k|    ctx->state[7] += H;
  216|  99.4k|}

the_only_doublet_neigh:
  175|      6|{
  176|      6|    int i, neigh1, num_rad1 = 0, num_rad2 = 0;
  177|       |
  178|      6|    inp_ATOM *a = at + i1, *b;
  179|      6|    if (RADICAL_DOUBLET != a->radical)
  ------------------
  |  |  104|      6|#define RADICAL_DOUBLET 2
  ------------------
  |  Branch (179:9): [True: 0, False: 6]
  ------------------
  180|      0|    {
  181|      0|        return -1;
  182|      0|    }
  183|     16|    for (i = 0; i < a->valence; i++)
  ------------------
  |  Branch (183:17): [True: 10, False: 6]
  ------------------
  184|     10|    {
  185|     10|        b = at + ( neigh1 = (int) a->neighbor[i] );
  186|     10|        if (RADICAL_DOUBLET == b->radical)
  ------------------
  |  |  104|     10|#define RADICAL_DOUBLET 2
  ------------------
  |  Branch (186:13): [True: 0, False: 10]
  ------------------
  187|      0|        {
  188|      0|            num_rad1++;
  189|      0|            *ineigh1 = i;
  190|      0|        }
  191|     10|    }
  192|       |
  193|      6|    if (1 == num_rad1)
  ------------------
  |  Branch (193:9): [True: 0, False: 6]
  ------------------
  194|      0|    {
  195|      0|        a = at + ( neigh1 = (int) a->neighbor[*ineigh1] );
  196|      0|        for (i = 0; i < a->valence; i++)
  ------------------
  |  Branch (196:21): [True: 0, False: 0]
  ------------------
  197|      0|        {
  198|      0|            b = at + (int) a->neighbor[i];
  199|      0|            if (RADICAL_DOUBLET == b->radical)
  ------------------
  |  |  104|      0|#define RADICAL_DOUBLET 2
  ------------------
  |  Branch (199:17): [True: 0, False: 0]
  ------------------
  200|      0|            {
  201|      0|                num_rad2++;
  202|      0|                *ineigh2 = i;
  203|      0|            }
  204|      0|        }
  205|       |
  206|      0|        if (1 == num_rad2)
  ------------------
  |  Branch (206:13): [True: 0, False: 0]
  ------------------
  207|      0|        {
  208|      0|            return neigh1;
  209|      0|        }
  210|      0|    }
  211|       |
  212|      6|    return -1;
  213|      6|}
fix_non_uniform_drawn_oxoanions:
  222|   110k|{
  223|       |    /* For central halogen, apply the following
  224|       |    correction rules:
  225|       |
  226|       |    O                             O(-)
  227|       |    ||                            |
  228|       |    O=Hal(-)=O         ===>        O=Hal=O
  229|       |    ||                            ||
  230|       |    O                             O
  231|       |
  232|       |    (perchlorate, etc.)
  233|       |
  234|       |
  235|       |    O                             O(-)
  236|       |    ||                            |
  237|       |    Hal(-)=O         ===>         Hal=O
  238|       |    ||                            ||
  239|       |    O                             O
  240|       |
  241|       |    (chlorate, etc.)
  242|       |
  243|       |    O                             O(-)
  244|       |    ||                            |
  245|       |    Hal(-)=O         ===>         Hal=O
  246|       |
  247|       |
  248|       |    (chlorite, etc.)
  249|       |
  250|       |    Hal(-)=O         ===>         Hal-O(-)
  251|       |
  252|       |
  253|       |    (hypochlorite, etc.)
  254|       |
  255|       |
  256|       |
  257|       |    For halcogenes (S, Se, Te)
  258|       |    Y                               Y(-)
  259|       |    ||                              |
  260|       |    RnX(-)            ===>          RnX
  261|       |
  262|       |    if:
  263|       |    1) (X = S, Y = O) || (X = Se, Y = S, O) || (X = Te, Y = O, S, Se)
  264|       |    2) valence of X exceeds 6, in initially drawn form
  265|       |
  266|       |
  267|       |    So the following is corrected:
  268|       |
  269|       |    O                               O(-)
  270|       |    ||                              |
  271|       |    O=S(-)-R            ===>        O=S-R
  272|       |    ||                              ||
  273|       |    O                               O
  274|       |
  275|       |    Or
  276|       |
  277|       |    O                              O-
  278|       |    ||                             |
  279|       |    F5Te(-)            ===>        F5Te
  280|       |
  281|       |    but the following remains unchanged:
  282|       |
  283|       |
  284|       |    O
  285|       |    ||
  286|       |    O=S(-)-R
  287|       |
  288|       |
  289|       |    The central atom (of IUPAC Group 16-17) is shown as negative but it contains double bond(s)
  290|       |    to terminal atom of greater electronegativity (of Group 16).
  291|       |    The central atom is halcogen (S,Se,Te) in highest oxidation state or halogen.
  292|       |
  293|       |    Fix:
  294|       |    move negative charge to terminal atom and change double bond to a single one.
  295|       |
  296|       |    Eligible central atom    Eligible terminal atom at double bond's end
  297|       |    Cl              O
  298|       |    Br              O
  299|       |    I               O
  300|       |    [At              S,Se,Te]
  301|       |    S               O
  302|       |    Se              O,S
  303|       |    Te              O, S, Se
  304|       |
  305|       |    Comments:
  306|       |    1. Central atoms of Groups 13-15 are not considered.
  307|       |    2. Pauling electronegativities are:
  308|       |    F(3.98) > O(3.44) > Cl (3.16) > N (3.04) > Br(2.96) > I(2.66) > S(2.58) > Se(2.55) > At (2.2) > Te(2.1)
  309|       |
  310|       |
  311|       |    */
  312|       |
  313|       |
  314|       |    /* constants for element numbers */
  315|   110k|    enum elems
  316|   110k|    {
  317|   110k|        dNone, dCl = 17, dBr = 35, dI = 53, dAt = 85, dO = 8,
  318|   110k|        dS = 16, dSe = 34, dTe = 52, dP = 15, dC = 6, dN = 7
  319|   110k|    };
  320|       |
  321|   110k|    static U_CHAR  allowed_elnums_center_halogen[] = { dCl, dBr, dI, dAt };
  322|   110k|    static U_CHAR  allowed_elnums_center_halcogen[] = { dS, dSe, dTe };
  323|       |
  324|   110k|    int en_center;
  325|   110k|    int i, j, k;
  326|       |
  327|   222k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (327:17): [True: 112k, False: 110k]
  ------------------
  328|   112k|    {
  329|       |        /* Find appropriate central atom. This center should be: ...*/
  330|       |
  331|       |        /* charged exactly (-1) ... */
  332|   112k|        if (at[i].charge != -1)
  ------------------
  |  Branch (332:13): [True: 112k, False: 20]
  ------------------
  333|   112k|        {
  334|   112k|            continue;
  335|   112k|        }
  336|     20|        en_center = at[i].el_number;
  337|       |        /*  from eligible element list ... */
  338|     20|        if (!memchr( allowed_elnums_center_halogen, en_center, sizeof( allowed_elnums_center_halogen ) ))
  ------------------
  |  Branch (338:13): [True: 20, False: 0]
  ------------------
  339|     20|        {
  340|       |            /* central atom is not not halogen; check if it is halcogen */
  341|     20|            if (memchr( allowed_elnums_center_halcogen, en_center, sizeof( allowed_elnums_center_halcogen ) ))
  ------------------
  |  Branch (341:17): [True: 6, False: 14]
  ------------------
  342|      6|            {
  343|      6|                if (at[i].chem_bonds_valence < 7)
  ------------------
  |  Branch (343:21): [True: 6, False: 0]
  ------------------
  344|      6|                {
  345|       |                    /* central atom is anionic halcogen, but not in the highest oxidation state */
  346|      6|                    continue;
  347|      6|                }
  348|      6|            }
  349|     14|            else
  350|     14|            {
  351|     14|                continue;
  352|     14|            }
  353|     20|        }
  354|       |
  355|       |        /* OK, found central halogen or eligible central halcogen. */
  356|       |
  357|       |        /* non-radical... */
  358|      0|        if (at[i].radical && ( at[i].radical != RADICAL_SINGLET ))
  ------------------
  |  |  103|      0|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (358:13): [True: 0, False: 0]
  |  Branch (358:30): [True: 0, False: 0]
  ------------------
  359|      0|        {
  360|      0|            continue;
  361|      0|        }
  362|       |
  363|       |        /* Center found, now examine the adjacent terminals... */
  364|      0|        {
  365|      0|            int en_term, kk = 0, jj = 0, min_en = 999, iso = 0, min_iso = 999;
  366|      0|            jj = -1;
  367|      0|            for (k = 0; k < at[i].valence; k++)
  ------------------
  |  Branch (367:25): [True: 0, False: 0]
  ------------------
  368|      0|            {
  369|      0|                j = at[i].neighbor[k];
  370|       |
  371|       |                /* Terminal should be: ... */
  372|       |
  373|       |                /* terminal... */
  374|      0|                if (at[j].valence != 1)
  ------------------
  |  Branch (374:21): [True: 0, False: 0]
  ------------------
  375|      0|                {
  376|      0|                    continue;
  377|      0|                }
  378|       |                /* double-bonded ... */
  379|      0|                if (at[i].bond_type[k] != BOND_TYPE_DOUBLE)
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (379:21): [True: 0, False: 0]
  ------------------
  380|      0|                {
  381|      0|                    continue;
  382|      0|                }
  383|       |                /* zero-charged ... */
  384|      0|                if (at[j].charge != 0)
  ------------------
  |  Branch (384:21): [True: 0, False: 0]
  ------------------
  385|      0|                {
  386|      0|                    continue;
  387|      0|                }
  388|       |                /* non-radical */
  389|      0|                if (at[j].radical && ( at[j].radical != RADICAL_SINGLET ))
  ------------------
  |  |  103|      0|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (389:21): [True: 0, False: 0]
  |  Branch (389:38): [True: 0, False: 0]
  ------------------
  390|      0|                {
  391|      0|                    continue;
  392|      0|                }
  393|       |                /*  of eligible elements list ... */
  394|      0|                en_term = at[j].el_number;
  395|      0|                switch (en_term)
  396|      0|                {
  397|      0|                    case dO:    break;
  ------------------
  |  Branch (397:21): [True: 0, False: 0]
  ------------------
  398|      0|                    case dS:    if (( en_center == dSe ) || ( en_center == dAt ) || ( en_center == dTe )) break;  continue;
  ------------------
  |  Branch (398:21): [True: 0, False: 0]
  |  Branch (398:37): [True: 0, False: 0]
  |  Branch (398:61): [True: 0, False: 0]
  |  Branch (398:85): [True: 0, False: 0]
  ------------------
  399|      0|                    case dSe:   if (( en_center == dAt ) || ( en_center == dTe )) break;  continue;
  ------------------
  |  Branch (399:21): [True: 0, False: 0]
  |  Branch (399:37): [True: 0, False: 0]
  |  Branch (399:61): [True: 0, False: 0]
  ------------------
  400|      0|                    case dTe:   if (en_center == dAt) break; continue;
  ------------------
  |  Branch (400:21): [True: 0, False: 0]
  |  Branch (400:37): [True: 0, False: 0]
  ------------------
  401|      0|                    default:    continue;
  ------------------
  |  Branch (401:21): [True: 0, False: 0]
  ------------------
  402|      0|                }
  403|       |
  404|       |                /* From several candidates, select one with less el. number (==more electronegative). */
  405|      0|                if (en_term < min_en)
  ------------------
  |  Branch (405:21): [True: 0, False: 0]
  ------------------
  406|      0|                {
  407|      0|                    min_en = en_term; kk = k; jj = j;
  408|      0|                    min_iso = at[j].iso_atw_diff > 0 ? at[i].iso_atw_diff - 1 : at[i].iso_atw_diff;
  ------------------
  |  Branch (408:31): [True: 0, False: 0]
  ------------------
  409|      0|                    continue;
  410|      0|                }
  411|       |                /* From same-element candidates, select one with less isotopic mass (arbitrary choice). */
  412|      0|                else if (en_term == min_en)
  ------------------
  |  Branch (412:26): [True: 0, False: 0]
  ------------------
  413|      0|                {
  414|      0|                    iso = at[j].iso_atw_diff > 0 ? at[i].iso_atw_diff - 1 : at[i].iso_atw_diff;
  ------------------
  |  Branch (414:27): [True: 0, False: 0]
  ------------------
  415|      0|                    if (iso < min_iso)
  ------------------
  |  Branch (415:25): [True: 0, False: 0]
  ------------------
  416|      0|                    {
  417|      0|                        min_iso = iso; kk = k; jj = j; continue;
  418|      0|                    }
  419|      0|                }
  420|      0|            } /* end of checking nbrs. */
  421|       |
  422|       |              /* If OK, apply changes. */
  423|      0|            if (jj >= 0)
  ------------------
  |  Branch (423:17): [True: 0, False: 0]
  ------------------
  424|      0|            {
  425|      0|                at[i].charge = 0;
  426|      0|                at[jj].charge = -1;
  427|      0|                at[i].bond_type[kk] = BOND_TYPE_SINGLE;
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  428|      0|                at[jj].bond_type[0] = BOND_TYPE_SINGLE;
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  429|      0|                at[i].bond_stereo[kk] = at[jj].bond_stereo[0] = 0;
  430|      0|                at[i].chem_bonds_valence--;
  431|      0|                at[jj].chem_bonds_valence--;
  432|      0|                ( *num_changes )++;
  433|      0|            }
  434|      0|        }
  435|      0|    }  /* end of search for candidate centers. */
  436|       |
  437|   110k|    return 0;
  438|   110k|}
fix_non_uniform_drawn_amidiniums:
  448|   110k|{
  449|       |    /* Amidines include carboxamidines RC(=NR)NR2,
  450|       |    sulfinamidines RS(=NR)NR2 and phosphinamidines, R2P(=NR)NR2.
  451|       |
  452|       |
  453|       |    NR                              NR
  454|       |    |                               |
  455|       |    R"-Y-NHR'         ===>          R"-Y=N(+)HR'
  456|       |    (+)
  457|       |
  458|       |
  459|       |    Y = C, S, P
  460|       |
  461|       |
  462|       |    Fix:
  463|       |    move positive charge to nitrogen and change single bond to a double one.
  464|       |
  465|       |
  466|       |    Comment:
  467|       |    Fix is applied only if at least one of R's at N is hydrogen
  468|       |    (otherwise we have just a '+' delocalization which is already recognized).
  469|       |
  470|       |
  471|       |    */
  472|       |
  473|       |    /* constants for element numbers */
  474|   110k|    enum elems
  475|   110k|    {
  476|   110k|        dNone, dCl = 17, dBr = 35, dI = 53, dAt = 85, dO = 8,
  477|   110k|        dS = 16, dSe = 34, dTe = 52, dP = 15, dC = 6, dN = 7
  478|   110k|    };
  479|       |
  480|   110k|    static U_CHAR  allowed_elnums_center[] = { dC, dS, dP };
  481|   110k|    int en_center;
  482|   110k|    int i, j, k, jj, kk, k1;
  483|   110k|    int mismatch = 0, nuH = 0, nuN = 0, nitrogens[MAXVAL];
  484|       |
  485|   222k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (485:17): [True: 112k, False: 110k]
  ------------------
  486|   112k|    {
  487|       |        /* Find appropriate central atom. This center should be: ...*/
  488|       |
  489|       |        /* charged exactly (+1) ... */
  490|   112k|        if (at[i].charge != 1)
  ------------------
  |  Branch (490:13): [True: 112k, False: 1]
  ------------------
  491|   112k|        {
  492|   112k|            continue;
  493|   112k|        }
  494|      1|        en_center = at[i].el_number;
  495|       |        /*  from eligible element list ... */
  496|      1|        if (!memchr( allowed_elnums_center, en_center, sizeof( allowed_elnums_center ) ))
  ------------------
  |  Branch (496:13): [True: 1, False: 0]
  ------------------
  497|      1|        {
  498|      1|            continue;
  499|      1|        }
  500|       |        /* has exactly 3 neighbours connected by single bonds*/
  501|      0|        if (at[i].valence != 3)
  ------------------
  |  Branch (501:13): [True: 0, False: 0]
  ------------------
  502|      0|        {
  503|      0|            continue;
  504|      0|        }
  505|      0|        if (at[i].chem_bonds_valence != 3)
  ------------------
  |  Branch (505:13): [True: 0, False: 0]
  ------------------
  506|      0|        {
  507|      0|            continue;
  508|      0|        }
  509|       |
  510|       |        /* non-radical. */
  511|      0|        if (at[i].radical && ( at[i].radical != RADICAL_SINGLET ))
  ------------------
  |  |  103|      0|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (511:13): [True: 0, False: 0]
  |  Branch (511:30): [True: 0, False: 0]
  ------------------
  512|      0|        {
  513|      0|            continue;
  514|      0|        }
  515|       |
  516|       |        /* NB: center must have neutral neighbours, two of them are aliphatic N's of which at least one bears H. */
  517|      0|        mismatch = nuH = nuN = jj = kk = 0;
  518|      0|        memset( nitrogens, 0, sizeof( nitrogens ) );
  519|      0|        jj = -1;
  520|      0|        for (k = 0; k < at[i].valence; k++)
  ------------------
  |  Branch (520:21): [True: 0, False: 0]
  ------------------
  521|      0|        {
  522|      0|            j = at[i].neighbor[k];
  523|       |
  524|      0|            if (at[j].charge != 0)
  ------------------
  |  Branch (524:17): [True: 0, False: 0]
  ------------------
  525|      0|            {
  526|      0|                mismatch = 1;
  527|      0|                break;
  528|      0|            }
  529|      0|            if (at[j].el_number == dN)
  ------------------
  |  Branch (529:17): [True: 0, False: 0]
  ------------------
  530|      0|            {
  531|      0|                if (( at[j].valence > 3 ) || ( at[j].chem_bonds_valence > 3 ))
  ------------------
  |  Branch (531:21): [True: 0, False: 0]
  |  Branch (531:46): [True: 0, False: 0]
  ------------------
  532|      0|                {
  533|      0|                    mismatch = 1;
  534|      0|                    break;
  535|      0|                }
  536|      0|                nuH += NUMH( at, j );
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  537|      0|                nuN++;
  538|      0|                if (jj < 0)
  ------------------
  |  Branch (538:21): [True: 0, False: 0]
  ------------------
  539|      0|                {
  540|      0|                    jj = j;
  541|      0|                    kk = k;
  542|      0|                }
  543|      0|            }
  544|      0|        }
  545|       |
  546|       |        /* If OK, apply changes. */
  547|      0|        if (mismatch)
  ------------------
  |  Branch (547:13): [True: 0, False: 0]
  ------------------
  548|      0|        {
  549|      0|            continue;
  550|      0|        }
  551|      0|        if (nuN != 2)
  ------------------
  |  Branch (551:13): [True: 0, False: 0]
  ------------------
  552|      0|        {
  553|      0|            continue;
  554|      0|        }
  555|      0|        if (nuH < 1)
  ------------------
  |  Branch (555:13): [True: 0, False: 0]
  ------------------
  556|      0|        {
  557|      0|            continue;
  558|      0|        }
  559|      0|        if (jj >= 0)
  ------------------
  |  Branch (559:13): [True: 0, False: 0]
  ------------------
  560|      0|        {
  561|      0|            at[i].charge = 0;
  562|      0|            at[jj].charge = 1;
  563|      0|            at[i].bond_type[kk] = BOND_TYPE_DOUBLE;
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  564|      0|            for (k1 = 0; k1 < at[jj].valence && i != at[jj].neighbor[k1]; k1++)
  ------------------
  |  Branch (564:26): [True: 0, False: 0]
  |  Branch (564:49): [True: 0, False: 0]
  ------------------
  565|      0|                ;
  566|      0|            at[jj].bond_type[k1] = BOND_TYPE_DOUBLE;
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  567|      0|            at[i].chem_bonds_valence++;
  568|      0|            at[jj].chem_bonds_valence++;
  569|       |            /* NB: do nothing with wedge stereo bonds (retain wedge) */
  570|       |
  571|      0|            ( *num_changes )++;
  572|      0|        }
  573|      0|    }  /* end of search for candidate centers. */
  574|       |
  575|   110k|    return 0;
  576|   110k|}
fix_odd_things:
  599|   110k|{
  600|       |    /*                           0 1 2  3  4 5 6  7                       8  9  */
  601|   110k|    static const char    el[] = "N;P;As;Sb;O;S;Se;Te;";   /* 8 elements + C, Si */
  602|   110k|    static U_CHAR  en[10];              /* same number: 8 elements */
  603|   110k|    static int     ne = 0;           /* will be 8 and 10 */
  604|       |
  605|   110k|#define FIRST_NEIGHB2  4
  606|   110k|#define FIRST_CENTER2  5
  607|   110k|#define NUM_CENTERS_N  4
  608|       |
  609|   110k|    int i1, i2, k1, k2, c = -1, num_changes = 0;
  610|   110k|    char elname[ATOM_EL_LEN];
  611|   110k|    int ne2, ne3;
  612|       |
  613|   110k|    if (bFixNonUniformDraw)
  ------------------
  |  Branch (613:9): [True: 110k, False: 0]
  ------------------
  614|   110k|    {
  615|   110k|        int ret1;
  616|   110k|        ret1 = fix_non_uniform_drawn_oxoanions( num_atoms, at, &num_changes );
  617|   110k|        ret1 = fix_non_uniform_drawn_amidiniums( num_atoms, at, &num_changes );
  618|   110k|    }
  619|       |
  620|   110k|    if (!ne)
  ------------------
  |  Branch (620:9): [True: 1, False: 110k]
  ------------------
  621|      1|    {
  622|       |        /* one time initialization */
  623|      1|        const char *b, *e;
  624|      1|        int  len;
  625|      1|        ne3 = 0;
  626|      9|        for (b = el; e = strchr( b, ';' ); b = e + 1)
  ------------------
  |  Branch (626:22): [True: 8, False: 1]
  ------------------
  627|      8|        {
  628|      8|            len = (int) ( e - b );
  629|      8|            memcpy( elname, b, len );
  630|      8|            elname[len] = '\0';
  631|      8|            en[ne3++] = get_periodic_table_number( elname );
  632|      8|        }
  633|      1|        ne2 = ne3;
  634|      1|        en[ne2++] = EL_NUMBER_C;
  ------------------
  |  |   43|      1|#define EL_NUMBER_C ((U_CHAR) 6)
  ------------------
  635|      1|        en[ne2++] = EL_NUMBER_SI;
  ------------------
  |  |   47|      1|#define EL_NUMBER_SI ((U_CHAR) 14)
  ------------------
  636|      1|        ne = ne3;
  637|      1|    }
  638|       |
  639|       |    /* H(-)-X  -> H-X(-);  H(+)-X  -> H-X(+) */
  640|   222k|    for (i1 = 0; i1 < num_atoms; i1++)
  ------------------
  |  Branch (640:18): [True: 112k, False: 110k]
  ------------------
  641|   112k|    {
  642|   112k|        if (1 == at[i1].valence &&
  ------------------
  |  Branch (642:13): [True: 12, False: 112k]
  ------------------
  643|   112k|             1 == abs( at[i1].charge ) &&
  ------------------
  |  Branch (643:14): [True: 10, False: 2]
  ------------------
  644|   112k|             ( 0 == at[i1].radical || RADICAL_SINGLET == at[i1].radical ) &&
  ------------------
  |  |  103|      0|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (644:16): [True: 10, False: 0]
  |  Branch (644:39): [True: 0, False: 0]
  ------------------
  645|   112k|             BOND_TYPE_SINGLE == at[i1].bond_type[0] &&
  ------------------
  |  |   60|     10|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (645:14): [True: 10, False: 0]
  ------------------
  646|   112k|             EL_NUMBER_H == at[i1].el_number && EL_NUMBER_H != at[i2 = (int) at[i1].neighbor[0]].el_number &&
  ------------------
  |  |   41|     10|#define EL_NUMBER_H ((U_CHAR) 1)
  ------------------
                           EL_NUMBER_H == at[i1].el_number && EL_NUMBER_H != at[i2 = (int) at[i1].neighbor[0]].el_number &&
  ------------------
  |  |   41|      0|#define EL_NUMBER_H ((U_CHAR) 1)
  ------------------
  |  Branch (646:14): [True: 0, False: 10]
  |  Branch (646:49): [True: 0, False: 0]
  ------------------
  647|   112k|             !NUMH( at, i1 ) && !NUMH( at, i2 ))
  ------------------
  |  |   88|   112k|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
                           !NUMH( at, i1 ) && !NUMH( at, i2 ))
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (647:14): [True: 0, False: 0]
  |  Branch (647:33): [True: 0, False: 0]
  ------------------
  648|      0|        {
  649|      0|            at[i2].charge += at[i1].charge;
  650|      0|            at[i1].charge = 0;
  651|      0|        }
  652|   112k|    }
  653|       |
  654|       |    /* replace XHm(-)--Y==XHn(+) with XHm==Y--XHn, (n>=0 ,m>=0, X=N,P,As,Sb,O,S,Se,Te) */
  655|   222k|    for (i1 = 0; i1 < num_atoms; i1++)
  ------------------
  |  Branch (655:18): [True: 112k, False: 110k]
  ------------------
  656|   112k|    {
  657|   112k|        if (1 != at[i1].charge ||
  ------------------
  |  Branch (657:13): [True: 112k, False: 1]
  ------------------
  658|   112k|             at[i1].radical && RADICAL_SINGLET != at[i1].radical ||
  ------------------
  |  |  103|      0|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (658:14): [True: 0, False: 1]
  |  Branch (658:32): [True: 0, False: 0]
  ------------------
  659|   112k|             at[i1].chem_bonds_valence == at[i1].valence ||
  ------------------
  |  Branch (659:14): [True: 1, False: 0]
  ------------------
  660|   112k|             !memchr( en, at[i1].el_number, ne ) ||
  ------------------
  |  Branch (660:14): [True: 0, False: 0]
  ------------------
  661|   112k|             get_el_valence( at[i1].el_number, at[i1].charge, 0 ) != at[i1].chem_bonds_valence + NUMH( at, i1 ))
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (661:14): [True: 0, False: 0]
  ------------------
  662|   112k|        {
  663|   112k|            continue;
  664|   112k|        }
  665|       |
  666|       |        /* found a candidate at[i1] for X in XHn(+) */
  667|      0|        if (1 == at[i1].valence &&
  ------------------
  |  Branch (667:13): [True: 0, False: 0]
  ------------------
  668|      0|             BOND_TYPE_DOUBLE == at[i1].bond_type[0])
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (668:14): [True: 0, False: 0]
  ------------------
  669|      0|        {
  670|      0|            c = (int) at[i1].neighbor[0];
  671|      0|            for (k2 = 0; k2 < at[c].valence; k2++)
  ------------------
  |  Branch (671:26): [True: 0, False: 0]
  ------------------
  672|      0|            {
  673|      0|                i2 = at[c].neighbor[k2];
  674|      0|                if (1 == at[i2].valence &&
  ------------------
  |  Branch (674:21): [True: 0, False: 0]
  ------------------
  675|      0|                     -1 == at[i2].charge  &&
  ------------------
  |  Branch (675:22): [True: 0, False: 0]
  ------------------
  676|      0|                     at[i2].el_number == at[i1].el_number && /* exact match */
  ------------------
  |  Branch (676:22): [True: 0, False: 0]
  ------------------
  677|      0|                     ( 0 == at[i2].radical || RADICAL_SINGLET == at[i2].radical ) &&
  ------------------
  |  |  103|      0|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (677:24): [True: 0, False: 0]
  |  Branch (677:47): [True: 0, False: 0]
  ------------------
  678|      0|                     BOND_TYPE_SINGLE == at[i2].bond_type[0] &&
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (678:22): [True: 0, False: 0]
  ------------------
  679|       |                     /*memchr(en, at[i2].el_number, ne) &&*/
  680|      0|                     get_el_valence( at[i2].el_number, at[i2].charge, 0 ) == at[i2].chem_bonds_valence + NUMH( at, i2 ))
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (680:22): [True: 0, False: 0]
  ------------------
  681|      0|                {
  682|       |                    /* found both X(-) and X(+); change bonds and remove charges */
  683|      0|                    for (k1 = 0; k1 < at[c].valence && i1 != at[c].neighbor[k1]; k1++)
  ------------------
  |  Branch (683:34): [True: 0, False: 0]
  |  Branch (683:56): [True: 0, False: 0]
  ------------------
  684|      0|                        ;
  685|      0|                    at[i1].charge = at[i2].charge = 0;
  686|      0|                    at[i1].bond_type[0] = at[c].bond_type[k1] = BOND_TYPE_SINGLE;
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  687|      0|                    at[i1].chem_bonds_valence--;
  688|      0|                    at[i2].bond_type[0] = at[c].bond_type[k2] = BOND_TYPE_DOUBLE;
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  689|      0|                    at[i2].chem_bonds_valence++;
  690|      0|                    num_changes++;
  691|      0|                    break;
  692|      0|                }
  693|      0|            }
  694|      0|        }
  695|      0|        else
  696|      0|        {
  697|       |            /* explicit H case: detect H-neighbors and Y */
  698|      0|            int ineigh, neigh, i1_c, i2_c, num_H_i1, num_H_i2;
  699|      0|            for (ineigh = 0, num_H_i1 = 0, i1_c = -1; ineigh < at[i1].valence; ineigh++)
  ------------------
  |  Branch (699:55): [True: 0, False: 0]
  ------------------
  700|      0|            {
  701|      0|                neigh = at[i1].neighbor[ineigh];
  702|      0|                if (at[neigh].el_number == EL_NUMBER_H)
  ------------------
  |  |   41|      0|#define EL_NUMBER_H ((U_CHAR) 1)
  ------------------
  |  Branch (702:21): [True: 0, False: 0]
  ------------------
  703|      0|                {
  704|      0|                    if (at[neigh].chem_bonds_valence == 1 &&
  ------------------
  |  Branch (704:25): [True: 0, False: 0]
  ------------------
  705|      0|                        ( 0 == at[neigh].radical || RADICAL_SINGLET == at[neigh].radical ))
  ------------------
  |  |  103|      0|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (705:27): [True: 0, False: 0]
  |  Branch (705:53): [True: 0, False: 0]
  ------------------
  706|      0|                    {
  707|      0|                        num_H_i1++; /* found H-neighbor */
  708|      0|                    }
  709|      0|                    else
  710|      0|                    {
  711|      0|                        break;  /* wrong neighbor */
  712|      0|                    }
  713|      0|                }
  714|      0|                else if (at[i1].bond_type[ineigh] == BOND_TYPE_DOUBLE)
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (714:26): [True: 0, False: 0]
  ------------------
  715|      0|                {
  716|       |                    /* found a candidate for Y; bond must be double */
  717|      0|                    i1_c = ineigh;
  718|      0|                    c = neigh;
  719|      0|                }
  720|      0|            }
  721|      0|            if (i1_c < 0 || num_H_i1 + 1 != at[i1].valence)
  ------------------
  |  Branch (721:17): [True: 0, False: 0]
  |  Branch (721:29): [True: 0, False: 0]
  ------------------
  722|      0|            {
  723|      0|                continue;
  724|      0|            }
  725|      0|            for (k2 = 0; k2 < at[c].valence; k2++)
  ------------------
  |  Branch (725:26): [True: 0, False: 0]
  ------------------
  726|      0|            {
  727|      0|                i2 = at[c].neighbor[k2];
  728|      0|                if (-1 == at[i2].charge  &&
  ------------------
  |  Branch (728:21): [True: 0, False: 0]
  ------------------
  729|      0|                     at[i2].el_number == at[i1].el_number && /* exact match */
  ------------------
  |  Branch (729:22): [True: 0, False: 0]
  ------------------
  730|      0|                     ( 0 == at[i2].radical || RADICAL_SINGLET == at[i2].radical ) &&
  ------------------
  |  |  103|      0|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (730:24): [True: 0, False: 0]
  |  Branch (730:47): [True: 0, False: 0]
  ------------------
  731|      0|                     get_el_valence( at[i2].el_number, at[i2].charge, 0 ) == at[i2].chem_bonds_valence + NUMH( at, i2 ))
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (731:22): [True: 0, False: 0]
  ------------------
  732|      0|                {
  733|      0|                    for (ineigh = 0, num_H_i2 = 0, i2_c = -1; ineigh < at[i2].valence; ineigh++)
  ------------------
  |  Branch (733:63): [True: 0, False: 0]
  ------------------
  734|      0|                    {
  735|      0|                        neigh = at[i2].neighbor[ineigh];
  736|      0|                        if (at[neigh].el_number == EL_NUMBER_H)
  ------------------
  |  |   41|      0|#define EL_NUMBER_H ((U_CHAR) 1)
  ------------------
  |  Branch (736:29): [True: 0, False: 0]
  ------------------
  737|      0|                        {
  738|      0|                            if (at[neigh].chem_bonds_valence == 1 &&
  ------------------
  |  Branch (738:33): [True: 0, False: 0]
  ------------------
  739|      0|                                ( 0 == at[neigh].radical || RADICAL_SINGLET == at[neigh].radical ))
  ------------------
  |  |  103|      0|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (739:35): [True: 0, False: 0]
  |  Branch (739:61): [True: 0, False: 0]
  ------------------
  740|      0|                            {
  741|      0|                                num_H_i2++;  /* found H-neighbor */
  742|      0|                            }
  743|      0|                            else
  744|      0|                            {
  745|      0|                                break; /* wrong neighbor */
  746|      0|                            }
  747|      0|                        }
  748|      0|                        else
  749|      0|                        {
  750|      0|                            if (c == neigh && at[i2].bond_type[ineigh] == BOND_TYPE_SINGLE)
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (750:33): [True: 0, False: 0]
  |  Branch (750:47): [True: 0, False: 0]
  ------------------
  751|      0|                            {
  752|      0|                                i2_c = ineigh; /* position of Y neighbor; bond must be single */
  753|      0|                            }
  754|      0|                            else
  755|      0|                            {
  756|      0|                                break;
  757|      0|                            }
  758|      0|                        }
  759|      0|                    }
  760|      0|                    if (num_H_i2 + ( i2_c >= 0 ) != at[i2].valence)
  ------------------
  |  Branch (760:25): [True: 0, False: 0]
  ------------------
  761|      0|                    {
  762|      0|                        continue;
  763|      0|                    }
  764|       |                    /* found both X(-) and X(+); change bonds and remove charges */
  765|      0|                    for (k1 = 0; k1 < at[c].valence && i1 != at[c].neighbor[k1]; k1++)
  ------------------
  |  Branch (765:34): [True: 0, False: 0]
  |  Branch (765:56): [True: 0, False: 0]
  ------------------
  766|      0|                        ;
  767|      0|                    at[i1].charge = at[i2].charge = 0;
  768|      0|                    at[i1].bond_type[i1_c] = at[c].bond_type[k1] = BOND_TYPE_SINGLE;
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  769|      0|                    at[i1].chem_bonds_valence--;
  770|      0|                    at[i2].bond_type[i2_c] = at[c].bond_type[k2] = BOND_TYPE_DOUBLE;
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  771|      0|                    at[i2].chem_bonds_valence++;
  772|      0|                    num_changes++;
  773|      0|                    break;
  774|      0|                }
  775|      0|            } /* k2 */
  776|      0|        }
  777|      0|    }
  778|       |
  779|       |    /* Replace
  780|       |
  781|       |    X-                X        X=O,S,Se,Te -- terminal atoms  (NEIGHB2)
  782|       |    \ |               \ ||
  783|       |    >Y++    with      >Y        Y=S,Se,Te   -- central cation  (CENTER2)
  784|       |    / |               / ||
  785|       |    X-                X        Y valence=4, original Y bond valence = 4
  786|       |
  787|       |
  788|       |    --- the following case of P is processed separately in remove_ion_pairs()
  789|       |    --- therefire, it has been disabled here, see #ifndef FIX_P_IV_Plus_O_Minus -- 2010-03-17 DT
  790|       |
  791|       |    X-                X        X=O,S,Se,Te -- terminal atoms  (NEIGHB2)
  792|       |    \ |               \ ||
  793|       |    >P+     with      >P
  794|       |    / |               / |
  795|       |    X-                X-       Y valence=4, original Y bond valence = 4
  796|       |
  797|       |    */
  798|       |
  799|   222k|    for (i1 = 0; i1 < num_atoms; i1++)
  ------------------
  |  Branch (799:18): [True: 112k, False: 110k]
  ------------------
  800|   112k|    {
  801|   112k|        if (1 == at[i1].valence &&
  ------------------
  |  Branch (801:13): [True: 12, False: 112k]
  ------------------
  802|   112k|             -1 == at[i1].charge &&
  ------------------
  |  Branch (802:14): [True: 10, False: 2]
  ------------------
  803|   112k|             ( 0 == at[i1].radical || RADICAL_SINGLET == at[i1].radical ) &&
  ------------------
  |  |  103|      0|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (803:16): [True: 10, False: 0]
  |  Branch (803:39): [True: 0, False: 0]
  ------------------
  804|   112k|             !NUMH( at, i1 ) &&
  ------------------
  |  |   88|   112k|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|     10|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (804:14): [True: 10, False: 0]
  ------------------
  805|   112k|             BOND_TYPE_SINGLE == at[i1].bond_type[0] &&
  ------------------
  |  |   60|     10|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (805:14): [True: 10, False: 0]
  ------------------
  806|   112k|             memchr( en + FIRST_NEIGHB2, at[i1].el_number, ne - FIRST_NEIGHB2 ))
  ------------------
  |  |  605|     10|#define FIRST_NEIGHB2  4
  ------------------
                           memchr( en + FIRST_NEIGHB2, at[i1].el_number, ne - FIRST_NEIGHB2 ))
  ------------------
  |  |  605|     10|#define FIRST_NEIGHB2  4
  ------------------
  |  Branch (806:14): [True: 10, False: 0]
  ------------------
  807|     10|        {
  808|     10|            int charge, i;
  809|       |            /* found a candidate for X */
  810|     10|            c = (int) at[i1].neighbor[0]; /* candidate for Y */
  811|     10|            if (( ( charge = 2 ) == at[c].charge && memchr( en + FIRST_CENTER2, at[c].el_number, ne - FIRST_CENTER2 )
  ------------------
  |  |  606|      0|#define FIRST_CENTER2  5
  ------------------
                          if (( ( charge = 2 ) == at[c].charge && memchr( en + FIRST_CENTER2, at[c].el_number, ne - FIRST_CENTER2 )
  ------------------
  |  |  606|      0|#define FIRST_CENTER2  5
  ------------------
  |  Branch (811:19): [True: 0, False: 10]
  |  Branch (811:53): [True: 0, False: 0]
  ------------------
  812|       |
  813|       |#ifndef FIX_P_IV_Plus_O_Minus
  814|       |                  || ( charge = 1 ) == at[c].charge && EL_NUMBER_P == at[c].el_number
  815|       |#endif
  816|     10|                  ) &&
  817|     10|                 4 == at[c].valence &&
  ------------------
  |  Branch (817:18): [True: 0, False: 0]
  ------------------
  818|     10|                 ( 0 == at[c].radical || RADICAL_SINGLET == at[c].radical ) &&
  ------------------
  |  |  103|      0|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (818:20): [True: 0, False: 0]
  |  Branch (818:42): [True: 0, False: 0]
  ------------------
  819|     10|                 at[c].valence == at[c].chem_bonds_valence &&
  ------------------
  |  Branch (819:18): [True: 0, False: 0]
  ------------------
  820|     10|                 !NUMH( at, c ))
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (820:18): [True: 0, False: 0]
  ------------------
  821|      0|            {
  822|      0|                ;  /* accept */
  823|      0|            }
  824|     10|            else
  825|     10|            {
  826|     10|                continue; /* ignore at[i1] */
  827|     10|            }
  828|      0|            for (k2 = 0; k2 < at[c].valence; k2++)
  ------------------
  |  Branch (828:26): [True: 0, False: 0]
  ------------------
  829|      0|            {
  830|      0|                i2 = at[c].neighbor[k2];
  831|      0|                if (i2 == i1)
  ------------------
  |  Branch (831:21): [True: 0, False: 0]
  ------------------
  832|      0|                {
  833|      0|                    continue;
  834|      0|                }
  835|      0|                if (1 == at[i2].valence &&
  ------------------
  |  Branch (835:21): [True: 0, False: 0]
  ------------------
  836|      0|                     -1 == at[i2].charge  &&
  ------------------
  |  Branch (836:22): [True: 0, False: 0]
  ------------------
  837|      0|                     memchr( en + FIRST_NEIGHB2, at[i2].el_number, ne - FIRST_NEIGHB2 ) &&
  ------------------
  |  |  605|      0|#define FIRST_NEIGHB2  4
  ------------------
                                   memchr( en + FIRST_NEIGHB2, at[i2].el_number, ne - FIRST_NEIGHB2 ) &&
  ------------------
  |  |  605|      0|#define FIRST_NEIGHB2  4
  ------------------
  |  Branch (837:22): [True: 0, False: 0]
  ------------------
  838|       |                     /*at[i2].el_number == at[i1].el_number &&*/ /* exact match */
  839|      0|                     ( 0 == at[i2].radical || RADICAL_SINGLET == at[i2].radical ) &&
  ------------------
  |  |  103|      0|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (839:24): [True: 0, False: 0]
  |  Branch (839:47): [True: 0, False: 0]
  ------------------
  840|      0|                     !NUMH( at, i2 ) &&
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (840:22): [True: 0, False: 0]
  ------------------
  841|      0|                     BOND_TYPE_SINGLE == at[i2].bond_type[0])
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (841:22): [True: 0, False: 0]
  ------------------
  842|      0|                {
  843|       |                    /* found both X(-) and X(-); change bonds and remove charges */
  844|      0|                    for (k1 = 0; k1 < at[c].valence && i1 != at[c].neighbor[k1]; k1++)
  ------------------
  |  Branch (844:34): [True: 0, False: 0]
  |  Branch (844:56): [True: 0, False: 0]
  ------------------
  845|      0|                    {
  846|      0|                        ;
  847|      0|                    }
  848|      0|                    for (i = 0; i < charge; i++)
  ------------------
  |  Branch (848:33): [True: 0, False: 0]
  ------------------
  849|      0|                    {
  850|       |                        /* in case of P it does not matter which X atom is neutralized
  851|       |                        because of tautomerism. However, neutral central atom is important
  852|       |                        for the neutralization of the components */
  853|      0|                        switch (i)
  ------------------
  |  Branch (853:33): [True: 0, False: 0]
  ------------------
  854|      0|                        {
  855|      0|                            case 0:
  ------------------
  |  Branch (855:29): [True: 0, False: 0]
  ------------------
  856|      0|                                at[i1].charge++; /* = 0; changed 2010-03-17 DT*/
  857|      0|                                at[i1].bond_type[0] = at[c].bond_type[k1] = BOND_TYPE_DOUBLE;
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  858|      0|                                at[i1].bond_stereo[0] = at[c].bond_stereo[k1] = 0;
  859|      0|                                at[i1].chem_bonds_valence++;
  860|      0|                                at[c].chem_bonds_valence++;
  861|      0|                                if (bFixBug) at[c].charge--; /* added 2010-03-17 DT*/
  ------------------
  |  Branch (861:37): [True: 0, False: 0]
  ------------------
  862|      0|                                num_changes++;
  863|      0|                                break;
  864|      0|                            case 1:
  ------------------
  |  Branch (864:29): [True: 0, False: 0]
  ------------------
  865|      0|                                at[i2].charge++; /*= 0; changed 2010-03-17 DT*/
  866|      0|                                at[i2].bond_type[0] = at[c].bond_type[k2] = BOND_TYPE_DOUBLE;
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  867|      0|                                at[i2].bond_stereo[0] = at[c].bond_stereo[k2] = 0;
  868|      0|                                at[i2].chem_bonds_valence++;
  869|      0|                                at[c].chem_bonds_valence++;
  870|      0|                                if (bFixBug) at[c].charge--; /* added 2010-03-17 DT */
  ------------------
  |  Branch (870:37): [True: 0, False: 0]
  ------------------
  871|      0|                                num_changes++;
  872|      0|                                break;
  873|      0|                        }
  874|      0|                    }
  875|       |
  876|       |                    /*   -- removed -- 2010-03-17 DT
  877|       |                    #if ( FIX_ODD_THINGS_REM_Plus_BUG == 1 )
  878|       |                    at[c].charge -= charge;
  879|       |                    #else
  880|       |                    if ( bFixBug )
  881|       |                    {
  882|       |                    at[c].charge -= charge;
  883|       |                    }
  884|       |                    #endif
  885|       |                    */
  886|      0|                    break;
  887|      0|                }
  888|      0|            }
  889|      0|        }
  890|   112k|    }
  891|       |
  892|       |    /* A(doublet)-B(doublet) -> A=B  (A and B have no other doublet neighbors) */
  893|       |    /* A(doublet)=B(doublet) -> A#B  (A and B have no other doublet neighbors) */
  894|   222k|    for (i1 = 0; i1 < num_atoms; i1++)
  ------------------
  |  Branch (894:18): [True: 112k, False: 110k]
  ------------------
  895|   112k|    {
  896|   112k|        if (RADICAL_DOUBLET == at[i1].radical &&
  ------------------
  |  |  104|   112k|#define RADICAL_DOUBLET 2
  ------------------
  |  Branch (896:13): [True: 6, False: 112k]
  ------------------
  897|   112k|             0 <= ( i2 = the_only_doublet_neigh( at, i1, &k1, &k2 ) ))
  ------------------
  |  Branch (897:14): [True: 0, False: 6]
  ------------------
  898|      0|        {
  899|      0|            if (at[i1].bond_type[k1] <= BOND_TYPE_DOUBLE)
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (899:17): [True: 0, False: 0]
  ------------------
  900|      0|            {
  901|      0|                at[i1].bond_type[k1] ++;
  902|      0|                at[i1].chem_bonds_valence++;
  903|      0|                at[i2].bond_type[k2] ++;
  904|      0|                at[i2].chem_bonds_valence++;
  905|      0|                at[i1].radical = 0;
  906|      0|                at[i2].radical = 0;
  907|      0|            }
  908|      0|        }
  909|   112k|    }
  910|       |
  911|   110k|#if ( REMOVE_ION_PAIRS_EARLY == 1 )
  912|   110k|    num_changes += remove_ion_pairs( num_atoms, at );
  913|   110k|#endif
  914|       |
  915|   110k|    return num_changes;
  916|   110k|}
post_fix_odd_things:
  921|  54.6k|{
  922|  54.6k|    int num_changes = 0;
  923|       |    /* currently does nothing */
  924|  54.6k|    return
  925|  54.6k|        num_changes;
  926|  54.6k|}
remove_ion_pairs:
 1048|   110k|{
 1049|   110k|    int num_changes = 0;
 1050|       |
 1051|       |    /*                           0 1 2  3  4 5 6  7  8  9                   8  9  */
 1052|       |#if ( FIX_REM_ION_PAIRS_Si_BUG == 1 )
 1053|       |    static const char    el[] = "N;P;As;Sb;O;S;Se;Te;C;Si;";   /* 8 elements + C, Si */
 1054|       |#else
 1055|   110k|    static const char    el[] = "N;P;As;Sb;O;S;Se;Te;C;Si";   /* 8 elements + C, Si */
 1056|   110k|#endif
 1057|   110k|    static char    en[12];         /* same number: 8 elements */
 1058|   110k|    static int     ne = 0;           /* will be 8 and 10 */
 1059|       |
 1060|   110k|#define ELEM_N_FST  0
 1061|   110k|#define ELEM_N_LEN  4
 1062|   110k|#define ELEM_O_FST  4
 1063|   110k|#define ELEM_O_LEN  4
 1064|   110k|#define ELEM_C_FST  8
 1065|   110k|#define ELEM_C_LEN  2
 1066|       |
 1067|   110k|#define MAX_NEIGH 6
 1068|       |
 1069|   110k|    int i, n, n2, i1, i2, i3, i4, type, chrg;
 1070|   110k|    int num_C_II = 0, num_C_plus = 0, num_C_minus = 0, num_N_plus = 0, num_N_minus = 0, num_O_plus = 0, num_O_minus = 0, num_All;
 1071|       |
 1072|   110k|#ifdef FIX_P_IV_Plus_O_Minus
 1073|   110k|    int num_P_IV_plus = 0; /* added 2010-03-17 DT */
 1074|   110k|#endif
 1075|       |
 1076|   110k|    inp_ATOM *a;
 1077|   110k|    char elname[ATOM_EL_LEN], *p;
 1078|       |
 1079|   110k|    int ne2;
 1080|       |
 1081|   110k|    if (!ne)
  ------------------
  |  Branch (1081:9): [True: 1, False: 110k]
  ------------------
 1082|      1|    {
 1083|       |        /* one time initialization */
 1084|      1|        const char *b, *e;
 1085|      1|        int  len;
 1086|      1|        ne2 = 0;
 1087|     10|        for (b = el; e = strchr( b, ';' ); b = e + 1)
  ------------------
  |  Branch (1087:22): [True: 9, False: 1]
  ------------------
 1088|      9|        {
 1089|      9|            len = (int) ( e - b );
 1090|      9|            memcpy( elname, b, len );
 1091|      9|            elname[len] = '\0';
 1092|      9|            en[ne2++] = get_periodic_table_number( elname );
 1093|      9|        }
 1094|      1|        en[ne2] = '\0';
 1095|      1|        ne = ne2;
 1096|      1|    }
 1097|       |
 1098|       |    /****** count candidates ********/
 1099|   222k|    for (i = 0, a = at; i < num_atoms; i++, a++)
  ------------------
  |  Branch (1099:25): [True: 112k, False: 110k]
  ------------------
 1100|   112k|    {
 1101|   112k|        if (1 == ( chrg = a->charge ) || -1 == chrg)
  ------------------
  |  Branch (1101:13): [True: 1, False: 112k]
  |  Branch (1101:42): [True: 20, False: 112k]
  ------------------
 1102|     21|        {
 1103|     21|            if (p = (char*) memchr( en, a->el_number, ne ))
  ------------------
  |  Branch (1103:17): [True: 18, False: 3]
  ------------------
 1104|     18|            {
 1105|     18|                n = (int) ( p - en );
 1106|     18|                if (n >= ELEM_C_FST)
  ------------------
  |  | 1064|     18|#define ELEM_C_FST  8
  ------------------
  |  Branch (1106:21): [True: 6, False: 12]
  ------------------
 1107|      6|                {
 1108|      6|                    if (chrg > 0)
  ------------------
  |  Branch (1108:25): [True: 0, False: 6]
  ------------------
 1109|      0|                    {
 1110|      0|                        num_C_plus++;
 1111|      0|                    }
 1112|      6|                    else
 1113|      6|                    {
 1114|      6|                        num_C_minus++;
 1115|      6|                    }
 1116|      6|                }
 1117|     12|                else if (n >= ELEM_O_FST)
  ------------------
  |  | 1062|     12|#define ELEM_O_FST  4
  ------------------
  |  Branch (1117:26): [True: 10, False: 2]
  ------------------
 1118|     10|                {
 1119|     10|                    if (chrg > 0)
  ------------------
  |  Branch (1119:25): [True: 0, False: 10]
  ------------------
 1120|      0|                    {
 1121|      0|                        num_O_plus++;
 1122|      0|                    }
 1123|     10|                    else
 1124|     10|                    {
 1125|     10|                        num_O_minus++;
 1126|     10|                    }
 1127|     10|                }
 1128|      2|                else
 1129|      2|                {
 1130|      2|                    if (chrg > 0)
  ------------------
  |  Branch (1130:25): [True: 0, False: 2]
  ------------------
 1131|      0|                    {
 1132|      0|                        num_N_plus++;
 1133|      0|                    }
 1134|      2|                    else
 1135|      2|                    {
 1136|      2|                        num_N_minus++;
 1137|      2|                    }
 1138|       |
 1139|      2|#ifdef FIX_P_IV_Plus_O_Minus
 1140|      2|                    num_P_IV_plus += n > 0 && chrg == 1 && a->valence == 4 && a->chem_bonds_valence == 4; /* added 2010-03-17 DT */
  ------------------
  |  Branch (1140:38): [True: 0, False: 2]
  |  Branch (1140:47): [True: 0, False: 0]
  |  Branch (1140:60): [True: 0, False: 0]
  |  Branch (1140:79): [True: 0, False: 0]
  ------------------
 1141|      2|#endif
 1142|      2|                }
 1143|     18|            }
 1144|     21|        }
 1145|   112k|        else if (!chrg && a->chem_bonds_valence + NUMH( a, 0 ) == 2 &&
  ------------------
  |  |   88|   112k|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|   112k|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (1145:18): [True: 112k, False: 6]
  |  Branch (1145:27): [True: 4, False: 112k]
  ------------------
 1146|   112k|                  get_el_valence( a->el_number, 0, 0 ) == 4 &&
  ------------------
  |  Branch (1146:19): [True: 0, False: 4]
  ------------------
 1147|   112k|                  NULL != memchr( en + ELEM_C_FST, a->el_number, ELEM_C_LEN ))
  ------------------
  |  | 1064|      0|#define ELEM_C_FST  8
  ------------------
                                NULL != memchr( en + ELEM_C_FST, a->el_number, ELEM_C_LEN ))
  ------------------
  |  | 1065|      0|#define ELEM_C_LEN  2
  ------------------
  |  Branch (1147:19): [True: 0, False: 0]
  ------------------
 1148|      0|        {
 1149|      0|            num_C_II++;
 1150|      0|        }
 1151|   112k|    }
 1152|       |
 1153|   110k|    num_All = num_C_II + num_C_plus + num_C_minus + num_N_plus + num_N_minus + num_O_plus + num_O_minus;
 1154|       |
 1155|       |    /* do not add num_P_IV_plus ! -- 2010-03-17 DT */
 1156|   110k|    if (!num_All)
  ------------------
  |  Branch (1156:9): [True: 110k, False: 6]
  ------------------
 1157|   110k|    {
 1158|   110k|        return 0;
 1159|   110k|    }
 1160|       |
 1161|       |    /**************************************************************************/
 1162|       |    /*************************** Terminal ion pairs ***************************/
 1163|       |    /**************************************************************************/
 1164|       |
 1165|       |    /*-------------------------------------------------------------------------
 1166|       |    Pair type 1            N=N,P,As,Sb; O=O,S,Se,Te
 1167|       |    ===========
 1168|       |
 1169|       |    X              X     if X is another -O(-) then neutralize O(-)
 1170|       |    |              |     that has the smallest periodic table number
 1171|       |    O=N(+)-O(-) => O=N=O
 1172|       |    i    n
 1173|       |    --------------------------------------------------------------------------*/
 1174|       |
 1175|    114|    for (type = 1; type <= 18; type++)
  ------------------
  |  Branch (1175:20): [True: 108, False: 6]
  ------------------
 1176|    108|    {
 1177|    108|        if (( !type || 1 == type ))
  ------------------
  |  Branch (1177:15): [True: 0, False: 108]
  |  Branch (1177:24): [True: 6, False: 102]
  ------------------
 1178|      6|        {
 1179|      6|            for (i = 0; i < num_atoms && 0 < num_N_plus && 0 < num_O_minus; i++)
  ------------------
  |  Branch (1179:25): [True: 6, False: 0]
  |  Branch (1179:42): [True: 0, False: 6]
  |  Branch (1179:60): [True: 0, False: 0]
  ------------------
 1180|      0|            {
 1181|      0|                if (1 == at[i].charge && 3 == nNoMetalNumBonds( at, i ) &&
  ------------------
  |  Branch (1181:21): [True: 0, False: 0]
  |  Branch (1181:42): [True: 0, False: 0]
  ------------------
 1182|      0|                     4 == nNoMetalBondsValence( at, i ) &&
  ------------------
  |  Branch (1182:22): [True: 0, False: 0]
  ------------------
 1183|      0|                     NULL != memchr( en + ELEM_N_FST, at[i].el_number, ELEM_N_LEN ))
  ------------------
  |  | 1060|      0|#define ELEM_N_FST  0
  ------------------
                                   NULL != memchr( en + ELEM_N_FST, at[i].el_number, ELEM_N_LEN ))
  ------------------
  |  | 1061|      0|#define ELEM_N_LEN  4
  ------------------
  |  Branch (1183:22): [True: 0, False: 0]
  ------------------
 1184|      0|                {
 1185|      0|                    int num_OM = 0, ord_OM[3]; /* -O(-) */
 1186|      0|                    int num_O = 0; /* =O    */
 1187|      0|                    int num_O_other = 0;
 1188|      0|                    for (i1 = 0; i1 < at[i].valence; i1++)
  ------------------
  |  Branch (1188:34): [True: 0, False: 0]
  ------------------
 1189|      0|                    {
 1190|      0|                        n = at[i].neighbor[i1];
 1191|      0|                        if (1 == nNoMetalNumBonds( at, n ) && 0 == num_of_H( at, n ) &&
  ------------------
  |  Branch (1191:29): [True: 0, False: 0]
  |  Branch (1191:63): [True: 0, False: 0]
  ------------------
 1192|      0|                             NULL != ( p = (char*) memchr( en + ELEM_O_FST, at[n].el_number, ELEM_O_LEN ) ))
  ------------------
  |  | 1062|      0|#define ELEM_O_FST  4
  ------------------
                                           NULL != ( p = (char*) memchr( en + ELEM_O_FST, at[n].el_number, ELEM_O_LEN ) ))
  ------------------
  |  | 1063|      0|#define ELEM_O_LEN  4
  ------------------
  |  Branch (1192:30): [True: 0, False: 0]
  ------------------
 1193|      0|                        {
 1194|      0|                            if (BOND_TYPE_SINGLE == at[i].bond_type[i1] &&
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (1194:33): [True: 0, False: 0]
  ------------------
 1195|      0|                                 -1 == at[n].charge)
  ------------------
  |  Branch (1195:34): [True: 0, False: 0]
  ------------------
 1196|      0|                            {
 1197|      0|                                ord_OM[num_OM++] = i1;
 1198|      0|                            }
 1199|      0|                            else if (BOND_TYPE_DOUBLE == at[n].bond_type[0] &&
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (1199:38): [True: 0, False: 0]
  ------------------
 1200|      0|                                      0 == at[n].charge)
  ------------------
  |  Branch (1200:39): [True: 0, False: 0]
  ------------------
 1201|      0|                            {
 1202|      0|                                num_O++;
 1203|      0|                            }
 1204|      0|                            else
 1205|      0|                            {
 1206|      0|                                num_O_other++;
 1207|      0|                            }
 1208|      0|                        }
 1209|      0|                    }
 1210|      0|                    if (num_OM > 0 && num_O > 0 && !num_O_other &&
  ------------------
  |  Branch (1210:25): [True: 0, False: 0]
  |  Branch (1210:39): [True: 0, False: 0]
  |  Branch (1210:52): [True: 0, False: 0]
  ------------------
 1211|      0|                         0 <= ( i1 = nFindOneOM( at, i, ord_OM, num_OM ) ))
  ------------------
  |  Branch (1211:26): [True: 0, False: 0]
  ------------------
 1212|      0|                    {
 1213|       |                        /* remove charges and increase bond order */
 1214|      0|                        n = at[i].neighbor[i1];
 1215|      0|                        i2 = (int) ( is_in_the_list( at[n].neighbor, (AT_NUMB) i, at[n].valence ) - at[n].neighbor );
 1216|      0|                        at[i].bond_type[i1] ++;
 1217|      0|                        at[n].bond_type[i2] ++;
 1218|      0|                        at[i].chem_bonds_valence++;
 1219|      0|                        at[n].chem_bonds_valence++;
 1220|      0|                        at[i].charge--;
 1221|      0|                        at[n].charge++;
 1222|      0|                        at[i].radical = 0;
 1223|      0|                        at[n].radical = 0;
 1224|      0|                        num_changes++;
 1225|      0|                        num_N_plus--;
 1226|      0|                        num_O_minus--;
 1227|      0|                        num_All -= 2;
 1228|      0|                    }
 1229|      0|                }
 1230|      0|            }
 1231|       |
 1232|      6|#ifdef FIX_P_IV_Plus_O_Minus
 1233|       |
 1234|       |            /*-------------------------------------------------------------------------
 1235|       |            Pair type 1a           P=P,As,Sb; O=O,S,Se,Te  -- added 2010-03-17
 1236|       |            =============
 1237|       |
 1238|       |            X              X     if X, Y, or Z is another -O(-) then neutralize O(-)
 1239|       |            |              |     that has the smallest periodic table number
 1240|       |            Y-P(+)-O(-) => Y-P=O
 1241|       |            |i   n         |
 1242|       |            Z              Z
 1243|       |
 1244|       |            --------------------------------------------------------------------------*/
 1245|       |
 1246|      6|            for (i = 0; i < num_atoms && 0 < num_P_IV_plus /*&& 0 < num_N_plus*/ && 0 < num_O_minus; i++)
  ------------------
  |  Branch (1246:25): [True: 6, False: 0]
  |  Branch (1246:42): [True: 0, False: 6]
  |  Branch (1246:85): [True: 0, False: 0]
  ------------------
 1247|      0|            {
 1248|      0|                if (1 == at[i].charge && 4 == nNoMetalNumBonds( at, i ) &&
  ------------------
  |  Branch (1248:21): [True: 0, False: 0]
  |  Branch (1248:42): [True: 0, False: 0]
  ------------------
 1249|      0|                     4 == nNoMetalBondsValence( at, i ) &&
  ------------------
  |  Branch (1249:22): [True: 0, False: 0]
  ------------------
 1250|      0|                     NULL != memchr( en + ELEM_N_FST + 1, at[i].el_number, ELEM_N_LEN - 1 ))
  ------------------
  |  | 1060|      0|#define ELEM_N_FST  0
  ------------------
                                   NULL != memchr( en + ELEM_N_FST + 1, at[i].el_number, ELEM_N_LEN - 1 ))
  ------------------
  |  | 1061|      0|#define ELEM_N_LEN  4
  ------------------
  |  Branch (1250:22): [True: 0, False: 0]
  ------------------
 1251|      0|                {
 1252|      0|                    int num_OM = 0, ord_OM[4]; /* -O(-) */
 1253|       |                                               /*int num_O  = 0;*/ /* =O    */
 1254|      0|                    int num_O_other = 0;
 1255|      0|                    for (i1 = 0; i1 < at[i].valence; i1++)
  ------------------
  |  Branch (1255:34): [True: 0, False: 0]
  ------------------
 1256|      0|                    {
 1257|      0|                        n = at[i].neighbor[i1];
 1258|      0|                        if (1 == nNoMetalNumBonds( at, n ) && 0 == num_of_H( at, n ) &&
  ------------------
  |  Branch (1258:29): [True: 0, False: 0]
  |  Branch (1258:63): [True: 0, False: 0]
  ------------------
 1259|      0|                             NULL != ( p = (char*) memchr( en + ELEM_O_FST, at[n].el_number, ELEM_O_LEN ) ))
  ------------------
  |  | 1062|      0|#define ELEM_O_FST  4
  ------------------
                                           NULL != ( p = (char*) memchr( en + ELEM_O_FST, at[n].el_number, ELEM_O_LEN ) ))
  ------------------
  |  | 1063|      0|#define ELEM_O_LEN  4
  ------------------
  |  Branch (1259:30): [True: 0, False: 0]
  ------------------
 1260|      0|                        {
 1261|      0|                            if (BOND_TYPE_SINGLE == at[i].bond_type[i1] &&
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (1261:33): [True: 0, False: 0]
  ------------------
 1262|      0|                                 -1 == at[n].charge)
  ------------------
  |  Branch (1262:34): [True: 0, False: 0]
  ------------------
 1263|      0|                            {
 1264|      0|                                ord_OM[num_OM++] = i1;
 1265|       |                                /*
 1266|       |                                }
 1267|       |                                if ( BOND_TYPE_DOUBLE == at[n].bond_type[0] &&
 1268|       |                                0                == at[n].charge       ) {
 1269|       |                                num_O ++;
 1270|       |                                */
 1271|      0|                            }
 1272|      0|                            else
 1273|      0|                            {
 1274|      0|                                num_O_other++;
 1275|      0|                            }
 1276|      0|                        }
 1277|      0|                    }
 1278|      0|                    if (num_OM > 0 /*&& num_O > 0 && !num_O_other*/ &&
  ------------------
  |  Branch (1278:25): [True: 0, False: 0]
  ------------------
 1279|      0|                         0 <= ( i1 = nFindOneOM( at, i, ord_OM, num_OM ) ))
  ------------------
  |  Branch (1279:26): [True: 0, False: 0]
  ------------------
 1280|      0|                    {
 1281|       |                        /* remove charges and increase bond order */
 1282|      0|                        n = at[i].neighbor[i1];
 1283|      0|                        i2 = is_in_the_list( at[n].neighbor, (AT_NUMB) i, at[n].valence ) - at[n].neighbor;
 1284|      0|                        at[i].bond_type[i1] ++;
 1285|      0|                        at[n].bond_type[i2] ++;
 1286|      0|                        at[i].chem_bonds_valence++;
 1287|      0|                        at[n].chem_bonds_valence++;
 1288|      0|                        at[i].charge--;
 1289|      0|                        at[n].charge++;
 1290|      0|                        at[i].radical = 0;
 1291|      0|                        at[n].radical = 0;
 1292|      0|                        num_changes++;
 1293|      0|                        num_N_plus--;
 1294|      0|                        num_O_minus--;
 1295|      0|                        num_P_IV_plus--;
 1296|      0|                        num_All -= 2;
 1297|      0|                    }
 1298|      0|                }
 1299|      0|            }
 1300|      6|#endif /* FIX_P_IV_Plus_O_Minus */
 1301|      6|        }
 1302|       |
 1303|       |
 1304|       |        /*-------------------------------------------------------------------------
 1305|       |        Terminal pair types: 2,3,4,5,6,7,8,9   N=N,P,As,Sb; O=O,S,Se,Te; C=C,Si
 1306|       |        ====================================
 1307|       |        type #
 1308|       |        2 2:  O=N-C(II)-     => O=N#C-      N=N,P,As,Sb; O=O,S,Se,Te; C=C,Si
 1309|       |        3 9:  O=O(+)-C(-)(III) => O=O=C(IV)
 1310|       |        4 3:  O(-)-N(+)(IV)  => O=N(V)  (input structure has at least 1 double bond)
 1311|       |        5 4:  O(-)-O(+)(III) => O=O(IV)
 1312|       |        6 8:  O(-)-O-C(+)(III) => O=O=C(IV)
 1313|       |        7 5:  N(-)=N(+)(IV)  => N#N(V)    allow terminal H on N(-)
 1314|       |        8 6:  N(-)=O(+)(III) => N#O-
 1315|       |        9 7:  N(-)=C(+)(III) => N#C-
 1316|       |        --------------------------------------------------------------------------*/
 1317|       |
 1318|    108|        if (!type || 2 <= type && type <= 9)
  ------------------
  |  Branch (1318:13): [True: 0, False: 108]
  |  Branch (1318:22): [True: 102, False: 6]
  |  Branch (1318:35): [True: 48, False: 54]
  ------------------
 1319|     48|        {
 1320|    288|            for (i = 0; i < num_atoms && 0 < num_All; i++)
  ------------------
  |  Branch (1320:25): [True: 240, False: 48]
  |  Branch (1320:42): [True: 240, False: 0]
  ------------------
 1321|    240|            {
 1322|    240|                if (0 == at[i].charge && 1 == nNoMetalNumBonds( at, i ) && 2 == nNoMetalBondsValence( at, i ) &&
  ------------------
  |  Branch (1322:21): [True: 32, False: 208]
  |  Branch (1322:42): [True: 0, False: 32]
  |  Branch (1322:76): [True: 0, False: 0]
  ------------------
 1323|    240|                     0 == num_of_H( at, i ) &&
  ------------------
  |  Branch (1323:22): [True: 0, False: 0]
  ------------------
 1324|    240|                     NULL != memchr( en + ELEM_O_FST, at[i].el_number, ELEM_O_LEN ) &&
  ------------------
  |  | 1062|      0|#define ELEM_O_FST  4
  ------------------
                                   NULL != memchr( en + ELEM_O_FST, at[i].el_number, ELEM_O_LEN ) &&
  ------------------
  |  | 1063|      0|#define ELEM_O_LEN  4
  ------------------
  |  Branch (1324:22): [True: 0, False: 0]
  ------------------
 1325|    240|                     0 <= ( i1 = nNoMetalNeighIndex( at, i ) ) &&
  ------------------
  |  Branch (1325:22): [True: 0, False: 0]
  ------------------
 1326|    240|                     at[i].bond_type[i1] <= BOND_TYPE_TRIPLE)
  ------------------
  |  |   62|      0|#define BOND_TYPE_TRIPLE    3
  ------------------
  |  Branch (1326:22): [True: 0, False: 0]
  ------------------
 1327|      0|                {
 1328|       |                    /* terminal O= */
 1329|      0|                    n = at[i].neighbor[i1];
 1330|      0|                    if (( !type || type == 2 ) && 0 < num_C_II)
  ------------------
  |  Branch (1330:27): [True: 0, False: 0]
  |  Branch (1330:36): [True: 0, False: 0]
  |  Branch (1330:51): [True: 0, False: 0]
  ------------------
 1331|      0|                    {
 1332|       |                        /* avoid alternating bonds */
 1333|      0|                        if (0 == at[n].charge &&
  ------------------
  |  Branch (1333:29): [True: 0, False: 0]
  ------------------
 1334|      0|                             2 == nNoMetalNumBonds( at, n ) && 3 == nNoMetalBondsValence( at, n ) &&
  ------------------
  |  Branch (1334:30): [True: 0, False: 0]
  |  Branch (1334:64): [True: 0, False: 0]
  ------------------
 1335|      0|                             0 == num_of_H( at, n ) &&
  ------------------
  |  Branch (1335:30): [True: 0, False: 0]
  ------------------
 1336|      0|                             NULL != memchr( en + ELEM_N_FST, at[n].el_number, ELEM_N_LEN ) &&
  ------------------
  |  | 1060|      0|#define ELEM_N_FST  0
  ------------------
                                           NULL != memchr( en + ELEM_N_FST, at[n].el_number, ELEM_N_LEN ) &&
  ------------------
  |  | 1061|      0|#define ELEM_N_LEN  4
  ------------------
  |  Branch (1336:30): [True: 0, False: 0]
  ------------------
 1337|      0|                             0 <= ( i2 = nNoMetalOtherNeighIndex( at, n, i ) ) &&
  ------------------
  |  Branch (1337:30): [True: 0, False: 0]
  ------------------
 1338|      0|                             at[n].bond_type[i2] <= BOND_TYPE_TRIPLE)
  ------------------
  |  |   62|      0|#define BOND_TYPE_TRIPLE    3
  ------------------
  |  Branch (1338:30): [True: 0, False: 0]
  ------------------
 1339|      0|                        {
 1340|       |                            /* i2 = index of opposite to at[i] neighbor of at[n] */
 1341|       |                            /*i2 = (at[n].neighbor[0] == i);*/
 1342|      0|                            n2 = at[n].neighbor[i2];
 1343|      0|                            if (0 == at[n2].charge &&
  ------------------
  |  Branch (1343:33): [True: 0, False: 0]
  ------------------
 1344|      0|                                 2 == at[n2].valence && 2 == at[n2].chem_bonds_valence &&
  ------------------
  |  Branch (1344:34): [True: 0, False: 0]
  |  Branch (1344:57): [True: 0, False: 0]
  ------------------
 1345|      0|                                 0 == num_of_H( at, n2 ) &&
  ------------------
  |  Branch (1345:34): [True: 0, False: 0]
  ------------------
 1346|      0|                                 NULL != memchr( en + ELEM_C_FST, at[n2].el_number, ELEM_C_LEN ))
  ------------------
  |  | 1064|      0|#define ELEM_C_FST  8
  ------------------
                                               NULL != memchr( en + ELEM_C_FST, at[n2].el_number, ELEM_C_LEN ))
  ------------------
  |  | 1065|      0|#define ELEM_C_LEN  2
  ------------------
  |  Branch (1346:34): [True: 0, False: 0]
  ------------------
 1347|      0|                            {
 1348|       |                                /*       i n n2     */
 1349|       |                                /* found O=N-C(II)- */
 1350|       |                                /* convert O=N-C(II)-     => O=N#C- */
 1351|       |
 1352|      0|                                i3 = ( at[n2].neighbor[0] != n ); /* index of at[n] neighbor of n2 */
 1353|      0|                                at[n].chem_bonds_valence = 5; /* N */
 1354|      0|                                at[n2].chem_bonds_valence = 4; /* C */
 1355|      0|                                at[n].bond_type[i2] = BOND_TYPE_TRIPLE;
  ------------------
  |  |   62|      0|#define BOND_TYPE_TRIPLE    3
  ------------------
 1356|      0|                                at[n2].bond_type[i3] = BOND_TYPE_TRIPLE;
  ------------------
  |  |   62|      0|#define BOND_TYPE_TRIPLE    3
  ------------------
 1357|      0|                                at[n2].radical = 0;
 1358|      0|                                num_changes++;
 1359|      0|                                num_C_II--;
 1360|      0|                                num_All--;
 1361|      0|                                continue;
 1362|      0|                            }
 1363|      0|                        }
 1364|      0|                    }
 1365|       |
 1366|      0|                    if (( !type || type == 3 ) && 0 < num_O_plus && 0 < num_C_minus)
  ------------------
  |  Branch (1366:27): [True: 0, False: 0]
  |  Branch (1366:36): [True: 0, False: 0]
  |  Branch (1366:51): [True: 0, False: 0]
  |  Branch (1366:69): [True: 0, False: 0]
  ------------------
 1367|      0|                    {
 1368|      0|                        if (1 == at[n].charge && 2 == nNoMetalNumBonds( at, n ) && 3 == nNoMetalBondsValence( at, n ) &&
  ------------------
  |  Branch (1368:29): [True: 0, False: 0]
  |  Branch (1368:50): [True: 0, False: 0]
  |  Branch (1368:84): [True: 0, False: 0]
  ------------------
 1369|      0|                             0 == num_of_H( at, n ) &&
  ------------------
  |  Branch (1369:30): [True: 0, False: 0]
  ------------------
 1370|      0|                             NULL != memchr( en + ELEM_O_FST, at[n].el_number, ELEM_O_LEN ) &&
  ------------------
  |  | 1062|      0|#define ELEM_O_FST  4
  ------------------
                                           NULL != memchr( en + ELEM_O_FST, at[n].el_number, ELEM_O_LEN ) &&
  ------------------
  |  | 1063|      0|#define ELEM_O_LEN  4
  ------------------
  |  Branch (1370:30): [True: 0, False: 0]
  ------------------
 1371|      0|                             0 <= ( i2 = nNoMetalOtherNeighIndex( at, n, i ) ) &&
  ------------------
  |  Branch (1371:30): [True: 0, False: 0]
  ------------------
 1372|      0|                             at[n].bond_type[i2] <= BOND_TYPE_TRIPLE)
  ------------------
  |  |   62|      0|#define BOND_TYPE_TRIPLE    3
  ------------------
  |  Branch (1372:30): [True: 0, False: 0]
  ------------------
 1373|      0|                        {
 1374|       |                            /* found O=O(+)- */
 1375|       |                            /* i2 = index of opposite to at[i] neighbor of at[n] */
 1376|       |                            /*i2 = (at[n].neighbor[0] == i);*/
 1377|      0|                            n2 = at[n].neighbor[i2];
 1378|      0|                            if (-1 == at[n2].charge && 3 >= nNoMetalNumBonds( at, n2 ) && 3 == nNoMetalBondsValence( at, n2 ) + NUMH( at, n2 ) &&
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (1378:33): [True: 0, False: 0]
  |  Branch (1378:56): [True: 0, False: 0]
  |  Branch (1378:91): [True: 0, False: 0]
  ------------------
 1379|      0|                                 NULL != memchr( en + ELEM_C_FST, at[n2].el_number, ELEM_C_LEN ))
  ------------------
  |  | 1064|      0|#define ELEM_C_FST  8
  ------------------
                                               NULL != memchr( en + ELEM_C_FST, at[n2].el_number, ELEM_C_LEN ))
  ------------------
  |  | 1065|      0|#define ELEM_C_LEN  2
  ------------------
  |  Branch (1379:34): [True: 0, False: 0]
  ------------------
 1380|      0|                            {
 1381|       |                                /*             i n    n2        */
 1382|       |                                /* found found O=O(+)-C(-)(III) */
 1383|       |                                /* convert O=O(+)-C(-)(III)     => O=O=C(IV) */
 1384|      0|                                i3 = ( at[n2].neighbor[0] != n ); /* index of at[n] neighbor of n2 */
 1385|      0|                                at[n].charge--;
 1386|      0|                                at[n2].charge++;
 1387|      0|                                at[n].chem_bonds_valence += 1; /* =O- => =O= */
 1388|      0|                                at[n2].chem_bonds_valence += 1; /* -C  => =C  */
 1389|      0|                                at[n].bond_type[i2] = BOND_TYPE_DOUBLE;
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
 1390|      0|                                at[n2].bond_type[i3] = BOND_TYPE_DOUBLE;
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
 1391|      0|                                num_changes++;
 1392|      0|                                num_O_plus--;
 1393|      0|                                num_C_minus--;
 1394|      0|                                num_All -= 2;
 1395|      0|                                continue;
 1396|      0|                            }
 1397|      0|                        }
 1398|      0|                    }
 1399|      0|                }
 1400|       |
 1401|    240|                else if (-1 == at[i].charge &&
  ------------------
  |  Branch (1401:26): [True: 160, False: 80]
  ------------------
 1402|    240|                          0 < num_O_minus + num_N_minus &&
  ------------------
  |  Branch (1402:27): [True: 160, False: 0]
  ------------------
 1403|    240|                          0 < num_N_plus + num_O_plus + num_C_plus &&
  ------------------
  |  Branch (1403:27): [True: 0, False: 160]
  ------------------
 1404|    240|                          1 == nNoMetalNumBonds( at, i ) && 1 == nNoMetalBondsValence( at, i ) &&
  ------------------
  |  Branch (1404:27): [True: 0, False: 0]
  |  Branch (1404:61): [True: 0, False: 0]
  ------------------
 1405|    240|                          0 == num_of_H( at, i ) &&
  ------------------
  |  Branch (1405:27): [True: 0, False: 0]
  ------------------
 1406|    240|                          NULL != memchr( en + ELEM_O_FST, at[i].el_number, ELEM_O_LEN ) &&
  ------------------
  |  | 1062|      0|#define ELEM_O_FST  4
  ------------------
                                        NULL != memchr( en + ELEM_O_FST, at[i].el_number, ELEM_O_LEN ) &&
  ------------------
  |  | 1063|      0|#define ELEM_O_LEN  4
  ------------------
  |  Branch (1406:27): [True: 0, False: 0]
  ------------------
 1407|    240|                          0 <= ( i1 = nNoMetalNeighIndex( at, i ) ) &&
  ------------------
  |  Branch (1407:27): [True: 0, False: 0]
  ------------------
 1408|    240|                          at[i].bond_type[i1] <= BOND_TYPE_TRIPLE)
  ------------------
  |  |   62|      0|#define BOND_TYPE_TRIPLE    3
  ------------------
  |  Branch (1408:27): [True: 0, False: 0]
  ------------------
 1409|      0|                {
 1410|       |                    /* terminal O(-)- */
 1411|      0|                    n = at[i].neighbor[i1];
 1412|       |
 1413|      0|                    if (( !type || type == 4 ) && 0 < num_O_minus && 0 < num_N_plus && /* O(-)-N(+)(IV) */
  ------------------
  |  Branch (1413:27): [True: 0, False: 0]
  |  Branch (1413:36): [True: 0, False: 0]
  |  Branch (1413:51): [True: 0, False: 0]
  |  Branch (1413:70): [True: 0, False: 0]
  ------------------
 1414|      0|                         1 == at[n].charge && 3 >= nNoMetalNumBonds( at, n ) && 4 == nNoMetalBondsValence( at, n ) &&
  ------------------
  |  Branch (1414:26): [True: 0, False: 0]
  |  Branch (1414:47): [True: 0, False: 0]
  |  Branch (1414:81): [True: 0, False: 0]
  ------------------
 1415|      0|                         0 == num_of_H( at, n ) &&
  ------------------
  |  Branch (1415:26): [True: 0, False: 0]
  ------------------
 1416|      0|                         NULL != memchr( en + ELEM_N_FST, at[n].el_number, ELEM_N_LEN ) /* except >O(+)- */
  ------------------
  |  | 1060|      0|#define ELEM_N_FST  0
  ------------------
                                       NULL != memchr( en + ELEM_N_FST, at[n].el_number, ELEM_N_LEN ) /* except >O(+)- */
  ------------------
  |  | 1061|      0|#define ELEM_N_LEN  4
  ------------------
  |  Branch (1416:26): [True: 0, False: 0]
  ------------------
 1417|      0|                         )
 1418|      0|                    {
 1419|       |                        /* found O(-)-N(+)(IV) */
 1420|       |                        /* convert O(-)-N(+)(IV)     => O=N(V)  */
 1421|       |
 1422|      0|                        i2 = (int) ( is_in_the_list( at[n].neighbor, (AT_NUMB) i, at[n].valence ) - at[n].neighbor ); /* index of at[i] neighbor of at[n] */
 1423|      0|                        at[i].charge++;
 1424|      0|                        at[n].charge--;
 1425|      0|                        at[i].chem_bonds_valence++;
 1426|      0|                        at[n].chem_bonds_valence++;
 1427|      0|                        at[i].bond_type[i1] ++;
 1428|      0|                        at[n].bond_type[i2] ++;
 1429|      0|                        num_changes++;
 1430|      0|                        num_O_minus--;
 1431|      0|                        num_N_plus--;
 1432|      0|                        num_All -= 2;
 1433|      0|                        continue;
 1434|      0|                    }
 1435|       |
 1436|      0|                    if (( !type || type == 5 ) && 0 < num_O_minus && 0 < num_O_plus &&/* O(-)-O(+)(III) */
  ------------------
  |  Branch (1436:27): [True: 0, False: 0]
  |  Branch (1436:36): [True: 0, False: 0]
  |  Branch (1436:51): [True: 0, False: 0]
  |  Branch (1436:70): [True: 0, False: 0]
  ------------------
 1437|      0|                         1 == at[n].charge && 3 >= nNoMetalNumBonds( at, n ) && 3 == nNoMetalBondsValence( at, n ) &&
  ------------------
  |  Branch (1437:26): [True: 0, False: 0]
  |  Branch (1437:47): [True: 0, False: 0]
  |  Branch (1437:81): [True: 0, False: 0]
  ------------------
 1438|      0|                         0 == num_of_H( at, n ) &&
  ------------------
  |  Branch (1438:26): [True: 0, False: 0]
  ------------------
 1439|      0|                         NULL != memchr( en + ELEM_O_FST, at[n].el_number, ELEM_O_LEN ) /* except >O(+)- */
  ------------------
  |  | 1062|      0|#define ELEM_O_FST  4
  ------------------
                                       NULL != memchr( en + ELEM_O_FST, at[n].el_number, ELEM_O_LEN ) /* except >O(+)- */
  ------------------
  |  | 1063|      0|#define ELEM_O_LEN  4
  ------------------
  |  Branch (1439:26): [True: 0, False: 0]
  ------------------
 1440|      0|                         )
 1441|      0|                    {
 1442|       |                        /* found  O(+)(III) */
 1443|       |                        /* convert O(-)-O(+)(III)    => O=O(IV) */
 1444|       |
 1445|      0|                        i2 = (int) ( is_in_the_list( at[n].neighbor, (AT_NUMB) i, at[n].valence ) - at[n].neighbor ); /* index of at[i] neighbor of at[n] */
 1446|      0|                        at[i].charge++;
 1447|      0|                        at[n].charge--;
 1448|      0|                        at[i].chem_bonds_valence++;
 1449|      0|                        at[n].chem_bonds_valence++;
 1450|      0|                        at[i].bond_type[i1] ++;
 1451|      0|                        at[n].bond_type[i2] ++;
 1452|      0|                        num_changes++;
 1453|      0|                        num_O_minus--;
 1454|      0|                        num_O_plus--;
 1455|      0|                        num_All -= 2;
 1456|      0|                        continue;
 1457|      0|                    }
 1458|       |
 1459|       |                    /* i    n n2        */
 1460|      0|                    if (( !type || type == 6 ) && /* O(-)-O-C(+)(III) */
  ------------------
  |  Branch (1460:27): [True: 0, False: 0]
  |  Branch (1460:36): [True: 0, False: 0]
  ------------------
 1461|      0|                         0 < num_O_minus && 0 < num_C_plus &&
  ------------------
  |  Branch (1461:26): [True: 0, False: 0]
  |  Branch (1461:45): [True: 0, False: 0]
  ------------------
 1462|      0|                         0 == at[n].charge && 2 == nNoMetalNumBonds( at, n ) && 2 == nNoMetalBondsValence( at, n ) &&
  ------------------
  |  Branch (1462:26): [True: 0, False: 0]
  |  Branch (1462:47): [True: 0, False: 0]
  |  Branch (1462:81): [True: 0, False: 0]
  ------------------
 1463|      0|                         0 == num_of_H( at, n ) &&
  ------------------
  |  Branch (1463:26): [True: 0, False: 0]
  ------------------
 1464|      0|                         NULL != memchr( en + ELEM_O_FST, at[n].el_number, ELEM_O_LEN ) &&
  ------------------
  |  | 1062|      0|#define ELEM_O_FST  4
  ------------------
                                       NULL != memchr( en + ELEM_O_FST, at[n].el_number, ELEM_O_LEN ) &&
  ------------------
  |  | 1063|      0|#define ELEM_O_LEN  4
  ------------------
  |  Branch (1464:26): [True: 0, False: 0]
  ------------------
 1465|      0|                         0 <= ( i2 = nNoMetalOtherNeighIndex( at, n, i ) ) &&
  ------------------
  |  Branch (1465:26): [True: 0, False: 0]
  ------------------
 1466|      0|                         at[n].bond_type[i2] <= BOND_TYPE_TRIPLE)
  ------------------
  |  |   62|      0|#define BOND_TYPE_TRIPLE    3
  ------------------
  |  Branch (1466:26): [True: 0, False: 0]
  ------------------
 1467|      0|                    {
 1468|       |                        /* found O(-)-O- */
 1469|       |                        /* i2 = index of opposite to at[i] neighbor of at[n] */
 1470|       |                        /*i2 = (at[n].neighbor[0] == i);*/
 1471|      0|                        n2 = at[n].neighbor[i2];
 1472|      0|                        if (1 == at[n2].charge && 3 >= nNoMetalNumBonds( at, n2 ) &&
  ------------------
  |  Branch (1472:29): [True: 0, False: 0]
  |  Branch (1472:51): [True: 0, False: 0]
  ------------------
 1473|      0|                             3 == nNoMetalBondsValence( at, n2 ) + NUMH( at, n2 ) &&
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (1473:30): [True: 0, False: 0]
  ------------------
 1474|      0|                             NULL != memchr( en + ELEM_C_FST, at[n2].el_number, ELEM_C_LEN ))
  ------------------
  |  | 1064|      0|#define ELEM_C_FST  8
  ------------------
                                           NULL != memchr( en + ELEM_C_FST, at[n2].el_number, ELEM_C_LEN ))
  ------------------
  |  | 1065|      0|#define ELEM_C_LEN  2
  ------------------
  |  Branch (1474:30): [True: 0, False: 0]
  ------------------
 1475|      0|                        {
 1476|       |                            /*       i    n n2  */
 1477|       |                            /* found O(-)-O-C(+)(III) */
 1478|       |                            /* convert O(-)-O-C(+)(III)     => O=O=C(IV) */
 1479|       |                            /*i3 = (at[n2].neighbor[0] != n);*/ /* i3 = index of at[n] neighbor of at[n2] */
 1480|      0|                            i3 = (int) ( is_in_the_list( at[n2].neighbor, (AT_NUMB) n, at[n2].valence ) - at[n2].neighbor );
 1481|       |                            /*i4 = index of at[i] in the adjacency list of at[n] */
 1482|      0|                            i4 = (int) ( is_in_the_list( at[n].neighbor, (AT_NUMB) i, at[n].valence ) - at[n].neighbor );
 1483|      0|                            at[i].charge++;
 1484|      0|                            at[n2].charge--;
 1485|      0|                            at[i].chem_bonds_valence += 1; /* O-  => O=  */
 1486|      0|                            at[n].chem_bonds_valence += 2; /* -O- => =O= */
 1487|      0|                            at[n2].chem_bonds_valence += 1; /* -C  => =C  */
 1488|      0|                            at[i].bond_type[i1] = BOND_TYPE_DOUBLE;
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
 1489|      0|                            at[n].bond_type[i4] = BOND_TYPE_DOUBLE;
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
 1490|      0|                            at[n].bond_type[i2] = BOND_TYPE_DOUBLE;
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
 1491|      0|                            at[n2].bond_type[i3] = BOND_TYPE_DOUBLE;
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
 1492|      0|                            num_changes++;
 1493|      0|                            num_O_minus--;
 1494|      0|                            num_C_plus--;
 1495|      0|                            num_All -= 2;
 1496|      0|                            continue;
 1497|      0|                        }
 1498|      0|                    }
 1499|      0|                }
 1500|    240|                else if (-1 == at[i].charge && 0 < num_N_minus && 0 < num_N_plus + num_O_plus + num_C_plus &&
  ------------------
  |  Branch (1500:26): [True: 160, False: 80]
  |  Branch (1500:48): [True: 48, False: 112]
  |  Branch (1500:67): [True: 0, False: 48]
  ------------------
 1501|    240|                          1 == nNoMetalNumBonds( at, i ) && 2 == nNoMetalBondsValence( at, i ) + NUMH( at, i ) &&
  ------------------
  |  |   88|    240|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (1501:27): [True: 0, False: 0]
  |  Branch (1501:61): [True: 0, False: 0]
  ------------------
 1502|       |                          /*0 == num_of_H( at, i ) &&*/
 1503|    240|                          NULL != memchr( en + ELEM_N_FST, at[i].el_number, ELEM_N_LEN ) &&
  ------------------
  |  | 1060|      0|#define ELEM_N_FST  0
  ------------------
                                        NULL != memchr( en + ELEM_N_FST, at[i].el_number, ELEM_N_LEN ) &&
  ------------------
  |  | 1061|      0|#define ELEM_N_LEN  4
  ------------------
  |  Branch (1503:27): [True: 0, False: 0]
  ------------------
 1504|    240|                          0 <= ( i1 = nNoMetalNeighIndex( at, i ) ) &&
  ------------------
  |  Branch (1504:27): [True: 0, False: 0]
  ------------------
 1505|    240|                          at[i].bond_type[i1] <= BOND_TYPE_TRIPLE)
  ------------------
  |  |   62|      0|#define BOND_TYPE_TRIPLE    3
  ------------------
  |  Branch (1505:27): [True: 0, False: 0]
  ------------------
 1506|      0|                {
 1507|       |                    /* terminal N(-)= */
 1508|      0|                    n = at[i].neighbor[i1 = 0];
 1509|      0|                    if (( !type || type == 7 ) && 0 < num_N_plus && /* N(-)=N(+)(IV) */
  ------------------
  |  Branch (1509:27): [True: 0, False: 0]
  |  Branch (1509:36): [True: 0, False: 0]
  |  Branch (1509:51): [True: 0, False: 0]
  ------------------
 1510|      0|                         1 == at[n].charge && 3 >= nNoMetalNumBonds( at, n ) && 4 == nNoMetalBondsValence( at, n ) &&
  ------------------
  |  Branch (1510:26): [True: 0, False: 0]
  |  Branch (1510:47): [True: 0, False: 0]
  |  Branch (1510:81): [True: 0, False: 0]
  ------------------
 1511|      0|                         0 == num_of_H( at, n ) &&
  ------------------
  |  Branch (1511:26): [True: 0, False: 0]
  ------------------
 1512|      0|                         NULL != memchr( en + ELEM_N_FST, at[n].el_number, ELEM_N_LEN ))
  ------------------
  |  | 1060|      0|#define ELEM_N_FST  0
  ------------------
                                       NULL != memchr( en + ELEM_N_FST, at[n].el_number, ELEM_N_LEN ))
  ------------------
  |  | 1061|      0|#define ELEM_N_LEN  4
  ------------------
  |  Branch (1512:26): [True: 0, False: 0]
  ------------------
 1513|      0|                    {
 1514|       |                        /* found N(-)-N(+)(IV) */
 1515|       |                        /* convert N(-)=N(+)(IV)     => N#N(V)  */
 1516|       |
 1517|      0|                        i2 = (int) ( is_in_the_list( at[n].neighbor, (AT_NUMB) i, at[n].valence ) - at[n].neighbor ); /* index of at[i] neighbor of at[n] */
 1518|      0|                        at[i].charge++;
 1519|      0|                        at[n].charge--;
 1520|      0|                        at[i].chem_bonds_valence++;
 1521|      0|                        at[n].chem_bonds_valence++;
 1522|      0|                        at[i].bond_type[i1] ++;
 1523|      0|                        at[n].bond_type[i2] ++;
 1524|      0|                        num_changes++;
 1525|      0|                        num_N_minus--;
 1526|      0|                        num_N_plus--;
 1527|      0|                        num_All -= 2;
 1528|      0|                        continue;
 1529|      0|                    }
 1530|      0|                    if (( !type || type == 8 ) && 0 < num_O_plus && /* N(-)=O(+)(III) */
  ------------------
  |  Branch (1530:27): [True: 0, False: 0]
  |  Branch (1530:36): [True: 0, False: 0]
  |  Branch (1530:51): [True: 0, False: 0]
  ------------------
 1531|      0|                         1 == at[n].charge && 2 == nNoMetalNumBonds( at, n ) && 3 == nNoMetalBondsValence( at, n ) &&
  ------------------
  |  Branch (1531:26): [True: 0, False: 0]
  |  Branch (1531:47): [True: 0, False: 0]
  |  Branch (1531:81): [True: 0, False: 0]
  ------------------
 1532|      0|                         0 == num_of_H( at, n ) &&
  ------------------
  |  Branch (1532:26): [True: 0, False: 0]
  ------------------
 1533|      0|                         NULL != memchr( en + ELEM_O_FST, at[n].el_number, ELEM_O_LEN ))
  ------------------
  |  | 1062|      0|#define ELEM_O_FST  4
  ------------------
                                       NULL != memchr( en + ELEM_O_FST, at[n].el_number, ELEM_O_LEN ))
  ------------------
  |  | 1063|      0|#define ELEM_O_LEN  4
  ------------------
  |  Branch (1533:26): [True: 0, False: 0]
  ------------------
 1534|      0|                    {
 1535|       |                        /* found N(-)-O(+)(III) */
 1536|       |                        /* convert N(-)=O(+)(III)    => N#O(IV)- */
 1537|      0|                        i2 = (int) ( is_in_the_list( at[n].neighbor, (AT_NUMB) i, at[n].valence ) - at[n].neighbor ); /* index of at[i] neighbor of at[n] */
 1538|      0|                        at[i].charge++;
 1539|      0|                        at[n].charge--;
 1540|      0|                        at[i].chem_bonds_valence++;
 1541|      0|                        at[n].chem_bonds_valence++;
 1542|      0|                        at[i].bond_type[i1] ++;
 1543|      0|                        at[n].bond_type[i2] ++;
 1544|      0|                        num_changes++;
 1545|      0|                        num_N_minus--;
 1546|      0|                        num_O_plus--;
 1547|      0|                        num_All -= 2;
 1548|      0|                        continue;
 1549|      0|                    }
 1550|      0|                    if (( !type || type == 9 ) && 0 < num_C_plus && /* N(-)=C(+)(III) */
  ------------------
  |  Branch (1550:27): [True: 0, False: 0]
  |  Branch (1550:36): [True: 0, False: 0]
  |  Branch (1550:51): [True: 0, False: 0]
  ------------------
 1551|      0|                         1 == at[n].charge && 2 == at[n].valence && 3 == at[n].chem_bonds_valence &&
  ------------------
  |  Branch (1551:26): [True: 0, False: 0]
  |  Branch (1551:47): [True: 0, False: 0]
  |  Branch (1551:69): [True: 0, False: 0]
  ------------------
 1552|      0|                         0 == num_of_H( at, n ) &&
  ------------------
  |  Branch (1552:26): [True: 0, False: 0]
  ------------------
 1553|      0|                         NULL != memchr( en + ELEM_C_FST, at[n].el_number, ELEM_C_LEN ))
  ------------------
  |  | 1064|      0|#define ELEM_C_FST  8
  ------------------
                                       NULL != memchr( en + ELEM_C_FST, at[n].el_number, ELEM_C_LEN ))
  ------------------
  |  | 1065|      0|#define ELEM_C_LEN  2
  ------------------
  |  Branch (1553:26): [True: 0, False: 0]
  ------------------
 1554|      0|                    {
 1555|       |                        /* found N(-)=C(+)(III) */
 1556|       |                        /* convert N(-)=C(+)(III)    => N#C(IV)- */
 1557|       |
 1558|      0|                        i2 = (int) ( is_in_the_list( at[n].neighbor, (AT_NUMB) i, at[n].valence ) - at[n].neighbor ); /* index of at[i] neighbor of at[n] */
 1559|      0|                        at[i].charge++;
 1560|      0|                        at[n].charge--;
 1561|      0|                        at[i].chem_bonds_valence++;
 1562|      0|                        at[n].chem_bonds_valence++;
 1563|      0|                        at[i].bond_type[i1] ++;
 1564|      0|                        at[n].bond_type[i2] ++;
 1565|      0|                        num_changes++;
 1566|      0|                        num_N_minus--;
 1567|      0|                        num_C_plus--;
 1568|      0|                        num_All -= 2;
 1569|      0|                        continue;
 1570|      0|                    }
 1571|      0|                }
 1572|    240|            }
 1573|     48|        }
 1574|       |
 1575|       |        /**************************************************************************/
 1576|       |        /*********************** NON-Terminal ion pairs ***************************/
 1577|       |        /**************************************************************************/
 1578|       |        /*-------------------------------------------------------------------------
 1579|       |        Non-Terminal pair types: 10,11,12,13,14   N=N,P,As,Sb; O=O,S,Se,Te; C=C,Si
 1580|       |        ========================================
 1581|       |
 1582|       |        10:  N(+)(IV)-C(-)(III)     => N(V)=C(IV)  (N has 3 or 2 bonds)
 1583|       |        11:  N(+)(IV)=C(-)(III)     => N(V)#C(IV)  (N has 3 or 2 bonds)
 1584|       |        12:  N(+)(IV)-N(-)(II)      => N(V)=N(III) (allow terminal H on N(-))
 1585|       |        13: -O(+)-C(-)(III)         => -O=C-
 1586|       |        14: -O(+)=C(-)(III)         => -O#C-
 1587|       |        15:  O(+)(III)-N(-)(II)     => O(IV)=N(III) (allow terminal H on N(-))
 1588|       |        --------------------------------------------------------------------------*/
 1589|       |
 1590|    108|        if (!type || 10 <= type && type <= 15)
  ------------------
  |  Branch (1590:13): [True: 0, False: 108]
  |  Branch (1590:22): [True: 54, False: 54]
  |  Branch (1590:36): [True: 36, False: 18]
  ------------------
 1591|     36|        {
 1592|    216|            for (i = 0; i < num_atoms && 0 < num_All; i++)
  ------------------
  |  Branch (1592:25): [True: 180, False: 36]
  |  Branch (1592:42): [True: 180, False: 0]
  ------------------
 1593|    180|            {
 1594|    180|                if (1 == at[i].charge &&
  ------------------
  |  Branch (1594:21): [True: 0, False: 180]
  ------------------
 1595|    180|                     0 < num_N_plus + num_O_plus && 0 < num_C_minus + num_N_minus &&
  ------------------
  |  Branch (1595:22): [True: 0, False: 0]
  |  Branch (1595:53): [True: 0, False: 0]
  ------------------
 1596|    180|                     4 >= nNoMetalNumBonds( at, i ) && 4 == nNoMetalBondsValence( at, i ) &&
  ------------------
  |  Branch (1596:22): [True: 0, False: 0]
  |  Branch (1596:56): [True: 0, False: 0]
  ------------------
 1597|    180|                     0 == num_of_H( at, i ) &&
  ------------------
  |  Branch (1597:22): [True: 0, False: 0]
  ------------------
 1598|    180|                     NULL != memchr( en + ELEM_N_FST, at[i].el_number, ELEM_N_LEN ))
  ------------------
  |  | 1060|      0|#define ELEM_N_FST  0
  ------------------
                                   NULL != memchr( en + ELEM_N_FST, at[i].el_number, ELEM_N_LEN ))
  ------------------
  |  | 1061|      0|#define ELEM_N_LEN  4
  ------------------
  |  Branch (1598:22): [True: 0, False: 0]
  ------------------
 1599|      0|                {
 1600|       |                    /* found non-terminal N(+)(IV) */
 1601|      0|                    if (( !type || 10 == type ) && 0 < num_N_plus && 0 < num_C_minus)
  ------------------
  |  Branch (1601:27): [True: 0, False: 0]
  |  Branch (1601:36): [True: 0, False: 0]
  |  Branch (1601:52): [True: 0, False: 0]
  |  Branch (1601:70): [True: 0, False: 0]
  ------------------
 1602|      0|                    {
 1603|      0|                        int num_neigh = 0, pos_neigh = -1;
 1604|      0|                        for (i1 = 0; i1 < at[i].valence; i1++)
  ------------------
  |  Branch (1604:38): [True: 0, False: 0]
  ------------------
 1605|      0|                        {
 1606|      0|                            n = at[i].neighbor[i1];
 1607|      0|                            if (-1 == at[n].charge && 3 >= at[n].valence && 3 == at[n].chem_bonds_valence + NUMH( at, n ) &&
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (1607:33): [True: 0, False: 0]
  |  Branch (1607:55): [True: 0, False: 0]
  |  Branch (1607:77): [True: 0, False: 0]
  ------------------
 1608|       |                                 /*0 == at[n].num_H &&*/
 1609|      0|                                 at[i].bond_type[i1] == BOND_TYPE_SINGLE &&
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (1609:34): [True: 0, False: 0]
  ------------------
 1610|      0|                                 NULL != memchr( en + ELEM_C_FST, at[n].el_number, ELEM_C_LEN ))
  ------------------
  |  | 1064|      0|#define ELEM_C_FST  8
  ------------------
                                               NULL != memchr( en + ELEM_C_FST, at[n].el_number, ELEM_C_LEN ))
  ------------------
  |  | 1065|      0|#define ELEM_C_LEN  2
  ------------------
  |  Branch (1610:34): [True: 0, False: 0]
  ------------------
 1611|      0|                            {
 1612|       |                                /* found N(+)(IV)-C(-)(III); prepare conversion to N(V)=C(IV) */
 1613|      0|                                num_neigh++;
 1614|      0|                                pos_neigh = i1;
 1615|      0|                            }
 1616|      0|                        }
 1617|      0|                        i1 = pos_neigh;
 1618|      0|                        if (1 == num_neigh &&
  ------------------
  |  Branch (1618:29): [True: 0, False: 0]
  ------------------
 1619|      0|                             at[i].bond_type[i1] <= BOND_TYPE_TRIPLE &&
  ------------------
  |  |   62|      0|#define BOND_TYPE_TRIPLE    3
  ------------------
  |  Branch (1619:30): [True: 0, False: 0]
  ------------------
 1620|      0|                             !has_other_ion_neigh( at, i, n = at[i].neighbor[i1], en, ne ) &&
  ------------------
  |  Branch (1620:30): [True: 0, False: 0]
  ------------------
 1621|      0|                             !has_other_ion_neigh( at, n, i, en, ne ))
  ------------------
  |  Branch (1621:30): [True: 0, False: 0]
  ------------------
 1622|      0|                        {
 1623|       |                            /*n = at[i].neighbor[i1=pos_neigh];*/
 1624|      0|                            i2 = (int) ( is_in_the_list( at[n].neighbor, (AT_NUMB) i, at[n].valence ) - at[n].neighbor );
 1625|      0|                            at[i].charge--;
 1626|      0|                            at[n].charge++;
 1627|      0|                            at[i].chem_bonds_valence++;
 1628|      0|                            at[n].chem_bonds_valence++;
 1629|      0|                            at[i].bond_type[i1] ++;
 1630|      0|                            at[n].bond_type[i2] ++;
 1631|      0|                            num_changes++;
 1632|      0|                            num_C_minus--;
 1633|      0|                            num_N_plus--;
 1634|      0|                            num_All -= 2;
 1635|      0|                            continue;
 1636|      0|                        }
 1637|      0|                    }
 1638|      0|                    if (( !type || 11 == type ) && 0 < num_N_plus && 0 < num_C_minus)
  ------------------
  |  Branch (1638:27): [True: 0, False: 0]
  |  Branch (1638:36): [True: 0, False: 0]
  |  Branch (1638:52): [True: 0, False: 0]
  |  Branch (1638:70): [True: 0, False: 0]
  ------------------
 1639|      0|                    {
 1640|      0|                        int num_neigh = 0, pos_neigh = -1;
 1641|      0|                        for (i1 = 0; i1 < at[i].valence; i1++)
  ------------------
  |  Branch (1641:38): [True: 0, False: 0]
  ------------------
 1642|      0|                        {
 1643|      0|                            n = at[i].neighbor[i1];
 1644|      0|                            if (-1 == at[n].charge && 3 >= at[n].valence && 3 == at[n].chem_bonds_valence + NUMH( at, n ) &&
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (1644:33): [True: 0, False: 0]
  |  Branch (1644:55): [True: 0, False: 0]
  |  Branch (1644:77): [True: 0, False: 0]
  ------------------
 1645|       |                                 /*0 == at[n].num_H &&*/
 1646|      0|                                 at[i].bond_type[i1] == BOND_TYPE_DOUBLE &&
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (1646:34): [True: 0, False: 0]
  ------------------
 1647|      0|                                 NULL != memchr( en + ELEM_C_FST, at[n].el_number, ELEM_C_LEN ))
  ------------------
  |  | 1064|      0|#define ELEM_C_FST  8
  ------------------
                                               NULL != memchr( en + ELEM_C_FST, at[n].el_number, ELEM_C_LEN ))
  ------------------
  |  | 1065|      0|#define ELEM_C_LEN  2
  ------------------
  |  Branch (1647:34): [True: 0, False: 0]
  ------------------
 1648|      0|                            {
 1649|       |                                /* found N(+)(IV)=C(-)(III); prepare conversion to N(V)#C(IV) */
 1650|      0|                                num_neigh++;
 1651|      0|                                pos_neigh = i1;
 1652|      0|                            }
 1653|      0|                        }
 1654|      0|                        if (1 == num_neigh &&
  ------------------
  |  Branch (1654:29): [True: 0, False: 0]
  ------------------
 1655|      0|                             !has_other_ion_neigh( at, i, n = at[i].neighbor[i1 = pos_neigh], en, ne ) &&
  ------------------
  |  Branch (1655:30): [True: 0, False: 0]
  ------------------
 1656|      0|                             !has_other_ion_neigh( at, n, i, en, ne ))
  ------------------
  |  Branch (1656:30): [True: 0, False: 0]
  ------------------
 1657|      0|                        {
 1658|       |                            /*n = at[i].neighbor[i1=pos_neigh];*/
 1659|      0|                            i2 = (int) ( is_in_the_list( at[n].neighbor, (AT_NUMB) i, at[n].valence ) - at[n].neighbor );
 1660|      0|                            at[i].charge--;
 1661|      0|                            at[n].charge++;
 1662|      0|                            at[i].chem_bonds_valence++;
 1663|      0|                            at[n].chem_bonds_valence++;
 1664|      0|                            at[i].bond_type[i1] ++;
 1665|      0|                            at[n].bond_type[i2] ++;
 1666|      0|                            num_changes++;
 1667|      0|                            num_C_minus--;
 1668|      0|                            num_N_plus--;
 1669|      0|                            num_All -= 2;
 1670|      0|                            continue;
 1671|      0|                        }
 1672|      0|                    }
 1673|      0|                    if (!type || 12 == type && 0 < num_N_plus && 0 < num_N_minus)
  ------------------
  |  Branch (1673:25): [True: 0, False: 0]
  |  Branch (1673:34): [True: 0, False: 0]
  |  Branch (1673:48): [True: 0, False: 0]
  |  Branch (1673:66): [True: 0, False: 0]
  ------------------
 1674|      0|                    {
 1675|      0|                        int num_neigh = 0, pos_neigh = -1;
 1676|      0|                        for (i1 = 0; i1 < at[i].valence; i1++)
  ------------------
  |  Branch (1676:38): [True: 0, False: 0]
  ------------------
 1677|      0|                        {
 1678|      0|                            n = at[i].neighbor[i1];
 1679|      0|                            if (-1 == at[n].charge && 2 >= nNoMetalNumBonds( at, n ) &&
  ------------------
  |  Branch (1679:33): [True: 0, False: 0]
  |  Branch (1679:55): [True: 0, False: 0]
  ------------------
 1680|      0|                                 2 == nNoMetalBondsValence( at, n ) + NUMH( at, n ) &&
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (1680:34): [True: 0, False: 0]
  ------------------
 1681|       |                                 /*0 == num_of_H( at, n ) &&*/
 1682|      0|                                 at[i].bond_type[i1] == BOND_TYPE_SINGLE &&
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (1682:34): [True: 0, False: 0]
  ------------------
 1683|      0|                                 NULL != memchr( en + ELEM_N_FST, at[n].el_number, ELEM_N_LEN ))
  ------------------
  |  | 1060|      0|#define ELEM_N_FST  0
  ------------------
                                               NULL != memchr( en + ELEM_N_FST, at[n].el_number, ELEM_N_LEN ))
  ------------------
  |  | 1061|      0|#define ELEM_N_LEN  4
  ------------------
  |  Branch (1683:34): [True: 0, False: 0]
  ------------------
 1684|      0|                            {
 1685|       |                                /* found N(+)(IV)=N(-)(II); prepare conversion to N(V)#N(III) */
 1686|      0|                                num_neigh++;
 1687|      0|                                pos_neigh = i1;
 1688|      0|                            }
 1689|      0|                        }
 1690|      0|                        if (1 == num_neigh &&
  ------------------
  |  Branch (1690:29): [True: 0, False: 0]
  ------------------
 1691|      0|                             !has_other_ion_neigh( at, i, n = at[i].neighbor[i1 = pos_neigh], en, ne ) &&
  ------------------
  |  Branch (1691:30): [True: 0, False: 0]
  ------------------
 1692|      0|                             !has_other_ion_neigh( at, n, i, en, ne ))
  ------------------
  |  Branch (1692:30): [True: 0, False: 0]
  ------------------
 1693|      0|                        {
 1694|       |                            /*n = at[i].neighbor[i1=pos_neigh];*/
 1695|      0|                            i2 = (int) ( is_in_the_list( at[n].neighbor, (AT_NUMB) i, at[n].valence ) - at[n].neighbor );
 1696|      0|                            at[i].charge--;
 1697|      0|                            at[n].charge++;
 1698|      0|                            at[i].chem_bonds_valence++;
 1699|      0|                            at[n].chem_bonds_valence++;
 1700|      0|                            at[i].bond_type[i1] ++;
 1701|      0|                            at[n].bond_type[i2] ++;
 1702|      0|                            num_changes++;
 1703|      0|                            num_N_minus--;
 1704|      0|                            num_N_plus--;
 1705|      0|                            num_All -= 2;
 1706|      0|                            continue;
 1707|      0|                        }
 1708|      0|                    }
 1709|      0|                }
 1710|    180|                else if (1 == at[i].charge &&
  ------------------
  |  Branch (1710:26): [True: 0, False: 180]
  ------------------
 1711|    180|                          0 < num_O_plus && 0 < num_C_minus + num_N_minus &&
  ------------------
  |  Branch (1711:27): [True: 0, False: 0]
  |  Branch (1711:45): [True: 0, False: 0]
  ------------------
 1712|    180|                          3 >= nNoMetalNumBonds( at, i ) && 3 == nNoMetalBondsValence( at, i ) &&
  ------------------
  |  Branch (1712:27): [True: 0, False: 0]
  |  Branch (1712:61): [True: 0, False: 0]
  ------------------
 1713|    180|                          0 == num_of_H( at, i ) &&
  ------------------
  |  Branch (1713:27): [True: 0, False: 0]
  ------------------
 1714|    180|                          NULL != memchr( en + ELEM_O_FST, at[i].el_number, ELEM_O_LEN ))
  ------------------
  |  | 1062|      0|#define ELEM_O_FST  4
  ------------------
                                        NULL != memchr( en + ELEM_O_FST, at[i].el_number, ELEM_O_LEN ))
  ------------------
  |  | 1063|      0|#define ELEM_O_LEN  4
  ------------------
  |  Branch (1714:27): [True: 0, False: 0]
  ------------------
 1715|      0|                {
 1716|       |                    /* found non-terminal O(+)(III) */
 1717|      0|                    if (( !type || 13 == type ) && 0 < num_C_minus)
  ------------------
  |  Branch (1717:27): [True: 0, False: 0]
  |  Branch (1717:36): [True: 0, False: 0]
  |  Branch (1717:52): [True: 0, False: 0]
  ------------------
 1718|      0|                    {
 1719|      0|                        int num_neigh = 0, pos_neigh = -1;
 1720|      0|                        for (i1 = 0; i1 < at[i].valence; i1++)
  ------------------
  |  Branch (1720:38): [True: 0, False: 0]
  ------------------
 1721|      0|                        {
 1722|      0|                            n = at[i].neighbor[i1];
 1723|      0|                            if (-1 == at[n].charge && 3 >= at[n].valence && 3 == at[n].chem_bonds_valence + NUMH( at, n ) &&
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (1723:33): [True: 0, False: 0]
  |  Branch (1723:55): [True: 0, False: 0]
  |  Branch (1723:77): [True: 0, False: 0]
  ------------------
 1724|       |                                 /*0 == at[n].num_H &&*/
 1725|      0|                                 at[i].bond_type[i1] == BOND_TYPE_SINGLE &&
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (1725:34): [True: 0, False: 0]
  ------------------
 1726|      0|                                 NULL != memchr( en + ELEM_C_FST, at[n].el_number, ELEM_C_LEN ))
  ------------------
  |  | 1064|      0|#define ELEM_C_FST  8
  ------------------
                                               NULL != memchr( en + ELEM_C_FST, at[n].el_number, ELEM_C_LEN ))
  ------------------
  |  | 1065|      0|#define ELEM_C_LEN  2
  ------------------
  |  Branch (1726:34): [True: 0, False: 0]
  ------------------
 1727|      0|                            {
 1728|       |                                /* found O(+)(III)-C(-)(II); prepare conversion to O(IV)=C(IV) */
 1729|      0|                                num_neigh++;
 1730|      0|                                pos_neigh = i1;
 1731|      0|                            }
 1732|      0|                        }
 1733|      0|                        if (1 == num_neigh &&
  ------------------
  |  Branch (1733:29): [True: 0, False: 0]
  ------------------
 1734|      0|                             !has_other_ion_neigh( at, i, n = at[i].neighbor[i1 = pos_neigh], en, ne ) &&
  ------------------
  |  Branch (1734:30): [True: 0, False: 0]
  ------------------
 1735|      0|                             !has_other_ion_neigh( at, n, i, en, ne ))
  ------------------
  |  Branch (1735:30): [True: 0, False: 0]
  ------------------
 1736|      0|                        {
 1737|       |                            /*n = at[i].neighbor[i1=pos_neigh];*/
 1738|      0|                            i2 = (int) ( is_in_the_list( at[n].neighbor, (AT_NUMB) i, at[n].valence ) - at[n].neighbor );
 1739|      0|                            at[i].charge--;
 1740|      0|                            at[n].charge++;
 1741|      0|                            at[i].chem_bonds_valence++;
 1742|      0|                            at[n].chem_bonds_valence++;
 1743|      0|                            at[i].bond_type[i1] ++;
 1744|      0|                            at[n].bond_type[i2] ++;
 1745|      0|                            num_changes++;
 1746|      0|                            num_C_minus--;
 1747|      0|                            num_O_plus--;
 1748|      0|                            num_All -= 2;
 1749|      0|                            continue;
 1750|      0|                        }
 1751|      0|                    }
 1752|      0|                    if (( !type || 14 == type ) && 0 < num_C_minus)
  ------------------
  |  Branch (1752:27): [True: 0, False: 0]
  |  Branch (1752:36): [True: 0, False: 0]
  |  Branch (1752:52): [True: 0, False: 0]
  ------------------
 1753|      0|                    {
 1754|      0|                        int num_neigh = 0, pos_neigh = -1;
 1755|      0|                        for (i1 = 0; i1 < at[i].valence; i1++)
  ------------------
  |  Branch (1755:38): [True: 0, False: 0]
  ------------------
 1756|      0|                        {
 1757|      0|                            n = at[i].neighbor[i1];
 1758|      0|                            if (-1 == at[n].charge && 3 >= at[n].valence && 3 == at[n].chem_bonds_valence + NUMH( at, n ) &&
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (1758:33): [True: 0, False: 0]
  |  Branch (1758:55): [True: 0, False: 0]
  |  Branch (1758:77): [True: 0, False: 0]
  ------------------
 1759|       |                                 /*0 == at[n].num_H &&*/
 1760|      0|                                 at[i].bond_type[i1] == BOND_TYPE_DOUBLE &&
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (1760:34): [True: 0, False: 0]
  ------------------
 1761|      0|                                 NULL != memchr( en + ELEM_C_FST, at[n].el_number, ELEM_C_LEN ))
  ------------------
  |  | 1064|      0|#define ELEM_C_FST  8
  ------------------
                                               NULL != memchr( en + ELEM_C_FST, at[n].el_number, ELEM_C_LEN ))
  ------------------
  |  | 1065|      0|#define ELEM_C_LEN  2
  ------------------
  |  Branch (1761:34): [True: 0, False: 0]
  ------------------
 1762|      0|                            {
 1763|       |                                /* found O(+)(III)=C(-)(III); prepare conversion to O(IV)#C(IV) */
 1764|      0|                                num_neigh++;
 1765|      0|                                pos_neigh = i1;
 1766|      0|                            }
 1767|      0|                        }
 1768|      0|                        if (1 == num_neigh &&
  ------------------
  |  Branch (1768:29): [True: 0, False: 0]
  ------------------
 1769|      0|                             !has_other_ion_neigh( at, i, n = at[i].neighbor[i1 = pos_neigh], en, ne ) &&
  ------------------
  |  Branch (1769:30): [True: 0, False: 0]
  ------------------
 1770|      0|                             !has_other_ion_neigh( at, n, i, en, ne ))
  ------------------
  |  Branch (1770:30): [True: 0, False: 0]
  ------------------
 1771|      0|                        {
 1772|       |                            /*n = at[i].neighbor[i1=pos_neigh];*/
 1773|      0|                            i2 = (int) ( is_in_the_list( at[n].neighbor, (AT_NUMB) i, at[n].valence ) - at[n].neighbor );
 1774|      0|                            at[i].charge--;
 1775|      0|                            at[n].charge++;
 1776|      0|                            at[i].chem_bonds_valence++;
 1777|      0|                            at[n].chem_bonds_valence++;
 1778|      0|                            at[i].bond_type[i1] ++;
 1779|      0|                            at[n].bond_type[i2] ++;
 1780|      0|                            num_changes++;
 1781|      0|                            num_C_minus--;
 1782|      0|                            num_O_plus--;
 1783|      0|                            num_All -= 2;
 1784|      0|                            continue;
 1785|      0|                        }
 1786|      0|                    }
 1787|      0|                    if (( !type || 15 == type ) && 0 < num_N_minus)
  ------------------
  |  Branch (1787:27): [True: 0, False: 0]
  |  Branch (1787:36): [True: 0, False: 0]
  |  Branch (1787:52): [True: 0, False: 0]
  ------------------
 1788|      0|                    {
 1789|      0|                        int num_neigh = 0, pos_neigh = -1;
 1790|      0|                        for (i1 = 0; i1 < at[i].valence; i1++)
  ------------------
  |  Branch (1790:38): [True: 0, False: 0]
  ------------------
 1791|      0|                        {
 1792|      0|                            n = at[i].neighbor[i1];
 1793|      0|                            if (-1 == at[n].charge && 2 >= nNoMetalNumBonds( at, n ) &&
  ------------------
  |  Branch (1793:33): [True: 0, False: 0]
  |  Branch (1793:55): [True: 0, False: 0]
  ------------------
 1794|      0|                                 2 == nNoMetalBondsValence( at, n ) + NUMH( at, n ) &&
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (1794:34): [True: 0, False: 0]
  ------------------
 1795|       |                                 /*0 == num_of_H( at, n ) &&*/
 1796|      0|                                 at[i].bond_type[i1] == BOND_TYPE_SINGLE &&
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (1796:34): [True: 0, False: 0]
  ------------------
 1797|      0|                                 NULL != memchr( en + ELEM_N_FST, at[n].el_number, ELEM_N_LEN ))
  ------------------
  |  | 1060|      0|#define ELEM_N_FST  0
  ------------------
                                               NULL != memchr( en + ELEM_N_FST, at[n].el_number, ELEM_N_LEN ))
  ------------------
  |  | 1061|      0|#define ELEM_N_LEN  4
  ------------------
  |  Branch (1797:34): [True: 0, False: 0]
  ------------------
 1798|      0|                            {
 1799|       |                                /* found O(+)(III)=N(-)(II); prepare conversion to O(IV)#N(III) */
 1800|      0|                                num_neigh++;
 1801|      0|                                pos_neigh = i1;
 1802|      0|                            }
 1803|      0|                        }
 1804|      0|                        if (1 == num_neigh &&
  ------------------
  |  Branch (1804:29): [True: 0, False: 0]
  ------------------
 1805|      0|                             !has_other_ion_neigh( at, i, n = at[i].neighbor[i1 = pos_neigh], en, ne ) &&
  ------------------
  |  Branch (1805:30): [True: 0, False: 0]
  ------------------
 1806|      0|                             !has_other_ion_neigh( at, n, i, en, ne ))
  ------------------
  |  Branch (1806:30): [True: 0, False: 0]
  ------------------
 1807|      0|                        {
 1808|       |                            /*n = at[i].neighbor[i1=pos_neigh];*/
 1809|      0|                            i2 = (int) ( is_in_the_list( at[n].neighbor, (AT_NUMB) i, at[n].valence ) - at[n].neighbor );
 1810|      0|                            at[i].charge--;
 1811|      0|                            at[n].charge++;
 1812|      0|                            at[i].chem_bonds_valence++;
 1813|      0|                            at[n].chem_bonds_valence++;
 1814|      0|                            at[i].bond_type[i1] ++;
 1815|      0|                            at[n].bond_type[i2] ++;
 1816|      0|                            num_changes++;
 1817|      0|                            num_N_minus--;
 1818|      0|                            num_O_plus--;
 1819|      0|                            num_All -= 2;
 1820|      0|                            continue;
 1821|      0|                        }
 1822|      0|                    }
 1823|      0|                }
 1824|    180|            }
 1825|     36|        }
 1826|       |
 1827|       |        /**************************************************************************/
 1828|       |        /*********************** NON-Terminal ion triples *************************/
 1829|       |        /**************************************************************************/
 1830|       |        /*-------------------------------------------------------------------------
 1831|       |        Non-Terminal triple types: 16, 17, 18   N=N,P,As,Sb; O=O,S,Se,Te; C=C,Si
 1832|       |        ========================================
 1833|       |        16: C(+)(III)-O-N(-)(II)  => C(IV)=O=N(III)  (allow terminal H on N(-))
 1834|       |        |                     |
 1835|       |        17: C(+)(III)-N-C(-)(III)  => C(IV)=N=C(IV)
 1836|       |
 1837|       |        18: C(-)(III)-N=C(+)(III)  => C(IV)=N#C(IV)   (may have two or no charges)
 1838|       |        C(IV)=N-C(II)          => C(IV)=N#C(IV)
 1839|       |
 1840|       |        */
 1841|       |
 1842|    108|        if (( !type || 16 == type ) && 0 < num_C_plus && 0 < num_N_minus)
  ------------------
  |  Branch (1842:15): [True: 0, False: 108]
  |  Branch (1842:24): [True: 6, False: 102]
  |  Branch (1842:40): [True: 0, False: 6]
  |  Branch (1842:58): [True: 0, False: 0]
  ------------------
 1843|      0|        {
 1844|      0|            int m[2], j[2], k;
 1845|      0|            for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1845:25): [True: 0, False: 0]
  ------------------
 1846|      0|            {
 1847|      0|                if (0 == at[i].charge && 2 == nNoMetalNumBonds( at, i ) && 2 == nNoMetalBondsValence( at, i ) &&
  ------------------
  |  Branch (1847:21): [True: 0, False: 0]
  |  Branch (1847:42): [True: 0, False: 0]
  |  Branch (1847:76): [True: 0, False: 0]
  ------------------
 1848|      0|                     0 == num_of_H( at, i ) &&
  ------------------
  |  Branch (1848:22): [True: 0, False: 0]
  ------------------
 1849|      0|                     0 <= ( j[0] = nNoMetalNeighIndex( at, i ) ) &&
  ------------------
  |  Branch (1849:22): [True: 0, False: 0]
  ------------------
 1850|      0|                     at[m[0] = at[i].neighbor[j[0]]].charge &&
  ------------------
  |  Branch (1850:22): [True: 0, False: 0]
  ------------------
 1851|      0|                     0 <= ( j[1] = nNoMetalOtherNeighIndex( at, i, m[0] ) ) &&
  ------------------
  |  Branch (1851:22): [True: 0, False: 0]
  ------------------
 1852|      0|                     0 == at[m[0]].charge + at[m[1] = at[i].neighbor[j[1]]].charge &&
  ------------------
  |  Branch (1852:22): [True: 0, False: 0]
  ------------------
 1853|      0|                     5 >= nNoMetalBondsValence( at, m[0] ) + nNoMetalBondsValence( at, m[1] ) &&
  ------------------
  |  Branch (1853:22): [True: 0, False: 0]
  ------------------
 1854|       |                     /*5 >= at[m[0]].chem_bonds_valence + at[m[1]].chem_bonds_valence &&*/
 1855|      0|                     NULL != memchr( en + ELEM_O_FST, at[i].el_number, ELEM_O_LEN ))
  ------------------
  |  | 1062|      0|#define ELEM_O_FST  4
  ------------------
                                   NULL != memchr( en + ELEM_O_FST, at[i].el_number, ELEM_O_LEN ))
  ------------------
  |  | 1063|      0|#define ELEM_O_LEN  4
  ------------------
  |  Branch (1855:22): [True: 0, False: 0]
  ------------------
 1856|      0|                {
 1857|       |                    /* found non-terminal A(+)-O-B(-); chem_bond_val of A+B <= 5 */
 1858|      0|                    int n_N = -1, n_C = -1, i_C = -1;
 1859|      0|                    for (k = 0; k < 2; k++)
  ------------------
  |  Branch (1859:33): [True: 0, False: 0]
  ------------------
 1860|      0|                    {
 1861|      0|                        n = m[k];
 1862|      0|                        if (-1 == at[n].charge && 2 == nNoMetalNumBonds( at, n ) + NUMH( at, n ) &&
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (1862:29): [True: 0, False: 0]
  |  Branch (1862:51): [True: 0, False: 0]
  ------------------
 1863|       |                             /*0 == num_of_H( at, n ) &&*/
 1864|      0|                             NULL != memchr( en + ELEM_N_FST, at[n].el_number, ELEM_N_LEN ))
  ------------------
  |  | 1060|      0|#define ELEM_N_FST  0
  ------------------
                                           NULL != memchr( en + ELEM_N_FST, at[n].el_number, ELEM_N_LEN ))
  ------------------
  |  | 1061|      0|#define ELEM_N_LEN  4
  ------------------
  |  Branch (1864:30): [True: 0, False: 0]
  ------------------
 1865|      0|                        {
 1866|      0|                            n_N = n;
 1867|      0|                        }
 1868|      0|                        else if (1 == at[n].charge && 3 == at[n].chem_bonds_valence + NUMH( at, n ) &&
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (1868:34): [True: 0, False: 0]
  |  Branch (1868:55): [True: 0, False: 0]
  ------------------
 1869|      0|                                  NULL != memchr( en + ELEM_C_FST, at[n].el_number, ELEM_C_LEN ))
  ------------------
  |  | 1064|      0|#define ELEM_C_FST  8
  ------------------
                                                NULL != memchr( en + ELEM_C_FST, at[n].el_number, ELEM_C_LEN ))
  ------------------
  |  | 1065|      0|#define ELEM_C_LEN  2
  ------------------
  |  Branch (1869:35): [True: 0, False: 0]
  ------------------
 1870|      0|                        {
 1871|      0|                            n_C = n;
 1872|      0|                            i_C = k;
 1873|      0|                        }
 1874|      0|                    }
 1875|      0|                    if (n_C < 0 || n_N < 0 ||
  ------------------
  |  Branch (1875:25): [True: 0, False: 0]
  |  Branch (1875:36): [True: 0, False: 0]
  ------------------
 1876|      0|                         has_other_ion_in_sphere_2( at, n_C, n_N, en, ne ) ||
  ------------------
  |  Branch (1876:26): [True: 0, False: 0]
  ------------------
 1877|      0|                         has_other_ion_in_sphere_2( at, n_N, n_C, en, ne ))
  ------------------
  |  Branch (1877:26): [True: 0, False: 0]
  ------------------
 1878|      0|                    {
 1879|      0|                        continue;
 1880|      0|                    }
 1881|       |
 1882|       |                    /* C(+)(III)-O-N(-)(II)  => C(IV)=O=N(III) */
 1883|      0|                    for (k = 0; k < 2; k++)
  ------------------
  |  Branch (1883:33): [True: 0, False: 0]
  ------------------
 1884|      0|                    {
 1885|      0|                        n = k ? n_C : n_N;
  ------------------
  |  Branch (1885:29): [True: 0, False: 0]
  ------------------
 1886|      0|                        i1 = k ? j[i_C] : j[1 - i_C];
  ------------------
  |  Branch (1886:30): [True: 0, False: 0]
  ------------------
 1887|      0|                        i2 = (int) ( is_in_the_list( at[n].neighbor, (AT_NUMB) i, at[n].valence ) - at[n].neighbor );
 1888|      0|                        at[i].bond_type[i1] ++;
 1889|      0|                        at[n].bond_type[i2] ++;
 1890|      0|                        at[i].chem_bonds_valence++;
 1891|      0|                        at[n].chem_bonds_valence++;
 1892|      0|                        at[n].charge += ( k ? -1 : 1 );
  ------------------
  |  Branch (1892:43): [True: 0, False: 0]
  ------------------
 1893|      0|                    }
 1894|      0|                    num_changes++;
 1895|      0|                    num_N_minus--;
 1896|      0|                    num_C_plus--;
 1897|      0|                    num_All -= 2;
 1898|      0|                }
 1899|      0|            }
 1900|      0|        }
 1901|       |
 1902|    108|        if (( !type || 17 == type ) && 0 < num_C_plus && 0 < num_C_minus)
  ------------------
  |  Branch (1902:15): [True: 0, False: 108]
  |  Branch (1902:24): [True: 6, False: 102]
  |  Branch (1902:40): [True: 0, False: 6]
  |  Branch (1902:58): [True: 0, False: 0]
  ------------------
 1903|      0|        {
 1904|      0|            int m[3], c[3], j[3], k;
 1905|      0|            for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1905:25): [True: 0, False: 0]
  ------------------
 1906|      0|            {
 1907|      0|                if (0 == at[i].charge && 3 == nNoMetalNumBonds( at, i ) && 3 == nNoMetalBondsValence( at, i ) &&
  ------------------
  |  Branch (1907:21): [True: 0, False: 0]
  |  Branch (1907:42): [True: 0, False: 0]
  |  Branch (1907:76): [True: 0, False: 0]
  ------------------
 1908|      0|                     0 == num_of_H( at, i ) &&
  ------------------
  |  Branch (1908:22): [True: 0, False: 0]
  ------------------
 1909|      0|                     0 <= ( j[0] = nNoMetalNeighIndex( at, i ) ) &&
  ------------------
  |  Branch (1909:22): [True: 0, False: 0]
  ------------------
 1910|      0|                     0 <= ( j[1] = nNoMetalOtherNeighIndex( at, i, m[0] = at[i].neighbor[j[0]] ) ) &&
  ------------------
  |  Branch (1910:22): [True: 0, False: 0]
  ------------------
 1911|      0|                     0 <= ( j[2] = nNoMetalOtherNeighIndex2( at, i, m[0], m[1] = at[i].neighbor[j[1]] ) ) &&
  ------------------
  |  Branch (1911:22): [True: 0, False: 0]
  ------------------
 1912|      0|                     1 == !( c[0] = at[m[0]].charge )
  ------------------
  |  Branch (1912:22): [True: 0, False: 0]
  ------------------
 1913|      0|                     + !( c[1] = at[m[1]].charge )
 1914|      0|                     + !( c[2] = at[m[2] = at[i].neighbor[j[2]]].charge ) &&
 1915|      0|                     0 == c[0] + c[1] + c[2] &&
  ------------------
  |  Branch (1915:22): [True: 0, False: 0]
  ------------------
 1916|      0|                     2 == ( 3 == ( c[0] ? at[m[0]].chem_bonds_valence + NUMH( at, m[0] ) : 0 ) )
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (1916:22): [True: 0, False: 0]
  |  Branch (1916:36): [True: 0, False: 0]
  ------------------
 1917|      0|                     + ( 3 == ( c[1] ? at[m[1]].chem_bonds_valence + NUMH( at, m[1] ) : 0 ) )
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (1917:33): [True: 0, False: 0]
  ------------------
 1918|      0|                     + ( 3 == ( c[2] ? at[m[2]].chem_bonds_valence + NUMH( at, m[2] ) : 0 ) ) &&
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (1918:33): [True: 0, False: 0]
  ------------------
 1919|      0|                     NULL != memchr( en + ELEM_N_FST, at[i].el_number, ELEM_N_LEN ))
  ------------------
  |  | 1060|      0|#define ELEM_N_FST  0
  ------------------
                                   NULL != memchr( en + ELEM_N_FST, at[i].el_number, ELEM_N_LEN ))
  ------------------
  |  | 1061|      0|#define ELEM_N_LEN  4
  ------------------
  |  Branch (1919:22): [True: 0, False: 0]
  ------------------
 1920|      0|                {
 1921|       |                    /* found non-terminal A(+)-O-B(-) */
 1922|      0|                    int n_Cp = -1, n_Cm = -1, i_Cp = -1, i_Cm = -1; /* p = positive, m = negatice ion C */
 1923|      0|                    for (k = 0; k < 3; k++)
  ------------------
  |  Branch (1923:33): [True: 0, False: 0]
  ------------------
 1924|      0|                    {
 1925|      0|                        if (c[k])
  ------------------
  |  Branch (1925:29): [True: 0, False: 0]
  ------------------
 1926|      0|                        {
 1927|      0|                            n = m[k];
 1928|      0|                            if (-1 == at[n].charge &&
  ------------------
  |  Branch (1928:33): [True: 0, False: 0]
  ------------------
 1929|      0|                                 NULL != memchr( en + ELEM_C_FST, at[n].el_number, ELEM_C_LEN ))
  ------------------
  |  | 1064|      0|#define ELEM_C_FST  8
  ------------------
                                               NULL != memchr( en + ELEM_C_FST, at[n].el_number, ELEM_C_LEN ))
  ------------------
  |  | 1065|      0|#define ELEM_C_LEN  2
  ------------------
  |  Branch (1929:34): [True: 0, False: 0]
  ------------------
 1930|      0|                            {
 1931|      0|                                n_Cm = n;
 1932|      0|                                i_Cm = k;
 1933|      0|                            }
 1934|      0|                            else if (1 == at[n].charge &&
  ------------------
  |  Branch (1934:38): [True: 0, False: 0]
  ------------------
 1935|      0|                                      NULL != memchr( en + ELEM_C_FST, at[n].el_number, ELEM_C_LEN ))
  ------------------
  |  | 1064|      0|#define ELEM_C_FST  8
  ------------------
                                                    NULL != memchr( en + ELEM_C_FST, at[n].el_number, ELEM_C_LEN ))
  ------------------
  |  | 1065|      0|#define ELEM_C_LEN  2
  ------------------
  |  Branch (1935:39): [True: 0, False: 0]
  ------------------
 1936|      0|                            {
 1937|      0|                                n_Cp = n;
 1938|      0|                                i_Cp = k;
 1939|      0|                            }
 1940|      0|                        }
 1941|      0|                    }
 1942|      0|                    if (n_Cp < 0 || n_Cm < 0 ||
  ------------------
  |  Branch (1942:25): [True: 0, False: 0]
  |  Branch (1942:37): [True: 0, False: 0]
  ------------------
 1943|      0|                         has_other_ion_in_sphere_2( at, n_Cp, n_Cm, en, ne ) ||
  ------------------
  |  Branch (1943:26): [True: 0, False: 0]
  ------------------
 1944|      0|                         has_other_ion_in_sphere_2( at, n_Cm, n_Cp, en, ne ))
  ------------------
  |  Branch (1944:26): [True: 0, False: 0]
  ------------------
 1945|      0|                    {
 1946|      0|                        continue;
 1947|      0|                    }
 1948|       |
 1949|       |                    /*           |                     |       */
 1950|       |                    /* C(+)(III)-N-C(-)(III)  => C(IV)=N=C(IV) */
 1951|      0|                    for (k = 0; k < 2; k++)
  ------------------
  |  Branch (1951:33): [True: 0, False: 0]
  ------------------
 1952|      0|                    {
 1953|      0|                        n = k ? n_Cp : n_Cm;
  ------------------
  |  Branch (1953:29): [True: 0, False: 0]
  ------------------
 1954|      0|                        i1 = k ? j[i_Cp] : j[i_Cm];
  ------------------
  |  Branch (1954:30): [True: 0, False: 0]
  ------------------
 1955|      0|                        i2 = (int) ( is_in_the_list( at[n].neighbor, (AT_NUMB) i, at[n].valence ) - at[n].neighbor );
 1956|      0|                        at[i].bond_type[i1] ++;
 1957|      0|                        at[n].bond_type[i2] ++;
 1958|      0|                        at[i].chem_bonds_valence++;
 1959|      0|                        at[n].chem_bonds_valence++;
 1960|      0|                        at[n].charge += ( k ? -1 : 1 );
  ------------------
  |  Branch (1960:43): [True: 0, False: 0]
  ------------------
 1961|      0|                    }
 1962|      0|                    num_changes++;
 1963|      0|                    num_C_minus--;
 1964|      0|                    num_C_plus--;
 1965|      0|                    num_All -= 2;
 1966|      0|                }
 1967|      0|            }
 1968|      0|        }
 1969|       |
 1970|    108|        if (( !type || 18 == type ) && ( 0 < num_C_plus && 0 < num_C_minus || 0 < num_C_II ))
  ------------------
  |  Branch (1970:15): [True: 0, False: 108]
  |  Branch (1970:24): [True: 6, False: 102]
  |  Branch (1970:42): [True: 0, False: 6]
  |  Branch (1970:60): [True: 0, False: 0]
  |  Branch (1970:79): [True: 0, False: 6]
  ------------------
 1971|      0|        {
 1972|      0|            int m[2], v[2], j[2], k;
 1973|      0|            for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (1973:25): [True: 0, False: 0]
  ------------------
 1974|      0|            {
 1975|      0|                if (0 == at[i].charge && 2 == nNoMetalNumBonds( at, i ) && 3 == nNoMetalBondsValence( at, i ) &&
  ------------------
  |  Branch (1975:21): [True: 0, False: 0]
  |  Branch (1975:42): [True: 0, False: 0]
  |  Branch (1975:76): [True: 0, False: 0]
  ------------------
 1976|      0|                     0 == num_of_H( at, i ) &&
  ------------------
  |  Branch (1976:22): [True: 0, False: 0]
  ------------------
 1977|      0|                     0 <= ( j[0] = nNoMetalNeighIndex( at, i ) ) &&
  ------------------
  |  Branch (1977:22): [True: 0, False: 0]
  ------------------
 1978|      0|                     0 <= ( j[1] = nNoMetalOtherNeighIndex( at, i, m[0] = at[i].neighbor[j[0]] ) ) &&
  ------------------
  |  Branch (1978:22): [True: 0, False: 0]
  ------------------
 1979|      0|                     0 == at[m[0]].charge
  ------------------
  |  Branch (1979:22): [True: 0, False: 0]
  ------------------
 1980|      0|                     + at[m[1] = at[i].neighbor[j[1]]].charge &&
 1981|      0|                     6 == ( v[0] = at[m[0]].chem_bonds_valence + NUMH( at, m[0] ) )
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (1981:22): [True: 0, False: 0]
  ------------------
 1982|      0|                     + ( v[1] = at[m[1]].chem_bonds_valence + NUMH( at, m[1] ) ) &&
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
 1983|      0|                     2 >= abs( v[0] - v[1] ) &&
  ------------------
  |  Branch (1983:22): [True: 0, False: 0]
  ------------------
 1984|      0|                     NULL != memchr( en + ELEM_N_FST, at[i].el_number, ELEM_N_LEN ) &&
  ------------------
  |  | 1060|      0|#define ELEM_N_FST  0
  ------------------
                                   NULL != memchr( en + ELEM_N_FST, at[i].el_number, ELEM_N_LEN ) &&
  ------------------
  |  | 1061|      0|#define ELEM_N_LEN  4
  ------------------
  |  Branch (1984:22): [True: 0, False: 0]
  ------------------
 1985|      0|                     NULL != memchr( en + ELEM_C_FST, at[m[0]].el_number, ELEM_C_LEN ) &&
  ------------------
  |  | 1064|      0|#define ELEM_C_FST  8
  ------------------
                                   NULL != memchr( en + ELEM_C_FST, at[m[0]].el_number, ELEM_C_LEN ) &&
  ------------------
  |  | 1065|      0|#define ELEM_C_LEN  2
  ------------------
  |  Branch (1985:22): [True: 0, False: 0]
  ------------------
 1986|      0|                     NULL != memchr( en + ELEM_C_FST, at[m[1]].el_number, ELEM_C_LEN ))
  ------------------
  |  | 1064|      0|#define ELEM_C_FST  8
  ------------------
                                   NULL != memchr( en + ELEM_C_FST, at[m[1]].el_number, ELEM_C_LEN ))
  ------------------
  |  | 1065|      0|#define ELEM_C_LEN  2
  ------------------
  |  Branch (1986:22): [True: 0, False: 0]
  ------------------
 1987|      0|                {
 1988|       |                    /*                    n_Cm      i n_Cp */
 1989|       |                    /* found non-terminal C(-)(III)-N=C(+)(III) or C(IV)=N-C(II): Cm-N-Cp */
 1990|       |                    /* convert to C(IV)=N#C(IV) */
 1991|      0|                    int n_Cp = -1, n_Cm = -1, i_Cp = -1, i_Cm = -1; /* p = positive, m = negatice ion C */
 1992|      0|                    for (k = 0; k < 2; k++)
  ------------------
  |  Branch (1992:33): [True: 0, False: 0]
  ------------------
 1993|      0|                    {
 1994|      0|                        n = m[k];
 1995|      0|                        if (v[k] == 4 || v[k] == 3 && at[i].bond_type[j[k]] == BOND_TYPE_SINGLE)
  ------------------
  |  |   60|      0|#define BOND_TYPE_SINGLE    1
  ------------------
  |  Branch (1995:29): [True: 0, False: 0]
  |  Branch (1995:42): [True: 0, False: 0]
  |  Branch (1995:55): [True: 0, False: 0]
  ------------------
 1996|      0|                        {
 1997|      0|                            n_Cm = n;
 1998|      0|                            i_Cm = k;
 1999|      0|                        }
 2000|      0|                        else if (v[k] == 2 || v[k] == 3 && at[i].bond_type[j[k]] == BOND_TYPE_DOUBLE)
  ------------------
  |  |   61|      0|#define BOND_TYPE_DOUBLE    2
  ------------------
  |  Branch (2000:34): [True: 0, False: 0]
  |  Branch (2000:47): [True: 0, False: 0]
  |  Branch (2000:60): [True: 0, False: 0]
  ------------------
 2001|      0|                        {
 2002|      0|                            n_Cp = n;
 2003|      0|                            i_Cp = k;
 2004|      0|                        }
 2005|      0|                    }
 2006|      0|                    if (n_Cp < 0 || n_Cm < 0 || at[n_Cp].valence + NUMH( at, n_Cp ) != 2)
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (2006:25): [True: 0, False: 0]
  |  Branch (2006:37): [True: 0, False: 0]
  |  Branch (2006:49): [True: 0, False: 0]
  ------------------
 2007|      0|                    {
 2008|      0|                        continue; /* guarantees at[n_Cp].valence <= 2 */
 2009|      0|                    }
 2010|      0|                    if (v[i_Cp] == 2 || !at[n_Cp].charge)
  ------------------
  |  Branch (2010:25): [True: 0, False: 0]
  |  Branch (2010:41): [True: 0, False: 0]
  ------------------
 2011|      0|                    {
 2012|      0|                        if (at[n_Cp].valence == 2)
  ------------------
  |  Branch (2012:29): [True: 0, False: 0]
  ------------------
 2013|      0|                        {
 2014|       |                            /* neighbor of at[n_Cp] opposite to at[i] */
 2015|      0|                            k = at[n_Cp].neighbor[at[n_Cp].neighbor[0] == i];
 2016|      0|                            if (NULL != memchr( en + ELEM_N_FST, at[k].el_number, ELEM_N_LEN ))
  ------------------
  |  | 1060|      0|#define ELEM_N_FST  0
  ------------------
                                          if (NULL != memchr( en + ELEM_N_FST, at[k].el_number, ELEM_N_LEN ))
  ------------------
  |  | 1061|      0|#define ELEM_N_LEN  4
  ------------------
  |  Branch (2016:33): [True: 0, False: 0]
  ------------------
 2017|      0|                            {
 2018|      0|                                continue;
 2019|      0|                            }
 2020|      0|                        }
 2021|      0|                    }
 2022|      0|                    else if (at[n_Cp].charge)
  ------------------
  |  Branch (2022:30): [True: 0, False: 0]
  ------------------
 2023|      0|                    {
 2024|      0|                        if (has_other_ion_in_sphere_2( at, n_Cp, n_Cm, en, ne ) ||
  ------------------
  |  Branch (2024:29): [True: 0, False: 0]
  ------------------
 2025|      0|                             has_other_ion_in_sphere_2( at, n_Cm, n_Cp, en, ne ))
  ------------------
  |  Branch (2025:30): [True: 0, False: 0]
  ------------------
 2026|      0|                        {
 2027|      0|                            continue;
 2028|      0|                        }
 2029|      0|                    }
 2030|      0|                    else
 2031|      0|                    {
 2032|      0|                        continue; /* unknown case */
 2033|      0|                    }
 2034|       |
 2035|       |                    /*                                         */
 2036|       |                    /* C(-)(III)-N=C(+)(III)  => C(IV)=N#C(IV) */
 2037|       |                    /* C(IV)=N-C(II)          => C(IV)=N#C(IV) */
 2038|      0|                    if (at[n_Cp].charge)
  ------------------
  |  Branch (2038:25): [True: 0, False: 0]
  ------------------
 2039|      0|                    {
 2040|      0|                        num_C_minus--;
 2041|      0|                        num_C_plus--;
 2042|      0|                        num_All -= 2;
 2043|      0|                    }
 2044|      0|                    else
 2045|      0|                    {
 2046|      0|                        num_C_II--;
 2047|      0|                        num_All--;
 2048|      0|                    }
 2049|       |
 2050|      0|                    for (k = 0; k < 2; k++)
  ------------------
  |  Branch (2050:33): [True: 0, False: 0]
  ------------------
 2051|      0|                    {
 2052|      0|                        n = k ? n_Cp : n_Cm;
  ------------------
  |  Branch (2052:29): [True: 0, False: 0]
  ------------------
 2053|      0|                        i3 = k ? i_Cp : i_Cm; /* added to fix the bug */
  ------------------
  |  Branch (2053:30): [True: 0, False: 0]
  ------------------
 2054|       |                                              /*i1 = k? j[i_Cp] : j[i_Cm];*/ /* replaced with next line */
 2055|      0|                        i1 = j[i3];
 2056|      0|                        if (v[i3 /*was i1*/] < 4)
  ------------------
  |  Branch (2056:29): [True: 0, False: 0]
  ------------------
 2057|      0|                        {
 2058|       |                            /* WDI found a bug here: bounds violation */
 2059|      0|                            int delta = 4 - v[i3 /*was i1*/];
 2060|      0|                            i2 = (int) ( is_in_the_list( at[n].neighbor, (AT_NUMB) i, at[n].valence ) - at[n].neighbor );
 2061|      0|                            at[i].bond_type[i1] += delta;
 2062|      0|                            at[n].bond_type[i2] += delta;
 2063|      0|                            at[i].chem_bonds_valence += delta;
 2064|      0|                            at[n].chem_bonds_valence += delta;
 2065|      0|                            at[n].charge = 0;
 2066|      0|                            at[n].radical = 0;
 2067|      0|                        }
 2068|      0|                    }
 2069|      0|                    at[i].charge = 0;
 2070|      0|                    at[i].radical = 0;
 2071|      0|                    num_changes++;
 2072|      0|                }
 2073|      0|            }
 2074|      0|        }
 2075|    108|    }
 2076|       |
 2077|      6|    return num_changes;
 2078|   110k|}
bIsAmmoniumSalt:
 2345|     16|{
 2346|       |    /* NH4(+charge)-O(-charge)-C -> NH3 + HO-C; any charge including 0, */
 2347|       |    /* any C except charged or radical F, Cl, Br, I                     */
 2348|       |
 2349|     16|    int num_H, num_non_iso_H, num_impl_iso_H, bDisconnect = 1;
 2350|     16|    int j, val, neigh, iO = -1, iC, k = -1;
 2351|       |
 2352|     16|    if (at[i].el_number != EL_NUMBER_N)
  ------------------
  |  |   44|     16|#define EL_NUMBER_N ((U_CHAR) 7)
  ------------------
  |  Branch (2352:9): [True: 14, False: 2]
  ------------------
 2353|     14|    {
 2354|     14|        return 0;
 2355|     14|    }
 2356|       |
 2357|       |    /* check for NH4-O-C... -> NH3 + HO-C... */
 2358|      2|    val = at[i].valence;
 2359|      2|    num_impl_iso_H = NUM_ISO_H( at, i );
  ------------------
  |  |   87|      2|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  ------------------
 2360|      2|    num_non_iso_H = at[i].num_H;
 2361|      2|    num_H = num_non_iso_H + num_impl_iso_H;
 2362|      2|    if (val + num_H == 5)
  ------------------
  |  Branch (2362:9): [True: 0, False: 2]
  ------------------
 2363|      0|    {
 2364|      0|        int num_O = 0;
 2365|      0|        memset( num_explicit_H, 0, ( NUM_H_ISOTOPES + 1 ) * sizeof( num_explicit_H[0] ) );
  ------------------
  |  |   53|      0|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
 2366|      0|        for (j = 0; j < val; j++)
  ------------------
  |  Branch (2366:21): [True: 0, False: 0]
  ------------------
 2367|      0|        { /* looking for O: H4N-O-C... */
 2368|      0|            neigh = at[i].neighbor[j];
 2369|      0|            if (at[neigh].num_H ||
  ------------------
  |  Branch (2369:17): [True: 0, False: 0]
  ------------------
 2370|      0|                 at[neigh].charge && ( at[neigh].el_number != EL_NUMBER_O || at[neigh].charge + at[i].charge ) ||
  ------------------
  |  |   45|      0|#define EL_NUMBER_O ((U_CHAR) 8)
  ------------------
  |  Branch (2370:18): [True: 0, False: 0]
  |  Branch (2370:40): [True: 0, False: 0]
  |  Branch (2370:78): [True: 0, False: 0]
  ------------------
 2371|      0|                 at[neigh].radical && at[neigh].radical != RADICAL_SINGLET)
  ------------------
  |  |  103|      0|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (2371:18): [True: 0, False: 0]
  |  Branch (2371:39): [True: 0, False: 0]
  ------------------
 2372|      0|            {
 2373|      0|                bDisconnect = 0;
 2374|      0|                break; /* reject */
 2375|      0|            }
 2376|      0|            if (at[neigh].el_number == EL_NUMBER_H && at[neigh].valence == 1 &&
  ------------------
  |  |   41|      0|#define EL_NUMBER_H ((U_CHAR) 1)
  ------------------
  |  Branch (2376:17): [True: 0, False: 0]
  |  Branch (2376:55): [True: 0, False: 0]
  ------------------
 2377|      0|                 !at[neigh].charge && !at[neigh].radical)
  ------------------
  |  Branch (2377:18): [True: 0, False: 0]
  |  Branch (2377:39): [True: 0, False: 0]
  ------------------
 2378|      0|            {
 2379|      0|                num_H++; /* at this point at[].num_H does not include explicit H count */
 2380|      0|                num_non_iso_H += ( 0 == at[neigh].iso_atw_diff );
 2381|      0|                num_explicit_H[at[neigh].iso_atw_diff] ++;  /* explicit H on N */
 2382|      0|            }
 2383|      0|            else if (at[neigh].el_number == EL_NUMBER_O && at[neigh].valence == 2 && !num_O)
  ------------------
  |  |   45|      0|#define EL_NUMBER_O ((U_CHAR) 8)
  ------------------
  |  Branch (2383:22): [True: 0, False: 0]
  |  Branch (2383:60): [True: 0, False: 0]
  |  Branch (2383:86): [True: 0, False: 0]
  ------------------
 2384|      0|            {
 2385|      0|                num_O++; /* found O: N-O- */
 2386|      0|                iO = neigh;
 2387|      0|                k = j;
 2388|      0|                iC = at[iO].neighbor[at[iO].neighbor[0] == i];
 2389|      0|                if (at[iC].el_number != EL_NUMBER_C || /*
  ------------------
  |  |   43|      0|#define EL_NUMBER_C ((U_CHAR) 6)
  ------------------
  |  Branch (2389:21): [True: 0, False: 0]
  ------------------
 2390|       |                                                       at[iC].num_H ||
 2391|       |                                                       at[iC].chem_bonds_valence != 4 || */
 2392|      0|                     at[iC].charge ||
  ------------------
  |  Branch (2392:22): [True: 0, False: 0]
  ------------------
 2393|       |                     at[iC].radical && at[iC].radical != RADICAL_SINGLET /*||
  ------------------
  |  |  103|      0|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (2393:22): [True: 0, False: 0]
  |  Branch (2393:40): [True: 0, False: 0]
  ------------------
 2394|      0|                                                                         at[iC].valence == at[iC].chem_bonds_valence*/)
 2395|      0|                {
 2396|      0|                    bDisconnect = 0;
 2397|      0|                    break; /* reject */
 2398|      0|                }
 2399|      0|            }
 2400|      0|            else if (( at[neigh].el_number == EL_NUMBER_F ||
  ------------------
  |  |   46|      0|#define EL_NUMBER_F ((U_CHAR) 9)
  ------------------
  |  Branch (2400:24): [True: 0, False: 0]
  ------------------
 2401|      0|                       at[neigh].el_number == EL_NUMBER_CL ||
  ------------------
  |  |   50|      0|#define EL_NUMBER_CL ((U_CHAR) 17)
  ------------------
  |  Branch (2401:24): [True: 0, False: 0]
  ------------------
 2402|      0|                       at[neigh].el_number == EL_NUMBER_BR ||
  ------------------
  |  |   53|      0|#define EL_NUMBER_BR ((U_CHAR) 35)
  ------------------
  |  Branch (2402:24): [True: 0, False: 0]
  ------------------
 2403|      0|                       at[neigh].el_number == EL_NUMBER_I ) &&
  ------------------
  |  |   55|      0|#define EL_NUMBER_I ((U_CHAR) 53)
  ------------------
  |  Branch (2403:24): [True: 0, False: 0]
  ------------------
 2404|      0|                      at[neigh].valence == 1 && at[neigh].chem_bonds_valence == 1 &&
  ------------------
  |  Branch (2404:23): [True: 0, False: 0]
  |  Branch (2404:49): [True: 0, False: 0]
  ------------------
 2405|      0|                      !at[neigh].charge && !NUMH( at, neigh ) && !num_O)
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (2405:23): [True: 0, False: 0]
  |  Branch (2405:44): [True: 0, False: 0]
  |  Branch (2405:66): [True: 0, False: 0]
  ------------------
 2406|      0|            {
 2407|      0|                num_O++; /* found O: N-O- */
 2408|      0|                iO = neigh;
 2409|      0|                k = j;
 2410|      0|                iC = -1;
 2411|      0|            }
 2412|      0|            else
 2413|      0|            {
 2414|      0|                bDisconnect = 0;
 2415|      0|                break;  /* reject */
 2416|      0|            }
 2417|      0|        }
 2418|      0|        if (bDisconnect && ( num_O != 1 || num_H != 4 ))
  ------------------
  |  Branch (2418:13): [True: 0, False: 0]
  |  Branch (2418:30): [True: 0, False: 0]
  |  Branch (2418:44): [True: 0, False: 0]
  ------------------
 2419|      0|        {
 2420|      0|            bDisconnect = 0; /* reject */
 2421|      0|        }
 2422|      0|    }
 2423|      2|    else
 2424|      2|    {
 2425|      2|        bDisconnect = 0;
 2426|      2|    }
 2427|      2|    if (bDisconnect)
  ------------------
  |  Branch (2427:9): [True: 0, False: 2]
  ------------------
 2428|      0|    {
 2429|      0|        *piO = iO;
 2430|      0|        *pk = k;
 2431|      0|    }
 2432|       |
 2433|      2|    return bDisconnect;
 2434|     16|}
bIsMetalSalt:
 2548|     16|{
 2549|     16|    int type, val, k, iO, iC, j, neigh;
 2550|     16|    int bDisconnect = 1;
 2551|       |
 2552|       |    /* check for a metal atom:
 2553|       |    metal atom should be connected and be a metal */
 2554|     16|    if (!( val = at[i].valence ) ||
  ------------------
  |  Branch (2554:9): [True: 0, False: 16]
  ------------------
 2555|     16|         !( type = get_el_type( at[i].el_number ) ) ||
  ------------------
  |  Branch (2555:10): [True: 16, False: 0]
  ------------------
 2556|     16|         !( type & IS_METAL ))
  ------------------
  |  |  110|      0|#define IS_METAL        3          /* metal bitmap */
  ------------------
  |  Branch (2556:10): [True: 0, False: 0]
  ------------------
 2557|     16|    {
 2558|     16|        bDisconnect = 0;  /* reject */
 2559|     16|    }
 2560|      0|    else if (at[i].num_H)
  ------------------
  |  Branch (2560:14): [True: 0, False: 0]
  ------------------
 2561|       |        /* metal atom should not have adjacent H or multiple bonds or radical */
 2562|      0|    {
 2563|      0|        bDisconnect = 0; /* reject */
 2564|      0|    }
 2565|      0|    else
 2566|      0|    {
 2567|       |        /* check valence */
 2568|      0|        if (at[i].charge == 0 &&
  ------------------
  |  Branch (2568:13): [True: 0, False: 0]
  ------------------
 2569|      0|            ( ( type & 1 ) && val == get_el_valence( at[i].el_number, 0, 0 ) ||
  ------------------
  |  Branch (2569:15): [True: 0, False: 0]
  |  Branch (2569:31): [True: 0, False: 0]
  ------------------
 2570|      0|             ( type & 2 ) && val == get_el_valence( at[i].el_number, 0, 1 ) ) ||
  ------------------
  |  Branch (2570:14): [True: 0, False: 0]
  |  Branch (2570:30): [True: 0, False: 0]
  ------------------
 2571|      0|             at[i].charge > 0 &&
  ------------------
  |  Branch (2571:14): [True: 0, False: 0]
  ------------------
 2572|      0|             ( type & 1 ) && val == get_el_valence( at[i].el_number, at[i].charge, 0 ))
  ------------------
  |  Branch (2572:14): [True: 0, False: 0]
  |  Branch (2572:30): [True: 0, False: 0]
  ------------------
 2573|      0|        {
 2574|      0|            ; /* accept */
 2575|      0|        }
 2576|      0|        else
 2577|      0|        {
 2578|      0|            bDisconnect = 0; /* reject */
 2579|      0|        }
 2580|      0|    }
 2581|       |
 2582|     16|    if (bDisconnect)
  ------------------
  |  Branch (2582:9): [True: 0, False: 16]
  ------------------
 2583|      0|    {
 2584|       |        /*************************************************************************
 2585|       |        *                                                                  |    *
 2586|       |        * check M neighbors. Disconnect if all neighbors are M-O-C# or M-O-C=   *
 2587|       |        *                                                                  |    *
 2588|       |        *************************************************************************/
 2589|      0|        for (k = 0; k < at[i].valence; k++)
  ------------------
  |  Branch (2589:21): [True: 0, False: 0]
  ------------------
 2590|      0|        {
 2591|      0|            iO = at[i].neighbor[k];
 2592|       |            /* halogenide 2004-07-08 */
 2593|      0|            if (( at[iO].el_number == EL_NUMBER_F ||
  ------------------
  |  |   46|      0|#define EL_NUMBER_F ((U_CHAR) 9)
  ------------------
  |  Branch (2593:19): [True: 0, False: 0]
  ------------------
 2594|      0|                  at[iO].el_number == EL_NUMBER_CL ||
  ------------------
  |  |   50|      0|#define EL_NUMBER_CL ((U_CHAR) 17)
  ------------------
  |  Branch (2594:19): [True: 0, False: 0]
  ------------------
 2595|      0|                  at[iO].el_number == EL_NUMBER_BR ||
  ------------------
  |  |   53|      0|#define EL_NUMBER_BR ((U_CHAR) 35)
  ------------------
  |  Branch (2595:19): [True: 0, False: 0]
  ------------------
 2596|      0|                  at[iO].el_number == EL_NUMBER_I ) &&
  ------------------
  |  |   55|      0|#define EL_NUMBER_I ((U_CHAR) 53)
  ------------------
  |  Branch (2596:19): [True: 0, False: 0]
  ------------------
 2597|      0|                 at[iO].valence == 1 && at[iO].chem_bonds_valence == 1 &&
  ------------------
  |  Branch (2597:18): [True: 0, False: 0]
  |  Branch (2597:41): [True: 0, False: 0]
  ------------------
 2598|      0|                 !at[iO].charge && !( at[iO].radical && at[iO].radical != RADICAL_SINGLET ) && !NUMH( at, iO ))
  ------------------
  |  |  103|      0|#define RADICAL_SINGLET 1
  ------------------
                               !at[iO].charge && !( at[iO].radical && at[iO].radical != RADICAL_SINGLET ) && !NUMH( at, iO ))
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (2598:18): [True: 0, False: 0]
  |  Branch (2598:39): [True: 0, False: 0]
  |  Branch (2598:57): [True: 0, False: 0]
  |  Branch (2598:96): [True: 0, False: 0]
  ------------------
 2599|      0|            {
 2600|      0|                ; /* found */
 2601|      0|            }
 2602|      0|            else
 2603|      0|            {
 2604|       |                /* -O-C= */
 2605|      0|                if (at[iO].el_number != EL_NUMBER_O ||
  ------------------
  |  |   45|      0|#define EL_NUMBER_O ((U_CHAR) 8)
  ------------------
  |  Branch (2605:21): [True: 0, False: 0]
  ------------------
 2606|      0|                     NUMH( at, iO ) ||
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  |  |  |  Branch (88:24): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2607|      0|                     at[iO].valence != 2 ||
  ------------------
  |  Branch (2607:22): [True: 0, False: 0]
  ------------------
 2608|      0|                     at[iO].charge ||
  ------------------
  |  Branch (2608:22): [True: 0, False: 0]
  ------------------
 2609|      0|                     at[iO].radical && at[iO].radical != RADICAL_SINGLET ||
  ------------------
  |  |  103|      0|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (2609:22): [True: 0, False: 0]
  |  Branch (2609:40): [True: 0, False: 0]
  ------------------
 2610|      0|                     at[iO].valence != at[iO].chem_bonds_valence)
  ------------------
  |  Branch (2610:22): [True: 0, False: 0]
  ------------------
 2611|      0|                {
 2612|      0|                    bDisconnect = 0; /* reject */
 2613|      0|                    break;
 2614|      0|                }
 2615|      0|                iC = at[iO].neighbor[at[iO].neighbor[0] == i];
 2616|      0|                if (at[iC].el_number != EL_NUMBER_C ||
  ------------------
  |  |   43|      0|#define EL_NUMBER_C ((U_CHAR) 6)
  ------------------
  |  Branch (2616:21): [True: 0, False: 0]
  ------------------
 2617|      0|                     at[iC].num_H ||
  ------------------
  |  Branch (2617:22): [True: 0, False: 0]
  ------------------
 2618|      0|                     at[iC].chem_bonds_valence != 4 ||
  ------------------
  |  Branch (2618:22): [True: 0, False: 0]
  ------------------
 2619|      0|                     at[iC].charge ||
  ------------------
  |  Branch (2619:22): [True: 0, False: 0]
  ------------------
 2620|      0|                     at[iC].radical && at[iC].radical != RADICAL_SINGLET ||
  ------------------
  |  |  103|      0|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (2620:22): [True: 0, False: 0]
  |  Branch (2620:40): [True: 0, False: 0]
  ------------------
 2621|      0|                     at[iC].valence == at[iC].chem_bonds_valence)
  ------------------
  |  Branch (2621:22): [True: 0, False: 0]
  ------------------
 2622|      0|                {
 2623|      0|                    bDisconnect = 0; /* reject */
 2624|      0|                    break;
 2625|      0|                }
 2626|      0|                for (j = 0; j < at[iC].valence; j++)
  ------------------
  |  Branch (2626:29): [True: 0, False: 0]
  ------------------
 2627|      0|                {
 2628|      0|                    neigh = at[iC].neighbor[j];
 2629|      0|                    if (at[neigh].el_number == EL_NUMBER_H)
  ------------------
  |  |   41|      0|#define EL_NUMBER_H ((U_CHAR) 1)
  ------------------
  |  Branch (2629:25): [True: 0, False: 0]
  ------------------
 2630|      0|                    {
 2631|      0|                        break;
 2632|      0|                    }
 2633|      0|                }
 2634|      0|                if (j != at[iC].valence)
  ------------------
  |  Branch (2634:21): [True: 0, False: 0]
  ------------------
 2635|      0|                {
 2636|      0|                    bDisconnect = 0; /* reject */
 2637|      0|                    break;
 2638|      0|                }
 2639|      0|            }
 2640|      0|        }
 2641|      0|    }
 2642|       |
 2643|     16|    return bDisconnect;
 2644|     16|}
DisconnectSalts:
 2705|  54.6k|{
 2706|  54.6k|    int i, k, iO, num_changes, val;
 2707|  54.6k|    S_CHAR    num_explicit_H[NUM_H_ISOTOPES + 1];
 2708|  54.6k|    inp_ATOM *at = orig_inp_data->at;
 2709|  54.6k|    int num_at = orig_inp_data->num_inp_atoms;
 2710|       |
 2711|       |    /* check each atom */
 2712|   109k|    for (i = 0, num_changes = 0; i < num_at; i++)
  ------------------
  |  Branch (2712:34): [True: 54.6k, False: 54.6k]
  ------------------
 2713|  54.6k|    {
 2714|       |
 2715|  54.6k|        if (!( val = at[i].valence ) || /* disconnected atom */
  ------------------
  |  Branch (2715:13): [True: 54.6k, False: 15]
  ------------------
 2716|  54.6k|             val != at[i].chem_bonds_valence || /* a bond has higher multiplicity than 1 */
  ------------------
  |  Branch (2716:14): [True: 6, False: 9]
  ------------------
 2717|  54.6k|             at[i].radical && at[i].radical != RADICAL_SINGLET /* radical */)
  ------------------
  |  |  103|      1|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (2717:14): [True: 1, False: 8]
  |  Branch (2717:31): [True: 1, False: 0]
  ------------------
 2718|  54.6k|        {
 2719|  54.6k|            continue;   /* reject */
 2720|  54.6k|        }
 2721|       |
 2722|      8|        if (bIsAmmoniumSalt( at, i, &iO, &k, num_explicit_H ))
  ------------------
  |  Branch (2722:13): [True: 0, False: 8]
  ------------------
 2723|      0|        {
 2724|      0|            if (bDisconnect)
  ------------------
  |  Branch (2724:17): [True: 0, False: 0]
  ------------------
 2725|      0|            {
 2726|      0|                DisconnectAmmoniumSalt( at, i, iO, k, num_explicit_H );
 2727|      0|                orig_inp_data->num_inp_bonds--;
 2728|      0|            }
 2729|       |
 2730|       |            /* count disconnected atoms */
 2731|      0|            num_changes++;
 2732|      0|        }
 2733|      8|        else if (bIsMetalSalt( at, i ))
  ------------------
  |  Branch (2733:18): [True: 0, False: 8]
  ------------------
 2734|      0|        {
 2735|      0|            if (bDisconnect)
  ------------------
  |  Branch (2735:17): [True: 0, False: 0]
  ------------------
 2736|      0|            {
 2737|      0|                k = DisconnectMetalSalt( at, i );
 2738|      0|                orig_inp_data->num_inp_bonds -= k;
 2739|      0|            }
 2740|      0|            num_changes++;
 2741|      0|        }
 2742|      8|    }
 2743|       |
 2744|  54.6k|    return num_changes;
 2745|  54.6k|}
bIsMetalToDisconnect:
 2756|     15|{
 2757|     15|    int type, at_valence, num_H;
 2758|       |
 2759|       |    /*
 2760|       |    if ( !at[i].valence )
 2761|       |    */
 2762|       |
 2763|     15|    if (!( type = get_el_type( at[i].el_number ) ) ||
  ------------------
  |  Branch (2763:9): [True: 15, False: 0]
  ------------------
 2764|     15|         !( type & IS_METAL ))
  ------------------
  |  |  110|      0|#define IS_METAL        3          /* metal bitmap */
  ------------------
  |  Branch (2764:10): [True: 0, False: 0]
  ------------------
 2765|     15|    {
 2766|     15|        return 0;
 2767|     15|    }
 2768|       |
 2769|      0|    num_H = NUMH( at, i );
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
 2770|      0|    at_valence = num_H + at[i].chem_bonds_valence;
 2771|       |
 2772|      0|    if (!at_valence)
  ------------------
  |  Branch (2772:9): [True: 0, False: 0]
  ------------------
 2773|      0|    {
 2774|      0|        return 0; /* nothing to disconnect */
 2775|      0|    }
 2776|       |
 2777|      0|    if (bCheckMetalValence)
  ------------------
  |  Branch (2777:9): [True: 0, False: 0]
  ------------------
 2778|      0|    {
 2779|      0|        if (abs( at[i].charge ) > 1)
  ------------------
  |  Branch (2779:13): [True: 0, False: 0]
  ------------------
 2780|      0|        {
 2781|      0|            return 1; /* multiple charges */
 2782|      0|        }
 2783|       |
 2784|      0|        for (i = 0; i < 2 && ( i & type ); i++)
  ------------------
  |  Branch (2784:21): [True: 0, False: 0]
  |  Branch (2784:30): [True: 0, False: 0]
  ------------------
 2785|      0|        {
 2786|      0|            if (at_valence == get_el_valence( at[i].el_number, at[i].charge, i ))
  ------------------
  |  Branch (2786:17): [True: 0, False: 0]
  ------------------
 2787|      0|            {
 2788|      0|                return 2; /* atom has normal valence */
 2789|      0|            }
 2790|      0|        }
 2791|      0|    }
 2792|       |
 2793|      0|    return 1;
 2794|      0|}
bMayDisconnectMetals:
 2801|  54.6k|{
 2802|  54.6k|    int i, j, k, iO, num_changes, val, bRadOrMultBonds, num_impl_H = 0;
 2803|  54.6k|    S_CHAR    num_explicit_H[NUM_H_ISOTOPES + 1];
 2804|  54.6k|    inp_ATOM *at = orig_inp_data->at;
 2805|  54.6k|    int num_at = orig_inp_data->num_inp_atoms;
 2806|  54.6k|    int *nNumImplH = &orig_inp_data->bDisconnectCoord;
 2807|       |
 2808|       |    /* check each atom */
 2809|   109k|    for (i = 0, num_changes = 0; i < num_at; i++)
  ------------------
  |  Branch (2809:34): [True: 54.6k, False: 54.6k]
  ------------------
 2810|  54.6k|    {
 2811|       |
 2812|  54.6k|        if (!( val = at[i].valence ) && !NUMH( at, i ))
  ------------------
  |  |   88|  54.6k|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|  54.6k|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (2812:13): [True: 54.6k, False: 15]
  |  Branch (2812:41): [True: 54.6k, False: 0]
  ------------------
 2813|  54.6k|        {
 2814|  54.6k|            continue; /* disconnected atom */
 2815|  54.6k|        }
 2816|       |
 2817|     15|        bRadOrMultBonds = ( val == 0 ) ||
  ------------------
  |  Branch (2817:27): [True: 0, False: 15]
  ------------------
 2818|     15|            ( val != at[i].chem_bonds_valence ) || /* a bond has higher multiplicity than 1 */
  ------------------
  |  Branch (2818:13): [True: 6, False: 9]
  ------------------
 2819|     15|            ( at[i].radical && at[i].radical != RADICAL_SINGLET ); /* radical */
  ------------------
  |  |  103|      1|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (2819:15): [True: 1, False: 8]
  |  Branch (2819:32): [True: 1, False: 0]
  ------------------
 2820|       |
 2821|     15|        if (!bRadOrMultBonds && bIsAmmoniumSalt( at, i, &iO, &k, num_explicit_H ))
  ------------------
  |  Branch (2821:13): [True: 8, False: 7]
  |  Branch (2821:33): [True: 0, False: 8]
  ------------------
 2822|      0|        {
 2823|      0|            ;
 2824|      0|        }
 2825|     15|        else if (!bRadOrMultBonds && bIsMetalSalt( at, i ))
  ------------------
  |  Branch (2825:18): [True: 8, False: 7]
  |  Branch (2825:38): [True: 0, False: 8]
  ------------------
 2826|      0|        {
 2827|      0|            ;
 2828|      0|        }
 2829|     15|        else if (1 == ( j = bIsMetalToDisconnect( at, i, bCheckMetalValence ) ))
  ------------------
  |  Branch (2829:18): [True: 0, False: 15]
  ------------------
 2830|      0|        {
 2831|      0|            num_impl_H += NUMH( at, i );
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
 2832|      0|            num_changes++;
 2833|      0|        }
 2834|     15|        else if (2 == j && bTautFlagsDone)
  ------------------
  |  Branch (2834:18): [True: 0, False: 15]
  |  Branch (2834:28): [True: 0, False: 0]
  ------------------
 2835|      0|        {
 2836|      0|            *bTautFlagsDone |= TG_FLAG_CHECK_VALENCE_COORD_DONE;
  ------------------
  |  |  973|      0|#define TG_FLAG_CHECK_VALENCE_COORD_DONE 0x00000200   /* did not disconnect "coord. centers" with usual valence */
  ------------------
 2837|      0|        }
 2838|     15|    }
 2839|       |
 2840|  54.6k|    if (nNumImplH)
  ------------------
  |  Branch (2840:9): [True: 54.6k, False: 0]
  ------------------
 2841|  54.6k|    {
 2842|  54.6k|        *nNumImplH = num_changes ? num_impl_H + 1 : 0;
  ------------------
  |  Branch (2842:22): [True: 0, False: 54.6k]
  ------------------
 2843|  54.6k|    }
 2844|       |
 2845|  54.6k|    return num_changes;
 2846|  54.6k|}
add_DT_to_num_H:
 3736|  54.6k|{
 3737|  54.6k|    int i, j;
 3738|   109k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (3738:17): [True: 54.6k, False: 54.6k]
  ------------------
 3739|  54.6k|    {
 3740|   218k|        for (j = 0; j < NUM_H_ISOTOPES; j++)
  ------------------
  |  |   53|   218k|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (3740:21): [True: 163k, False: 54.6k]
  ------------------
 3741|   163k|        {
 3742|   163k|            at[i].num_H += at[i].num_iso_H[j];
 3743|   163k|        }
 3744|  54.6k|    }
 3745|  54.6k|    return 0;
 3746|  54.6k|}
remove_terminal_HDT:
 3753|  54.6k|{
 3754|  54.6k|    AT_NUMB   *new_ord;
 3755|  54.6k|    inp_ATOM  *new_at;
 3756|  54.6k|    char *p;
 3757|  54.6k|    static const char szHDT[] = "HDT";
 3758|  54.6k|    static const int  kMax = sizeof( szHDT ); /*  = 4 */
 3759|  54.6k|    int ret = -1;
 3760|  54.6k|    int num_hydrogens = 0, num_H = 0;  /*  number of terminal H, D, T */
 3761|  54.6k|    int i, j, k, n, m;
 3762|  54.6k|    int val;
 3763|  54.6k|    AT_RANK new_HydrogenAt_order[NUM_H_ISOTOPES + 1];
 3764|  54.6k|    AT_RANK new_OtherNeigh_order[MAXVAL];
 3765|  54.6k|    S_CHAR  old_trans[MAX_NUM_STEREO_BONDS];
 3766|       |
 3767|  54.6k|    int  num_OtherNeigh, num_HydrogenAt;
 3768|       |
 3769|  54.6k|    new_ord = (AT_NUMB *) inchi_calloc( num_atoms, sizeof( new_ord[0] ) ); /* changed malloc to calloc 9-11-2003 */
  ------------------
  |  | 1133|  54.6k|#define inchi_calloc   calloc
  ------------------
 3770|  54.6k|    new_at = (inp_ATOM  *) inchi_malloc( sizeof( new_at[0] ) *num_atoms );
  ------------------
  |  | 1130|  54.6k|#define inchi_malloc   malloc
  ------------------
 3771|  54.6k|    if (!new_ord || !new_at)
  ------------------
  |  Branch (3771:9): [True: 0, False: 54.6k]
  |  Branch (3771:21): [True: 0, False: 54.6k]
  ------------------
 3772|      0|    {
 3773|      0|        goto exit_function;
 3774|      0|    }
 3775|       |
 3776|       |    /*  move H. D, T to the end of the list of atoms */
 3777|   109k|    for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (3777:17): [True: 54.6k, False: 54.6k]
  ------------------
 3778|  54.6k|    {
 3779|  54.6k|        at[i].component = i; /*  temporarily save original numbering */
 3780|       |                             /*  get k = temp. hydrogen isotope/non-hydrogen atom type: */
 3781|       |                             /*  k=0:H, k=2:D, k=3:T, k=4=kMax: not a hydrogen */
 3782|  54.6k|        k = at[i].elname[1] ? kMax : ( p = (char*) strchr( szHDT, at[i].elname[0] ) ) ? (int) ( p - szHDT ) : kMax;
  ------------------
  |  Branch (3782:13): [True: 54.3k, False: 248]
  |  Branch (3782:38): [True: 1, False: 247]
  ------------------
 3783|       |        /*  set hydrogen isotope atw differences */
 3784|       |        /*  Notes: k-value of isotopic H is incremented to correct iso_atw_diff value later. */
 3785|       |        /*         1H isotope cannot be detected here. */
 3786|  54.6k|        if (k == ATW_H || k == ATW_H + 1)
  ------------------
  |  |   54|   109k|#define ATW_H                 1  /* hydrogen atomic weight */
  ------------------
                      if (k == ATW_H || k == ATW_H + 1)
  ------------------
  |  |   54|  54.6k|#define ATW_H                 1  /* hydrogen atomic weight */
  ------------------
  |  Branch (3786:13): [True: 0, False: 54.6k]
  |  Branch (3786:27): [True: 0, False: 54.6k]
  ------------------
 3787|      0|        {
 3788|       |            /* D or T, k = 1 or 2 */
 3789|      0|            at[i].elname[0] = 'H'; /*  hydrogen isotope */
 3790|      0|            at[i].iso_atw_diff = ++k; /*  increment k to make k = iso_atw_diff ( 2 for D, 3 for T ) */
 3791|      0|        }
 3792|  54.6k|        num_H += ( k != kMax && at[i].valence == 1 && at[i].chem_bonds_valence == 1 && !NUMH( at, i ) );
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (3792:20): [True: 1, False: 54.6k]
  |  Branch (3792:33): [True: 0, False: 1]
  |  Branch (3792:55): [True: 0, False: 0]
  |  Branch (3792:88): [True: 0, False: 0]
  ------------------
 3793|  54.6k|    }
 3794|       |
 3795|       |    /* special case: HD, HT, DT, HH: the only non-isotopic H or
 3796|       |    * the lightest isotopic H out of two is removed
 3797|       |    * to become implicit (make the heavier H the "central atom").
 3798|       |    * Note: This must be consistent with MOL_FMT_to_atom()
 3799|       |    * treatment of isotopic Hn aliases.
 3800|       |    */
 3801|  54.6k|    if (2 == num_H && 2 == num_atoms && !NUMH( at, 0 ) && !NUMH( at, 1 ))
  ------------------
  |  |   88|  54.6k|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
                  if (2 == num_H && 2 == num_atoms && !NUMH( at, 0 ) && !NUMH( at, 1 ))
  ------------------
  |  |   88|      0|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|      0|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
  |  Branch (3801:9): [True: 0, False: 54.6k]
  |  Branch (3801:23): [True: 0, False: 0]
  |  Branch (3801:41): [True: 0, False: 0]
  |  Branch (3801:59): [True: 0, False: 0]
  ------------------
 3802|      0|    {
 3803|       |
 3804|      0|        if (at[0].iso_atw_diff >= at[1].iso_atw_diff)
  ------------------
  |  Branch (3804:13): [True: 0, False: 0]
  ------------------
 3805|      0|        {
 3806|      0|            new_ord[0] = 0;
 3807|      0|            new_ord[1] = 1;
 3808|      0|        }
 3809|      0|        else
 3810|      0|        {
 3811|      0|            new_ord[0] = 1;
 3812|      0|            new_ord[1] = 0;
 3813|      0|        }
 3814|      0|        if (at[new_ord[1]].charge)
  ------------------
  |  Branch (3814:13): [True: 0, False: 0]
  ------------------
 3815|      0|        {
 3816|      0|            at[new_ord[0]].charge += at[new_ord[1]].charge;
 3817|      0|            at[new_ord[1]].charge = 0;
 3818|      0|        }
 3819|      0|        new_at[new_ord[0]] = at[0];
 3820|      0|        new_at[new_ord[1]] = at[1];
 3821|      0|        num_hydrogens = 1;
 3822|      0|    }
 3823|  54.6k|    else
 3824|  54.6k|    {
 3825|       |        /* general case except H-H */
 3826|   109k|        for (i = 0; i < num_atoms; i++)
  ------------------
  |  Branch (3826:21): [True: 54.6k, False: 54.6k]
  ------------------
 3827|  54.6k|        {
 3828|  54.6k|            k = ( at[i].elname[1] || NUMH( at, i ) ) ? kMax : ( at[i].elname[0] == 'H' ) ? at[i].iso_atw_diff : kMax;
  ------------------
  |  |   88|    248|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|    248|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  |  |  |  Branch (88:24): [True: 0, False: 248]
  |  |  ------------------
  ------------------
  |  Branch (3828:19): [True: 54.3k, False: 248]
  |  Branch (3828:63): [True: 1, False: 247]
  ------------------
 3829|  54.6k|            if (k < kMax && at[i].valence == 1 && at[i].chem_bonds_valence == 1 &&
  ------------------
  |  Branch (3829:17): [True: 1, False: 54.6k]
  |  Branch (3829:29): [True: 0, False: 1]
  |  Branch (3829:51): [True: 0, False: 0]
  ------------------
 3830|       |                 /*  the order of comparison is important */
 3831|  54.6k|                ( ( n = (int) at[i].neighbor[0] ) > i               /* at[n] has not been encountered yet*/ ||
  ------------------
  |  Branch (3831:19): [True: 0, False: 0]
  ------------------
 3832|      0|                 (int) new_ord[n] < num_atoms - num_hydrogens ) /* at[n] might have been encountered; it has not been moved */)
  ------------------
  |  Branch (3832:18): [True: 0, False: 0]
  ------------------
 3833|      0|            {
 3834|       |                /*  found an explicit terminal hydrogen */
 3835|      0|                num_hydrogens++;
 3836|      0|                if (k == 0 && ATW_H <= at[i].iso_atw_diff && at[i].iso_atw_diff < ATW_H + NUM_H_ISOTOPES)
  ------------------
  |  |   54|      0|#define ATW_H                 1  /* hydrogen atomic weight */
  ------------------
                              if (k == 0 && ATW_H <= at[i].iso_atw_diff && at[i].iso_atw_diff < ATW_H + NUM_H_ISOTOPES)
  ------------------
  |  |   54|      0|#define ATW_H                 1  /* hydrogen atomic weight */
  ------------------
                              if (k == 0 && ATW_H <= at[i].iso_atw_diff && at[i].iso_atw_diff < ATW_H + NUM_H_ISOTOPES)
  ------------------
  |  |   53|      0|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (3836:21): [True: 0, False: 0]
  |  Branch (3836:31): [True: 0, False: 0]
  |  Branch (3836:62): [True: 0, False: 0]
  ------------------
 3837|      0|                {
 3838|      0|                    k = at[i].iso_atw_diff; /*  H isotope has already been marked above or elsewhere */
 3839|      0|                }
 3840|      0|                if (at[i].charge)
  ------------------
  |  Branch (3840:21): [True: 0, False: 0]
  ------------------
 3841|      0|                {
 3842|       |                    /*  transfer charge from the hydrogen */
 3843|      0|                    at[n].charge += at[i].charge;
 3844|      0|                    at[i].charge = 0;
 3845|      0|                    if (bFixTermHChrg)
  ------------------
  |  Branch (3845:25): [True: 0, False: 0]
  ------------------
 3846|      0|                    {
 3847|       |                        /*    Fixed bug (July 6, 2008 IPl) :
 3848|       |                        if terminal H was charged (not neutralized before call of remove_terminal_HDT)
 3849|       |                        and had an ordering number > than that of heavy-atom neighbour, then
 3850|       |                        charge on neighbour atom was not adjusted (though charge on H was removed). */
 3851|      0|                        if (i > n)
  ------------------
  |  Branch (3851:29): [True: 0, False: 0]
  ------------------
 3852|       |                            /* new_at[new_ord[n]] has been created and filled already */
 3853|      0|                            new_at[new_ord[n]].charge = at[n].charge;
 3854|      0|                    }
 3855|      0|                }
 3856|      0|                new_ord[i] = num_atoms - num_hydrogens;  /*  move hydrogens to the end of the list */
 3857|      0|            }
 3858|  54.6k|            else
 3859|  54.6k|            {
 3860|       |                /* atom is not an explicit terminal hydrogen */
 3861|  54.6k|                new_ord[i] = i - num_hydrogens;  /*  adjust non-hydrogens positions */
 3862|  54.6k|            }
 3863|       |
 3864|       |            /*  copy atom to the new position */
 3865|  54.6k|            new_at[new_ord[i]] = at[i];
 3866|  54.6k|        } /* i */
 3867|  54.6k|    } /* general case except H-H */
 3868|       |
 3869|  54.6k|    if (num_hydrogens)
  ------------------
  |  Branch (3869:9): [True: 0, False: 54.6k]
  ------------------
 3870|      0|    {
 3871|      0|        int num_others = num_atoms - num_hydrogens; /*  atoms which are not terminal H, D, T */
 3872|      0|        if (num_hydrogens > 1)
  ------------------
  |  Branch (3872:13): [True: 0, False: 0]
  ------------------
 3873|      0|        {
 3874|       |            /*  sort hydrogen isotopes in ascending order, */
 3875|       |            /*  orig, numbers being the secondary sorting key */
 3876|      0|            qsort( new_at + num_others, num_hydrogens, sizeof( new_at[0] ), cmp_iso_atw_diff_component_no );
 3877|      0|        }
 3878|       |        /*  save new numbering of hydrogen atoms using temporarily saved orig numbering */
 3879|      0|        for (i = num_others; i < num_atoms; i++)
  ------------------
  |  Branch (3879:30): [True: 0, False: 0]
  ------------------
 3880|      0|        {
 3881|      0|            new_ord[(int) new_at[i].component] = i;
 3882|      0|        }
 3883|       |
 3884|       |        /*  renumber neighbors according to new_ord[] and detach terminal hydrogens */
 3885|      0|        for (i = 0; i < num_others; i++)
  ------------------
  |  Branch (3885:21): [True: 0, False: 0]
  ------------------
 3886|      0|        {
 3887|      0|            memset( new_HydrogenAt_order, 0, sizeof( new_HydrogenAt_order ) );
 3888|      0|            memset( new_OtherNeigh_order, 0, sizeof( new_OtherNeigh_order ) );
 3889|      0|            num_OtherNeigh = 0;
 3890|      0|            num_HydrogenAt = 0;
 3891|      0|            num_H = 0;
 3892|       |
 3893|      0|            for (m = 0; m < MAX_NUM_STEREO_BONDS && new_at[i].sb_parity[m]; m++)
  ------------------
  |  |  876|      0|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (3893:25): [True: 0, False: 0]
  |  Branch (3893:53): [True: 0, False: 0]
  ------------------
 3894|      0|            {
 3895|      0|                old_trans[m] = 2 - ( new_at[i].sn_ord[m] + new_at[i].sb_ord[m] + ( new_at[i].sn_ord[m] > new_at[i].sb_ord[m] ) ) % 2;
 3896|      0|            }
 3897|       |
 3898|      0|            for (k = j = val = 0; k < new_at[i].valence; k++)
  ------------------
  |  Branch (3898:35): [True: 0, False: 0]
  ------------------
 3899|      0|            {
 3900|      0|                if (num_others <= ( n = new_ord[new_at[i].neighbor[k]] ))
  ------------------
  |  Branch (3900:21): [True: 0, False: 0]
  ------------------
 3901|      0|                {
 3902|       |                    /*  discovered neighbor = disconnected explicit hydrogen
 3903|       |                    *  i = new atom new_at[i] ordering number
 3904|       |                    *  n = new number of the explicit H
 3905|       |                    *  k = ordering number of the explicit H in new_at[i] adjacency list
 3906|       |                    */
 3907|      0|                    if (0 < new_at[n].iso_atw_diff && new_at[n].iso_atw_diff < ATW_H + NUM_H_ISOTOPES)
  ------------------
  |  |   54|      0|#define ATW_H                 1  /* hydrogen atomic weight */
  ------------------
                                  if (0 < new_at[n].iso_atw_diff && new_at[n].iso_atw_diff < ATW_H + NUM_H_ISOTOPES)
  ------------------
  |  |   53|      0|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (3907:25): [True: 0, False: 0]
  |  Branch (3907:55): [True: 0, False: 0]
  ------------------
 3908|      0|                    {
 3909|       |                        /* make explicit isotopic H implicit */
 3910|      0|                        new_at[i].num_iso_H[new_at[n].iso_atw_diff - 1] ++; /*  isotopic H */
 3911|      0|                        num_HydrogenAt += !new_HydrogenAt_order[new_at[n].iso_atw_diff];
 3912|      0|                        new_HydrogenAt_order[new_at[n].iso_atw_diff] = k + 1;
 3913|      0|                    }
 3914|      0|                    else
 3915|      0|                    {
 3916|       |                        /* make explicit non-isotopic H implicit */
 3917|      0|                        new_at[i].num_H++; /*  non-isotopic H */
 3918|      0|                        num_HydrogenAt += !num_H;
 3919|      0|                        num_H++;
 3920|      0|                        new_HydrogenAt_order[0] = k + 1;
 3921|      0|                    }
 3922|       |                    /*  decrement chem. bonds valence because one bond is removed */
 3923|      0|                    new_at[i].chem_bonds_valence = inchi_max( 0, new_at[i].chem_bonds_valence - 1 );
  ------------------
  |  |  166|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3924|      0|                    new_at[n].neighbor[0] = i; /*  update removed hydrogen neighbor number */
 3925|      0|                    if (new_at[i].sb_parity[0])
  ------------------
  |  Branch (3925:25): [True: 0, False: 0]
  ------------------
 3926|      0|                    {
 3927|       |                        /* if the removed H is an SB neighbor then mark it as removed */
 3928|      0|                        for (m = 0; m < MAX_NUM_STEREO_BONDS && new_at[i].sb_parity[m]; m++)
  ------------------
  |  |  876|      0|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (3928:37): [True: 0, False: 0]
  |  Branch (3928:65): [True: 0, False: 0]
  ------------------
 3929|      0|                        {
 3930|      0|                            if (k == (int) new_at[i].sn_ord[m])
  ------------------
  |  Branch (3930:33): [True: 0, False: 0]
  ------------------
 3931|      0|                            {
 3932|      0|                                new_at[i].sn_ord[m] = -( new_at[n].iso_atw_diff + 1 );
 3933|       |                                /* means the SB neighbor has been removed; (-4)=H, (-3)=1H, (-2)=D, (-1)=T */
 3934|      0|                            }
 3935|      0|                        }
 3936|      0|                    }
 3937|      0|                }
 3938|      0|                else
 3939|      0|                {
 3940|       |                    /* discovered a regular (not an explicit H) neighbor */
 3941|      0|                    if (new_at[i].sb_parity[0])
  ------------------
  |  Branch (3941:25): [True: 0, False: 0]
  ------------------
 3942|      0|                    {
 3943|      0|                        if (num_OtherNeigh < MAX_NUM_STEREO_BONDS)
  ------------------
  |  |  876|      0|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (3943:29): [True: 0, False: 0]
  ------------------
 3944|      0|                        {
 3945|      0|                            new_OtherNeigh_order[num_OtherNeigh] = k + 1;
 3946|      0|                        }
 3947|      0|                        num_OtherNeigh++; /* increment outside of if() to detect overflow */
 3948|      0|                        if (val != k)
  ------------------
  |  Branch (3948:29): [True: 0, False: 0]
  ------------------
 3949|      0|                        {
 3950|       |                            /* store new stereobond and sb-neighbor ordering numbers */
 3951|      0|                            for (m = 0; m < MAX_NUM_STEREO_BONDS && new_at[i].sb_parity[m]; m++)
  ------------------
  |  |  876|      0|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (3951:41): [True: 0, False: 0]
  |  Branch (3951:69): [True: 0, False: 0]
  ------------------
 3952|      0|                            {
 3953|      0|                                if (k == (int) new_at[i].sb_ord[m])
  ------------------
  |  Branch (3953:37): [True: 0, False: 0]
  ------------------
 3954|      0|                                    new_at[i].sb_ord[m] = val;
 3955|      0|                                else
 3956|      0|                                    if (k == (int) new_at[i].sn_ord[m])
  ------------------
  |  Branch (3956:41): [True: 0, False: 0]
  ------------------
 3957|      0|                                        new_at[i].sn_ord[m] = val;
 3958|      0|                            }
 3959|      0|                        }
 3960|      0|                    }
 3961|      0|                    new_at[i].neighbor[val] = new_ord[new_at[i].neighbor[k]];
 3962|      0|                    new_at[i].bond_type[val] = new_at[i].bond_type[k];
 3963|      0|                    new_at[i].bond_stereo[val] = new_at[i].bond_stereo[k];
 3964|      0|                    val++;
 3965|      0|                }
 3966|      0|            }
 3967|      0|            if (new_at[i].valence > val && new_at[i].sb_parity[0])
  ------------------
  |  Branch (3967:17): [True: 0, False: 0]
  |  Branch (3967:44): [True: 0, False: 0]
  ------------------
 3968|      0|            {
 3969|      0|                if (num_HydrogenAt == new_at[i].valence - val && num_HydrogenAt + num_OtherNeigh <= MAXVAL)
  ------------------
  |  |   88|      0|#define MAXVAL 20       /* maximum valence */
  ------------------
  |  Branch (3969:21): [True: 0, False: 0]
  |  Branch (3969:66): [True: 0, False: 0]
  ------------------
 3970|      0|                {
 3971|       |                    /* recalculate parity so that it would describe neighbor sequence H,1H,D,T,neigh[0],neigh[1]... */
 3972|      0|                    memmove( new_OtherNeigh_order + num_HydrogenAt, new_OtherNeigh_order, num_OtherNeigh * sizeof( new_OtherNeigh_order[0] ) );
 3973|      0|                    for (k = 0, j = 1; k <= NUM_H_ISOTOPES; k++)
  ------------------
  |  |   53|      0|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (3973:40): [True: 0, False: 0]
  ------------------
 3974|      0|                    {
 3975|      0|                        if (new_HydrogenAt_order[k])
  ------------------
  |  Branch (3975:29): [True: 0, False: 0]
  ------------------
 3976|      0|                        {
 3977|      0|                            new_OtherNeigh_order[num_HydrogenAt - j] = new_HydrogenAt_order[k];
 3978|      0|                            for (m = 0; m < MAX_NUM_STEREO_BONDS && new_at[i].sb_parity[m]; m++)
  ------------------
  |  |  876|      0|#define MAX_NUM_STEREO_BONDS      3
  ------------------
  |  Branch (3978:41): [True: 0, False: 0]
  |  Branch (3978:69): [True: 0, False: 0]
  ------------------
 3979|      0|                            {
 3980|      0|                                if ((int) new_at[i].sn_ord[m] == -( k + 1 ))
  ------------------
  |  Branch (3980:37): [True: 0, False: 0]
  ------------------
 3981|      0|                                {
 3982|      0|                                    new_at[i].sn_ord[m] = -j;
 3983|       |                                    /* negative means explicit H isotope ord are
 3984|       |                                    (contiguously) in front of the adjacency list */
 3985|      0|                                }
 3986|      0|                            }
 3987|      0|                            j++;
 3988|      0|                        }
 3989|      0|                    }
 3990|       |                    /* at this point new_OtherNeigh_order[] contains
 3991|       |                    incremented old ordering numbers in new order */
 3992|      0|                    k = insertions_sort_AT_RANK( new_OtherNeigh_order, num_HydrogenAt + num_OtherNeigh );
 3993|      0|                    k = k % 2; /* seems to be of no use */
 3994|       |                               /*if ( k ) {*/
 3995|       |                               /*
 3996|       |                               for ( m = 0; m < MAX_NUM_STEREO_BONDS && new_at[i].sb_parity[m]; m ++ ) {
 3997|       |                               if ( PARITY_WELL_DEF(new_at[i].sb_parity[m]) ) {
 3998|       |                               if ( old_trans[m] != 2 - (4 + new_at[i].sn_ord[m] + new_at[i].sb_ord[m] + (new_at[i].sn_ord[m] > new_at[i].sb_ord[m]))%2 ) {
 3999|       |                               new_at[i].sb_parity[m] = 3 - new_at[i].sb_parity[m];
 4000|       |                               }
 4001|       |                               }
 4002|       |                               }
 4003|       |                               */
 4004|       |                               /*}*/
 4005|      0|                }
 4006|      0|            }
 4007|      0|            new_at[i].valence = val;
 4008|      0|        }
 4009|      0|        memcpy( at, new_at, sizeof( at[0] )*num_atoms );
 4010|      0|        ret = num_others;
 4011|      0|    }
 4012|  54.6k|    else
 4013|  54.6k|    {
 4014|  54.6k|        ret = num_atoms;
 4015|  54.6k|    }
 4016|       |
 4017|  54.6k|exit_function:
 4018|       |
 4019|  54.6k|    if (new_ord)
  ------------------
  |  Branch (4019:9): [True: 54.6k, False: 0]
  ------------------
 4020|  54.6k|    {
 4021|  54.6k|        inchi_free( new_ord );
  ------------------
  |  | 1136|  54.6k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 54.6k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4022|  54.6k|    }
 4023|  54.6k|    if (new_at)
  ------------------
  |  Branch (4023:9): [True: 54.6k, False: 0]
  ------------------
 4024|  54.6k|    {
 4025|  54.6k|        inchi_free( new_at );
  ------------------
  |  | 1136|  54.6k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 54.6k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4026|  54.6k|    }
 4027|       |
 4028|  54.6k|    return ret;
 4029|  54.6k|}
get_iat_number:
 4035|   112k|{
 4036|   112k|    int i;
 4037|  1.45M|    for (i = 0; i < el_num_len; i++)
  ------------------
  |  Branch (4037:17): [True: 1.34M, False: 110k]
  ------------------
 4038|  1.34M|    {
 4039|  1.34M|        if (el_num[i] == el_number)
  ------------------
  |  Branch (4039:13): [True: 1.93k, False: 1.34M]
  ------------------
 4040|  1.93k|        {
 4041|  1.93k|            return i;
 4042|  1.93k|        }
 4043|  1.34M|    }
 4044|       |
 4045|   110k|    return -1;
 4046|   112k|}
bNumHeterAtomHasIsotopicH:
 4178|   110k|{
 4179|   110k|    static int el_num[IAT_MAX];
 4180|   110k|    int i, j, val, is_O = 0, is_Cl = 0, is_N = 0, is_H = 0, num_H, iat_numb, bAccept, num_iso_H, cur_num_iso_H, num_iso_atoms;
 4181|   110k|    inp_ATOM *at, *at2;
 4182|       |
 4183|       |    /* one time initialization */
 4184|   110k|    if (!el_num[IAT_H])
  ------------------
  |  Branch (4184:9): [True: 1, False: 110k]
  ------------------
 4185|      1|    {
 4186|      1|        el_num[IAT_H] = get_periodic_table_number( "H" );
 4187|      1|        el_num[IAT_C] = get_periodic_table_number( "C" );
 4188|      1|        el_num[IAT_N] = get_periodic_table_number( "N" );
 4189|      1|        el_num[IAT_P] = get_periodic_table_number( "P" );
 4190|      1|        el_num[IAT_O] = get_periodic_table_number( "O" );
 4191|      1|        el_num[IAT_S] = get_periodic_table_number( "S" );
 4192|      1|        el_num[IAT_Se] = get_periodic_table_number( "Se" );
 4193|      1|        el_num[IAT_Te] = get_periodic_table_number( "Te" );
 4194|      1|        el_num[IAT_F] = get_periodic_table_number( "F" );
 4195|      1|        el_num[IAT_Cl] = get_periodic_table_number( "Cl" );
 4196|      1|        el_num[IAT_Br] = get_periodic_table_number( "Br" );
 4197|      1|        el_num[IAT_I] = get_periodic_table_number( "I" );
 4198|      1|    }
 4199|       |
 4200|   110k|    num_iso_H = 0;
 4201|   110k|    num_iso_atoms = 0;
 4202|       |
 4203|   222k|    for (i = 0, at = atom; i < num_atoms; i++, at++)
  ------------------
  |  Branch (4203:28): [True: 112k, False: 110k]
  ------------------
 4204|   112k|    {
 4205|       |
 4206|   112k|        num_iso_atoms += ( at->iso_atw_diff != 0 || NUM_ISO_H( at, 0 ) );
  ------------------
  |  |   87|   112k|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  |  |  |  Branch (87:25): [True: 50, False: 112k]
  |  |  ------------------
  ------------------
  |  Branch (4206:28): [True: 89, False: 112k]
  ------------------
 4207|       |        /* isotopic atoms and implicit isotopic H */
 4208|       |
 4209|   112k|        if (0 >( iat_numb = get_iat_number( at->el_number, el_num, IAT_MAX ) ))
  ------------------
  |  Branch (4209:13): [True: 110k, False: 1.93k]
  ------------------
 4210|   110k|        {
 4211|   110k|            continue;
 4212|   110k|        }
 4213|       |
 4214|  1.93k|        if (abs( at->charge ) > 1 || at->radical && RADICAL_SINGLET != at->radical)
  ------------------
  |  |  103|      0|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (4214:13): [True: 6, False: 1.93k]
  |  Branch (4214:38): [True: 0, False: 1.93k]
  |  Branch (4214:53): [True: 0, False: 0]
  ------------------
 4215|      6|        {
 4216|      6|            continue;
 4217|      6|        }
 4218|       |
 4219|  1.93k|        val = -1;
 4220|  1.93k|        switch (iat_numb)
  ------------------
  |  Branch (4220:17): [True: 58, False: 1.87k]
  ------------------
 4221|  1.93k|        {
 4222|    528|            case IAT_N:
  ------------------
  |  Branch (4222:13): [True: 528, False: 1.40k]
  ------------------
 4223|    585|            case IAT_P:
  ------------------
  |  Branch (4223:13): [True: 57, False: 1.87k]
  ------------------
 4224|    585|                is_N = 1;
 4225|    585|                val = 3 + at->charge;
 4226|    585|                break;
 4227|       |
 4228|     60|            case IAT_O:
  ------------------
  |  Branch (4228:13): [True: 60, False: 1.87k]
  ------------------
 4229|    255|            case IAT_S:
  ------------------
  |  Branch (4229:13): [True: 195, False: 1.73k]
  ------------------
 4230|    255|            case IAT_Se:
  ------------------
  |  Branch (4230:13): [True: 0, False: 1.93k]
  ------------------
 4231|    255|            case IAT_Te:
  ------------------
  |  Branch (4231:13): [True: 0, False: 1.93k]
  ------------------
 4232|    255|                is_O = 1;
 4233|    255|                val = 2 + at->charge;
 4234|    255|                break;
 4235|       |
 4236|    313|            case IAT_F:
  ------------------
  |  Branch (4236:13): [True: 313, False: 1.62k]
  ------------------
 4237|    313|            case IAT_Cl:
  ------------------
  |  Branch (4237:13): [True: 0, False: 1.93k]
  ------------------
 4238|    313|            case IAT_Br:
  ------------------
  |  Branch (4238:13): [True: 0, False: 1.93k]
  ------------------
 4239|  1.03k|            case IAT_I:
  ------------------
  |  Branch (4239:13): [True: 721, False: 1.21k]
  ------------------
 4240|  1.03k|                if (at->charge == 0)
  ------------------
  |  Branch (4240:21): [True: 1.03k, False: 0]
  ------------------
 4241|  1.03k|                {
 4242|  1.03k|                    is_Cl = 1; /* isolated HCl */
 4243|  1.03k|                    val = 1;
 4244|  1.03k|                }
 4245|  1.03k|                break;
 4246|       |
 4247|      1|            case IAT_H:
  ------------------
  |  Branch (4247:13): [True: 1, False: 1.93k]
  ------------------
 4248|      1|                if (at->valence == 0 &&
  ------------------
  |  Branch (4248:21): [True: 1, False: 0]
  ------------------
 4249|      1|                     at->charge == 1)
  ------------------
  |  Branch (4249:22): [True: 1, False: 0]
  ------------------
 4250|      1|                {
 4251|      1|                    is_H = 1; /* isolated proton */
 4252|      1|                    val = 0;
 4253|      1|                }
 4254|  1.93k|        }
 4255|  1.93k|        if (val < 0)
  ------------------
  |  Branch (4255:13): [True: 58, False: 1.87k]
  ------------------
 4256|     58|        {
 4257|     58|            continue;
 4258|     58|        }
 4259|       |
 4260|  1.87k|        num_H = NUMH( at, 0 );
  ------------------
  |  |   88|  1.87k|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|  1.87k|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
 4261|  1.87k|        if (val != at->chem_bonds_valence + num_H)
  ------------------
  |  Branch (4261:13): [True: 1.83k, False: 45]
  ------------------
 4262|  1.83k|        {
 4263|  1.83k|            continue;
 4264|  1.83k|        }
 4265|       |
 4266|     45|        if (is_H)
  ------------------
  |  Branch (4266:13): [True: 1, False: 44]
  ------------------
 4267|      1|        {
 4268|      1|            bAccept = 1;
 4269|      1|            cur_num_iso_H = ( at->iso_atw_diff != 0 );
 4270|      1|        }
 4271|     44|        else
 4272|     44|        {
 4273|     44|            cur_num_iso_H = 0;
 4274|     54|            for (j = 0, bAccept = 1; j < at->valence && bAccept; j++)
  ------------------
  |  Branch (4274:38): [True: 20, False: 34]
  |  Branch (4274:57): [True: 20, False: 0]
  ------------------
 4275|     20|            {
 4276|     20|                at2 = atom + (int) at->neighbor[j];
 4277|     20|                if (at2->charge && at->charge ||
  ------------------
  |  Branch (4277:21): [True: 16, False: 4]
  |  Branch (4277:36): [True: 8, False: 8]
  ------------------
 4278|     20|                    ( at2->radical && RADICAL_SINGLET != at2->radical ))
  ------------------
  |  |  103|      2|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (4278:23): [True: 2, False: 10]
  |  Branch (4278:39): [True: 2, False: 0]
  ------------------
 4279|     10|                {
 4280|     10|                    bAccept = 0; /* adjacent charged/radical atoms: do not neutralizate */
 4281|     10|                    break;
 4282|     10|                }
 4283|     10|                else if (at2->el_number == el_num[IAT_H] &&
  ------------------
  |  Branch (4283:26): [True: 0, False: 10]
  ------------------
 4284|     10|                          at2->valence == 1 && at2->iso_atw_diff)
  ------------------
  |  Branch (4284:27): [True: 0, False: 0]
  |  Branch (4284:48): [True: 0, False: 0]
  ------------------
 4285|      0|                {
 4286|      0|                    cur_num_iso_H++; /* isotopic explicit H */
 4287|      0|                }
 4288|     20|            }
 4289|       |
 4290|     44|            if (bAccept)
  ------------------
  |  Branch (4290:17): [True: 34, False: 10]
  ------------------
 4291|     34|            {
 4292|     34|                num_iso_atoms -= cur_num_iso_H;  /* avoid counting explicit H as isotopic atom */
 4293|     34|                cur_num_iso_H += NUM_ISO_H( at, 0 );
  ------------------
  |  |   87|     34|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  ------------------
 4294|     34|            }
 4295|     44|        }
 4296|       |
 4297|     45|        num_iso_H += ( bAccept && cur_num_iso_H ); /* number of acceptable heteroatoms that have isotopic H */
  ------------------
  |  Branch (4297:24): [True: 35, False: 10]
  |  Branch (4297:35): [True: 28, False: 7]
  ------------------
 4298|     45|    }
 4299|       |
 4300|   110k|    return
 4301|   110k|        ( ( num_iso_H ? 1 : 0 ) | ( num_iso_atoms ? 2 : 0 ) );
  ------------------
  |  Branch (4301:13): [True: 3, False: 110k]
  |  Branch (4301:37): [True: 45, False: 109k]
  ------------------
 4302|   110k|}
MarkDisconnectedComponents:
 4341|  54.6k|{
 4342|  54.6k|    typedef AT_NUMB AT_TRIPLE[3];
 4343|       |
 4344|  54.6k|    inp_ATOM    *at = orig_at_data->at;
 4345|  54.6k|    int         num_at = orig_at_data->num_inp_atoms;
 4346|  54.6k|    AT_NUMB     *nCurAtLen = NULL;
 4347|       |
 4348|  54.6k|    AT_NUMB *nNewCompNumber = NULL;
 4349|  54.6k|    AT_NUMB *nPrevAtom = NULL;
 4350|  54.6k|    S_CHAR  *iNeigh = NULL;
 4351|       |
 4352|  54.6k|    AT_NUMB *nOldCompNumber = NULL;
 4353|  54.6k|    int i, j, num_components, ret;
 4354|  54.6k|    int new_comp_no;
 4355|  54.6k|    AT_NUMB old_comp_no, another_comp_no, no_component;
 4356|       |
 4357|       |    /* component_nbr[i][0] = number of atoms in the component i-1
 4358|       |    * component_nbr[i][1] = original component number (id-1) = i
 4359|       |    * after sorting:
 4360|       |    * component_nbr[j][2] = new number of component #(component_nbr[i][1]+1)
 4361|       |    */
 4362|  54.6k|    AT_TRIPLE *component_nbr = NULL;
 4363|       |
 4364|       |    /* initialize */
 4365|  54.6k|    if (bProcessOldCompNumbers && !orig_at_data->nOldCompNumber)
  ------------------
  |  Branch (4365:9): [True: 0, False: 54.6k]
  |  Branch (4365:35): [True: 0, False: 0]
  ------------------
 4366|      0|    {
 4367|      0|        bProcessOldCompNumbers = 0;
 4368|      0|    }
 4369|  54.6k|    num_components = 0;
 4370|       |
 4371|       |    /*
 4372|       |    for ( j = 0; j < num_at; j ++ )
 4373|       |    {
 4374|       |    at[j].component = 0;
 4375|       |    }
 4376|       |    */
 4377|       |
 4378|  54.6k|    ret = -1;
 4379|  54.6k|    if (!num_at)
  ------------------
  |  Branch (4379:9): [True: 0, False: 54.6k]
  ------------------
 4380|      0|    {
 4381|      0|        return 0;
 4382|      0|    }
 4383|       |
 4384|  54.6k|    if (!( nNewCompNumber = (AT_NUMB *) inchi_calloc( num_at, sizeof( nNewCompNumber[0] ) ) ) ||
  ------------------
  |  | 1133|  54.6k|#define inchi_calloc   calloc
  ------------------
  |  Branch (4384:9): [True: 0, False: 54.6k]
  ------------------
 4385|       |         /* for non-recursive DFS only: */
 4386|  54.6k|         !( nPrevAtom = (AT_NUMB *) inchi_calloc( num_at, sizeof( nPrevAtom[0] ) ) ) ||
  ------------------
  |  | 1133|  54.6k|#define inchi_calloc   calloc
  ------------------
  |  Branch (4386:10): [True: 0, False: 54.6k]
  ------------------
 4387|  54.6k|         !( iNeigh = (S_CHAR  *) inchi_calloc( num_at, sizeof( iNeigh[0] ) ) ))
  ------------------
  |  | 1133|  54.6k|#define inchi_calloc   calloc
  ------------------
  |  Branch (4387:10): [True: 0, False: 54.6k]
  ------------------
 4388|      0|    {
 4389|      0|        goto exit_function;
 4390|      0|    }
 4391|       |
 4392|       |    /* Mark and count; avoid deep DFS recursion: it may make verifying software unhappy */
 4393|       |    /* nNewCompNumber[i] will contain new component number for atoms at[i], i=0..num_at-1 */
 4394|   109k|    for (j = 0; j < num_at; j++)
  ------------------
  |  Branch (4394:17): [True: 54.6k, False: 54.6k]
  ------------------
 4395|  54.6k|    {
 4396|  54.6k|        if (!nNewCompNumber[j])
  ------------------
  |  Branch (4396:13): [True: 54.6k, False: 12]
  ------------------
 4397|  54.6k|        {
 4398|       |            /* mark starting with at[j] */
 4399|  54.6k|            int fst_at, nxt_at, cur_at = j;
 4400|  54.6k|            num_components++;
 4401|       |
 4402|       |            /* first time at at[j] */
 4403|  54.6k|            nNewCompNumber[fst_at = cur_at] = (AT_NUMB) num_components;
 4404|       |
 4405|       |            /* find next neighbor */
 4406|  54.6k|            while (1)
  ------------------
  |  Branch (4406:20): [Folded - Ignored]
  ------------------
 4407|  54.6k|            {
 4408|       |
 4409|  54.6k|                if (iNeigh[cur_at] < at[cur_at].valence)
  ------------------
  |  Branch (4409:21): [True: 24, False: 54.6k]
  ------------------
 4410|     24|                {
 4411|     24|                    nxt_at = at[cur_at].neighbor[(int) iNeigh[cur_at] ++];
 4412|       |
 4413|     24|                    if (!nNewCompNumber[nxt_at])
  ------------------
  |  Branch (4413:25): [True: 12, False: 12]
  ------------------
 4414|     12|                    {
 4415|       |                        /* forward edge: found new atom */
 4416|     12|                        nNewCompNumber[nxt_at] = (AT_NUMB) num_components;
 4417|     12|                        nPrevAtom[nxt_at] = (AT_NUMB) cur_at;
 4418|     12|                        cur_at = nxt_at;
 4419|     12|                    }
 4420|     24|                }
 4421|  54.6k|                else if (cur_at == fst_at)
  ------------------
  |  Branch (4421:26): [True: 54.6k, False: 12]
  ------------------
 4422|  54.6k|                {
 4423|  54.6k|                    break; /* done */
 4424|  54.6k|                }
 4425|     12|                else
 4426|     12|                {
 4427|     12|                    cur_at = nPrevAtom[cur_at]; /* retract */
 4428|     12|                }
 4429|  54.6k|            }
 4430|  54.6k|        }
 4431|  54.6k|    }
 4432|       |
 4433|  54.6k|    inchi_free( nPrevAtom );
  ------------------
  |  | 1136|  54.6k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 54.6k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4434|  54.6k|    nPrevAtom = NULL;
 4435|  54.6k|    inchi_free( iNeigh );
  ------------------
  |  | 1136|  54.6k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 54.6k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4436|  54.6k|    iNeigh = NULL;
 4437|       |
 4438|       |    /* Allocate more memory */
 4439|  54.6k|    i = inchi_max( num_components, orig_at_data->num_components );
  ------------------
  |  |  166|  54.6k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 54.6k, False: 0]
  |  |  ------------------
  ------------------
 4440|       |
 4441|  54.6k|    if (!( nCurAtLen = (AT_NUMB *)
  ------------------
  |  Branch (4441:9): [True: 0, False: 54.6k]
  ------------------
 4442|  54.6k|           inchi_calloc( num_components + 1, sizeof( nCurAtLen[0] ) ) ) ||
  ------------------
  |  | 1133|  54.6k|#define inchi_calloc   calloc
  ------------------
 4443|  54.6k|         !( nOldCompNumber = (AT_NUMB *)
  ------------------
  |  Branch (4443:10): [True: 0, False: 54.6k]
  ------------------
 4444|  54.6k|            inchi_calloc( i + 1, sizeof( nOldCompNumber[0] ) ) ) ||
  ------------------
  |  | 1133|  54.6k|#define inchi_calloc   calloc
  ------------------
 4445|  54.6k|         !( component_nbr = (AT_TRIPLE *)
  ------------------
  |  Branch (4445:10): [True: 0, False: 54.6k]
  ------------------
 4446|  54.6k|            inchi_calloc( num_components + 1, sizeof( component_nbr[0] ) ) ))
  ------------------
  |  | 1133|  54.6k|#define inchi_calloc   calloc
  ------------------
 4447|      0|    {
 4448|      0|        goto exit_function;
 4449|      0|    }
 4450|       |
 4451|       |    /* Count atoms per component and renumber the components */
 4452|   109k|    for (i = 0; i < num_components; i++)
  ------------------
  |  Branch (4452:17): [True: 54.6k, False: 54.6k]
  ------------------
 4453|  54.6k|    {
 4454|  54.6k|        component_nbr[i][0] = 0; /* number of atoms in the component */
 4455|  54.6k|        component_nbr[i][1] = i; /* component ordering number */
 4456|  54.6k|    }
 4457|       |
 4458|   109k|    for (j = 0; j < num_at; j++)
  ------------------
  |  Branch (4458:17): [True: 54.6k, False: 54.6k]
  ------------------
 4459|  54.6k|    {
 4460|  54.6k|        component_nbr[(int) nNewCompNumber[j] - 1][0] ++; /* count atoms in each component */
 4461|  54.6k|    }
 4462|       |
 4463|       |    /* Sort settings
 4464|       |    key: number of atoms
 4465|       |    order: descending
 4466|       |    stable sort
 4467|       |    */
 4468|       |
 4469|  54.6k|    qsort( (void*) component_nbr[0],
 4470|  54.6k|           num_components,
 4471|  54.6k|           sizeof( component_nbr[0] ),
 4472|  54.6k|           cmp_components );
 4473|       |
 4474|       |    /* Invert the transposition */
 4475|   109k|    for (i = 0; i < num_components; i++)
  ------------------
  |  Branch (4475:17): [True: 54.6k, False: 54.6k]
  ------------------
 4476|  54.6k|    {
 4477|  54.6k|        nCurAtLen[i] = component_nbr[i][0];
 4478|  54.6k|        component_nbr[component_nbr[i][1]][2] = i + 1;
 4479|  54.6k|    }
 4480|       |
 4481|       |    /* Renumber the components so that the component with the greatest number of atoms is the first */
 4482|  54.6k|    no_component = num_at + 1;
 4483|       |
 4484|   109k|    for (j = 0; j < num_at; j++)
  ------------------
  |  Branch (4484:17): [True: 54.6k, False: 54.6k]
  ------------------
 4485|  54.6k|    {
 4486|       |        /* new component number for at[j] */
 4487|  54.6k|        new_comp_no = component_nbr[(int) nNewCompNumber[j] - 1][2] - 1; /* starts from 0 */
 4488|  54.6k|        if (bProcessOldCompNumbers)
  ------------------
  |  Branch (4488:13): [True: 0, False: 54.6k]
  ------------------
 4489|      0|        {
 4490|       |            /* old component number for at[j] */
 4491|      0|            old_comp_no = at[j].component;
 4492|       |            /* fill out nOldCompNumber[]; initially it contains zeroes */
 4493|      0|            if (!old_comp_no)
  ------------------
  |  Branch (4493:17): [True: 0, False: 0]
  ------------------
 4494|      0|            {
 4495|      0|                nOldCompNumber[new_comp_no] = no_component; /* atom did not have component number */
 4496|      0|            }
 4497|      0|            else if (nOldCompNumber[new_comp_no] != old_comp_no)
  ------------------
  |  Branch (4497:22): [True: 0, False: 0]
  ------------------
 4498|      0|            {
 4499|      0|                if (!nOldCompNumber[new_comp_no])
  ------------------
  |  Branch (4499:21): [True: 0, False: 0]
  ------------------
 4500|      0|                {
 4501|      0|                    nOldCompNumber[new_comp_no] = old_comp_no;
 4502|      0|                }
 4503|      0|                else
 4504|      0|                {
 4505|       |                    /* at[j] moved from old comp #old_comp_no to old comp #nOldCompNumber[new_comp_no]
 4506|       |                    Both components cannot be equal to any current component */
 4507|      0|                    another_comp_no = nOldCompNumber[new_comp_no];
 4508|      0|                    for (i = 0; i < num_components; i++)
  ------------------
  |  Branch (4508:33): [True: 0, False: 0]
  ------------------
 4509|      0|                    {
 4510|      0|                        if (nOldCompNumber[i] == old_comp_no ||
  ------------------
  |  Branch (4510:29): [True: 0, False: 0]
  ------------------
 4511|      0|                             nOldCompNumber[i] == another_comp_no)
  ------------------
  |  Branch (4511:30): [True: 0, False: 0]
  ------------------
 4512|      0|                        {
 4513|      0|                            nOldCompNumber[i] = no_component;
 4514|      0|                        }
 4515|      0|                    }
 4516|       |                    /* nOldCompNumber[new_comp_no] = num_at+1; */
 4517|      0|                }
 4518|      0|            }
 4519|      0|        }
 4520|       |
 4521|       |        /* orig_at_data->nOldCompNumber */
 4522|       |
 4523|       |        /* Finally, set the new component number for atom j (NB: starts from 1 ) */
 4524|  54.6k|        at[j].component = new_comp_no + 1;
 4525|  54.6k|    }
 4526|       |
 4527|  54.6k|    if (bProcessOldCompNumbers)
  ------------------
  |  Branch (4527:9): [True: 0, False: 54.6k]
  ------------------
 4528|      0|    {
 4529|      0|        for (j = 0; j < num_components; j++)
  ------------------
  |  Branch (4529:21): [True: 0, False: 0]
  ------------------
 4530|      0|        {
 4531|      0|            if (nOldCompNumber[j] == no_component)
  ------------------
  |  Branch (4531:17): [True: 0, False: 0]
  ------------------
 4532|      0|            {
 4533|       |                /* the component has atom from another component */
 4534|      0|                nOldCompNumber[j] = 0;
 4535|      0|            }
 4536|      0|            else if (nOldCompNumber[j] &&
  ------------------
  |  Branch (4536:22): [True: 0, False: 0]
  ------------------
 4537|      0|                      !orig_at_data->nOldCompNumber[nOldCompNumber[j] - 1])
  ------------------
  |  Branch (4537:23): [True: 0, False: 0]
  ------------------
 4538|      0|            {
 4539|       |                /* the component has changed in the previous processing  */
 4540|      0|                nOldCompNumber[j] = 0;
 4541|      0|            }
 4542|      0|        }
 4543|      0|    }
 4544|  54.6k|    else
 4545|  54.6k|    {
 4546|   109k|        for (j = 0; j < num_components; j++)
  ------------------
  |  Branch (4546:21): [True: 54.6k, False: 54.6k]
  ------------------
 4547|  54.6k|        {
 4548|  54.6k|            nOldCompNumber[j] = j + 1;
 4549|  54.6k|        }
 4550|  54.6k|    }
 4551|       |
 4552|  54.6k|    ret = num_components;
 4553|       |
 4554|  54.6k|exit_function:
 4555|       |
 4556|  54.6k|    if (nNewCompNumber)
  ------------------
  |  Branch (4556:9): [True: 54.6k, False: 0]
  ------------------
 4557|  54.6k|    {
 4558|  54.6k|        inchi_free( nNewCompNumber );
  ------------------
  |  | 1136|  54.6k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 54.6k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4559|  54.6k|    }
 4560|  54.6k|    if (component_nbr)
  ------------------
  |  Branch (4560:9): [True: 54.6k, False: 0]
  ------------------
 4561|  54.6k|    {
 4562|  54.6k|        inchi_free( component_nbr );
  ------------------
  |  | 1136|  54.6k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 54.6k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4563|  54.6k|    }
 4564|       |
 4565|  54.6k|    if (ret < 0)
  ------------------
  |  Branch (4565:9): [True: 0, False: 54.6k]
  ------------------
 4566|      0|    {
 4567|      0|        if (nPrevAtom)
  ------------------
  |  Branch (4567:13): [True: 0, False: 0]
  ------------------
 4568|      0|        {
 4569|      0|            inchi_free( nPrevAtom );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4570|      0|            nPrevAtom = NULL;
 4571|      0|        }
 4572|      0|        if (iNeigh)
  ------------------
  |  Branch (4572:13): [True: 0, False: 0]
  ------------------
 4573|      0|        {
 4574|      0|            inchi_free( iNeigh );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4575|      0|            iNeigh = NULL;
 4576|      0|        }
 4577|      0|        if (nCurAtLen)
  ------------------
  |  Branch (4577:13): [True: 0, False: 0]
  ------------------
 4578|      0|        {
 4579|      0|            inchi_free( nCurAtLen );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4580|      0|            nCurAtLen = NULL;
 4581|      0|        }
 4582|      0|        if (nOldCompNumber)
  ------------------
  |  Branch (4582:13): [True: 0, False: 0]
  ------------------
 4583|      0|        {
 4584|      0|            inchi_free( nOldCompNumber );
  ------------------
  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4585|      0|            nOldCompNumber = NULL;
 4586|      0|        }
 4587|      0|        num_components = ret;
 4588|      0|    }
 4589|       |
 4590|       |    /* avoid memory leaks */
 4591|  54.6k|    if (orig_at_data->nCurAtLen)
  ------------------
  |  Branch (4591:9): [True: 54.6k, False: 0]
  ------------------
 4592|  54.6k|    {
 4593|  54.6k|        inchi_free( orig_at_data->nCurAtLen );
  ------------------
  |  | 1136|  54.6k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 54.6k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4594|  54.6k|    }
 4595|  54.6k|    if (orig_at_data->nOldCompNumber)
  ------------------
  |  Branch (4595:9): [True: 54.6k, False: 0]
  ------------------
 4596|  54.6k|    {
 4597|  54.6k|        inchi_free( orig_at_data->nOldCompNumber );
  ------------------
  |  | 1136|  54.6k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 54.6k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4598|  54.6k|    }
 4599|       |
 4600|  54.6k|    orig_at_data->nCurAtLen = nCurAtLen;
 4601|  54.6k|    orig_at_data->nOldCompNumber = nOldCompNumber;
 4602|       |
 4603|  54.6k|    orig_at_data->num_components = num_components;
 4604|       |
 4605|  54.6k|    return
 4606|  54.6k|        ret;  /* number of disconnected components;
 4607|       |              1=>single connected structure        */
 4608|  54.6k|}
ExtractConnectedComponent:
 4618|  54.6k|{
 4619|  54.6k|    int i, j, num_component_at;
 4620|  54.6k|    AT_NUMB *number;
 4621|       |
 4622|  54.6k|    if (NULL == ( number = (AT_NUMB*) inchi_calloc( num_at, sizeof( AT_NUMB ) ) ))
  ------------------
  |  | 1133|  54.6k|#define inchi_calloc   calloc
  ------------------
  |  Branch (4622:9): [True: 0, False: 54.6k]
  ------------------
 4623|      0|    {
 4624|      0|        return CT_OUT_OF_RAM; /* out of memory */  /*   <BRKPT> */
  ------------------
  |  |   49|      0|#define CT_OUT_OF_RAM        (CT_ERR_FIRST- 2)  /*(-30002) */
  |  |  ------------------
  |  |  |  |   46|      0|#define CT_ERR_FIRST         (-30000)
  |  |  ------------------
  ------------------
 4625|      0|    }
 4626|       |
 4627|       |    /* copy atoms */
 4628|   109k|    for (i = 0, num_component_at = 0; i < num_at; i++)
  ------------------
  |  Branch (4628:39): [True: 54.6k, False: 54.6k]
  ------------------
 4629|  54.6k|    {
 4630|  54.6k|        if (at[i].component == component_number)
  ------------------
  |  Branch (4630:13): [True: 54.6k, False: 0]
  ------------------
 4631|  54.6k|        {
 4632|  54.6k|            number[i] = num_component_at;
 4633|  54.6k|            component_at[num_component_at++] = at[i];
 4634|  54.6k|        }
 4635|  54.6k|    }
 4636|       |
 4637|       |    /* renumber neighbors */
 4638|   109k|    for (i = 0; i < num_component_at; i++)
  ------------------
  |  Branch (4638:17): [True: 54.6k, False: 54.6k]
  ------------------
 4639|  54.6k|    {
 4640|  54.6k|        component_at[i].orig_compt_at_numb = (AT_NUMB) ( i + 1 );
 4641|  54.6k|        for (j = 0; j < component_at[i].valence; j++)
  ------------------
  |  Branch (4641:21): [True: 24, False: 54.6k]
  ------------------
 4642|     24|        {
 4643|     24|            component_at[i].neighbor[j] = number[(int) component_at[i].neighbor[j]];
 4644|     24|        }
 4645|  54.6k|    }
 4646|       |
 4647|  54.6k|    inchi_free( number );
  ------------------
  |  | 1136|  54.6k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 54.6k, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4648|       |
 4649|  54.6k|    return num_component_at;
 4650|  54.6k|}
SetConnectedComponentNumber:
 4655|   110k|{
 4656|   110k|    int i;
 4657|   222k|    for (i = 0; i < num_at; i++)
  ------------------
  |  Branch (4657:17): [True: 112k, False: 110k]
  ------------------
 4658|   112k|    {
 4659|   112k|        at[i].component = (AT_NUMB) component_number;
 4660|   112k|    }
 4661|       |
 4662|   110k|    return 0;
 4663|   110k|}
Free_INChI_Stereo:
 4668|  1.01M|{
 4669|  1.01M|    if (pINChI_Stereo)
  ------------------
  |  Branch (4669:9): [True: 333k, False: 681k]
  ------------------
 4670|   333k|    {
 4671|   333k|        qzfree( pINChI_Stereo->nNumber );
  ------------------
  |  | 1160|   333k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|   333k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 333k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 333k, False: 26]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4672|   333k|        qzfree( pINChI_Stereo->t_parity );
  ------------------
  |  | 1160|   333k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|   333k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 333k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 333k, False: 26]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4673|   333k|        qzfree( pINChI_Stereo->nNumberInv );
  ------------------
  |  | 1160|   333k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|   220k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 220k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 220k, False: 113k]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4674|   333k|        qzfree( pINChI_Stereo->t_parityInv );
  ------------------
  |  | 1160|   333k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|   220k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 220k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 220k, False: 113k]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4675|   333k|        qzfree( pINChI_Stereo->nBondAtom1 );
  ------------------
  |  | 1160|   333k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|     46|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 46, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 46, False: 333k]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4676|   333k|        qzfree( pINChI_Stereo->nBondAtom2 );
  ------------------
  |  | 1160|   333k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|     46|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 46, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 46, False: 333k]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4677|   333k|        qzfree( pINChI_Stereo->b_parity );
  ------------------
  |  | 1160|   333k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|     46|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 46, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 46, False: 333k]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4678|   333k|    }
 4679|       |
 4680|  1.01M|    return 0;
 4681|  1.01M|}
Alloc_INChI_Stereo:
 4686|   220k|{
 4687|       |
 4688|   220k|    INChI_Stereo *pINChI_Stereo = (INChI_Stereo *)
 4689|   220k|        inchi_calloc( 1, sizeof( INChI_Stereo ) );
  ------------------
  |  | 1133|   220k|#define inchi_calloc   calloc
  ------------------
 4690|       |
 4691|   220k|    if (pINChI_Stereo)
  ------------------
  |  Branch (4691:9): [True: 220k, False: 0]
  ------------------
 4692|   220k|    {
 4693|   220k|        if (num_at &&
  ------------------
  |  Branch (4693:13): [True: 220k, False: 0]
  ------------------
 4694|   220k|            ( pINChI_Stereo->nNumber = (AT_NUMB *) inchi_calloc( num_at, sizeof( pINChI_Stereo->nNumber[0] ) ) ) &&
  ------------------
  |  | 1133|   220k|#define inchi_calloc   calloc
  ------------------
  |  Branch (4694:13): [True: 220k, False: 0]
  ------------------
 4695|   220k|             ( pINChI_Stereo->t_parity = (S_CHAR  *) inchi_calloc( num_at, sizeof( pINChI_Stereo->t_parity[0] ) ) ) &&
  ------------------
  |  | 1133|   220k|#define inchi_calloc   calloc
  ------------------
  |  Branch (4695:14): [True: 220k, False: 0]
  ------------------
 4696|   220k|             ( pINChI_Stereo->nNumberInv = (AT_NUMB *) inchi_calloc( num_at, sizeof( pINChI_Stereo->nNumberInv[0] ) ) ) &&
  ------------------
  |  | 1133|   220k|#define inchi_calloc   calloc
  ------------------
  |  Branch (4696:14): [True: 220k, False: 0]
  ------------------
 4697|   220k|             ( pINChI_Stereo->t_parityInv = (S_CHAR  *) inchi_calloc( num_at, sizeof( pINChI_Stereo->t_parityInv[0] ) ) ))
  ------------------
  |  | 1133|   220k|#define inchi_calloc   calloc
  ------------------
  |  Branch (4697:14): [True: 220k, False: 0]
  ------------------
 4698|   220k|        {
 4699|   220k|            ;
 4700|   220k|        }
 4701|      0|        else if (num_at)
  ------------------
  |  Branch (4701:18): [True: 0, False: 0]
  ------------------
 4702|      0|        {
 4703|      0|            goto out_of_RAM;
 4704|      0|        }
 4705|       |
 4706|   220k|        if (num_bonds &&
  ------------------
  |  Branch (4706:13): [True: 20, False: 220k]
  ------------------
 4707|   220k|            ( pINChI_Stereo->nBondAtom1 = (AT_NUMB *) inchi_calloc( num_bonds, sizeof( pINChI_Stereo->nBondAtom1[0] ) ) ) &&
  ------------------
  |  | 1133|     20|#define inchi_calloc   calloc
  ------------------
  |  Branch (4707:13): [True: 20, False: 0]
  ------------------
 4708|   220k|             ( pINChI_Stereo->nBondAtom2 = (AT_NUMB *) inchi_calloc( num_bonds, sizeof( pINChI_Stereo->nBondAtom2[0] ) ) ) &&
  ------------------
  |  | 1133|     20|#define inchi_calloc   calloc
  ------------------
  |  Branch (4708:14): [True: 20, False: 0]
  ------------------
 4709|   220k|             ( pINChI_Stereo->b_parity = (S_CHAR  *) inchi_calloc( num_bonds, sizeof( pINChI_Stereo->b_parity[0] ) ) ))
  ------------------
  |  | 1133|     20|#define inchi_calloc   calloc
  ------------------
  |  Branch (4709:14): [True: 20, False: 0]
  ------------------
 4710|     20|        {
 4711|     20|            ;
 4712|     20|        }
 4713|   220k|        else if (num_bonds)
  ------------------
  |  Branch (4713:18): [True: 0, False: 220k]
  ------------------
 4714|      0|        {
 4715|      0|            goto out_of_RAM;
 4716|      0|        }
 4717|       |
 4718|   220k|        return pINChI_Stereo;
 4719|       |
 4720|      0|    out_of_RAM:
 4721|       |
 4722|      0|        Free_INChI_Stereo( pINChI_Stereo );
 4723|      0|        qzfree( pINChI_Stereo );
  ------------------
  |  | 1160|      0|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 0, False: 0]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4724|      0|    } /* if ( pINChI_Stereo )  */
 4725|       |
 4726|      0|    return NULL;
 4727|   220k|}
Free_INChI:
 4732|   444k|{
 4733|       |
 4734|   444k|    INChI *pINChI;
 4735|       |
 4736|   444k|    if (pINChI = *ppINChI)
  ------------------
  |  Branch (4736:9): [True: 111k, False: 332k]
  ------------------
 4737|   111k|    {
 4738|       |
 4739|   111k|#if ( bREUSE_INCHI == 1 )
 4740|   111k|        if (pINChI->nRefCount-- > 0)
  ------------------
  |  Branch (4740:13): [True: 0, False: 111k]
  ------------------
 4741|      0|            return 1;
 4742|   111k|#endif
 4743|       |
 4744|   111k|        Free_INChI_Members( pINChI );
 4745|   111k|        qzfree( pINChI );
  ------------------
  |  | 1160|   111k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|   111k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 111k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 111k, False: 0]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4746|   111k|        *ppINChI = NULL;
 4747|   111k|    }
 4748|       |
 4749|   444k|    return 0;
 4750|   444k|}
Free_INChI_Members:
 4755|   507k|{
 4756|   507k|    if (pINChI)
  ------------------
  |  Branch (4756:9): [True: 507k, False: 0]
  ------------------
 4757|   507k|    {
 4758|   507k|        Free_INChI_Stereo( pINChI->Stereo );
 4759|   507k|        Free_INChI_Stereo( pINChI->StereoIsotopic );
 4760|   507k|        qzfree( pINChI->nAtom );
  ------------------
  |  | 1160|   507k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|   448k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 448k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 448k, False: 59.3k]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4761|   507k|        qzfree( pINChI->nConnTable );
  ------------------
  |  | 1160|   507k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|   425k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 425k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 425k, False: 82.3k]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4762|   507k|        qzfree( pINChI->nTautomer );
  ------------------
  |  | 1160|   507k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 110k, False: 397k]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4763|   507k|        qzfree( pINChI->nNum_H );
  ------------------
  |  | 1160|   507k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|   448k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 448k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 448k, False: 59.8k]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4764|   507k|        qzfree( pINChI->nNum_H_fixed );
  ------------------
  |  | 1160|   507k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|   111k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 111k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 111k, False: 396k]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4765|   507k|        qzfree( pINChI->IsotopicAtom );
  ------------------
  |  | 1160|   507k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|  93.7k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 93.7k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 93.7k, False: 414k]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4766|   507k|        qzfree( pINChI->IsotopicTGroup );
  ------------------
  |  | 1160|   507k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|     78|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 78, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 78, False: 507k]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4767|   507k|        qzfree( pINChI->nPossibleLocationsOfIsotopicH );
  ------------------
  |  | 1160|   507k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 110k, False: 397k]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4768|   507k|        qzfree( pINChI->Stereo );
  ------------------
  |  | 1160|   507k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|   130k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 130k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 130k, False: 377k]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4769|   507k|        qzfree( pINChI->StereoIsotopic );
  ------------------
  |  | 1160|   507k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|   203k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 203k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 203k, False: 304k]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4770|   507k|        qzfree( pINChI->szHillFormula );
  ------------------
  |  | 1160|   507k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|   448k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 448k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 448k, False: 59.3k]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4771|   507k|    }
 4772|       |
 4773|   507k|    return 0;
 4774|   507k|}
Alloc_INChI:
 4783|   110k|{
 4784|   110k|    int    i, num_bonds, num_isotopic_atoms;
 4785|   110k|    INChI  *pINChI;
 4786|   110k|    int    bIsotopic = ( nAllocMode & REQ_MODE_ISO );
  ------------------
  |  |   45|   110k|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
 4787|       |    /* int    bTautomeric = (nAllocMode & REQ_MODE_TAUT); */
 4788|       |
 4789|   110k|    if (num_at <= 0 ||
  ------------------
  |  Branch (4789:9): [True: 0, False: 110k]
  ------------------
 4790|   110k|         NULL == ( pINChI = (INChI *) inchi_calloc( 1, sizeof( INChI ) ) ))
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
  |  Branch (4790:10): [True: 0, False: 110k]
  ------------------
 4791|      0|    {
 4792|      0|        return NULL;
 4793|      0|    }
 4794|       |
 4795|   223k|    for (i = 0, num_bonds = 0, num_isotopic_atoms = 0; i < num_at; i++)
  ------------------
  |  Branch (4795:56): [True: 113k, False: 110k]
  ------------------
 4796|   113k|    {
 4797|   113k|        num_bonds += at[i].valence;
 4798|       |        /* if ( bIsotopic ) { */
 4799|   113k|        num_isotopic_atoms += ( 0 != at[i].iso_atw_diff ||
  ------------------
  |  Branch (4799:33): [True: 128, False: 113k]
  ------------------
 4800|   113k|                                !strcmp( at[i].elname, "D" ) ||
  ------------------
  |  Branch (4800:33): [True: 0, False: 113k]
  ------------------
 4801|   113k|                                !strcmp( at[i].elname, "T" ) ||
  ------------------
  |  Branch (4801:33): [True: 0, False: 113k]
  ------------------
 4802|   113k|                                at[i].num_iso_H[0] ||
  ------------------
  |  Branch (4802:33): [True: 1, False: 113k]
  ------------------
 4803|   113k|                                at[i].num_iso_H[1] ||
  ------------------
  |  Branch (4803:33): [True: 40, False: 112k]
  ------------------
 4804|   113k|                                at[i].num_iso_H[2] );
  ------------------
  |  Branch (4804:33): [True: 26, False: 112k]
  ------------------
 4805|       |        /* } */
 4806|   113k|    }
 4807|   110k|    num_bonds /= 2;
 4808|       |
 4809|   110k|    *found_num_bonds = num_bonds;
 4810|   110k|    *found_num_isotopic = num_isotopic_atoms;
 4811|       |
 4812|   110k|    if (( pINChI->nAtom = (U_CHAR*) inchi_calloc( num_at, sizeof( pINChI->nAtom[0] ) ) ) &&
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
  |  Branch (4812:9): [True: 110k, False: 0]
  ------------------
 4813|   110k|        ( pINChI->nConnTable = (AT_NUMB*) inchi_calloc( num_at + num_bonds, sizeof( pINChI->nConnTable[0] ) ) ) &&
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
  |  Branch (4813:9): [True: 110k, False: 0]
  ------------------
 4814|   110k|         ( pINChI->nTautomer = (AT_NUMB*) inchi_calloc( ( ( 3 + INCHI_T_NUM_MOVABLE )*num_at ) / 2 + 1, sizeof( pINChI->nTautomer[0] ) ) ) &&
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
                       ( pINChI->nTautomer = (AT_NUMB*) inchi_calloc( ( ( 3 + INCHI_T_NUM_MOVABLE )*num_at ) / 2 + 1, sizeof( pINChI->nTautomer[0] ) ) ) &&
  ------------------
  |  |  752|   110k|#define INCHI_T_NUM_MOVABLE  2
  ------------------
  |  Branch (4814:10): [True: 110k, False: 0]
  ------------------
 4815|   110k|         ( pINChI->nNum_H = (S_CHAR*) inchi_calloc( num_at, sizeof( pINChI->nNum_H[0] ) ) ) &&
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
  |  Branch (4815:10): [True: 110k, False: 0]
  ------------------
 4816|   110k|         ( pINChI->nNum_H_fixed = (S_CHAR*) inchi_calloc( num_at, sizeof( pINChI->nNum_H_fixed[0] ) ) ))
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
  |  Branch (4816:10): [True: 110k, False: 0]
  ------------------
 4817|   110k|    {
 4818|   110k|        ;
 4819|       |        /* nTautomer length: max. number of tautomeric groups is num_at/2
 4820|       |
 4821|       |        1 word                     -> number of t-groups
 4822|       |
 4823|       |        each group has:
 4824|       |
 4825|       |        1 word                     -> number of endpoints+INCHI_T_NUM_MOVABLE
 4826|       |        INCHI_T_NUM_MOVABLE words   -> number(s) of moveable attachments
 4827|       |        numbers of endpoints words -> canon. numbers
 4828|       |
 4829|       |        max. occurs if each t-group has 2 atoms (num_at/2 t-groups) and all atoms
 4830|       |        belong to t-groups (num_at endpoints)
 4831|       |
 4832|       |        Total: 1 + (number of t-groups)*(1+INCHI_T_NUM_MOVABLE) + (number of endpoints) <=
 4833|       |        1 + (num_at/2) * (1+INCHI_T_NUM_MOVABLE) + num_at <=
 4834|       |        1 + (3+INCHI_T_NUM_MOVABLE)*num_at/2 words.
 4835|       |        */
 4836|   110k|    }
 4837|      0|    else
 4838|      0|    {
 4839|      0|        goto out_of_RAM;
 4840|      0|    }
 4841|       |
 4842|   110k|    pINChI->szHillFormula = NULL; /*  the length is unknown */
 4843|       |
 4844|   110k|    if (bIsotopic)
  ------------------
  |  Branch (4844:9): [True: 110k, False: 5]
  ------------------
 4845|   110k|    {
 4846|   110k|        if (num_isotopic_atoms &&
  ------------------
  |  Branch (4846:13): [True: 78, False: 109k]
  ------------------
 4847|   110k|            ( pINChI->IsotopicAtom = (INChI_IsotopicAtom *) inchi_calloc( num_isotopic_atoms, sizeof( INChI_IsotopicAtom ) ) ) &&
  ------------------
  |  | 1133|     78|#define inchi_calloc   calloc
  ------------------
  |  Branch (4847:13): [True: 78, False: 0]
  ------------------
 4848|   110k|             ( pINChI->IsotopicTGroup = (INChI_IsotopicTGroup *) inchi_calloc( num_isotopic_atoms, sizeof( INChI_IsotopicTGroup ) ) ))
  ------------------
  |  | 1133|     78|#define inchi_calloc   calloc
  ------------------
  |  Branch (4848:14): [True: 78, False: 0]
  ------------------
 4849|     78|        {
 4850|     78|            ;
 4851|     78|        }
 4852|   109k|        else if (num_isotopic_atoms)
  ------------------
  |  Branch (4852:18): [True: 0, False: 109k]
  ------------------
 4853|      0|        {
 4854|      0|            goto out_of_RAM;
 4855|      0|        }
 4856|   110k|        if (!( pINChI->nPossibleLocationsOfIsotopicH = (AT_NUMB *) inchi_calloc( num_at + 1, sizeof( pINChI->nPossibleLocationsOfIsotopicH[0] ) ) ))
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
  |  Branch (4856:13): [True: 0, False: 110k]
  ------------------
 4857|      0|        {
 4858|      0|            goto out_of_RAM;
 4859|      0|        }
 4860|   110k|    }
 4861|       |
 4862|   110k|    if (( pINChI->Stereo = Alloc_INChI_Stereo( num_at, num_bonds ) ))
  ------------------
  |  Branch (4862:9): [True: 110k, False: 0]
  ------------------
 4863|   110k|    {
 4864|   110k|        ;
 4865|   110k|    }
 4866|      0|    else
 4867|      0|    {
 4868|      0|        goto out_of_RAM;
 4869|      0|    }
 4870|       |
 4871|   110k|    if (bIsotopic)
  ------------------
  |  Branch (4871:9): [True: 110k, False: 5]
  ------------------
 4872|   110k|    {
 4873|   110k|        if (( pINChI->StereoIsotopic = Alloc_INChI_Stereo( num_at, num_bonds ) ))
  ------------------
  |  Branch (4873:13): [True: 110k, False: 0]
  ------------------
 4874|   110k|        {
 4875|   110k|            ;
 4876|   110k|        }
 4877|      0|        else
 4878|      0|        {
 4879|      0|            goto out_of_RAM;
 4880|      0|        }
 4881|   110k|    }
 4882|       |
 4883|   110k|    return pINChI;
 4884|       |
 4885|      0|out_of_RAM:
 4886|      0|    if (pINChI)
  ------------------
  |  Branch (4886:9): [True: 0, False: 0]
  ------------------
 4887|      0|    {
 4888|      0|        Free_INChI( &pINChI );
 4889|       |        /*
 4890|       |        inchi_free(pINChI);
 4891|       |        */
 4892|      0|    }
 4893|       |
 4894|      0|    return NULL;
 4895|   110k|}
Free_INChI_Aux:
 4900|   444k|{
 4901|   444k|    INChI_Aux *pINChI_Aux = *ppINChI_Aux;
 4902|   444k|    if (pINChI_Aux)
  ------------------
  |  Branch (4902:9): [True: 111k, False: 332k]
  ------------------
 4903|   111k|    {
 4904|       |
 4905|   111k|#if ( bREUSE_INCHI == 1 )
 4906|   111k|        if (pINChI_Aux->nRefCount-- > 0)
  ------------------
  |  Branch (4906:13): [True: 0, False: 111k]
  ------------------
 4907|      0|            return 1;
 4908|   111k|#endif
 4909|       |
 4910|   111k|        qzfree( pINChI_Aux->nOrigAtNosInCanonOrd );
  ------------------
  |  | 1160|   111k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 110k, False: 1.21k]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4911|   111k|        qzfree( pINChI_Aux->nIsotopicOrigAtNosInCanonOrd );
  ------------------
  |  | 1160|   111k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 110k, False: 1.21k]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4912|   111k|        qzfree( pINChI_Aux->nOrigAtNosInCanonOrdInv );
  ------------------
  |  | 1160|   111k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 110k, False: 1.21k]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4913|   111k|        qzfree( pINChI_Aux->nIsotopicOrigAtNosInCanonOrdInv );
  ------------------
  |  | 1160|   111k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 110k, False: 1.21k]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4914|   111k|        qzfree( pINChI_Aux->szOrigCoord );
  ------------------
  |  | 1160|   111k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|      0|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 0, False: 111k]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4915|   111k|        qzfree( pINChI_Aux->OrigInfo );
  ------------------
  |  | 1160|   111k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 110k, False: 1.21k]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4916|       |        /*
 4917|       |        qzfree( pINChI_Aux->nOriginalAtomNumber          );
 4918|       |        qzfree( pINChI_Aux->nCanonicalTGroupNumbers      );
 4919|       |        qzfree( pINChI_Aux->nIsotopicCanonicalTGroupNumbers);
 4920|       |        qzfree( pINChI_Aux->nTautomer                    );
 4921|       |        qzfree( pINChI_Aux->nNontautomericCanonicalNumbers         );
 4922|       |        qzfree( pINChI_Aux->nIsotopicCanonicalNumbers    );
 4923|       |        qzfree( pINChI_Aux->nNontautomericIsotopicCanonicalNumbers );
 4924|       |        qzfree( pINChI_Aux->nNontautomericEquNumbers               );
 4925|       |        qzfree( pINChI_Aux->nNontautomericIsotopicEquNumbers       );
 4926|       |        */
 4927|   111k|        qzfree( pINChI_Aux->nConstitEquNumbers );
  ------------------
  |  | 1160|   111k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 110k, False: 1.21k]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4928|   111k|        qzfree( pINChI_Aux->nConstitEquTGroupNumbers );
  ------------------
  |  | 1160|   111k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|    811|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 811, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 811, False: 110k]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4929|   111k|        qzfree( pINChI_Aux->nConstitEquIsotopicNumbers );
  ------------------
  |  | 1160|   111k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 110k, False: 1.21k]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4930|   111k|        qzfree( pINChI_Aux->nConstitEquIsotopicTGroupNumbers );
  ------------------
  |  | 1160|   111k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|   110k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 110k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 110k, False: 1.21k]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4931|   111k|        qzfree( pINChI_Aux );
  ------------------
  |  | 1160|   111k|#define qzfree(X)   do{if(X){inchi_free(X);(X)=NULL;}}while(0)
  |  |  ------------------
  |  |  |  | 1136|   111k|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1136:31): [True: 111k, False: 0]
  |  |  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (1160:27): [True: 111k, False: 0]
  |  |  |  Branch (1160:61): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4932|   111k|        *ppINChI_Aux = NULL;
 4933|   111k|    }
 4934|       |
 4935|   444k|    return 0;
 4936|   444k|}
Alloc_INChI_Aux:
 4944|   110k|{
 4945|   110k|    INChI_Aux     *pINChI_Aux;
 4946|   110k|    int    bIsotopic = ( nAllocMode & REQ_MODE_ISO );
  ------------------
  |  |   45|   110k|#define REQ_MODE_ISO                0x000004    /* I    */
  ------------------
 4947|   110k|    int    num_at_tg = num_at + num_at / 2;
 4948|       |    /* int    bTautomeric = (nAllocMode & REQ_MODE_TAUT); */
 4949|       |
 4950|   110k|    if (num_at <= 0 ||
  ------------------
  |  Branch (4950:9): [True: 0, False: 110k]
  ------------------
 4951|   110k|         NULL == ( pINChI_Aux = (INChI_Aux *) inchi_calloc( sizeof( INChI_Aux ), 1 ) ))
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
  |  Branch (4951:10): [True: 0, False: 110k]
  ------------------
 4952|      0|    {
 4953|      0|        return NULL;
 4954|      0|    }
 4955|       |
 4956|   110k|    if (( pINChI_Aux->nOrigAtNosInCanonOrd = (AT_NUMB*)
  ------------------
  |  Branch (4956:9): [True: 110k, False: 0]
  ------------------
 4957|   110k|          inchi_calloc( sizeof( pINChI_Aux->nOrigAtNosInCanonOrd[0] ), num_at_tg ) ) &&
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
 4958|   110k|          ( pINChI_Aux->nOrigAtNosInCanonOrdInv = (AT_NUMB*)
  ------------------
  |  Branch (4958:11): [True: 110k, False: 0]
  ------------------
 4959|   110k|            inchi_calloc( sizeof( pINChI_Aux->nOrigAtNosInCanonOrd[0] ), num_at_tg ) ) &&
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
 4960|   110k|            ( pINChI_Aux->nConstitEquNumbers = (AT_NUMB*)
  ------------------
  |  Branch (4960:13): [True: 110k, False: 0]
  ------------------
 4961|   110k|              inchi_calloc( sizeof( pINChI_Aux->nConstitEquNumbers[0] ), num_at_tg ) ))
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
 4962|   110k|    {
 4963|   110k|        ;
 4964|   110k|    }
 4965|      0|    else
 4966|      0|    {
 4967|      0|        goto out_of_RAM;
 4968|      0|    }
 4969|       |
 4970|   110k|    if (num_at > 1 &&
  ------------------
  |  Branch (4970:9): [True: 811, False: 109k]
  ------------------
 4971|   110k|        ( pINChI_Aux->nConstitEquTGroupNumbers = (AT_NUMB*) inchi_calloc( sizeof( pINChI_Aux->nConstitEquTGroupNumbers[0] ), num_at / 2 + 1 ) ))
  ------------------
  |  | 1133|    811|#define inchi_calloc   calloc
  ------------------
  |  Branch (4971:9): [True: 811, False: 0]
  ------------------
 4972|    811|    {
 4973|    811|        ;
 4974|    811|    }
 4975|   109k|    else
 4976|   109k|    {
 4977|   109k|        if (num_at > 1)
  ------------------
  |  Branch (4977:13): [True: 0, False: 109k]
  ------------------
 4978|      0|        {
 4979|      0|            goto out_of_RAM;
 4980|      0|        }
 4981|   109k|    }
 4982|       |
 4983|   110k|    if (num_at > 0)
  ------------------
  |  Branch (4983:9): [True: 110k, False: 0]
  ------------------
 4984|   110k|    {
 4985|   110k|        pINChI_Aux->OrigInfo = (ORIG_INFO *) inchi_calloc( sizeof( pINChI_Aux->OrigInfo[0] ), num_at );
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
 4986|   110k|        if (!pINChI_Aux->OrigInfo)
  ------------------
  |  Branch (4986:13): [True: 0, False: 110k]
  ------------------
 4987|      0|            goto out_of_RAM;
 4988|   110k|    }
 4989|       |
 4990|   110k|    if (bOrigCoord && num_at > 0)
  ------------------
  |  Branch (4990:9): [True: 0, False: 110k]
  |  Branch (4990:23): [True: 0, False: 0]
  ------------------
 4991|      0|    {
 4992|      0|        pINChI_Aux->szOrigCoord = (MOL_COORD *) inchi_calloc( sizeof( pINChI_Aux->szOrigCoord[0] ), num_at );
  ------------------
  |  | 1133|      0|#define inchi_calloc   calloc
  ------------------
 4993|      0|        if (!pINChI_Aux->szOrigCoord)
  ------------------
  |  Branch (4993:13): [True: 0, False: 0]
  ------------------
 4994|      0|            goto out_of_RAM;
 4995|      0|    }
 4996|       |
 4997|   110k|    if (bIsotopic)
  ------------------
  |  Branch (4997:9): [True: 110k, False: 5]
  ------------------
 4998|   110k|    {
 4999|   110k|        if ( /*num_isotopic_atoms &&*/
 5000|   110k|            ( pINChI_Aux->nIsotopicOrigAtNosInCanonOrd = (AT_NUMB*) inchi_calloc( sizeof( pINChI_Aux->nIsotopicOrigAtNosInCanonOrd[0] ), num_at_tg ) ) &&
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
  |  Branch (5000:13): [True: 110k, False: 0]
  ------------------
 5001|   110k|             ( pINChI_Aux->nIsotopicOrigAtNosInCanonOrdInv = (AT_NUMB*) inchi_calloc( sizeof( pINChI_Aux->nIsotopicOrigAtNosInCanonOrd[0] ), num_at_tg ) ) &&
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
  |  Branch (5001:14): [True: 110k, False: 0]
  ------------------
 5002|   110k|             ( pINChI_Aux->nConstitEquIsotopicNumbers = (AT_NUMB*) inchi_calloc( sizeof( pINChI_Aux->nConstitEquIsotopicNumbers[0] ), num_at_tg ) ))
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
  |  Branch (5002:14): [True: 110k, False: 0]
  ------------------
 5003|   110k|        {
 5004|   110k|            ;
 5005|   110k|        }
 5006|      0|        else if (num_isotopic_atoms)
  ------------------
  |  Branch (5006:18): [True: 0, False: 0]
  ------------------
 5007|      0|        {
 5008|      0|            goto out_of_RAM;
 5009|      0|        }
 5010|       |
 5011|   110k|        if ( /*num_isotopic_atoms && num_at > 1 &&*/
 5012|   110k|            ( pINChI_Aux->nConstitEquIsotopicTGroupNumbers = (AT_NUMB*) inchi_calloc( sizeof( pINChI_Aux->nConstitEquIsotopicTGroupNumbers[0] ), num_at / 2 + 1 ) ))
  ------------------
  |  | 1133|   110k|#define inchi_calloc   calloc
  ------------------
  |  Branch (5012:13): [True: 110k, False: 0]
  ------------------
 5013|   110k|        {
 5014|   110k|            ;
 5015|   110k|        }
 5016|      0|        else if (num_isotopic_atoms && num_at > 1)
  ------------------
  |  Branch (5016:18): [True: 0, False: 0]
  |  Branch (5016:40): [True: 0, False: 0]
  ------------------
 5017|      0|        {
 5018|      0|            goto out_of_RAM;
 5019|      0|        }
 5020|   110k|    }
 5021|       |
 5022|   110k|    return pINChI_Aux;
 5023|       |
 5024|       |
 5025|      0|out_of_RAM:
 5026|       |
 5027|      0|    if (pINChI_Aux)
  ------------------
  |  Branch (5027:9): [True: 0, False: 0]
  ------------------
 5028|      0|    {
 5029|      0|        Free_INChI_Aux( &pINChI_Aux );
 5030|       |        /*
 5031|       |        inchi_free(pINChI_Aux);
 5032|       |        */
 5033|      0|    }
 5034|       |
 5035|      0|    return NULL;
 5036|   110k|}
imat_new:
 5062|    723|{
 5063|    723|    int i;   
 5064|    723|    if (m == 0 || n == 0)
  ------------------
  |  Branch (5064:9): [True: 1, False: 722]
  |  Branch (5064:19): [True: 0, False: 722]
  ------------------
 5065|      1|    {
 5066|      1|        return 0;
 5067|      1|    }
 5068|    722|    if (*a)
  ------------------
  |  Branch (5068:9): [True: 0, False: 722]
  ------------------
 5069|      0|    {
 5070|      0|        imat_free(m, *a);
 5071|      0|        *a = NULL;
 5072|      0|    }
 5073|    722|    *a = (int **) inchi_calloc( m, sizeof( int * ) );
  ------------------
  |  | 1133|    722|#define inchi_calloc   calloc
  ------------------
 5074|    722|    if (NULL == *a)
  ------------------
  |  Branch (5074:9): [True: 0, False: 722]
  ------------------
 5075|      0|    {
 5076|      0|        return 1;
 5077|      0|    }
 5078|  1.44k|    for (i = 0; i < m; i++)
  ------------------
  |  Branch (5078:17): [True: 722, False: 722]
  ------------------
 5079|    722|    {
 5080|    722|        ( *a )[i] = (int *) inchi_calloc( n, sizeof( int ) );
  ------------------
  |  | 1133|    722|#define inchi_calloc   calloc
  ------------------
 5081|    722|        if (NULL == ( *a )[i])
  ------------------
  |  Branch (5081:13): [True: 0, False: 722]
  ------------------
 5082|      0|        {
 5083|      0|            return 1;
 5084|      0|        }
 5085|    722|    }
 5086|    722|    return 0;
 5087|    722|}
imat_free:
 5093|    722|{
 5094|    722|    int i;
 5095|    722|    if (NULL != a)
  ------------------
  |  Branch (5095:9): [True: 722, False: 0]
  ------------------
 5096|    722|    {
 5097|  1.44k|        for (i = 0; i < m; i++)
  ------------------
  |  Branch (5097:21): [True: 722, False: 722]
  ------------------
 5098|    722|        {
 5099|    722|            if (NULL != a[i])
  ------------------
  |  Branch (5099:17): [True: 722, False: 0]
  ------------------
 5100|    722|            {
 5101|    722|                inchi_free( a[i] );
  ------------------
  |  | 1136|    722|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 722, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 5102|    722|            }
 5103|    722|        }
 5104|    722|        inchi_free( a );
  ------------------
  |  | 1136|    722|#define inchi_free(X)  do{ if(X) free(X); }while(0)
  |  |  ------------------
  |  |  |  Branch (1136:31): [True: 722, False: 0]
  |  |  |  Branch (1136:50): [Folded - Ignored]
  |  |  ------------------
  ------------------
 5105|    722|        a = NULL;
 5106|    722|    }
 5107|       |
 5108|    722|    return;
 5109|    722|}

get_element_chemical_symbol:
  275|   707k|{
  276|   707k|    nAtNum -= 1;
  277|       |
  278|   707k|    if (0 < nAtNum)
  ------------------
  |  Branch (278:9): [True: 707k, False: 0]
  ------------------
  279|   707k|    {
  280|   707k|        nAtNum += 2; /*  bypass D, T */
  281|   707k|    }
  282|       |
  283|   707k|    if (0 <= nAtNum && nAtNum < nElDataLen)
  ------------------
  |  Branch (283:9): [True: 707k, False: 0]
  |  Branch (283:24): [True: 707k, False: 0]
  ------------------
  284|   707k|    {
  285|       |        /* valid element symbol found */
  286|   707k|        strcpy( szElement, ElData[nAtNum].szElName );
  287|   707k|        return 0;
  288|   707k|    }
  289|       |
  290|       |    /* not found */
  291|      0|    strcpy( szElement, "??" );
  292|       |
  293|      0|    return -1;
  294|   707k|}
get_element_or_pseudoelement_symbol:
  304|   226k|{
  305|   226k|    nAtNum -= 1;
  306|       |
  307|   226k|    if (0 < nAtNum)
  ------------------
  |  Branch (307:9): [True: 226k, False: 2]
  ------------------
  308|   226k|    {
  309|   226k|        nAtNum += 2; /*  bypass D, T */
  310|   226k|    }
  311|       |
  312|   226k|    if (0 <= nAtNum && nAtNum < nElDataLen)
  ------------------
  |  Branch (312:9): [True: 226k, False: 0]
  |  Branch (312:24): [True: 226k, False: 0]
  ------------------
  313|   226k|    {
  314|       |        /* valid element symbol found */
  315|   226k|        strcpy( szElement, ElData[nAtNum].szElName );
  316|       |
  317|   226k|        if (!strcmp( szElement, "Zy" ))
  ------------------
  |  Branch (317:13): [True: 0, False: 226k]
  ------------------
  318|      0|        {
  319|      0|            strcpy( szElement, "Zz" );
  320|      0|        }
  321|       |
  322|   226k|        return 0;
  323|   226k|    }
  324|       |
  325|       |    /* not found */
  326|      0|    strcpy( szElement, "??" );
  327|       |
  328|      0|    return -1;
  329|   226k|}
el_number_in_internal_ref_table:
  334|   117k|{
  335|   117k|    int i;
  336|   117k|    const char *p;
  337|       |
  338|  13.5M|    for (i = 0; ( p = ElData[i].szElName )[0] && strcmp( p, elname ); i++)
  ------------------
  |  Branch (338:17): [True: 13.5M, False: 3]
  |  Branch (338:50): [True: 13.4M, False: 117k]
  ------------------
  339|  13.4M|    {
  340|  13.4M|        ;
  341|  13.4M|    }
  342|       |
  343|   117k|    return p[0] ? i : ERR_ELEM;
  ------------------
  |  Branch (343:12): [True: 117k, False: 3]
  ------------------
  344|   117k|}
get_periodic_table_number:
  351|   117k|{
  352|   117k|    int num;
  353|       |
  354|   117k|    num = el_number_in_internal_ref_table( elname );
  355|       |
  356|   117k|    if (num < ERR_ELEM)
  ------------------
  |  Branch (356:9): [True: 117k, False: 3]
  ------------------
  357|   117k|    {
  358|       |        /* account for D,T in internal table (but not Mendeleev's table) */
  359|   117k|        num = inchi_max( 1, num - 1 );
  ------------------
  |  |  166|   117k|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 11, False: 117k]
  |  |  ------------------
  ------------------
  360|   117k|    }
  361|       |
  362|   117k|    return num;
  363|   117k|}
if_skip_add_H:
  371|   762k|{
  372|   762k|    return
  373|   762k|        ElData[nPeriodicNum > 1 ? nPeriodicNum + 1 : 0].bSkipAddingH;
  ------------------
  |  Branch (373:16): [True: 762k, False: 0]
  ------------------
  374|   762k|}
get_el_valence:
  381|   578k|{
  382|   578k|    if (charge < MIN_ATOM_CHARGE || charge > MAX_ATOM_CHARGE || val_num >= MAX_NUM_VALENCES)
  ------------------
  |  |   51|  1.15M|#define MIN_ATOM_CHARGE        (-2)
  ------------------
                  if (charge < MIN_ATOM_CHARGE || charge > MAX_ATOM_CHARGE || val_num >= MAX_NUM_VALENCES)
  ------------------
  |  |   52|  1.15M|#define MAX_ATOM_CHARGE         2
  ------------------
                  if (charge < MIN_ATOM_CHARGE || charge > MAX_ATOM_CHARGE || val_num >= MAX_NUM_VALENCES)
  ------------------
  |  |   55|   578k|#define MAX_NUM_VALENCES        5                /* max. number + 1 to provide zero termination */
  ------------------
  |  Branch (382:9): [True: 0, False: 578k]
  |  Branch (382:37): [True: 0, False: 578k]
  |  Branch (382:65): [True: 0, False: 578k]
  ------------------
  383|      0|    {
  384|      0|        return 0;
  385|      0|    }
  386|       |
  387|   578k|    return
  388|   578k|        ElData[nPeriodicNum > 1 ? nPeriodicNum + 1 : 0].cValence[NEUTRAL_STATE + charge][val_num];
  ------------------
  |  |   53|   578k|#define NEUTRAL_STATE          (-MIN_ATOM_CHARGE)
  |  |  ------------------
  |  |  |  |   51|   578k|#define MIN_ATOM_CHARGE        (-2)
  |  |  ------------------
  ------------------
  |  Branch (388:16): [True: 578k, False: 2]
  ------------------
  389|   578k|}
get_unusual_el_valence:
  401|     40|{
  402|     40|    int i, num_found, chem_valence, rad_adj, known_chem_valence, exact_found;
  403|       |
  404|     40|    if (!num_bonds && !num_H)
  ------------------
  |  Branch (404:9): [True: 0, False: 40]
  |  Branch (404:23): [True: 0, False: 0]
  ------------------
  405|      0|    {
  406|      0|        return 0;
  407|      0|    }
  408|       |
  409|     40|    if (charge < MIN_ATOM_CHARGE || charge > MAX_ATOM_CHARGE)
  ------------------
  |  |   51|     80|#define MIN_ATOM_CHARGE        (-2)
  ------------------
                  if (charge < MIN_ATOM_CHARGE || charge > MAX_ATOM_CHARGE)
  ------------------
  |  |   52|     32|#define MAX_ATOM_CHARGE         2
  ------------------
  |  Branch (409:9): [True: 8, False: 32]
  |  Branch (409:37): [True: 0, False: 32]
  ------------------
  410|      8|    {
  411|      8|        if (bonds_valence == num_bonds)
  ------------------
  |  Branch (411:13): [True: 2, False: 6]
  ------------------
  412|      2|        {
  413|      2|            return 0; /* all single bonds */
  414|      2|        }
  415|      6|        return bonds_valence;
  416|      8|    }
  417|       |
  418|     32|    if (!get_el_valence( nPeriodicNum, charge, 0 ) && bonds_valence == num_bonds)
  ------------------
  |  Branch (418:9): [True: 0, False: 32]
  |  Branch (418:55): [True: 0, False: 0]
  ------------------
  419|      0|    {
  420|      0|        return 0;
  421|      0|    }
  422|       |
  423|     32|    chem_valence = bonds_valence + num_H;
  424|     32|    rad_adj = 0;
  425|     32|    num_found = 0;
  426|     32|    exact_found = 0;
  427|       |
  428|       |    /* Take into account a radical */
  429|     32|    if (radical == RADICAL_DOUBLET)
  ------------------
  |  |  104|     32|#define RADICAL_DOUBLET 2
  ------------------
  |  Branch (429:9): [True: 0, False: 32]
  ------------------
  430|      0|    {
  431|      0|        rad_adj = 1;
  432|      0|    }
  433|     32|    else if (radical == RADICAL_TRIPLET)
  ------------------
  |  |  105|     32|#define RADICAL_TRIPLET 3
  ------------------
  |  Branch (433:14): [True: 0, False: 32]
  ------------------
  434|      0|    {
  435|      0|        rad_adj = 2;
  436|      0|    }
  437|       |
  438|     32|    for (i = 0; i < MAX_NUM_VALENCES; i++)
  ------------------
  |  |   55|     32|#define MAX_NUM_VALENCES        5                /* max. number + 1 to provide zero termination */
  ------------------
  |  Branch (438:17): [True: 32, False: 0]
  ------------------
  439|     32|    {
  440|     32|        if (0 < ( known_chem_valence = get_el_valence( nPeriodicNum, charge, i ) - rad_adj ) &&
  ------------------
  |  Branch (440:13): [True: 32, False: 0]
  ------------------
  441|     32|             num_bonds <= known_chem_valence && known_chem_valence <= chem_valence)
  ------------------
  |  Branch (441:14): [True: 32, False: 0]
  |  Branch (441:49): [True: 32, False: 0]
  ------------------
  442|     32|        {
  443|     32|            num_found++;
  444|     32|            if (known_chem_valence == chem_valence)
  ------------------
  |  Branch (444:17): [True: 32, False: 0]
  ------------------
  445|     32|            {
  446|     32|                exact_found = 1;
  447|     32|                break;
  448|     32|            }
  449|     32|        }
  450|     32|    }
  451|       |
  452|     32|    return ( exact_found && 1 == num_found ) ? 0 : chem_valence;
  ------------------
  |  Branch (452:14): [True: 32, False: 0]
  |  Branch (452:29): [True: 32, False: 0]
  ------------------
  453|     32|}
needed_unusual_el_valence:
  466|   109k|{
  467|   109k|    int chem_valence, num_H_expected;
  468|   109k|    char szElement[4];
  469|       |
  470|       |    /*
  471|       |    if ( !num_bonds && !num_H )
  472|       |        return 0;
  473|       |    */
  474|       |
  475|   109k|    if (num_bonds && get_element_chemical_symbol( nPeriodicNum, szElement ) != -1)
  ------------------
  |  Branch (475:9): [True: 30, False: 109k]
  |  Branch (475:22): [True: 30, False: 0]
  ------------------
  476|     30|    {
  477|     30|        num_H_expected = get_num_H( szElement, 0, NULL, charge, radical, actual_bonds_valence, 0, 0, 0, 0 );
  478|     30|    }
  479|   109k|    else
  480|   109k|    {
  481|   109k|        num_H_expected = num_H;
  482|   109k|    }
  483|       |
  484|   109k|    chem_valence = bonds_valence + num_H;
  485|       |
  486|       |#if ( (BUILD_WITH_ENG_OPTIONS==1) && (SDF_OUTPUT_HETERO_VALENCE==1) )
  487|       |    if (nPeriodicNum == 1 && chem_valence != 1 /* H */ || nPeriodicNum == 6 && chem_valence != 4 /* C */ ||
  488|       |         nPeriodicNum != 1 && nPeriodicNum != 6 || charge || radical)
  489|       |    {
  490|       |        return chem_valence ? chem_valence : -1;
  491|       |    }
  492|       |    else
  493|       |    {
  494|       |        return 0;
  495|       |    }
  496|       |#else
  497|   109k|    {
  498|   109k|        int i, num_found, num_found_known, rad_adj, known_chem_valence, exact_found;
  499|       |
  500|   109k|        if (charge < MIN_ATOM_CHARGE || charge > MAX_ATOM_CHARGE ||
  ------------------
  |  |   51|   218k|#define MIN_ATOM_CHARGE        (-2)
  ------------------
                      if (charge < MIN_ATOM_CHARGE || charge > MAX_ATOM_CHARGE ||
  ------------------
  |  |   52|   218k|#define MAX_ATOM_CHARGE         2
  ------------------
  |  Branch (500:13): [True: 6, False: 109k]
  |  Branch (500:41): [True: 0, False: 109k]
  ------------------
  501|   109k|             !get_el_valence( nPeriodicNum, charge, 0 ) ||
  ------------------
  |  Branch (501:14): [True: 130, False: 109k]
  ------------------
  502|   109k|             if_skip_add_H( nPeriodicNum ) || bonds_valence != actual_bonds_valence ||
  ------------------
  |  Branch (502:14): [True: 108k, False: 526]
  |  Branch (502:47): [True: 0, False: 526]
  ------------------
  503|   109k|             num_H_expected != num_H)
  ------------------
  |  Branch (503:14): [True: 0, False: 526]
  ------------------
  504|   108k|        {
  505|   108k|            if (!num_H && !num_H_expected && bonds_valence == actual_bonds_valence)
  ------------------
  |  Branch (505:17): [True: 108k, False: 0]
  |  Branch (505:27): [True: 108k, False: 0]
  |  Branch (505:46): [True: 108k, False: 0]
  ------------------
  506|   108k|            {
  507|   108k|                return 0; /* no H */
  508|   108k|            }
  509|      0|            return chem_valence; /* needs to add H-atoms */
  510|   108k|        }
  511|       |
  512|       |        /* take into account radical */
  513|    526|        if (radical == RADICAL_DOUBLET)
  ------------------
  |  |  104|    526|#define RADICAL_DOUBLET 2
  ------------------
  |  Branch (513:13): [True: 0, False: 526]
  ------------------
  514|      0|        {
  515|      0|            rad_adj = 1;
  516|      0|        }
  517|    526|        else if (radical == RADICAL_TRIPLET)
  ------------------
  |  |  105|    526|#define RADICAL_TRIPLET 3
  ------------------
  |  Branch (517:18): [True: 0, False: 526]
  ------------------
  518|      0|        {
  519|      0|            rad_adj = 2;
  520|      0|        }
  521|    526|        else
  522|    526|        {
  523|    526|            rad_adj = 0;
  524|    526|        }
  525|       |
  526|    526|        num_found_known = 0;
  527|    526|        num_found = 0;
  528|    526|        exact_found = 0;
  529|       |
  530|  3.03k|        for (i = 0; i < MAX_NUM_VALENCES; i++)
  ------------------
  |  |   55|  3.03k|#define MAX_NUM_VALENCES        5                /* max. number + 1 to provide zero termination */
  ------------------
  |  Branch (530:21): [True: 2.53k, False: 502]
  ------------------
  531|  2.53k|        {
  532|  2.53k|            if (0 < ( known_chem_valence = get_el_valence( nPeriodicNum, charge, i ) ) &&
  ------------------
  |  Branch (532:17): [True: 1.07k, False: 1.46k]
  ------------------
  533|  2.53k|                 bonds_valence <= ( known_chem_valence -= rad_adj ))
  ------------------
  |  Branch (533:18): [True: 1.07k, False: 0]
  ------------------
  534|  1.07k|            {
  535|       |                /* found known valence that fits without H */
  536|  1.07k|                num_found_known++;
  537|  1.07k|                if (known_chem_valence <= chem_valence)
  ------------------
  |  Branch (537:21): [True: 24, False: 1.05k]
  ------------------
  538|     24|                {
  539|       |                    /* known valence is large enough to accommodate (implicit) H */
  540|     24|                    num_found++;
  541|     24|                }
  542|  1.07k|                if (known_chem_valence == chem_valence)
  ------------------
  |  Branch (542:21): [True: 24, False: 1.05k]
  ------------------
  543|     24|                {
  544|     24|                    exact_found = 1;
  545|     24|                    break;
  546|     24|                }
  547|  1.07k|            }
  548|  2.53k|        }
  549|       |
  550|    526|        return ( exact_found && 1 == num_found && 1 == num_found_known )
  ------------------
  |  Branch (550:18): [True: 24, False: 502]
  |  Branch (550:33): [True: 24, False: 0]
  |  Branch (550:51): [True: 24, False: 0]
  ------------------
  551|    526|            ? 0
  552|    526|            : chem_valence ? chem_valence : -1;    /* needs zero */
  ------------------
  |  Branch (552:15): [True: 0, False: 502]
  ------------------
  553|   109k|    }
  554|   109k|#endif
  555|   109k|}
detect_unusual_el_valence:
  567|   165k|{
  568|   165k|    int i, chem_valence, rad_adj, known_chem_valence;
  569|       |
  570|   165k|    if (!num_bonds && !num_H)
  ------------------
  |  Branch (570:9): [True: 165k, False: 323]
  |  Branch (570:23): [True: 165k, False: 0]
  ------------------
  571|   165k|    {
  572|   165k|        return 0;
  573|   165k|    }
  574|       |
  575|    323|    if (charge < MIN_ATOM_CHARGE || charge > MAX_ATOM_CHARGE)
  ------------------
  |  |   51|    646|#define MIN_ATOM_CHARGE        (-2)
  ------------------
                  if (charge < MIN_ATOM_CHARGE || charge > MAX_ATOM_CHARGE)
  ------------------
  |  |   52|    320|#define MAX_ATOM_CHARGE         2
  ------------------
  |  Branch (575:9): [True: 3, False: 320]
  |  Branch (575:37): [True: 0, False: 320]
  ------------------
  576|      3|    {
  577|      3|        if (bonds_valence == num_bonds)
  ------------------
  |  Branch (577:13): [True: 1, False: 2]
  ------------------
  578|      1|        {
  579|      1|            return 0; /* all single bonds */
  580|      1|        }
  581|      2|        return bonds_valence;
  582|      3|    }
  583|       |
  584|    320|    if (!get_el_valence( nPeriodicNum, charge, 0 ) && bonds_valence == num_bonds)
  ------------------
  |  Branch (584:9): [True: 0, False: 320]
  |  Branch (584:55): [True: 0, False: 0]
  ------------------
  585|      0|    {
  586|      0|        return 0;
  587|      0|    }
  588|       |
  589|    320|    chem_valence = bonds_valence + num_H;
  590|    320|    rad_adj = 0;
  591|       |
  592|       |    /* take into account radical */
  593|    320|    if (radical == RADICAL_DOUBLET)
  ------------------
  |  |  104|    320|#define RADICAL_DOUBLET 2
  ------------------
  |  Branch (593:9): [True: 0, False: 320]
  ------------------
  594|      0|    {
  595|      0|        rad_adj = 1;
  596|      0|    }
  597|    320|    else if (radical == RADICAL_TRIPLET || radical == RADICAL_SINGLET)
  ------------------
  |  |  105|    640|#define RADICAL_TRIPLET 3
  ------------------
                  else if (radical == RADICAL_TRIPLET || radical == RADICAL_SINGLET)
  ------------------
  |  |  103|    320|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (597:14): [True: 0, False: 320]
  |  Branch (597:44): [True: 0, False: 320]
  ------------------
  598|      0|    {
  599|      0|        rad_adj = 2;
  600|      0|    }
  601|       |
  602|    320|    for (i = 0; i < MAX_NUM_VALENCES; i++)
  ------------------
  |  |   55|    320|#define MAX_NUM_VALENCES        5                /* max. number + 1 to provide zero termination */
  ------------------
  |  Branch (602:17): [True: 320, False: 0]
  ------------------
  603|    320|    {
  604|    320|        if (0 < ( known_chem_valence = get_el_valence( nPeriodicNum, charge, i ) - rad_adj ))
  ------------------
  |  Branch (604:13): [True: 320, False: 0]
  ------------------
  605|    320|        {
  606|    320|            if (known_chem_valence == chem_valence)
  ------------------
  |  Branch (606:17): [True: 320, False: 0]
  ------------------
  607|    320|            {
  608|    320|                return 0;
  609|    320|            }
  610|    320|        }
  611|    320|    }
  612|       |
  613|      0|    return chem_valence;
  614|    320|}
get_el_type:
  621|     31|{
  622|     31|    return ElData[nPeriodicNum + 1].nType;
  623|     31|}
is_el_a_metal:
  630|  1.40M|{
  631|  1.40M|    return 0 != ( ElData[nPeriodicNum + 1].nType & IS_METAL );
  ------------------
  |  |  110|  1.40M|#define IS_METAL        3          /* metal bitmap */
  ------------------
  632|  1.40M|}
get_num_H:
  813|     30|{
  814|     30|    int val, i, el_number, num_H = 0, num_iso_H;
  815|     30|    static int intl_el_number_N = 0, intl_el_number_S=0, intl_el_number_O=0, intl_el_number_C=0;
  816|       |
  817|     30|    if (!intl_el_number_N)
  ------------------
  |  Branch (817:9): [True: 1, False: 29]
  ------------------
  818|      1|    {
  819|      1|        intl_el_number_N = el_number_in_internal_ref_table( "N" );
  820|      1|    }
  821|     30|    if (!intl_el_number_S)
  ------------------
  |  Branch (821:9): [True: 1, False: 29]
  ------------------
  822|      1|    {
  823|      1|        intl_el_number_S = el_number_in_internal_ref_table( "S" );
  824|      1|    }
  825|     30|    if (!intl_el_number_O)
  ------------------
  |  Branch (825:9): [True: 1, False: 29]
  ------------------
  826|      1|    {
  827|      1|        intl_el_number_O = el_number_in_internal_ref_table( "O" );
  828|      1|    }
  829|     30|    if (!intl_el_number_C)
  ------------------
  |  Branch (829:9): [True: 1, False: 29]
  ------------------
  830|      1|    {
  831|      1|        intl_el_number_C = el_number_in_internal_ref_table( "C" );
  832|      1|    }
  833|       |
  834|       |
  835|       |    /*  atom_input_valence (cValence) cannot be specified in case of */
  836|       |    /*  aliased MOLFile atom with known inp_num_H or inp_num_iso_H[] */
  837|       |
  838|     30|    if (bAliased)
  ------------------
  |  Branch (838:9): [True: 0, False: 30]
  ------------------
  839|      0|    {
  840|      0|        num_H = inp_num_H;
  841|      0|    }
  842|     30|    else if (atom_input_valence && ( atom_input_valence != 15 || chem_bonds_valence ))
  ------------------
  |  Branch (842:14): [True: 0, False: 30]
  |  Branch (842:38): [True: 0, False: 0]
  |  Branch (842:66): [True: 0, False: 0]
  ------------------
  843|      0|    {
  844|      0|        num_H = inchi_max( 0, atom_input_valence - chem_bonds_valence );
  ------------------
  |  |  166|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  845|      0|    }
  846|     30|    else if (atom_input_valence == 15 && !chem_bonds_valence)
  ------------------
  |  Branch (846:14): [True: 0, False: 30]
  |  Branch (846:42): [True: 0, False: 0]
  ------------------
  847|      0|    {
  848|      0|        num_H = 0;
  849|      0|    }
  850|     30|    else if (MIN_ATOM_CHARGE <= charge &&
  ------------------
  |  |   51|     30|#define MIN_ATOM_CHARGE        (-2)
  ------------------
  |  Branch (850:14): [True: 24, False: 6]
  ------------------
  851|     30|              MAX_ATOM_CHARGE >= charge &&
  ------------------
  |  |   52|     24|#define MAX_ATOM_CHARGE         2
  ------------------
  |  Branch (851:15): [True: 24, False: 0]
  ------------------
  852|     30|              ERR_ELEM != ( el_number = el_number_in_internal_ref_table( elname ) ) &&
  ------------------
  |  Branch (852:15): [True: 24, False: 0]
  ------------------
  853|     30|              !ElData[el_number].bSkipAddingH && !bDoNotAddH)
  ------------------
  |  Branch (853:15): [True: 24, False: 0]
  |  Branch (853:50): [True: 24, False: 0]
  ------------------
  854|     24|    {
  855|       |        /* add hydrogen atoms according to standard element valence */
  856|     24|        if (radical && radical != RADICAL_SINGLET)
  ------------------
  |  |  103|      0|#define RADICAL_SINGLET 1
  ------------------
  |  Branch (856:13): [True: 0, False: 24]
  |  Branch (856:24): [True: 0, False: 0]
  ------------------
  857|      0|        {
  858|      0|            if (val = ElData[el_number].cValence[NEUTRAL_STATE + charge][0])
  ------------------
  |  |   53|      0|#define NEUTRAL_STATE          (-MIN_ATOM_CHARGE)
  |  |  ------------------
  |  |  |  |   51|      0|#define MIN_ATOM_CHARGE        (-2)
  |  |  ------------------
  ------------------
  |  Branch (858:17): [True: 0, False: 0]
  ------------------
  859|      0|            {
  860|      0|                val -= ( radical == RADICAL_DOUBLET ) ? 1
  ------------------
  |  |  104|      0|#define RADICAL_DOUBLET 2
  ------------------
  |  Branch (860:24): [True: 0, False: 0]
  ------------------
  861|      0|                    : ( radical == RADICAL_SINGLET || radical == RADICAL_TRIPLET ) ? 2 : val;
  ------------------
  |  |  103|      0|#define RADICAL_SINGLET 1
  ------------------
                                  : ( radical == RADICAL_SINGLET || radical == RADICAL_TRIPLET ) ? 2 : val;
  ------------------
  |  |  105|      0|#define RADICAL_TRIPLET 3
  ------------------
  |  Branch (861:25): [True: 0, False: 0]
  |  Branch (861:55): [True: 0, False: 0]
  ------------------
  862|       |                /* if unknown radical then do not add H */
  863|      0|                num_H = inchi_max( 0, val - chem_bonds_valence );
  ------------------
  |  |  166|      0|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  864|      0|            }
  865|      0|        }
  866|     24|        else
  867|     24|        {
  868|       |            /* find the smallest valence that is greater than the sum of the chemical bond valences */
  869|     24|            for (i = 0;
  870|     24|                 ( val = ElData[el_number].cValence[NEUTRAL_STATE + charge][i] ) &&
  ------------------
  |  |   53|     24|#define NEUTRAL_STATE          (-MIN_ATOM_CHARGE)
  |  |  ------------------
  |  |  |  |   51|     24|#define MIN_ATOM_CHARGE        (-2)
  |  |  ------------------
  ------------------
  |  Branch (870:18): [True: 24, False: 0]
  ------------------
  871|     24|                 val < chem_bonds_valence;
  ------------------
  |  Branch (871:18): [True: 0, False: 24]
  ------------------
  872|     24|                 i++)
  873|      0|            {
  874|      0|                ;
  875|      0|            }
  876|       |
  877|       |            /* special case: do not add H to N(IV), S(III), S+(II), S-(II) */ /* S ions added 2004-05-10 */
  878|     24|            if (el_number == intl_el_number_N && !charge && !radical && val == 5)
  ------------------
  |  Branch (878:17): [True: 2, False: 22]
  |  Branch (878:50): [True: 0, False: 2]
  |  Branch (878:61): [True: 0, False: 0]
  |  Branch (878:73): [True: 0, False: 0]
  ------------------
  879|      0|            {
  880|      0|                val = 3;
  881|      0|            }
  882|       |            /*else if ( el_number == el_number_N && !charge && !radical && val == 3 &&
  883|       |                 chem_bonds_valence == 2 && bHasMetalNeighbor )
  884|       |              {
  885|       |              val = 2;
  886|       |              }
  887|       |            */
  888|     24|            else if (el_number == intl_el_number_S && !charge && !radical && val == 4 && chem_bonds_valence == 3)
  ------------------
  |  Branch (888:22): [True: 6, False: 18]
  |  Branch (888:55): [True: 0, False: 6]
  |  Branch (888:66): [True: 0, False: 0]
  |  Branch (888:78): [True: 0, False: 0]
  |  Branch (888:90): [True: 0, False: 0]
  ------------------
  889|      0|            {
  890|      0|                val = 3;
  891|      0|            }
  892|     24|            else if (bHasMetalNeighbor && el_number != intl_el_number_C && val > 0)
  ------------------
  |  Branch (892:22): [True: 0, False: 24]
  |  Branch (892:43): [True: 0, False: 0]
  |  Branch (892:76): [True: 0, False: 0]
  ------------------
  893|      0|            {
  894|      0|                val--;
  895|      0|            }
  896|       |            /*
  897|       |            if ( (el_number == el_number_S || el_number == el_number_O) &&
  898|       |                 abs(charge)==1 && !radical && val == 3 && chem_bonds_valence == 2 && bHasMetalNeighbor )
  899|       |              {
  900|       |              val = 2;
  901|       |              }
  902|       |            else
  903|       |            */
  904|       |
  905|     24|            num_H = inchi_max( 0, val - chem_bonds_valence );
  ------------------
  |  |  166|     24|#define inchi_max(a,b)  (((a)>(b))?(a):(b))
  |  |  ------------------
  |  |  |  Branch (166:26): [True: 0, False: 24]
  |  |  ------------------
  ------------------
  906|     24|        }
  907|       |
  908|     24|        num_iso_H = 0;
  909|     24|        if (inp_num_iso_H)
  ------------------
  |  Branch (909:13): [True: 0, False: 24]
  ------------------
  910|      0|        {
  911|      0|            for (i = 0; i < NUM_H_ISOTOPES; i++)
  ------------------
  |  |   53|      0|#define NUM_H_ISOTOPES        3  /* number of hydrogen isotopes: protium, deuterium, tritium */
  ------------------
  |  Branch (911:25): [True: 0, False: 0]
  ------------------
  912|      0|            {
  913|      0|                num_iso_H += inp_num_iso_H[i];
  914|      0|            }
  915|      0|        }
  916|       |
  917|       |        /*  should not happen because atom here is not aliased */
  918|     24|        if (num_iso_H)
  ------------------
  |  Branch (918:13): [True: 0, False: 24]
  ------------------
  919|      0|        {
  920|      0|            if (num_H >= num_iso_H)
  ------------------
  |  Branch (920:17): [True: 0, False: 0]
  ------------------
  921|      0|            {
  922|      0|                num_H -= num_iso_H;
  923|      0|            }
  924|      0|            else
  925|      0|            {
  926|      0|                num_H = inp_num_H; /*  as requested in the alias */
  927|       |                /* num_H = (num_iso_H - num_H) % 2; */ /*  keep unchanged parity of the total number of H atoms */
  928|      0|            }
  929|      0|        }
  930|       |
  931|       |        /*  should not happen because atom here is not aliased */
  932|     24|        if (inp_num_H > num_H)
  ------------------
  |  Branch (932:13): [True: 0, False: 24]
  ------------------
  933|      0|        {
  934|      0|            num_H = inp_num_H;  /*  as requested in the alias */
  935|       |            /* num_H = inp_num_H + (inp_num_H - num_H)%2; */ /*  keep unchanged parity of the number of non-isotopic H atoms */
  936|      0|        }
  937|     24|    }
  938|      6|    else
  939|      6|    {
  940|      6|        num_H = inp_num_H;
  941|      6|    }
  942|       |
  943|     30|    return num_H;
  944|     30|}
get_atomic_mass_from_elnum:
  949|     30|{
  950|     30|    nAtNum -= 1;
  951|       |
  952|     30|    if (0 < nAtNum)
  ------------------
  |  Branch (952:9): [True: 30, False: 0]
  ------------------
  953|     30|    {
  954|     30|        nAtNum += 2; /*  bypass D, T */
  955|     30|    }
  956|       |
  957|     30|    if (0 <= nAtNum && nAtNum < nElDataLen)
  ------------------
  |  Branch (957:9): [True: 30, False: 0]
  |  Branch (957:24): [True: 30, False: 0]
  ------------------
  958|     30|    {
  959|     30|        return (int) ElData[nAtNum].nAtMass;
  960|     30|    }
  961|       |
  962|      0|    return 0;
  963|     30|}
is_in_the_list:
 1001|     24|{
 1002|     36|    for (; nPathLen && *pathAtom != nNextAtom; nPathLen--, pathAtom++)
  ------------------
  |  Branch (1002:12): [True: 36, False: 0]
  |  Branch (1002:24): [True: 12, False: 24]
  ------------------
 1003|     12|    {
 1004|     12|        ;
 1005|     12|    }
 1006|     24|    return nPathLen ? pathAtom : NULL;
  ------------------
  |  Branch (1006:12): [True: 24, False: 0]
  ------------------
 1007|     24|}
num_of_H:
 1071|    128|{
 1072|    128|    static int el_number_H;
 1073|    128|    int    i, n, num_explicit_H = 0;
 1074|    128|    inp_ATOM *a = at + iat;
 1075|       |
 1076|    128|    if (!el_number_H)
  ------------------
  |  Branch (1076:9): [True: 1, False: 127]
  ------------------
 1077|      1|    {
 1078|      1|        el_number_H = get_periodic_table_number( "H" );
 1079|      1|    }
 1080|       |
 1081|    128|    for (i = 0; i < a->valence; i++)
  ------------------
  |  Branch (1081:17): [True: 0, False: 128]
  ------------------
 1082|      0|    {
 1083|      0|        n = a->neighbor[i];
 1084|      0|        num_explicit_H += ( 1 == at[n].valence && el_number_H == at[n].el_number );
  ------------------
  |  Branch (1084:29): [True: 0, False: 0]
  |  Branch (1084:51): [True: 0, False: 0]
  ------------------
 1085|      0|    }
 1086|       |
 1087|    128|    return num_explicit_H + NUMH( at, iat );
  ------------------
  |  |   88|    128|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|    128|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
 1088|    128|}
nNoMetalNumBonds:
 1173|     32|{
 1174|     32|    int i;
 1175|       |
 1176|     32|    inp_ATOM *a = at + at_no;
 1177|     32|    int num_H = NUMH( a, 0 );
  ------------------
  |  |   88|     32|#define NUMH(AT,N)     (AT[N].num_H+NUM_ISO_H(AT,N))
  |  |  ------------------
  |  |  |  |   87|     32|#define NUM_ISO_H(AT,N) (AT[N].num_iso_H[0]+AT[N].num_iso_H[1]+AT[N].num_iso_H[2])
  |  |  ------------------
  ------------------
 1178|     32|    int std_chem_bonds_valence = get_el_valence( a->el_number, a->charge, 0 );
 1179|       |
 1180|     32|    if (a->chem_bonds_valence + num_H > std_chem_bonds_valence)
  ------------------
  |  Branch (1180:9): [True: 0, False: 32]
  ------------------
 1181|      0|    {
 1182|      0|        int valence_to_metal = 0;
 1183|      0|        int num_bonds_to_metal = 0;
 1184|       |
 1185|      0|        for (i = 0; i < a->valence; i++)
  ------------------
  |  Branch (1185:21): [True: 0, False: 0]
  ------------------
 1186|      0|        {
 1187|      0|            if (is_el_a_metal( at[(int) a->neighbor[i]].el_number ))
  ------------------
  |  Branch (1187:17): [True: 0, False: 0]
  ------------------
 1188|      0|            {
 1189|      0|                if (( a->bond_type[i] & BOND_TYPE_MASK ) >= BOND_TYPE_ALTERN)
  ------------------
  |  |  217|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
                              if (( a->bond_type[i] & BOND_TYPE_MASK ) >= BOND_TYPE_ALTERN)
  ------------------
  |  |   63|      0|#define BOND_TYPE_ALTERN    4
  ------------------
  |  Branch (1189:21): [True: 0, False: 0]
  ------------------
 1190|      0|                {
 1191|      0|                    return a->valence; /* fall back */
 1192|      0|                }
 1193|      0|                num_bonds_to_metal++;
 1194|      0|                valence_to_metal += ( a->bond_type[i] & BOND_TYPE_MASK );
  ------------------
  |  |  217|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
 1195|      0|            }
 1196|      0|        }
 1197|       |
 1198|      0|        if (a->chem_bonds_valence + num_H - valence_to_metal == std_chem_bonds_valence)
  ------------------
  |  Branch (1198:13): [True: 0, False: 0]
  ------------------
 1199|      0|        {
 1200|       |            /* removing bonds to metal produces standard valence */
 1201|      0|            return a->valence - num_bonds_to_metal;
 1202|      0|        }
 1203|      0|    }
 1204|       |
 1205|     32|#if ( S_VI_O_PLUS_METAL_FIX_BOND == 1 )
 1206|     32|    else
 1207|     32|    {
 1208|     32|        if (1 == a->charge && 2 == get_endpoint_valence( a->el_number ) &&
  ------------------
  |  Branch (1208:13): [True: 0, False: 32]
  |  Branch (1208:31): [True: 0, False: 0]
  ------------------
 1209|     32|                a->chem_bonds_valence + num_H == std_chem_bonds_valence)
  ------------------
  |  Branch (1209:17): [True: 0, False: 0]
  ------------------
 1210|      0|        {
 1211|      0|            int valence_to_metal = 0;
 1212|      0|            int num_bonds_to_metal = 0;
 1213|      0|            for (i = 0; i < a->valence; i++)
  ------------------
  |  Branch (1213:25): [True: 0, False: 0]
  ------------------
 1214|      0|            {
 1215|      0|                if (is_el_a_metal( at[(int) a->neighbor[i]].el_number ))
  ------------------
  |  Branch (1215:21): [True: 0, False: 0]
  ------------------
 1216|      0|                {
 1217|      0|                    if (( a->bond_type[i] & BOND_TYPE_MASK ) >= BOND_TYPE_ALTERN)
  ------------------
  |  |  217|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
                                  if (( a->bond_type[i] & BOND_TYPE_MASK ) >= BOND_TYPE_ALTERN)
  ------------------
  |  |   63|      0|#define BOND_TYPE_ALTERN    4
  ------------------
  |  Branch (1217:25): [True: 0, False: 0]
  ------------------
 1218|      0|                    {
 1219|      0|                        return a->valence; /* fall back */
 1220|      0|                    }
 1221|      0|                    num_bonds_to_metal++;
 1222|      0|                    valence_to_metal += ( a->bond_type[i] & BOND_TYPE_MASK );
  ------------------
  |  |  217|      0|#define BOND_TYPE_MASK        0x0f
  ------------------
 1223|      0|                }
 1224|      0|            }
 1225|      0|            if (1 == valence_to_metal)
  ------------------
  |  Branch (1225:17): [True: 0, False: 0]
  ------------------
 1226|      0|            {
 1227|       |                /* removing bonds to metal produces standard valence */
 1228|      0|                return a->valence - num_bonds_to_metal;
 1229|      0|            }
 1230|      0|        }
 1231|     32|    }
 1232|     32|#endif
 1233|       |
 1234|     32|    return a->valence;
 1235|     32|}
get_endpoint_valence:
 1429|   676k|{
 1430|   676k|    static U_CHAR el_numb[6];
 1431|   676k|    static int len, len2;
 1432|   676k|    int i;
 1433|   676k|    int len3;
 1434|   676k|    if (!len)
  ------------------
  |  Branch (1434:9): [True: 1, False: 676k]
  ------------------
 1435|      1|    {
 1436|      1|        len3 = 0;
 1437|      1|        el_numb[len3++] = (U_CHAR) get_periodic_table_number( "O" );
 1438|      1|        el_numb[len3++] = (U_CHAR) get_periodic_table_number( "S" );
 1439|      1|        el_numb[len3++] = (U_CHAR) get_periodic_table_number( "Se" );
 1440|      1|        el_numb[len3++] = (U_CHAR) get_periodic_table_number( "Te" );
 1441|      1|        len2 = len3;
 1442|      1|        el_numb[len3++] = (U_CHAR) get_periodic_table_number( "N" );
 1443|      1|        len = len3;
 1444|      1|    }
 1445|  4.04M|    for (i = 0; i < len; i++)
  ------------------
  |  Branch (1445:17): [True: 3.37M, False: 671k]
  ------------------
 1446|  3.37M|    {
 1447|  3.37M|        if (el_numb[i] == el_number)
  ------------------
  |  Branch (1447:13): [True: 4.42k, False: 3.37M]
  ------------------
 1448|  4.42k|        {
 1449|  4.42k|            return i < len2 ? 2 : 3;
  ------------------
  |  Branch (1449:20): [True: 1.36k, False: 3.06k]
  ------------------
 1450|  4.42k|        }
 1451|  3.37M|    }
 1452|       |
 1453|   671k|    return 0;
 1454|   676k|}
extract_inchi_substring:
 1791|    283|{
 1792|    283|    size_t i;
 1793|    283|    const char *p;
 1794|    283|    char pp;
 1795|       |
 1796|       |
 1797|    283|    *buf = NULL;
 1798|       |
 1799|    283|    if (str == NULL)
  ------------------
  |  Branch (1799:9): [True: 0, False: 283]
  ------------------
 1800|      0|    {
 1801|      0|        return;
 1802|      0|    }
 1803|    283|    if (strlen( str ) < 1)
  ------------------
  |  Branch (1803:9): [True: 0, False: 283]
  ------------------
 1804|      0|    {
 1805|      0|        return;
 1806|      0|    }
 1807|       |
 1808|    283|    p = strstr( str, "InChI=" );
 1809|    283|    if (NULL == p)
  ------------------
  |  Branch (1809:9): [True: 0, False: 283]
  ------------------
 1810|      0|        return;
 1811|       |
 1812|  6.36M|    for (i = 0; i < slen; i++)
  ------------------
  |  Branch (1812:17): [True: 6.36M, False: 241]
  ------------------
 1813|  6.36M|    {
 1814|  6.36M|        pp = p[i];
 1815|       |
 1816|  6.36M|        if (pp >= 'A' && pp <= 'Z')   continue;
  ------------------
  |  Branch (1816:13): [True: 5.24M, False: 1.12M]
  |  Branch (1816:26): [True: 95.6k, False: 5.14M]
  ------------------
 1817|  6.26M|        if (pp >= 'a' && pp <= 'z')   continue;
  ------------------
  |  Branch (1817:13): [True: 5.14M, False: 1.12M]
  |  Branch (1817:26): [True: 5.14M, False: 2]
  ------------------
 1818|  1.12M|        if (pp >= '0' && pp <= '9')   continue;
  ------------------
  |  Branch (1818:13): [True: 603k, False: 517k]
  |  Branch (1818:26): [True: 551k, False: 51.8k]
  ------------------
 1819|   569k|        switch (pp)
 1820|   569k|        {
 1821|  89.7k|            case '(':
  ------------------
  |  Branch (1821:13): [True: 89.7k, False: 479k]
  ------------------
 1822|   167k|            case ')':
  ------------------
  |  Branch (1822:13): [True: 77.4k, False: 491k]
  ------------------
 1823|   168k|            case '*':
  ------------------
  |  Branch (1823:13): [True: 1.05k, False: 568k]
  ------------------
 1824|   169k|            case '+':
  ------------------
  |  Branch (1824:13): [True: 920, False: 568k]
  ------------------
 1825|   307k|            case ',':
  ------------------
  |  Branch (1825:13): [True: 137k, False: 431k]
  ------------------
 1826|   456k|            case '-':
  ------------------
  |  Branch (1826:13): [True: 149k, False: 420k]
  ------------------
 1827|   458k|            case '.':
  ------------------
  |  Branch (1827:13): [True: 2.29k, False: 566k]
  ------------------
 1828|   517k|            case '/':
  ------------------
  |  Branch (1828:13): [True: 58.9k, False: 510k]
  ------------------
 1829|   558k|            case ';':
  ------------------
  |  Branch (1829:13): [True: 41.3k, False: 527k]
  ------------------
 1830|   567k|            case '=':
  ------------------
  |  Branch (1830:13): [True: 8.57k, False: 560k]
  ------------------
 1831|   569k|            case '?':
  ------------------
  |  Branch (1831:13): [True: 1.91k, False: 567k]
  ------------------
 1832|   569k|            case '@':    continue;
  ------------------
  |  Branch (1832:13): [True: 0, False: 569k]
  ------------------
 1833|       |
 1834|     42|            default:    break;
  ------------------
  |  Branch (1834:13): [True: 42, False: 569k]
  ------------------
 1835|   569k|        }
 1836|       |
 1837|     42|        break;
 1838|   569k|    }
 1839|       |
 1840|    283|    *buf = (char*) inchi_calloc( i + 1, sizeof( char ) );
  ------------------
  |  | 1133|    283|#define inchi_calloc   calloc
  ------------------
 1841|    283|    memcpy( *buf, p, i );
 1842|    283|    ( *buf )[i] = '\0';
 1843|       |
 1844|    283|    return;
 1845|    283|}
inchi_memicmp:
 1898|  4.60k|{
 1899|  4.60k|    const U_CHAR *s1 = (const U_CHAR*) p1;
 1900|  4.60k|    const U_CHAR *s2 = (const U_CHAR*) p2;
 1901|  4.60k|    while (length--)
  ------------------
  |  Branch (1901:12): [True: 4.60k, False: 0]
  ------------------
 1902|  4.60k|    {
 1903|  4.60k|        if (*s1 == *s2 ||
  ------------------
  |  Branch (1903:13): [True: 0, False: 4.60k]
  ------------------
 1904|  4.60k|              __MYTOLOWER( (int) *s1 ) == __MYTOLOWER( (int) *s2 ))
  ------------------
  |  | 1893|  4.60k|#define __MYTOLOWER(c) ( ((c) >= 'A') && ((c) <= 'Z') ? ((c) - 'A' + 'a') : (c) )
  |  |  ------------------
  |  |  |  Branch (1893:26): [True: 4.60k, False: 0]
  |  |  |  Branch (1893:42): [True: 4.60k, False: 0]
  |  |  ------------------
  ------------------
                            __MYTOLOWER( (int) *s1 ) == __MYTOLOWER( (int) *s2 ))
  ------------------
  |  | 1893|  4.60k|#define __MYTOLOWER(c) ( ((c) >= 'A') && ((c) <= 'Z') ? ((c) - 'A' + 'a') : (c) )
  |  |  ------------------
  |  |  |  Branch (1893:26): [True: 4.60k, False: 0]
  |  |  |  Branch (1893:42): [True: 4.60k, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1904:15): [True: 0, False: 4.60k]
  ------------------
 1905|      0|        {
 1906|      0|            s1++;
 1907|      0|            s2++;
 1908|      0|        }
 1909|  4.60k|        else
 1910|  4.60k|        {
 1911|  4.60k|            return
 1912|  4.60k|                __MYTOLOWER( (int) *s1 ) - __MYTOLOWER( (int) *s2 );
  ------------------
  |  | 1893|  4.60k|#define __MYTOLOWER(c) ( ((c) >= 'A') && ((c) <= 'Z') ? ((c) - 'A' + 'a') : (c) )
  |  |  ------------------
  |  |  |  Branch (1893:26): [True: 4.60k, False: 0]
  |  |  |  Branch (1893:42): [True: 4.60k, False: 0]
  |  |  ------------------
  ------------------
                              __MYTOLOWER( (int) *s1 ) - __MYTOLOWER( (int) *s2 );
  ------------------
  |  | 1893|  4.60k|#define __MYTOLOWER(c) ( ((c) >= 'A') && ((c) <= 'Z') ? ((c) - 'A' + 'a') : (c) )
  |  |  ------------------
  |  |  |  Branch (1893:26): [True: 4.60k, False: 0]
  |  |  |  Branch (1893:42): [True: 4.60k, False: 0]
  |  |  ------------------
  ------------------
 1913|  4.60k|        }
 1914|  4.60k|    }
 1915|       |
 1916|      0|    return 0;
 1917|  4.60k|}
inchi_stricmp:
 1922|  26.2k|{
 1923|  35.7k|    while (*s1)
  ------------------
  |  Branch (1923:12): [True: 35.1k, False: 576]
  ------------------
 1924|  35.1k|    {
 1925|  35.1k|        if (*s1 == *s2 ||
  ------------------
  |  Branch (1925:13): [True: 8.92k, False: 26.2k]
  ------------------
 1926|  35.1k|              __MYTOLOWER( (int) *s1 ) == __MYTOLOWER( (int) *s2 ))
  ------------------
  |  | 1893|  26.2k|#define __MYTOLOWER(c) ( ((c) >= 'A') && ((c) <= 'Z') ? ((c) - 'A' + 'a') : (c) )
  |  |  ------------------
  |  |  |  Branch (1893:26): [True: 26.2k, False: 0]
  |  |  |  Branch (1893:42): [True: 25.6k, False: 576]
  |  |  ------------------
  ------------------
                            __MYTOLOWER( (int) *s1 ) == __MYTOLOWER( (int) *s2 ))
  ------------------
  |  | 1893|  26.2k|#define __MYTOLOWER(c) ( ((c) >= 'A') && ((c) <= 'Z') ? ((c) - 'A' + 'a') : (c) )
  |  |  ------------------
  |  |  |  Branch (1893:26): [True: 25.6k, False: 576]
  |  |  |  Branch (1893:42): [True: 25.0k, False: 576]
  |  |  ------------------
  ------------------
  |  Branch (1926:15): [True: 576, False: 25.6k]
  ------------------
 1927|  9.50k|        {
 1928|  9.50k|            s1++;
 1929|  9.50k|            s2++;
 1930|  9.50k|        }
 1931|  25.6k|        else
 1932|  25.6k|        {
 1933|  25.6k|            return
 1934|  25.6k|                __MYTOLOWER( (int) *s1 ) - __MYTOLOWER( (int) *s2 );
  ------------------
  |  | 1893|  25.6k|#define __MYTOLOWER(c) ( ((c) >= 'A') && ((c) <= 'Z') ? ((c) - 'A' + 'a') : (c) )
  |  |  ------------------
  |  |  |  Branch (1893:26): [True: 25.6k, False: 0]
  |  |  |  Branch (1893:42): [True: 25.6k, False: 0]
  |  |  ------------------
  ------------------
                              __MYTOLOWER( (int) *s1 ) - __MYTOLOWER( (int) *s2 );
  ------------------
  |  | 1893|  25.6k|#define __MYTOLOWER(c) ( ((c) >= 'A') && ((c) <= 'Z') ? ((c) - 'A' + 'a') : (c) )
  |  |  ------------------
  |  |  |  Branch (1893:26): [True: 25.0k, False: 576]
  |  |  |  Branch (1893:42): [True: 24.4k, False: 576]
  |  |  ------------------
  ------------------
 1935|  25.6k|        }
 1936|  35.1k|    }
 1937|       |
 1938|    576|    if (*s2)
  ------------------
  |  Branch (1938:9): [True: 0, False: 576]
  ------------------
 1939|      0|    {
 1940|      0|        return -1;
 1941|      0|    }
 1942|       |
 1943|    576|    return 0;
 1944|    576|}

LLVMFuzzerTestOneInput:
   27|    288|int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   28|       |
   29|    288|  if (size == kSizeMax)
  ------------------
  |  Branch (29:7): [True: 0, False: 288]
  ------------------
   30|      0|    return 0;
   31|       |
   32|    288|  char *szINCHISource = malloc(sizeof(char) * (size + 1));
   33|    288|  memcpy(szINCHISource, data, size);
   34|    288|  szINCHISource[size] = '\0'; // InChI string must be null-terminated
   35|       |
   36|       |  // Buffer lengths taken from InChI API reference, located at
   37|       |  // https://www.inchi-trust.org/download/104/InChI_API_Reference.pdf, page 24
   38|    288|  char szINCHIKey[28], szXtra1[65], szXtra2[65];
   39|    288|  GetINCHIKeyFromINCHI(szINCHISource, 0, 0, szINCHIKey, szXtra1, szXtra2);
   40|       |
   41|    288|  inchi_InputINCHI inpInChI;
   42|    288|  inpInChI.szInChI = szINCHISource;
   43|    288|  inpInChI.szOptions = NULL;
   44|       |
   45|    288|  inchi_Output out;
   46|    288|  GetINCHIfromINCHI(&inpInChI, &out);
   47|       |
   48|    288|  inchi_OutputStruct outStruct;
   49|    288|  GetStructFromINCHI(&inpInChI, &outStruct);
   50|       |
   51|    288|  free(szINCHISource);
   52|    288|  FreeINCHI(&out);
   53|    288|  FreeStructFromINCHI(&outStruct);
   54|       |
   55|    288|  return 0;
   56|    288|}

